Comment by whalesalad
5 days ago
Can anyone recommend a resource for how to (architecturally) handle communication with a device over i2c? That is where I am kinda stuck atm when it comes to programming a GPS device.
Backstory: at one point I was trying to use elixir/nerves on an rpi to manipulate a few sensor modules to try and produce a race lap timer for motorcycles: https://github.com/whalesalad/rabbit/blob/master/lib/rabbit/...
I bit off more than I could chew: learn elixir, learn i2c, and produce a novel library for controlling the ublox chip since nothing existed for Elixir.
But when it comes to managing the state of the device, reading/writing memory, etc.. that is all very foreign to me (I am used to sockets, http apis, etc) like request/response style interactions.
So it jumps into detail quickly and is written by a vendor but this is a pretty good guide handling the architecture and detail. See how read and writes use device and register addresses to issue requests, and responses are managed with clock pulses and bus arbitration.
https://www.ti.com/lit/pdf/sbaa565 [pdf]
thank you!
You might find some useful information on elinux.org here: https://elinux.org/Interfacing_with_I2C_Devices
Additionally, search on the wiki of i2c.