Implemented I2C scanner app (#97)

This commit is contained in:
Ken Van Hoeylandt
2024-11-28 21:42:18 +01:00
committed by GitHub
parent 6094b9c3f2
commit 3f62ec2efa
19 changed files with 451 additions and 44 deletions
+8 -3
View File
@@ -3,6 +3,7 @@
/**
* This code is based on i2c_manager from https://github.com/ropg/i2c_manager/blob/master/i2c_manager/i2c_manager.c (original has MIT license)
*/
#include <Kernel.h>
#include "I2c.h"
#include "Log.h"
#include "Mutex.h"
@@ -81,15 +82,15 @@ bool isStarted(i2c_port_t port) {
return started;
}
bool read(i2c_port_t port, uint16_t address, uint32_t reg, uint8_t* buffer, uint16_t size) {
bool read(i2c_port_t port, uint16_t address, uint32_t reg, uint8_t* buffer, uint16_t size, TickType_t timeout) {
return false;
}
bool write(i2c_port_t port, uint16_t address, uint32_t reg, const uint8_t* buffer, uint16_t size) {
bool write(i2c_port_t port, uint16_t address, uint32_t reg, const uint8_t* buffer, uint16_t size, TickType_t timeout) {
return false;
}
TtStatus lock(i2c_port_t port, uint32_t timeout) {
TtStatus lock(i2c_port_t port, TickType_t timeout) {
return dataArray[port].mutex.acquire(timeout);
}
@@ -97,6 +98,10 @@ TtStatus unlock(i2c_port_t port) {
return dataArray[port].mutex.release();
}
bool masterCheckAddressForDevice(i2c_port_t port, uint8_t address, TickType_t timeout) {
return (rand()) % 25 == 0;
}
} // namespace
#endif