forked from mirrors/qmk_userspace
Port action_* to mbed
This commit is contained in:
parent
04fe78ee0a
commit
c67ae2a6b5
21 changed files with 92 additions and 64 deletions
|
@ -31,8 +31,8 @@ static uint8_t real_mods = 0;
|
|||
static uint8_t weak_mods = 0;
|
||||
|
||||
#ifdef USB_6KRO_ENABLE
|
||||
#define RO_ADD(a, b) ((a + b) % REPORT_KEYS)
|
||||
#define RO_SUB(a, b) ((a - b + REPORT_KEYS) % REPORT_KEYS)
|
||||
#define RO_ADD(a, b) ((a + b) % KEYBOARD_REPORT_KEYS)
|
||||
#define RO_SUB(a, b) ((a - b + KEYBOARD_REPORT_KEYS) % KEYBOARD_REPORT_KEYS)
|
||||
#define RO_INC(a) RO_ADD(a, 1)
|
||||
#define RO_DEC(a) RO_SUB(a, 1)
|
||||
static int8_t cb_head = 0;
|
||||
|
@ -98,7 +98,7 @@ void del_key(uint8_t key)
|
|||
void clear_keys(void)
|
||||
{
|
||||
// not clear mods
|
||||
for (int8_t i = 1; i < REPORT_SIZE; i++) {
|
||||
for (int8_t i = 1; i < KEYBOARD_REPORT_SIZE; i++) {
|
||||
keyboard_report->raw[i] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ void clear_oneshot_mods(void)
|
|||
uint8_t has_anykey(void)
|
||||
{
|
||||
uint8_t cnt = 0;
|
||||
for (uint8_t i = 1; i < REPORT_SIZE; i++) {
|
||||
for (uint8_t i = 1; i < KEYBOARD_REPORT_SIZE; i++) {
|
||||
if (keyboard_report->raw[i])
|
||||
cnt++;
|
||||
}
|
||||
|
@ -162,7 +162,7 @@ uint8_t get_first_key(void)
|
|||
#ifdef NKRO_ENABLE
|
||||
if (keyboard_nkro) {
|
||||
uint8_t i = 0;
|
||||
for (; i < REPORT_BITS && !keyboard_report->nkro.bits[i]; i++)
|
||||
for (; i < KEYBOARD_REPORT_BITS && !keyboard_report->nkro.bits[i]; i++)
|
||||
;
|
||||
return i<<3 | biton(keyboard_report->nkro.bits[i]);
|
||||
}
|
||||
|
@ -234,7 +234,7 @@ static inline void add_key_byte(uint8_t code)
|
|||
#else
|
||||
int8_t i = 0;
|
||||
int8_t empty = -1;
|
||||
for (; i < REPORT_KEYS; i++) {
|
||||
for (; i < KEYBOARD_REPORT_KEYS; i++) {
|
||||
if (keyboard_report->keys[i] == code) {
|
||||
break;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ static inline void add_key_byte(uint8_t code)
|
|||
empty = i;
|
||||
}
|
||||
}
|
||||
if (i == REPORT_KEYS) {
|
||||
if (i == KEYBOARD_REPORT_KEYS) {
|
||||
if (empty != -1) {
|
||||
keyboard_report->keys[empty] = code;
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ static inline void del_key_byte(uint8_t code)
|
|||
} while (i != cb_tail);
|
||||
}
|
||||
#else
|
||||
for (uint8_t i = 0; i < REPORT_KEYS; i++) {
|
||||
for (uint8_t i = 0; i < KEYBOARD_REPORT_KEYS; i++) {
|
||||
if (keyboard_report->keys[i] == code) {
|
||||
keyboard_report->keys[i] = 0;
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ static inline void del_key_byte(uint8_t code)
|
|||
#ifdef NKRO_ENABLE
|
||||
static inline void add_key_bit(uint8_t code)
|
||||
{
|
||||
if ((code>>3) < REPORT_BITS) {
|
||||
if ((code>>3) < KEYBOARD_REPORT_BITS) {
|
||||
keyboard_report->nkro.bits[code>>3] |= 1<<(code&7);
|
||||
} else {
|
||||
dprintf("add_key_bit: can't add: %02X\n", code);
|
||||
|
@ -298,7 +298,7 @@ static inline void add_key_bit(uint8_t code)
|
|||
|
||||
static inline void del_key_bit(uint8_t code)
|
||||
{
|
||||
if ((code>>3) < REPORT_BITS) {
|
||||
if ((code>>3) < KEYBOARD_REPORT_BITS) {
|
||||
keyboard_report->nkro.bits[code>>3] &= ~(1<<(code&7));
|
||||
} else {
|
||||
dprintf("del_key_bit: can't del: %02X\n", code);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue