summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjlukanc <27705324+jlukanc1@users.noreply.github.com>2021-01-15 22:49:37 -0500
committerjlukanc <27705324+jlukanc1@users.noreply.github.com>2021-01-15 22:49:37 -0500
commitb5992fd7ec369d057ce4fe1b10bbc52ed4f6f988 (patch)
treed52601ff23e020cc057e9b9625be2c7d4db387df /src
parentce6c5d3bd3691b283ac2102d1ed7b9a298928b6c (diff)
add motor to notifs, fix tabs in motorcontroller.h
Diffstat (limited to 'src')
-rw-r--r--src/components/motor/MotorController.h88
-rw-r--r--src/displayapp/screens/Notifications.cpp4
-rw-r--r--src/displayapp/screens/Notifications.h2
3 files changed, 50 insertions, 44 deletions
diff --git a/src/components/motor/MotorController.h b/src/components/motor/MotorController.h
index 6712d933..63bc9580 100644
--- a/src/components/motor/MotorController.h
+++ b/src/components/motor/MotorController.h
@@ -7,50 +7,50 @@ namespace Pinetime {
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:
+ 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:
};
}
diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp
index 51a601c4..cfcecec2 100644
--- a/src/displayapp/screens/Notifications.cpp
+++ b/src/displayapp/screens/Notifications.cpp
@@ -7,6 +7,9 @@ Notifications::Notifications(DisplayApp *app, Pinetime::Controllers::Notificatio
Screen(app), notificationManager{notificationManager}, mode{mode} {
notificationManager.ClearNewNotificationFlag();
auto notification = notificationManager.GetLastNotification();
+
+ motorController.Init(); //start the vibration timer setups
+
if(notification.valid) {
currentId = notification.id;
currentItem.reset(new NotificationItem("\nNotification", notification.message.data(), notification.index, notificationManager.NbNotifications(), mode));
@@ -22,6 +25,7 @@ Notifications::Notifications(DisplayApp *app, Pinetime::Controllers::Notificatio
style_line.line.width = 3;
style_line.line.rounded = 0;
+ motorController.SetDuration(35);
timeoutLine = lv_line_create(lv_scr_act(), nullptr);
lv_line_set_style(timeoutLine, LV_LINE_STYLE_MAIN, &style_line);
diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h
index f5c6a860..345ad15a 100644
--- a/src/displayapp/screens/Notifications.h
+++ b/src/displayapp/screens/Notifications.h
@@ -5,6 +5,7 @@
#include <memory>
#include "Screen.h"
#include "components/ble/NotificationManager.h"
+#include "components/motor/MotorController.h"
namespace Pinetime {
namespace Applications {
@@ -45,6 +46,7 @@ namespace Pinetime {
const char* text;
};
Pinetime::Controllers::NotificationManager& notificationManager;
+ Pinetime::Controllers::MotorController motorController;
Modes mode = Modes::Normal;
std::unique_ptr<NotificationItem> currentItem;
Controllers::NotificationManager::Notification::Id currentId;