Add basic samd class

This commit is contained in:
jacqueline
2023-05-18 18:17:14 +10:00
parent d71f726c42
commit b320a6a863
5 changed files with 168 additions and 1 deletions
+11
View File
@@ -31,6 +31,7 @@
#include "gpio_expander.hpp"
#include "i2c.hpp"
#include "lvgl_task.hpp"
#include "samd.hpp"
#include "spi.hpp"
#include "storage.hpp"
#include "touchwheel.hpp"
@@ -48,6 +49,16 @@ extern "C" void app_main(void) {
ESP_LOGI(TAG, "Init GPIOs");
drivers::GpioExpander* expander = drivers->AcquireGpios();
ESP_LOGI(TAG, "Init SAMD comms");
drivers::Samd samd;
ESP_LOGI(TAG, "It might have worked? Let's read something!");
auto res = samd.ReadChargeStatus();
if (res) {
ESP_LOGI(TAG, "Charge status is %d", static_cast<uint8_t>(*res));
} else {
ESP_LOGI(TAG, "no charge status?");
}
ESP_LOGI(TAG, "Enable power rails for development");
expander->with(
[&](auto& gpio) { gpio.set_pin(drivers::GpioExpander::AMP_EN, 1); });