diff options
Diffstat (limited to 'keyboards/cospad/cospad.c')
| -rw-r--r-- | keyboards/cospad/cospad.c | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/keyboards/cospad/cospad.c b/keyboards/cospad/cospad.c index 48d752a84..e7ef71f87 100644 --- a/keyboards/cospad/cospad.c +++ b/keyboards/cospad/cospad.c | |||
| @@ -1,37 +1,33 @@ | |||
| 1 | |||
| 2 | /* Copyright 2019 | ||
| 3 | * | ||
| 4 | * This program is free software: you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation, either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * 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/>. | ||
| 16 | */ | ||
| 1 | #include "cospad.h" | 17 | #include "cospad.h" |
| 2 | #include "led.h" | ||
| 3 | 18 | ||
| 4 | extern inline void cospad_bl_led_on(void); | 19 | #ifdef BACKLIGHT_ENABLE |
| 5 | extern inline void cospad_bl_led_off(void); | ||
| 6 | extern inline void cospad_bl_led_togg(void); | ||
| 7 | 20 | ||
| 8 | void matrix_init_kb(void) { | 21 | void backlight_init_ports(void) { |
| 9 | // put your keyboard start-up code here | 22 | setPinOutput(F7); |
| 10 | // runs once when the firmware starts up | 23 | } |
| 11 | matrix_init_user(); | ||
| 12 | led_init_ports(); | ||
| 13 | }; | ||
| 14 | |||
| 15 | void matrix_scan_kb(void) { | ||
| 16 | // put your looping keyboard code here | ||
| 17 | // runs every cycle (a lot) | ||
| 18 | matrix_scan_user(); | ||
| 19 | }; | ||
| 20 | 24 | ||
| 21 | void led_init_ports(void) { | 25 | void backlight_set(uint8_t level) { |
| 22 | // * Set our LED pins as output | 26 | writePin(F7, !!level); |
| 23 | DDRB |= (1<<2); | ||
| 24 | DDRF |= (1<<7); | ||
| 25 | // * Setting BL LEDs to init as off | ||
| 26 | PORTF |= (1<<7); | ||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | void led_set_kb(uint8_t usb_led) { | 29 | void backlight_task(void) { |
| 30 | if (usb_led & (1<<USB_LED_NUM_LOCK)) { | 30 | // do nothing - as default implementation of software PWM does not work |
| 31 | // Turn numlock on | ||
| 32 | PORTB &= ~(1<<2); | ||
| 33 | } else { | ||
| 34 | // Turn numlock off | ||
| 35 | PORTB |= (1<<2); | ||
| 36 | } | ||
| 37 | } | 31 | } |
| 32 | |||
| 33 | #endif //BACKLIGHT_ENABLE | ||
