test
Dependencies: SimpleDMA mbed-rtos mbed
Fork of spiDMAtest by
Diff: dmaSPIslave.h
- Revision:
- 1:3cceef118195
- Parent:
- 0:f0f5102ed9ca
- Child:
- 2:16545dbc88ae
--- a/dmaSPIslave.h Wed Jul 15 11:16:13 2015 +0000 +++ b/dmaSPIslave.h Thu Jul 16 05:19:02 2015 +0000 @@ -14,21 +14,29 @@ read_dma.source(&_spi.spi->DL, false); } - void bulkRead(uint8_t *read_data, int length){ + void bulkRead_init(uint8_t *read_data, int len, void (*fun)(void) ){ // acquire(); _spi.spi->C2 |= SPI_C2_RXDMAE_MASK; // auto increment is true read_dma.destination(read_data, true); +// specify length + length = len; + +// attach interrupt function + read_dma.attach(fun); + +// _spi.spi->C2 &= ~(SPI_C2_RXDMAE_MASK); + } + + void bulkRead_start(){ // start the read_dma read_dma.start(length); - - while(read_dma.isBusy()); + } - _spi.spi->C2 &= ~(SPI_C2_RXDMAE_MASK); - } private: + int length; SimpleDMA read_dma; }; #endif \ No newline at end of file