Files
RaDrone/Source/BSP/Inc/radio_receiver.h
Radzhab Bisultanov eecf8f2cc2 Initial commit
2026-02-17 19:10:09 +03:00

34 lines
818 B
C

#ifndef RADIO_RECEIVER_H
#define RADIO_RECEIVER_H
#include "stm32g431xx.h"
#include <stdint.h>
#define SBUS_FRAME_SIZE 25
#define SBUS_START_BYTE 0X0F
typedef struct
{
int16_t rc_roll; // -500 - 500
int16_t rc_pitch; // -500 - 500
int16_t rc_throttle; // 1000 - 2000
int16_t rc_yaw; // -500 - 500
int16_t rc_armed; // 0/1
} rc_channels;
void receiver_gpio_init();
void receiver_lpuart_clock_init();
void receiver_uart_init();
void receiver_init();
void LPUART1_IRQHandler();
void receiver_update(rc_channels* chs);
void receiver_parse_frame();
rc_channels normalize_channels(rc_channels chs);
int16_t int_mapping(int16_t x, int16_t in_min, int16_t in_max, int16_t out_min, int16_t out_max);
int8_t bool_mapping_gt(int16_t x, int16_t boundary);
void led_init();
void toggle_led();
#endif