Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: net 1-wire lpc1768 crypto clock web fram log
Diff: main/main.c
- Revision:
- 20:904a4f043f2c
- Parent:
- 19:969f7be69225
- Child:
- 28:bb55def47737
--- a/main/main.c Mon Jan 07 08:15:23 2019 +0000
+++ b/main/main.c Tue Jan 08 14:08:33 2019 +0000
@@ -1,8 +1,7 @@
#include "system.h"
-#include "watchdog.h"
#include "periphs.h"
#include "led.h"
-#include "clock.h"
+#include "clk.h"
#include "log.h"
#include "fram.h"
#include "net.h"
@@ -16,6 +15,7 @@
#include "values.h"
#include "debounce.h"
#include "fault.h"
+#include "userfault.h"
int main()
{
@@ -23,8 +23,8 @@
PeriphsInit();
SystemInit();
LedInit();
- ClockInit();
- LogInit(ClockTmUtc, 115200);
+ ClkInit();
+ LogInit(ClkNowTmUtc, 115200);
if ( FramInit()) goto end; //Reserves 1 FRAM byte to detect if empty
FramAllocate(4); //Reserves 4 FRAM bytes where the watchdog used to hold the last program position
NetInit("ch4", "ch6");
@@ -36,20 +36,19 @@
DebounceInit();
if ( SettingsInit()) goto end;
if ( ValuesInit()) goto end;
- WatchdogInit();
+ FaultInit();
while (1)
{
- FaultZone = FAULT_ZONE_LOG; LogMain();
- FaultZone = FAULT_ZONE_CLOCK; ClockMain();
- FaultZone = FAULT_ZONE_NET; NetMain();
- FaultZone = FAULT_ZONE_NONE; NtpClientMain();
- FaultZone = FAULT_ZONE_NONE; ValuesMain();
- FaultZone = FAULT_ZONE_NONE; if ( OneWireMain()) break;
- FaultZone = FAULT_ZONE_NONE; if ( DeviceMain()) break;
- FaultZone = FAULT_ZONE_NONE; HeatingMain();
- FaultZone = FAULT_ZONE_NONE; WatchdogMain();
- FaultZone = FAULT_ZONE_NONE; FaultMain();
+ FaultZone = FAULT_ZONE_LOG; LogMain();
+ FaultZone = FAULT_ZONE_CLOCK; ClkMain();
+ FaultZone = FAULT_ZONE_NET; NetMain();
+ FaultZone = FAULT_ZONE_NTP_CLIENT; NtpClientMain();
+ FaultZone = FAULT_ZONE_VALUES; ValuesMain();
+ FaultZone = FAULT_ZONE_ONE_WIRE; if (OneWireMain()) break;
+ FaultZone = FAULT_ZONE_DEVICE; if ( DeviceMain()) break;
+ FaultZone = FAULT_ZONE_HEATING; HeatingMain();
+ FaultZone = FAULT_ZONE_FAULT; FaultMain();
}
end: