diff options
| author | JF <jf@codingfield.com> | 2021-01-04 18:56:56 (GMT) |
|---|---|---|
| committer | Gitea <gitea@fake.local> | 2021-01-04 18:56:56 (GMT) |
| commit | 1d940af924bac5728a4d494f780e298e5b67b707 (patch) | |
| tree | 24540888f3d038ca3c88a0789b63faa8ac07d631 /src/systemtask/SystemTask.cpp | |
| parent | 04abc91f157f5925ffa404728291a69893acf8cf (diff) | |
| parent | 50ae0ae5e073ac48652e6c26549f9b19655e8da3 (diff) | |
Merge branch 'develop' of JF/PineTime into master
Diffstat (limited to 'src/systemtask/SystemTask.cpp')
| -rw-r--r-- | src/systemtask/SystemTask.cpp | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index dac4ce2..9cd2f5e 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -1,19 +1,27 @@ -#include <libraries/log/nrf_log.h> -#include <libraries/gpiote/app_gpiote.h> -#include <drivers/Cst816s.h> -#include "displayapp/LittleVgl.h" -#include <hal/nrf_rtc.h> -#include "components/ble/NotificationManager.h" -#include <host/ble_gatt.h> -#include <host/ble_hs_adv.h> #include "SystemTask.h" -#include <nimble/hci_common.h> +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max #include <host/ble_gap.h> +#include <host/ble_gatt.h> +#include <host/ble_hs_adv.h> #include <host/util/util.h> -#include <drivers/InternalFlash.h> +#include <nimble/hci_common.h> +#undef max +#undef min +#include <hal/nrf_rtc.h> +#include <libraries/gpiote/app_gpiote.h> +#include <libraries/log/nrf_log.h> + +#include "BootloaderVersion.h" +#include "components/ble/BleController.h" +#include "displayapp/LittleVgl.h" +#include "drivers/Cst816s.h" +#include "drivers/St7789.h" +#include "drivers/InternalFlash.h" +#include "drivers/SpiMaster.h" +#include "drivers/SpiNorFlash.h" +#include "drivers/TwiMaster.h" #include "main.h" -#include "components/ble/NimbleController.h" -#include "../BootloaderVersion.h" using namespace Pinetime::System; @@ -107,21 +115,22 @@ void SystemTask::Work() { while(true) { uint8_t msg; if (xQueueReceive(systemTasksMsgQueue, &msg, isSleeping ? 2500 : 1000)) { + batteryController.Update(); Messages message = static_cast<Messages >(msg); switch(message) { case Messages::GoToRunning: spi.Wakeup(); twiMaster.Wakeup(); + nimbleController.StartAdvertising(); + xTimerStart(idleTimer, 0); spiNorFlash.Wakeup(); - lcd.Wakeup(); touchPanel.Wakeup(); + lcd.Wakeup(); displayApp->PushMessage(Applications::DisplayApp::Messages::GoToRunning); displayApp->PushMessage(Applications::DisplayApp::Messages::UpdateBatteryLevel); - xTimerStart(idleTimer, 0); - nimbleController.StartAdvertising(); isSleeping = false; isWakingUp = false; break; @@ -190,12 +199,9 @@ void SystemTask::Work() { } } + monitor.Process(); uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG); dateTimeController.UpdateTime(systick_counter); - batteryController.Update(); - - monitor.Process(); - if(!nrf_gpio_pin_read(pinButton)) watchdog.Kick(); } |
