STM32F103C8T6_WIFI_Heating_system
Dependencies: mbed mbed-STM32F103C8T6 eeprom_flash Watchdog PinDetect DS1820
- Bluepill STM32F103C8T6 Heating system
- _This project is core part of bigger heating system project!_
Features
- Reading temperature from four DS18B20 sensors
- Making a decision about switching on/off heater and pomp
- Executing simple user commands from UART
- Storing state parameters to program memory (EEPROM emulation)
Diff: main.cpp
- Revision:
- 56:522ad08941bb
- Parent:
- 55:3378972851fd
- Child:
- 57:9bf4c8142958
--- a/main.cpp Sat Oct 06 09:16:46 2018 +0000 +++ b/main.cpp Sun Oct 07 05:53:12 2018 +0000 @@ -32,6 +32,8 @@ DigitalOut pomp_OFF(PA_12); // pomp off DigitalOut heater_OFF(PA_15); // heater off +DigitalOut reset_wifi(PA_4); // reset WIFI + // This function is called when a character goes into the RX buffer. void rxCallback() { char c; @@ -198,6 +200,14 @@ }; }; +void flushSerialBuffer(void) { + char char1 = 0; + while (pc.readable()) { + char1 = pc.getc(); + }; + return; +}; + int main() { @@ -205,6 +215,7 @@ heater_OFF = 1; pomp_OFF = 1; + reset_wifi = 0; eeprom_config_value = get_temp_config_value(); working_mode = (char)get_mode_config_value(); @@ -215,15 +226,19 @@ pb.mode(PullUp); // Delay for initial pullup to take effect - wait(.005); + wait(.15); + + reset_wifi = 1; // starts esp8266 pb.attach_deasserted(&pb_hit_interrupt); pb.attach_asserted(&pb_out_interrupt); //pb.rise(&pb_out_interrupt); pb.setSampleFrequency(); + pc.attach(&rxCallback, Serial::RxIrq); pc.baud(19200); + flushSerialBuffer(); pc.printf("\r\nNaumovich 2.0\r\n"); blink_myled(3);