*/
#include "facew.h"
-#ifdef BACKLIGHT_ENABLE
-#include "backlight.h"
-#endif
-#ifdef RGBLIGHT_ENABLE
-#include "rgblight.h"
-#endif
-#include <avr/pgmspace.h>
-
-#include "action_layer.h"
-#include "i2c_master.h"
-#include "quantum.h"
-
-#ifdef RGBLIGHT_ENABLE
-extern rgblight_config_t rgblight_config;
-
-void rgblight_set(void) {
- if (!rgblight_config.enable) {
- for (uint8_t i = 0; i < RGBLED_NUM; i++) {
- led[i].r = 0;
- led[i].g = 0;
- led[i].b = 0;
- }
- }
-
- i2c_init();
- i2c_transmit(0xb0, (uint8_t*)led, 3 * RGBLED_NUM, 100);
-}
-#endif
-
-__attribute__ ((weak))
-void matrix_scan_user(void) {
+void keyboard_pre_init_kb(void) {
+ led_init_ports();
+ keyboard_pre_init_user();
}
-void backlight_init_ports(void) {
- DDRD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
- PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
+void led_init_ports(void) {
+ setPinOutput(D0);
+ setPinOutput(D1);
+ writePinHigh(D0);
+ writePinHigh(D1);
}
-void backlight_set(uint8_t level) {
- if (level == 0) {
- // Turn out the lights
- PORTD &= ~(1<<0 | 1<<1 | 1<<4 | 1<<6);
- } else {
- // Turn on the lights
- PORTD |= (1<<0 | 1<<1 | 1<<4 | 1<<6);
- }
+bool led_update_kb(led_t led_state) {
+ if (led_update_user(led_state)) {
+ writePin(D1, !led_state.caps_lock);
+ }
+ return true;
}