Testing 1 blue pill
Dependencies: mbed mbed-rtos TextLCD
SETUP.hpp@24:728de4bf961e, 2019-02-18 (annotated)
- Committer:
- thomasmorris
- Date:
- Mon Feb 18 12:02:34 2019 +0000
- Revision:
- 24:728de4bf961e
- Parent:
- 23:07a368f2cdb1
- Child:
- 25:9751619fa030
Working Code(start + stop)
Who changed what in which revision?
User | Revision | Line number | New 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 | 23:07a368f2cdb1 | 12 | |
thomasmorris | 24:728de4bf961e | 13 | #define Debounce_Time 200 |
thomasmorris | 23:07a368f2cdb1 | 14 | INTERFACE INTERFACE(20); |
thomasmorris | 17:68b3fdabe4c5 | 15 | //If the code compiles GET IN THE BIN |
thomasmorris | 17:68b3fdabe4c5 | 16 | //Interrupt In for the button control to the interface |
thomasmorris | 16:9f98ec0ededb | 17 | InterruptIn button_up(D8); //D8//Increment Button |
thomasmorris | 16:9f98ec0ededb | 18 | InterruptIn button_down(A1); //A1//Decrement Button |
thomasmorris | 16:9f98ec0ededb | 19 | InterruptIn button_start(D9); //D9//START / STOP BUTTON |
thomasmorris | 16:9f98ec0ededb | 20 | InterruptIn button_funct(A3); //A3//Function Button |
thomasmorris | 16:9f98ec0ededb | 21 | InterruptIn button_select(A4);//A4//Select Button |
thomasmorris | 16:9f98ec0ededb | 22 | |
thomasmorris | 13:c681f340909b | 23 | //Digital Outputs |
thomasmorris | 13:c681f340909b | 24 | DigitalOut led1(LED1); |
thomasmorris | 13:c681f340909b | 25 | DigitalOut led2(LED2); |
thomasmorris | 21:6d9f6a986647 | 26 | |
thomasmorris | 14:63998be3d43c | 27 | void up_thread_function(); |
thomasmorris | 14:63998be3d43c | 28 | void down_thread_function(); |
thomasmorris | 14:63998be3d43c | 29 | void start_thread_function(); |
thomasmorris | 14:63998be3d43c | 30 | void function_thread_function(); |
thomasmorris | 14:63998be3d43c | 31 | void select_thread_function(); |
thomasmorris | 14:63998be3d43c | 32 | |
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 | 17:68b3fdabe4c5 | 41 | //LCD pin connections |
thomasmorris | 17:68b3fdabe4c5 | 42 | TextLCD lcd(D0,D1,D4,D5,D6,D7); // rs, e, d4-d7 |
thomasmorris | 14:63998be3d43c | 43 | |
thomasmorris | 17:68b3fdabe4c5 | 44 | //Serial Terminal setup for debugging |
thomasmorris | 13:c681f340909b | 45 | Serial pc(USBTX, USBRX); //Define serial namespace so the serial comms can be printed to |
thomasmorris | 23:07a368f2cdb1 | 46 | |
thomasmorris | 17:68b3fdabe4c5 | 47 | #endif |
thomasmorris | 13:c681f340909b | 48 | |
thomasmorris | 17:68b3fdabe4c5 | 49 | //Useful information |
thomasmorris | 17:68b3fdabe4c5 | 50 | /* |
thomasmorris | 17:68b3fdabe4c5 | 51 | Function 0 = Turn |
thomasmorris | 17:68b3fdabe4c5 | 52 | Function 1 = Anneal |
thomasmorris | 17:68b3fdabe4c5 | 53 | Function 2 = Test |
thomasmorris | 17:68b3fdabe4c5 | 54 | |
thomasmorris | 17:68b3fdabe4c5 | 55 | Black :Reset : HardWired |
thomasmorris | 17:68b3fdabe4c5 | 56 | Red :Up : D8 |
thomasmorris | 17:68b3fdabe4c5 | 57 | Orange:Down : A1 |
thomasmorris | 17:68b3fdabe4c5 | 58 | Brown :Start/Stop: D9 |
thomasmorris | 17:68b3fdabe4c5 | 59 | Green :Select : A3 |
thomasmorris | 17:68b3fdabe4c5 | 60 | Yellow:Function : A4 |
thomasmorris | 17:68b3fdabe4c5 | 61 | |
thomasmorris | 22:fc2186b610b5 | 62 | |
thomasmorris | 22:fc2186b610b5 | 63 | //Led Outputs //check the pin outs. |
thomasmorris | 22:fc2186b610b5 | 64 | static DigitalOut Led_Select_Left(D2); |
thomasmorris | 22:fc2186b610b5 | 65 | static DigitalOut Led_Select_Right(D3); |
thomasmorris | 22:fc2186b610b5 | 66 | static DigitalOut Led_Power(A3); |
thomasmorris | 22:fc2186b610b5 | 67 | |
thomasmorris | 22:fc2186b610b5 | 68 | TextLCD lcd(D0,D1,D4,D5,D6,D7); // rs, e, d4-d7 |
thomasmorris | 17:68b3fdabe4c5 | 69 | TendonPower (PWM) pin is PE_8 |
thomasmorris | 17:68b3fdabe4c5 | 70 | STEPPER_MOTOR STEPPER_MOTOR_1(D15,D14,D13,D12) this is defined in interface.hpp |
thomasmorris | 17:68b3fdabe4c5 | 71 | */ |
thomasmorris | 17:68b3fdabe4c5 | 72 |