QMK/keyboards/betalupi_ergodox/rawhid.h

83 lines
1.9 KiB
C
Raw Normal View History

2022-07-08 10:50:17 -07:00
#pragma once
#include "betalupi_ergodox.h"
#include "raw_hid.h"
void raw_hid_receive(uint8_t *data, uint8_t length);
void hid_send_state(void);
2022-07-20 21:19:13 -07:00
void hid_send_word(void);
2022-07-08 10:50:17 -07:00
2022-07-09 20:34:43 -07:00
void cmd_animation(uint8_t *data, uint8_t length);
2022-07-08 10:50:17 -07:00
2022-07-09 20:34:43 -07:00
#ifdef RGB_MATRIX_FRAMEBUFFER_EFFECTS
extern uint8_t g_rgb_frame_buffer[MATRIX_ROWS][MATRIX_COLS];
2022-07-08 10:50:17 -07:00
#endif
2022-07-09 20:34:43 -07:00
2022-07-08 10:50:17 -07:00
// Sent by host when connection is initiated.
2022-07-09 13:34:45 -07:00
//
// Packet structure:
// Data: | cmd |
// # of Bytes: | 1 |
2022-07-08 10:50:17 -07:00
#define CMD_HELLO 0x00
2022-07-09 13:34:45 -07:00
// Sent periodically by host to test connection.
// Keyboard should ignore this command.
//
// Packet structure:
// Data: | cmd |
// # of Bytes: | 1 |
#define CMD_RUTHERE 0x01
2022-07-08 10:50:17 -07:00
// Send keyboard state to host.
//
// Packet structure:
// Data: | cmd | anim state |
// # of Bytes: | 1 | 1 |
//
// anim state:
// 0x00: RGBMatrix disabled
// 0x01: normal animation, no HID data.
// 0x02: FFT Animation
2022-07-09 13:34:45 -07:00
#define CMD_SEND_STATE 0x02
2022-07-08 10:50:17 -07:00
2022-07-20 21:19:13 -07:00
// 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
2022-07-08 10:50:17 -07:00
// 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.
2022-07-09 13:34:45 -07:00
#define CMD_ANIM_DATA 0x03
2022-07-08 10:50:17 -07:00
// 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
2022-07-09 13:34:45 -07:00