mirror of
https://github.com/whowechina/chu_pico.git
synced 2024-11-11 22:47:09 +01:00
NKRO with Umiguri default keymap (always on)
This commit is contained in:
parent
f63a404083
commit
46be776a38
Binary file not shown.
@ -20,6 +20,7 @@
|
|||||||
#define RGB_PIN 2
|
#define RGB_PIN 2
|
||||||
#define RGB_ORDER GRB // or RGB
|
#define RGB_ORDER GRB // or RGB
|
||||||
|
|
||||||
|
#define NKRO_KEYMAP "1aqz2swx3dec4frv5gtb6hyn7jum8ki90olp,."
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "tusb.h"
|
#include "tusb.h"
|
||||||
#include "usb_descriptors.h"
|
#include "usb_descriptors.h"
|
||||||
|
|
||||||
|
#include "board_defs.h"
|
||||||
#include "slider.h"
|
#include "slider.h"
|
||||||
#include "air.h"
|
#include "air.h"
|
||||||
#include "rgb.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 uint8_t keycode_table[128][2] = { HID_ASCII_TO_KEYCODE };
|
||||||
|
const char keymap[38 + 1] = NKRO_KEYMAP; // 32 keys, 6 air keys, 1 terminator
|
||||||
const char keymap[33] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456";
|
|
||||||
static void gen_nkro_report()
|
static void gen_nkro_report()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 32; i++) {
|
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 byte = code / 8;
|
||||||
uint8_t bit = code % 8;
|
uint8_t bit = code % 8;
|
||||||
if (slider_touched(i)) {
|
if (slider_touched(i)) {
|
||||||
@ -131,6 +131,16 @@ static void gen_nkro_report()
|
|||||||
hid_nkro.keymap[byte] &= ~(1 << bit);
|
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;
|
static uint64_t last_hid_time = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user