Are there any good examples of I2C polling floating around? There's only one I2C example included for the 2803x and it's based on interrupts. I know the application would probably work fine with interrupts, but I've never really used them before and now isn't a good time to learn. My project due date is approaching fast.
You see, I'm running a real-time flight application that needs to sample a few devices at every nth loop iteration. Since the control servos are controlled by such a slow signal (50 Hz), I can do each poll sequentially and simply wait for the data to come in each time.
Beyond that, I also need to do a few sequential writes at boot up. Similarly to the reads, I can transfer each message sequentially and simply wait for the transfer to finish on each one.
To be clear, this is a breakdown of what I want to do:
1.) Device boot up
2.) Send messages to each device containing the initialization data for various registers. Each transfer is expected to complete before the next one begins. No other logic is executed during this time.
3.) Once all initialization data has been sent, the device begins its main flight loop.
4.) Device 1 is polled. The flight loop pauses until the data transfer is complete. Same thing with Devices 2 and 3.
5.) The data from each device is used to adjust the servo controls appropriately.
6.) Return to step 3 to iterate through the loop once again.
If anyone could point me to some specific code examples that could shed some light on a good way to do this, I would very much appreciate it.
Thanks in advance!
--Daniel