summaryrefslogtreecommitdiff
path: root/keyboard/phantom/led.c
diff options
context:
space:
mode:
authortmk <wakojun@gmail.com>2013-05-27 15:57:30 -0700
committertmk <wakojun@gmail.com>2013-05-27 15:57:30 -0700
commitce950736a2206c8ae6d471ee691b9b2559878d40 (patch)
treebb16e1a3cda1afbae91ff5c32d00163a874e2af6 /keyboard/phantom/led.c
parentbf3a23b30645e98b9999b6c5cd6f29044a13821f (diff)
parent43b4e2d3b158e09a4a19516c2a553f8c68235f82 (diff)
Merge pull request #37 from Wraul/update_phantom
Polishing the Phantom project
Diffstat (limited to 'keyboard/phantom/led.c')
-rw-r--r--keyboard/phantom/led.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/keyboard/phantom/led.c b/keyboard/phantom/led.c
index 109004ba89..f4e9108f06 100644
--- a/keyboard/phantom/led.c
+++ b/keyboard/phantom/led.c
@@ -16,19 +16,34 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <avr/io.h>
-#include "stdint.h"
#include "led.h"
void led_set(uint8_t usb_led)
{
- if (!(usb_led & (1<<USB_LED_CAPS_LOCK)))
- DDRB &= ~(1<<6);
- else
+ if (usb_led & (1<<USB_LED_CAPS_LOCK))
+ {
+ // Output high.
DDRB |= (1<<6);
+ PORTB |= (1<<6);
+ }
+ else
+ {
+ // Output low.
+ DDRB &= ~(1<<6);
+ PORTB &= ~(1<<6);
+ }
- if (!(usb_led & (1<<USB_LED_SCROLL_LOCK)))
+ if (usb_led & (1<<USB_LED_SCROLL_LOCK))
+ {
+ // Output high.
DDRB &= ~(1<<7);
+ PORTB |= (1<<7);
+ }
else
- DDRB |= (1<<7);
+ {
+ // Output low.
+ DDRB &= ~(1<<7);
+ PORTB &= ~(1<<7);
+ }
}