mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-03-13 23:14:09 +00:00
Port changes to other launch boards
This commit is contained in:
parent
6419d4409a
commit
a04a16160a
@ -26,6 +26,9 @@
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
// NKRO must be used
|
||||
#define FORCE_NKRO
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
|
||||
|
@ -1,92 +1,8 @@
|
||||
#include "dynamic_keymap.h"
|
||||
#include "raw_hid.h"
|
||||
#include "tmk_core/common/eeprom.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "launch_alpha_1.h"
|
||||
|
||||
enum Command {
|
||||
// Probe for System76 EC protocol
|
||||
CMD_PROBE = 1,
|
||||
// Read board string
|
||||
CMD_BOARD = 2,
|
||||
// Read version string
|
||||
CMD_VERSION = 3,
|
||||
// Get keyboard map index
|
||||
CMD_KEYMAP_GET = 9,
|
||||
// Set keyboard map index
|
||||
CMD_KEYMAP_SET = 10,
|
||||
};
|
||||
|
||||
static bool keymap_get(uint8_t layer, uint8_t output, uint8_t input, uint16_t *value) {
|
||||
if (layer < dynamic_keymap_get_layer_count()) {
|
||||
if (output < MATRIX_ROWS) {
|
||||
if (input < MATRIX_COLS) {
|
||||
*value = dynamic_keymap_get_keycode(layer, output, input);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool keymap_set(uint8_t layer, uint8_t output, uint8_t input, uint16_t value) {
|
||||
if (layer < dynamic_keymap_get_layer_count()) {
|
||||
if (output < MATRIX_ROWS) {
|
||||
if (input < MATRIX_COLS) {
|
||||
dynamic_keymap_set_keycode(layer, output, input, value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void raw_hid_receive(uint8_t *data, uint8_t length) {
|
||||
// Error response by default, set to success by commands
|
||||
data[1] = 1;
|
||||
|
||||
switch (data[0]) {
|
||||
case CMD_PROBE:
|
||||
// Signature
|
||||
data[2] = 0x76;
|
||||
data[3] = 0xEC;
|
||||
// Version
|
||||
data[4] = 0x01;
|
||||
data[1] = 0;
|
||||
break;
|
||||
case CMD_BOARD:
|
||||
strncpy((char *)&data[2], QMK_KEYBOARD, length - 2);
|
||||
data[1] = 0;
|
||||
break;
|
||||
case CMD_VERSION:
|
||||
strncpy((char *)&data[2], QMK_VERSION, length - 2);
|
||||
data[1] = 0;
|
||||
break;
|
||||
case CMD_KEYMAP_GET:
|
||||
{
|
||||
uint16_t value = 0;
|
||||
if (keymap_get(data[2], data[3], data[4], &value)) {
|
||||
data[5] = (uint8_t)value;
|
||||
data[6] = (uint8_t)(value >> 8);
|
||||
data[1] = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CMD_KEYMAP_SET:
|
||||
{
|
||||
uint16_t value =
|
||||
((uint16_t)data[5]) |
|
||||
(((uint16_t)data[6]) << 8);
|
||||
if (keymap_set(data[2], data[3], data[4], value)) {
|
||||
data[1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
raw_hid_send(data, length);
|
||||
}
|
||||
|
||||
bool eeprom_is_valid(void) {
|
||||
return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC &&
|
||||
eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION);
|
||||
|
@ -16,9 +16,13 @@ BOOTLOADER = caterina
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
DYNAMIC_KEYMAP_ENABLE = yes # Reconfigurable keyboard without flashing firmware
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
RAW_ENABLE = yes # Enable RAW HID commands (used by keyboard configurator)
|
||||
USB_6KRO_ENABLE = no # 6key Rollover
|
||||
|
||||
# Add System76 EC command interface
|
||||
SRC+=../system76_ec.c
|
||||
|
@ -26,6 +26,9 @@
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCE 5
|
||||
|
||||
// NKRO must be used
|
||||
#define FORCE_NKRO
|
||||
|
||||
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
|
||||
#define LOCKING_SUPPORT_ENABLE
|
||||
|
||||
|
@ -1,92 +1,8 @@
|
||||
#include "dynamic_keymap.h"
|
||||
#include "raw_hid.h"
|
||||
#include "tmk_core/common/eeprom.h"
|
||||
#include "version.h"
|
||||
|
||||
#include "launch_alpha_2.h"
|
||||
|
||||
enum Command {
|
||||
// Probe for System76 EC protocol
|
||||
CMD_PROBE = 1,
|
||||
// Read board string
|
||||
CMD_BOARD = 2,
|
||||
// Read version string
|
||||
CMD_VERSION = 3,
|
||||
// Get keyboard map index
|
||||
CMD_KEYMAP_GET = 9,
|
||||
// Set keyboard map index
|
||||
CMD_KEYMAP_SET = 10,
|
||||
};
|
||||
|
||||
static bool keymap_get(uint8_t layer, uint8_t output, uint8_t input, uint16_t *value) {
|
||||
if (layer < dynamic_keymap_get_layer_count()) {
|
||||
if (output < MATRIX_ROWS) {
|
||||
if (input < MATRIX_COLS) {
|
||||
*value = dynamic_keymap_get_keycode(layer, output, input);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool keymap_set(uint8_t layer, uint8_t output, uint8_t input, uint16_t value) {
|
||||
if (layer < dynamic_keymap_get_layer_count()) {
|
||||
if (output < MATRIX_ROWS) {
|
||||
if (input < MATRIX_COLS) {
|
||||
dynamic_keymap_set_keycode(layer, output, input, value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void raw_hid_receive(uint8_t *data, uint8_t length) {
|
||||
// Error response by default, set to success by commands
|
||||
data[1] = 1;
|
||||
|
||||
switch (data[0]) {
|
||||
case CMD_PROBE:
|
||||
// Signature
|
||||
data[2] = 0x76;
|
||||
data[3] = 0xEC;
|
||||
// Version
|
||||
data[4] = 0x01;
|
||||
data[1] = 0;
|
||||
break;
|
||||
case CMD_BOARD:
|
||||
strncpy((char *)&data[2], QMK_KEYBOARD, length - 2);
|
||||
data[1] = 0;
|
||||
break;
|
||||
case CMD_VERSION:
|
||||
strncpy((char *)&data[2], QMK_VERSION, length - 2);
|
||||
data[1] = 0;
|
||||
break;
|
||||
case CMD_KEYMAP_GET:
|
||||
{
|
||||
uint16_t value = 0;
|
||||
if (keymap_get(data[2], data[3], data[4], &value)) {
|
||||
data[5] = (uint8_t)value;
|
||||
data[6] = (uint8_t)(value >> 8);
|
||||
data[1] = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case CMD_KEYMAP_SET:
|
||||
{
|
||||
uint16_t value =
|
||||
((uint16_t)data[5]) |
|
||||
(((uint16_t)data[6]) << 8);
|
||||
if (keymap_set(data[2], data[3], data[4], value)) {
|
||||
data[1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
raw_hid_send(data, length);
|
||||
}
|
||||
|
||||
bool eeprom_is_valid(void) {
|
||||
return (eeprom_read_word(((void*)EEPROM_MAGIC_ADDR)) == EEPROM_MAGIC &&
|
||||
eeprom_read_byte(((void*)EEPROM_VERSION_ADDR)) == EEPROM_VERSION);
|
||||
|
@ -16,9 +16,13 @@ BOOTLOADER = caterina
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
|
||||
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
|
||||
EXTRAKEY_ENABLE = no # Audio control and System control(+450)
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
|
||||
CONSOLE_ENABLE = no # Console for debug(+400)
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
DYNAMIC_KEYMAP_ENABLE = yes # Reconfigurable keyboard without flashing firmware
|
||||
NKRO_ENABLE = yes # USB Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
|
||||
RAW_ENABLE = yes # Enable RAW HID commands (used by keyboard configurator)
|
||||
USB_6KRO_ENABLE = no # 6key Rollover
|
||||
|
||||
# Add System76 EC command interface
|
||||
SRC+=../system76_ec.c
|
||||
|
@ -33,7 +33,7 @@ RGB_MATRIX_ENABLE = WS2812 # Support for RGB matrix
|
||||
USB_6KRO_ENABLE = no # 6key Rollover
|
||||
|
||||
# Add System76 EC command interface
|
||||
SRC+=system76_ec.c
|
||||
SRC+=../system76_ec.c
|
||||
|
||||
# Add I2C driver
|
||||
SRC+=i2c.c
|
||||
|
Loading…
Reference in New Issue
Block a user