🚚 Moves firmware to src and include

This commit is contained in:
Rune Harlyk
2025-07-11 12:12:07 +02:00
committed by Rune Harlyk
parent 743aa073b7
commit a3be035f98
60 changed files with 2 additions and 3 deletions
@@ -0,0 +1,49 @@
#pragma once
#include <vector>
#include <ArduinoJson.h>
#include <template/state_result.h>
/*
* I2C software connection
*/
#ifndef SDA_PIN
#define SDA_PIN SDA
#endif
#ifndef SCL_PIN
#define SCL_PIN SCL
#endif
#ifndef I2C_FREQUENCY
#define I2C_FREQUENCY 1000000UL
#endif
class PinConfig {
public:
int pin;
String mode;
String type;
String role;
PinConfig(int p, String m, String t, String r) : pin(p), mode(m), type(t), role(r) {}
};
class PeripheralsConfiguration {
public:
int sda = SDA_PIN;
int scl = SCL_PIN;
long frequency = I2C_FREQUENCY;
std::vector<PinConfig> pins;
static void read(PeripheralsConfiguration &settings, JsonVariant &root) {
root["sda"] = settings.sda;
root["scl"] = settings.scl;
root["frequency"] = settings.frequency;
}
static StateUpdateResult update(JsonVariant &root, PeripheralsConfiguration &settings) {
settings.sda = root["sda"] | SDA_PIN;
settings.scl = root["scl"] | SCL_PIN;
settings.frequency = root["frequency"] | I2C_FREQUENCY;
return StateUpdateResult::CHANGED;
};
};