diff options
Diffstat (limited to 'keyboards/singa/singa.c')
| -rw-r--r-- | keyboards/singa/singa.c | 63 |
1 files changed, 44 insertions, 19 deletions
diff --git a/keyboards/singa/singa.c b/keyboards/singa/singa.c index 0f5ec471a..26a7e4637 100644 --- a/keyboards/singa/singa.c +++ b/keyboards/singa/singa.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Copyright 2018 REPLACE_WITH_YOUR_NAME | 1 | /* Copyright 2018 amnesia0287 |
| 2 | * | 2 | * |
| 3 | * This program is free software: you can redistribute it and/or modify | 3 | * This program is free software: you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License as published by | 4 | * it under the terms of the GNU General Public License as published by |
| @@ -13,32 +13,57 @@ | |||
| 13 | * You should have received a copy of the GNU General Public License | 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | */ | 15 | */ |
| 16 | #include QMK_KEYBOARD_H | 16 | #include "rgblight.h" |
| 17 | 17 | #include "i2c_master.h" | |
| 18 | #include <avr/pgmspace.h> | ||
| 19 | #include "action_layer.h" | ||
| 20 | #include "i2c.h" | ||
| 21 | #include "quantum.h" | 18 | #include "quantum.h" |
| 22 | 19 | ||
| 20 | #ifdef RGBLIGHT_ENABLE | ||
| 21 | extern rgblight_config_t rgblight_config; | ||
| 22 | |||
| 23 | void rgblight_set(void) { | ||
| 24 | if (!rgblight_config.enable) { | ||
| 25 | for (uint8_t i = 0; i < RGBLED_NUM; i++) { | ||
| 26 | led[i].r = 0; | ||
| 27 | led[i].g = 0; | ||
| 28 | led[i].b = 0; | ||
| 29 | } | ||
| 30 | } | ||
| 23 | 31 | ||
| 24 | // for keyboard subdirectory level init functions | 32 | i2c_init(); |
| 25 | // @Override | 33 | i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100); |
| 26 | void matrix_init_kb(void) { | ||
| 27 | // call user level keymaps, if any | ||
| 28 | matrix_init_user(); | ||
| 29 | } | 34 | } |
| 35 | #endif | ||
| 30 | 36 | ||
| 31 | void matrix_scan_kb(void) { | 37 | __attribute__ ((weak)) |
| 32 | matrix_scan_user(); | 38 | void matrix_scan_user(void) { |
| 33 | /* Nothing else for now. */ | ||
| 34 | } | 39 | } |
| 35 | 40 | ||
| 36 | __attribute__((weak)) // overridable | 41 | void backlight_init_ports(void) { |
| 37 | void matrix_init_user(void) { | 42 | // initialize pins D0, D1, D4 and D6 as output |
| 43 | setPinOutput(D0); | ||
| 44 | setPinOutput(D1); | ||
| 45 | setPinOutput(D4); | ||
| 46 | setPinOutput(D6); | ||
| 38 | 47 | ||
| 48 | // turn RGB LEDs on | ||
| 49 | writePinHigh(D0); | ||
| 50 | writePinHigh(D1); | ||
| 51 | writePinHigh(D4); | ||
| 52 | writePinHigh(D6); | ||
| 39 | } | 53 | } |
| 40 | 54 | ||
| 41 | __attribute__((weak)) // overridable | 55 | void backlight_set(uint8_t level) { |
| 42 | void matrix_scan_user(void) { | 56 | if (level == 0) { |
| 43 | 57 | // turn RGB LEDs off | |
| 58 | writePinLow(D0); | ||
| 59 | writePinLow(D1); | ||
| 60 | writePinLow(D4); | ||
| 61 | writePinLow(D6); | ||
| 62 | } else { | ||
| 63 | // turn RGB LEDs on | ||
| 64 | writePinHigh(D0); | ||
| 65 | writePinHigh(D1); | ||
| 66 | writePinHigh(D4); | ||
| 67 | writePinHigh(D6); | ||
| 68 | } | ||
| 44 | } | 69 | } |
