Hi @Gordon. I ran the I2C scanner script from the other thread, I don't get any positive results. If the address bits are shifted, wouldn't the scanner still find the devices?
@ClearMemory041063, good find. Actually I think this wasn't that hard. But there's a few pieces I'm uncertain of. Is this line a function? #define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
So my guess is it becomes this: function CHECK_BIT (val, pos) { return ((val) & (1<<(pos))); }
And the init_i2c function is puzzling to me. Looks like init_i2c("/dev/i2c-1"); is akin to calling I2C1.setup().
Looks like the substring function isn't being used, so fortunately I can take that out. The pointer stuff there is beyond me, but I'm guessing it works like slice().
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi @Gordon. I ran the I2C scanner script from the other thread, I don't get any positive results. If the address bits are shifted, wouldn't the scanner still find the devices?
@ClearMemory041063, good find. Actually I think this wasn't that hard. But there's a few pieces I'm uncertain of. Is this line a function?
#define CHECK_BIT(var,pos) ((var) & (1<<(pos)))
So my guess is it becomes this:
function CHECK_BIT (val, pos) { return ((val) & (1<<(pos))); }
And the
init_i2c
function is puzzling to me. Looks likeinit_i2c("/dev/i2c-1");
is akin to callingI2C1.setup()
.Looks like the
substring
function isn't being used, so fortunately I can take that out. The pointer stuff there is beyond me, but I'm guessing it works likeslice()
.Here's my first attempt at a rewrite.
https://gist.github.com/stokebrain/e7956dc7b5f1f62f3a54e1a820042526
(the
getliner()
function needs to be updated still)