![]() |
Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
PX4IO interface protocol. More...
#include <inttypes.h>
Go to the source code of this file.
Data Structures | |
struct | IOPacket |
Enumerations | |
enum | { dsm_bind_power_down = 0 , dsm_bind_power_up , dsm_bind_set_rx_out , dsm_bind_send_pulses , dsm_bind_reinit_uart } |
Functions | |
static uint8_t | crc_packet (struct IOPacket *pkt) |
Variables | |
static const uint8_t | crc8_tab [256] |
PX4IO interface protocol.
Communication is performed via writes to and reads from 16-bit virtual registers organised into pages of 255 registers each.
The first two bytes of each write select a page and offset address respectively. Subsequent reads and writes increment the offset within the page.
Some pages are read- or write-only.
Note that some pages may permit offset values greater than 255, which can only be achieved by long writes. The offset does not wrap.
Writes to unimplemented registers are ignored. Reads from unimplemented registers return undefined values.
As convention, values that would be floating point in other parts of the PX4 system are expressed as signed integer values scaled by 10000, e.g. control values range from -10000..10000. Use the REG_TO_SIGNED and SIGNED_TO_REG macros to convert between register representation and the signed version.
Note that the implementation of readable pages prefers registers within readable pages to be densely packed. Page numbers do not need to be packed.
Definitions marked [1] are only valid on PX4IOv1 boards. Likewise, [2] denotes definitions specific to the PX4IOv2 board.
Definition in file protocol.h.
struct IOPacket |
#define PKT_CODE | ( | _p | ) | ((_p).count_code & PKT_CODE_MASK) |
Definition at line 242 of file protocol.h.
Definition at line 235 of file protocol.h.
Definition at line 236 of file protocol.h.
#define PKT_CODE_MASK 0xc0 |
Definition at line 238 of file protocol.h.
Definition at line 232 of file protocol.h.
Definition at line 234 of file protocol.h.
Definition at line 233 of file protocol.h.
#define PKT_COUNT | ( | _p | ) | ((_p).count_code & PKT_COUNT_MASK) |
Definition at line 241 of file protocol.h.
#define PKT_COUNT_MASK 0x3f |
Definition at line 239 of file protocol.h.
#define PKT_MAX_REGS 32 |
Serial protocol encapsulation.
Definition at line 216 of file protocol.h.
Definition at line 243 of file protocol.h.
#define PX4IO_MAX_TRANSFER_LEN 64 |
Definition at line 93 of file protocol.h.
Definition at line 90 of file protocol.h.
Definition at line 92 of file protocol.h.
Definition at line 87 of file protocol.h.
Definition at line 89 of file protocol.h.
Definition at line 86 of file protocol.h.
Definition at line 88 of file protocol.h.
#define PX4IO_P_CONFIG_PROTOCOL_VERSION 0 /* PX4IO_PROTOCOL_VERSION */ |
Definition at line 85 of file protocol.h.
Definition at line 91 of file protocol.h.
Definition at line 139 of file protocol.h.
Definition at line 140 of file protocol.h.
#define PX4IO_P_RAW_RC_BASE 6 /* CONFIG_RC_INPUT_COUNT channels from here */ |
Definition at line 141 of file protocol.h.
Definition at line 129 of file protocol.h.
#define PX4IO_P_RAW_RC_DATA 3 /* [1] + [2] Details about the RC source (PPM frame length, Spektrum protocol type) */ |
Definition at line 138 of file protocol.h.
Definition at line 130 of file protocol.h.
Definition at line 132 of file protocol.h.
Definition at line 131 of file protocol.h.
Definition at line 134 of file protocol.h.
Definition at line 133 of file protocol.h.
Definition at line 135 of file protocol.h.
#define PX4IO_P_RAW_RC_NRSSI 2 /* [2] Normalized RSSI value, 0: no reception, 255: perfect reception */ |
Definition at line 137 of file protocol.h.
Definition at line 157 of file protocol.h.
Definition at line 161 of file protocol.h.
Definition at line 159 of file protocol.h.
Definition at line 160 of file protocol.h.
#define PX4IO_P_SETUP_ARMING_FORCE_FAILSAFE (1 << 5) /* If set, the system will always output the failsafe values */ |
Definition at line 163 of file protocol.h.
Definition at line 158 of file protocol.h.
#define PX4IO_P_SETUP_ARMING_LOCKDOWN (1 << 4) /* If set, the system operates normally, but won't actuate any servos */ |
Definition at line 162 of file protocol.h.
#define PX4IO_P_SETUP_ARMING_TERMINATION_FAILSAFE (1 << 6) /* If set, the system will never return from a failsafe, but remain in failsafe once triggered. */ |
Definition at line 164 of file protocol.h.
Definition at line 184 of file protocol.h.
#define PX4IO_P_SETUP_ENABLE_FLIGHTTERMINATION 18 |
flight termination; false if the circuit breaker (CBRK_FLIGHTTERM) is set
Definition at line 190 of file protocol.h.
#define PX4IO_P_SETUP_FEATURES 0 |
Definition at line 152 of file protocol.h.
#define PX4IO_P_SETUP_FEATURES_ADC_RSSI (1 << 2) |
enable ADC RSSI parsing
Definition at line 155 of file protocol.h.
#define PX4IO_P_SETUP_FEATURES_SBUS1_OUT (1 << 0) |
enable S.Bus v1 output
Definition at line 153 of file protocol.h.
#define PX4IO_P_SETUP_FEATURES_SBUS2_OUT (1 << 1) |
enable S.Bus v2 output
Definition at line 154 of file protocol.h.
Definition at line 168 of file protocol.h.
Definition at line 167 of file protocol.h.
Definition at line 191 of file protocol.h.
Definition at line 192 of file protocol.h.
Definition at line 193 of file protocol.h.
Definition at line 194 of file protocol.h.
Definition at line 166 of file protocol.h.
#define PX4IO_P_SETUP_REBOOT_BL 10 /* reboot IO into bootloader */ |
Definition at line 181 of file protocol.h.
#define PX4IO_P_SETUP_SAFETY_BUTTON_ACK 14 |
ACK from FMU when it gets safety button pressed status.
Definition at line 186 of file protocol.h.
#define PX4IO_P_SETUP_SAFETY_OFF 15 |
FMU inform PX4IO about safety_off for LED indication.
Definition at line 187 of file protocol.h.
#define PX4IO_P_SETUP_SBUS_RATE 16 |
frame rate of SBUS1 output in Hz
Definition at line 188 of file protocol.h.
Definition at line 179 of file protocol.h.
#define PX4IO_P_SETUP_THERMAL 17 |
thermal management
Definition at line 189 of file protocol.h.
Definition at line 169 of file protocol.h.
Definition at line 117 of file protocol.h.
Definition at line 119 of file protocol.h.
Definition at line 118 of file protocol.h.
#define PX4IO_P_STATUS_CPULOAD 1 |
Definition at line 98 of file protocol.h.
#define PX4IO_P_STATUS_FLAGS 2 /* monitoring flags */ |
Definition at line 100 of file protocol.h.
Definition at line 108 of file protocol.h.
Definition at line 110 of file protocol.h.
Definition at line 112 of file protocol.h.
Definition at line 106 of file protocol.h.
#define PX4IO_P_STATUS_FLAGS_INIT_OK (1 << 8) /* initialisation of the IO completed without error */ |
Definition at line 109 of file protocol.h.
Definition at line 101 of file protocol.h.
Definition at line 107 of file protocol.h.
Definition at line 104 of file protocol.h.
Definition at line 102 of file protocol.h.
Definition at line 103 of file protocol.h.
Definition at line 105 of file protocol.h.
Definition at line 113 of file protocol.h.
Definition at line 114 of file protocol.h.
#define PX4IO_P_STATUS_FLAGS_SAFETY_BUTTON_EVENT (1 << 14) /* px4io safety button was pressed for longer than 1 second */ |
Definition at line 115 of file protocol.h.
Definition at line 111 of file protocol.h.
#define PX4IO_P_STATUS_FREEMEM 0 |
Definition at line 97 of file protocol.h.
Definition at line 122 of file protocol.h.
Definition at line 121 of file protocol.h.
#define PX4IO_P_TEST_LED 0 |
set the amber LED on/off
Definition at line 208 of file protocol.h.
#define PX4IO_PAGE_CONFIG 0 |
Definition at line 84 of file protocol.h.
#define PX4IO_PAGE_DIRECT_PWM 54 |
0..CONFIG_ACTUATOR_COUNT-1
Definition at line 201 of file protocol.h.
#define PX4IO_PAGE_DISARMED_PWM 109 /* 0..CONFIG_ACTUATOR_COUNT-1 */ |
Definition at line 211 of file protocol.h.
#define PX4IO_PAGE_FAILSAFE_PWM 55 |
0..CONFIG_ACTUATOR_COUNT-1
Definition at line 204 of file protocol.h.
#define PX4IO_PAGE_PWM_INFO 7 |
Definition at line 147 of file protocol.h.
#define PX4IO_PAGE_RAW_ADC_INPUT 6 /* 0..CONFIG_ADC_INPUT_COUNT-1 */ |
Definition at line 144 of file protocol.h.
#define PX4IO_PAGE_RAW_RC_INPUT 4 |
Definition at line 128 of file protocol.h.
#define PX4IO_PAGE_SERVOS 3 /* 0..CONFIG_ACTUATOR_COUNT-1 */ |
Definition at line 125 of file protocol.h.
#define PX4IO_PAGE_SETUP 50 |
Definition at line 151 of file protocol.h.
#define PX4IO_PAGE_STATUS 1 |
Definition at line 96 of file protocol.h.
#define PX4IO_PAGE_TEST 127 |
Definition at line 207 of file protocol.h.
#define PX4IO_PROTOCOL_MAX_CONTROL_COUNT 8 |
The protocol does not support more than set here, individual units might support less - see PX4IO_P_CONFIG_CONTROL_COUNT.
Definition at line 81 of file protocol.h.
#define PX4IO_PROTOCOL_VERSION 5 |
Definition at line 78 of file protocol.h.
Definition at line 148 of file protocol.h.
Definition at line 182 of file protocol.h.
#define PX4IO_THERMAL_FULL 10000 |
Definition at line 198 of file protocol.h.
#define PX4IO_THERMAL_IGNORE UINT16_MAX |
Definition at line 196 of file protocol.h.
#define PX4IO_THERMAL_OFF 0 |
Definition at line 197 of file protocol.h.
Enumerator | |
---|---|
dsm_bind_power_down | |
dsm_bind_power_up | |
dsm_bind_set_rx_out | |
dsm_bind_send_pulses | |
dsm_bind_reinit_uart |
Definition at line 171 of file protocol.h.
Definition at line 282 of file protocol.h.
References crc8_tab, foo, p, and PKT_COUNT.
Referenced by px4flash_event().
Definition at line 245 of file protocol.h.
Referenced by crc_packet().