support SBUS instead PWM

This commit is contained in:
2026-02-14 21:42:46 +01:00
parent 5cc2bd0b1d
commit 4ccfc5128b
3 changed files with 237 additions and 3 deletions

View File

@ -11,6 +11,15 @@
#include <stdint.h>
#include <stdbool.h>
// Define to switch between PWM and SBUS mode
// Comment out to use PWM mode, uncomment to use SBUS mode
#define USE_SBUS_MODE
#ifdef USE_SBUS_MODE
#define SBUS_NUM_CHANNELS 16 // SBUS supports 16 proportional channels
#define SBUS_TRIGGER_CHANNEL 3 // Channel 4 (index 3) for mode trigger
#endif
/**
* @brief Callback function type for mode changes
*/
@ -52,4 +61,18 @@ bool rcsignal_is_active(void);
*/
uint8_t rcsignal_get_current_mode(void);
#ifdef USE_SBUS_MODE
/**
* @brief Get SBUS channel value
* @param channel Channel index (0-15)
* @return Channel value (172-1811) or 0 if invalid
*/
uint16_t rcsignal_get_sbus_channel(uint8_t channel);
/**
* @brief Debug function to print all SBUS channels
*/
void rcsignal_debug_print_channels(void);
#endif
#endif // RCSIGNAL_H