Improve I2C locking and implement I2C for TactilityC (#147)

I2C:
- Lock timeout set to reasonable times
- Check lock status in all functions
- Refactor lock/unlock to return `bool` values
- Implement functions in TactilityC
Other:
- Updated screenshots
This commit is contained in:
Ken Van Hoeylandt
2025-01-03 23:39:23 +01:00
committed by GitHub
parent a9e890a7f3
commit 7187e5e49e
13 changed files with 207 additions and 74 deletions
+5 -5
View File
@@ -88,15 +88,15 @@ bool write(i2c_port_t port, uint16_t address, uint32_t reg, const uint8_t* buffe
return false;
}
TtStatus lock(i2c_port_t port, TickType_t timeout) {
return dataArray[port].mutex.acquire(timeout);
bool lock(i2c_port_t port, TickType_t timeout) {
return dataArray[port].mutex.lock(timeout);
}
TtStatus unlock(i2c_port_t port) {
return dataArray[port].mutex.release();
bool unlock(i2c_port_t port) {
return dataArray[port].mutex.unlock();
}
bool masterCheckAddressForDevice(i2c_port_t port, uint8_t address, TickType_t timeout) {
bool masterHasDeviceAtAddress(i2c_port_t port, uint8_t address, TickType_t timeout) {
return (rand()) % 25 == 0;
}