Use common NRF52 begin() and deduplicate() startup reason init

Use a common begin() method that can be called from derived classes
to contain the shared initialization code.

Signed-off-by: Frieder Schrempf <frieder@fris.de>
This commit is contained in:
Frieder Schrempf
2025-12-09 15:00:08 +01:00
parent 87b0e432bb
commit 93d1560d14
41 changed files with 26 additions and 128 deletions

View File

@@ -24,8 +24,7 @@ static void disconnect_callback(uint16_t conn_handle, uint8_t reason)
void NanoG2Ultra::begin()
{
// for future use, sub-classes SHOULD call this from their begin()
startup_reason = BD_STARTUP_NORMAL;
NRF52Board::begin();
// set user button
pinMode(PIN_BUTTON1, INPUT);

View File

@@ -36,16 +36,11 @@
#define REAL_VBAT_MV_PER_LSB (VBAT_DIVIDER_COMP * VBAT_MV_PER_LSB)
class NanoG2Ultra : public NRF52Board {
protected:
uint8_t startup_reason;
public:
void begin();
uint16_t getBattMilliVolts() override;
bool startOTAUpdate(const char *id, char reply[]) override;
uint8_t getStartupReason() const override { return startup_reason; }
const char *getManufacturerName() const override { return "Nano G2 Ultra"; }
void powerOff() override {