Thomas Morris / Mbed 2 deprecated Stacy

Dependencies:   mbed mbed-rtos TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Interface.hpp Source File

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 
00008 //Digital In for the button control to the interface
00009 static DigitalIn button_up(D8);    //D8//Increment Button
00010 static DigitalIn button_down(A1);  //A1//Decrement Button
00011 static DigitalIn button_start(D9); //D9//START / STOP BUTTON
00012 static DigitalIn button_function(A3); //A3//Function Button
00013 static DigitalIn button_select(A4);//A4//Select Button
00014 
00015 
00016 //Led Outputs //check the pin outs
00017 static DigitalOut Led_Select_Left(D2);
00018 static DigitalOut Led_Select_Right(D3);
00019 static DigitalOut Led_Power(A0);
00020 static STEPPER_MOTOR STEPPER_MOTOR_1(D15,D14,D13,D12);
00021 
00022 class INTERFACE//This creates a class called Led
00023 { 
00024 public: 
00025     //Public member variables
00026 
00027     //Public Member Functions
00028     INTERFACE(); //Constructor
00029     ~INTERFACE();//Destructor
00030     
00031     void Interface_Init(int turns);//Set all values to 0 bar the passed in variable
00032     void Interface_Serial();
00033     void Up();//Up Routine
00034     void Down();//Down Routine
00035     void Start_Stop();//Start / Stop Routine
00036     void Function();//Function Routine
00037     void Select();//Select Routine
00038     void Interface_main();//Main Routine
00039 
00040     //Setters to assign data to the private memeber variables
00041     void Set_System_Running(int System_Running);
00042     void Set_Function(int Function);
00043     void Set_Twist_Go(bool Twist_Go);
00044     void Set_Anneal_Go(bool Anneal_Go);
00045     void Set_Test_Go(bool Test_Go);
00046     void Set_Run_Go(bool Run_Go);
00047     void Set_Twist_Stop(bool Twist_Stop);
00048     void Set_Anneal_Stop(bool Anneal_Stop);
00049     void Set_Test_Stop(bool Test_Stop);
00050     void Set_Run_Stop(bool Run_Stop);
00051     void Set_Select(int Select);
00052     void Set_Turns_Done(int Turns_Done);
00053     void Set_Turns_To_Do(int Turns_To_Do);
00054     void Set_Loop(int Loop);
00055     void Set_Loops_done(int Loops_done);
00056     void Set_On_Time(float On_Time);
00057     void Set_Run_Once_On_Time(float Run_Once_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     void Set_Direction(bool Direction);
00062     
00063     //Getters to receive private information
00064     int Get_System_Running();
00065     int Get_Function();
00066     bool Get_Twist_Go();
00067     bool Get_Anneal_Go();
00068     bool Get_Test_Go();
00069     bool Get_Run_Go();
00070     bool Get_Twist_Stop();
00071     bool Get_Anneal_Stop();
00072     bool Get_Test_Stop();
00073     bool Get_Run_Stop();
00074     int Get_Select();
00075     int Get_Turns_Done();
00076     int Get_Turns_To_Do();
00077     int Get_Loop();
00078     int Get_Loops_done();
00079     float Get_On_Time();
00080     float Get_Run_Once_On_Time();
00081     int Get_Off_Time();
00082     int Get_Duty_Cycle();
00083     int Get_Power_Time();
00084     bool Get_Direction();
00085 
00086 private:    
00087     //Private member variables to prevent them being accessed externally 
00088     int _System_Running;
00089     int _No_Of_Rotations;
00090     int _Function;
00091     
00092     //Start
00093     bool _Twist_Go;
00094     bool _Anneal_Go;
00095     bool _Test_Go;
00096     bool _Run_Go;
00097     
00098     //Stop
00099     bool _Twist_Stop;
00100     bool _Anneal_Stop;
00101     bool _Test_Stop;
00102     bool _Run_Stop;
00103         
00104     int _Select;
00105     int _Turns_Done;
00106     int _Turns_Todo;
00107     int _Loops_done;
00108     int _Loop;
00109     float _On_Time;
00110     float _Run_Once_On_Time;
00111     int _Off_Time;//IN SECONDS
00112     int _Duty_Cycle;
00113     int _Power_Time;
00114     bool _Direction;
00115 
00116     
00117     //Mutex Locks
00118     Mutex _System_Running_mutex;
00119     Mutex _No_Of_Rotations_mutex;
00120     Mutex _Function_mutex;
00121     Mutex _Twist_Go_mutex;
00122     Mutex _Anneal_Go_mutex;
00123     Mutex _Test_Go_mutex;
00124     Mutex _Run_Go_mutex;
00125     Mutex _Twist_Stop_mutex;
00126     Mutex _Anneal_Stop_mutex;
00127     Mutex _Test_Stop_mutex;
00128     Mutex _Run_Stop_mutex;
00129     Mutex _Select_mutex;
00130     Mutex _Turns_Done_mutex;
00131     Mutex _Turns_Todo_mutex;
00132     Mutex _Loop_mutex;
00133     Mutex _Loops_done_mutex;
00134     Mutex _On_Time_mutex;//IN SECONDS
00135     Mutex _Run_Once_On_Time_mutex;
00136     Mutex _Off_Time_mutex;
00137     Mutex _Duty_Cycle_mutex;
00138     Mutex _Power_Time_mutex;
00139     Mutex _Tendon_mutex;
00140     Mutex Led_Select_Left_mutex;
00141     Mutex Led_Select_Right_mutex;
00142     Mutex Led_Power_mutex;
00143     Mutex _Direction_mutex;
00144     Mutex _Type_of_Rig_mutex;
00145 };
00146 #endif//INTERFACE_HPP