Skip to content

Namespace STM32Board

Namespace List > STM32Board

Public Static Attributes

Type Name
constexpr uint8_t PIN_LED_GREEN = PB15
Green LED pin — same on all STM32 boards.
constexpr uint8_t PIN_LED_RED = PB14
Red LED pin — same on all STM32 boards.

Public Functions

Type Name
void begin ()
Initialise all shared hardware. Call once at the top of setup().
CAN_HandleTypeDef * canHandle ()
Access the HAL CAN handle.
HardwareSerial & diagSerial ()
Access DiagSerial directly for multi-field formatted output.
bool isDebug ()
Returns true when debug output is enabled.
void log (const char * msg)
Print a line to DiagSerial if debug is enabled; no-op otherwise.
void onCanStatus (CanStatus status)
CAN bus status event handler — maps CanStatus to LED state.
void setDebug (bool on)
Enable or disable DiagSerial output.
void setLinkActive (bool active)
Signal that application data is actively flowing → CONNECTED (green solid).
void setWarning (bool on=true)
Raise or clear the WARNING condition — red/green alternating at 500 ms.
void tick ()
Drive LED animations. Call once per loop() iteration.

Public Static Attributes Documentation

variable PIN_LED_GREEN

Green LED pin — same on all STM32 boards.

constexpr uint8_t STM32Board::PIN_LED_GREEN;

variable PIN_LED_RED

Red LED pin — same on all STM32 boards.

constexpr uint8_t STM32Board::PIN_LED_RED;

Public Functions Documentation

function begin

Initialise all shared hardware. Call once at the top of setup().

void STM32Board::begin () 

Configures PB14 (Red) and PB15 (Green) as outputs, enters BOOTING LED state. Starts DiagSerial (USART1 PA9/PA10, 115200 baud) — silent until setDebug(true). Configures the CAN peripheral at 500 kbps on PA11/PA12 but does NOT start it — call CANProtocol::start() after filter setup.


function canHandle

Access the HAL CAN handle.

CAN_HandleTypeDef * STM32Board::canHandle () 

Note:

Internal — used by CANProtocol only. Do not call from sketches.

Returns:

Pointer to the internal CAN_HandleTypeDef.


function diagSerial

Access DiagSerial directly for multi-field formatted output.

HardwareSerial & STM32Board::diagSerial () 

Guard with isDebug() to avoid formatting overhead when debug is off.

Returns:

Reference to the USART1 HardwareSerial instance.


function isDebug

Returns true when debug output is enabled.

bool STM32Board::isDebug () 

Guard multi-field formatted print blocks with this to skip string formatting overhead when debug is off.


function log

Print a line to DiagSerial if debug is enabled; no-op otherwise.

void STM32Board::log (
    const char * msg
) 

Parameters:

  • msg Null-terminated string to print.

function onCanStatus

CAN bus status event handler — maps CanStatus to LED state.

void STM32Board::onCanStatus (
    CanStatus status
) 

Register with CANProtocol::onStatusChange(STM32Board::onCanStatus) in setup(). Never call directly from sketch code.

Parameters:


function setDebug

Enable or disable DiagSerial output.

void STM32Board::setDebug (
    bool on
) 

DiagSerial is always initialised by begin(); this flag gates all log() calls.

Parameters:

  • on True to emit output on USART1; false for silence (default).

function setLinkActive

Signal that application data is actively flowing → CONNECTED (green solid).

void STM32Board::setLinkActive (
    bool active
) 

Call setLinkActive(true) on each unit of inbound data (PanelBridge: a DCS-BIOS export seen; PanelGroup: a CTRL_BCAST received). The link auto-decays back to NORMAL after ~500 ms with no further calls. CONNECTED is only shown while the CAN bus is healthy; a CAN fault masks it and it re-engages automatically on recovery if data is still flowing.

Parameters:

  • active True to (re)assert the data-flowing link; false to drop it immediately.

function setWarning

Raise or clear the WARNING condition — red/green alternating at 500 ms.

void STM32Board::setWarning (
    bool on=true
) 

Call when a degraded condition is detected that is not represented by CanStatus (e.g. SYNC timeout, dead PanelGroup node, lost master heartbeat). WARNING outranks CONNECTED/NORMAL but is masked by any CAN fault (CAN_ERROR/BUS_OFF). Clear it with setWarning(false) once the condition recovers.

Parameters:

  • on True to raise WARNING (default); false to clear it.

function tick

Drive LED animations. Call once per loop() iteration.

void STM32Board::tick () 

Advances blink state using millis(). Fully non-blocking.



The documentation for this class was generated from the following file Firmware/Libraries/STM32Board/STM32Board.cpp