Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 11:8702316d7fc8
- Parent:
- 10:d1104e320de7
- Child:
- 12:5cb359f981f3
diff -r d1104e320de7 -r 8702316d7fc8 main.cpp --- a/main.cpp Sat Apr 06 05:11:01 2019 +0000 +++ b/main.cpp Sat Apr 13 05:55:40 2019 +0000 @@ -6,10 +6,19 @@ #include "SB1602E.h" extern void analyzePayload(); -#if 0 +#if 1 +#ifdef STM32F207xx +HX711 hx711(PB_11, PB_10);// data, clk +#endif + +#ifdef STM32F303xE +//HX711 hx711(D8, D9);// data, clk +HX711 hx711(PA_14, PA_15); +#endif extern void scaleCalibration(); -void init_scale(); -extern HX711 hx711; +extern void init_scale(); +Thread scale_thread; +extern void scale_reading(); #endif unsigned char rx_buffer[8], tx_buffer[8]; unsigned char rx_length, tx_length; @@ -47,6 +56,7 @@ fflush(stdout); } + Thread can_receivethread; Thread can_handlethread; @@ -133,9 +143,7 @@ lcd.printf(5, 0, "UUU"); lcd.printf(0, 0, "pressed!" ); #endif -#if 0 - init_scale(); -#endif + can_receivethread.start(can_rxthread); can_handlethread.start(analyzePayload); @@ -148,8 +156,13 @@ //button1.mode(PullUp); // Activate pull-up button1.fall(callback(button1_onpressed_cb)); // Attach ISR to handle button press event - eeprom_test(); +// eeprom_test(); +#if 1 +// scaleCalibration(); + init_scale(); + scale_thread.start(scale_reading); +#endif int idx = 0; // Just for printf below can_tx_data[0] = 0; while(1) {