Compare commits
2 Commits
ee98ba12a3
...
fdb524c8d4
Author | SHA1 | Date | |
---|---|---|---|
fdb524c8d4 | |||
2c3bccd147 |
@ -53,7 +53,7 @@ void sequencerExec(void *handle) {
|
|||||||
uint16_t sequencerPlayMelody(t_melody *melody) {
|
uint16_t sequencerPlayMelody(t_melody *melody) {
|
||||||
melody->idx = 0;
|
melody->idx = 0;
|
||||||
melody->lengthCnt = 0;
|
melody->lengthCnt = 0;
|
||||||
melody->state = e_PlayTone;
|
melody->state = e_Init;
|
||||||
|
|
||||||
return schAdd(sequencerExec, (void*) melody, 0, melody->pace);
|
return schAdd(sequencerExec, (void*) melody, 0, melody->pace);
|
||||||
}
|
}
|
||||||
|
29
sound-driver/spi.c
Normal file
29
sound-driver/spi.c
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <msp430g2553.h>
|
||||||
|
#include "spi.h"
|
||||||
|
|
||||||
|
|
||||||
|
void __attribute__ ((interrupt (USCIAB0RX_VECTOR))) receive() {
|
||||||
|
if (UC0IFG & UCB0RXIFG) {
|
||||||
|
// receive an octet
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void spiInit() {
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
9
sound-driver/spi.h
Normal file
9
sound-driver/spi.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef _SPI_H_
|
||||||
|
#define _SPI_H_
|
||||||
|
|
||||||
|
|
||||||
|
void spiInit();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _SPI_H_
|
Reference in New Issue
Block a user