THERE IS NO GOD
This commit is contained in:
parent
550623ee5d
commit
3223228e0b
1 changed files with 19 additions and 14 deletions
23
avr/main.c
23
avr/main.c
|
@ -20,7 +20,8 @@ static const uint16_t timer_counter_intervals[4] = {
|
|||
|
||||
static volatile tabby_avr_buffer buffer = {
|
||||
.len = 0,
|
||||
.cur = 0
|
||||
.cur = 0,
|
||||
.read = 0
|
||||
};
|
||||
|
||||
static tabby_clock_source source = TABBY_CLOCK_SOURCE_INTERNAL;
|
||||
|
@ -74,6 +75,8 @@ ISR(SPI_STC_vect) {
|
|||
if (buffer.cur < buffer.len) {
|
||||
SPDR = buffer.data[buffer.cur++];
|
||||
} else {
|
||||
SPDR = 0xff;
|
||||
|
||||
buffer.len = 0;
|
||||
buffer.cur = 0;
|
||||
buffer.read = 0;
|
||||
|
@ -84,17 +87,17 @@ static void setup_clock_internal(tabby_clock_speed speed) {
|
|||
/*
|
||||
* Configure MISO as output
|
||||
*/
|
||||
DDRB |= (1 << DDB3);
|
||||
DDRB |= (1 << DDB4);
|
||||
|
||||
/*
|
||||
* Configure MOSI as input
|
||||
*/
|
||||
DDRB &= ~(1 << DDB2);
|
||||
DDRB &= ~(1 << DDB3);
|
||||
|
||||
/*
|
||||
* Configure SCK pin as output
|
||||
*/
|
||||
DDRB |= (1 << DDB1);
|
||||
DDRB |= (1 << DDB5);
|
||||
|
||||
/*
|
||||
* Enable timer interrupt vector
|
||||
|
@ -128,12 +131,12 @@ static void setup_clock_external() {
|
|||
/*
|
||||
* Configure MISO as output
|
||||
*/
|
||||
DDRB |= (1 << DDB3);
|
||||
DDRB |= (1 << DDB4);
|
||||
|
||||
/*
|
||||
* Configure MOSI as input
|
||||
* Configure SS as input
|
||||
*/
|
||||
DDRB &= ~(1 << DDB3);
|
||||
DDRB &= ~(1 << DDB2);
|
||||
|
||||
/*
|
||||
* Set SPI slave mode, and shift in/out most significant bit first
|
||||
|
@ -152,6 +155,7 @@ static void setup_clock_external() {
|
|||
|
||||
buffer.len = 0;
|
||||
buffer.cur = 0;
|
||||
buffer.read = 0;
|
||||
}
|
||||
|
||||
/*static void snooze() {
|
||||
|
@ -210,7 +214,7 @@ int main() {
|
|||
break;
|
||||
}
|
||||
|
||||
case TABBY_COMMAND_CLOCK_SOURCE:
|
||||
case TABBY_COMMAND_CLOCK_SOURCE: {
|
||||
switch (c) {
|
||||
case TABBY_CLOCK_SOURCE_INTERNAL: {
|
||||
source = c;
|
||||
|
@ -232,6 +236,7 @@ int main() {
|
|||
goto reset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case TABBY_COMMAND_CLOCK_SPEED: {
|
||||
switch (c) {
|
||||
|
@ -254,7 +259,7 @@ int main() {
|
|||
}
|
||||
|
||||
default: {
|
||||
break;
|
||||
goto reset;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue