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:
- 32:aebbfe391bbc
- Parent:
- 31:0a516ceaec4d
- Child:
- 33:2c54746f7518
--- a/main.cpp Mon Sep 17 07:54:57 2018 +0000 +++ b/main.cpp Mon Sep 17 18:38:14 2018 +0000 @@ -12,6 +12,7 @@ // Create a thread that'll run the event queue's dispatch function //Thread t; +Watchdog wd; char a[128] = ""; // RX command buffer char i = 0; // RX char pointer @@ -96,12 +97,24 @@ void at_command(){ if (recieved == 1) { + __disable_irq(); + // command was recieved - pc.printf(a); - pc.printf("\r\n"); + + if (a[0]=='A' && a[1]=='T') { + + if ( a[2]=='\0') { + //pc.printf(a); + pc.printf("OK\r\n"); + }; + } else { + pc.printf("Wrong request\r\n"); + }; // process_command(a); + __enable_irq(); + // ready for new command recieved = 0; a[0] = '\0'; @@ -114,6 +127,8 @@ myled = 0; // turn the LED on + // kick the watchdog + wd.Service(); __disable_irq(); @@ -151,6 +166,8 @@ confSysClock(); //Configure system clock (72MHz HSE clock, 48MHz USB clock) + wd.Configure(5.0); + PinDetect pb(PA_11); pb.mode(PullUp); @@ -164,7 +181,7 @@ pc.attach(&rxCallback, Serial::RxIrq); pc.baud(115200); - pc.printf("Wifi Heating system\r\n"); + pc.printf("\r\n\r\nWifi Heating system\r\n");