2 Copyright 2012 Jun Wako <wakojun@gmail.com>
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.
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.
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/>.
23 void led_set(uint8_t usb_led) {
24 // The LCD backlight functionality conflicts with this simple
26 #if !defined(LCD_BACKLIGHT_ENABLE) && defined(STATUS_LED_ENABLE)
27 // PTC1: LCD Backlight Red(0:on/1:off)
28 GPIOC->PDDR |= (1<<1);
29 PORTC->PCR[1] |= PORTx_PCRn_DSE | PORTx_PCRn_MUX(1);
30 if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
31 GPIOC->PCOR |= (1<<1);
33 GPIOC->PSOR |= (1<<1);
35 #elif !defined(LCD_BACKLIGHT_ENABLE)
37 GPIOC->PDDR |= (1<<1);
38 PORTC->PCR[1] |= PORTx_PCRn_DSE | PORTx_PCRn_MUX(1);
39 GPIOC->PSOR |= (1<<1);
40 GPIOC->PDDR |= (1<<2);
41 PORTC->PCR[2] |= PORTx_PCRn_DSE | PORTx_PCRn_MUX(1);
42 GPIOC->PSOR |= (1<<2);
43 GPIOC->PDDR |= (1<<3);
44 PORTC->PCR[3] |= PORTx_PCRn_DSE | PORTx_PCRn_MUX(1);
45 GPIOC->PSOR |= (1<<3);