#pragma once // Sent by host when connection is initiated. // // Packet structure: // Data: | cmd | // # of Bytes: | 1 | #define CMD_HELLO 0x00 // Sent periodically by host to test connection. // Keyboard should ignore this command. // // Packet structure: // Data: | cmd | // # of Bytes: | 1 | #define CMD_RUTHERE 0x01 // Send keyboard state to host. // // Packet structure: // Data: | cmd | anim state | layer state | layer layout | // # of Bytes: | 1 | 1 | 4 | 1 | // // anim state: // 0x00: RGBMatrix disabled // 0x01: normal animation, no HID data. // 0x02: FFT Animation // // layer state: layer state right now. // This is a uint32_t, where each bit corresponds to a layer index. // Lowest-order bit is base layer, highest bit is layer 31. // Layer indices are defined by the LAYER_* enum in layer.h, // host interface should have a matching enum. // Make sure to update it when you change your layers! // // layer layout: // The layout this layer was designed for. // 0x00: en_us // 0x01: russian #define CMD_SEND_STATE 0x02 // Animation data. Sent by host. // // Packet structure: // Data: | cmd | data type | data | // # of Bytes: | 1 | 1 | ? | // // data type: // Which animation this data is for. These are defined below. // // data: // Animation data. Content depends on data type. #define CMD_ANIM_DATA 0x03 // Data for FFT animation. // Data segment consists of 10 bits, each representing the height of a column. // Minimum height is 0, maximum is 250. #define CMD_ANIM_DATA_fft 0x00 // Sent by keyboard to host when a complete word is typed. // Host checks if this is a known word. // If it is not, host responds with the same CMD (see below). // // Packet structure (sent by keyboard): // Data: | cmd | word length | keycodes | // # of Bytes: | 1 | 1 | ? | // // word length: number of bytes in `keycodes` block // // // Packet structure (sent by host): // Data: | cmd | typo? | // # of Bytes: | 1 | 1 | // // typo: If this is 0x01, the word we got was a typo. #define CMD_SPELLCHECK_WORD 0x04 // Sent by host when a "special char" key is pressed. // Handled by host interface. // // Packet structure: // Data: | cmd | character | // # of Bytes: | 1 | 2 | // // character: // uint16_t, character id // #define CMD_SPECIAL_CHAR 0x05