Andrew Boyson / oldheating

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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers hot-water.c Source File

hot-water.c

00001 #include <stdint.h>
00002 #include <string.h>
00003 #include <stdbool.h>
00004 #include <stdint.h>
00005 
00006 #include "ds18b20.h"
00007 #include "fram.h"
00008 
00009 static char*    hotWaterRom;         static int iHotWaterRom;
00010 
00011 uint16_t HotWaterGetDS18B20Value(){ return DS18B20ValueFromRom(hotWaterRom); }
00012 
00013 static void  setHotWaterRom          (char* value) { memcpy(hotWaterRom,  value, 8);        FramWrite(iHotWaterRom,          8,  hotWaterRom         ); }
00014 
00015 int HotWaterInit()
00016 {
00017     hotWaterRom = DS18B20Roms + 8 * DS18B20RomCount;
00018     DS18B20RomSetters[DS18B20RomCount] = setHotWaterRom;
00019     DS18B20RomNames[DS18B20RomCount] = "HotWater";
00020     DS18B20RomCount++;
00021 
00022     int  address;
00023     char    def1;
00024     int32_t def4;
00025                address = FramLoad( 8,  hotWaterRom,              0); if (address < 0) return -1; iHotWaterRom          = address;
00026     return 0;
00027 }