Skip to content

Commit b311c56

Browse files
committed
Merge pull request #138 from ytsuboi/master
[LPC812] Add SPISlave function
2 parents 971dfcf + 4fbf286 commit b311c56

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC81X/device.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#define DEVICE_I2CSLAVE 0
3333

3434
#define DEVICE_SPI 1
35-
#define DEVICE_SPISLAVE 0
35+
#define DEVICE_SPISLAVE 1
3636

3737
#define DEVICE_CAN 0
3838

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC81X/spi_api.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,9 @@ static inline int ssp_read(spi_t *obj) {
183183
}
184184

185185
static inline int ssp_busy(spi_t *obj) {
186-
// TODO
187-
return 0;
188-
}
186+
// checking RXOV(Receiver Overrun interrupt flag)
187+
return obj->spi->STAT & (1 << 2);
188+
}
189189

190190
int spi_master_write(spi_t *obj, int value) {
191191
ssp_write(obj, value);

libraries/tests/mbed/spi_slave/main.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
#if defined(TARGET_KL25Z)
44
SPISlave device(PTD2, PTD3, PTD1, PTD0); // mosi, miso, sclk, ssel
5+
6+
#elif defined(TARGET_LPC812)
7+
SPISlave device(P0_14, P0_15, P0_12, P0_13); // mosi, miso, sclk, ssel
8+
59
#else
610
SPISlave device(p5, p6, p7, p8); // mosi, miso, sclk, ssel
711
#endif

0 commit comments

Comments
 (0)