WIP keymaps
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "keymap.h"
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/util/queue.h"
|
||||
#include "pico/multicore.h"
|
||||
@@ -34,6 +35,7 @@ void holdForEnable();
|
||||
uint8_t readCommand();
|
||||
void sendByte(uint8_t payload);
|
||||
void sendNextKey();
|
||||
void transmitKey(uint8_t key);
|
||||
|
||||
queue_t key_queue;
|
||||
|
||||
@@ -143,10 +145,26 @@ void sendNextKey() {
|
||||
while (time_us_64() - startTime < 250000) { // 250ms timeout
|
||||
uint8_t key;
|
||||
if (queue_try_remove(&key_queue, &key)) {
|
||||
sendByte(key); // TODO: Replace with mac-plus-ps2's sendKey()
|
||||
transmitKey(key); // TODO: Replace with mac-plus-ps2's sendKey()
|
||||
return;
|
||||
}
|
||||
sleep_us(2);
|
||||
}
|
||||
sendByte(NULL_TRANSITION); // Send null transition if no key is available
|
||||
}
|
||||
|
||||
void transmitKey(uint8_t key) {
|
||||
if (key & 0x0100){
|
||||
sendByte(0x79);
|
||||
readCommand();
|
||||
sendByte(key);
|
||||
} else if (key & 0x0200) {
|
||||
sendByte(0x71);
|
||||
readCommand();
|
||||
sendByte(0x79);
|
||||
readCommand();
|
||||
sendByte(key);
|
||||
} else {
|
||||
sendByte(key);
|
||||
}
|
||||
}
|
||||
|
||||
33
src/keymap.h
Normal file
33
src/keymap.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef KEYMAP
|
||||
#define KEYMAP
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
|
||||
const uint8_t keymap[29] = {
|
||||
// A B C D E F G H I
|
||||
0x01, 0x17, 0x11, 0x05, 0x1D, 0x07, 0x0B, 0x09, 0x45,
|
||||
// J K L M N O P Q R
|
||||
0x4D, 0x51, 0x4B, 0x5D, 0x5B, 0x3F, 0x47, 0x19, 0x1F,
|
||||
// S T U V W X Y Z [
|
||||
0x03, 0x23, 0x41, 0x13, 0x1B, 0x0F, 0x13, 0x0D, 0x43,
|
||||
// \ ]
|
||||
0x55, 0x3D
|
||||
};
|
||||
|
||||
const uint8_t numpad[18] = {
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
0x25, 0x27, 0x29, 0x2B, 0x2D, 0x2F, 0x31, 0x33, 0x35,
|
||||
// 0 . Enter ⬇️ ⬆️ ➡️ ⬅️ - Clear
|
||||
0x39, 0x03, 0x19, 0x11, 0x1B, 0x05, 0x0D, 0x1D, 0x0F
|
||||
};
|
||||
|
||||
const uint8_t numpad_ascii[18] = {
|
||||
//0 1 2 3 4 5 6 7 8
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8',
|
||||
// 9 . Enter ⬇️ ⬆️ ➡️ ⬅️ - Clear
|
||||
'9', '.', 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // TODO: Replace with actual values once known
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user