Monitor motorhome leisure battery and provide simple control of habitation

Dependencies:   net lpc1768 crypto clock web fram log

Committer:
andrewboyson
Date:
Fri Jun 10 18:32:21 2022 +0000
Revision:
10:a97a7cb7aa82
Parent:
9:d957af50fdc2
Corrected amp second count in html

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andrewboyson 0:b843d647695c 1 #include "lpc1768.h"
andrewboyson 0:b843d647695c 2 #include "periphs.h"
andrewboyson 0:b843d647695c 3 #include "led.h"
andrewboyson 0:b843d647695c 4 #include "clk.h"
andrewboyson 0:b843d647695c 5 #include "log.h"
andrewboyson 0:b843d647695c 6 #include "fram.h"
andrewboyson 0:b843d647695c 7 #include "net.h"
andrewboyson 0:b843d647695c 8 #include "settings.h"
andrewboyson 0:b843d647695c 9 #include "web.h"
andrewboyson 0:b843d647695c 10 #include "settings.h"
andrewboyson 0:b843d647695c 11 #include "values.h"
andrewboyson 0:b843d647695c 12 #include "restart.h"
andrewboyson 0:b843d647695c 13 #include "restart-this.h"
andrewboyson 0:b843d647695c 14 #include "crypto.h"
andrewboyson 2:5229cab71d69 15 #include "i2c1.h"
andrewboyson 2:5229cab71d69 16 #include "lcd.h"
andrewboyson 9:d957af50fdc2 17 #include "can.h"
andrewboyson 9:d957af50fdc2 18 #include "comms.h"
andrewboyson 0:b843d647695c 19
andrewboyson 0:b843d647695c 20 int main()
andrewboyson 0:b843d647695c 21 {
andrewboyson 0:b843d647695c 22 RestartZone = RESTART_ZONE_INIT;
andrewboyson 0:b843d647695c 23 PeriphsInit();
andrewboyson 0:b843d647695c 24 LedInit();
andrewboyson 0:b843d647695c 25 Lpc1768Init();
andrewboyson 0:b843d647695c 26 ClkInit();
andrewboyson 0:b843d647695c 27 LogInit(ClkNowTmUtc, 115200);
andrewboyson 0:b843d647695c 28 if ( FramInit()) goto end; //Reserves 1 FRAM byte to detect if empty
andrewboyson 0:b843d647695c 29 FramAllocate(4); //Reserves 4 FRAM bytes where the watchdog used to hold the last program position
andrewboyson 0:b843d647695c 30 CryptoInit(); //Uses log
andrewboyson 0:b843d647695c 31 NetInit();
andrewboyson 0:b843d647695c 32 if (SettingsNtpInit()) goto end; //Loads of FRAM
andrewboyson 0:b843d647695c 33 WebInit(); //No FRAM
andrewboyson 0:b843d647695c 34 if ( SettingsInit()) goto end;
andrewboyson 0:b843d647695c 35 if ( ValuesInit()) goto end;
andrewboyson 2:5229cab71d69 36 I2C1Init();
andrewboyson 2:5229cab71d69 37 LcdInit();
andrewboyson 9:d957af50fdc2 38 CanInit();
andrewboyson 9:d957af50fdc2 39 CommsInit();
andrewboyson 0:b843d647695c 40 while (1)
andrewboyson 0:b843d647695c 41 {
andrewboyson 0:b843d647695c 42 RestartZone = RESTART_ZONE_LOG; LogMain();
andrewboyson 0:b843d647695c 43 RestartZone = RESTART_ZONE_CLOCK; ClkMain();
andrewboyson 0:b843d647695c 44 RestartZone = RESTART_ZONE_NET; NetMain();
andrewboyson 0:b843d647695c 45 RestartZone = RESTART_ZONE_VALUES; ValuesMain();
andrewboyson 0:b843d647695c 46 RestartZone = RESTART_ZONE_LPC1768; Lpc1768Main();
andrewboyson 0:b843d647695c 47 RestartZone = RESTART_ZONE_CRYPTO; CryptoMain();
andrewboyson 2:5229cab71d69 48 I2C1Main();
andrewboyson 2:5229cab71d69 49 LcdMain();
andrewboyson 9:d957af50fdc2 50 CanMain();
andrewboyson 9:d957af50fdc2 51 CommsMain();
andrewboyson 0:b843d647695c 52 }
andrewboyson 0:b843d647695c 53
andrewboyson 0:b843d647695c 54 end:
andrewboyson 0:b843d647695c 55 Led1Set(1); Led2Set(1); Led3Set(1); Led4Set(1);
andrewboyson 0:b843d647695c 56 return 0;
andrewboyson 0:b843d647695c 57 }