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
main/main.c@6:b325de442777, 2018-02-22 (annotated)
- Committer:
- andrewboyson
- Date:
- Thu Feb 22 18:33:44 2018 +0000
- Revision:
- 6:b325de442777
- Parent:
- 4:9e1c6ac4ef06
- Child:
- 8:8b5e0bb28da0
Added debounce for the hall switch using the repetitive interrupt timer
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| andrewboyson | 4:9e1c6ac4ef06 | 1 | #include "system.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 | 6:b325de442777 | 18 | #include "debounce.h" |
| andrewboyson | 0:3c04f4b47041 | 19 | |
| andrewboyson | 0:3c04f4b47041 | 20 | int main() |
| andrewboyson | 0:3c04f4b47041 | 21 | { |
| andrewboyson | 1:ccc66fdf858d | 22 | PeriphsInit(); |
| andrewboyson | 4:9e1c6ac4ef06 | 23 | SystemInit(); |
| andrewboyson | 4:9e1c6ac4ef06 | 24 | LedInit(); |
| andrewboyson | 0:3c04f4b47041 | 25 | ClockInit(); |
| andrewboyson | 4:9e1c6ac4ef06 | 26 | LogInit(ClockTmUtc, 115200); |
| andrewboyson | 0:3c04f4b47041 | 27 | if ( FramInit()) goto end; //Reserves 1 FRAM byte to detect if empty |
| andrewboyson | 0:3c04f4b47041 | 28 | if ( WatchdogInit()) goto end; //Reserves 1 FRAM byte for the program position |
| andrewboyson | 1:ccc66fdf858d | 29 | NetServerInit(); |
| andrewboyson | 1:ccc66fdf858d | 30 | if (NtpClientInit()) goto end; |
| andrewboyson | 0:3c04f4b47041 | 31 | ServerHttpInit(); |
| andrewboyson | 0:3c04f4b47041 | 32 | OneWireInit(); |
| andrewboyson | 0:3c04f4b47041 | 33 | DeviceInit(); |
| andrewboyson | 0:3c04f4b47041 | 34 | HeatingInit(); |
| andrewboyson | 6:b325de442777 | 35 | DebounceInit(); |
| andrewboyson | 0:3c04f4b47041 | 36 | if ( SettingsInit()) goto end; |
| andrewboyson | 0:3c04f4b47041 | 37 | if ( TraceInit()) goto end; |
| andrewboyson | 0:3c04f4b47041 | 38 | if ( ValuesInit()) goto end; |
| andrewboyson | 0:3c04f4b47041 | 39 | |
| andrewboyson | 0:3c04f4b47041 | 40 | while (1) |
| andrewboyson | 0:3c04f4b47041 | 41 | { |
| andrewboyson | 0:3c04f4b47041 | 42 | WatchdogThisProgramPosition = 1; WatchdogMain(); |
| andrewboyson | 0:3c04f4b47041 | 43 | WatchdogThisProgramPosition = 2; LogMain(); |
| andrewboyson | 0:3c04f4b47041 | 44 | WatchdogThisProgramPosition = 3; ClockMain(); |
| andrewboyson | 1:ccc66fdf858d | 45 | WatchdogThisProgramPosition = 4; NetServerMain(); |
| andrewboyson | 0:3c04f4b47041 | 46 | WatchdogThisProgramPosition = 5; NtpClientMain(); |
| andrewboyson | 0:3c04f4b47041 | 47 | WatchdogThisProgramPosition = 6; ValuesMain(); |
| andrewboyson | 0:3c04f4b47041 | 48 | WatchdogThisProgramPosition = 7; if ( OneWireMain()) break; |
| andrewboyson | 0:3c04f4b47041 | 49 | WatchdogThisProgramPosition = 8; if ( DeviceMain()) break; |
| andrewboyson | 0:3c04f4b47041 | 50 | WatchdogThisProgramPosition = 9; HeatingMain(); |
| andrewboyson | 0:3c04f4b47041 | 51 | } |
| andrewboyson | 0:3c04f4b47041 | 52 | |
| andrewboyson | 0:3c04f4b47041 | 53 | end: |
| andrewboyson | 1:ccc66fdf858d | 54 | Led1Set(1); Led2Set(1); Led3Set(1); Led4Set(1); |
| andrewboyson | 0:3c04f4b47041 | 55 | return 0; |
| andrewboyson | 0:3c04f4b47041 | 56 | } |