From 5077fec0348e717fa93bd1879548fed03fcae52e Mon Sep 17 00:00:00 2001 From: Nathan Perry Date: Thu, 24 Oct 2024 00:25:25 -0400 Subject: test_fw: refactor --- test_fw/include/board.h | 20 ++++++++++++++++++++ test_fw/include/bringup.h | 18 ++++++++++++++++++ test_fw/include/veml.h | 8 ++++---- 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 test_fw/include/board.h create mode 100644 test_fw/include/bringup.h (limited to 'test_fw/include') diff --git a/test_fw/include/board.h b/test_fw/include/board.h new file mode 100644 index 0000000..3f4be82 --- /dev/null +++ b/test_fw/include/board.h @@ -0,0 +1,20 @@ +#pragma once + +#include + +constexpr auto SDA_PIN = 6, SCL_PIN = 23; + +constexpr auto SD_CS = 17, SD_SCK = 18, SD_MOSI = 19, SD_MISO = 20; +constexpr auto CARD_DETECT = 12; + +constexpr auto LSM_CS = 13, LSM_SCK = 10, LSM_MOSI = 11, LSM_MISO = 8; +constexpr auto LSM_INT1 = 4, LSM_INT2 = 5; + +constexpr auto LED_FAULT = 0, LED_CAPTURING = 1, LED_OTHER = 2, LED_STORAGE = 3; +constexpr auto I2S_DATA = 22, I2S_BCLK = 24, I2S_WS = 25; + +constexpr auto BME_ADDR = 0x76; + +#define SD_SPI SPI +#define LSM_SPI SPI1 + diff --git a/test_fw/include/bringup.h b/test_fw/include/bringup.h new file mode 100644 index 0000000..762a26a --- /dev/null +++ b/test_fw/include/bringup.h @@ -0,0 +1,18 @@ +#pragma once + +#include +#include + +namespace ocularium::bringup { + struct init_check + { + const String name; + bool (*f)(); + bool succeeded; + }; + + void startup_checks(const etl::span &checks); + void init_buses(); + void init_pins(); + void boot_animation(); +} diff --git a/test_fw/include/veml.h b/test_fw/include/veml.h index 89282c8..51345a9 100644 --- a/test_fw/include/veml.h +++ b/test_fw/include/veml.h @@ -50,9 +50,9 @@ namespace ocularium AmbientLightGain gain = AmbientLightGain::Eighth; IntegrationTime integration = IntegrationTime::Ms100; - uint16_t to_reg() const; + [[nodiscard]] uint16_t to_reg() const; - int32_t gain_factor() const + [[nodiscard]] int32_t gain_factor() const { int32_t gain = 0; @@ -122,8 +122,8 @@ namespace ocularium bool init(const Config& config = Config{}); - uint16_t chipid() const; - float lux() const; + [[nodiscard]] uint16_t chipid() const; + [[nodiscard]] float lux() const; void set_config(const Config& config); -- cgit v1.3.1