
BLE Nano Code.Tested with Integrated mDot code
Dependencies: BLE_API mbed nRF51822
Fork of eco_Labs_ble_Client by
Diff: spi_slave.cpp
- Revision:
- 25:96044c55f844
- Parent:
- 16:79b149aae10a
- Child:
- 33:17b8c186eb07
--- a/spi_slave.cpp Sun Oct 23 12:46:21 2016 +0000 +++ b/spi_slave.cpp Sun Oct 23 14:41:49 2016 +0000 @@ -41,8 +41,7 @@ /******************************************************************************/ DigitalOut led2(LED1); SPISlave device(P0_9, P0_11,P0_8, P0_10); // mosi, miso, sclk, ssel -DigitalOut spi_rqst(P0_28); -DigitalOut spi_rdy(P0_29); + static spi_data_ready_callback_t spi_data_ready_cb; @@ -50,45 +49,10 @@ uint8_t spi_tx_ptr; uint8_t spi_bytes_to_send; -#define SPI_RQST 28 -#define SPI_RDY 29 /******************************************************************************/ /* Global Functions */ /******************************************************************************/ /** - * @brief Enable Interrupt line - * @param None - * @retval None - */ -void enable_interrupt_line(bool state ,uint8_t pin_num ) -{ - - if(pin_num == SPI_RQST) - { - if(state) - { - spi_rqst =1; - } - else - { - spi_rqst =0; - } - } - else - { - if(state) - { - - spi_rdy =1; - } - else - { - spi_rdy =0; - } - } - -} -/** * @brief Initializes the Nano BLE SPI slave buffer init * @param None * @retval None @@ -129,7 +93,6 @@ { send_ptr = 0; /*read compleated*/ - enable_interrupt_line(false,SPI_RDY); } } else { device.reply(SPI_TX_EMPTY_DATA); @@ -153,11 +116,7 @@ void spi_slave_tx_data(uint8_t *tx_buf, uint8_t len) { spi_tx_ptr = 0; - spi_bytes_to_send = 0; - - /* TODO: make the GPIO line high */ - enable_interrupt_line(true,SPI_RDY); - + spi_bytes_to_send = 0; /* Copy the buffer into local buffer */ memcpy(&spi_tx_buf[spi_tx_ptr], tx_buf, len); spi_bytes_to_send += len; @@ -177,15 +136,6 @@ { spi_data_ready_cb = data_rx_callback; } - - -void init_interrupt_line(void ) -{ - spi_rqst =0; - spi_rdy =0; -} - - /******************************************************************************/ /* END OF FILE */ /******************************************************************************/ \ No newline at end of file