| 1 | #ifndef _SPI_H |
| 2 | #define _SPI_H |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | #include "spi_hal.h" |
| 7 | |
| 8 | class SPI { |
| 9 | public: |
| 10 | SPI(PinName mosi, PinName miso, PinName sclk); |
| 11 | ~SPI(); |
| 12 | |
| 13 | void frequency(uint32_t); |
| 14 | uint8_t write(uint8_t); |
| 15 | |
| 16 | // int writeblock(uint8_t *, int); |
| 17 | |
| 18 | bool can_DMA(); |
| 19 | int setup_DMA_rx(DMA_REG *); |
| 20 | int setup_DMA_tx(DMA_REG *); |
| 21 | |
| 22 | void irq(void); |
| 23 | |
| 24 | static SPI* isr_dispatch[N_SPI_INTERRUPT_ROUTINES]; |
| 25 | |
| 26 | protected: |
| 27 | uint32_t delay; |
| 28 | Pin_t miso; |
| 29 | Pin_t mosi; |
| 30 | Pin_t sclk; |
| 31 | SPI_REG *sspr; |
| 32 | }; |
| 33 | |
| 34 | #endif /* _SPI_H */ |