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@34:18a3fc737899, 2019-02-28 (annotated)
- Committer:
- andrewboyson
- Date:
- Thu Feb 28 16:21:15 2019 +0000
- Revision:
- 34:18a3fc737899
- Parent:
- 28:bb55def47737
- Child:
- 47:229338b3adcb
Updated lpc1768 library for firmware updates over html.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 34:18a3fc737899 | 1 | #include "lpc1768.h" |
andrewboyson | 1:ccc66fdf858d | 2 | #include "periphs.h" |
andrewboyson | 0:3c04f4b47041 | 3 | #include "led.h" |
andrewboyson | 20:904a4f043f2c | 4 | #include "clk.h" |
andrewboyson | 0:3c04f4b47041 | 5 | #include "log.h" |
andrewboyson | 0:3c04f4b47041 | 6 | #include "fram.h" |
andrewboyson | 17:13a1068dda70 | 7 | #include "net.h" |
andrewboyson | 0:3c04f4b47041 | 8 | #include "1-wire.h" |
andrewboyson | 0:3c04f4b47041 | 9 | #include "1-wire-device.h" |
andrewboyson | 0:3c04f4b47041 | 10 | #include "heating.h" |
andrewboyson | 0:3c04f4b47041 | 11 | #include "settings.h" |
andrewboyson | 15:f91462db6088 | 12 | #include "http-server.h" |
andrewboyson | 8:8b5e0bb28da0 | 13 | #include "settings.h" |
andrewboyson | 0:3c04f4b47041 | 14 | #include "values.h" |
andrewboyson | 6:b325de442777 | 15 | #include "debounce.h" |
andrewboyson | 16:48ef9d43018b | 16 | #include "fault.h" |
andrewboyson | 20:904a4f043f2c | 17 | #include "userfault.h" |
andrewboyson | 0:3c04f4b47041 | 18 | |
andrewboyson | 0:3c04f4b47041 | 19 | int main() |
andrewboyson | 0:3c04f4b47041 | 20 | { |
andrewboyson | 16:48ef9d43018b | 21 | FaultZone = FAULT_ZONE_INIT; |
andrewboyson | 28:bb55def47737 | 22 | PeriphsInit(); |
andrewboyson | 34:18a3fc737899 | 23 | Lpc1768Init(); |
andrewboyson | 28:bb55def47737 | 24 | LedInit(); |
andrewboyson | 28:bb55def47737 | 25 | ClkInit(); |
andrewboyson | 28:bb55def47737 | 26 | LogInit(ClkNowTmUtc, 115200); |
andrewboyson | 28:bb55def47737 | 27 | if ( FramInit()) goto end; //Reserves 1 FRAM byte to detect if empty |
andrewboyson | 28:bb55def47737 | 28 | FramAllocate(4); //Reserves 4 FRAM bytes where the watchdog used to hold the last program position |
andrewboyson | 28:bb55def47737 | 29 | NetInit("ch4", "ch6"); |
andrewboyson | 28:bb55def47737 | 30 | if (SettingsNtpInit()) goto end; //Loads of FRAM |
andrewboyson | 28:bb55def47737 | 31 | HttpServerInit(); //No FRAM |
andrewboyson | 28:bb55def47737 | 32 | OneWireInit(); //No FRAM |
andrewboyson | 28:bb55def47737 | 33 | DeviceInit(); //No FRAM |
andrewboyson | 28:bb55def47737 | 34 | HeatingInit(); //Loads of FRAM |
andrewboyson | 28:bb55def47737 | 35 | DebounceInit(); //No Fram |
andrewboyson | 28:bb55def47737 | 36 | if ( SettingsInit()) goto end; |
andrewboyson | 28:bb55def47737 | 37 | if ( ValuesInit()) goto end; |
andrewboyson | 0:3c04f4b47041 | 38 | while (1) |
andrewboyson | 0:3c04f4b47041 | 39 | { |
andrewboyson | 20:904a4f043f2c | 40 | FaultZone = FAULT_ZONE_LOG; LogMain(); |
andrewboyson | 20:904a4f043f2c | 41 | FaultZone = FAULT_ZONE_CLOCK; ClkMain(); |
andrewboyson | 20:904a4f043f2c | 42 | FaultZone = FAULT_ZONE_NET; NetMain(); |
andrewboyson | 20:904a4f043f2c | 43 | FaultZone = FAULT_ZONE_VALUES; ValuesMain(); |
andrewboyson | 20:904a4f043f2c | 44 | FaultZone = FAULT_ZONE_ONE_WIRE; if (OneWireMain()) break; |
andrewboyson | 20:904a4f043f2c | 45 | FaultZone = FAULT_ZONE_DEVICE; if ( DeviceMain()) break; |
andrewboyson | 20:904a4f043f2c | 46 | FaultZone = FAULT_ZONE_HEATING; HeatingMain(); |
andrewboyson | 34:18a3fc737899 | 47 | FaultZone = FAULT_ZONE_LPC1768; Lpc1768Main(); |
andrewboyson | 0:3c04f4b47041 | 48 | } |
andrewboyson | 0:3c04f4b47041 | 49 | |
andrewboyson | 0:3c04f4b47041 | 50 | end: |
andrewboyson | 1:ccc66fdf858d | 51 | Led1Set(1); Led2Set(1); Led3Set(1); Led4Set(1); |
andrewboyson | 0:3c04f4b47041 | 52 | return 0; |
andrewboyson | 0:3c04f4b47041 | 53 | } |