#pragma once #include #include #include #include class MeshtinyBoard : public NRF52BoardDCDC { protected: uint8_t btn_prev_state; public: MeshtinyBoard() : NRF52Board("Meshtiny OTA") {} void begin(); void onBeforeTransmit() override { if (ledManager) ledManager->onBeforeTransmit(); } void onAfterTransmit() override { if (ledManager) ledManager->onAfterTransmit(); } uint16_t getBattMilliVolts() override { int adcvalue = 0; analogReadResolution(12); analogReference(AR_INTERNAL_3_0); delay(10); adcvalue = analogRead(PIN_VBAT_READ); return (adcvalue * ADC_MULTIPLIER * AREF_VOLTAGE) / 4.096; } const char *getManufacturerName() const override { return "Meshtiny"; } void reboot() override { NVIC_SystemReset(); } void powerOff() override { #ifdef PIN_USER_BTN while (digitalRead(PIN_USER_BTN) == LOW) { delay(10); } #endif #ifdef PIN_3V3_EN pinMode(PIN_3V3_EN, OUTPUT); digitalWrite(PIN_3V3_EN, LOW); #endif if (ledManager) ledManager->powerOff(); #ifdef PIN_USER_BTN nrf_gpio_cfg_sense_input(g_ADigitalPinMap[PIN_USER_BTN], NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW); #endif sd_power_system_off(); } };