CarletonURocketry / fetcher

A QNX process for fetching data from sensors over I2C.
https://carletonurocketry.github.io/fetcher/
MIT License
1 stars 0 forks source link

I2C lock #27

Closed linguini1 closed 4 months ago

linguini1 commented 4 months ago

This PR implements the locking and unlocking of the I2C bus mutex to allow for the eventual implementation of multi-threading.

Certain functions in the sensor drivers that use the I2C bus do not lock it, simply because they are functions that are meant to be called in sequence or multiple times (i.e. multiple calls to read byte for extracting data). These functions are marked with WARNING in their docstrings so that callers are aware that they must lock the I2C bus before performing a collection of these calls. This reduces overhead.