Added I2C settings app (#85)

This commit is contained in:
Ken Van Hoeylandt
2024-11-24 21:31:15 +01:00
committed by GitHub
parent d8731eaa17
commit c8f63adba4
19 changed files with 186 additions and 56 deletions
+3 -1
View File
@@ -1,7 +1,8 @@
#pragma once
#include "I2cCompat.h"
#include <CoreTypes.h>
#include "CoreTypes.h"
#include <string>
#include <vector>
namespace tt::hal::i2c {
@@ -13,6 +14,7 @@ typedef enum {
} InitMode;
typedef struct {
std::string name;
/** The port to operate on */
i2c_port_t port;
/** Whether this bus should be initialized when device starts up */
+3 -3
View File
@@ -39,7 +39,7 @@ bool init(const std::vector<i2c::Configuration>& configurations) {
return true;
}
static bool configure_locked(i2c_port_t port, const i2c_config_t& configuration) {
static bool configureLocked(i2c_port_t port, const i2c_config_t& configuration) {
Data& data = dataArray[port];
if (data.isStarted) {
TT_LOG_E(TAG, "(%d) Cannot reconfigure while interface is started", port);
@@ -55,7 +55,7 @@ static bool configure_locked(i2c_port_t port, const i2c_config_t& configuration)
esp_err_t configure(i2c_port_t port, const i2c_config_t& configuration) {
lock(port);
bool result = configure_locked(port, configuration);
bool result = configureLocked(port, configuration);
unlock(port);
return result;
}
@@ -64,7 +64,7 @@ bool start(i2c_port_t port) {
lock(port);
dataArray[port].isStarted = true;
unlock(port);
return false;
return true;
}
bool stop(i2c_port_t port) {