Uses DMA to read/write SPI blocks, while putting the current thread in Wait state.
Diff: RTOS_SPI.h
- Revision:
- 2:d052724e2ad6
- Parent:
- 0:004e5e86de4e
--- a/RTOS_SPI.h Sun Jan 05 10:20:17 2014 +0000 +++ b/RTOS_SPI.h Fri Jun 27 10:12:42 2014 +0000 @@ -15,6 +15,8 @@ * * This is a child class of SPI, so all regular SPI functions * are available + two for DMA control. +* +* @note Only supports 8-bit SPI. The 16-bit SPI mode of the KL46Z is not supported. */ class RTOS_SPI: public SPI { public: @@ -37,7 +39,7 @@ * @param length - number of bytes to write * @param array - true if write_data is an array, false if it is a single constant value */ - void bulkWrite(uint8_t *write_data, int length, bool array = true) { + void bulkWrite(const uint8_t *write_data, int length, bool array = true) { uint8_t dummy; bulkInternal(&dummy, write_data, length, false, array); } @@ -50,12 +52,12 @@ * @param length - number of bytes to write * @param array - true if write_data is an array, false if it is a single constant value */ - void bulkReadWrite(uint8_t *read_data, uint8_t *write_data, int length, bool array = true) { + void bulkReadWrite(uint8_t *read_data, const uint8_t *write_data, int length, bool array = true) { bulkInternal(read_data, write_data, length, true, array); } private: - void bulkInternal(uint8_t *read_data, uint8_t *write_data, int length, bool read_inc, bool write_inc); + void bulkInternal(uint8_t *read_data, const uint8_t *write_data, int length, bool read_inc, bool write_inc); SimpleDMA read_dma; SimpleDMA write_dma;