Scaffold PlatformIO project with 20 board configs and C99/C++ source skeleton

Three-tier configuration hierarchy:
- [env:base] — RadioLib + default LoRa parameters
- [soc_esp32/esp32s3/nrf52] — platform + framework per SoC
- [env:board_name] — board-specific pins + chip selection

20 boards across 4 vendors:
- Heltec: 11 boards (T114, CT62, E213, E290, Mesh Solar, T190, Tracker,
  Tracker V2, V2, V3, V4)
- LilyGo: 4 boards (T-Beam 1W, sx1262, sx1276, supreme)
- Seeed: 1 board (Xiao S3 + Wio SX1262 with verified pins)
- RAK: 4 boards (RAK11310, RAK3112, RAK3401, RAK3x72, RAK4631)

Known/verified pins: Heltec V2/V3/V4, RAK4631, Seeed Xiao S3
FIXME pins: all others (placeholders for future research)

Source skeleton:
- config.h — compile-time defaults + pin validation (#error checks)
- kiss.h/c — KISS protocol implementation (C99)
- radio.h/cpp — RadioLib wrapper with C API (extern "C" boundary)
- main.cpp — Arduino entry point

All files pass pre-commit (prettier, markdownlint, YAML check).
This commit is contained in:
Maze X
2026-03-27 17:15:30 +01:00
parent 777014f375
commit 8883ee3e94
33 changed files with 824 additions and 15 deletions

70
src/kiss.h Normal file
View File

@@ -0,0 +1,70 @@
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
/* KISS special bytes */
#define KISS_FEND 0xC0u
#define KISS_FESC 0xDBu
#define KISS_TFEND 0xDCu
#define KISS_TFESC 0xDDu
/* Port assignments */
#define KISS_PORT_DATA 0u
#define KISS_PORT_QUALITY 1u
#define KISS_PORT_CONFIG 2u
/* Configuration command opcodes (port 2) */
#define KISS_CMD_RESERVED 0x00u
#define KISS_CMD_RES_OK 0x01u
#define KISS_CMD_RES_ERROR 0x02u
#define KISS_CMD_GET_RADIO 0x10u
#define KISS_CMD_SET_RADIO 0x11u
#define KISS_CMD_GET_FREQ 0x12u
#define KISS_CMD_SET_FREQ 0x13u
#define KISS_CMD_GET_BW 0x14u
#define KISS_CMD_SET_BW 0x15u
#define KISS_CMD_GET_SF 0x16u
#define KISS_CMD_SET_SF 0x17u
#define KISS_CMD_GET_CR 0x18u
#define KISS_CMD_SET_CR 0x19u
#define KISS_CMD_GET_POWER 0x1Au
#define KISS_CMD_SET_POWER 0x1Bu
#define KISS_CMD_GET_SYNCWORD 0x1Cu
#define KISS_CMD_SET_SYNCWORD 0x1Du
#define KISS_MAX_FRAME 256u
typedef struct {
uint8_t port;
uint8_t data[KISS_MAX_FRAME];
uint16_t len;
} kiss_frame_t;
typedef enum {
KISS_STATE_IDLE,
KISS_STATE_IN_FRAME,
KISS_STATE_ESCAPE,
} kiss_state_t;
typedef struct {
kiss_state_t state;
uint8_t buf[KISS_MAX_FRAME + 1u]; /* +1 for type byte */
uint16_t len;
} kiss_decoder_t;
void kiss_decoder_init(kiss_decoder_t *dec);
/* Feed one byte into the decoder. Returns true when a complete frame is
ready in *frame. frame must not be NULL when return value is checked. */
bool kiss_decode(kiss_decoder_t *dec, uint8_t byte, kiss_frame_t *frame);
/* Encode port+data into a KISS frame. Returns bytes written, or 0 on
overflow. */
size_t kiss_encode(uint8_t port, const uint8_t *data, size_t len,
uint8_t *dst, size_t dst_cap);
/* Encode a 3-byte signal quality frame for port 1. Big-endian: int8 snr,
int16 rssi. */
size_t kiss_encode_quality(int8_t snr, int16_t rssi, uint8_t *dst,
size_t dst_cap);