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@1:ccc66fdf858d, 2018-01-28 (annotated)
- Committer:
- andrewboyson
- Date:
- Sun Jan 28 14:41:12 2018 +0000
- Revision:
- 1:ccc66fdf858d
- Parent:
- 0:3c04f4b47041
- Child:
- 4:9e1c6ac4ef06
Updated libraries
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 1:ccc66fdf858d | 1 | #include "lpc1768.h" |
andrewboyson | 0:3c04f4b47041 | 2 | #include "watchdog.h" |
andrewboyson | 1:ccc66fdf858d | 3 | #include "periphs.h" |
andrewboyson | 0:3c04f4b47041 | 4 | #include "led.h" |
andrewboyson | 0:3c04f4b47041 | 5 | #include "clock.h" |
andrewboyson | 0:3c04f4b47041 | 6 | #include "tick.h" |
andrewboyson | 0:3c04f4b47041 | 7 | #include "log.h" |
andrewboyson | 0:3c04f4b47041 | 8 | #include "fram.h" |
andrewboyson | 1:ccc66fdf858d | 9 | #include "net-server.h" |
andrewboyson | 0:3c04f4b47041 | 10 | #include "1-wire.h" |
andrewboyson | 0:3c04f4b47041 | 11 | #include "1-wire-device.h" |
andrewboyson | 0:3c04f4b47041 | 12 | #include "heating.h" |
andrewboyson | 0:3c04f4b47041 | 13 | #include "settings.h" |
andrewboyson | 0:3c04f4b47041 | 14 | #include "ntp-client.h" |
andrewboyson | 0:3c04f4b47041 | 15 | #include "server-http.h" |
andrewboyson | 0:3c04f4b47041 | 16 | #include "trace.h" |
andrewboyson | 0:3c04f4b47041 | 17 | #include "values.h" |
andrewboyson | 0:3c04f4b47041 | 18 | |
andrewboyson | 0:3c04f4b47041 | 19 | int main() |
andrewboyson | 0:3c04f4b47041 | 20 | { |
andrewboyson | 1:ccc66fdf858d | 21 | PeriphsInit(); |
andrewboyson | 1:ccc66fdf858d | 22 | Lpc1768Init(); |
andrewboyson | 0:3c04f4b47041 | 23 | ClockInit(); |
andrewboyson | 0:3c04f4b47041 | 24 | LogInit(); |
andrewboyson | 0:3c04f4b47041 | 25 | if ( FramInit()) goto end; //Reserves 1 FRAM byte to detect if empty |
andrewboyson | 0:3c04f4b47041 | 26 | if ( WatchdogInit()) goto end; //Reserves 1 FRAM byte for the program position |
andrewboyson | 1:ccc66fdf858d | 27 | NetServerInit(); |
andrewboyson | 1:ccc66fdf858d | 28 | if (NtpClientInit()) goto end; |
andrewboyson | 0:3c04f4b47041 | 29 | ServerHttpInit(); |
andrewboyson | 0:3c04f4b47041 | 30 | OneWireInit(); |
andrewboyson | 0:3c04f4b47041 | 31 | DeviceInit(); |
andrewboyson | 0:3c04f4b47041 | 32 | HeatingInit(); |
andrewboyson | 0:3c04f4b47041 | 33 | if ( SettingsInit()) goto end; |
andrewboyson | 0:3c04f4b47041 | 34 | if ( TraceInit()) goto end; |
andrewboyson | 0:3c04f4b47041 | 35 | if ( ValuesInit()) goto end; |
andrewboyson | 0:3c04f4b47041 | 36 | LogUart = 1; |
andrewboyson | 1:ccc66fdf858d | 37 | LogTmFunction = ClockTmUtc; |
andrewboyson | 0:3c04f4b47041 | 38 | |
andrewboyson | 0:3c04f4b47041 | 39 | while (1) |
andrewboyson | 0:3c04f4b47041 | 40 | { |
andrewboyson | 0:3c04f4b47041 | 41 | WatchdogThisProgramPosition = 1; WatchdogMain(); |
andrewboyson | 0:3c04f4b47041 | 42 | WatchdogThisProgramPosition = 2; LogMain(); |
andrewboyson | 0:3c04f4b47041 | 43 | WatchdogThisProgramPosition = 3; ClockMain(); |
andrewboyson | 1:ccc66fdf858d | 44 | WatchdogThisProgramPosition = 4; NetServerMain(); |
andrewboyson | 0:3c04f4b47041 | 45 | WatchdogThisProgramPosition = 5; NtpClientMain(); |
andrewboyson | 0:3c04f4b47041 | 46 | WatchdogThisProgramPosition = 6; ValuesMain(); |
andrewboyson | 0:3c04f4b47041 | 47 | WatchdogThisProgramPosition = 7; if ( OneWireMain()) break; |
andrewboyson | 0:3c04f4b47041 | 48 | WatchdogThisProgramPosition = 8; if ( DeviceMain()) break; |
andrewboyson | 0:3c04f4b47041 | 49 | WatchdogThisProgramPosition = 9; HeatingMain(); |
andrewboyson | 0:3c04f4b47041 | 50 | } |
andrewboyson | 0:3c04f4b47041 | 51 | |
andrewboyson | 0:3c04f4b47041 | 52 | end: |
andrewboyson | 1:ccc66fdf858d | 53 | Led1Set(1); Led2Set(1); Led3Set(1); Led4Set(1); |
andrewboyson | 0:3c04f4b47041 | 54 | return 0; |
andrewboyson | 0:3c04f4b47041 | 55 | } |