Add simple LED driver
This commit is contained in:
parent
1a77421caf
commit
81701220aa
11
blink.c
Normal file
11
blink.c
Normal 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
10
drivers/led.c
Normal 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
3
drivers/led.h
Normal file
@ -0,0 +1,3 @@
|
||||
#include <stdint.h>
|
||||
|
||||
void led(uint8_t on);
|
Loading…
Reference in New Issue
Block a user