Testing 1 blue pill
Dependencies: mbed mbed-rtos TextLCD
Interface/Interface.hpp@29:f3b1387c81f1, 2019-03-13 (annotated)
- Committer:
- thomasmorris
- Date:
- Wed Mar 13 11:34:39 2019 +0000
- Revision:
- 29:f3b1387c81f1
- Parent:
- 28:3193157ebb0c
- Child:
- 30:a35f0ab97a65
Final Coiling Rig;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasmorris | 16:9f98ec0ededb | 1 | #ifndef INTERFACE_HPP//Header Guards Prevents Multiple includes |
thomasmorris | 16:9f98ec0ededb | 2 | #define INTERFACE_HPP |
thomasmorris | 16:9f98ec0ededb | 3 | |
thomasmorris | 16:9f98ec0ededb | 4 | #include "mbed.h" |
thomasmorris | 17:68b3fdabe4c5 | 5 | #include "STEPPER_MOTOR.hpp" //Include this to use the stepper motor |
thomasmorris | 25:9751619fa030 | 6 | |
thomasmorris | 25:9751619fa030 | 7 | |
thomasmorris | 26:83550fc299aa | 8 | //Digital In for the button control to the interface |
thomasmorris | 26:83550fc299aa | 9 | static DigitalIn button_up(D8); //D8//Increment Button |
thomasmorris | 26:83550fc299aa | 10 | static DigitalIn button_down(A1); //A1//Decrement Button |
thomasmorris | 26:83550fc299aa | 11 | static DigitalIn button_start(D9); //D9//START / STOP BUTTON |
thomasmorris | 26:83550fc299aa | 12 | static DigitalIn button_function(A3); //A3//Function Button |
thomasmorris | 26:83550fc299aa | 13 | static DigitalIn button_select(A4);//A4//Select Button |
thomasmorris | 25:9751619fa030 | 14 | |
thomasmorris | 25:9751619fa030 | 15 | |
thomasmorris | 23:07a368f2cdb1 | 16 | //Led Outputs //check the pin outs |
thomasmorris | 28:3193157ebb0c | 17 | static DigitalOut Led_Select_Left(D2); |
thomasmorris | 28:3193157ebb0c | 18 | static DigitalOut Led_Select_Right(D3); |
thomasmorris | 28:3193157ebb0c | 19 | static DigitalOut Led_Power(A0); |
thomasmorris | 16:9f98ec0ededb | 20 | static STEPPER_MOTOR STEPPER_MOTOR_1(D15,D14,D13,D12); |
thomasmorris | 23:07a368f2cdb1 | 21 | static PwmOut Tendon_Power(PE_8); |
thomasmorris | 16:9f98ec0ededb | 22 | |
thomasmorris | 17:68b3fdabe4c5 | 23 | |
thomasmorris | 23:07a368f2cdb1 | 24 | class INTERFACE//This creates a class called Led |
thomasmorris | 16:9f98ec0ededb | 25 | { |
thomasmorris | 16:9f98ec0ededb | 26 | public: |
thomasmorris | 16:9f98ec0ededb | 27 | //Public member variables |
thomasmorris | 16:9f98ec0ededb | 28 | |
thomasmorris | 16:9f98ec0ededb | 29 | //Public Member Functions |
thomasmorris | 25:9751619fa030 | 30 | INTERFACE(); //Constructor |
thomasmorris | 17:68b3fdabe4c5 | 31 | ~INTERFACE();//Destructor |
thomasmorris | 16:9f98ec0ededb | 32 | |
thomasmorris | 29:f3b1387c81f1 | 33 | void Interface_Init(int turns, int type_of_rig);//Set all values to 0 bar the passed in variable |
thomasmorris | 17:68b3fdabe4c5 | 34 | void Up();//Up Routine |
thomasmorris | 17:68b3fdabe4c5 | 35 | void Down();//Down Routine |
thomasmorris | 17:68b3fdabe4c5 | 36 | void Start_Stop();//Start / Stop Routine |
thomasmorris | 17:68b3fdabe4c5 | 37 | void Function();//Function Routine |
thomasmorris | 17:68b3fdabe4c5 | 38 | void Select();//Select Routine |
thomasmorris | 17:68b3fdabe4c5 | 39 | void Interface_main();//Main Routine |
thomasmorris | 16:9f98ec0ededb | 40 | |
thomasmorris | 17:68b3fdabe4c5 | 41 | //Setters to assign data to the private memeber variables |
thomasmorris | 23:07a368f2cdb1 | 42 | void Set_System_Running(int System_Running); |
thomasmorris | 16:9f98ec0ededb | 43 | void Set_Function(int Function); |
thomasmorris | 16:9f98ec0ededb | 44 | void Set_Twist_Go(bool Twist_Go); |
thomasmorris | 16:9f98ec0ededb | 45 | void Set_Anneal_Go(bool Anneal_Go); |
thomasmorris | 16:9f98ec0ededb | 46 | void Set_Test_Go(bool Test_Go); |
thomasmorris | 23:07a368f2cdb1 | 47 | void Set_Twist_Stop(bool Twist_Stop); |
thomasmorris | 23:07a368f2cdb1 | 48 | void Set_Anneal_Stop(bool Anneal_Stop); |
thomasmorris | 23:07a368f2cdb1 | 49 | void Set_Test_Stop(bool Test_Stop); |
thomasmorris | 25:9751619fa030 | 50 | void Set_Select(int Select); |
thomasmorris | 16:9f98ec0ededb | 51 | void Set_Turns_Done(int Turns_Done); |
thomasmorris | 16:9f98ec0ededb | 52 | void Set_Turns_To_Do(int Turns_To_Do); |
thomasmorris | 16:9f98ec0ededb | 53 | void Set_Loop(int Loop); |
thomasmorris | 25:9751619fa030 | 54 | void Set_On_Time(int On_Time); |
thomasmorris | 25:9751619fa030 | 55 | void Set_Off_Time(int Off_Time); |
thomasmorris | 16:9f98ec0ededb | 56 | void Set_Duty_Cycle(int Duty_Cycle); |
thomasmorris | 16:9f98ec0ededb | 57 | void Set_Power_Time(float Power_Time); |
thomasmorris | 29:f3b1387c81f1 | 58 | void Set_Direction(bool Direction); |
thomasmorris | 16:9f98ec0ededb | 59 | |
thomasmorris | 17:68b3fdabe4c5 | 60 | //Getters to receive private information |
thomasmorris | 23:07a368f2cdb1 | 61 | int Get_System_Running(); |
thomasmorris | 16:9f98ec0ededb | 62 | int Get_Function(); |
thomasmorris | 16:9f98ec0ededb | 63 | bool Get_Twist_Go(); |
thomasmorris | 16:9f98ec0ededb | 64 | bool Get_Anneal_Go(); |
thomasmorris | 16:9f98ec0ededb | 65 | bool Get_Test_Go(); |
thomasmorris | 23:07a368f2cdb1 | 66 | bool Get_Twist_Stop(); |
thomasmorris | 23:07a368f2cdb1 | 67 | bool Get_Anneal_Stop(); |
thomasmorris | 23:07a368f2cdb1 | 68 | bool Get_Test_Stop(); |
thomasmorris | 25:9751619fa030 | 69 | int Get_Select(); |
thomasmorris | 16:9f98ec0ededb | 70 | int Get_Turns_Done(); |
thomasmorris | 16:9f98ec0ededb | 71 | int Get_Turns_To_Do(); |
thomasmorris | 16:9f98ec0ededb | 72 | int Get_Loop(); |
thomasmorris | 25:9751619fa030 | 73 | int Get_On_Time(); |
thomasmorris | 25:9751619fa030 | 74 | int Get_Off_Time(); |
thomasmorris | 16:9f98ec0ededb | 75 | int Get_Duty_Cycle(); |
thomasmorris | 16:9f98ec0ededb | 76 | int Get_Power_Time(); |
thomasmorris | 29:f3b1387c81f1 | 77 | bool Get_Direction(); |
thomasmorris | 16:9f98ec0ededb | 78 | |
thomasmorris | 16:9f98ec0ededb | 79 | private: |
thomasmorris | 16:9f98ec0ededb | 80 | //Private member variables to prevent them being accessed externally |
thomasmorris | 23:07a368f2cdb1 | 81 | int _System_Running; |
thomasmorris | 16:9f98ec0ededb | 82 | int _No_Of_Rotations; |
thomasmorris | 16:9f98ec0ededb | 83 | int _Function; |
thomasmorris | 23:07a368f2cdb1 | 84 | |
thomasmorris | 23:07a368f2cdb1 | 85 | //Start |
thomasmorris | 16:9f98ec0ededb | 86 | bool _Twist_Go; |
thomasmorris | 16:9f98ec0ededb | 87 | bool _Anneal_Go; |
thomasmorris | 16:9f98ec0ededb | 88 | bool _Test_Go; |
thomasmorris | 23:07a368f2cdb1 | 89 | |
thomasmorris | 23:07a368f2cdb1 | 90 | //Stop |
thomasmorris | 23:07a368f2cdb1 | 91 | bool _Twist_Stop; |
thomasmorris | 23:07a368f2cdb1 | 92 | bool _Anneal_Stop; |
thomasmorris | 23:07a368f2cdb1 | 93 | bool _Test_Stop; |
thomasmorris | 23:07a368f2cdb1 | 94 | |
thomasmorris | 25:9751619fa030 | 95 | int _Select; |
thomasmorris | 16:9f98ec0ededb | 96 | int _Turns_Done; |
thomasmorris | 16:9f98ec0ededb | 97 | int _Turns_Todo; |
thomasmorris | 16:9f98ec0ededb | 98 | int _Loop; |
thomasmorris | 25:9751619fa030 | 99 | int _On_Time; |
thomasmorris | 25:9751619fa030 | 100 | int _Off_Time;//IN SECONDS |
thomasmorris | 16:9f98ec0ededb | 101 | int _Duty_Cycle; |
thomasmorris | 16:9f98ec0ededb | 102 | int _Power_Time; |
thomasmorris | 29:f3b1387c81f1 | 103 | bool _Direction; |
thomasmorris | 29:f3b1387c81f1 | 104 | int _Type_of_Rig; |
thomasmorris | 29:f3b1387c81f1 | 105 | |
thomasmorris | 23:07a368f2cdb1 | 106 | //Mutex Locks |
thomasmorris | 23:07a368f2cdb1 | 107 | Mutex _System_Running_mutex; |
thomasmorris | 23:07a368f2cdb1 | 108 | Mutex _No_Of_Rotations_mutex; |
thomasmorris | 23:07a368f2cdb1 | 109 | Mutex _Function_mutex; |
thomasmorris | 23:07a368f2cdb1 | 110 | Mutex _Twist_Go_mutex; |
thomasmorris | 23:07a368f2cdb1 | 111 | Mutex _Anneal_Go_mutex; |
thomasmorris | 23:07a368f2cdb1 | 112 | Mutex _Test_Go_mutex; |
thomasmorris | 23:07a368f2cdb1 | 113 | Mutex _Twist_Stop_mutex; |
thomasmorris | 23:07a368f2cdb1 | 114 | Mutex _Anneal_Stop_mutex; |
thomasmorris | 23:07a368f2cdb1 | 115 | Mutex _Test_Stop_mutex; |
thomasmorris | 23:07a368f2cdb1 | 116 | Mutex _Select_mutex; |
thomasmorris | 23:07a368f2cdb1 | 117 | Mutex _Turns_Done_mutex; |
thomasmorris | 23:07a368f2cdb1 | 118 | Mutex _Turns_Todo_mutex; |
thomasmorris | 23:07a368f2cdb1 | 119 | Mutex _Loop_mutex; |
thomasmorris | 25:9751619fa030 | 120 | Mutex _On_Time_mutex;//IN SECONDS |
thomasmorris | 25:9751619fa030 | 121 | Mutex _Off_Time_mutex; |
thomasmorris | 23:07a368f2cdb1 | 122 | Mutex _Duty_Cycle_mutex; |
thomasmorris | 23:07a368f2cdb1 | 123 | Mutex _Power_Time_mutex; |
thomasmorris | 23:07a368f2cdb1 | 124 | Mutex _Tendon_mutex; |
thomasmorris | 23:07a368f2cdb1 | 125 | Mutex Led_Select_Left_mutex; |
thomasmorris | 23:07a368f2cdb1 | 126 | Mutex Led_Select_Right_mutex; |
thomasmorris | 23:07a368f2cdb1 | 127 | Mutex Led_Power_mutex; |
thomasmorris | 29:f3b1387c81f1 | 128 | Mutex _Direction_mutex; |
thomasmorris | 29:f3b1387c81f1 | 129 | Mutex _Type_of_Rig_mutex; |
thomasmorris | 16:9f98ec0ededb | 130 | }; |
thomasmorris | 16:9f98ec0ededb | 131 | #endif//INTERFACE_HPP |