Proposed I2C driver and MOS API implementation #115
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
This proposed driver for I2C has the following API to user programs:
mos_i2c_open - to open the channel with a given frequency id (57.6Khz, 115.200Khz, 230Khz)
mos_i2c_close - to close the channel
mos_i2c_write - to send a I2C datagram to a given slave address, with length and pointer to a send buffer
mos_i2c_read - to read a I2C datagram from a given slave address, with length and pointer to a read buffer
Currently, the following functional limitations apply to the driver:
7bit addressing only
32byte datagram length maximum, aligning with several Linux driver implementations
Master (write/read) role only. Talking to sensors and displays uses this mode, but configuring the Agon as an I2C slave is not yet implemented
2sec arbitration timeout on the channel, allowing very slow sensors to reply before the channel times out, while not locking up the Agon if a sensor borks.
I'll publish example code to use this driver interface a.s.a.p.