Merge pull request #138 from ytsuboi/master

[LPC812] Add SPISlave function
pull/139/head
Bogdan Marinescu 2013-12-31 07:25:41 -08:00
commit b311c56b44
3 changed files with 8 additions and 4 deletions

View File

@ -32,7 +32,7 @@
#define DEVICE_I2CSLAVE 0
#define DEVICE_SPI 1
#define DEVICE_SPISLAVE 0
#define DEVICE_SPISLAVE 1
#define DEVICE_CAN 0

View File

@ -183,9 +183,9 @@ static inline int ssp_read(spi_t *obj) {
}
static inline int ssp_busy(spi_t *obj) {
// TODO
return 0;
}
// checking RXOV(Receiver Overrun interrupt flag)
return obj->spi->STAT & (1 << 2);
}
int spi_master_write(spi_t *obj, int value) {
ssp_write(obj, value);

View File

@ -2,6 +2,10 @@
#if defined(TARGET_KL25Z)
SPISlave device(PTD2, PTD3, PTD1, PTD0); // mosi, miso, sclk, ssel
#elif defined(TARGET_LPC812)
SPISlave device(P0_14, P0_15, P0_12, P0_13); // mosi, miso, sclk, ssel
#else
SPISlave device(p5, p6, p7, p8); // mosi, miso, sclk, ssel
#endif