Testing 1 blue pill

Dependencies:   mbed mbed-rtos TextLCD

Committer:
thomasmorris
Date:
Tue Feb 12 10:03:05 2019 +0000
Revision:
17:68b3fdabe4c5
Parent:
16:9f98ec0ededb
Child:
21:6d9f6a986647
Working Code;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thomasmorris 12:d9c133b360b0 1 #ifndef SETUP_HPP//Header Guards Prevents Multiple includes
thomasmorris 12:d9c133b360b0 2 #define SETUP_HPP
thomasmorris 13:c681f340909b 3 #include "stdio.h"
thomasmorris 13:c681f340909b 4 #include "string.h"
thomasmorris 13:c681f340909b 5 #include "mbed.h"
thomasmorris 13:c681f340909b 6 #include "rtos.h"
thomasmorris 13:c681f340909b 7 #include "TextLCD.h"
thomasmorris 13:c681f340909b 8 #include "iostream"
thomasmorris 12:d9c133b360b0 9 #include "rtos.h"
thomasmorris 16:9f98ec0ededb 10 #include "STEPPER_MOTOR.hpp"
thomasmorris 16:9f98ec0ededb 11 #include "Interface.hpp"
thomasmorris 17:68b3fdabe4c5 12 //If the code compiles GET IN THE BIN
thomasmorris 17:68b3fdabe4c5 13 //Interrupt In for the button control to the interface
thomasmorris 16:9f98ec0ededb 14 InterruptIn button_up(D8); //D8//Increment Button
thomasmorris 16:9f98ec0ededb 15 InterruptIn button_down(A1); //A1//Decrement Button
thomasmorris 16:9f98ec0ededb 16 InterruptIn button_start(D9); //D9//START / STOP BUTTON
thomasmorris 16:9f98ec0ededb 17 InterruptIn button_funct(A3); //A3//Function Button
thomasmorris 16:9f98ec0ededb 18 InterruptIn button_select(A4);//A4//Select Button
thomasmorris 16:9f98ec0ededb 19
thomasmorris 13:c681f340909b 20 //Digital Outputs
thomasmorris 13:c681f340909b 21 DigitalOut led1(LED1);
thomasmorris 13:c681f340909b 22 DigitalOut led2(LED2);
thomasmorris 14:63998be3d43c 23 void up_thread_function();
thomasmorris 14:63998be3d43c 24 void down_thread_function();
thomasmorris 14:63998be3d43c 25 void start_thread_function();
thomasmorris 14:63998be3d43c 26 void function_thread_function();
thomasmorris 14:63998be3d43c 27 void select_thread_function();
thomasmorris 14:63998be3d43c 28
thomasmorris 13:c681f340909b 29 //Thread Setups
thomasmorris 13:c681f340909b 30 Thread lcd_thread;
thomasmorris 13:c681f340909b 31 Thread led_thread;
thomasmorris 14:63998be3d43c 32 Thread up_thread;
thomasmorris 14:63998be3d43c 33 Thread down_thread;
thomasmorris 14:63998be3d43c 34 Thread start_stop_thread;
thomasmorris 14:63998be3d43c 35 Thread function_thread;
thomasmorris 14:63998be3d43c 36 Thread select_thread;
thomasmorris 17:68b3fdabe4c5 37 //LCD pin connections
thomasmorris 17:68b3fdabe4c5 38 TextLCD lcd(D0,D1,D4,D5,D6,D7); // rs, e, d4-d7
thomasmorris 14:63998be3d43c 39
thomasmorris 17:68b3fdabe4c5 40 //Serial Terminal setup for debugging
thomasmorris 13:c681f340909b 41 Serial pc(USBTX, USBRX); //Define serial namespace so the serial comms can be printed to
thomasmorris 17:68b3fdabe4c5 42 #endif
thomasmorris 13:c681f340909b 43
thomasmorris 17:68b3fdabe4c5 44 //Useful information
thomasmorris 17:68b3fdabe4c5 45 /*
thomasmorris 17:68b3fdabe4c5 46 Function 0 = Turn
thomasmorris 17:68b3fdabe4c5 47 Function 1 = Anneal
thomasmorris 17:68b3fdabe4c5 48 Function 2 = Test
thomasmorris 17:68b3fdabe4c5 49
thomasmorris 17:68b3fdabe4c5 50 Black :Reset : HardWired
thomasmorris 17:68b3fdabe4c5 51 Red :Up : D8
thomasmorris 17:68b3fdabe4c5 52 Orange:Down : A1
thomasmorris 17:68b3fdabe4c5 53 Brown :Start/Stop: D9
thomasmorris 17:68b3fdabe4c5 54 Green :Select : A3
thomasmorris 17:68b3fdabe4c5 55 Yellow:Function : A4
thomasmorris 17:68b3fdabe4c5 56
thomasmorris 17:68b3fdabe4c5 57 TendonPower (PWM) pin is PE_8
thomasmorris 17:68b3fdabe4c5 58 STEPPER_MOTOR STEPPER_MOTOR_1(D15,D14,D13,D12) this is defined in interface.hpp
thomasmorris 17:68b3fdabe4c5 59 */
thomasmorris 17:68b3fdabe4c5 60