- ST7735 SPI-Treiber (80x160, 5x7-Font) mit Debug-Panel (5MIN/FRM/DROP/SRC/FREE/CH) - SPI2_HOST statt SPI1_HOST (SPI1 = Flash-reserviert auf ESP32-C5) - xTaskCreate statt xTaskCreatePinnedToCore (C5 ist Single-Core) - SD-Karte (SPI 1-bit, 32 GB, FAT32) + Flash-storage-Fallback - Serial-REPL: stats, seron, seroff, reboot - APA102 RGB-Status-LED (blau=boot, gruen=armed, rot=fehler) - Build: ESP-IDF v6.1-dev, RISC-V, ~920 KB Replaced old block1-4 prototype with full modular firmware.
57 lines
2.1 KiB
C
57 lines
2.1 KiB
C
#pragma once
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
#include "esp_err.h"
|
|
|
|
/* Parsed 802.11 MAC header. */
|
|
typedef struct {
|
|
uint8_t type; /* 0=Mgmt, 1=Ctrl, 2=Data */
|
|
uint8_t subtype;
|
|
bool to_ds, from_ds, more_frag, retry, protected_, order;
|
|
uint8_t da[6];
|
|
uint8_t sa[6];
|
|
uint8_t bssid[6];
|
|
int addr_count;
|
|
const uint8_t *payload;
|
|
uint16_t payload_len;
|
|
bool is_data;
|
|
} ieee80211_hdr_t;
|
|
|
|
/* C-ITS ASdu classification.
|
|
*
|
|
* ASdu id values follow the European C-ITS profile (ETSI EN 303 617 / TS 102 913).
|
|
* The mapping and the per-message field offsets below are a best-effort decode;
|
|
* the authoritative capture is the raw hex we always log, so any mis-decode is
|
|
* recoverable offline. */
|
|
typedef enum {
|
|
CITS_UNKNOWN = 0,
|
|
CITS_SPM, /* 0x01 SpMS - Signal Phase & Timing (traffic light) */
|
|
CITS_SPT, /* 0x02 SpTM - Signal Timing Message */
|
|
CITS_SPS, /* 0x03 SpSM - Signal State Message */
|
|
CITS_SPA, /* 0x04 SpAM - Signal Acknowledgment Message */
|
|
CITS_MAP, /* 0x05 MAPM - MAP Message */
|
|
CITS_CAM, /* 0x06 CAM - Cooperative Awareness Message (vehicle) */
|
|
CITS_DENM, /* 0x07 DENM - Decentralised Environmental Notification */
|
|
} cits_msg_type_t;
|
|
|
|
typedef struct {
|
|
cits_msg_type_t type;
|
|
uint8_t asdu_id;
|
|
uint8_t asdu_version;
|
|
uint16_t asdu_len;
|
|
uint32_t site_id; /* SpMS: 3-byte traffic-light site id */
|
|
uint8_t num_phases; /* SpMS: number of signal phases */
|
|
uint8_t phase0_state; /* SpMS: first phase state (0 off,1 red,2 amber,3 green,4 flash) */
|
|
uint32_t station_id; /* CAM/other: leading station-id bytes (best-effort) */
|
|
} cits_msg_t;
|
|
|
|
/* Parse the 802.11 MAC header; fills address fields and points 'payload' at the
|
|
* frame body (after any seq/fcs word). */
|
|
esp_err_t cits_parse_80211(const uint8_t *frame, uint16_t len, ieee80211_hdr_t *out);
|
|
|
|
/* Parse the C-ITS ASdu payload (the body of an 802.11 data frame) and
|
|
* best-effort classify/extract fields. */
|
|
esp_err_t cits_parse_asdu(const uint8_t *payload, uint16_t len, cits_msg_t *out);
|
|
|
|
const char *cits_type_name(cits_msg_type_t t);
|