Initial commit - sync AliceRC to Gitea
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @file sbus.h
|
||||
* @brief SBUS decoder for receiver telemetry input
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* SBUS frame structure (25 bytes) */
|
||||
typedef struct __attribute__((packed)) {
|
||||
uint8_t start_byte; /* 0x0F */
|
||||
uint8_t channel_data[22]; /* 16 channels × 11 bit = 176 bit */
|
||||
uint8_t flags; /* CH17, CH18, failsafe, lost frame */
|
||||
uint8_t end_byte; /* 0x00 */
|
||||
} sbus_frame_t;
|
||||
|
||||
/* SBUS flags */
|
||||
#define SBUS_FLAG_CH17 (1 << 0)
|
||||
#define SBUS_FLAG_CH18 (1 << 1)
|
||||
#define SBUS_FLAG_LOST_FRAME (1 << 2)
|
||||
#define SBUS_FLAG_FAILSAFE (1 << 3)
|
||||
|
||||
/* Initialize SBUS decoder */
|
||||
void sbus_init(void);
|
||||
|
||||
/* Decode SBUS frame into channel values */
|
||||
void sbus_decode(const sbus_frame_t *frame, uint16_t *channels, uint8_t *flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user