More compact module sensors was added

This commit is contained in:
2024-01-05 23:21:31 +07:00
parent 89940fbec2
commit b86af180ab
9 changed files with 213 additions and 47 deletions

15
BoardI2C.h Normal file
View File

@@ -0,0 +1,15 @@
#include "Wire.h"
#include "board_pins.h"
#include "esp_log.h"
class BoardI2C : public TwoWire {
BoardI2C(bool loop_on_fail = true) : TwoWire(0) {
if (begin(I2C_SDA_PIN, I2C_SCL_PIN, 400000)) {
ESP_LOGI("I2CBus", "Bus initialized");
} else {
ESP_LOGE("I2CBus", "Failed to initialize the i2c software bus!");
while (loop_on_fail)
;
}
}
};