diff options
| author | fauxpark <fauxpark@gmail.com> | 2019-11-05 11:05:03 +1100 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-11-04 16:05:03 -0800 |
| commit | efa28d0f5cca55b0dfecaddd0860ec3dfeab8bb0 (patch) | |
| tree | aab048a027771fa8ab55b535bce64e101e861680 /keyboards/tgr | |
| parent | 0a9a69394e132c3d00eddffd2e345f48113e56c4 (diff) | |
| download | qmk_firmware-efa28d0f5cca55b0dfecaddd0860ec3dfeab8bb0.tar.gz qmk_firmware-efa28d0f5cca55b0dfecaddd0860ec3dfeab8bb0.zip | |
Convert some PS2AVRGB boards to I2C WS2812 driver (#7241)
* Convert some PS2AVRGB boards to I2C WS2812 driver
* Fix Travis failure for bface
Diffstat (limited to 'keyboards/tgr')
| -rw-r--r-- | keyboards/tgr/alice/alice.c | 39 | ||||
| -rw-r--r-- | keyboards/tgr/alice/rules.mk | 19 | ||||
| -rw-r--r-- | keyboards/tgr/jane/jane.c | 51 | ||||
| -rw-r--r-- | keyboards/tgr/jane/rules.mk | 19 |
4 files changed, 8 insertions, 120 deletions
diff --git a/keyboards/tgr/alice/alice.c b/keyboards/tgr/alice/alice.c index adb88fef0..39aed2cf5 100644 --- a/keyboards/tgr/alice/alice.c +++ b/keyboards/tgr/alice/alice.c | |||
| @@ -15,41 +15,4 @@ You should have received a copy of the GNU General Public License | |||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include <string.h> | 18 | #include "alice.h" |
| 19 | |||
| 20 | #include "rgblight.h" | ||
| 21 | |||
| 22 | #include "i2c_master.h" | ||
| 23 | #include "quantum.h" | ||
| 24 | |||
| 25 | #ifdef RGBLIGHT_ENABLE | ||
| 26 | extern rgblight_config_t rgblight_config; | ||
| 27 | |||
| 28 | void matrix_init_kb(void) { | ||
| 29 | i2c_init(); | ||
| 30 | // call user level keymaps, if any | ||
| 31 | matrix_init_user(); | ||
| 32 | } | ||
| 33 | |||
| 34 | // custom RGB driver | ||
| 35 | void rgblight_set(void) { | ||
| 36 | if (!rgblight_config.enable) { | ||
| 37 | memset(led, 0, 3 * RGBLED_NUM); | ||
| 38 | } | ||
| 39 | |||
| 40 | i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100); | ||
| 41 | } | ||
| 42 | |||
| 43 | bool rgb_init = false; | ||
| 44 | |||
| 45 | void matrix_scan_kb(void) { | ||
| 46 | // if LEDs were previously on before poweroff, turn them back on | ||
| 47 | if (rgb_init == false && rgblight_config.enable) { | ||
| 48 | i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100); | ||
| 49 | rgb_init = true; | ||
| 50 | } | ||
| 51 | |||
| 52 | rgblight_task(); | ||
| 53 | matrix_scan_user(); | ||
| 54 | } | ||
| 55 | #endif | ||
diff --git a/keyboards/tgr/alice/rules.mk b/keyboards/tgr/alice/rules.mk index aa141f7c3..530e8ea32 100644 --- a/keyboards/tgr/alice/rules.mk +++ b/keyboards/tgr/alice/rules.mk | |||
| @@ -1,18 +1,3 @@ | |||
| 1 | # Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> | ||
| 2 | # | ||
| 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 | ||
| 5 | # the Free Software Foundation, either version 2 of the License, or | ||
| 6 | # (at your option) any later version. | ||
| 7 | # | ||
| 8 | # This program is distributed in the hope that it will be useful, | ||
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | # GNU General Public License for more details. | ||
| 12 | # | ||
| 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/>. | ||
| 15 | |||
| 16 | # MCU name | 1 | # MCU name |
| 17 | MCU = atmega32a | 2 | MCU = atmega32a |
| 18 | 3 | ||
| @@ -34,8 +19,6 @@ CONSOLE_ENABLE = yes | |||
| 34 | COMMAND_ENABLE = yes | 19 | COMMAND_ENABLE = yes |
| 35 | BACKLIGHT_ENABLE = no | 20 | BACKLIGHT_ENABLE = no |
| 36 | RGBLIGHT_ENABLE = yes | 21 | RGBLIGHT_ENABLE = yes |
| 37 | RGBLIGHT_CUSTOM_DRIVER = yes | 22 | WS2812_DRIVER = i2c |
| 38 | 23 | ||
| 39 | OPT_DEFS = -DDEBUG_LEVEL=0 | 24 | OPT_DEFS = -DDEBUG_LEVEL=0 |
| 40 | |||
| 41 | SRC += i2c_master.c | ||
diff --git a/keyboards/tgr/jane/jane.c b/keyboards/tgr/jane/jane.c index c17cb0084..4ab0b3007 100644 --- a/keyboards/tgr/jane/jane.c +++ b/keyboards/tgr/jane/jane.c | |||
| @@ -13,49 +13,8 @@ | |||
| 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 "i2c_master.h" | ||
| 17 | #include "quantum.h" | ||
| 18 | 16 | ||
| 19 | #ifdef RGBLIGHT_ENABLE | 17 | #include "jane.h" |
| 20 | #include "rgblight.h" | ||
| 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 | } | ||
| 31 | |||
| 32 | i2c_init(); | ||
| 33 | i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100); | ||
| 34 | } | ||
| 35 | #endif | ||
| 36 | |||
| 37 | void matrix_init_kb(void) { | ||
| 38 | #ifdef RGBLIGHT_ENABLE | ||
| 39 | if (rgblight_config.enable) { | ||
| 40 | i2c_init(); | ||
| 41 | i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100); | ||
| 42 | } | ||
| 43 | #endif | ||
| 44 | // call user level keymaps, if any | ||
| 45 | matrix_init_user(); | ||
| 46 | } | ||
| 47 | |||
| 48 | void matrix_scan_kb(void) { | ||
| 49 | #ifdef RGBLIGHT_ENABLE | ||
| 50 | rgblight_task(); | ||
| 51 | #endif | ||
| 52 | matrix_scan_user(); | ||
| 53 | /* Nothing else for now. */ | ||
| 54 | } | ||
| 55 | |||
| 56 | __attribute__ ((weak)) | ||
| 57 | void matrix_scan_user(void) { | ||
| 58 | } | ||
| 59 | 18 | ||
| 60 | void backlight_init_ports(void) { | 19 | void backlight_init_ports(void) { |
| 61 | // initialize pins D0, D1, D4 and D6 as output | 20 | // initialize pins D0, D1, D4 and D6 as output |
| @@ -72,17 +31,17 @@ void backlight_init_ports(void) { | |||
| 72 | } | 31 | } |
| 73 | 32 | ||
| 74 | void backlight_set(uint8_t level) { | 33 | void backlight_set(uint8_t level) { |
| 75 | if (level == 0) { | 34 | if (level == 0) { |
| 76 | // turn backlight LEDs off | 35 | // turn backlight LEDs off |
| 77 | writePinLow(D0); | 36 | writePinLow(D0); |
| 78 | writePinLow(D1); | 37 | writePinLow(D1); |
| 79 | writePinLow(D4); | 38 | writePinLow(D4); |
| 80 | writePinLow(D6); | 39 | writePinLow(D6); |
| 81 | } else { | 40 | } else { |
| 82 | // turn backlight LEDs on | 41 | // turn backlight LEDs on |
| 83 | writePinHigh(D0); | 42 | writePinHigh(D0); |
| 84 | writePinHigh(D1); | 43 | writePinHigh(D1); |
| 85 | writePinHigh(D4); | 44 | writePinHigh(D4); |
| 86 | writePinHigh(D6); | 45 | writePinHigh(D6); |
| 87 | } | 46 | } |
| 88 | } \ No newline at end of file | 47 | } |
diff --git a/keyboards/tgr/jane/rules.mk b/keyboards/tgr/jane/rules.mk index f2b488306..c6a26d4a4 100644 --- a/keyboards/tgr/jane/rules.mk +++ b/keyboards/tgr/jane/rules.mk | |||
| @@ -1,18 +1,3 @@ | |||
| 1 | # Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> | ||
| 2 | # | ||
| 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 | ||
| 5 | # the Free Software Foundation, either version 2 of the License, or | ||
| 6 | # (at your option) any later version. | ||
| 7 | # | ||
| 8 | # This program is distributed in the hope that it will be useful, | ||
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | # GNU General Public License for more details. | ||
| 12 | # | ||
| 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/>. | ||
| 15 | |||
| 16 | # MCU name | 1 | # MCU name |
| 17 | MCU = atmega32a | 2 | MCU = atmega32a |
| 18 | 3 | ||
| @@ -34,10 +19,8 @@ CONSOLE_ENABLE = yes | |||
| 34 | COMMAND_ENABLE = yes | 19 | COMMAND_ENABLE = yes |
| 35 | BACKLIGHT_ENABLE = yes | 20 | BACKLIGHT_ENABLE = yes |
| 36 | RGBLIGHT_ENABLE = no | 21 | RGBLIGHT_ENABLE = no |
| 37 | RGBLIGHT_CUSTOM_DRIVER = no | 22 | WS2812_DRIVER = i2c |
| 38 | 23 | ||
| 39 | OPT_DEFS = -DDEBUG_LEVEL=0 | 24 | OPT_DEFS = -DDEBUG_LEVEL=0 |
| 40 | 25 | ||
| 41 | QUANTUM_LIB_SRC = i2c_master.c | ||
| 42 | |||
| 43 | LAYOUTS = tkl_ansi tkl_iso | 26 | LAYOUTS = tkl_ansi tkl_iso |
