Testing 1 blue pill

Dependencies:   mbed mbed-rtos TextLCD

Committer:
thomasmorris
Date:
Sat Feb 16 15:19:21 2019 +0000
Revision:
23:07a368f2cdb1
Parent:
22:fc2186b610b5
Child:
25:9751619fa030
Mutexed;

Who changed what in which revision?

UserRevisionLine numberNew 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 23:07a368f2cdb1 6 //Led Outputs //check the pin outs
thomasmorris 22:fc2186b610b5 7 static DigitalOut Led_Select_Left(D2);
thomasmorris 22:fc2186b610b5 8 static DigitalOut Led_Select_Right(D3);
thomasmorris 22:fc2186b610b5 9 static DigitalOut Led_Power(A2);
thomasmorris 16:9f98ec0ededb 10 static STEPPER_MOTOR STEPPER_MOTOR_1(D15,D14,D13,D12);
thomasmorris 23:07a368f2cdb1 11 static PwmOut Tendon_Power(PE_8);
thomasmorris 16:9f98ec0ededb 12
thomasmorris 17:68b3fdabe4c5 13
thomasmorris 23:07a368f2cdb1 14 class INTERFACE//This creates a class called Led
thomasmorris 16:9f98ec0ededb 15 {
thomasmorris 16:9f98ec0ededb 16 public:
thomasmorris 16:9f98ec0ededb 17 //Public member variables
thomasmorris 16:9f98ec0ededb 18
thomasmorris 16:9f98ec0ededb 19 //Public Member Functions
thomasmorris 17:68b3fdabe4c5 20 INTERFACE(int Default_Turns); //Constructor
thomasmorris 17:68b3fdabe4c5 21 ~INTERFACE();//Destructor
thomasmorris 16:9f98ec0ededb 22
thomasmorris 17:68b3fdabe4c5 23 void Interface_Init();//Set all values to 0
thomasmorris 17:68b3fdabe4c5 24 void Up();//Up Routine
thomasmorris 17:68b3fdabe4c5 25 void Down();//Down Routine
thomasmorris 17:68b3fdabe4c5 26 void Start_Stop();//Start / Stop Routine
thomasmorris 17:68b3fdabe4c5 27 void Function();//Function Routine
thomasmorris 17:68b3fdabe4c5 28 void Select();//Select Routine
thomasmorris 17:68b3fdabe4c5 29 void Interface_main();//Main Routine
thomasmorris 16:9f98ec0ededb 30
thomasmorris 17:68b3fdabe4c5 31 //Setters to assign data to the private memeber variables
thomasmorris 23:07a368f2cdb1 32 void Set_System_Running(int System_Running);
thomasmorris 16:9f98ec0ededb 33 void Set_Function(int Function);
thomasmorris 16:9f98ec0ededb 34 void Set_Twist_Go(bool Twist_Go);
thomasmorris 16:9f98ec0ededb 35 void Set_Anneal_Go(bool Anneal_Go);
thomasmorris 16:9f98ec0ededb 36 void Set_Test_Go(bool Test_Go);
thomasmorris 23:07a368f2cdb1 37 void Set_Twist_Stop(bool Twist_Stop);
thomasmorris 23:07a368f2cdb1 38 void Set_Anneal_Stop(bool Anneal_Stop);
thomasmorris 23:07a368f2cdb1 39 void Set_Test_Stop(bool Test_Stop);
thomasmorris 16:9f98ec0ededb 40 void Set_Select(bool Select);
thomasmorris 16:9f98ec0ededb 41 void Set_Turns_Done(int Turns_Done);
thomasmorris 16:9f98ec0ededb 42 void Set_Turns_To_Do(int Turns_To_Do);
thomasmorris 16:9f98ec0ededb 43 void Set_Loop(int Loop);
thomasmorris 16:9f98ec0ededb 44 void Set_Wait_Time(int Wait_Time);
thomasmorris 16:9f98ec0ededb 45 void Set_Duty_Cycle(int Duty_Cycle);
thomasmorris 16:9f98ec0ededb 46 void Set_Power_Time(float Power_Time);
thomasmorris 16:9f98ec0ededb 47
thomasmorris 17:68b3fdabe4c5 48 //Getters to receive private information
thomasmorris 23:07a368f2cdb1 49 int Get_System_Running();
thomasmorris 16:9f98ec0ededb 50 int Get_Function();
thomasmorris 16:9f98ec0ededb 51 bool Get_Twist_Go();
thomasmorris 16:9f98ec0ededb 52 bool Get_Anneal_Go();
thomasmorris 16:9f98ec0ededb 53 bool Get_Test_Go();
thomasmorris 23:07a368f2cdb1 54 bool Get_Twist_Stop();
thomasmorris 23:07a368f2cdb1 55 bool Get_Anneal_Stop();
thomasmorris 23:07a368f2cdb1 56 bool Get_Test_Stop();
thomasmorris 16:9f98ec0ededb 57 bool Get_Select();
thomasmorris 16:9f98ec0ededb 58 int Get_Turns_Done();
thomasmorris 16:9f98ec0ededb 59 int Get_Turns_To_Do();
thomasmorris 16:9f98ec0ededb 60 int Get_Loop();
thomasmorris 16:9f98ec0ededb 61 int Get_Wait_Time();
thomasmorris 16:9f98ec0ededb 62 int Get_Duty_Cycle();
thomasmorris 16:9f98ec0ededb 63 int Get_Power_Time();
thomasmorris 16:9f98ec0ededb 64
thomasmorris 16:9f98ec0ededb 65 private:
thomasmorris 16:9f98ec0ededb 66 //Private member variables to prevent them being accessed externally
thomasmorris 23:07a368f2cdb1 67 int _System_Running;
thomasmorris 16:9f98ec0ededb 68 int _No_Of_Rotations;
thomasmorris 16:9f98ec0ededb 69 int _Function;
thomasmorris 23:07a368f2cdb1 70
thomasmorris 23:07a368f2cdb1 71 //Start
thomasmorris 16:9f98ec0ededb 72 bool _Twist_Go;
thomasmorris 16:9f98ec0ededb 73 bool _Anneal_Go;
thomasmorris 16:9f98ec0ededb 74 bool _Test_Go;
thomasmorris 23:07a368f2cdb1 75
thomasmorris 23:07a368f2cdb1 76 //Stop
thomasmorris 23:07a368f2cdb1 77 bool _Twist_Stop;
thomasmorris 23:07a368f2cdb1 78 bool _Anneal_Stop;
thomasmorris 23:07a368f2cdb1 79 bool _Test_Stop;
thomasmorris 23:07a368f2cdb1 80
thomasmorris 16:9f98ec0ededb 81 bool _Select;
thomasmorris 16:9f98ec0ededb 82 int _Turns_Done;
thomasmorris 16:9f98ec0ededb 83 int _Turns_Todo;
thomasmorris 16:9f98ec0ededb 84 int _Loop;
thomasmorris 16:9f98ec0ededb 85 int _Wait_Time;//IN SECONDS
thomasmorris 16:9f98ec0ededb 86 int _Duty_Cycle;
thomasmorris 16:9f98ec0ededb 87 int _Power_Time;
thomasmorris 16:9f98ec0ededb 88
thomasmorris 23:07a368f2cdb1 89
thomasmorris 23:07a368f2cdb1 90 //Mutex Locks
thomasmorris 23:07a368f2cdb1 91 Mutex _System_Running_mutex;
thomasmorris 23:07a368f2cdb1 92 Mutex _No_Of_Rotations_mutex;
thomasmorris 23:07a368f2cdb1 93 Mutex _Function_mutex;
thomasmorris 23:07a368f2cdb1 94 Mutex _Twist_Go_mutex;
thomasmorris 23:07a368f2cdb1 95 Mutex _Anneal_Go_mutex;
thomasmorris 23:07a368f2cdb1 96 Mutex _Test_Go_mutex;
thomasmorris 23:07a368f2cdb1 97 Mutex _Twist_Stop_mutex;
thomasmorris 23:07a368f2cdb1 98 Mutex _Anneal_Stop_mutex;
thomasmorris 23:07a368f2cdb1 99 Mutex _Test_Stop_mutex;
thomasmorris 23:07a368f2cdb1 100 Mutex _Select_mutex;
thomasmorris 23:07a368f2cdb1 101 Mutex _Turns_Done_mutex;
thomasmorris 23:07a368f2cdb1 102 Mutex _Turns_Todo_mutex;
thomasmorris 23:07a368f2cdb1 103 Mutex _Loop_mutex;
thomasmorris 23:07a368f2cdb1 104 Mutex _Wait_Time_mutex;//IN SECONDS
thomasmorris 23:07a368f2cdb1 105 Mutex _Duty_Cycle_mutex;
thomasmorris 23:07a368f2cdb1 106 Mutex _Power_Time_mutex;
thomasmorris 23:07a368f2cdb1 107 Mutex _Tendon_mutex;
thomasmorris 23:07a368f2cdb1 108 Mutex Led_Select_Left_mutex;
thomasmorris 23:07a368f2cdb1 109 Mutex Led_Select_Right_mutex;
thomasmorris 23:07a368f2cdb1 110 Mutex Led_Power_mutex;
thomasmorris 16:9f98ec0ededb 111 };
thomasmorris 16:9f98ec0ededb 112 #endif//INTERFACE_HPP