65 lines
1.1 KiB
C
65 lines
1.1 KiB
C
/*
|
|
* led.h
|
|
*
|
|
* Created on: 26.07.2015
|
|
* Author: Flo
|
|
*/
|
|
|
|
#include <util/delay.h>
|
|
#include <avr/io.h>
|
|
|
|
|
|
#ifndef LED_H_
|
|
#define LED_H_
|
|
|
|
|
|
#ifndef cbi
|
|
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
|
|
#endif
|
|
#ifndef sbi
|
|
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
|
|
#endif
|
|
|
|
#define LED_PORT PORTD
|
|
#define LED_DDR DDRD
|
|
|
|
#define LED_ACTIVE_LOW 0x01
|
|
#define LED_ACTIVE_HIGH 0x02
|
|
|
|
|
|
#if defined (__AVR_ATmega8__)
|
|
#define LED_BLUE PD5
|
|
#define LED_RED PD6
|
|
#define LED_GREEN PD7
|
|
#elif defined (__AVR_ATmega168P__)
|
|
#define LED_BLUE PD5
|
|
#define LED_RED PD6
|
|
#define LED_GREEN PD7
|
|
#elif defined (__AVR_ATtiny2313__)
|
|
#define LED_BLUE PD3
|
|
#define LED_RED PD4
|
|
#define LED_GREEN PD5
|
|
#else
|
|
#if !defined(__COMPILING_AVR_LIBC__)
|
|
#warning "device type not defined"
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
extern volatile uint8_t led_flags;
|
|
|
|
void led_init();
|
|
void led_config(uint8_t flags);
|
|
void led_initPorts();
|
|
|
|
void led_off(uint8_t pin);
|
|
void led_on(uint8_t pin);
|
|
void led_flash(uint8_t pin);
|
|
|
|
void disco();
|
|
|
|
|
|
|
|
#endif /* LED_H_ */
|