Alex Borisevich
/
OpenBCI
PlatformSPI.h@1:4683702d7ad8, 2017-01-22 (annotated)
- Committer:
- akpc806a
- Date:
- Sun Jan 22 04:10:11 2017 +0000
- Revision:
- 1:4683702d7ad8
- Parent:
- 0:2cb59ea20ace
OpenBCI 32bit board variation with STM32L476 mircocontroller and mbed support. Version V2 of firmware, forked from the same official version for the PIC32 board.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
akpc806a | 0:2cb59ea20ace | 1 | // interface for SPI implemented with mbed framework |
akpc806a | 0:2cb59ea20ace | 2 | |
akpc806a | 0:2cb59ea20ace | 3 | #ifndef __PlatformSPI__ |
akpc806a | 0:2cb59ea20ace | 4 | #define __PlatformSPI__ |
akpc806a | 0:2cb59ea20ace | 5 | |
akpc806a | 0:2cb59ea20ace | 6 | #define DSPI_MODE0 0 // CKP = 0 CKE = 1 ====> POL=0 PHA=0 |
akpc806a | 0:2cb59ea20ace | 7 | #define DSPI_MODE1 1 // CKP = 0 CKE = 0 ====> POL=0 PHA=1 |
akpc806a | 0:2cb59ea20ace | 8 | #define DSPI_MODE2 2 // CKP = 1 CKE = 1 ====> POL=1 PHA=0 |
akpc806a | 0:2cb59ea20ace | 9 | #define DSPI_MODE3 3 // CKP = 1 CKE = 0 ====> POL=1 PHA=1 |
akpc806a | 0:2cb59ea20ace | 10 | |
akpc806a | 0:2cb59ea20ace | 11 | class DSPI0 { |
akpc806a | 0:2cb59ea20ace | 12 | public: |
akpc806a | 0:2cb59ea20ace | 13 | void begin(); |
akpc806a | 0:2cb59ea20ace | 14 | void setSpeed(int speed_hz); |
akpc806a | 0:2cb59ea20ace | 15 | void setMode(int mode); |
akpc806a | 0:2cb59ea20ace | 16 | int transfer(int data); |
akpc806a | 0:2cb59ea20ace | 17 | private: |
akpc806a | 0:2cb59ea20ace | 18 | |
akpc806a | 0:2cb59ea20ace | 19 | }; |
akpc806a | 0:2cb59ea20ace | 20 | |
akpc806a | 0:2cb59ea20ace | 21 | #endif |