mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-01 10:21:59 +00:00
One nRF52840 variant shared across both radios, picked per env: Duo runs the LR1121, Uno the SX1262. Same PCB, only the radio and its DIO1 pin change. SuperIO adds the SH1107 OLED, GPS, buzzer and joystick. GPS is driven by the 3-position mode switch (Mode 2 = on), polled live the way thinknode_m1 does it. Five quick user-button presses power the unit off; a press wakes it back on (arms the button as an nRF52 GPIO SENSE source before SYSTEMOFF). Consolidates #2054 and andyshinn's shared-base/uno work, rebased on dev. Co-authored-by: lbibass <ewdries02@gmail.com> Co-authored-by: Andy Shinn <andys@andyshinn.as>
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
#include <Arduino.h>
|
|
#include <Wire.h>
|
|
|
|
#include "muzi_baseBoard.h"
|
|
|
|
#ifdef NRF52_POWER_MANAGEMENT
|
|
const PowerMgtConfig power_config = {
|
|
.lpcomp_ain_channel = PWRMGT_LPCOMP_AIN,
|
|
.lpcomp_refsel = PWRMGT_LPCOMP_REFSEL,
|
|
.voltage_bootlock = PWRMGT_VOLTAGE_BOOTLOCK
|
|
};
|
|
|
|
void muzi_baseBoard::initiateShutdown(uint8_t reason) {
|
|
// Disable LoRa module power before shutdown
|
|
if (reason == SHUTDOWN_REASON_LOW_VOLTAGE ||
|
|
reason == SHUTDOWN_REASON_BOOT_PROTECT) {
|
|
configureVoltageWake(power_config.lpcomp_ain_channel, power_config.lpcomp_refsel);
|
|
}
|
|
|
|
enterSystemOff(reason);
|
|
}
|
|
#endif // NRF52_POWER_MANAGEMENT
|
|
|
|
void muzi_baseBoard::begin() {
|
|
NRF52BoardDCDC::begin();
|
|
pinMode(PIN_VBAT_READ, INPUT);
|
|
#ifdef muzi_base_superIO
|
|
// 12V rail is only needed for the superIO display
|
|
pinMode(SCREEN_12V_ENABLE, OUTPUT);
|
|
digitalWrite(SCREEN_12V_ENABLE, HIGH); // Enable 12V power for SH1107 display
|
|
delay(250);
|
|
#endif
|
|
Wire.begin();
|
|
// delay(1000); // wait for display to initialize. otherwise it doesn't come up on boot.
|
|
|
|
#ifdef PIN_USER_BTN
|
|
pinMode(PIN_USER_BTN, INPUT_PULLUP);
|
|
#endif
|
|
pinMode(PIN_BUTTON1, INPUT_PULLUP);
|
|
pinMode(PIN_BUTTON2, INPUT_PULLUP);
|
|
pinMode(PIN_BUTTON3, INPUT_PULLUP);
|
|
pinMode(PIN_BUTTON4, INPUT_PULLUP);
|
|
pinMode(PIN_BUTTON5, INPUT_PULLUP);
|
|
pinMode(PIN_BUTTON6, INPUT_PULLUP);
|
|
|
|
// #if defined(PIN_BOARD_SDA) && defined(PIN_BOARD_SCL)
|
|
// Wire.setPins(PIN_BOARD_SDA, PIN_BOARD_SCL);
|
|
// #endif
|
|
#ifdef NRF52_POWER_MANAGEMENT
|
|
checkBootVoltage(&power_config);
|
|
#endif
|
|
}
|