mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-10-06 07:47:46 +00:00
- 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()
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <MeshCore.h>
|
|
#include <Arduino.h>
|
|
#include <helpers/NRF52Board.h>
|
|
|
|
// The Muzi Base PCB ships in two radio flavors. Keep the user-facing identity
|
|
// (OTA/DFU name and reported manufacturer) distinct per radio even though the
|
|
// board logic is shared.
|
|
#if defined(USE_SX1262)
|
|
#define MUZI_BASE_OTA_NAME "MUZI_BASE_UNO_OTA"
|
|
#define MUZI_BASE_MFR_NAME "Muzi Base Uno"
|
|
#else
|
|
#define MUZI_BASE_OTA_NAME "MUZI_BASE_DUO_OTA"
|
|
#define MUZI_BASE_MFR_NAME "Muzi Base Duo"
|
|
#endif
|
|
|
|
class MuziBaseBoard : public NRF52BoardDCDC {
|
|
protected:
|
|
#ifdef NRF52_POWER_MANAGEMENT
|
|
void initiateShutdown(uint8_t reason) override;
|
|
#endif
|
|
|
|
public:
|
|
MuziBaseBoard() : NRF52Board(MUZI_BASE_OTA_NAME) {}
|
|
void begin();
|
|
|
|
#define BATTERY_SAMPLES 8
|
|
|
|
uint16_t getBattMilliVolts() override {
|
|
analogReadResolution(12);
|
|
analogReference(AR_INTERNAL_3_0);
|
|
delay(1);
|
|
|
|
uint32_t raw = 0;
|
|
for (int i = 0; i < BATTERY_SAMPLES; i++) {
|
|
raw += analogRead(PIN_VBAT_READ);
|
|
}
|
|
raw = raw / BATTERY_SAMPLES;
|
|
|
|
// ADC_MULTIPLIER is the voltage divider ratio
|
|
return (raw * ADC_MULTIPLIER * AREF_VOLTAGE) / 4.096;
|
|
}
|
|
|
|
const char* getManufacturerName() const override {
|
|
return MUZI_BASE_MFR_NAME;
|
|
}
|
|
};
|