30 #if defined(PIOS_INCLUDE_IR_TRANSPONDER)
36 static void ir_invert_bits(uint8_t *
data, uint8_t data_len)
38 for (
int i=0;
i<data_len;
i++) {
53 uint8_t crc_data[4] = {0, 0, 0, 0};
58 uint32_t decimal = 10000000;
61 digit =
MIN(9, (ilap_id / decimal));
62 ilap_id -= digit * decimal;
63 crc_data[
pos] |= (digit << 4) & 0xF0;
65 digit =
MIN(9, (ilap_id / decimal));
66 ilap_id -= digit * decimal;
67 crc_data[
pos] |= digit & 0x0F;
74 data[0] = crc_data[3];
75 data[1] = (crc & 0xFF00) >> 8;
76 data[2] = crc_data[2];
77 data[3] = crc_data[1];
78 data[4] = crc_data[0];
79 data[5] = (crc & 0x00FF);
81 ir_invert_bits(data, 6);
95 crc_data[1] = trackmate_id & 0x00FF;
96 crc_data[0] = (trackmate_id & 0xFF00) >> 8;
100 data[0] = (trackmate_id >> 8) & 0xFF;
101 data[1] = trackmate_id & 0xFF;
102 data[2] = (crc >> 8) & 0xFF;
103 data[3] = crc & 0xFF;
uint16_t PIOS_CRC16_CCITT_updateCRC(uint16_t crc, const uint8_t *data, uint32_t data_len)
Main PiOS header to include all the compiled in PiOS options.
void pios_ir_generate_trackmate_packet(uint16_t trackmate_id, uint8_t *data, uint8_t data_len)
uint8_t data[XFER_BYTES_PER_PACKET]
void pios_ir_generate_ilap_packet(uint32_t ilap_id, uint8_t *data, uint8_t data_len)