mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-10-06 01:18:05 +00:00
Address review feedback on Muzi Base support
- rename the board class and files to MuziBaseBoard
- uppercase the build flags (MUZI_BASE, MUZI_BASE_SUPERIO)
- name the superIO envs muzi_base_{duo,uno}_superIO_companion_radio_ble so
build.sh picks them up
- set MAX_CONTACTS to 350 like the other variants
- move the pin setup from initVariant() into MuziBaseBoard::begin()
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include <Arduino.h>
|
||||
#include <Wire.h>
|
||||
|
||||
#include "muzi_baseBoard.h"
|
||||
#include "MuziBaseBoard.h"
|
||||
|
||||
#ifdef NRF52_POWER_MANAGEMENT
|
||||
const PowerMgtConfig power_config = {
|
||||
@@ -10,7 +10,7 @@ const PowerMgtConfig power_config = {
|
||||
.voltage_bootlock = PWRMGT_VOLTAGE_BOOTLOCK
|
||||
};
|
||||
|
||||
void muzi_baseBoard::initiateShutdown(uint8_t reason) {
|
||||
void MuziBaseBoard::initiateShutdown(uint8_t reason) {
|
||||
// Disable LoRa module power before shutdown
|
||||
if (reason == SHUTDOWN_REASON_LOW_VOLTAGE ||
|
||||
reason == SHUTDOWN_REASON_BOOT_PROTECT) {
|
||||
@@ -21,14 +21,26 @@ void muzi_baseBoard::initiateShutdown(uint8_t reason) {
|
||||
}
|
||||
#endif // NRF52_POWER_MANAGEMENT
|
||||
|
||||
void muzi_baseBoard::begin() {
|
||||
void MuziBaseBoard::begin() {
|
||||
NRF52BoardDCDC::begin();
|
||||
pinMode(PIN_VBAT_READ, INPUT);
|
||||
#ifdef muzi_base_superIO
|
||||
pinMode(PIN_BATTERY_CHARGING, INPUT);
|
||||
pinMode(PIN_CHARGER_FAULT, INPUT);
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
digitalWrite(LED_PIN, LOW);
|
||||
// output latches default to HIGH, so pull these low right after enabling
|
||||
pinMode(BUZZER_PIN, OUTPUT);
|
||||
digitalWrite(BUZZER_PIN, LOW);
|
||||
// gps power is driven by the sensor manager (mode switch). off to start.
|
||||
pinMode(PIN_GPS_EN, OUTPUT);
|
||||
digitalWrite(PIN_GPS_EN, LOW);
|
||||
// 12V rail is only needed for the superIO display
|
||||
pinMode(SCREEN_12V_ENABLE, OUTPUT);
|
||||
#ifdef MUZI_BASE_SUPERIO
|
||||
digitalWrite(SCREEN_12V_ENABLE, HIGH); // Enable 12V power for SH1107 display
|
||||
delay(250);
|
||||
#else
|
||||
digitalWrite(SCREEN_12V_ENABLE, LOW);
|
||||
#endif
|
||||
Wire.begin();
|
||||
// delay(1000); // wait for display to initialize. otherwise it doesn't come up on boot.
|
||||
@@ -15,14 +15,14 @@
|
||||
#define MUZI_BASE_MFR_NAME "Muzi Base Duo"
|
||||
#endif
|
||||
|
||||
class muzi_baseBoard : public NRF52BoardDCDC {
|
||||
class MuziBaseBoard : public NRF52BoardDCDC {
|
||||
protected:
|
||||
#ifdef NRF52_POWER_MANAGEMENT
|
||||
void initiateShutdown(uint8_t reason) override;
|
||||
#endif
|
||||
|
||||
public:
|
||||
muzi_baseBoard() : NRF52Board(MUZI_BASE_OTA_NAME) {}
|
||||
MuziBaseBoard() : NRF52Board(MUZI_BASE_OTA_NAME) {}
|
||||
void begin();
|
||||
|
||||
#define BATTERY_SAMPLES 8
|
||||
@@ -17,7 +17,7 @@ build_flags = ${nrf52_base.build_flags}
|
||||
-I lib/nrf52/s140_nrf52_6.1.1_API/include/nrf52
|
||||
-I variants/muzi_base
|
||||
-I src/helpers/ui
|
||||
-D muzi_base
|
||||
-D MUZI_BASE
|
||||
-D NRF52_POWER_MANAGEMENT
|
||||
-D PIN_USER_BTN=PIN_BUTTON1
|
||||
-D USER_BTN_PRESSED=LOW
|
||||
@@ -106,7 +106,7 @@ board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${muzi_base_duo.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=500 ;can increase number of contacts since we have a ton of extra flash.
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
@@ -125,7 +125,7 @@ board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${muzi_base_duo.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=500 ;can increase number of contacts since we have a ton of extra flash.
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_TX_POWER=0
|
||||
@@ -150,7 +150,7 @@ extends = muzi_base_duo
|
||||
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${muzi_base_duo.build_flags}
|
||||
-D muzi_base_superIO
|
||||
-D MUZI_BASE_SUPERIO
|
||||
-D UI_HAS_JOYSTICK=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D DISPLAY_CLASS=SH1107Display
|
||||
@@ -174,12 +174,12 @@ lib_deps = ${muzi_base_duo.lib_deps}
|
||||
debug_tool = jlink
|
||||
upload_protocol = nrfutil
|
||||
|
||||
[env:muzi_base_duo_companion_radio_ble_superIO]
|
||||
[env:muzi_base_duo_superIO_companion_radio_ble]
|
||||
extends = muzi_base_duo_superIO
|
||||
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${muzi_base_duo_superIO.build_flags}
|
||||
-D MAX_CONTACTS=500 ; can increase number of contacts since we have a ton of extra flash.
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-I examples/companion_radio/ui-new
|
||||
-D BLE_PIN_CODE=123456
|
||||
@@ -235,7 +235,7 @@ board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${muzi_base_uno.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=500 ;can increase number of contacts since we have a ton of extra flash.
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
; -D MESH_PACKET_LOGGING=1
|
||||
; -D MESH_DEBUG=1
|
||||
@@ -254,7 +254,7 @@ board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${muzi_base_uno.build_flags}
|
||||
-I examples/companion_radio/ui-new
|
||||
-D MAX_CONTACTS=500 ;can increase number of contacts since we have a ton of extra flash.
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-D BLE_PIN_CODE=123456
|
||||
-D BLE_TX_POWER=0
|
||||
@@ -279,7 +279,7 @@ extends = muzi_base_uno
|
||||
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${muzi_base_uno.build_flags}
|
||||
-D muzi_base_superIO
|
||||
-D MUZI_BASE_SUPERIO
|
||||
-D UI_HAS_JOYSTICK=1
|
||||
-D OFFLINE_QUEUE_SIZE=256
|
||||
-D DISPLAY_CLASS=SH1107Display
|
||||
@@ -303,12 +303,12 @@ lib_deps = ${muzi_base_uno.lib_deps}
|
||||
debug_tool = jlink
|
||||
upload_protocol = nrfutil
|
||||
|
||||
[env:muzi_base_uno_companion_radio_ble_superIO]
|
||||
[env:muzi_base_uno_superIO_companion_radio_ble]
|
||||
extends = muzi_base_uno_superIO
|
||||
board_build.ldscript = boards/nrf52840_s140_v6_extrafs.ld
|
||||
board_upload.maximum_size = 708608
|
||||
build_flags = ${muzi_base_uno_superIO.build_flags}
|
||||
-D MAX_CONTACTS=500 ; can increase number of contacts since we have a ton of extra flash.
|
||||
-D MAX_CONTACTS=350
|
||||
-D MAX_GROUP_CHANNELS=40
|
||||
-I examples/companion_radio/ui-new
|
||||
-D BLE_PIN_CODE=123456
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "target.h"
|
||||
#include "variant.h"
|
||||
|
||||
muzi_baseBoard board;
|
||||
MuziBaseBoard board;
|
||||
|
||||
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY, SPI);
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#define RADIOLIB_STATIC_ONLY 1
|
||||
#include <RadioLib.h>
|
||||
#include <helpers/radiolib/RadioLibWrappers.h>
|
||||
#include "muzi_baseBoard.h"
|
||||
#include "MuziBaseBoard.h"
|
||||
#if defined(USE_LR1121)
|
||||
#include <helpers/radiolib/CustomLR1121Wrapper.h>
|
||||
#elif defined(USE_SX1262)
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <helpers/ui/MomentaryButton.h>
|
||||
|
||||
|
||||
#ifdef muzi_base_superIO
|
||||
#ifdef MUZI_BASE_SUPERIO
|
||||
#include <helpers/ui/SH1107Display.h>
|
||||
extern DISPLAY_CLASS display;
|
||||
extern MomentaryButton user_btn;
|
||||
@@ -32,7 +32,7 @@
|
||||
extern MomentaryButton user_btn;
|
||||
#endif
|
||||
|
||||
extern muzi_baseBoard board;
|
||||
extern MuziBaseBoard board;
|
||||
extern WRAPPER_CLASS radio_driver;
|
||||
extern AutoDiscoverRTCClock rtc_clock;
|
||||
|
||||
|
||||
@@ -60,31 +60,3 @@ const uint32_t g_ADigitalPinMap[PINS_COUNT + 1] =
|
||||
46,
|
||||
47,
|
||||
};
|
||||
|
||||
void initVariant()
|
||||
{
|
||||
// All pins output HIGH by default.
|
||||
// https://github.com/Seeed-Studio/Adafruit_nRF52_Arduino/blob/fab7d30a997a1dfeef9d1d59bfb549adda73815a/cores/nRF5/wiring.c#L65-L69
|
||||
|
||||
pinMode(PIN_VBAT_READ, INPUT);
|
||||
pinMode(PIN_BATTERY_CHARGING, INPUT);
|
||||
pinMode(PIN_CHARGER_FAULT, INPUT);
|
||||
pinMode(PIN_BUTTON1, INPUT);
|
||||
pinMode(PIN_BUTTON2, INPUT);
|
||||
pinMode(PIN_BUTTON3, INPUT);
|
||||
pinMode(PIN_BUTTON4, INPUT);
|
||||
pinMode(PIN_BUTTON5, INPUT);
|
||||
pinMode(PIN_BUTTON6, INPUT);
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
pinMode(LED_BLUE, OUTPUT);
|
||||
digitalWrite(LED_PIN, LOW);
|
||||
digitalWrite(LED_BLUE, LOW);
|
||||
pinMode(BUZZER_PIN, OUTPUT);
|
||||
digitalWrite(BUZZER_PIN, LOW); // turn off buzzer at start. don't leave it high.
|
||||
// gps power is driven by the sensor manager (mode switch). off to start.
|
||||
pinMode(PIN_GPS_EN, OUTPUT);
|
||||
digitalWrite(PIN_GPS_EN, LOW);
|
||||
|
||||
pinMode(SCREEN_12V_ENABLE, OUTPUT);
|
||||
digitalWrite(SCREEN_12V_ENABLE, LOW); // disable 12V power for SH1107 display for now.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user