diff options
Diffstat (limited to 'apps/px4io/registers.c')
-rw-r--r-- | apps/px4io/registers.c | 108 |
1 files changed, 69 insertions, 39 deletions
diff --git a/apps/px4io/registers.c b/apps/px4io/registers.c index 1c6fbf4fb..c60491f93 100644 --- a/apps/px4io/registers.c +++ b/apps/px4io/registers.c @@ -50,33 +50,8 @@ static int registers_set_one(uint8_t page, uint8_t offset, uint16_t value); /** - * Setup registers - */ -volatile uint16_t r_page_setup[] = -{ - [PX4IO_P_SETUP_FEATURES] = 0, - [PX4IO_P_SETUP_ARMING] = 0, - [PX4IO_P_SETUP_PWM_RATES] = 0, - [PX4IO_P_SETUP_PWM_LOWRATE] = 50, - [PX4IO_P_SETUP_PWM_HIGHRATE] = 200, - [PX4IO_P_SETUP_RELAYS] = 0, - [PX4IO_P_SETUP_VBATT_SCALE] = 10000, - [PX4IO_P_SETUP_IBATT_SCALE] = 0, - [PX4IO_P_SETUP_IBATT_BIAS] = 0 -}; - -#define PX4IO_P_SETUP_FEATURES_VALID (PX4IO_P_FEAT_ARMING_MANUAL_OVERRIDE_OK) -#define PX4IO_P_SETUP_ARMING_VALID (PX4IO_P_SETUP_ARMING_ARM_OK | \ - PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE) -#define PX4IO_P_SETUP_RATES_VALID ((1 << IO_SERVO_COUNT) - 1) -#define PX4IO_P_SETUP_RELAYS_VALID ((1 << PX4IO_RELAY_CHANNELS) - 1) - -/** - * Control values from the FMU. - */ -volatile uint16_t r_page_controls[PX4IO_CONTROL_CHANNELS]; - -/** + * PAGE 0 + * * Static configuration parameters. */ static const uint16_t r_page_config[] = { @@ -92,6 +67,8 @@ static const uint16_t r_page_config[] = { }; /** + * PAGE 1 + * * Status values. */ uint16_t r_page_status[] = { @@ -104,26 +81,33 @@ uint16_t r_page_status[] = { }; /** - * ADC input buffer. - */ -uint16_t r_page_adc[ADC_CHANNEL_COUNT]; - -/** + * PAGE 2 + * * Post-mixed actuator values. */ uint16_t r_page_actuators[IO_SERVO_COUNT]; /** + * PAGE 3 + * * Servo PWM values */ uint16_t r_page_servos[IO_SERVO_COUNT]; /** - * Servo PWM values + * PAGE 4 + * + * Raw RC input */ -uint16_t r_page_servo_failsafe[IO_SERVO_COUNT]; +uint16_t r_page_raw_rc_input[] = +{ + [PX4IO_P_RAW_RC_COUNT] = 0, + [PX4IO_P_RAW_RC_BASE ... (PX4IO_P_RAW_RC_BASE + MAX_CONTROL_CHANNELS)] = 0 +}; /** + * PAGE 5 + * * Scaled/routed RC input */ uint16_t r_page_rc_input[] = { @@ -132,25 +116,71 @@ uint16_t r_page_rc_input[] = { }; /** - * Raw RC input + * PAGE 6 + * + * Raw ADC input. */ -uint16_t r_page_raw_rc_input[] = +uint16_t r_page_adc[ADC_CHANNEL_COUNT]; + +/** + * PAGE 100 + * + * Setup registers + */ +volatile uint16_t r_page_setup[] = { - [PX4IO_P_RAW_RC_COUNT] = 0, - [PX4IO_P_RAW_RC_BASE ... (PX4IO_P_RAW_RC_BASE + MAX_CONTROL_CHANNELS)] = 0 + [PX4IO_P_SETUP_FEATURES] = 0, + [PX4IO_P_SETUP_ARMING] = 0, + [PX4IO_P_SETUP_PWM_RATES] = 0, + [PX4IO_P_SETUP_PWM_LOWRATE] = 50, + [PX4IO_P_SETUP_PWM_HIGHRATE] = 200, + [PX4IO_P_SETUP_RELAYS] = 0, + [PX4IO_P_SETUP_VBATT_SCALE] = 10000, + [PX4IO_P_SETUP_IBATT_SCALE] = 0, + [PX4IO_P_SETUP_IBATT_BIAS] = 0 }; +#define PX4IO_P_SETUP_FEATURES_VALID (PX4IO_P_FEAT_ARMING_MANUAL_OVERRIDE_OK) +#define PX4IO_P_SETUP_ARMING_VALID (PX4IO_P_SETUP_ARMING_ARM_OK | \ + PX4IO_P_SETUP_ARMING_MANUAL_OVERRIDE) +#define PX4IO_P_SETUP_RATES_VALID ((1 << IO_SERVO_COUNT) - 1) +#define PX4IO_P_SETUP_RELAYS_VALID ((1 << PX4IO_RELAY_CHANNELS) - 1) + +/** + * PAGE 101 + * + * Control values from the FMU. + */ +volatile uint16_t r_page_controls[PX4IO_CONTROL_CHANNELS]; + +/* + * PAGE 102 does not have a buffer. + */ + /** + * PAGE 103 + * * R/C channel input configuration. */ uint16_t r_page_rc_input_config[MAX_CONTROL_CHANNELS * PX4IO_P_RC_CONFIG_STRIDE]; +/* valid options excluding ENABLE */ #define PX4IO_P_RC_CONFIG_OPTIONS_VALID PX4IO_P_RC_CONFIG_OPTIONS_REVERSE +/* + * PAGE 104 uses r_page_servos. + */ + +/** + * PAGE 105 + * + * Failsafe servo PWM values + */ +uint16_t r_page_servo_failsafe[IO_SERVO_COUNT]; + void registers_set(uint8_t page, uint8_t offset, const uint16_t *values, unsigned num_values) { - system_state.fmu_data_received_time = hrt_absolute_time(); switch (page) { |