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: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
src/ConfigurationHandler/Controls/TimerControl.h@126:c85ac6a8e9af, 2016-09-23 (annotated)
- Committer:
- jmarkel44
- Date:
- Fri Sep 23 16:13:20 2016 +0000
- Revision:
- 126:c85ac6a8e9af
- Parent:
- 122:4db48b933115
- Child:
- 128:534bf29132f8
updates to timer control;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| jmarkel44 | 12:ea87887ca7ad | 1 | /****************************************************************************** |
| jmarkel44 | 12:ea87887ca7ad | 2 | * |
| jmarkel44 | 12:ea87887ca7ad | 3 | * File: TimerControl.h |
| jmarkel44 | 12:ea87887ca7ad | 4 | * Desciption: ICE Timer Control Class |
| jmarkel44 | 12:ea87887ca7ad | 5 | * |
| jmarkel44 | 12:ea87887ca7ad | 6 | *****************************************************************************/ |
| jmarkel44 | 12:ea87887ca7ad | 7 | #ifndef TIMERCONTROL_H |
| jmarkel44 | 12:ea87887ca7ad | 8 | #define TIMERCONTROL_H |
| jmarkel44 | 12:ea87887ca7ad | 9 | |
| jmarkel44 | 12:ea87887ca7ad | 10 | #include <string> |
| jmarkel44 | 122:4db48b933115 | 11 | #include <stdio.h> |
| jmarkel44 | 19:9bc8fabeddfa | 12 | |
| jmarkel44 | 12:ea87887ca7ad | 13 | class TimerControl |
| jmarkel44 | 12:ea87887ca7ad | 14 | { |
| jmarkel44 | 12:ea87887ca7ad | 15 | private: |
| jmarkel44 | 122:4db48b933115 | 16 | std::string controlFile; |
| jmarkel44 | 122:4db48b933115 | 17 | std::string id; |
| jmarkel44 | 122:4db48b933115 | 18 | unsigned int priority; |
| jmarkel44 | 122:4db48b933115 | 19 | unsigned int dow; |
| jmarkel44 | 122:4db48b933115 | 20 | unsigned int startw; |
| jmarkel44 | 122:4db48b933115 | 21 | std::string output; |
| jmarkel44 | 122:4db48b933115 | 22 | unsigned int startHour; |
| jmarkel44 | 122:4db48b933115 | 23 | unsigned int startMinute; |
| jmarkel44 | 122:4db48b933115 | 24 | unsigned int duration; |
| jmarkel44 | 126:c85ac6a8e9af | 25 | |
| jmarkel44 | 122:4db48b933115 | 26 | |
| jmarkel44 | 12:ea87887ca7ad | 27 | public: |
| jmarkel44 | 19:9bc8fabeddfa | 28 | TimerControl() {}; |
| jmarkel44 | 12:ea87887ca7ad | 29 | ~TimerControl() { |
| jmarkel44 | 12:ea87887ca7ad | 30 | printf("\r%s destructor invoked\n", __func__); |
| jmarkel44 | 12:ea87887ca7ad | 31 | } |
| jmarkel44 | 20:653923c2f37a | 32 | // load a control from the control file |
| jmarkel44 | 122:4db48b933115 | 33 | bool load(std::string filename); |
| jmarkel44 | 122:4db48b933115 | 34 | |
| jmarkel44 | 122:4db48b933115 | 35 | void display(void); |
| jmarkel44 | 122:4db48b933115 | 36 | |
| jmarkel44 | 122:4db48b933115 | 37 | std::string getControlFile(void) { |
| jmarkel44 | 12:ea87887ca7ad | 38 | return controlFile; |
| jmarkel44 | 12:ea87887ca7ad | 39 | } |
| jmarkel44 | 126:c85ac6a8e9af | 40 | |
| jmarkel44 | 126:c85ac6a8e9af | 41 | void start(void); |
| jmarkel44 | 126:c85ac6a8e9af | 42 | void update(void); |
| jmarkel44 | 126:c85ac6a8e9af | 43 | |
| jmarkel44 | 12:ea87887ca7ad | 44 | }; |
| jmarkel44 | 12:ea87887ca7ad | 45 | |
| jmarkel44 | 126:c85ac6a8e9af | 46 | #define DAYS_IN_WEEK (7) |
| jmarkel44 | 126:c85ac6a8e9af | 47 | |
| jmarkel44 | 122:4db48b933115 | 48 | #define DAY_SUNDAY_MASK (1 << 0) |
| jmarkel44 | 122:4db48b933115 | 49 | #define DAY_MONDAY_MASK (1 << 1) |
| jmarkel44 | 122:4db48b933115 | 50 | #define DAY_TUESDAY_MASK (1 << 2) |
| jmarkel44 | 122:4db48b933115 | 51 | #define DAY_WEDNESDAY_MASK (1 << 3) |
| jmarkel44 | 122:4db48b933115 | 52 | #define DAY_THURSDAY_MASK (1 << 4) |
| jmarkel44 | 122:4db48b933115 | 53 | #define DAY_FRIDAY_MASK (1 << 5) |
| jmarkel44 | 122:4db48b933115 | 54 | #define DAY_SATURDAY_MASK (1 << 6) |
| jmarkel44 | 122:4db48b933115 | 55 | |
| jmarkel44 | 122:4db48b933115 | 56 | // used to decipher starting week |
| jmarkel44 | 122:4db48b933115 | 57 | typedef enum |
| jmarkel44 | 122:4db48b933115 | 58 | { |
| jmarkel44 | 122:4db48b933115 | 59 | EVERY_WEEK = 0, |
| jmarkel44 | 122:4db48b933115 | 60 | FIRST_WEEK = 1, |
| jmarkel44 | 122:4db48b933115 | 61 | SECOND_WEEK = 2, |
| jmarkel44 | 122:4db48b933115 | 62 | THIRD_WEEK = 3, |
| jmarkel44 | 122:4db48b933115 | 63 | FOURTH_WEEK = 4, |
| jmarkel44 | 122:4db48b933115 | 64 | LAST_WEEK = 5, |
| jmarkel44 | 122:4db48b933115 | 65 | EVERY_OTHER_WEEK = 6 |
| jmarkel44 | 122:4db48b933115 | 66 | } WEEKLY_CHOICES; |
| jmarkel44 | 12:ea87887ca7ad | 67 | #endif |
