Fix missing DDR initialisation for led driver

This commit is contained in:
Nero 2018-01-28 20:10:26 +00:00 committed by Nero
parent 168e453193
commit 3d53f30331
2 changed files with 6 additions and 1 deletions

View File

@ -1,6 +1,7 @@
MCU_TARGET = atmega328p
MCU_FREQ = 16000000UL
CPPFLAGS += -DLED_PORT=PORTB -DLED_PIN=5
CPPFLAGS += -DLED_DDR=DDRB -DLED_PORT=PORTB -DLED_PIN=5
AVRDUDE_TYPE = arduino
AVRDUDE_TTY = /dev/ttyUSB0

View File

@ -1,6 +1,10 @@
#include "led.h"
#include <avr/io.h>
void __attribute__ ((naked)) __attribute__ ((section (".init5"))) led_init() {
LED_DDR |= (1 << LED_PIN);
}
void led(uint8_t on) {
if (on) {
LED_PORT |= (1 << LED_PIN);