Ben Gordon
/
Muscle_Controlled_Servo
SPI.h@5:11489c0bd020, 2018-04-05 (annotated)
- Committer:
- BenRJG
- Date:
- Thu Apr 05 15:54:48 2018 +0000
- Revision:
- 5:11489c0bd020
- Parent:
- 4:bcef9164776e
- Child:
- 9:a7085b7503d2
Separated functions to individual SPI, FPGA, LCD and ADC files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
BenRJG | 1:acc66d3a1a1c | 1 | #ifndef _SPI_H_ |
BenRJG | 1:acc66d3a1a1c | 2 | #define _SPI_H_ |
BenRJG | 1:acc66d3a1a1c | 3 | //////Included Files////// |
BenRJG | 1:acc66d3a1a1c | 4 | #include "mbed.h" |
BenRJG | 1:acc66d3a1a1c | 5 | ////////////////////////// |
BenRJG | 1:acc66d3a1a1c | 6 | |
BenRJG | 4:bcef9164776e | 7 | ///////Definitions//////// |
BenRJG | 1:acc66d3a1a1c | 8 | #define DD 25 //Display Delay us |
BenRJG | 1:acc66d3a1a1c | 9 | #define CD 2000 //Command Delay us |
BenRJG | 3:d6e142b6ead1 | 10 | |
BenRJG | 3:d6e142b6ead1 | 11 | // Chip Select => 111(7) = Nothing, 110(6) = General, 101(5) = LCD, 011(3) = ADC// |
BenRJG | 4:bcef9164776e | 12 | #define CS_RESET 7 // RESET (No chip selected) |
BenRJG | 4:bcef9164776e | 13 | #define CS_GENERAL 6 // GENERAL |
BenRJG | 4:bcef9164776e | 14 | #define CS_LCD 5 // LCD |
BenRJG | 4:bcef9164776e | 15 | #define CS_ADC 3 // ADC |
BenRJG | 3:d6e142b6ead1 | 16 | |
BenRJG | 4:bcef9164776e | 17 | ////////////////////////// |
BenRJG | 1:acc66d3a1a1c | 18 | |
BenRJG | 4:bcef9164776e | 19 | ////////Functions///////// |
BenRJG | 1:acc66d3a1a1c | 20 | //Function Prototypes, will just output a string to display, see later// |
BenRJG | 2:b615682e3e4f | 21 | void SPI_INIT(void); |
BenRJG | 4:bcef9164776e | 22 | |
BenRJG | 4:bcef9164776e | 23 | void spi_write_data(short destination, unsigned int data); |
BenRJG | 4:bcef9164776e | 24 | int32_t spi_read_data(short destination); |
BenRJG | 4:bcef9164776e | 25 | int32_t spi_read_write_data(short destination, unsigned int data); |
BenRJG | 4:bcef9164776e | 26 | ////////////////////////// |
BenRJG | 4:bcef9164776e | 27 | #endif |