Add simple LED driver

This commit is contained in:
Nero 2018-01-28 19:40:50 +00:00 committed by Nero
parent 1a77421caf
commit 81701220aa
3 changed files with 24 additions and 0 deletions

11
blink.c Normal file
View File

@ -0,0 +1,11 @@
#include <util/delay.h>
#include "drivers/led.h"
int main(void) {
while(1) {
led(1);
_delay_ms(500);
led(0);
_delay_ms(500);
}
}

10
drivers/led.c Normal file
View File

@ -0,0 +1,10 @@
#include "led.h"
#include <avr/io.h>
void led(uint8_t on) {
if (on) {
LED_PORT |= (1 << LED_PIN);
} else {
LED_PORT &= ~(1 << LED_PIN);
}
}

3
drivers/led.h Normal file
View File

@ -0,0 +1,3 @@
#include <stdint.h>
void led(uint8_t on);