STM32F103C8T6_WIFI_Heating_system

Dependencies:   mbed mbed-STM32F103C8T6 eeprom_flash Watchdog PinDetect DS1820

  1. Bluepill STM32F103C8T6 Heating system
    1. _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)

Revision:
26:750f21025bb9
Parent:
25:49e5d653d789
Child:
27:007e17df5ba0
--- a/main.cpp	Sat Sep 15 19:47:28 2018 +0000
+++ b/main.cpp	Sat Sep 15 20:00:16 2018 +0000
@@ -1,6 +1,7 @@
 #include "stm32f103c8t6.h"
 #include "mbed.h"
 #include "DS1820.h"
+#include "PinDetect.h"
 #include <string> 
 
 char a[128] = "";       // RX command buffer
@@ -9,7 +10,6 @@
 
 Serial  pc(PA_2, PA_3);
 DigitalOut  myled(LED1);
-InterruptIn   pb(PA_11);
 
 // This function is called when a character goes into the RX buffer.
 void rxCallback() {
@@ -34,20 +34,27 @@
  
  
 void pb_hit_interrupt (void) {
-    pc.printf("Button pressed\r\n"); 
+    //pc.printf("Button pressed\r\n"); 
 }; 
 
 void pb_out_interrupt (void) {
-    pc.printf("Button unpressed\r\n"); 
+    //pc.printf("Button unpressed\r\n"); 
 }; 
   
 int main() {
         
     confSysClock();     //Configure system clock (72MHz HSE clock, 48MHz USB clock)
-    
+
+    PinDetect   pb(PA_11);
     pb.mode(PullUp);
-    pb.fall(&pb_hit_interrupt);
-    pb.rise(&pb_out_interrupt);
+    
+    // Delay for initial pullup to take effect
+    wait(.005);
+    
+    pb.attach_deasserted(&pb_hit_interrupt);
+    pb.attach_asserted(&pb_out_interrupt);
+    //pb.rise(&pb_out_interrupt);
+    pb.setSampleFrequency();
     
     float temp[5] = {
                     85,85,85,85,85  // initial temperature