|
Firmware
|
General defines and structures for the PX4IO module firmware. More...
#include <px4_config.h>#include <stdbool.h>#include <stdint.h>#include <board_config.h>#include "protocol.h"#include <pwm_limit/pwm_limit.h>#include <debug.h>Go to the source code of this file.
Classes | |
| struct | sys_state_s |
Macros | |
| #define | perf_alloc(a, b) NULL |
| #define | PX4IO_BL_VERSION 3 |
| #define | PX4IO_SERVO_COUNT 8 |
| #define | PX4IO_CONTROL_CHANNELS 8 |
| #define | PX4IO_CONTROL_GROUPS 4 |
| #define | PX4IO_RC_INPUT_CHANNELS 18 |
| #define | PX4IO_RC_MAPPED_CONTROL_CHANNELS 8 |
| This is the maximum number of channels mapped/used. | |
| #define | debug(fmt, args...) do {} while(0) |
| #define | r_status_flags r_page_status[PX4IO_P_STATUS_FLAGS] |
| #define | r_status_alarms r_page_status[PX4IO_P_STATUS_ALARMS] |
| #define | r_raw_rc_count r_page_raw_rc_input[PX4IO_P_RAW_RC_COUNT] |
| #define | r_raw_rc_values (&r_page_raw_rc_input[PX4IO_P_RAW_RC_BASE]) |
| #define | r_raw_rc_flags r_page_raw_rc_input[PX4IO_P_RAW_RC_FLAGS] |
| #define | r_rc_valid r_page_rc_input[PX4IO_P_RC_VALID] |
| #define | r_rc_values (&r_page_rc_input[PX4IO_P_RC_BASE]) |
| #define | r_mixer_limits r_page_status[PX4IO_P_STATUS_MIXER] |
| #define | r_setup_features r_page_setup[PX4IO_P_SETUP_FEATURES] |
| #define | r_setup_arming r_page_setup[PX4IO_P_SETUP_ARMING] |
| #define | r_setup_pwm_rates r_page_setup[PX4IO_P_SETUP_PWM_RATES] |
| #define | r_setup_pwm_defaultrate r_page_setup[PX4IO_P_SETUP_PWM_DEFAULTRATE] |
| #define | r_setup_pwm_altrate r_page_setup[PX4IO_P_SETUP_PWM_ALTRATE] |
| #define | r_setup_rc_thr_failsafe r_page_setup[PX4IO_P_SETUP_RC_THR_FAILSAFE_US] |
| #define | r_setup_pwm_reverse r_page_setup[PX4IO_P_SETUP_PWM_REVERSE] |
| #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_scale_roll r_page_setup[PX4IO_P_SETUP_SCALE_ROLL] |
| #define | r_setup_scale_pitch r_page_setup[PX4IO_P_SETUP_SCALE_PITCH] |
| #define | r_setup_scale_yaw r_page_setup[PX4IO_P_SETUP_SCALE_YAW] |
| #define | r_setup_sbus_rate r_page_setup[PX4IO_P_SETUP_SBUS_RATE] |
| #define | r_setup_thr_fac r_page_setup[PX4IO_P_SETUP_THR_MDL_FAC] |
| #define | r_setup_slew_max r_page_setup[PX4IO_P_SETUP_MOTOR_SLEW_MAX] |
| #define | r_setup_airmode r_page_setup[PX4IO_P_SETUP_AIRMODE] |
| #define | r_control_values (&r_page_controls[0]) |
| #define | LED_BLUE(_s) px4_arch_gpiowrite(GPIO_LED1, !(_s)) |
| #define | LED_AMBER(_s) px4_arch_gpiowrite(GPIO_LED2, !(_s)) |
| #define | LED_SAFETY(_s) px4_arch_gpiowrite(GPIO_LED3, !(_s)) |
| #define | LED_RING(_s) px4_arch_gpiowrite(GPIO_LED4, (_s)) |
| #define | PX4IO_RELAY_CHANNELS 0 |
| #define | ENABLE_SBUS_OUT(_s) px4_arch_gpiowrite(GPIO_SBUS_OENABLE, !(_s)) |
| #define | VDD_SERVO_FAULT (!px4_arch_gpioread(GPIO_SERVO_FAULT_DETECT)) |
| #define | PX4IO_ADC_CHANNEL_COUNT 2 |
| #define | ADC_VSERVO 4 |
| #define | ADC_RSSI 5 |
| #define | BUTTON_SAFETY px4_arch_gpioread(GPIO_BTN_SAFETY) |
| #define | CONTROL_PAGE_INDEX(_group, _channel) (_group * PX4IO_CONTROL_CHANNELS + _channel) |
| #define | PX4_CRITICAL_SECTION(cmd) { irqstate_t flags = px4_enter_critical_section(); cmd; px4_leave_critical_section(flags); } |
| #define | PX4_ATOMIC_MODIFY_OR(target, modification) { if ((target | (modification)) != target) { PX4_CRITICAL_SECTION(target |= (modification)); } } |
| #define | PX4_ATOMIC_MODIFY_CLEAR(target, modification) { if ((target & ~(modification)) != target) { PX4_CRITICAL_SECTION(target &= ~(modification)); } } |
| #define | PX4_ATOMIC_MODIFY_AND(target, modification) { if ((target & (modification)) != target) { PX4_CRITICAL_SECTION(target &= (modification)); } } |
Functions | |
| void | mixer_tick (void) |
| int | mixer_handle_text_create_mixer (void) |
| int | mixer_handle_text (const void *buffer, size_t length) |
| void | mixer_set_failsafe (void) |
| void | safety_init (void) |
| Safety switch/LED. | |
| void | failsafe_led_init (void) |
| void | interface_init (void) |
| FMU communications. | |
| void | interface_tick (void) |
| int | registers_set (uint8_t page, uint8_t offset, const uint16_t *values, unsigned num_values) |
| Register space. | |
| int | registers_get (uint8_t page, uint8_t offset, uint16_t **values, unsigned *num_values) |
| int | adc_init (void) |
| Sensors/misc inputs. | |
| uint16_t | adc_measure (unsigned channel) |
| void | controls_init (void) |
| R/C receiver handling. More... | |
| void | controls_tick (void) |
| void | isr_debug (uint8_t level, const char *fmt,...) |
| send a debug message to the console | |
| void | schedule_reboot (uint32_t time_delta_usec) |
| schedule a reboot More... | |
Variables | |
| volatile uint16_t | r_page_status [] |
| PAGE 1. More... | |
| uint16_t | r_page_actuators [] |
| PAGE 2. More... | |
| uint16_t | r_page_servos [] |
| PAGE 3. More... | |
| uint16_t | r_page_direct_pwm [] |
| PAGE 8. More... | |
| uint16_t | r_page_raw_rc_input [] |
| PAGE 4. More... | |
| uint16_t | r_page_rc_input [] |
| PAGE 5. More... | |
| uint16_t | r_page_adc [] |
| volatile uint16_t | r_page_setup [] |
| PAGE 100. More... | |
| uint16_t | r_page_controls [] |
| PAGE 101. More... | |
| uint16_t | r_page_rc_input_config [] |
| PAGE 103. More... | |
| uint16_t | r_page_servo_failsafe [] |
| PAGE 105. More... | |
| uint16_t | r_page_servo_control_min [] |
| PAGE 106. More... | |
| uint16_t | r_page_servo_control_max [] |
| PAGE 107. More... | |
| int16_t | r_page_servo_control_trim [] |
| PAGE 108. More... | |
| uint16_t | r_page_servo_disarmed [] |
| PAGE 109. More... | |
| struct sys_state_s | system_state |
| float | dt |
| bool | update_mc_thrust_param |
| bool | update_trims |
| pwm_limit_t | pwm_limit |
| volatile uint8_t | debug_level |
| global debug level for isr_debug() | |
General defines and structures for the PX4IO module firmware.
| void controls_init | ( | void | ) |
R/C receiver handling.
Input functions return true when they receive an update from the RC controller.
| void schedule_reboot | ( | uint32_t | time_delta_usec | ) |
schedule a reboot
schedule a reboot
| uint16_t r_page_actuators[] |
PAGE 2.
Post-mixed actuator values.
| uint16_t r_page_controls[] |
PAGE 101.
Control values from the FMU.
| uint16_t r_page_direct_pwm[] |
PAGE 8.
RAW PWM values
| uint16_t r_page_raw_rc_input[] |
PAGE 4.
Raw RC input
| uint16_t r_page_rc_input[] |
PAGE 5.
Scaled/routed RC input
| uint16_t r_page_rc_input_config[] |
PAGE 103.
R/C channel input configuration.
| uint16_t r_page_servo_control_max[] |
PAGE 107.
maximum PWM values when armed
| uint16_t r_page_servo_control_min[] |
PAGE 106.
minimum PWM values when armed
| int16_t r_page_servo_control_trim[] |
PAGE 108.
trim values for center position
| uint16_t r_page_servo_disarmed[] |
PAGE 109.
disarmed PWM values for difficult ESCs
| uint16_t r_page_servo_failsafe[] |
PAGE 105.
Failsafe servo PWM values
Disable pulses as default.
| uint16_t r_page_servos[] |
PAGE 3.
Servo PWM values
| volatile uint16_t r_page_setup[] |
PAGE 100.
Setup registers
| volatile uint16_t r_page_status[] |
PAGE 1.
Status values.
1.8.12