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
heating/hall-led.c@106:41ed3ea0bbba, 2021-04-23 (annotated)
- Committer:
- andrewboyson
- Date:
- Fri Apr 23 08:36:42 2021 +0000
- Revision:
- 106:41ed3ea0bbba
- Parent:
- 58:d968191f46f2
Not working, crashes.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andrewboyson | 58:d968191f46f2 | 1 | #include <stdbool.h> |
andrewboyson | 58:d968191f46f2 | 2 | |
andrewboyson | 58:d968191f46f2 | 3 | |
andrewboyson | 58:d968191f46f2 | 4 | #include "gpio.h" |
andrewboyson | 58:d968191f46f2 | 5 | #include "radiator.h" |
andrewboyson | 58:d968191f46f2 | 6 | #include "program.h" |
andrewboyson | 58:d968191f46f2 | 7 | #include "mstimer.h" |
andrewboyson | 58:d968191f46f2 | 8 | #include "hall-pb.h" |
andrewboyson | 58:d968191f46f2 | 9 | |
andrewboyson | 58:d968191f46f2 | 10 | #define HALL_LED_DIR FIO0DIR(10) // P0.10 == p28; |
andrewboyson | 58:d968191f46f2 | 11 | #define HALL_LED_PIN FIO0PIN(10) |
andrewboyson | 58:d968191f46f2 | 12 | #define HALL_LED_SET FIO0SET(10) |
andrewboyson | 58:d968191f46f2 | 13 | #define HALL_LED_CLR FIO0CLR(10) |
andrewboyson | 58:d968191f46f2 | 14 | |
andrewboyson | 58:d968191f46f2 | 15 | #define WINTER_FLASH_MS 100 |
andrewboyson | 58:d968191f46f2 | 16 | #define SUMMER_FLASH_MS 500 |
andrewboyson | 58:d968191f46f2 | 17 | |
andrewboyson | 58:d968191f46f2 | 18 | void HallLedInit() |
andrewboyson | 58:d968191f46f2 | 19 | { |
andrewboyson | 58:d968191f46f2 | 20 | HALL_LED_DIR = 1; //Set the direction to 1 == output |
andrewboyson | 58:d968191f46f2 | 21 | } |
andrewboyson | 58:d968191f46f2 | 22 | void HallLedMain() |
andrewboyson | 58:d968191f46f2 | 23 | { |
andrewboyson | 58:d968191f46f2 | 24 | static uint32_t hallLedFlashMsTimer = 0; |
andrewboyson | 58:d968191f46f2 | 25 | if (HallPbOverrideMode) |
andrewboyson | 58:d968191f46f2 | 26 | { |
andrewboyson | 58:d968191f46f2 | 27 | if (RadiatorPump) HALL_LED_SET; else HALL_LED_CLR; |
andrewboyson | 58:d968191f46f2 | 28 | hallLedFlashMsTimer = MsTimerCount; |
andrewboyson | 58:d968191f46f2 | 29 | } |
andrewboyson | 58:d968191f46f2 | 30 | else |
andrewboyson | 58:d968191f46f2 | 31 | { |
andrewboyson | 58:d968191f46f2 | 32 | int flashRate = RadiatorGetWinter() ? WINTER_FLASH_MS : SUMMER_FLASH_MS; |
andrewboyson | 58:d968191f46f2 | 33 | if (MsTimerRepetitive(&hallLedFlashMsTimer, flashRate)) |
andrewboyson | 58:d968191f46f2 | 34 | { |
andrewboyson | 58:d968191f46f2 | 35 | static bool flash = false; |
andrewboyson | 58:d968191f46f2 | 36 | flash = !flash; |
andrewboyson | 58:d968191f46f2 | 37 | if (flash) HALL_LED_SET; else HALL_LED_CLR; |
andrewboyson | 58:d968191f46f2 | 38 | } |
andrewboyson | 58:d968191f46f2 | 39 | } |
andrewboyson | 58:d968191f46f2 | 40 | } |