Testing 1 blue pill

Dependencies:   mbed mbed-rtos TextLCD

Committer:
thomasmorris
Date:
Mon Feb 18 22:04:54 2019 +0000
Revision:
25:9751619fa030
Parent:
24:728de4bf961e
Child:
26:83550fc299aa
GET IN THE BIN

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 25:9751619fa030 3
thomasmorris 13:c681f340909b 4 #include "stdio.h"
thomasmorris 13:c681f340909b 5 #include "string.h"
thomasmorris 13:c681f340909b 6 #include "mbed.h"
thomasmorris 13:c681f340909b 7 #include "rtos.h"
thomasmorris 13:c681f340909b 8 #include "TextLCD.h"
thomasmorris 13:c681f340909b 9 #include "iostream"
thomasmorris 12:d9c133b360b0 10 #include "rtos.h"
thomasmorris 16:9f98ec0ededb 11 #include "STEPPER_MOTOR.hpp"
thomasmorris 16:9f98ec0ededb 12 #include "Interface.hpp"
thomasmorris 23:07a368f2cdb1 13
thomasmorris 25:9751619fa030 14 #define Debounce_Time 50
thomasmorris 25:9751619fa030 15 INTERFACE INTERFACE;
thomasmorris 17:68b3fdabe4c5 16 //If the code compiles GET IN THE BIN
thomasmorris 25:9751619fa030 17
thomasmorris 16:9f98ec0ededb 18
thomasmorris 13:c681f340909b 19 //Digital Outputs
thomasmorris 13:c681f340909b 20 DigitalOut led1(LED1);
thomasmorris 13:c681f340909b 21 DigitalOut led2(LED2);
thomasmorris 21:6d9f6a986647 22
thomasmorris 25:9751619fa030 23
thomasmorris 25:9751619fa030 24 //Function forward declarations
thomasmorris 14:63998be3d43c 25 void up_thread_function();
thomasmorris 14:63998be3d43c 26 void down_thread_function();
thomasmorris 14:63998be3d43c 27 void start_thread_function();
thomasmorris 14:63998be3d43c 28 void function_thread_function();
thomasmorris 14:63998be3d43c 29 void select_thread_function();
thomasmorris 14:63998be3d43c 30
thomasmorris 13:c681f340909b 31 //Thread Setups
thomasmorris 13:c681f340909b 32 Thread lcd_thread;
thomasmorris 13:c681f340909b 33 Thread led_thread;
thomasmorris 14:63998be3d43c 34 Thread up_thread;
thomasmorris 14:63998be3d43c 35 Thread down_thread;
thomasmorris 14:63998be3d43c 36 Thread start_stop_thread;
thomasmorris 14:63998be3d43c 37 Thread function_thread;
thomasmorris 14:63998be3d43c 38 Thread select_thread;
thomasmorris 17:68b3fdabe4c5 39 //LCD pin connections
thomasmorris 17:68b3fdabe4c5 40 TextLCD lcd(D0,D1,D4,D5,D6,D7); // rs, e, d4-d7
thomasmorris 14:63998be3d43c 41
thomasmorris 17:68b3fdabe4c5 42 //Serial Terminal setup for debugging
thomasmorris 13:c681f340909b 43 Serial pc(USBTX, USBRX); //Define serial namespace so the serial comms can be printed to
thomasmorris 23:07a368f2cdb1 44
thomasmorris 17:68b3fdabe4c5 45 #endif
thomasmorris 13:c681f340909b 46
thomasmorris 17:68b3fdabe4c5 47 //Useful information
thomasmorris 17:68b3fdabe4c5 48 /*
thomasmorris 17:68b3fdabe4c5 49 Function 0 = Turn
thomasmorris 17:68b3fdabe4c5 50 Function 1 = Anneal
thomasmorris 17:68b3fdabe4c5 51 Function 2 = Test
thomasmorris 17:68b3fdabe4c5 52
thomasmorris 17:68b3fdabe4c5 53 Black :Reset : HardWired
thomasmorris 17:68b3fdabe4c5 54 Red :Up : D8
thomasmorris 17:68b3fdabe4c5 55 Orange:Down : A1
thomasmorris 17:68b3fdabe4c5 56 Brown :Start/Stop: D9
thomasmorris 17:68b3fdabe4c5 57 Green :Select : A3
thomasmorris 17:68b3fdabe4c5 58 Yellow:Function : A4
thomasmorris 17:68b3fdabe4c5 59
thomasmorris 22:fc2186b610b5 60
thomasmorris 22:fc2186b610b5 61 //Led Outputs //check the pin outs.
thomasmorris 22:fc2186b610b5 62 static DigitalOut Led_Select_Left(D2);
thomasmorris 22:fc2186b610b5 63 static DigitalOut Led_Select_Right(D3);
thomasmorris 22:fc2186b610b5 64 static DigitalOut Led_Power(A3);
thomasmorris 22:fc2186b610b5 65
thomasmorris 22:fc2186b610b5 66 TextLCD lcd(D0,D1,D4,D5,D6,D7); // rs, e, d4-d7
thomasmorris 25:9751619fa030 67 TendonPower (PWM) pin is PE_8 one below d0
thomasmorris 17:68b3fdabe4c5 68 STEPPER_MOTOR STEPPER_MOTOR_1(D15,D14,D13,D12) this is defined in interface.hpp
thomasmorris 17:68b3fdabe4c5 69 */
thomasmorris 17:68b3fdabe4c5 70