Ben Gordon
/
Muscle_Controlled_Servo
ELEC240 Group Coursework ---------------------------------- C-Code for muscle controlled servo
SPI.h@10:6b9c7857d57c, 2018-06-01 (annotated)
- Committer:
- BenRJG
- Date:
- Fri Jun 01 13:39:12 2018 +0000
- Revision:
- 10:6b9c7857d57c
- Parent:
- 9:a7085b7503d2
fixed adc
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 | 9:a7085b7503d2 | 5 | #include <stm32f4xx.h> |
BenRJG | 1:acc66d3a1a1c | 6 | ////////////////////////// |
BenRJG | 1:acc66d3a1a1c | 7 | |
BenRJG | 4:bcef9164776e | 8 | ///////Definitions//////// |
BenRJG | 1:acc66d3a1a1c | 9 | #define DD 25 //Display Delay us |
BenRJG | 1:acc66d3a1a1c | 10 | #define CD 2000 //Command Delay us |
BenRJG | 3:d6e142b6ead1 | 11 | |
BenRJG | 3:d6e142b6ead1 | 12 | // Chip Select => 111(7) = Nothing, 110(6) = General, 101(5) = LCD, 011(3) = ADC// |
BenRJG | 4:bcef9164776e | 13 | #define CS_RESET 7 // RESET (No chip selected) |
BenRJG | 4:bcef9164776e | 14 | #define CS_GENERAL 6 // GENERAL |
BenRJG | 4:bcef9164776e | 15 | #define CS_LCD 5 // LCD |
BenRJG | 4:bcef9164776e | 16 | #define CS_ADC 3 // ADC |
BenRJG | 3:d6e142b6ead1 | 17 | |
BenRJG | 4:bcef9164776e | 18 | ////////////////////////// |
BenRJG | 1:acc66d3a1a1c | 19 | |
BenRJG | 4:bcef9164776e | 20 | ////////Functions///////// |
BenRJG | 1:acc66d3a1a1c | 21 | //Function Prototypes, will just output a string to display, see later// |
BenRJG | 2:b615682e3e4f | 22 | void SPI_INIT(void); |
BenRJG | 4:bcef9164776e | 23 | |
BenRJG | 4:bcef9164776e | 24 | void spi_write_data(short destination, unsigned int data); |
BenRJG | 4:bcef9164776e | 25 | int32_t spi_read_data(short destination); |
BenRJG | 4:bcef9164776e | 26 | int32_t spi_read_write_data(short destination, unsigned int data); |
BenRJG | 4:bcef9164776e | 27 | ////////////////////////// |
BenRJG | 4:bcef9164776e | 28 | #endif |