123
Fork of LG by
DeviceTimers.h@173:7f938afb0447, 2016-06-19 (annotated)
- Committer:
- Diletant
- Date:
- Sun Jun 19 03:54:35 2016 +0000
- Revision:
- 173:7f938afb0447
- Parent:
- 167:bedc0a9d559a
Device&... update. Not final!!!
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Diletant | 137:14a0c452cf32 | 1 | #ifndef __DEVICE_TIMERS_H__ |
Diletant | 137:14a0c452cf32 | 2 | #define __DEVICE_TIMERS_H__ |
Diletant | 137:14a0c452cf32 | 3 | |
Diletant | 156:e68ee0bcdcda | 4 | typedef struct _DeviceTimerSettings { |
Diletant | 156:e68ee0bcdcda | 5 | } DeviceTimerSettings; |
Diletant | 156:e68ee0bcdcda | 6 | |
Diletant | 156:e68ee0bcdcda | 7 | typedef struct _DeviceTimerState { |
Diletant | 156:e68ee0bcdcda | 8 | //Match Register 0. MR0 can be enabled through the MCR to reset the TC, stop both the TC and PC, and/or generate an interrupt every time MR0 matches the TC. |
Diletant | 156:e68ee0bcdcda | 9 | uint32_t MR0; |
Diletant | 156:e68ee0bcdcda | 10 | //Match Control Register. The MCR is used to control if an interrupt is generated and if the TC is reset when a Match occurs. |
Diletant | 156:e68ee0bcdcda | 11 | uint32_t MCR; |
Diletant | 156:e68ee0bcdcda | 12 | //Timer Control Register. The TCR is used to control the Timer Counter functions. The Timer Counter can be disabled or reset through the TCR. |
Diletant | 156:e68ee0bcdcda | 13 | uint32_t TCR; |
Diletant | 156:e68ee0bcdcda | 14 | } DeviceTimerState; |
Diletant | 156:e68ee0bcdcda | 15 | |
Diletant | 156:e68ee0bcdcda | 16 | typedef struct _DeviceTimer { |
Diletant | 156:e68ee0bcdcda | 17 | DeviceTimerSettings settings; |
Diletant | 156:e68ee0bcdcda | 18 | DeviceTimerState state; |
Diletant | 156:e68ee0bcdcda | 19 | } DeviceTimer; |
Diletant | 156:e68ee0bcdcda | 20 | |
Diletant | 167:bedc0a9d559a | 21 | void InitMeasurementTimerDefaultSettings(void); |
Diletant | 167:bedc0a9d559a | 22 | void InitMeasurementTimerState(void); |
Diletant | 167:bedc0a9d559a | 23 | void DeviceStartMeasurementTimer(void); |
Diletant | 156:e68ee0bcdcda | 24 | |
Diletant | 173:7f938afb0447 | 25 | void timersSetMeasurementPeriod(uint32_t period); |
Diletant | 173:7f938afb0447 | 26 | |
Diletant | 167:bedc0a9d559a | 27 | void InitRegularTimerDefaultSettings(void); |
Diletant | 167:bedc0a9d559a | 28 | void InitRegularTimerState(void); |
Diletant | 167:bedc0a9d559a | 29 | void DeviceStartRegularTimer(void); |
Diletant | 156:e68ee0bcdcda | 30 | |
Diletant | 173:7f938afb0447 | 31 | void timersSetRegularPeriod(uint32_t period); |
Diletant | 173:7f938afb0447 | 32 | |
Diletant | 137:14a0c452cf32 | 33 | #endif /* __DEVICE_TIMERS_H__ */ |