Skip to content

Namespace SimGateway

Namespace List > SimGateway

Public Functions

Type Name
void loop ()
Relay bytes and dispatch HID frames. Call once per loop() iteration.
void setup (SerialUART & uart, uint8_t txPin=DEFAULT_UART_TX_PIN, uint8_t rxPin=DEFAULT_UART_RX_PIN)
Initialise USB identity, OpenSkyhawkJoystick, and UART link to PanelBridge .
void statusLedBegin ()
Configure GP2 (green) / GP3 (red) as outputs, both off. Call once from setup() .
void statusTick ()
Advance the status-LED state machine and animation. Call once per loop() .

Public Functions Documentation

function loop

Relay bytes and dispatch HID frames. Call once per loop() iteration.

void SimGateway::loop () 

Per call: * Forward all USB CDC bytes (Serial) to UART — DCS-BIOS stream to PanelBridge. * Drain all UART bytes: byte ≤ 0x7F → forward to USB CDC (DCS-BIOS from PanelBridge) 0xAA 0x55 + 4 bytes → parse controlId + value LE; dispatch to HID lists 0xAA + non-0x55 → forward 0xAA + byte to USB CDC; resume IDLE * If any HID setter fired, call OsJoystick.send() exactly once.

Note:

Node-status reporting (#86) needs no handling here: PanelBridge's _NODE_STATUS DCS-BIOS messages are ASCII (≤ 0x7F) forwarded by step 2, and the host's roster request is a DCS-BIOS export write (addr 0x86FE) forwarded by step 1. Both transit transparently.

Note:

Parser state persists across calls — frames split across iterations assemble correctly.


function setup

Initialise USB identity, OpenSkyhawkJoystick, and UART link to PanelBridge .

void SimGateway::setup (
    SerialUART & uart,
    uint8_t txPin=DEFAULT_UART_TX_PIN,
    uint8_t rxPin=DEFAULT_UART_RX_PIN
) 

Must be the first call in the sketch's setup(). Sets USB identity before the TinyUSB stack enumerates: * Manufacturer: "OpenSkyhawk" * Product: "A-4E Skyhawk" * VID/PID: 0x2E8A / 0x4134 * CDC port: "A-4E Skyhawk DCS-BIOS" (iInterface — names the serial port) Configures the UART pins and calls uart.begin(250000), then calls OsJoystick.begin() to initialise the HID descriptor and enumerate.

Parameters:

  • uart Hardware UART connected to PanelBridge (Serial1 / UART0 on standard board).
  • txPin RP2040 UART TX pin. Defaults to GP0, wired to STM32 PA3.
  • rxPin RP2040 UART RX pin. Defaults to GP1, wired to STM32 PA2.

function statusLedBegin

Configure GP2 (green) / GP3 (red) as outputs, both off. Call once from setup() .

void SimGateway::statusLedBegin () 

Called automatically by SimGateway::setup(); sketches do not call it directly.


function statusTick

Advance the status-LED state machine and animation. Call once per loop() .

void SimGateway::statusTick () 

Samples USB-mount, recent DCS-BIOS activity, and the uart0 PL011 error flags, then drives GP2/GP3 for the current state. Non-blocking. Called automatically by SimGateway::loop(); sketches do not call it directly.



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