Skip to content
Snippets Groups Projects
Commit f19761d2 authored by Andrew Tridgell's avatar Andrew Tridgell Committed by Lorenz Meier
Browse files

px4iofirmware: support setting the SBUS output frame rate

this allows for helicopters and multicopters with SBUS output
parent 58122ed3
No related branches found
No related tags found
No related merge requests found
......@@ -239,6 +239,8 @@ enum { /* DSM bind states */
#define PX4IO_P_SETUP_TRIM_PITCH 17 /**< Pitch trim, in actuator units */
#define PX4IO_P_SETUP_TRIM_YAW 18 /**< Yaw trim, in actuator units */
#define PX4IO_P_SETUP_SBUS_RATE 19 /* frame rate of SBUS1 output in Hz */
/* autopilot control values, -10000..10000 */
#define PX4IO_PAGE_CONTROLS 51 /**< actuator control groups, one after the other, 8 wide */
#define PX4IO_P_CONTROLS_GROUP_0 (PX4IO_PROTOCOL_MAX_CONTROL_COUNT * 0) /**< 0..PX4IO_PROTOCOL_MAX_CONTROL_COUNT - 1 */
......
......@@ -122,6 +122,7 @@ extern uint16_t r_page_servo_disarmed[]; /* PX4IO_PAGE_DISARMED_PWM */
#define r_setup_trim_roll r_page_setup[PX4IO_P_SETUP_TRIM_ROLL]
#define r_setup_trim_pitch r_page_setup[PX4IO_P_SETUP_TRIM_PITCH]
#define r_setup_trim_yaw r_page_setup[PX4IO_P_SETUP_TRIM_YAW]
#define r_setup_sbus_rate r_page_setup[PX4IO_P_SETUP_SBUS_RATE]
#define r_control_values (&r_page_controls[0])
......
......@@ -48,6 +48,7 @@
#include <systemlib/systemlib.h>
#include <stm32_pwr.h>
#include <rc/dsm.h>
#include <rc/sbus.h>
#include "px4io.h"
#include "protocol.h"
......@@ -157,6 +158,7 @@ volatile uint16_t r_page_setup[] = {
[PX4IO_P_SETUP_PWM_RATES] = 0,
[PX4IO_P_SETUP_PWM_DEFAULTRATE] = 50,
[PX4IO_P_SETUP_PWM_ALTRATE] = 200,
[PX4IO_P_SETUP_SBUS_RATE] = 72,
#ifdef CONFIG_ARCH_BOARD_PX4IO_V1
[PX4IO_P_SETUP_RELAYS] = 0,
#else
......@@ -682,6 +684,10 @@ registers_set_one(uint8_t page, uint8_t offset, uint16_t value)
r_page_setup[offset] = value;
break;
case PX4IO_P_SETUP_SBUS_RATE:
sbus1_set_output_rate_hz(value);
break;
default:
return -1;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment