From e6f4173aecaedabe3b2550340321520f45227c7f Mon Sep 17 00:00:00 2001 From: zvecr Date: Wed, 24 Apr 2019 19:13:07 +0100 Subject: Refactor cospad to current standards and enable support for backlight keycodes (#5582) --- keyboards/cospad/cospad.c | 56 ++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 30 deletions(-) (limited to 'keyboards/cospad/cospad.c') diff --git a/keyboards/cospad/cospad.c b/keyboards/cospad/cospad.c index 48d752a84b..e7ef71f874 100644 --- a/keyboards/cospad/cospad.c +++ b/keyboards/cospad/cospad.c @@ -1,37 +1,33 @@ + +/* Copyright 2019 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ #include "cospad.h" -#include "led.h" -extern inline void cospad_bl_led_on(void); -extern inline void cospad_bl_led_off(void); -extern inline void cospad_bl_led_togg(void); +#ifdef BACKLIGHT_ENABLE -void matrix_init_kb(void) { - // put your keyboard start-up code here - // runs once when the firmware starts up - matrix_init_user(); - led_init_ports(); -}; - -void matrix_scan_kb(void) { - // put your looping keyboard code here - // runs every cycle (a lot) - matrix_scan_user(); -}; +void backlight_init_ports(void) { + setPinOutput(F7); +} -void led_init_ports(void) { - // * Set our LED pins as output - DDRB |= (1<<2); - DDRF |= (1<<7); - // * Setting BL LEDs to init as off - PORTF |= (1<<7); +void backlight_set(uint8_t level) { + writePin(F7, !!level); } -void led_set_kb(uint8_t usb_led) { - if (usb_led & (1<