Omit unsupported regulator vtable slots on integrated STM32WL
This commit is contained in:
1 parent
758004373d
commit
a886f618f1
6 files changed
+133
-15
No files matched your search
+4
-4
@@ -37,12 +37,12 @@ public:
|
||||
*/
|
||||
class Radio {
|
||||
public:
|
||||
virtual uint8_t regulatorModes() const { return 0; }
|
||||
virtual power::RegulatorMode defaultRegulatorMode() const { return power::RegulatorMode::Default; }
|
||||
MESH_REGULATOR_VIRTUAL uint8_t regulatorModes() const { return 0; }
|
||||
MESH_REGULATOR_VIRTUAL power::RegulatorMode defaultRegulatorMode() const { return power::RegulatorMode::Default; }
|
||||
// Cache a selection before the first hardware initialization. Save later
|
||||
// choices for the next reboot; never change a live RX/TX regulator here.
|
||||
virtual bool configureBootRegulator(power::RegulatorMode) { return false; }
|
||||
virtual power::RegulatorMode activeRegulatorMode() const { return power::RegulatorMode::Default; }
|
||||
MESH_REGULATOR_VIRTUAL bool configureBootRegulator(power::RegulatorMode) { return false; }
|
||||
MESH_REGULATOR_VIRTUAL power::RegulatorMode activeRegulatorMode() const { return power::RegulatorMode::Default; }
|
||||
static constexpr uint32_t CarrierWaveDefaultMillis = 10000;
|
||||
static constexpr uint32_t CarrierWaveMaxMillis = 60000;
|
||||
virtual bool supportsCarrierWave() const { return false; }
|
||||
|
||||
+4
-4
@@ -146,12 +146,12 @@ public:
|
||||
virtual void onBeforeTransmit() { }
|
||||
virtual void onAfterTransmit() { }
|
||||
virtual void reboot() = 0;
|
||||
virtual uint8_t mcuRegulatorModes() const { return 0; }
|
||||
virtual power::RegulatorMode defaultMcuRegulatorMode() const {
|
||||
MESH_REGULATOR_VIRTUAL uint8_t mcuRegulatorModes() const { return 0; }
|
||||
MESH_REGULATOR_VIRTUAL power::RegulatorMode defaultMcuRegulatorMode() const {
|
||||
return power::RegulatorMode::Default;
|
||||
}
|
||||
virtual bool applyMcuRegulator(power::RegulatorMode) { return false; }
|
||||
virtual power::RegulatorMode activeMcuRegulatorMode() const {
|
||||
MESH_REGULATOR_VIRTUAL bool applyMcuRegulator(power::RegulatorMode) { return false; }
|
||||
MESH_REGULATOR_VIRTUAL power::RegulatorMode activeMcuRegulatorMode() const {
|
||||
return power::RegulatorMode::Default;
|
||||
}
|
||||
// Reboot into a UF2-capable bootloader when the platform supports the
|
||||
|
||||
@@ -1,6 +1,24 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
// The current integrated STM32WL driver has no selectable supply domain:
|
||||
// MCU and radio share a regulator and need coordinated support first. Keep
|
||||
// its unsupported defaults out of every board/radio vtable as well as the
|
||||
// settings implementation. Other drivers/platforms retain virtual dispatch.
|
||||
#define MESH_REGULATOR_FIXED_RADIO_CustomSTM32WLx 1
|
||||
#define MESH_REGULATOR_FIXED_RADIO_I(type) MESH_REGULATOR_FIXED_RADIO_##type
|
||||
#define MESH_REGULATOR_FIXED_RADIO(type) MESH_REGULATOR_FIXED_RADIO_I(type)
|
||||
#if defined(STM32_PLATFORM) && MESH_REGULATOR_FIXED_RADIO(RADIO_CLASS)
|
||||
#define MESH_REGULATOR_FIXED_SUPPLY 1
|
||||
#define MESH_REGULATOR_VIRTUAL
|
||||
#else
|
||||
#define MESH_REGULATOR_FIXED_SUPPLY 0
|
||||
#define MESH_REGULATOR_VIRTUAL virtual
|
||||
#endif
|
||||
#undef MESH_REGULATOR_FIXED_RADIO
|
||||
#undef MESH_REGULATOR_FIXED_RADIO_I
|
||||
#undef MESH_REGULATOR_FIXED_RADIO_CustomSTM32WLx
|
||||
|
||||
namespace mesh { namespace power {
|
||||
|
||||
enum class RegulatorMode : uint8_t { Default = 0, Dcdc = 1, Ldo = 2 };
|
||||
|
||||
@@ -17,10 +17,7 @@
|
||||
// nRF52 plus an external radio. Do not retain the unreachable persistence and
|
||||
// recovery machinery on these flash-constrained targets. Match this exact
|
||||
// driver: an STM32 target with a different radio keeps the ordinary path.
|
||||
#define MESH_REGULATOR_FIXED_RADIO_CustomSTM32WLx 1
|
||||
#define MESH_REGULATOR_FIXED_RADIO_I(type) MESH_REGULATOR_FIXED_RADIO_##type
|
||||
#define MESH_REGULATOR_FIXED_RADIO(type) MESH_REGULATOR_FIXED_RADIO_I(type)
|
||||
#if defined(STM32_PLATFORM) && MESH_REGULATOR_FIXED_RADIO(RADIO_CLASS)
|
||||
#if MESH_REGULATOR_FIXED_SUPPLY
|
||||
namespace mesh { namespace power {
|
||||
bool beginRegulatorSettings(MainBoard&, Radio&, FILESYSTEM*) { return true; }
|
||||
void serviceRegulatorSettings() {}
|
||||
@@ -320,9 +317,6 @@ void resumeRegulatorRecovery() {
|
||||
|
||||
}} // namespace mesh::power
|
||||
#endif
|
||||
#undef MESH_REGULATOR_FIXED_RADIO
|
||||
#undef MESH_REGULATOR_FIXED_RADIO_I
|
||||
#undef MESH_REGULATOR_FIXED_RADIO_CustomSTM32WLx
|
||||
|
||||
extern "C" void meshRegulatorCleanReset() {
|
||||
// Intentional resets can happen before the settings/filesystem is ready.
|
||||
|
||||
Reference in new issue
Block a user