/** * Sends one data id/value pair. */ static void frsky_send_data(int uart, uint8_t id, int16_t data) { /* Cast data to unsigned, because signed shift might behave incorrectly */ uint16_t udata = data; frsky_send_startstop(uart); frsky_send_byte(uart, id); frsky_send_byte(uart, udata); /* LSB */ frsky_send_byte(uart, udata >> 8); /* MSB */ }
/** * Sends one data id/value pair. */ void AP_Frsky_Telem::frsky_send_data(uint8_t id, int16_t data) { /* Cast data to unsigned, because signed shift might behave incorrectly */ uint16_t udata = data; frsky_send_hub_startstop(); frsky_send_byte(id); frsky_send_byte(udata); /* LSB */ frsky_send_byte(udata >> 8); /* MSB */ }
/** * Sends one data id/value pair. */ void AP_Frsky_Telem::frsky_send_data(uint8_t id, int16_t data) { static const uint8_t zero = 0x0; /* Cast data to unsigned, because signed shift might behave incorrectly */ uint16_t udata = data; if (_protocol == FrSkySPORT) { frsky_send_sport_prim(); frsky_send_byte(id); frsky_send_byte(zero); } else { frsky_send_hub_startstop(); frsky_send_byte(id); } frsky_send_byte(udata); /* LSB */ frsky_send_byte(udata >> 8); /* MSB */ if (_protocol == FrSkySPORT) { //Sport expect 32 bits data but we use only 16 bits data, so we send 0 for MSB frsky_send_byte(zero); frsky_send_byte(zero); send_crc(); } }
/* add sport protocol for frsky tx module */ void AP_Frsky_Telem::frsky_send_sport_prim() { static const uint8_t c = 0x10; frsky_send_byte(c); }
/* * send the crc at the end of the S-PORT frame */ void AP_Frsky_Telem::send_crc() { frsky_send_byte(0x00ff-_crc); _crc = 0; }
/* add sport protocol for frsky tx module */ void AP_IO_BOARD::frsky_send_sport_prim() { static const uint8_t c = 0x10; frsky_send_byte(c); }
/* * send the crc at the end of the S-PORT frame */ void AP_IO_BOARD::send_crc() { frsky_send_byte(0x00ff-_crc); _crc = 0; }