First implementation of the HR sensor using 100% foss code (ported from waspos)
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include "drivers/SpiMaster.h"
|
||||
#include "drivers/SpiNorFlash.h"
|
||||
#include "drivers/TwiMaster.h"
|
||||
#include "drivers/Hrs3300.h"
|
||||
#include "main.h"
|
||||
|
||||
using namespace Pinetime::System;
|
||||
@@ -39,12 +40,14 @@ SystemTask::SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd,
|
||||
Components::LittleVgl &lvgl,
|
||||
Controllers::Battery &batteryController, Controllers::Ble &bleController,
|
||||
Controllers::DateTime &dateTimeController,
|
||||
Pinetime::Controllers::NotificationManager& notificationManager) :
|
||||
Pinetime::Controllers::NotificationManager& notificationManager,
|
||||
Pinetime::Drivers::Hrs3300& heartRateSensor) :
|
||||
spi{spi}, lcd{lcd}, spiNorFlash{spiNorFlash},
|
||||
twiMaster{twiMaster}, touchPanel{touchPanel}, lvgl{lvgl}, batteryController{batteryController},
|
||||
bleController{bleController}, dateTimeController{dateTimeController},
|
||||
watchdog{}, watchdogView{watchdog}, notificationManager{notificationManager},
|
||||
nimbleController(*this, bleController,dateTimeController, notificationManager, batteryController, spiNorFlash) {
|
||||
nimbleController(*this, bleController,dateTimeController, notificationManager, batteryController, spiNorFlash),
|
||||
heartRateSensor{heartRateSensor}{
|
||||
systemTasksMsgQueue = xQueueCreate(10, 1);
|
||||
}
|
||||
|
||||
@@ -77,12 +80,19 @@ void SystemTask::Work() {
|
||||
batteryController.Init();
|
||||
|
||||
displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController,
|
||||
dateTimeController, watchdogView, *this, notificationManager));
|
||||
dateTimeController, watchdogView, *this, notificationManager, heartRateController));
|
||||
displayApp->Start();
|
||||
|
||||
batteryController.Update();
|
||||
displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateBatteryLevel);
|
||||
|
||||
|
||||
heartRateSensor.Init();
|
||||
heartRateSensor.Disable();
|
||||
heartRateApp.reset(new Pinetime::Applications::HeartRateTask(heartRateSensor, heartRateController));
|
||||
heartRateApp->Start();
|
||||
|
||||
|
||||
nrf_gpio_cfg_sense_input(pinButton, (nrf_gpio_pin_pull_t)GPIO_PIN_CNF_PULL_Pulldown, (nrf_gpio_pin_sense_t)GPIO_PIN_CNF_SENSE_High);
|
||||
nrf_gpio_cfg_output(15);
|
||||
nrf_gpio_pin_set(15);
|
||||
|
@@ -5,6 +5,8 @@
|
||||
#include <FreeRTOS.h>
|
||||
#include <task.h>
|
||||
#include <timers.h>
|
||||
#include <heartratetask/HeartRateTask.h>
|
||||
#include <components/heartrate/HeartRateController.h>
|
||||
|
||||
#include "SystemMonitor.h"
|
||||
#include "components/battery/BatteryController.h"
|
||||
@@ -20,6 +22,7 @@ namespace Pinetime {
|
||||
class SpiNorFlash;
|
||||
class St7789;
|
||||
class TwiMaster;
|
||||
class Hrs3300;
|
||||
}
|
||||
namespace System {
|
||||
class SystemTask {
|
||||
@@ -34,7 +37,8 @@ namespace Pinetime {
|
||||
Components::LittleVgl &lvgl,
|
||||
Controllers::Battery &batteryController, Controllers::Ble &bleController,
|
||||
Controllers::DateTime &dateTimeController,
|
||||
Pinetime::Controllers::NotificationManager& manager);
|
||||
Pinetime::Controllers::NotificationManager& manager,
|
||||
Pinetime::Drivers::Hrs3300& heartRateSensor);
|
||||
|
||||
|
||||
void Start();
|
||||
@@ -58,6 +62,9 @@ namespace Pinetime {
|
||||
Pinetime::Components::LittleVgl& lvgl;
|
||||
Pinetime::Controllers::Battery& batteryController;
|
||||
std::unique_ptr<Pinetime::Applications::DisplayApp> displayApp;
|
||||
Pinetime::Controllers::HeartRateController heartRateController;
|
||||
std::unique_ptr<Pinetime::Applications::HeartRateTask> heartRateApp;
|
||||
|
||||
Pinetime::Controllers::Ble& bleController;
|
||||
Pinetime::Controllers::DateTime& dateTimeController;
|
||||
QueueHandle_t systemTasksMsgQueue;
|
||||
@@ -68,7 +75,7 @@ namespace Pinetime {
|
||||
Pinetime::Drivers::WatchdogView watchdogView;
|
||||
Pinetime::Controllers::NotificationManager& notificationManager;
|
||||
Pinetime::Controllers::NimbleController nimbleController;
|
||||
|
||||
Pinetime::Drivers::Hrs3300& heartRateSensor;
|
||||
|
||||
static constexpr uint8_t pinSpiSck = 2;
|
||||
static constexpr uint8_t pinSpiMosi = 3;
|
||||
|
Reference in New Issue
Block a user