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:
@@ -7,8 +7,7 @@
|
||||
static BLEDfu bledfu;
|
||||
|
||||
void PromicroBoard::begin() {
|
||||
// for future use, sub-classes SHOULD call this from their begin()
|
||||
startup_reason = BD_STARTUP_NORMAL;
|
||||
NRF52Board::begin();
|
||||
btn_prev_state = HIGH;
|
||||
|
||||
pinMode(PIN_VBAT_READ, INPUT);
|
||||
|
||||
@@ -22,15 +22,12 @@
|
||||
|
||||
class PromicroBoard : public NRF52Board {
|
||||
protected:
|
||||
uint8_t startup_reason;
|
||||
uint8_t btn_prev_state;
|
||||
float adc_mult = ADC_MULTIPLIER;
|
||||
|
||||
public:
|
||||
void begin();
|
||||
|
||||
uint8_t getStartupReason() const override { return startup_reason; }
|
||||
|
||||
#define BATTERY_SAMPLES 8
|
||||
|
||||
uint16_t getBattMilliVolts() override {
|
||||
|
||||
Reference in New Issue
Block a user