44 #include <px4_platform_common/px4_config.h> 49 #include <board_config.h> 59 #define perf_alloc(a,b) NULL 64 #define PX4IO_BL_VERSION 3 65 #define PX4IO_SERVO_COUNT 8 66 #define PX4IO_CONTROL_CHANNELS 8 67 #define PX4IO_CONTROL_GROUPS 4 68 #define PX4IO_RC_INPUT_CHANNELS 18 69 #define PX4IO_RC_MAPPED_CONTROL_CHANNELS 8 77 # define debug(fmt, args...) syslog(LOG_DEBUG,fmt "\n", ##args) 79 # define debug(fmt, args...) do {} while(0) 107 #define r_status_flags r_page_status[PX4IO_P_STATUS_FLAGS] 108 #define r_status_alarms r_page_status[PX4IO_P_STATUS_ALARMS] 110 #define r_raw_rc_count r_page_raw_rc_input[PX4IO_P_RAW_RC_COUNT] 111 #define r_raw_rc_values (&r_page_raw_rc_input[PX4IO_P_RAW_RC_BASE]) 112 #define r_raw_rc_flags r_page_raw_rc_input[PX4IO_P_RAW_RC_FLAGS] 113 #define r_rc_valid r_page_rc_input[PX4IO_P_RC_VALID] 114 #define r_rc_values (&r_page_rc_input[PX4IO_P_RC_BASE]) 115 #define r_mixer_limits r_page_status[PX4IO_P_STATUS_MIXER] 117 #define r_setup_features r_page_setup[PX4IO_P_SETUP_FEATURES] 118 #define r_setup_arming r_page_setup[PX4IO_P_SETUP_ARMING] 119 #define r_setup_pwm_rates r_page_setup[PX4IO_P_SETUP_PWM_RATES] 120 #define r_setup_pwm_defaultrate r_page_setup[PX4IO_P_SETUP_PWM_DEFAULTRATE] 121 #define r_setup_pwm_altrate r_page_setup[PX4IO_P_SETUP_PWM_ALTRATE] 122 #define r_setup_rc_thr_failsafe r_page_setup[PX4IO_P_SETUP_RC_THR_FAILSAFE_US] 124 #define r_setup_pwm_reverse r_page_setup[PX4IO_P_SETUP_PWM_REVERSE] 126 #define r_setup_trim_roll r_page_setup[PX4IO_P_SETUP_TRIM_ROLL] 127 #define r_setup_trim_pitch r_page_setup[PX4IO_P_SETUP_TRIM_PITCH] 128 #define r_setup_trim_yaw r_page_setup[PX4IO_P_SETUP_TRIM_YAW] 129 #define r_setup_scale_roll r_page_setup[PX4IO_P_SETUP_SCALE_ROLL] 130 #define r_setup_scale_pitch r_page_setup[PX4IO_P_SETUP_SCALE_PITCH] 131 #define r_setup_scale_yaw r_page_setup[PX4IO_P_SETUP_SCALE_YAW] 132 #define r_setup_sbus_rate r_page_setup[PX4IO_P_SETUP_SBUS_RATE] 133 #define r_setup_thr_fac r_page_setup[PX4IO_P_SETUP_THR_MDL_FAC] 134 #define r_setup_slew_max r_page_setup[PX4IO_P_SETUP_MOTOR_SLEW_MAX] 135 #define r_setup_airmode r_page_setup[PX4IO_P_SETUP_AIRMODE] 136 #define r_setup_flighttermination r_page_setup[PX4IO_P_SETUP_ENABLE_FLIGHTTERMINATION] 138 #define r_control_values (&r_page_controls[0]) 168 #define LED_BLUE(_s) px4_arch_gpiowrite(GPIO_LED1, !(_s)) 169 #define LED_AMBER(_s) px4_arch_gpiowrite(GPIO_LED2, !(_s)) 170 #define LED_SAFETY(_s) px4_arch_gpiowrite(GPIO_LED3, !(_s)) 171 #define LED_RING(_s) px4_arch_gpiowrite(GPIO_LED4, (_s)) 174 # define PX4IO_RELAY_CHANNELS 0 175 # define ENABLE_SBUS_OUT(_s) px4_arch_gpiowrite(GPIO_SBUS_OENABLE, !(_s)) 177 # define VDD_SERVO_FAULT (!px4_arch_gpioread(GPIO_SERVO_FAULT_DETECT)) 179 # define PX4IO_ADC_CHANNEL_COUNT 2 180 # define ADC_VSERVO 4 183 #define BUTTON_SAFETY px4_arch_gpioread(GPIO_BTN_SAFETY) 185 #define CONTROL_PAGE_INDEX(_group, _channel) (_group * PX4IO_CONTROL_CHANNELS + _channel) 187 #define PX4_CRITICAL_SECTION(cmd) { irqstate_t flags = px4_enter_critical_section(); cmd; px4_leave_critical_section(flags); } 217 extern int registers_set(uint8_t page, uint8_t offset,
const uint16_t *values,
unsigned num_values);
218 extern int registers_get(uint8_t page, uint8_t offset, uint16_t **values,
unsigned *num_values);
238 extern void isr_debug(uint8_t level,
const char *fmt, ...);
volatile uint16_t r_page_setup[]
PAGE 100.
void atomic_modify_and(volatile uint16_t *target, uint16_t modification)
void failsafe_led_init(void)
void schedule_reboot(uint32_t time_delta_usec)
schedule a reboot
PX4IO interface protocol.
void controls_init(void)
R/C receiver handling.
volatile uint64_t rc_channels_timestamp_valid
uint16_t r_page_servo_control_max[]
PAGE 107.
struct sys_state_s system_state
int adc_init(void)
Sensors/misc inputs.
void mixer_set_failsafe(void)
int registers_get(uint8_t page, uint8_t offset, uint16_t **values, unsigned *num_values)
volatile uint8_t debug_level
global debug level for isr_debug()
void safety_init(void)
Safety switch/LED.
void atomic_modify_clear(volatile uint16_t *target, uint16_t modification)
uint16_t r_page_controls[]
PAGE 101.
uint16_t r_page_servo_disarmed[]
PAGE 109.
void interface_init(void)
FMU communications.
void interface_tick(void)
uint16_t r_page_servo_control_min[]
PAGE 106.
uint16_t adc_measure(unsigned channel)
uint16_t r_page_rc_input_config[]
PAGE 103.
bool update_mc_thrust_param
int mixer_handle_text_create_mixer(void)
uint16_t r_page_servos[]
PAGE 3.
uint16_t r_page_actuators[]
PAGE 2.
uint16_t r_page_rc_input[]
PAGE 5.
int16_t r_page_servo_control_trim[]
PAGE 108.
volatile uint16_t r_page_status[]
PAGE 1.
uint16_t r_page_direct_pwm[]
PAGE 8.
uint16_t r_page_raw_rc_input[]
PAGE 4.
int registers_set(uint8_t page, uint8_t offset, const uint16_t *values, unsigned num_values)
Register space.
volatile uint64_t rc_channels_timestamp_received
uint16_t r_page_servo_failsafe[]
PAGE 105.
Library for output limiting (PWM for example)
void atomic_modify_or(volatile uint16_t *target, uint16_t modification)
volatile uint64_t fmu_data_received_time
Last FMU receive time, in microseconds since system boot.
void isr_debug(uint8_t level, const char *fmt,...)
send a debug message to the console
int mixer_handle_text(const void *buffer, size_t length)