Libavr32 i2c update

Slave code is very simple. Essentially, the slave first gets an event with the payload of the TX (up to three bytes - though I only send one). For the TXi, this sets the desired output that the Teletype wants to poll. Immediately after that the slave gets a request for a certain number of bytes (in this case, two) and returns the value for that input.

I was worried that there might be timing issues - but I’ve been able to pound the i2c bus requesting data from 8 different inputs and get really fast response rates (and the proper data) passing it through the Teletype and back out. Longer term it might make sense to cache the response for at least the length of a script to reduce redundant polling, but for now it seems to be working.

For most flexibility, the function would take an array for the the three packet.addr bytes and set the length based on how many the calling function was passing. I left it as-is for now.

Cheers!

b

without changing the TT code i have no control over how it’s sent but yeah, i think i should be able to just restore to a properly signed int on my end by casting to unsigned, unshifting and then casting to signed.

should probably just go ahead and fix it, but don’t want to be making changes in that area while you and @tehn are working on the new i2c protocol. if it doesn’t get fixed in the process i can take a look later!