pezi / dart_periphery

dart_periphery is a Dart port of the native c-periphery library
BSD 3-Clause "New" or "Revised" License
36 stars 9 forks source link

I2C send word error #25

Open frikadelki opened 2 months ago

frikadelki commented 2 months ago

This is a neat library. Big thanks for developing it! Hope to see it get back to active life some day.

I think there is an issue when sending words via i2c. Functions writeWord/writeWordReg https://github.com/pezi/dart_periphery/blob/d994099d99f7a4d9d22ecfe89e4b9cf2576d8f5e/lib/src/i2c.dart#L393 https://github.com/pezi/dart_periphery/blob/d994099d99f7a4d9d22ecfe89e4b9cf2576d8f5e/lib/src/i2c.dart#L410 use the following code to split bytes and send them separately. array = [wordValue | 0xff, wordValue >> 8]; The high byte gets sent ok, however the low byte gets OR'ed with 0xff, so 0xff always gets sent. I believe it should be & 0xff.