summaryrefslogtreecommitdiffstats
path: root/keyboards/tmo50
diff options
context:
space:
mode:
authorEmīls Delle <emiilsdelle@gmail.com>2019-02-04 23:12:23 +0100
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-02-04 23:12:23 +0100
commitff893bf17c454f28a8a00f9bf27d4ec4a72727e9 (patch)
tree1f679ec128a58bf6b6aebf7e61cf55bafe428f76 /keyboards/tmo50
parentb49dbf9b19264e7558253a34ca737dcd301487b1 (diff)
downloadqmk_firmware-ff893bf17c454f28a8a00f9bf27d4ec4a72727e9.tar.gz
qmk_firmware-ff893bf17c454f28a8a00f9bf27d4ec4a72727e9.tar.xz
Tmo50 indicators (#5044)
* Create ISO HHKB keymapping for GH60 * Add media controls to Fn layer * Use M(x) instead of F(x), add Copyright text * Add README for additional information about TMO50 features/quirks * Add indicator LED code * Move indicator code to tmo50.c
Diffstat (limited to 'keyboards/tmo50')
-rw-r--r--keyboards/tmo50/keymaps/default/keymap.c1
-rw-r--r--keyboards/tmo50/tmo50.c41
2 files changed, 41 insertions, 1 deletions
diff --git a/keyboards/tmo50/keymaps/default/keymap.c b/keyboards/tmo50/keymaps/default/keymap.c
index 419893f1a..7b8b644cc 100644
--- a/keyboards/tmo50/keymaps/default/keymap.c
+++ b/keyboards/tmo50/keymaps/default/keymap.c
@@ -48,4 +48,3 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
),
};
-
diff --git a/keyboards/tmo50/tmo50.c b/keyboards/tmo50/tmo50.c
index a42ab4720..4f6288133 100644
--- a/keyboards/tmo50/tmo50.c
+++ b/keyboards/tmo50/tmo50.c
@@ -19,6 +19,15 @@ void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
+ DDRB |= (1 << PB0); //init B0
+ PORTB &= ~(1 << PB0); //turn on B0
+ DDRB |= (1 << PB1);
+ PORTB |= (1<<PB1); //turn off B1
+ DDRB |= (1 << PB2);
+ PORTB |= (1<<PB2);
+ DDRB |= (1 << PB3);
+ PORTB |= (1<<PB3);
+
matrix_init_user();
}
@@ -41,3 +50,35 @@ void led_set_kb(uint8_t usb_led) {
led_set_user(usb_led);
}
+
+uint32_t layer_state_set_user(uint32_t state)
+{
+ // if on layer 0, turn on B0 LED, otherwise off.
+ if (biton32(state) == 0) {
+ PORTB &= ~(1<<PB0);
+ } else {
+ PORTB |= (1<<PB0);
+ }
+
+ // if on layer 1, turn on B1 LED, otherwise off.
+ if (biton32(state) == 1) {
+ PORTB &= ~(1<<PB1);
+ } else {
+ PORTB |= (1<<PB1);
+ }
+ // if on layer 2, turn on B2 LED, otherwise off.
+ if (biton32(state) == 2) {
+ PORTB &= ~(1<<PB2);
+ } else {
+ PORTB |= (1<<PB2);
+ }
+
+ // if on layer 3, turn on B3 LED, otherwise off.
+ if (biton32(state) == 3) {
+ PORTB &= ~(1<<PB3);
+ } else {
+ PORTB |= (1<<PB3);
+ }
+
+ return state;
+}