summaryrefslogtreecommitdiff
path: root/src/components/motor/MotorController.h
diff options
context:
space:
mode:
authorjlukanc <27705324+jlukanc1@users.noreply.github.com>2021-01-16 03:11:53 (GMT)
committerjlukanc <27705324+jlukanc1@users.noreply.github.com>2021-01-16 03:11:53 (GMT)
commitfbb77baa3b6e487f4c68e08770499cb893c4e035 (patch)
tree54b0606373dc4b281071ea49643744848c54c1ed /src/components/motor/MotorController.h
parent50ae0ae5e073ac48652e6c26549f9b19655e8da3 (diff)
add non-blocking motor controller
Diffstat (limited to 'src/components/motor/MotorController.h')
-rw-r--r--src/components/motor/MotorController.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/components/motor/MotorController.h b/src/components/motor/MotorController.h
new file mode 100644
index 0000000..6712d93
--- /dev/null
+++ b/src/components/motor/MotorController.h
@@ -0,0 +1,57 @@
+#pragma once
+
+#include <cstdint>
+
+namespace Pinetime {
+ namespace Controllers {
+ static constexpr uint8_t pinMotor = 16;
+
+ class MotorController {
+ public:
+ void Init();
+ void SetDuration(uint8_t motorDuration);
+ #ifndef NRF_CLOCK_ENABLED
+ #define NRF_CLOCK_ENABLED 1
+ #endif
+
+ #ifndef CLOCK_CONFIG_LF_SRC
+ #define CLOCK_CONFIG_LF_SRC 1
+ #endif
+
+ #ifndef CLOCK_CONFIG_IRQ_PRIORITY
+ #define CLOCK_CONFIG_IRQ_PRIORITY 6
+ #endif
+
+ #define APP_TIMER_ENABLED 1
+ #define APP_TIMER_CONFIG_RTC_FREQUENCY 15 //2048hz
+ #define APP_TIMER_CONFIG_IRQ_PRIORITY 6
+
+ #ifndef APP_TIMER_CONFIG_OP_QUEUE_SIZE
+ #define APP_TIMER_CONFIG_OP_QUEUE_SIZE 10
+ #endif
+
+ #ifndef APP_TIMER_CONFIG_USE_SCHEDULER
+ #define APP_TIMER_CONFIG_USE_SCHEDULER 0
+ #endif
+
+ #ifndef APP_TIMER_KEEPS_RTC_ACTIVE
+ #define APP_TIMER_KEEPS_RTC_ACTIVE 0
+ #endif
+
+ #ifndef APP_TIMER_SAFE_WINDOW_MS
+ #define APP_TIMER_SAFE_WINDOW_MS 300000
+ #endif
+
+ #ifndef APP_TIMER_WITH_PROFILER
+ #define APP_TIMER_WITH_PROFILER 0
+ #endif
+
+ #ifndef APP_TIMER_CONFIG_SWI_NUMBER
+ #define APP_TIMER_CONFIG_SWI_NUMBER 0
+ #endif
+
+ private:
+
+ };
+ }
+} \ No newline at end of file