Skeleton code. LCD, Serial, Feedback, MOSFETS
Dependencies: mbed mbed-rtos ShiftReg2 TextLCD
INTERFACE/Interface.cpp@4:020f93d35f6e, 2019-05-07 (annotated)
- Committer:
- thomasmorris
- Date:
- Tue May 07 21:55:57 2019 +0000
- Revision:
- 4:020f93d35f6e
Added mutex and safey coding needs more. Added board and serial functions that need testing. As well as a more thorough post function.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
thomasmorris | 4:020f93d35f6e | 1 | #include "Interface.hpp" |
thomasmorris | 4:020f93d35f6e | 2 | //Define the variables here |
thomasmorris | 4:020f93d35f6e | 3 | Serial PC(PB_10, PB_11); //TX, RX |
thomasmorris | 4:020f93d35f6e | 4 | Serial Board(PB_6, PB_7); //TX, RX |
thomasmorris | 4:020f93d35f6e | 5 | //TextLCD Lcd(PB_12, PB_13, PB_14, PB_15, PA_8, PA_9); // rs, e, d4-d7 |
thomasmorris | 4:020f93d35f6e | 6 | TextLCD Lcd(PB_12, PB_13, PB_14, PB_15, PA_8, PA_9); // rs, e, d4-d7 |
thomasmorris | 4:020f93d35f6e | 7 | DigitalOut On_board_led(PC_13);//Onborad LED needs no pass in parameter |
thomasmorris | 4:020f93d35f6e | 8 | |
thomasmorris | 4:020f93d35f6e | 9 | INTERFACE::INTERFACE(PinName N1, PinName N2, PinName N3, PinName N4,PinName N5, PinName N6, PinName N7, PinName N8,PinName N9, PinName N10, PinName N11): _Rotary_Encoder_A(N1),_Rotary_Encoder_B(N2),_Rotary_Encoder_Button(N3),_Button_1(N4), _Button_2(N5), _Button_3(N6), _MOSFET_Safety(N7), _Shift_SCLK(N8),_Shift_Latch(N9), _Shift_Enable(N10), _Shift_Data(N11) |
thomasmorris | 4:020f93d35f6e | 10 | { |
thomasmorris | 4:020f93d35f6e | 11 | |
thomasmorris | 4:020f93d35f6e | 12 | } |
thomasmorris | 4:020f93d35f6e | 13 | |
thomasmorris | 4:020f93d35f6e | 14 | INTERFACE::~INTERFACE(){} |
thomasmorris | 4:020f93d35f6e | 15 | void INTERFACE::Init(){} |
thomasmorris | 4:020f93d35f6e | 16 | int INTERFACE::Post() |
thomasmorris | 4:020f93d35f6e | 17 | { |
thomasmorris | 4:020f93d35f6e | 18 | return 1;//Success |
thomasmorris | 4:020f93d35f6e | 19 | } |
thomasmorris | 4:020f93d35f6e | 20 | void INTERFACE::On_board_LED_Flash() |
thomasmorris | 4:020f93d35f6e | 21 | { |
thomasmorris | 4:020f93d35f6e | 22 | while(1) |
thomasmorris | 4:020f93d35f6e | 23 | { |
thomasmorris | 4:020f93d35f6e | 24 | On_board_led = !On_board_led; |
thomasmorris | 4:020f93d35f6e | 25 | Thread::wait(1000); |
thomasmorris | 4:020f93d35f6e | 26 | } |
thomasmorris | 4:020f93d35f6e | 27 | } |
thomasmorris | 4:020f93d35f6e | 28 | void INTERFACE::Serial() |
thomasmorris | 4:020f93d35f6e | 29 | { |
thomasmorris | 4:020f93d35f6e | 30 | while(1) |
thomasmorris | 4:020f93d35f6e | 31 | { |
thomasmorris | 4:020f93d35f6e | 32 | PC.printf("Testing Serial\n"); |
thomasmorris | 4:020f93d35f6e | 33 | Thread::wait(1000); |
thomasmorris | 4:020f93d35f6e | 34 | } |
thomasmorris | 4:020f93d35f6e | 35 | } |
thomasmorris | 4:020f93d35f6e | 36 | void INTERFACE::LCD() |
thomasmorris | 4:020f93d35f6e | 37 | { |
thomasmorris | 4:020f93d35f6e | 38 | while(1) |
thomasmorris | 4:020f93d35f6e | 39 | { |
thomasmorris | 4:020f93d35f6e | 40 | Lcd.printf("Testing\nINTERFACE"); |
thomasmorris | 4:020f93d35f6e | 41 | Thread::wait(1000); |
thomasmorris | 4:020f93d35f6e | 42 | } |
thomasmorris | 4:020f93d35f6e | 43 | } |
thomasmorris | 4:020f93d35f6e | 44 |