You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
357 B
24 lines
357 B
/* beep.c */ |
|
|
|
#include <avr/io.h> |
|
|
|
#include "common.h" |
|
|
|
#define DDR_BEEP DDRB |
|
#define PORT_BEEP PORTB |
|
|
|
#define PIN_BEEP 1 |
|
|
|
void beep_on(void) |
|
{ |
|
TIMSK1 = 0; |
|
TCCR1A = (1<<COM1A0); |
|
TCCR1B = (1<<CS10) | (1<<WGM12); /* clkIO / 1, CTC mode */ |
|
DDR_BEEP |= (1<<PIN_BEEP); |
|
OCR1A = 1000; |
|
} |
|
|
|
void beep_off(void) |
|
{ |
|
DDR_BEEP &= ~(1<<PIN_BEEP); |
|
}
|
|
|