spi separated
This commit is contained in:
parent
33242a09c1
commit
ee98ba12a3
@ -11,7 +11,7 @@ CFLAGS+= -g3 -ggdb -gdwarf-2
|
||||
|
||||
LDFLAGS=-mmcu=$(MCU) -L $(TOOLCHAIN_PREFIX)/include
|
||||
|
||||
$(ARTIFACT).elf: main.o scheduler.o psg.o sequencer.o melody.o
|
||||
$(ARTIFACT).elf: main.o scheduler.o spi.o psg.o sequencer.o melody.o
|
||||
$(CC) -o $@ $(LDFLAGS) $^
|
||||
$(OBJDUMP) -D $(ARTIFACT).elf > $(ARTIFACT).txt
|
||||
|
||||
|
@ -2,18 +2,12 @@
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "spi.h"
|
||||
#include "psg.h"
|
||||
#include "scheduler.h"
|
||||
#include "sequencer.h"
|
||||
#include "melody.h"
|
||||
|
||||
void __attribute__ ((interrupt (USCIAB0RX_VECTOR))) receive() {
|
||||
if (UC0IFG & UCB0RXIFG) {
|
||||
// receive an octet
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int main() {
|
||||
WDTCTL = WDTPW | WDTHOLD;
|
||||
|
||||
@ -25,22 +19,10 @@ int main() {
|
||||
BCSCTL2 = 0;
|
||||
BCSCTL3 = 0;
|
||||
|
||||
// SPI slave
|
||||
// BIT4: UCB0STE
|
||||
// BIT5: UCB0CLK
|
||||
// BIT6: UCB0SOMI
|
||||
// BIT7: UCB0SIMO
|
||||
P1SEL |= BIT4 | BIT5 | BIT6 | BIT7;
|
||||
P1SEL2 |= BIT4 | BIT5 | BIT6 | BIT7;
|
||||
// most significant bit first, enable STE
|
||||
UCB0CTL0 = UCSYNC | UCMSB | UCMODE_2;
|
||||
UCB0CTL1 = 0x00;
|
||||
// enable RX interrupt
|
||||
UC0IE |= UCB0RXIE;
|
||||
|
||||
|
||||
schInit();
|
||||
|
||||
spiInit();
|
||||
psgInit();
|
||||
sequencerInit();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user