PX4 Firmware
PX4 Autopilot Software http://px4.io
|
Functions | |
static uint8_t | crc8_esc (uint8_t *p, uint8_t len) |
static uint8_t | crc_packet (EscPacket &p) |
void | select_responder (uint8_t sel) |
Select tap esc responder data for serial interface by 74hct151. More... | |
int | initialise_uart (const char *const device, int &uart_fd) |
Opens a device for use as UART. More... | |
int | deinitialise_uart (int &uart_fd) |
Closes a device previously opened with initialise_uart(). More... | |
int | enable_flow_control (int uart_fd, bool enabled) |
Enables/disables flow control for open UART device. More... | |
int | send_packet (int uart_fd, EscPacket &packet, int responder) |
Sends a packet to all ESCs and requests a specific ESC to respond. More... | |
int | read_data_from_uart (int uart_fd, ESC_UART_BUF *const uart_buf) |
Read data from the UART into a buffer. More... | |
int | parse_tap_esc_feedback (ESC_UART_BUF *const serial_buf, EscPacket *const packetdata) |
Parse feedback from an ESC. More... | |
Variables | |
const uint8_t | crc_table [256] |
Lookup-table for faster CRC computation when sending ESC packets. More... | |
|
static |
Definition at line 263 of file tap_esc_common.cpp.
References crc_table.
Referenced by crc_packet(), and parse_tap_esc_feedback().
|
static |
Definition at line 274 of file tap_esc_common.cpp.
References EscPacket::bytes, crc8_esc(), EscPacket::d, and EscPacket::len.
Referenced by send_packet().
int tap_esc_common::deinitialise_uart | ( | int & | uart_fd | ) |
Closes a device previously opened with initialise_uart().
uart_fd | file-descriptor of UART device as provided by initialise_uart() |
Definition at line 106 of file tap_esc_common.cpp.
Referenced by TAP_ESC::~TAP_ESC().
int tap_esc_common::enable_flow_control | ( | int | uart_fd, |
bool | enabled | ||
) |
Enables/disables flow control for open UART device.
uart_fd | file-descriptor of UART device |
enabled | Set true for enabling and false for disabling flow control |
Definition at line 117 of file tap_esc_common.cpp.
Referenced by Mavlink::get_instance_id(), and initialise_uart().
int tap_esc_common::initialise_uart | ( | const char *const | device, |
int & | uart_fd | ||
) |
Opens a device for use as UART.
device | UNIX path of UART device |
uart_fd | file-descriptor of UART device |
Definition at line 66 of file tap_esc_common.cpp.
References B250000, and enable_flow_control().
Referenced by TAP_ESC::init().
int tap_esc_common::parse_tap_esc_feedback | ( | ESC_UART_BUF *const | serial_buf, |
EscPacket *const | packetdata | ||
) |
Parse feedback from an ESC.
serial_buf | Buffer where incoming data will be stored |
packetdata | Packet that will be populated with information from buffer |
Definition at line 177 of file tap_esc_common.cpp.
References EscPacket::bytes, CRC, crc8_esc(), EscPacket::crc_data, EscPacket::d, ESC_UART_BUF::dat_cnt, DATA, ESC_UART_BUF::esc_feedback_buf, ESCBUS_MSG_ID_MAX_NUM, EscPacket::head, ESC_UART_BUF::head, HEAD, ID, EscPacket::len, LEN, EscPacket::msg_id, PACKET_HEAD, state, and UART_BUFFER_SIZE.
Referenced by TAP_ESC::cycle().
int tap_esc_common::read_data_from_uart | ( | int | uart_fd, |
ESC_UART_BUF *const | uart_buf | ||
) |
Read data from the UART into a buffer.
uart_fd | file-descriptor of UART device |
uart_buf | Buffer where incoming data will be stored |
Definition at line 154 of file tap_esc_common.cpp.
References arraySize, ESC_UART_BUF::dat_cnt, ESC_UART_BUF::esc_feedback_buf, read(), ESC_UART_BUF::tail, and UART_BUFFER_SIZE.
Referenced by TAP_ESC::cycle().
void tap_esc_common::select_responder | ( | uint8_t | sel | ) |
Select tap esc responder data for serial interface by 74hct151.
GPIOs to be defined in board_config.h
sel | ID of the ESC (responder) of which feedback is requested |
Definition at line 57 of file tap_esc_common.cpp.
Referenced by send_packet().
int tap_esc_common::send_packet | ( | int | uart_fd, |
EscPacket & | packet, | ||
int | responder | ||
) |
Sends a packet to all ESCs and requests a specific ESC to respond.
uart_fd | file-descriptor of UART device |
packet | Packet to be sent to ESCs. CRC information will be added. |
responder | ID of the ESC (responder) that should return feedback |
Definition at line 138 of file tap_esc_common.cpp.
References crc_packet(), EscPacket::head, select_responder(), and write().
Referenced by Mavlink::begin_send(), TAP_ESC::init(), and TAP_ESC::send_esc_outputs().
const uint8_t tap_esc_common::crc_table |
Lookup-table for faster CRC computation when sending ESC packets.
Definition at line 282 of file tap_esc_common.cpp.
Referenced by crc8_esc().