Arduino frameworks
- AltSoftSerial UART with WT61 IMU - UART with Pi on TX0/RX0 (and USB)
This commit is contained in:
31
arduino/main/imu.h
Normal file
31
arduino/main/imu.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef IMU_H
|
||||
#define IMU_H
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
// WT61 IMU data structure
|
||||
struct ImuData {
|
||||
// Acceleration (g)
|
||||
float ax, ay, az;
|
||||
// Angular velocity (deg/s)
|
||||
float gx, gy, gz;
|
||||
// Euler angles (degrees)
|
||||
float roll, pitch, yaw;
|
||||
// Timestamp of last valid packet (millis)
|
||||
unsigned long lastUpdate;
|
||||
};
|
||||
|
||||
// Initialize IMU serial (call in setup)
|
||||
void imu_init();
|
||||
|
||||
// Process incoming bytes - call frequently in loop
|
||||
// Returns true if new complete packet was parsed
|
||||
bool imu_update();
|
||||
|
||||
// Get latest IMU data
|
||||
const ImuData& imu_get_data();
|
||||
|
||||
// Check if IMU data is fresh (updated within timeout_ms)
|
||||
bool imu_is_fresh(unsigned long timeout_ms = 200);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user