Ultra fast and direct SPI library for some STM32 micros.
Dependents: DirectSPI-test wave_player_super_lite
DirectSPI.h@2:1faa28f1a5bb, 2017-02-23 (annotated)
- Committer:
- mimi3
- Date:
- Thu Feb 23 22:25:39 2017 +0900
- Revision:
- 2:1faa28f1a5bb
- Parent:
- 1:576dbeb04958
- Child:
- 3:63cc20b0895b
update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mimi3 | 1:576dbeb04958 | 1 | #include "mbed.h" |
mimi3 | 1:576dbeb04958 | 2 | #include "PeripheralPins.h" |
mimi3 | 1:576dbeb04958 | 3 | #define TODO 0 |
mimi3 | 1:576dbeb04958 | 4 | |
mimi3 | 1:576dbeb04958 | 5 | class DirectSPI : public SPI |
mimi3 | 1:576dbeb04958 | 6 | { |
mimi3 | 1:576dbeb04958 | 7 | public: |
mimi3 | 1:576dbeb04958 | 8 | DirectSPI(PinName mosi, PinName miso, PinName sclk); |
mimi3 | 1:576dbeb04958 | 9 | uint16_t directWrite8(uint16_t data); |
mimi3 | 1:576dbeb04958 | 10 | uint16_t directWrite16(uint16_t data); |
mimi3 | 2:1faa28f1a5bb | 11 | uint16_t directWrite(uint16_t data); |
mimi3 | 2:1faa28f1a5bb | 12 | protected: |
mimi3 | 1:576dbeb04958 | 13 | SPI_TypeDef *spi; |
mimi3 | 1:576dbeb04958 | 14 | #if TODO |
mimi3 | 1:576dbeb04958 | 15 | uint16_t (DirectSPI::*spiSend)(uint16_t data); |
mimi3 | 2:1faa28f1a5bb | 16 | uint16_t spiSend8(uint16_t data){return 0;}; |
mimi3 | 2:1faa28f1a5bb | 17 | uint16_t spiSend16(uint16_t data){return 0;}; |
mimi3 | 1:576dbeb04958 | 18 | #endif |
mimi3 | 1:576dbeb04958 | 19 | }; |
mimi3 | 1:576dbeb04958 | 20 |