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: 1-wire clock crypto fram log lpc1768 net web wiz mbed
main/main.c@0:22b158d3c76f, 2021-05-10 (annotated)
- Committer:
- andrewboyson
- Date:
- Mon May 10 10:23:48 2021 +0000
- Revision:
- 0:22b158d3c76f
- Child:
- 3:f1464bf461c1
New version as old one would not commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 0:22b158d3c76f | 1 | #include "lpc1768.h" |
andrewboyson | 0:22b158d3c76f | 2 | #include "periphs.h" |
andrewboyson | 0:22b158d3c76f | 3 | #include "led.h" |
andrewboyson | 0:22b158d3c76f | 4 | #include "clk.h" |
andrewboyson | 0:22b158d3c76f | 5 | #include "log.h" |
andrewboyson | 0:22b158d3c76f | 6 | #include "fram.h" |
andrewboyson | 0:22b158d3c76f | 7 | #include "net.h" |
andrewboyson | 0:22b158d3c76f | 8 | #include "1-wire.h" |
andrewboyson | 0:22b158d3c76f | 9 | #include "1-wire-device.h" |
andrewboyson | 0:22b158d3c76f | 10 | #include "heating.h" |
andrewboyson | 0:22b158d3c76f | 11 | #include "settings.h" |
andrewboyson | 0:22b158d3c76f | 12 | #include "web.h" |
andrewboyson | 0:22b158d3c76f | 13 | #include "settings.h" |
andrewboyson | 0:22b158d3c76f | 14 | #include "values.h" |
andrewboyson | 0:22b158d3c76f | 15 | #include "restart.h" |
andrewboyson | 0:22b158d3c76f | 16 | #include "restart-this.h" |
andrewboyson | 0:22b158d3c76f | 17 | #include "crypto.h" |
andrewboyson | 0:22b158d3c76f | 18 | #include "wiz.h" |
andrewboyson | 0:22b158d3c76f | 19 | |
andrewboyson | 0:22b158d3c76f | 20 | int main() |
andrewboyson | 0:22b158d3c76f | 21 | { |
andrewboyson | 0:22b158d3c76f | 22 | RestartZone = RESTART_ZONE_INIT; |
andrewboyson | 0:22b158d3c76f | 23 | PeriphsInit(); |
andrewboyson | 0:22b158d3c76f | 24 | LedInit(); |
andrewboyson | 0:22b158d3c76f | 25 | Lpc1768Init(); |
andrewboyson | 0:22b158d3c76f | 26 | ClkInit(); |
andrewboyson | 0:22b158d3c76f | 27 | LogInit(ClkNowTmUtc, 115200); |
andrewboyson | 0:22b158d3c76f | 28 | if ( FramInit()) goto end; //Reserves 1 FRAM byte to detect if empty |
andrewboyson | 0:22b158d3c76f | 29 | FramAllocate(4); //Reserves 4 FRAM bytes where the watchdog used to hold the last program position |
andrewboyson | 0:22b158d3c76f | 30 | CryptoInit(); //Uses log |
andrewboyson | 0:22b158d3c76f | 31 | NetInit(); |
andrewboyson | 0:22b158d3c76f | 32 | if (SettingsNtpInit()) goto end; //Loads of FRAM |
andrewboyson | 0:22b158d3c76f | 33 | WebInit(); //No FRAM |
andrewboyson | 0:22b158d3c76f | 34 | OneWireInit(); //No FRAM |
andrewboyson | 0:22b158d3c76f | 35 | DeviceInit(); //No FRAM |
andrewboyson | 0:22b158d3c76f | 36 | HeatingInit(); //Loads of FRAM |
andrewboyson | 0:22b158d3c76f | 37 | if ( SettingsInit()) goto end; |
andrewboyson | 0:22b158d3c76f | 38 | if ( ValuesInit()) goto end; |
andrewboyson | 0:22b158d3c76f | 39 | WizInit(); |
andrewboyson | 0:22b158d3c76f | 40 | while (1) |
andrewboyson | 0:22b158d3c76f | 41 | { |
andrewboyson | 0:22b158d3c76f | 42 | RestartZone = RESTART_ZONE_LOG; LogMain(); |
andrewboyson | 0:22b158d3c76f | 43 | RestartZone = RESTART_ZONE_CLOCK; ClkMain(); |
andrewboyson | 0:22b158d3c76f | 44 | RestartZone = RESTART_ZONE_NET; NetMain(); |
andrewboyson | 0:22b158d3c76f | 45 | RestartZone = RESTART_ZONE_VALUES; ValuesMain(); |
andrewboyson | 0:22b158d3c76f | 46 | RestartZone = RESTART_ZONE_ONE_WIRE; if (OneWireMain()) break; |
andrewboyson | 0:22b158d3c76f | 47 | RestartZone = RESTART_ZONE_DEVICE; if ( DeviceMain()) break; |
andrewboyson | 0:22b158d3c76f | 48 | RestartZone = RESTART_ZONE_HEATING; HeatingMain(); |
andrewboyson | 0:22b158d3c76f | 49 | RestartZone = RESTART_ZONE_LPC1768; Lpc1768Main(); |
andrewboyson | 0:22b158d3c76f | 50 | RestartZone = RESTART_ZONE_CRYPTO; CryptoMain(); |
andrewboyson | 0:22b158d3c76f | 51 | WizMain(); |
andrewboyson | 0:22b158d3c76f | 52 | } |
andrewboyson | 0:22b158d3c76f | 53 | |
andrewboyson | 0:22b158d3c76f | 54 | end: |
andrewboyson | 0:22b158d3c76f | 55 | Led1Set(1); Led2Set(1); Led3Set(1); Led4Set(1); |
andrewboyson | 0:22b158d3c76f | 56 | return 0; |
andrewboyson | 0:22b158d3c76f | 57 | } |