1
0
Fork 0

Refactor to use led config - Part 5 (#10975)

* Refactor to use led config

* Refactor to use led config

* Refactor to use led config
This commit is contained in:
Joel Challis 2020-11-21 19:11:24 +00:00 committed by GitHub
parent 4368611bfd
commit 23222625c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 81 additions and 671 deletions

View file

@ -19,16 +19,17 @@
#define MATRIX_COL_PINS { B2, D0, D1, D2, D3, D5, D4, D6, D7, B4, B1, C6, C7, E6, F6, F7 }
#define UNUSED_PINS
#define BACKLIGHT_PIN B5
#define BACKLIGHT_BREATHING
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST
/* number of backlight levels */
#define LED_CAPS_LOCK_PIN B6
#define LED_SCROLL_LOCK_PIN B7
#define BACKLIGHT_PIN B5
#define BACKLIGHT_BREATHING
#define BACKLIGHT_LEVELS 3
/* Set 0 if debouncing isn't needed */

View file

@ -1,47 +1 @@
#include "evil80.h"
void matrix_init_kb(void) {
// put your keyboard start-up code here
// runs once when the firmware starts up
led_init_ports();
matrix_init_user();
}
void matrix_scan_kb(void) {
// put your looping keyboard code here
// runs every cycle (a lot)
matrix_scan_user();
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
// put your per-action keyboard code here
// runs for every action, just before processing by the firmware
return process_record_user(keycode, record);
}
void led_init_ports(void) {
DDRB |= (1<<6) | (1<<7); // OUT
}
void led_set_kb(uint8_t usb_led) {
if (usb_led & (1<<USB_LED_CAPS_LOCK))
{
PORTB |= (1<<6); // HI
}
else
{
PORTB &= ~(1<<6); // LO
}
if (usb_led & (1<<USB_LED_SCROLL_LOCK))
{
PORTB |= (1<<7); // HI
}
else
{
PORTB &= ~(1<<7); // LO
}
led_set_user(usb_led);
}