Skip to content
Discussion options

You must be logged in to vote

Hi - yes, the reading individually from the FIFO isn't great - usually you could do a single large I2C read of n*2 bytes and that'd be ok, but the Puck.accelRd function was only really for convenience and doesn't handle this.

Instead, since the Puck uses software I2C anyway, you should be able to set up your own I2C instance and use that. Something like this should work:

let i2c  = new I2C();
i2c.setup({sda:D14, scl:D15, bitrate:10000000 });
//..
let data = i2c.readReg(106, FIFO_DATA_OUT_L, 2*n);
let i16 = new Int16Array(data.buffer); // convert 16 bits to something readable

I could extend Puck.accelRd to allow you to read more data, but that'd require you to install a new firmware.

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@gfwilliams
Comment options

@baldursigurds
Comment options

@baldursigurds
Comment options

@gfwilliams
Comment options

@baldursigurds
Comment options

Answer selected by baldursigurds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants