]> git.donarmstrong.com Git - qmk_firmware.git/blobdiff - keyboard/phantom/led.c
adds backlight levels to the satan keyboard (#431)
[qmk_firmware.git] / keyboard / phantom / led.c
index 109004ba89ee6389e1cc5013bc4d04a4680ed386..b2459c7743395a9d3eeb2497a6ee024b55622772 100644 (file)
@@ -19,16 +19,25 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #include "stdint.h"
 #include "led.h"
 
+void led_init(void) {
+    // * Set our LED pins as output
+    DDRB |= (1<<6);
+       DDRB |= (1<<7);
+}
 
-void led_set(uint8_t usb_led)
-{
-    if (!(usb_led & (1<<USB_LED_CAPS_LOCK)))
-        DDRB &= ~(1<<6);
-    else
-        DDRB |= (1<<6);
-
-    if (!(usb_led & (1<<USB_LED_SCROLL_LOCK)))
-        DDRB &= ~(1<<7);
-    else
-        DDRB |= (1<<7);
+void led_set_kb(uint8_t usb_led) {
+    if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
+        // Turn capslock on
+        PORTB |= (1<<6);
+    } else {
+        // Turn capslock off
+        PORTB &= ~(1<<6);
+    }
+       if (usb_led & (1<<USB_LED_SCROLL_LOCK)) {
+        // Turn scrolllock on
+        PORTB |= (1<<7);
+    } else {
+        // Turn scrolllock off
+        PORTB &= ~(1<<7);
+    }
 }