Files
meshcore-tth/variants/nucleo_wl55jc/target.h
T
Will MacGregorandClaude Opus 5 afb56bb976 Add variant for ST Nucleo-WL55JC1
Adds repeater, room_server, companion_radio_usb and kiss_modem
environments for the NUCLEO-WL55JC1 (STM32WL55JC, integrated SubGHz radio).

Notes on the board setup:

- Uses the upstream nucleo_wl55jc board. PlatformIO's boards_remap maps it
  to the core's NUCLEO_WL55JC1 variant, so the LEDs, user buttons and the
  LPUART1 -> ST-LINK VCP serial mapping all come from the core rather than
  being redefined here.
- The RF switch table is built from the core's LORAWAN_RFSWITCH_* macros
  (SP3T front end on PC3/PC4/PC5) so it tracks upstream if those are ever
  revised. Both RFO_LP and RFO_HP are registered, so RadioLib selects HP
  above 14 dBm and LP below it.
- board_build.extra_flags pins the device to STM32WL55xx. The stock board
  manifest declares product_line STM32WL55xx but extra_flags -DSTM32WLE5xx;
  that only works because every #elif chain happens to test WL55xx first.
- The Nucleo's LD1..LD3 are driven active HIGH, so the TX LED hooks are
  inverted relative to STM32Board's active-LOW default.
- 32 KB reserved at the top of flash for LittleFS, as on the other
  STM32WL variants.

Verified on hardware: all four environments build; repeater and room_server
flash and run over ST-LINK; identity and prefs persist across reboot and
across a firmware swap; and GPIOC reads back the documented RX levels at
idle, confirming the front-end switch is driven correctly.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-11-04 09:46:40 -05:00

48 lines
1.4 KiB
C++

#pragma once
#define RADIOLIB_STATIC_ONLY 1
#include <RadioLib.h>
#include <helpers/radiolib/RadioLibWrappers.h>
#include <helpers/stm32/STM32Board.h>
#include <helpers/radiolib/CustomSTM32WLxWrapper.h>
#include <helpers/ArduinoHelpers.h>
#include <helpers/SensorManager.h>
class NucleoWL55JCBoard : public STM32Board {
public:
void begin() override {
STM32Board::begin();
pinMode(P_LORA_TX_LED, OUTPUT);
digitalWrite(P_LORA_TX_LED, LOW); // see note on LED polarity below
pinMode(PIN_USER_BTN, INPUT_PULLUP);
}
const char* getManufacturerName() const override {
return "ST Nucleo WL55JC1";
}
// LD1..LD3 on the Nucleo are driven active HIGH, whereas STM32Board's
// default TX-LED handling assumes the active LOW wiring used by the
// Wio-E5 boards. Invert both halves here.
void onBeforeTransmit() override {
digitalWrite(P_LORA_TX_LED, HIGH); // turn TX LED on
}
void onAfterTransmit() override {
digitalWrite(P_LORA_TX_LED, LOW); // turn TX LED off
}
// No battery on this dev board, it is USB/ST-LINK powered.
uint16_t getBattMilliVolts() override {
return 0;
}
};
extern NucleoWL55JCBoard board;
extern WRAPPER_CLASS radio_driver;
extern VolatileRTCClock rtc_clock;
extern SensorManager sensors;
bool radio_init();
mesh::LocalIdentity radio_new_identity();