![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Testing 1 blue pill
Dependencies: mbed mbed-rtos TextLCD
Interface/Interface.hpp@25:9751619fa030, 2019-02-18 (annotated)
- Committer:
- thomasmorris
- Date:
- Mon Feb 18 22:04:54 2019 +0000
- Revision:
- 25:9751619fa030
- Parent:
- 23:07a368f2cdb1
- Child:
- 26:83550fc299aa
GET IN THE BIN
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 | #define Type_of_Rig 3 //Place 2 for coiling place 3 for twisting |
thomasmorris | 25:9751619fa030 | 8 | #define Default_Coiling_Turns 20 |
thomasmorris | 25:9751619fa030 | 9 | #define Default_Twisting_Turns 70 |
thomasmorris | 25:9751619fa030 | 10 | |
thomasmorris | 25:9751619fa030 | 11 | //Interrupt In for the button control to the interface |
thomasmorris | 25:9751619fa030 | 12 | static InterruptIn button_up(D8); //D8//Increment Button |
thomasmorris | 25:9751619fa030 | 13 | static InterruptIn button_down(A1); //A1//Decrement Button |
thomasmorris | 25:9751619fa030 | 14 | static InterruptIn button_start(D9); //D9//START / STOP BUTTON |
thomasmorris | 25:9751619fa030 | 15 | static InterruptIn button_funct(A3); //A3//Function Button |
thomasmorris | 25:9751619fa030 | 16 | static InterruptIn button_select(A4);//A4//Select Button |
thomasmorris | 25:9751619fa030 | 17 | |
thomasmorris | 25:9751619fa030 | 18 | |
thomasmorris | 23:07a368f2cdb1 | 19 | //Led Outputs //check the pin outs |
thomasmorris | 22:fc2186b610b5 | 20 | static DigitalOut Led_Select_Left(D2); |
thomasmorris | 22:fc2186b610b5 | 21 | static DigitalOut Led_Select_Right(D3); |
thomasmorris | 22:fc2186b610b5 | 22 | static DigitalOut Led_Power(A2); |
thomasmorris | 16:9f98ec0ededb | 23 | static STEPPER_MOTOR STEPPER_MOTOR_1(D15,D14,D13,D12); |
thomasmorris | 23:07a368f2cdb1 | 24 | static PwmOut Tendon_Power(PE_8); |
thomasmorris | 16:9f98ec0ededb | 25 | |
thomasmorris | 17:68b3fdabe4c5 | 26 | |
thomasmorris | 23:07a368f2cdb1 | 27 | class INTERFACE//This creates a class called Led |
thomasmorris | 16:9f98ec0ededb | 28 | { |
thomasmorris | 16:9f98ec0ededb | 29 | public: |
thomasmorris | 16:9f98ec0ededb | 30 | //Public member variables |
thomasmorris | 16:9f98ec0ededb | 31 | |
thomasmorris | 16:9f98ec0ededb | 32 | //Public Member Functions |
thomasmorris | 25:9751619fa030 | 33 | INTERFACE(); //Constructor |
thomasmorris | 17:68b3fdabe4c5 | 34 | ~INTERFACE();//Destructor |
thomasmorris | 16:9f98ec0ededb | 35 | |
thomasmorris | 17:68b3fdabe4c5 | 36 | void Interface_Init();//Set all values to 0 |
thomasmorris | 17:68b3fdabe4c5 | 37 | void Up();//Up Routine |
thomasmorris | 17:68b3fdabe4c5 | 38 | void Down();//Down Routine |
thomasmorris | 17:68b3fdabe4c5 | 39 | void Start_Stop();//Start / Stop Routine |
thomasmorris | 17:68b3fdabe4c5 | 40 | void Function();//Function Routine |
thomasmorris | 17:68b3fdabe4c5 | 41 | void Select();//Select Routine |
thomasmorris | 17:68b3fdabe4c5 | 42 | void Interface_main();//Main Routine |
thomasmorris | 16:9f98ec0ededb | 43 | |
thomasmorris | 17:68b3fdabe4c5 | 44 | //Setters to assign data to the private memeber variables |
thomasmorris | 23:07a368f2cdb1 | 45 | void Set_System_Running(int System_Running); |
thomasmorris | 16:9f98ec0ededb | 46 | void Set_Function(int Function); |
thomasmorris | 16:9f98ec0ededb | 47 | void Set_Twist_Go(bool Twist_Go); |
thomasmorris | 16:9f98ec0ededb | 48 | void Set_Anneal_Go(bool Anneal_Go); |
thomasmorris | 16:9f98ec0ededb | 49 | void Set_Test_Go(bool Test_Go); |
thomasmorris | 23:07a368f2cdb1 | 50 | void Set_Twist_Stop(bool Twist_Stop); |
thomasmorris | 23:07a368f2cdb1 | 51 | void Set_Anneal_Stop(bool Anneal_Stop); |
thomasmorris | 23:07a368f2cdb1 | 52 | void Set_Test_Stop(bool Test_Stop); |
thomasmorris | 25:9751619fa030 | 53 | void Set_Select(int Select); |
thomasmorris | 16:9f98ec0ededb | 54 | void Set_Turns_Done(int Turns_Done); |
thomasmorris | 16:9f98ec0ededb | 55 | void Set_Turns_To_Do(int Turns_To_Do); |
thomasmorris | 16:9f98ec0ededb | 56 | void Set_Loop(int Loop); |
thomasmorris | 25:9751619fa030 | 57 | void Set_On_Time(int On_Time); |
thomasmorris | 25:9751619fa030 | 58 | void Set_Off_Time(int Off_Time); |
thomasmorris | 16:9f98ec0ededb | 59 | void Set_Duty_Cycle(int Duty_Cycle); |
thomasmorris | 16:9f98ec0ededb | 60 | void Set_Power_Time(float Power_Time); |
thomasmorris | 16:9f98ec0ededb | 61 | |
thomasmorris | 17:68b3fdabe4c5 | 62 | //Getters to receive private information |
thomasmorris | 23:07a368f2cdb1 | 63 | int Get_System_Running(); |
thomasmorris | 16:9f98ec0ededb | 64 | int Get_Function(); |
thomasmorris | 16:9f98ec0ededb | 65 | bool Get_Twist_Go(); |
thomasmorris | 16:9f98ec0ededb | 66 | bool Get_Anneal_Go(); |
thomasmorris | 16:9f98ec0ededb | 67 | bool Get_Test_Go(); |
thomasmorris | 23:07a368f2cdb1 | 68 | bool Get_Twist_Stop(); |
thomasmorris | 23:07a368f2cdb1 | 69 | bool Get_Anneal_Stop(); |
thomasmorris | 23:07a368f2cdb1 | 70 | bool Get_Test_Stop(); |
thomasmorris | 25:9751619fa030 | 71 | int Get_Select(); |
thomasmorris | 16:9f98ec0ededb | 72 | int Get_Turns_Done(); |
thomasmorris | 16:9f98ec0ededb | 73 | int Get_Turns_To_Do(); |
thomasmorris | 16:9f98ec0ededb | 74 | int Get_Loop(); |
thomasmorris | 25:9751619fa030 | 75 | int Get_On_Time(); |
thomasmorris | 25:9751619fa030 | 76 | int Get_Off_Time(); |
thomasmorris | 16:9f98ec0ededb | 77 | int Get_Duty_Cycle(); |
thomasmorris | 16:9f98ec0ededb | 78 | int Get_Power_Time(); |
thomasmorris | 16:9f98ec0ededb | 79 | |
thomasmorris | 16:9f98ec0ededb | 80 | private: |
thomasmorris | 16:9f98ec0ededb | 81 | //Private member variables to prevent them being accessed externally |
thomasmorris | 23:07a368f2cdb1 | 82 | int _System_Running; |
thomasmorris | 16:9f98ec0ededb | 83 | int _No_Of_Rotations; |
thomasmorris | 16:9f98ec0ededb | 84 | int _Function; |
thomasmorris | 23:07a368f2cdb1 | 85 | |
thomasmorris | 23:07a368f2cdb1 | 86 | //Start |
thomasmorris | 16:9f98ec0ededb | 87 | bool _Twist_Go; |
thomasmorris | 16:9f98ec0ededb | 88 | bool _Anneal_Go; |
thomasmorris | 16:9f98ec0ededb | 89 | bool _Test_Go; |
thomasmorris | 23:07a368f2cdb1 | 90 | |
thomasmorris | 23:07a368f2cdb1 | 91 | //Stop |
thomasmorris | 23:07a368f2cdb1 | 92 | bool _Twist_Stop; |
thomasmorris | 23:07a368f2cdb1 | 93 | bool _Anneal_Stop; |
thomasmorris | 23:07a368f2cdb1 | 94 | bool _Test_Stop; |
thomasmorris | 23:07a368f2cdb1 | 95 | |
thomasmorris | 25:9751619fa030 | 96 | int _Select; |
thomasmorris | 16:9f98ec0ededb | 97 | int _Turns_Done; |
thomasmorris | 16:9f98ec0ededb | 98 | int _Turns_Todo; |
thomasmorris | 16:9f98ec0ededb | 99 | int _Loop; |
thomasmorris | 25:9751619fa030 | 100 | int _On_Time; |
thomasmorris | 25:9751619fa030 | 101 | int _Off_Time;//IN SECONDS |
thomasmorris | 16:9f98ec0ededb | 102 | int _Duty_Cycle; |
thomasmorris | 16:9f98ec0ededb | 103 | int _Power_Time; |
thomasmorris | 16:9f98ec0ededb | 104 | |
thomasmorris | 23:07a368f2cdb1 | 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 | 16:9f98ec0ededb | 128 | }; |
thomasmorris | 16:9f98ec0ededb | 129 | #endif//INTERFACE_HPP |