aboutsummaryrefslogtreecommitdiffstats
path: root/keyboards/infinity_ergodox/led.c
diff options
context:
space:
mode:
authorGravatar Fred Sundvik <fsundvik@gmail.com>2016-07-05 16:45:29 +0300
committerGravatar Fred Sundvik <fsundvik@gmail.com>2016-07-05 16:45:29 +0300
commit74847a84f8c90c8065f50cee9768f7768b5f856b (patch)
treecbd51bb41b8807af89067f0ebd93a6b6eea85462 /keyboards/infinity_ergodox/led.c
parent94d3159d9dbdf711b830c6d7c5a53324097be0a5 (diff)
downloadqmk_firmware-74847a84f8c90c8065f50cee9768f7768b5f856b.tar.gz
First version of Infinity Ergodox
Mostly just adding the files from the fredizzimo repository. Still needs some fixing until it works
Diffstat (limited to 'keyboards/infinity_ergodox/led.c')
-rw-r--r--keyboards/infinity_ergodox/led.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/keyboards/infinity_ergodox/led.c b/keyboards/infinity_ergodox/led.c
new file mode 100644
index 000000000..77195bb35
--- /dev/null
+++ b/keyboards/infinity_ergodox/led.c
@@ -0,0 +1,49 @@
+/*
+Copyright 2012 Jun Wako <wakojun@gmail.com>
+
+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 <http://www.gnu.org/licenses/>.
+*/
+
+#include "hal.h"
+
+#include "led.h"
+
+
+void led_set(uint8_t usb_led) {
+// The LCD backlight functionality conflicts with this simple
+// red backlight
+#if !defined(LCD_BACKLIGHT_ENABLE) && defined(STATUS_LED_ENABLE)
+ // PTC1: LCD Backlight Red(0:on/1:off)
+ GPIOC->PDDR |= (1<<1);
+ PORTC->PCR[1] |= PORTx_PCRn_DSE | PORTx_PCRn_MUX(1);
+ if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+ GPIOC->PCOR |= (1<<1);
+ } else {
+ GPIOC->PSOR |= (1<<1);
+ }
+#elif !defined(LCD_BACKLIGHT_ENABLE)
+ (void)usb_led;
+ GPIOC->PDDR |= (1<<1);
+ PORTC->PCR[1] |= PORTx_PCRn_DSE | PORTx_PCRn_MUX(1);
+ GPIOC->PSOR |= (1<<1);
+ GPIOC->PDDR |= (1<<2);
+ PORTC->PCR[2] |= PORTx_PCRn_DSE | PORTx_PCRn_MUX(1);
+ GPIOC->PSOR |= (1<<2);
+ GPIOC->PDDR |= (1<<3);
+ PORTC->PCR[3] |= PORTx_PCRn_DSE | PORTx_PCRn_MUX(1);
+ GPIOC->PSOR |= (1<<3);
+#else
+ (void)usb_led;
+#endif
+}