aboutsummaryrefslogtreecommitdiff
path: root/keyboards/ps2avrGB/ps2avrGB.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/ps2avrGB/ps2avrGB.c')
-rw-r--r--keyboards/ps2avrGB/ps2avrGB.c49
1 files changed, 41 insertions, 8 deletions
diff --git a/keyboards/ps2avrGB/ps2avrGB.c b/keyboards/ps2avrGB/ps2avrGB.c
index 701c5847f..45ba37bff 100644
--- a/keyboards/ps2avrGB/ps2avrGB.c
+++ b/keyboards/ps2avrGB/ps2avrGB.c
@@ -24,22 +24,55 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
24#include "i2c.h" 24#include "i2c.h"
25#include "quantum.h" 25#include "quantum.h"
26 26
27// for keyboard subdirectory level init functions
28// @Override
29void matrix_init_kb(void) {
30 // call user level keymaps, if any
31 matrix_init_user();
32}
33
34#ifdef RGBLIGHT_ENABLE
27extern rgblight_config_t rgblight_config; 35extern rgblight_config_t rgblight_config;
28 36
37// custom RGB driver
29void rgblight_set(void) { 38void rgblight_set(void) {
30 if (!rgblight_config.enable) { 39 if (!rgblight_config.enable) {
31 for (uint8_t i = 0; i < RGBLED_NUM; i++) { 40 for (uint8_t i=0; i<RGBLED_NUM; i++) {
32 led[i].r = 0; 41 led[i].r = 0;
33 led[i].g = 0; 42 led[i].g = 0;
34 led[i].b = 0; 43 led[i].b = 0;
35 }
36 } 44 }
45 }
46
47 i2c_init();
48 i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
49}
50
51bool rgb_init = false;
37 52
53void matrix_scan_kb(void) {
54 // if LEDs were previously on before poweroff, turn them back on
55 if (rgb_init == false && rgblight_config.enable) {
38 i2c_init(); 56 i2c_init();
39 i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM); 57 i2c_send(0xb0, (uint8_t*)led, 3 * RGBLED_NUM);
58 rgb_init = true;
59 }
60
61 rgblight_task();
62#else
63void matrix_scan_kb(void) {
64#endif
65 matrix_scan_user();
66 /* Nothing else for now. */
40} 67}
41 68
42__attribute__ ((weak)) 69__attribute__((weak)) // overridable
70void matrix_init_user(void) {
71
72}
73
74
75__attribute__((weak)) // overridable
43void matrix_scan_user(void) { 76void matrix_scan_user(void) {
44 rgblight_task(); 77
45} 78}