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

main/main.c

Committer:
andrewboyson
Date:
2018-12-31
Revision:
15:f91462db6088
Parent:
11:fa01ea25b62d
Child:
16:48ef9d43018b

File content as of revision 15:f91462db6088:

#include "system.h"
#include "watchdog.h"
#include "periphs.h"
#include "led.h"
#include "clock.h"
#include "log.h"
#include "fram.h"
#include "net-server.h"
#include "1-wire.h"
#include "1-wire-device.h"
#include "heating.h"
#include "settings.h"
#include "ntp-client.h"
#include "http-server.h"
#include "settings.h"
#include "values.h"
#include "debounce.h"

int main()
{
          PeriphsInit();
           SystemInit();
              LedInit();
            ClockInit();
              LogInit(ClockTmUtc, 115200);
    if (     FramInit()) goto end; //Reserves 1 FRAM byte to detect if empty
    if ( WatchdogInit()) goto end; //Reserves 1 FRAM byte for the program position
        NetServerInit();
    if (NtpClientInit()) goto end;
       HttpServerInit();
          OneWireInit();
           DeviceInit();
          HeatingInit();
         DebounceInit();
    if ( SettingsInit()) goto end;
    if (   ValuesInit()) goto end;
      
    while (1)
    {   
        WatchdogThisProgramPosition = 1;      WatchdogMain();
        WatchdogThisProgramPosition = 2;           LogMain();
        WatchdogThisProgramPosition = 3;         ClockMain();
        WatchdogThisProgramPosition = 4;     NetServerMain();
        WatchdogThisProgramPosition = 5;     NtpClientMain();
        WatchdogThisProgramPosition = 6;        ValuesMain();
        WatchdogThisProgramPosition = 7; if (  OneWireMain()) break;
        WatchdogThisProgramPosition = 8; if (   DeviceMain()) break;
        WatchdogThisProgramPosition = 9;       HeatingMain();
    }

end:
    Led1Set(1); Led2Set(1); Led3Set(1); Led4Set(1);
    return 0;
}