mirror of
https://github.com/whowechina/chu_pico.git
synced 2024-11-28 12:40:48 +01:00
Merge branch 'main' of https://github.com/whowechina/chu_pico
This commit is contained in:
commit
ed1af36ef6
Binary file not shown.
@ -20,6 +20,7 @@
|
||||
#define RGB_PIN 2
|
||||
#define RGB_ORDER GRB // or RGB
|
||||
|
||||
#define NKRO_KEYMAP "1aqz2swx3dec4frv5gtb6hyn7jum8ki90olp,."
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "tusb.h"
|
||||
#include "usb_descriptors.h"
|
||||
|
||||
#include "board_defs.h"
|
||||
#include "slider.h"
|
||||
#include "air.h"
|
||||
#include "rgb.h"
|
||||
@ -117,12 +118,11 @@ static void gen_joy_report()
|
||||
}
|
||||
|
||||
const uint8_t keycode_table[128][2] = { HID_ASCII_TO_KEYCODE };
|
||||
|
||||
const char keymap[33] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456";
|
||||
const char keymap[38 + 1] = NKRO_KEYMAP; // 32 keys, 6 air keys, 1 terminator
|
||||
static void gen_nkro_report()
|
||||
{
|
||||
for (int i = 0; i < 32; i++) {
|
||||
uint8_t code = keycode_table[i + 'A'][1];
|
||||
uint8_t code = keycode_table[keymap[i]][1];
|
||||
uint8_t byte = code / 8;
|
||||
uint8_t bit = code % 8;
|
||||
if (slider_touched(i)) {
|
||||
@ -131,6 +131,16 @@ static void gen_nkro_report()
|
||||
hid_nkro.keymap[byte] &= ~(1 << bit);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
uint8_t code = keycode_table[keymap[32 + i]][1];
|
||||
uint8_t byte = code / 8;
|
||||
uint8_t bit = code % 8;
|
||||
if (hid_joy.buttons & (1 << i)) {
|
||||
hid_nkro.keymap[byte] |= (1 << bit);
|
||||
} else {
|
||||
hid_nkro.keymap[byte] &= ~(1 << bit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t last_hid_time = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user