feat(ex02): removed unused files
This commit is contained in:
parent
9580fa10ca
commit
4861b7beaf
2 changed files with 1 additions and 39 deletions
|
|
@ -11,7 +11,7 @@ SERIAL=-P /dev/ttyUSB0 -b 115200
|
|||
SRC_DIR=.
|
||||
OBJ_DIR=build
|
||||
|
||||
SRC_FILES=main.c utils.c uart.c timer.c
|
||||
SRC_FILES=main.c utils.c uart.c
|
||||
OBJ_FILES=$(patsubst %.c,%.o,$(SRC_FILES))
|
||||
|
||||
SRC=$(addprefix $(SRC_DIR)/,$(SRC_FILES))
|
||||
|
|
|
|||
38
ex02/timer.c
38
ex02/timer.c
|
|
@ -1,38 +0,0 @@
|
|||
|
||||
#include <avr/io.h>
|
||||
#include <avr/interrupt.h>
|
||||
#include "mystd.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define PRESCALER 256
|
||||
#define TIMER_FREQ (F_CPU / PRESCALER)
|
||||
|
||||
// at a high level:
|
||||
// Set the OC1B (PB2) pin as output
|
||||
// set the TIMER1 mode to COMPARE (CTC)
|
||||
// say to compare against OC1A
|
||||
// set the value to be compated at X count
|
||||
// say the presacler for the timer is 512
|
||||
//
|
||||
// all these information are on page ~140
|
||||
void timer1_init(void) {
|
||||
// Set PB1 (OC1A) as output
|
||||
DDRB |= _BV(PB1);
|
||||
|
||||
// CTC mode (WGM12 = 1)
|
||||
TCCR1B |= _BV(WGM12);
|
||||
|
||||
// Toggle OC1B on compare match (COM1B0 = 1)
|
||||
// TCCR1A |= _BV(COM1A0);
|
||||
|
||||
// Set compare values
|
||||
OCR1A = TIMER_FREQ / 2;
|
||||
|
||||
// Start timer with prescaler 256 (CS12)
|
||||
TCCR1B |= _BV(CS12);
|
||||
|
||||
// set OCR1A interrupt
|
||||
TIMSK1 = _BV(1);
|
||||
|
||||
sei();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue