Testing 1 blue pill

Dependencies:   mbed mbed-rtos TextLCD

Committer:
thomasmorris
Date:
Mon Feb 11 14:18:58 2019 +0000
Revision:
13:c681f340909b
Parent:
12:d9c133b360b0
Child:
14:63998be3d43c
Updated;

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 13:c681f340909b 21 //Thread Setups
thomasmorris 13:c681f340909b 22 Thread lcd_thread;
thomasmorris 13:c681f340909b 23 Thread led_thread;
thomasmorris 13:c681f340909b 24 TextLCD lcd(D0,D1,D4,D5,D6,D7); // rs, e, d4-d7
thomasmorris 13:c681f340909b 25 Serial pc(USBTX, USBRX); //Define serial namespace so the serial comms can be printed to
thomasmorris 13:c681f340909b 26
thomasmorris 13:c681f340909b 27
thomasmorris 13:c681f340909b 28 //Switch toggling to bools for readability
thomasmorris 13:c681f340909b 29 InterruptIn button_up(A0); // UP BUTTON
thomasmorris 13:c681f340909b 30 InterruptIn button_down(A1); // These setup the button interupts
thomasmorris 13:c681f340909b 31 InterruptIn button_start(A2); // START / STOP BUTTON
thomasmorris 13:c681f340909b 32 InterruptIn button_funct(A3);// Random pin CHANGE FOR FUNCTION BUTTON
thomasmorris 13:c681f340909b 33 InterruptIn button_select(A4);// Random pin CHANGE FOR SELECT BUTTON
thomasmorris 13:c681f340909b 34
thomasmorris 13:c681f340909b 35 PwmOut Tendon_Power(PE_8);
thomasmorris 13:c681f340909b 36
thomasmorris 13:c681f340909b 37 //VARIABLE DEFINITIONS
thomasmorris 13:c681f340909b 38 int No_Of_Rotations;
thomasmorris 13:c681f340909b 39 int Function;
thomasmorris 13:c681f340909b 40 bool Twist_Go;
thomasmorris 13:c681f340909b 41 bool Anneal_Go;
thomasmorris 13:c681f340909b 42 bool Test_Go;
thomasmorris 13:c681f340909b 43 bool Select;
thomasmorris 13:c681f340909b 44
thomasmorris 13:c681f340909b 45 int turns_done;
thomasmorris 13:c681f340909b 46 int turns_todo;
thomasmorris 13:c681f340909b 47 int Loop;
thomasmorris 13:c681f340909b 48 int Wait_Time;//IN SECONDS
thomasmorris 13:c681f340909b 49
thomasmorris 13:c681f340909b 50 int Duty_Cycle;
thomasmorris 13:c681f340909b 51 int Power_Time;
thomasmorris 13:c681f340909b 52
thomasmorris 12:d9c133b360b0 53
thomasmorris 12:d9c133b360b0 54 static STEPPER_MOTOR STEPPER_MOTOR_1(D15,D14,D13,D12);
thomasmorris 12:d9c133b360b0 55 #endif