static void send_keyboard(report_keyboard_t *report) { #ifdef BLUEFRUIT_TRACE_SERIAL bluefruit_trace_header(); #endif bluefruit_serial_send(0xFD); for (uint8_t i = 0; i < KEYBOARD_REPORT_SIZE; i++) { bluefruit_serial_send(report->raw[i]); } #ifdef BLUEFRUIT_TRACE_SERIAL bluefruit_trace_footer(); #endif }
static void send_consumer(uint16_t data) { static uint16_t last_data = 0; if (data == last_data) return; last_data = data; uint16_t bitmap = CONSUMER2BLUEFRUIT(data); #ifdef BLUEFRUIT_TRACE_SERIAL dprintf("\nData: "); debug_hex16(data); dprintf("; bitmap: "); debug_hex16(bitmap); dprintf("\n"); bluefruit_trace_header(); #endif bluefruit_serial_send(0xFD); bluefruit_serial_send(0x00); bluefruit_serial_send(0x02); bluefruit_serial_send((bitmap>>8)&0xFF); bluefruit_serial_send(bitmap&0xFF); bluefruit_serial_send(0x00); bluefruit_serial_send(0x00); bluefruit_serial_send(0x00); bluefruit_serial_send(0x00); #ifdef BLUEFRUIT_TRACE_SERIAL bluefruit_trace_footer(); #endif }
static void send_mouse(report_mouse_t *report) { #ifdef BLUEFRUIT_TRACE_SERIAL bluefruit_trace_header(); #endif bluefruit_serial_send(0xFD); bluefruit_serial_send(0x00); bluefruit_serial_send(0x03); bluefruit_serial_send(report->buttons); bluefruit_serial_send(report->x); bluefruit_serial_send(report->y); bluefruit_serial_send(report->v); // should try sending the wheel v here bluefruit_serial_send(report->h); // should try sending the wheel h here bluefruit_serial_send(0x00); #ifdef BLUEFRUIT_TRACE_SERIAL bluefruit_trace_footer(); #endif }