Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed nRF51822
Fork of eco_Labs_ble_Client by
Diff: spi_slave.cpp
- Revision:
- 12:c7a8a7fe76fd
- Parent:
- 11:b8e687d97537
- Child:
- 15:67fbed00edf2
diff -r b8e687d97537 -r c7a8a7fe76fd spi_slave.cpp
--- a/spi_slave.cpp Thu Oct 06 09:42:38 2016 +0000
+++ b/spi_slave.cpp Thu Oct 06 15:25:57 2016 +0000
@@ -104,13 +104,18 @@
if (spi_bytes_to_send > 0) {
//device.reply(rx_buf[byte_cnt]);
- device.reply(spi_tx_buf[send_ptr]);
+ device.reply(spi_tx_buf[send_ptr++]);
if (spi_tx_ptr++ > SPI_TX_BUF_SIZE) {
spi_tx_ptr= 0;
}
spi_bytes_to_send--;
+ if(spi_bytes_to_send ==0)
+ {
+ send_ptr = 0;
+ enable_interrupt_line(false);
+ }
} else {
- device.reply(rx_buf[byte_cnt]);
+ device.reply(SPI_TX_EMPTY_DATA);
}
if ((byte_cnt >= 4) && (rx_buf[byte_cnt] == BLE_EOT_CMD)) {
@@ -130,9 +135,11 @@
*/
void spi_slave_tx_data(uint8_t *tx_buf, uint8_t len)
{
-#if 0
+ spi_tx_ptr = 0;
+ spi_bytes_to_send = 0;
+
/* TODO: make the GPIO line high */
- // enable_interrupt_line();
+ enable_interrupt_line(true);
/* Copy the buffer into local buffer */
memcpy(&spi_tx_buf[spi_tx_ptr], tx_buf, len);
@@ -141,7 +148,7 @@
if (spi_tx_ptr > SPI_TX_BUF_SIZE) {
spi_tx_ptr = 0;
}
-#endif
+
}
/**
