Files
zsa_qmk_firmware/platforms/webusb.h

47 lines
972 B
C
Raw Normal View History

2019-11-05 19:02:07 +09:00
#pragma once
#include <stdint.h>
#include <stdbool.h>
2019-12-02 18:58:07 +09:00
#ifndef FIRMWARE_VERSION
#define FIRMWARE_VERSION u8"default"
#endif
#define WEBUSB_STOP_BIT -2
#define WEBUSB_BLINK_STEPS 512
#define WEBUSB_BLINK_END WEBUSB_BLINK_STEPS * 60
2019-11-05 19:02:07 +09:00
void webusb_receive(uint8_t *data, uint8_t length);
void webusb_send(uint8_t *data, uint8_t length);
2019-12-04 19:15:04 +09:00
void webusb_layer_event(void);
void webusb_error(uint8_t code);
2019-11-05 19:02:07 +09:00
void webusb_set_pairing_state(void);
bool webusb_receive_quantum(uint8_t *data, uint8_t length);
2019-11-05 19:02:07 +09:00
typedef struct{
bool paired;
bool pairing;
} webusb_state_t;
extern webusb_state_t webusb_state;
enum Webusb_Status_Code {
WEBUSB_STATUS_NOT_PAIRED = -1,
WEBUSB_STATUS_OK,
WEBUSB_STATUS_UNKNOWN_COMMAND,
2020-01-14 17:48:23 -08:00
WEBUSB_STATUS_SAFE_RANGE,
2019-11-05 19:02:07 +09:00
};
enum Webusb_Command_Code {
2019-11-26 11:02:19 +09:00
WEBUSB_CMD_PAIR,
WEBUSB_CMD_GET_FW_VERSION,
WEBUSB_CMD_SAFE_RANGE,
};
2019-11-05 19:02:07 +09:00
enum Webusb_Event_Code {
WEBUSB_EVT_PAIRED,
WEBUSB_EVT_FW_VERSION,
WEBUSB_EVT_SAFE_RANGE,
};