![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Proj 324 Final
Fork of ELEC351_Group_T by
SETUP.hpp@54:a4c5949707ca, 2018-05-16 (annotated)
- Committer:
- thomasmorris
- Date:
- Wed May 16 19:57:52 2018 +0000
- Revision:
- 54:a4c5949707ca
- Parent:
- 53:71f59e195f06
- Child:
- 55:e0e684531825
Working_data_receive
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasmorris | 52:99915f5240b2 | 1 | /* |
thomasmorris | 52:99915f5240b2 | 2 | Setup file for the main |
thomasmorris | 52:99915f5240b2 | 3 | */ |
thomasmorris | 52:99915f5240b2 | 4 | |
thomasmorris | 52:99915f5240b2 | 5 | #ifndef SETUP_HPP//Header Guards Prevents Multiple includes |
thomasmorris | 52:99915f5240b2 | 6 | #define SETUP_HPP |
thomasmorris | 52:99915f5240b2 | 7 | |
thomasmorris | 52:99915f5240b2 | 8 | //Libraries and header includes |
thomasmorris | 25:36699ed589ab | 9 | #include "rtos.h" |
thomasmorris | 25:36699ed589ab | 10 | #include "LED.hpp" |
thomasmorris | 25:36699ed589ab | 11 | #include "LCD.hpp" |
thomasmorris | 25:36699ed589ab | 12 | #include "SERIAL.hpp" |
thomasmorris | 30:4cde05cc7c4f | 13 | #include "TIME.hpp" |
thomasmorris | 52:99915f5240b2 | 14 | #include "SERIAL_COMMANDS.hpp" |
thomasmorris | 53:71f59e195f06 | 15 | #include "sample_hardware.hpp" |
thomasmorris | 52:99915f5240b2 | 16 | #include "THREADS.hpp" |
thomasmorris | 52:99915f5240b2 | 17 | #include "LED_LOGGING.hpp" |
thomasmorris | 53:71f59e195f06 | 18 | #include "STEPPER_MOTOR.hpp" |
thomasmorris | 53:71f59e195f06 | 19 | #include "SPI.hpp" |
thomasmorris | 53:71f59e195f06 | 20 | #include "Algorithm.hpp" |
thomasmorris | 53:71f59e195f06 | 21 | #include <iostream> |
thomasmorris | 53:71f59e195f06 | 22 | #include <bitset> |
thomasmorris | 38:8d86e0d8a816 | 23 | |
thomasmorris | 53:71f59e195f06 | 24 | using namespace std; |
thomasmorris | 41:859b5e1e3d9a | 25 | //Time definitions |
thomasmorris | 45:875f7e18a386 | 26 | #define TimerInterval 15 //This is in seconds |
thomasmorris | 52:99915f5240b2 | 27 | #define SW1_SW2_Timeout_Time 15 //This is in seconds |
thomasmorris | 41:859b5e1e3d9a | 28 | |
thomasmorris | 52:99915f5240b2 | 29 | //Time outs |
thomasmorris | 52:99915f5240b2 | 30 | Timeout SW1TimeOut; //Used to prevent lockups |
thomasmorris | 52:99915f5240b2 | 31 | Timeout SW2TimeOut; //Used to prevent lockups |
thomasmorris | 41:859b5e1e3d9a | 32 | |
thomasmorris | 53:71f59e195f06 | 33 | LED Red_led(PE_15); |
thomasmorris | 53:71f59e195f06 | 34 | LED Green_led(PB_11); |
thomasmorris | 53:71f59e195f06 | 35 | |
thomasmorris | 41:859b5e1e3d9a | 36 | //Forward Declarations of functions |
thomasmorris | 25:36699ed589ab | 37 | |
thomasmorris | 25:36699ed589ab | 38 | void Serial_Comms(); |
chills | 26:78f5e454e59f | 39 | void Console_Output_ISR(); |
thomasmorris | 41:859b5e1e3d9a | 40 | void Serial_Comms_Data_Get(); |
thomasmorris | 41:859b5e1e3d9a | 41 | void Console_Output_ISR(); |
thomasmorris | 53:71f59e195f06 | 42 | void Rotate_Steps(); |
thomasmorris | 52:99915f5240b2 | 43 | void SW1TimeOutHandler(); |
thomasmorris | 52:99915f5240b2 | 44 | void SW1FallingEdge(); |
thomasmorris | 52:99915f5240b2 | 45 | void SW2TimeOutHandler(); |
thomasmorris | 52:99915f5240b2 | 46 | void SW2FallingEdge(); |
thomasmorris | 53:71f59e195f06 | 47 | //Object creations |
thomasmorris | 53:71f59e195f06 | 48 | static STEPPER_MOTOR STEPPER_MOTOR_1(D0,D1);//step then direction |
thomasmorris | 53:71f59e195f06 | 49 | static STEPPER_MOTOR STEPPER_MOTOR_2(D2,D3);//step then direction |
thomasmorris | 53:71f59e195f06 | 50 | static STEPPER_MOTOR STEPPER_MOTOR_3(D4,D5);//step then direction |
thomasmorris | 53:71f59e195f06 | 51 | static STEPPER_MOTOR STEPPER_MOTOR_4(D6,D7);//step then direction |
thomasmorris | 53:71f59e195f06 | 52 | static STEPPER_MOTOR STEPPER_MOTOR_5(D8,D9);//step then direction |
thomasmorris | 53:71f59e195f06 | 53 | static STEPPER_MOTOR STEPPER_MOTOR_6(D10,D11);//step then direction |
thomasmorris | 53:71f59e195f06 | 54 | |
thomasmorris | 53:71f59e195f06 | 55 | //Sets up the sides of the cube |
thomasmorris | 53:71f59e195f06 | 56 | static SIDE SIDE1(); |
thomasmorris | 53:71f59e195f06 | 57 | static SIDE SIDE2(); |
thomasmorris | 53:71f59e195f06 | 58 | static SIDE SIDE3(); |
thomasmorris | 53:71f59e195f06 | 59 | static SIDE SIDE4(); |
thomasmorris | 53:71f59e195f06 | 60 | static SIDE SIDE5(); |
thomasmorris | 53:71f59e195f06 | 61 | static SIDE SIDE6(); |
thomasmorris | 41:859b5e1e3d9a | 62 | |
thomasmorris | 54:a4c5949707ca | 63 | static Colours CubeMap[6][3][3];//The colours of each section on the cube map |
thomasmorris | 54:a4c5949707ca | 64 | /* |
thomasmorris | 54:a4c5949707ca | 65 | 1 White |
thomasmorris | 54:a4c5949707ca | 66 | 2 Red |
thomasmorris | 54:a4c5949707ca | 67 | 3 Orange |
thomasmorris | 54:a4c5949707ca | 68 | 4 Blue |
thomasmorris | 54:a4c5949707ca | 69 | 5 Green |
thomasmorris | 54:a4c5949707ca | 70 | 6 Yellow |
thomasmorris | 54:a4c5949707ca | 71 | These are the faces of the cube then there are the 3x3 cubelets within each face |
thomasmorris | 54:a4c5949707ca | 72 | */ |
thomasmorris | 54:a4c5949707ca | 73 | |
thomasmorris | 25:36699ed589ab | 74 | #endif |