Testing 1 blue pill

Dependencies:   mbed mbed-rtos TextLCD

Committer:
thomasmorris
Date:
Mon Feb 11 16:58:07 2019 +0000
Revision:
14:63998be3d43c
Parent:
13:c681f340909b
Child:
16:9f98ec0ededb
Working stepper needs fixing more;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thomasmorris 12:d9c133b360b0 1 /*
thomasmorris 12:d9c133b360b0 2 Setup file for the main
thomasmorris 12:d9c133b360b0 3 */
thomasmorris 12:d9c133b360b0 4
thomasmorris 12:d9c133b360b0 5 #ifndef SETUP_HPP//Header Guards Prevents Multiple includes
thomasmorris 12:d9c133b360b0 6 #define SETUP_HPP
thomasmorris 13:c681f340909b 7 #include "stdio.h"
thomasmorris 13:c681f340909b 8 #include "string.h"
thomasmorris 13:c681f340909b 9 #include "mbed.h"
thomasmorris 13:c681f340909b 10 #include "rtos.h"
thomasmorris 13:c681f340909b 11 #include "TextLCD.h"
thomasmorris 13:c681f340909b 12 #include "iostream"
thomasmorris 12:d9c133b360b0 13 //Libraries and header includes
thomasmorris 12:d9c133b360b0 14 #include "rtos.h"
thomasmorris 12:d9c133b360b0 15
thomasmorris 12:d9c133b360b0 16 #include "STEPPER_MOTOR.hpp"
thomasmorris 13:c681f340909b 17 //Digital Outputs
thomasmorris 13:c681f340909b 18 DigitalOut led1(LED1);
thomasmorris 13:c681f340909b 19 DigitalOut led2(LED2);
thomasmorris 12:d9c133b360b0 20
thomasmorris 14:63998be3d43c 21 void up_thread_function();
thomasmorris 14:63998be3d43c 22 void down_thread_function();
thomasmorris 14:63998be3d43c 23 void start_thread_function();
thomasmorris 14:63998be3d43c 24 void function_thread_function();
thomasmorris 14:63998be3d43c 25 void select_thread_function();
thomasmorris 14:63998be3d43c 26
thomasmorris 14:63998be3d43c 27
thomasmorris 14:63998be3d43c 28 InterruptIn button_up(D8);
thomasmorris 14:63998be3d43c 29 InterruptIn button_down(A1); // These setup the button interupts
thomasmorris 14:63998be3d43c 30 InterruptIn button_start(D9); // START / STOP BUTTON
thomasmorris 14:63998be3d43c 31 InterruptIn button_funct(A3);// Random pin CHANGE FOR FUNCTION BUTTON
thomasmorris 14:63998be3d43c 32 InterruptIn button_select(A4);// Random pin CHANGE FOR SELECT BUTTON
thomasmorris 13:c681f340909b 33 //Thread Setups
thomasmorris 13:c681f340909b 34 Thread lcd_thread;
thomasmorris 13:c681f340909b 35 Thread led_thread;
thomasmorris 14:63998be3d43c 36 Thread up_thread;
thomasmorris 14:63998be3d43c 37 Thread down_thread;
thomasmorris 14:63998be3d43c 38 Thread start_stop_thread;
thomasmorris 14:63998be3d43c 39 Thread function_thread;
thomasmorris 14:63998be3d43c 40 Thread select_thread;
thomasmorris 14:63998be3d43c 41
thomasmorris 13:c681f340909b 42 TextLCD lcd(D0,D1,D4,D5,D6,D7); // rs, e, d4-d7
thomasmorris 13:c681f340909b 43 Serial pc(USBTX, USBRX); //Define serial namespace so the serial comms can be printed to
thomasmorris 13:c681f340909b 44
thomasmorris 13:c681f340909b 45 PwmOut Tendon_Power(PE_8);
thomasmorris 13:c681f340909b 46
thomasmorris 13:c681f340909b 47 //VARIABLE DEFINITIONS
thomasmorris 13:c681f340909b 48 int No_Of_Rotations;
thomasmorris 13:c681f340909b 49 int Function;
thomasmorris 13:c681f340909b 50 bool Twist_Go;
thomasmorris 13:c681f340909b 51 bool Anneal_Go;
thomasmorris 13:c681f340909b 52 bool Test_Go;
thomasmorris 13:c681f340909b 53 bool Select;
thomasmorris 13:c681f340909b 54
thomasmorris 13:c681f340909b 55 int turns_done;
thomasmorris 13:c681f340909b 56 int turns_todo;
thomasmorris 13:c681f340909b 57 int Loop;
thomasmorris 13:c681f340909b 58 int Wait_Time;//IN SECONDS
thomasmorris 13:c681f340909b 59
thomasmorris 13:c681f340909b 60 int Duty_Cycle;
thomasmorris 13:c681f340909b 61 int Power_Time;
thomasmorris 13:c681f340909b 62
thomasmorris 12:d9c133b360b0 63
thomasmorris 12:d9c133b360b0 64 static STEPPER_MOTOR STEPPER_MOTOR_1(D15,D14,D13,D12);
thomasmorris 12:d9c133b360b0 65 #endif