aboutsummaryrefslogtreecommitdiffstats
path: root/keyboards/handwired/onekey
diff options
context:
space:
mode:
authorJoel Challis <git@zvecr.com>2019-10-05 16:57:00 +0100
committerGitHub <noreply@github.com>2019-10-05 16:57:00 +0100
commit38aefaf78e3d9f17ef561f031679a02c9fba869c (patch)
tree9de5fc423f20d27daedeee0500faad57ce8712a2 /keyboards/handwired/onekey
parent60b2a9a5ea88321629e970e936652cc1ba786b80 (diff)
downloadfirmware-38aefaf78e3d9f17ef561f031679a02c9fba869c.tar.gz
firmware-38aefaf78e3d9f17ef561f031679a02c9fba869c.tar.bz2
firmware-38aefaf78e3d9f17ef561f031679a02c9fba869c.zip
ARM - Initial backlight support (#6487)
* Move AVR backlight to own file, add borrowed ARM implementation * Tiny fix for backlight custom logic * Remove duplicate board from rebase * Fix f303 onekey example * clang-format * clang-format * Remove backlight keymap debug * Initial pass of ARM backlight docs * Initial pass of ARM backlight docs - resolve todos * fix rules validation logic * Add f072 warning * Add f072 warning * tidy up breathing in backlight keymap * tidy up breathing in backlight keymap * add missing break to backlight keymap
Diffstat (limited to 'keyboards/handwired/onekey')
-rw-r--r--keyboards/handwired/onekey/bluepill/config.h4
-rw-r--r--keyboards/handwired/onekey/bluepill/halconf.h2
-rw-r--r--keyboards/handwired/onekey/bluepill/mcuconf.h6
-rw-r--r--keyboards/handwired/onekey/bluepill/rules.mk6
-rw-r--r--keyboards/handwired/onekey/config.h2
-rw-r--r--keyboards/handwired/onekey/keymaps/backlight/config.h3
-rw-r--r--keyboards/handwired/onekey/keymaps/backlight/keymap.c40
-rw-r--r--keyboards/handwired/onekey/keymaps/backlight/rules.mk2
-rw-r--r--keyboards/handwired/onekey/proton_c/config.h5
-rw-r--r--keyboards/handwired/onekey/stm32f0_disco/config.h5
10 files changed, 70 insertions, 5 deletions
diff --git a/keyboards/handwired/onekey/bluepill/config.h b/keyboards/handwired/onekey/bluepill/config.h
index 3d88ee00e..81282ae1f 100644
--- a/keyboards/handwired/onekey/bluepill/config.h
+++ b/keyboards/handwired/onekey/bluepill/config.h
@@ -21,3 +21,7 @@
#define MATRIX_COL_PINS { B0 }
#define MATRIX_ROW_PINS { A7 }
#define UNUSED_PINS
+
+#define BACKLIGHT_PIN A0
+#define BACKLIGHT_PWM_DRIVER PWMD2
+#define BACKLIGHT_PWM_CHANNEL 1
diff --git a/keyboards/handwired/onekey/bluepill/halconf.h b/keyboards/handwired/onekey/bluepill/halconf.h
index 72879a575..53b2f91e3 100644
--- a/keyboards/handwired/onekey/bluepill/halconf.h
+++ b/keyboards/handwired/onekey/bluepill/halconf.h
@@ -146,7 +146,7 @@
* @brief Enables the SPI subsystem.
*/
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
-#define HAL_USE_SPI TRUE
+#define HAL_USE_SPI FALSE
#endif
/**
diff --git a/keyboards/handwired/onekey/bluepill/mcuconf.h b/keyboards/handwired/onekey/bluepill/mcuconf.h
index fced27289..a645d3c5d 100644
--- a/keyboards/handwired/onekey/bluepill/mcuconf.h
+++ b/keyboards/handwired/onekey/bluepill/mcuconf.h
@@ -132,8 +132,8 @@
* PWM driver system settings.
*/
#define STM32_PWM_USE_ADVANCED FALSE
-#define STM32_PWM_USE_TIM1 TRUE
-#define STM32_PWM_USE_TIM2 FALSE
+#define STM32_PWM_USE_TIM1 FALSE
+#define STM32_PWM_USE_TIM2 TRUE
#define STM32_PWM_USE_TIM3 FALSE
#define STM32_PWM_USE_TIM4 FALSE
#define STM32_PWM_USE_TIM5 FALSE
@@ -168,7 +168,7 @@
* SPI driver system settings.
*/
#define STM32_SPI_USE_SPI1 FALSE
-#define STM32_SPI_USE_SPI2 TRUE
+#define STM32_SPI_USE_SPI2 FALSE
#define STM32_SPI_USE_SPI3 FALSE
#define STM32_SPI_SPI1_DMA_PRIORITY 1
#define STM32_SPI_SPI2_DMA_PRIORITY 1
diff --git a/keyboards/handwired/onekey/bluepill/rules.mk b/keyboards/handwired/onekey/bluepill/rules.mk
index 46274066d..aeda2782b 100644
--- a/keyboards/handwired/onekey/bluepill/rules.mk
+++ b/keyboards/handwired/onekey/bluepill/rules.mk
@@ -1,7 +1,11 @@
# GENERIC STM32F103C8T6 board - stm32duino bootloader
+BOARD = GENERIC_STM32_F103
+
OPT_DEFS = -DCORTEX_VTOR_INIT=0x2000
MCU_LDSCRIPT = STM32F103x8_stm32duino_bootloader
-BOARD = GENERIC_STM32_F103
+
+DFU_ARGS = -d 1eaf:0003 -a2 -R
+DFU_SUFFIX_ARGS ?= -v 1eaf -p 0003
# OPT_DEFS =
# MCU_LDSCRIPT = STM32F103x8
diff --git a/keyboards/handwired/onekey/config.h b/keyboards/handwired/onekey/config.h
index 6f7ec1289..64a447481 100644
--- a/keyboards/handwired/onekey/config.h
+++ b/keyboards/handwired/onekey/config.h
@@ -35,6 +35,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
+#define TAPPING_TERM 500
+
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
diff --git a/keyboards/handwired/onekey/keymaps/backlight/config.h b/keyboards/handwired/onekey/keymaps/backlight/config.h
new file mode 100644
index 000000000..af01528b4
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/backlight/config.h
@@ -0,0 +1,3 @@
+#pragma once
+
+#define BACKLIGHT_BREATHING
diff --git a/keyboards/handwired/onekey/keymaps/backlight/keymap.c b/keyboards/handwired/onekey/keymaps/backlight/keymap.c
new file mode 100644
index 000000000..1f4be16a6
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/backlight/keymap.c
@@ -0,0 +1,40 @@
+#include QMK_KEYBOARD_H
+
+//Tap Dance Declarations
+enum {
+ TD_BL = 0
+};
+
+void dance_cln_finished (qk_tap_dance_state_t *state, void *user_data) {
+ // noop
+}
+
+void dance_cln_reset (qk_tap_dance_state_t *state, void *user_data) {
+ switch (state->count) {
+ case 1:
+ // single tap - step through backlight
+ backlight_step();
+ break;
+#ifdef BACKLIGHT_BREATHING
+ case 2:
+ // double tap - toggle breathing
+ breathing_toggle();
+ break;
+ case 3:
+ //tripple tap - do some pulse stuff
+ breathing_pulse();
+ break;
+#endif
+ default:
+ // more - nothing
+ break;
+ }
+}
+
+qk_tap_dance_action_t tap_dance_actions[] = {
+ [TD_BL] = ACTION_TAP_DANCE_FN_ADVANCED (NULL, dance_cln_finished, dance_cln_reset)
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+ LAYOUT( TD(TD_BL) )
+};
diff --git a/keyboards/handwired/onekey/keymaps/backlight/rules.mk b/keyboards/handwired/onekey/keymaps/backlight/rules.mk
new file mode 100644
index 000000000..176e09977
--- /dev/null
+++ b/keyboards/handwired/onekey/keymaps/backlight/rules.mk
@@ -0,0 +1,2 @@
+BACKLIGHT_ENABLE = yes
+TAP_DANCE_ENABLE = yes
diff --git a/keyboards/handwired/onekey/proton_c/config.h b/keyboards/handwired/onekey/proton_c/config.h
index f6bedcfe6..d4fb9c829 100644
--- a/keyboards/handwired/onekey/proton_c/config.h
+++ b/keyboards/handwired/onekey/proton_c/config.h
@@ -21,3 +21,8 @@
#define MATRIX_COL_PINS { A3 }
#define MATRIX_ROW_PINS { A2 }
#define UNUSED_PINS
+
+#define BACKLIGHT_PIN B8
+#define BACKLIGHT_PWM_DRIVER PWMD4
+#define BACKLIGHT_PWM_CHANNEL 3
+#define BACKLIGHT_PAL_MODE 2
diff --git a/keyboards/handwired/onekey/stm32f0_disco/config.h b/keyboards/handwired/onekey/stm32f0_disco/config.h
index 039a1beff..4024ee1ca 100644
--- a/keyboards/handwired/onekey/stm32f0_disco/config.h
+++ b/keyboards/handwired/onekey/stm32f0_disco/config.h
@@ -21,3 +21,8 @@
#define MATRIX_COL_PINS { B4 }
#define MATRIX_ROW_PINS { B5 }
#define UNUSED_PINS
+
+#define BACKLIGHT_PIN C8
+#define BACKLIGHT_PWM_DRIVER PWMD3
+#define BACKLIGHT_PWM_CHANNEL 3
+#define BACKLIGHT_PAL_MODE 0