aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjpetermans <tibcmhhm@gmail.com>2017-04-06 13:51:33 -0700
committerjpetermans <tibcmhhm@gmail.com>2017-04-06 13:51:33 -0700
commit02ef122cbbf7b9f94de5f1248fd7f8ec0351f4b4 (patch)
tree4881311251b46dd0e2a242966017a801a7464c66
parentf66361d678047af31d9d48ca6c22afcc48756882 (diff)
downloadqmk_firmware-02ef122cbbf7b9f94de5f1248fd7f8ec0351f4b4.tar.gz
qmk_firmware-02ef122cbbf7b9f94de5f1248fd7f8ec0351f4b4.zip
Add led_controller.h to user keymap.c
-rw-r--r--keyboards/infinity60/keymaps/jpetermans/keymap.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/keyboards/infinity60/keymaps/jpetermans/keymap.c b/keyboards/infinity60/keymaps/jpetermans/keymap.c
index be0bee544..2c38068fe 100644
--- a/keyboards/infinity60/keymaps/jpetermans/keymap.c
+++ b/keyboards/infinity60/keymaps/jpetermans/keymap.c
@@ -1,5 +1,5 @@
1#include "infinity60.h" 1#include "infinity60.h"
2#include "backlight.h" 2#include "led_controller.h"
3 3
4//Helpful Defines 4//Helpful Defines
5#define _______ KC_TRNS 5#define _______ KC_TRNS
@@ -57,7 +57,7 @@ const uint16_t keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
57 _______,_______,_______,_______,_______,_______,_______, _______, _______, _______,KC_MUTE, KC_VOLD, KC_VOLU,_______,KC_NO,\ 57 _______,_______,_______,_______,_______,_______,_______, _______, _______, _______,KC_MUTE, KC_VOLD, KC_VOLU,_______,KC_NO,\
58 _______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______, _______,_______,_______,\ 58 _______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______, _______,_______,_______,\
59 _______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______, _______,_______, \ 59 _______,_______,_______,_______,_______,_______,_______, _______, _______, _______,_______, _______,_______, \
60 _______,_______,F(2),M(1),_______,_______,_______, _______, KC_MPRV, KC_MNXT,KC_MSTP, _______,KC_NO, \ 60 _______,_______,F(2),F(3),_______,_______,_______, _______, KC_MPRV, KC_MNXT,KC_MSTP, _______,KC_NO, \
61 _______,_______,_______, KC_MPLY, _______,_______, _______,_______ \ 61 _______,_______,_______, KC_MPLY, _______,_______, _______,_______ \
62 ), 62 ),
63 /* ~ */ 63 /* ~ */
@@ -85,12 +85,15 @@ enum function_id {
85 85
86enum macro_id { 86enum macro_id {
87 ACTION_LEDS_ALL, 87 ACTION_LEDS_ALL,
88 ACTION_LEDS_GAME
88}; 89};
89 90
90const uint16_t fn_actions[] = { 91const uint16_t fn_actions[] = {
91 [0] = ACTION_KEY(LALT(LCTL(KC_DEL))), 92 [0] = ACTION_KEY(LALT(LCTL(KC_DEL))),
92 [1] = ACTION_LAYER_MODS(_TILDE, MOD_LSFT), 93 [1] = ACTION_LAYER_MODS(_TILDE, MOD_LSFT),
93 [2] = ACTION_BACKLIGHT_TOGGLE() 94 [2] = ACTION_FUNCTION(ACTION_LEDS_ALL),
95 [3] = ACTION_FUNCTION(ACTION_LEDS_GAME)
96
94/* [1] = ACTION_FUNCTION(ACTION_LEDS_GAME), 97/* [1] = ACTION_FUNCTION(ACTION_LEDS_GAME),
95 98
96 [4] = ACTION_USAGE_CONSUMER(0x1B4), 99 [4] = ACTION_USAGE_CONSUMER(0x1B4),
@@ -101,27 +104,29 @@ const uint16_t fn_actions[] = {
101}; 104};
102 105
103/* custom action function */ 106/* custom action function */
104/*
105void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { 107void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
106 (void)opt; 108 (void)opt;
107 switch(id) { 109 switch(id) {
108 case 1: 110 case ACTION_LEDS_ALL:
109 if(record->event.pressed) { 111 if(record->event.pressed) {
110 // signal the LED controller thread 112 // signal the LED controller thread
111 chMBPost(&led_mailbox, LED_MSG_GAME_TOGGLE, TIME_IMMEDIATE); 113 chMBPost(&led_mailbox, LED_MSG_GAME_TOGGLE, TIME_IMMEDIATE);
112 } 114 }
113 break; 115 break;
114 } 116 case ACTION_LEDS_GAME:
115 117 if(record->event.pressed) {
118 // signal the LED controller thread
119 chMBPost(&led_mailbox, LED_MSG_ALL_TOGGLE, TIME_IMMEDIATE);
120 }
121 break;
122 }
116} 123}
117*/
118 124
119const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt) 125const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
120{ 126{
121 switch(id) { 127 switch(id) {
122 case 0: 128 case 0:
123 if (record->event.pressed) { 129 if (record->event.pressed) {
124 return MACRO( I(5), END);
125 } 130 }
126 break; 131 break;
127 case 1: 132 case 1:
@@ -135,7 +140,7 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
135 140
136// Runs just one time when the keyboard initializes. 141// Runs just one time when the keyboard initializes.
137void matrix_init_user(void) { 142void matrix_init_user(void) {
138 143 led_controller_init();
139}; 144};
140 145
141// Runs constantly in the background, in a loop. 146// Runs constantly in the background, in a loop.