summaryrefslogtreecommitdiff
path: root/keyboards/ergodox_infinity
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/ergodox_infinity')
-rw-r--r--keyboards/ergodox_infinity/bootloader_defs.h1
-rw-r--r--keyboards/ergodox_infinity/ergodox_infinity.c85
-rw-r--r--keyboards/ergodox_infinity/keymaps/narze/keymap.c8
-rw-r--r--keyboards/ergodox_infinity/rules.mk24
4 files changed, 63 insertions, 55 deletions
diff --git a/keyboards/ergodox_infinity/bootloader_defs.h b/keyboards/ergodox_infinity/bootloader_defs.h
deleted file mode 100644
index c67153be60..0000000000
--- a/keyboards/ergodox_infinity/bootloader_defs.h
+++ /dev/null
@@ -1 +0,0 @@
-#define KIIBOHD_BOOTLOADER
diff --git a/keyboards/ergodox_infinity/ergodox_infinity.c b/keyboards/ergodox_infinity/ergodox_infinity.c
index 9fda7991f1..c69c1eb36f 100644
--- a/keyboards/ergodox_infinity/ergodox_infinity.c
+++ b/keyboards/ergodox_infinity/ergodox_infinity.c
@@ -6,6 +6,17 @@
#include "lcd_backlight.h"
#endif
+#ifdef WPM_ENABLE
+# include "serial_link/protocol/transport.h"
+# include "wpm.h"
+
+MASTER_TO_ALL_SLAVES_OBJECT(current_wpm, uint8_t);
+static remote_object_t* remote_objects[] = {
+ REMOTE_OBJECT(current_wpm),
+};
+static uint8_t last_sent_wpm = 0;
+#endif
+
void init_serial_link_hal(void) {
PORTA->PCR[1] = PORTx_PCRn_PE | PORTx_PCRn_PS | PORTx_PCRn_PFE | PORTx_PCRn_MUX(2);
PORTA->PCR[2] = PORTx_PCRn_DSE | PORTx_PCRn_SRE | PORTx_PCRn_MUX(2);
@@ -39,30 +50,30 @@ void init_serial_link_hal(void) {
// Which will reduce the brightness range
#define PRESCALAR_DEFINE 0
void lcd_backlight_hal_init(void) {
- // Setup Backlight
+ // Setup Backlight
SIM->SCGC6 |= SIM_SCGC6_FTM0;
FTM0->CNT = 0; // Reset counter
- // PWM Period
- // 16-bit maximum
- FTM0->MOD = 0xFFFF;
+ // PWM Period
+ // 16-bit maximum
+ FTM0->MOD = 0xFFFF;
- // Set FTM to PWM output - Edge Aligned, Low-true pulses
+ // Set FTM to PWM output - Edge Aligned, Low-true pulses
#define CNSC_MODE FTM_SC_CPWMS | FTM_SC_PS(4) | FTM_SC_CLKS(0)
- CHANNEL_RED.CnSC = CNSC_MODE;
- CHANNEL_GREEN.CnSC = CNSC_MODE;
- CHANNEL_BLUE.CnSC = CNSC_MODE;
+ CHANNEL_RED.CnSC = CNSC_MODE;
+ CHANNEL_GREEN.CnSC = CNSC_MODE;
+ CHANNEL_BLUE.CnSC = CNSC_MODE;
- // System clock, /w prescalar setting
- FTM0->SC = FTM_SC_CLKS(1) | FTM_SC_PS(PRESCALAR_DEFINE);
+ // System clock, /w prescalar setting
+ FTM0->SC = FTM_SC_CLKS(1) | FTM_SC_PS(PRESCALAR_DEFINE);
- CHANNEL_RED.CnV = 0;
- CHANNEL_GREEN.CnV = 0;
- CHANNEL_BLUE.CnV = 0;
+ CHANNEL_RED.CnV = 0;
+ CHANNEL_GREEN.CnV = 0;
+ CHANNEL_BLUE.CnV = 0;
- RGB_PORT_GPIO->PDDR |= (1 << RED_PIN);
- RGB_PORT_GPIO->PDDR |= (1 << GREEN_PIN);
- RGB_PORT_GPIO->PDDR |= (1 << BLUE_PIN);
+ RGB_PORT_GPIO->PDDR |= (1 << RED_PIN);
+ RGB_PORT_GPIO->PDDR |= (1 << GREEN_PIN);
+ RGB_PORT_GPIO->PDDR |= (1 << BLUE_PIN);
#define RGB_MODE PORTx_PCRn_SRE | PORTx_PCRn_DSE | PORTx_PCRn_MUX(4)
RGB_PORT->PCR[RED_PIN] = RGB_MODE;
@@ -94,9 +105,9 @@ static uint16_t cie_lightness(uint16_t v) {
}
void lcd_backlight_hal_color(uint16_t r, uint16_t g, uint16_t b) {
- CHANNEL_RED.CnV = cie_lightness(r);
- CHANNEL_GREEN.CnV = cie_lightness(g);
- CHANNEL_BLUE.CnV = cie_lightness(b);
+ CHANNEL_RED.CnV = cie_lightness(r);
+ CHANNEL_GREEN.CnV = cie_lightness(g);
+ CHANNEL_BLUE.CnV = cie_lightness(b);
}
__attribute__ ((weak))
@@ -109,21 +120,39 @@ void matrix_scan_user(void) {
void matrix_init_kb(void) {
- // put your keyboard start-up code here
- // runs once when the firmware starts up
+ // put your keyboard start-up code here
+ // runs once when the firmware starts up
- matrix_init_user();
- // The backlight always has to be initialized, otherwise it will stay lit
+ matrix_init_user();
+ // The backlight always has to be initialized, otherwise it will stay lit
#ifndef VISUALIZER_ENABLE
- lcd_backlight_hal_init();
+ lcd_backlight_hal_init();
+#endif
+#ifdef WPM_ENABLE
+ add_remote_objects(remote_objects, sizeof(remote_objects) / sizeof(remote_object_t*));
#endif
}
void matrix_scan_kb(void) {
- // put your looping keyboard code here
- // runs every cycle (a lot)
-
- matrix_scan_user();
+ // put your looping keyboard code here
+ // runs every cycle (a lot)
+
+#ifdef WPM_ENABLE
+ if (is_serial_link_master()) {
+ uint8_t current_wpm = get_current_wpm();
+ if (current_wpm != last_sent_wpm) {
+ *begin_write_current_wpm() = current_wpm;
+ end_write_current_wpm();
+ last_sent_wpm = current_wpm;
+ }
+ } else if (is_serial_link_connected()) {
+ uint8_t* new_wpm = read_current_wpm();
+ if (new_wpm) {
+ set_current_wpm(*new_wpm);
+ }
+ }
+#endif
+ matrix_scan_user();
}
bool is_keyboard_master(void) {
diff --git a/keyboards/ergodox_infinity/keymaps/narze/keymap.c b/keyboards/ergodox_infinity/keymaps/narze/keymap.c
index 4a4e8ab941..d9499f0037 100644
--- a/keyboards/ergodox_infinity/keymaps/narze/keymap.c
+++ b/keyboards/ergodox_infinity/keymaps/narze/keymap.c
@@ -635,17 +635,17 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// 1. Hold for LGUI, tap for Underscore
case GUI_UNDS:
- perform_space_cadet(record, KC_LGUI, KC_LSFT, KC_MINS);
+ perform_space_cadet(record, keycode, KC_LGUI, KC_LSFT, KC_MINS);
return false;
// 2. Hold for LSHIFT, tap for Parens open
case LSFT_LPRN:
- perform_space_cadet(record, KC_LSFT, KC_LSFT, KC_9);
+ perform_space_cadet(record, keycode, KC_LSFT, KC_LSFT, KC_9);
return false;
// 3. Hold for RSHIFT, tap for Parens close
case RSFT_RPRN:
- perform_space_cadet(record, KC_RSFT, KC_RSFT, KC_0);
+ perform_space_cadet(record, keycode, KC_RSFT, KC_RSFT, KC_0);
return false;
}
@@ -683,7 +683,7 @@ void matrix_scan_user(void) {
// Combos
-void process_combo_event(uint8_t combo_index, bool pressed) {
+void process_combo_event(uint16_t combo_index, bool pressed) {
if (pressed) {
switch(combo_index) {
case CB_SUPERDUPER:
diff --git a/keyboards/ergodox_infinity/rules.mk b/keyboards/ergodox_infinity/rules.mk
index 31bc20454c..b9ead9e87c 100644
--- a/keyboards/ergodox_infinity/rules.mk
+++ b/keyboards/ergodox_infinity/rules.mk
@@ -1,32 +1,12 @@
# MCU name
MCU = MK20DX256
-# Linker script to use
-# - it should exist either in <chibios>/os/common/ports/ARMCMx/compilers/GCC/ld/
-# or <this_dir>/ld/
-# - NOTE: a custom ld script is needed for EEPROM on Teensy LC
-# - LDSCRIPT =
-# - MKL26Z64 for Teensy LC
-# - MK20DX128 for Teensy 3.0
-# - MK20DX256 for Teensy 3.1 and 3.2
-# - MK20DX128BLDR4 for Infinity 60% with Kiibohd bootloader
-# - MK20DX256BLDR8 for Infinity ErgoDox with Kiibohd bootloader
-MCU_LDSCRIPT = MK20DX256BLDR8
-
-# Vector table for application
-# 0x00000000-0x00001000 area is occupied by bootlaoder.*/
-# The CORTEX_VTOR... is needed only for MCHCK/Infinity KB
-OPT_DEFS += -DCORTEX_VTOR_INIT=0x00002000
-
-BOOTLOADER = dfu
+# Bootloader selection
+BOOTLOADER = kiibohd
# Build Options
# comment out to disable the options.
#
-
-DFU_ARGS = -d 1c11:b007
-DFU_SUFFIX_ARGS = -p b007 -v 1c11
-
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control