QMK/keyboards/betalupi_ergodox/rawhid.h

110 lines
2.6 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);
2022-07-20 21:19:13 -07:00
void hid_send_word(void);
2022-07-08 10:50:17 -07:00
// hid_send_state with advanced arguments
typedef struct {
uint32_t state;
} _hid_send_state_args;
void _hid_send_state(_hid_send_state_args args);
#define hid_send_state(...) _hid_send_state( \
(_hid_send_state_args) { \
.state = 0, \
__VA_ARGS__ \
} \
)
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 | layer state | layer layout |
// # of Bytes: | 1 | 1 | 4 | 1 |
2022-07-08 10:50:17 -07:00
//
// 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
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