Working Start + stop code
Dependencies: mbed mbed-rtos TextLCD
Interface.hpp
00001 #ifndef INTERFACE_HPP//Header Guards Prevents Multiple includes 00002 #define INTERFACE_HPP 00003 00004 #include "mbed.h" 00005 #include "STEPPER_MOTOR.hpp" //Include this to use the stepper motor 00006 00007 #define Type_of_Rig 3 //Place 2 for coiling place 3 for twisting 00008 #define Default_Coiling_Turns 20 00009 #define Default_Twisting_Turns 70 00010 00011 //Digital In for the button control to the interface 00012 static DigitalIn button_up(D8); //D8//Increment Button 00013 static DigitalIn button_down(A1); //A1//Decrement Button 00014 static DigitalIn button_start(D9); //D9//START / STOP BUTTON 00015 static DigitalIn button_function(A3); //A3//Function Button 00016 static DigitalIn button_select(A4);//A4//Select Button 00017 00018 00019 //Led Outputs //check the pin outs 00020 static DigitalOut Led_Select_Left(D3); 00021 static DigitalOut Led_Select_Right(D2); 00022 static DigitalOut Led_Power(A2); 00023 static STEPPER_MOTOR STEPPER_MOTOR_1(D15,D14,D13,D12); 00024 static PwmOut Tendon_Power(PE_8); 00025 00026 00027 class INTERFACE//This creates a class called Led 00028 { 00029 public: 00030 //Public member variables 00031 00032 //Public Member Functions 00033 INTERFACE(); //Constructor 00034 ~INTERFACE();//Destructor 00035 00036 void Interface_Init();//Set all values to 0 00037 void Up();//Up Routine 00038 void Down();//Down Routine 00039 void Start_Stop();//Start / Stop Routine 00040 void Function();//Function Routine 00041 void Select();//Select Routine 00042 void Interface_main();//Main Routine 00043 00044 //Setters to assign data to the private memeber variables 00045 void Set_System_Running(int System_Running); 00046 void Set_Function(int Function); 00047 void Set_Twist_Go(bool Twist_Go); 00048 void Set_Anneal_Go(bool Anneal_Go); 00049 void Set_Test_Go(bool Test_Go); 00050 void Set_Twist_Stop(bool Twist_Stop); 00051 void Set_Anneal_Stop(bool Anneal_Stop); 00052 void Set_Test_Stop(bool Test_Stop); 00053 void Set_Select(int Select); 00054 void Set_Turns_Done(int Turns_Done); 00055 void Set_Turns_To_Do(int Turns_To_Do); 00056 void Set_Loop(int Loop); 00057 void Set_On_Time(int On_Time); 00058 void Set_Off_Time(int Off_Time); 00059 void Set_Duty_Cycle(int Duty_Cycle); 00060 void Set_Power_Time(float Power_Time); 00061 00062 //Getters to receive private information 00063 int Get_System_Running(); 00064 int Get_Function(); 00065 bool Get_Twist_Go(); 00066 bool Get_Anneal_Go(); 00067 bool Get_Test_Go(); 00068 bool Get_Twist_Stop(); 00069 bool Get_Anneal_Stop(); 00070 bool Get_Test_Stop(); 00071 int Get_Select(); 00072 int Get_Turns_Done(); 00073 int Get_Turns_To_Do(); 00074 int Get_Loop(); 00075 int Get_On_Time(); 00076 int Get_Off_Time(); 00077 int Get_Duty_Cycle(); 00078 int Get_Power_Time(); 00079 00080 private: 00081 //Private member variables to prevent them being accessed externally 00082 int _System_Running; 00083 int _No_Of_Rotations; 00084 int _Function; 00085 00086 //Start 00087 bool _Twist_Go; 00088 bool _Anneal_Go; 00089 bool _Test_Go; 00090 00091 //Stop 00092 bool _Twist_Stop; 00093 bool _Anneal_Stop; 00094 bool _Test_Stop; 00095 00096 int _Select; 00097 int _Turns_Done; 00098 int _Turns_Todo; 00099 int _Loop; 00100 int _On_Time; 00101 int _Off_Time;//IN SECONDS 00102 int _Duty_Cycle; 00103 int _Power_Time; 00104 00105 00106 //Mutex Locks 00107 Mutex _System_Running_mutex; 00108 Mutex _No_Of_Rotations_mutex; 00109 Mutex _Function_mutex; 00110 Mutex _Twist_Go_mutex; 00111 Mutex _Anneal_Go_mutex; 00112 Mutex _Test_Go_mutex; 00113 Mutex _Twist_Stop_mutex; 00114 Mutex _Anneal_Stop_mutex; 00115 Mutex _Test_Stop_mutex; 00116 Mutex _Select_mutex; 00117 Mutex _Turns_Done_mutex; 00118 Mutex _Turns_Todo_mutex; 00119 Mutex _Loop_mutex; 00120 Mutex _On_Time_mutex;//IN SECONDS 00121 Mutex _Off_Time_mutex; 00122 Mutex _Duty_Cycle_mutex; 00123 Mutex _Power_Time_mutex; 00124 Mutex _Tendon_mutex; 00125 Mutex Led_Select_Left_mutex; 00126 Mutex Led_Select_Right_mutex; 00127 Mutex Led_Power_mutex; 00128 }; 00129 #endif//INTERFACE_HPP
Generated on Wed Jul 13 2022 20:03:02 by
1.7.2