summaryrefslogtreecommitdiffstatshomepage
path: root/cc3200/mods/pybrtc.h
diff options
context:
space:
mode:
Diffstat (limited to 'cc3200/mods/pybrtc.h')
-rw-r--r--cc3200/mods/pybrtc.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/cc3200/mods/pybrtc.h b/cc3200/mods/pybrtc.h
index 06c4868db7..5111b78f7c 100644
--- a/cc3200/mods/pybrtc.h
+++ b/cc3200/mods/pybrtc.h
@@ -28,12 +28,32 @@
#ifndef PYBRTC_H_
#define PYBRTC_H_
-#define RTC_U16MS_CYCLES(msec) ((msec * 1024) / 1000)
-#define RTC_CYCLES_U16MS(cycles) ((cycles * 1000) / 1024)
+// RTC triggers
+#define PYB_RTC_ALARM0 (0x01)
+
+#define RTC_ACCESS_TIME_MSEC (5)
+#define PYB_RTC_MIN_ALARM_TIME_MS (RTC_ACCESS_TIME_MSEC * 2)
+
+typedef struct _pyb_rtc_obj_t {
+ mp_obj_base_t base;
+ mp_obj_t irq_obj;
+ uint32_t irq_flags;
+ uint32_t alarm_ms;
+ uint32_t alarm_time_s;
+ uint16_t alarm_time_ms;
+ byte pwrmode;
+ bool alarmset;
+ bool repeat;
+ bool irq_enabled;
+} pyb_rtc_obj_t;
extern const mp_obj_type_t pyb_rtc_type;
extern void pyb_rtc_pre_init(void);
+extern void pyb_rtc_get_time (uint32_t *secs, uint16_t *msecs);
extern uint32_t pyb_rtc_get_seconds (void);
+extern void pyb_rtc_calc_future_time (uint32_t a_mseconds, uint32_t *f_seconds, uint16_t *f_mseconds);
+extern void pyb_rtc_repeat_alarm (pyb_rtc_obj_t *self);
+extern void pyb_rtc_disable_alarm (void);
#endif // PYBRTC_H_