28class TerraPins final :
public Pins {
31 const I2cPins& i2c()
const override {
return i2c_; }
33 const SpiPins& spi()
const override {
return spi_; }
35 const DisplayPins& display()
const override {
return display_; }
37 const ButtonPins& buttons()
const override {
return buttons_; }
39 const BatteryPins& battery()
const override {
return battery_; }
42 const I2cPins i2c_{{6, PinFunction::I2c}, {7, PinFunction::I2c}};
43 const SpiPins spi_{{8, PinFunction::Spi}, {10, PinFunction::Spi}, {-1, PinFunction::Spi}};
44 const DisplayPins display_{{5, PinFunction::Gpio, PinPull::None, PinActiveLevel::Low, PinDirection::Output},
45 {20, PinFunction::Gpio, PinPull::None, PinActiveLevel::High, PinDirection::Output},
46 {21, PinFunction::Gpio, PinPull::None, PinActiveLevel::Low, PinDirection::Output},
47 {9, PinFunction::Gpio, PinPull::None, PinActiveLevel::High, PinDirection::Input}};
48 const ButtonPins buttons_{{4, PinFunction::Gpio, PinPull::Up, PinActiveLevel::Low, PinDirection::Input},
49 {3, PinFunction::Gpio, PinPull::Up, PinActiveLevel::Low, PinDirection::Input}};
50 const BatteryPins battery_{{2, PinFunction::Adc, PinPull::None, PinActiveLevel::High, PinDirection::Input}, 2, 1};
61class BoardTerra :
public Board {
66 ~BoardTerra()
override =
default;
69 Result<void> init()
override;
71 const char* getName()
const override {
return getDeviceInfo().name; }
73 const DeviceInfo& getDeviceInfo()
const override;
75 const BoardConfig& getConfig()
const override {
return config_; }
77 const Pins& getPins()
const override {
return pins_; }
80 hal::IDisplay& getDisplay()
override {
return display_; }
82 hal::IRtc& getRtc()
override {
return rtc_; }
84 hal::IBattery& getBattery()
override {
return battery_; }
86 hal::IInput& getInput()
override {
return input_; }
88 hal::IBluetooth& getBluetooth()
override {
return bluetooth_; }
90 hal::ICompanionSource& getCompanionSource()
override {
return bluetooth_; }
92 hal::IWifiRadio& getWifi()
override {
return wifi_; }
94 hal::IPowerManagement& getPowerManagement()
override {
return powerManagement_; }
96 hal::IConsole& getConsole()
override {
return console_; }
97 hal::IHttpServer& getHttpServer()
override {
return web_; }
98 hal::IDnsServer& getDnsServer()
override {
return web_; }
99 hal::IHttpClient& getHttpClient()
override {
return httpClient_; }
100 hal::INtpTimeSource& getNtpTimeSource()
override {
return ntpTimeSource_; }
101 hal::IPlatformDiagnostics& getDiagnostics()
override {
return diagnostics_; }
104 uint32_t getUptimeMs()
const override;
106 void delayMs(uint32_t ms)
override;
108 void restart()
override;
111 static BoardTerra& instance();
116 drivers::display::Ssd1681Display display_;
118 hal::Esp32Battery battery_;
119 hal::Esp32Input input_;
120 hal::Esp32Bluetooth bluetooth_;
121 hal::Esp32Wifi wifi_;
122 hal::Esp32PowerManagement powerManagement_;
123 hal::Esp32UsbConsole console_;
124 hal::Esp32WebServer web_;
125 hal::Esp32HttpClient httpClient_;
126 hal::Esp32NtpTimeSource ntpTimeSource_;
127 hal::Esp32PlatformDiagnostics diagnostics_;
Definition application.h:10