Testing 1 blue pill

Dependencies:   mbed mbed-rtos TextLCD

Committer:
thomasmorris
Date:
Thu Feb 14 10:22:54 2019 +0000
Revision:
21:6d9f6a986647
Parent:
17:68b3fdabe4c5
Child:
22:fc2186b610b5
Debounce code added

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 21:6d9f6a986647 23
thomasmorris 14:63998be3d43c 24 void up_thread_function();
thomasmorris 14:63998be3d43c 25 void down_thread_function();
thomasmorris 14:63998be3d43c 26 void start_thread_function();
thomasmorris 14:63998be3d43c 27 void function_thread_function();
thomasmorris 14:63998be3d43c 28 void select_thread_function();
thomasmorris 14:63998be3d43c 29
thomasmorris 13:c681f340909b 30 //Thread Setups
thomasmorris 13:c681f340909b 31 Thread lcd_thread;
thomasmorris 13:c681f340909b 32 Thread led_thread;
thomasmorris 14:63998be3d43c 33 Thread up_thread;
thomasmorris 14:63998be3d43c 34 Thread down_thread;
thomasmorris 14:63998be3d43c 35 Thread start_stop_thread;
thomasmorris 14:63998be3d43c 36 Thread function_thread;
thomasmorris 14:63998be3d43c 37 Thread select_thread;
thomasmorris 17:68b3fdabe4c5 38 //LCD pin connections
thomasmorris 17:68b3fdabe4c5 39 TextLCD lcd(D0,D1,D4,D5,D6,D7); // rs, e, d4-d7
thomasmorris 14:63998be3d43c 40
thomasmorris 17:68b3fdabe4c5 41 //Serial Terminal setup for debugging
thomasmorris 13:c681f340909b 42 Serial pc(USBTX, USBRX); //Define serial namespace so the serial comms can be printed to
thomasmorris 17:68b3fdabe4c5 43 #endif
thomasmorris 13:c681f340909b 44
thomasmorris 17:68b3fdabe4c5 45 //Useful information
thomasmorris 17:68b3fdabe4c5 46 /*
thomasmorris 17:68b3fdabe4c5 47 Function 0 = Turn
thomasmorris 17:68b3fdabe4c5 48 Function 1 = Anneal
thomasmorris 17:68b3fdabe4c5 49 Function 2 = Test
thomasmorris 17:68b3fdabe4c5 50
thomasmorris 17:68b3fdabe4c5 51 Black :Reset : HardWired
thomasmorris 17:68b3fdabe4c5 52 Red :Up : D8
thomasmorris 17:68b3fdabe4c5 53 Orange:Down : A1
thomasmorris 17:68b3fdabe4c5 54 Brown :Start/Stop: D9
thomasmorris 17:68b3fdabe4c5 55 Green :Select : A3
thomasmorris 17:68b3fdabe4c5 56 Yellow:Function : A4
thomasmorris 17:68b3fdabe4c5 57
thomasmorris 17:68b3fdabe4c5 58 TendonPower (PWM) pin is PE_8
thomasmorris 17:68b3fdabe4c5 59 STEPPER_MOTOR STEPPER_MOTOR_1(D15,D14,D13,D12) this is defined in interface.hpp
thomasmorris 17:68b3fdabe4c5 60 */
thomasmorris 17:68b3fdabe4c5 61