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