summaryrefslogtreecommitdiff
path: root/include/nitro/OS_timer_shared.h
diff options
context:
space:
mode:
authorRevo <projectrevotpp@hotmail.com>2020-06-25 01:30:36 -0400
committerGitHub <noreply@github.com>2020-06-25 01:30:36 -0400
commit40c3f6e85a2d25d3d98b2cfdaf1dd6872bbb4a6d (patch)
treea3b78fd54d27e7ead3c0ec3ff7e62ca87909a8e0 /include/nitro/OS_timer_shared.h
parentce09e79eb9ca2b384fb1c64f0946661b30ae75ea (diff)
parente34791ca4a781fc37717ac0ea7c2ac9fd5d65c2e (diff)
Merge pull request #188 from Cleverking2003/master
OS_tick
Diffstat (limited to 'include/nitro/OS_timer_shared.h')
-rw-r--r--include/nitro/OS_timer_shared.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/include/nitro/OS_timer_shared.h b/include/nitro/OS_timer_shared.h
new file mode 100644
index 00000000..db20ee08
--- /dev/null
+++ b/include/nitro/OS_timer_shared.h
@@ -0,0 +1,32 @@
+#ifndef POKEDIAMOND_OS_TIMER_SHARED_H
+#define POKEDIAMOND_OS_TIMER_SHARED_H
+
+#include "nitro/consts_shared.h"
+
+typedef enum
+{
+ OS_TIMER_PRESCALER_1 = (0UL << REG_OS_TM0CNT_H_PS_SHIFT),
+ OS_TIMER_PRESCALER_64 = (1UL << REG_OS_TM0CNT_H_PS_SHIFT),
+ OS_TIMER_PRESCALER_256 = (2UL << REG_OS_TM0CNT_H_PS_SHIFT),
+ OS_TIMER_PRESCALER_1024 = (3UL << REG_OS_TM0CNT_H_PS_SHIFT)
+} OSTimerPrescaler;
+
+typedef enum
+{
+ OS_TIMER_0 = 0,
+ OS_TIMER_1 = 1,
+ OS_TIMER_2 = 2,
+ OS_TIMER_3 = 3
+} OSTimer;
+
+static inline void OS_SetTimerCount(OSTimer id, u16 count)
+{
+ *((REGType16 *)((u32)&reg_OS_TM0CNT_L + id * 4)) = count;
+}
+
+static inline void OS_SetTimerControl(OSTimer id, u16 control)
+{
+ *((REGType16 *)((u32)&reg_OS_TM0CNT_H + id * 4)) = control;
+}
+
+#endif