Central Heating controller using the real time clock, PHY module for internet, 1-wire interface for temperature sensors, a system log and a configuration file

Dependencies:   net 1-wire lpc1768 crypto clock web fram log

/media/uploads/andrewboyson/heating.sch

/media/uploads/andrewboyson/heating.brd

/media/uploads/andrewboyson/eagle.epf

Revision:
48:6eac12df3ad5
Parent:
35:bb8a6d1c034c
Child:
57:72c1c1357861
--- a/heating/radiator.c	Tue Apr 23 18:47:47 2019 +0000
+++ b/heating/radiator.c	Fri Apr 26 16:40:19 2019 +0000
@@ -1,6 +1,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <stdbool.h>
+#include <stdint.h>
 
 #include "gpio.h"
 #include "program.h"
@@ -22,19 +23,19 @@
 
 static char      htgMode;        static int iMode;
 static char      htgOverride;    static int iOverride;
-static char     hallRom[8];      static int iHallRom;
+static char*    hallRom;         static int iHallRom;
 static int32_t nightTemperature; static int iNightTemperature;
 static int32_t frostTemperature; static int iFrostTemperature;
 
-bool  RadiatorGetMode            (){ return (bool)htgMode;          } 
-bool  RadiatorGetOverride        (){ return (bool)htgOverride;      } 
-char* RadiatorGetHallRom         (){ return       hallRom;          } 
-int   RadiatorGetNightTemperature(){ return  (int)nightTemperature; } 
-int   RadiatorGetFrostTemperature(){ return  (int)frostTemperature; } 
+bool     RadiatorGetMode            (){ return (bool)htgMode;          } 
+bool     RadiatorGetOverride        (){ return (bool)htgOverride;      } 
+uint16_t RadiatorGetHallDS18B20Value(){ return DS18B20ValueFromRom(hallRom); }
+int      RadiatorGetNightTemperature(){ return  (int)nightTemperature; } 
+int      RadiatorGetFrostTemperature(){ return  (int)frostTemperature; } 
 
 static void  setMode             ( bool value) { htgMode          =    (char)value; FramWrite(iMode,             1, &htgMode         ); }
 static void  setOverride         ( bool value) { htgOverride      =    (char)value; FramWrite(iOverride,         1, &htgOverride     ); }
-void RadiatorSetHallRom          (char* value) { memcpy(hallRom,  value, 8);        FramWrite(iHallRom,          8,  hallRom         ); }
+static void  setHallRom          (char* value) { memcpy(hallRom,  value, 8);        FramWrite(iHallRom,          8,  hallRom         ); }
 void RadiatorSetNightTemperature ( int  value) { nightTemperature = (int32_t)value; FramWrite(iNightTemperature, 4, &nightTemperature); }
 void RadiatorSetFrostTemperature ( int  value) { frostTemperature = (int32_t)value; FramWrite(iFrostTemperature, 4, &frostTemperature); }
 
@@ -100,6 +101,11 @@
 
 int RadiatorInit()
 {
+    hallRom = DS18B20Roms + 8 * DS18B20RomCount;
+    DS18B20RomSetters[DS18B20RomCount] = setHallRom;
+    DS18B20RomNames[DS18B20RomCount] = "Hall";
+    DS18B20RomCount++;
+
     int  address;
     char    def1;
     int32_t def4;