Arduino frameworks

- AltSoftSerial UART with WT61 IMU
- UART with Pi on TX0/RX0 (and USB)
This commit is contained in:
Mikkeli Matlock
2026-02-01 11:47:15 +09:00
parent 7a6e69861b
commit 559e62e292
6 changed files with 356 additions and 26 deletions

25
arduino/main/comms.h Normal file
View File

@@ -0,0 +1,25 @@
#ifndef COMMS_H
#define COMMS_H
#include <Arduino.h>
// Initialize Pi serial communication (call in setup)
void comms_init();
// Process incoming commands from Pi - call in loop
// Returns true if a complete command was received
bool comms_update();
// Send telemetry line to Pi
void comms_send(const char* key, float value, int decimals = 2);
void comms_send(const char* key, int value);
void comms_send(const char* key, const char* value);
// Get last received command (empty if none)
// Command buffer is cleared after reading
const char* comms_get_command();
// Check if connected (received any data recently)
bool comms_is_connected(unsigned long timeout_ms = 5000);
#endif