![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Skeleton code. LCD, Serial, Feedback, MOSFETS
Dependencies: mbed mbed-rtos ShiftReg2 TextLCD
Diff: main.cpp
- Revision:
- 4:020f93d35f6e
- Parent:
- 3:5665939d31ca
--- a/main.cpp Tue May 07 14:05:31 2019 +0000 +++ b/main.cpp Tue May 07 21:55:57 2019 +0000 @@ -1,68 +1,19 @@ -#include "mbed.h" -#include "rtos.h" //Real Time Operating System. https://os.mbed.com/handbook/RTOS -#include "TextLCD.h" -#include "ShiftReg.h" - -//Pinouts for the bluepill can be found here -//https://os.mbed.com/users/hudakz/code/STM32F103C8T6_Hello/ +#include "Setup.hpp" -DigitalOut myled(PC_13); //Onboard LED -Serial PC(PB_10, PB_11); //TX, RX -//TextLCD LCD(PB_12, PB_13, PB_14, PB_15, PA_8, PA_9); // rs, e, d4-d7 -ShiftReg SR(PA_10, PA_12, PA_15, PA_11); //data, store, clock, output enable - - -//DigitalOut Muscle0(PA_10); -//DigitalOut Muscle1(PA_10); - -//AnalogIn FEEDBACK_0(PB_0); -//AnalogIn FEEDBACK_1(PB_1); - - +void Control_Power_Function(){Control_Main();} +void Serial_PC_Thread_Function(){SERIAL_PC_1.Main();} +void Serial_Board_Thread_Function(){SERIAL_BOARD_1.Main();} int main() { - /* - //outen = 0; - SR.ShiftByte(0x0000, ShiftReg::MSBFirst); - //SR.ShiftByte(0x00,0x80); - SR.Latch(); - wait(0.2); - SR.ShiftByte(0xF0F0, ShiftReg::MSBFirst); - SR.Latch(); - //outen = 0; - wait(2); - SR.ShiftByte(0x0000, ShiftReg::MSBFirst); - SR.Latch(); - */ - SR.Write(0x0000); - wait(1); + //Thread starting + Control_Post();//Power on self test + Thread::wait(1000); + Control_power_Thread.start(Control_Power_Function); + Serial_PC_Thread.start(Serial_PC_Thread_Function); + Serial_Board_Thread.start(Serial_Board_Thread_Function); + while(1) { - SR.Write(0xF0F0); - wait(1); - SR.Write(0x0F0F); - wait(1); - /* - SR.ShiftBit(1); - SR.Latch(); - wait(0.2); - for (int i = 0; i < 16; i++) { - SR.ShiftBit(0); - SR.Latch(); - wait(0.2); - } - */ - //myled = 1; // LED is ON - //Muscle0 = 1; - //wait(1); // 200 ms - - //myled = 0; // LED is OFF - //Muscle0 = 0; - //wait(1); // 1 sec - - PC.printf("troll lol lol lol lol lol lol\n\r"); - //PC.printf("%.6f %.6f\n\r",FEEDBACK_0.read(),FEEDBACK_1.read()); - //LCD.printf("Hello World!\n"); - + Thread::signal_wait(1);//Sleep the main thread } }