diff options
Diffstat (limited to 'keyboards/jj50/jj50.c')
| -rw-r--r-- | keyboards/jj50/jj50.c | 61 |
1 files changed, 55 insertions, 6 deletions
diff --git a/keyboards/jj50/jj50.c b/keyboards/jj50/jj50.c index a75b12c4e..d4a70f68d 100644 --- a/keyboards/jj50/jj50.c +++ b/keyboards/jj50/jj50.c | |||
| @@ -16,7 +16,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include "jj50.h" | 18 | #include "jj50.h" |
| 19 | #include "rgblight.h" | ||
| 20 | 19 | ||
| 21 | #include <avr/pgmspace.h> | 20 | #include <avr/pgmspace.h> |
| 22 | 21 | ||
| @@ -24,22 +23,72 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 24 | #include "i2c.h" | 23 | #include "i2c.h" |
| 25 | #include "quantum.h" | 24 | #include "quantum.h" |
| 26 | 25 | ||
| 26 | #include "backlight.h" | ||
| 27 | #include "backlight_custom.h" | ||
| 28 | |||
| 29 | // for keyboard subdirectory level init functions | ||
| 30 | // @Override | ||
| 31 | void matrix_init_kb(void) { | ||
| 32 | // call user level keymaps, if any | ||
| 33 | matrix_init_user(); | ||
| 34 | } | ||
| 35 | |||
| 36 | #ifdef BACKLIGHT_ENABLE | ||
| 37 | /// Overrides functions in `quantum.c` | ||
| 38 | void backlight_init_ports(void) { | ||
| 39 | b_led_init_ports(); | ||
| 40 | } | ||
| 41 | |||
| 42 | void backlight_task(void) { | ||
| 43 | b_led_task(); | ||
| 44 | } | ||
| 45 | |||
| 46 | void backlight_set(uint8_t level) { | ||
| 47 | b_led_set(level); | ||
| 48 | } | ||
| 49 | #endif | ||
| 50 | |||
| 51 | #ifdef RGBLIGHT_ENABLE | ||
| 27 | extern rgblight_config_t rgblight_config; | 52 | extern rgblight_config_t rgblight_config; |
| 28 | 53 | ||
| 54 | // custom RGB driver | ||
| 29 | void rgblight_set(void) { | 55 | void rgblight_set(void) { |
| 30 | if (!rgblight_config.enable) { | 56 | if (!rgblight_config.enable) { |
| 31 | for (uint8_t i = 0; i < RGBLED_NUM; i++) { | 57 | for (uint8_t i=0; i<RGBLED_NUM; i++) { |
| 32 | led[i].r = 0; | 58 | led[i].r = 0; |
| 33 | led[i].g = 0; | 59 | led[i].g = 0; |
| 34 | led[i].b = 0; | 60 | led[i].b = 0; |
| 35 | } | 61 | } |
| 36 | } | 62 | } |
| 37 | 63 | ||
| 38 | i2c_init(); | 64 | i2c_init(); |
| 39 | i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); | 65 | i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); |
| 40 | } | 66 | } |
| 41 | 67 | ||
| 42 | __attribute__ ((weak)) | 68 | bool rgb_init = false; |
| 43 | void matrix_scan_user(void) { | 69 | |
| 70 | void matrix_scan_kb(void) { | ||
| 71 | // if LEDs were previously on before poweroff, turn them back on | ||
| 72 | if (rgb_init == false && rgblight_config.enable) { | ||
| 73 | i2c_init(); | ||
| 74 | i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); | ||
| 75 | rgb_init = true; | ||
| 76 | } | ||
| 77 | |||
| 44 | rgblight_task(); | 78 | rgblight_task(); |
| 45 | } | 79 | #else |
| 80 | void matrix_scan_kb(void) { | ||
| 81 | #endif | ||
| 82 | matrix_scan_user(); | ||
| 83 | /* Nothing else for now. */ | ||
| 84 | } | ||
| 85 | |||
| 86 | __attribute__((weak)) // overridable | ||
| 87 | void matrix_init_user(void) { | ||
| 88 | |||
| 89 | } | ||
| 90 | |||
| 91 | __attribute__((weak)) // overridable | ||
| 92 | void matrix_scan_user(void) { | ||
| 93 | |||
| 94 | } | ||
