Maybe someday I'll suck less at reading datasheets
This commit is contained in:
parent
d4e60aeace
commit
8f06f6abc8
1 changed files with 6 additions and 6 deletions
12
avr/send.c
12
avr/send.c
|
@ -6,7 +6,7 @@
|
|||
#include <tabby/printer.h>
|
||||
#include <tabby/avr/uart.h>
|
||||
|
||||
#define TIMER0_INTERVAL 1953
|
||||
#define TIMER1_INTERVAL 1953
|
||||
|
||||
enum {
|
||||
TABBY_SEND_READING = 0,
|
||||
|
@ -54,7 +54,7 @@ static void spi_start() {
|
|||
/*
|
||||
* Enable timer interrupt vector
|
||||
*/
|
||||
TIMSK0 = (1 << TOIE1);
|
||||
TIMSK0 = (1 << TOIE0);
|
||||
|
||||
/*
|
||||
* Reset timer counter to zero
|
||||
|
@ -64,7 +64,7 @@ static void spi_start() {
|
|||
/*
|
||||
* Set timer interval
|
||||
*/
|
||||
OCR1A = TIMER0_INTERVAL;
|
||||
OCR1A = TIMER1_INTERVAL;
|
||||
|
||||
/*
|
||||
* Set timer clock divider to 1/1
|
||||
|
@ -74,13 +74,13 @@ static void spi_start() {
|
|||
|
||||
static void spi_end() {
|
||||
DDRB &= ~((1 << DDB5) | (1 << DDB4) | (1 << DDB3));
|
||||
TIMSK0 &= ~(1 << TOIE1);
|
||||
TIMSK0 &= ~(1 << TOIE0);
|
||||
TCNT1 = 0;
|
||||
OCR1A = TIMER0_INTERVAL;
|
||||
OCR1A = TIMER1_INTERVAL;
|
||||
TCCR1B = (1 << CS10);
|
||||
}
|
||||
|
||||
ISR(TIMER0_COMPB_vect) {
|
||||
ISR(TIMER1_COMPA_vect) {
|
||||
value_in >>= 1;
|
||||
|
||||
PORTB |= (1 << PORTB5);
|
||||
|
|
Loading…
Add table
Reference in a new issue