Project

General

Profile

Statistics
| Branch: | Revision:

root / toolbox / led.h @ dc472500

History | View | Annotate | Download (552 Bytes)

1 532ba0bd Tom Mullins
#ifndef LED_H
2
#define LED_H
3
4
#include <avr/io.h>
5
6
static inline void led_init() {DDRC |= _BV(DDC1) | _BV(DDC0);}
7
static inline void led_off() {PORTC &= ~(_BV(PC1) | _BV(PC0));}
8
static inline void led_red() {PORTC = (PORTC & ~_BV(PC0)) | _BV(PC1);}
9
static inline void led_yellow() {PORTC |= _BV(PC1) | _BV(PC0);}
10
static inline void led_green() {PORTC = (PORTC & ~_BV(PC1)) | _BV(PC0);}
11
12 dc472500 Tom Mullins
/* Starts LED blinking */ 
13
void led_blink_start(unsigned int period_ms, char n_times);
14
15
/* Returns nonzero if blinking has finished */
16
char led_blink_done();
17
18 532ba0bd Tom Mullins
#endif