diff --git a/.clang-format b/.clang-format index e7355499..7430d4d6 100644 --- a/.clang-format +++ b/.clang-format @@ -21,8 +21,8 @@ AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: MultiLine -BinPackArguments: true -BinPackParameters: true +BinPackArguments: false +BinPackParameters: false BraceWrapping: AfterCaseLabel: false AfterClass: false @@ -52,14 +52,14 @@ BreakStringLiterals: true ColumnLimit: 140 CommentPragmas: '^ IWYU pragma:' CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 2 ContinuationIndentWidth: 2 Cpp11BracedListStyle: true DeriveLineEnding: false DerivePointerAlignment: false DisableFormat: false -ExperimentalAutoDetectBinPacking: false +ExperimentalAutoDetectBinPacking: true FixNamespaceComments: false ForEachMacros: - foreach @@ -90,10 +90,6 @@ MacroBlockBegin: '' MacroBlockEnd: '' MaxEmptyLinesToKeep: 1 NamespaceIndentation: All -ObjCBinPackProtocolList: Auto -ObjCBlockIndentWidth: 2 -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true PenaltyBreakAssignment: 2 PenaltyBreakBeforeFirstCallParameter: 19 PenaltyBreakComment: 300 diff --git a/.gitignore b/.gitignore index 100e2580..2f9ac181 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ .idea/ +# Python virtual environment for DFU images +.venv/ + # CMake cmake-build-* cmake-* diff --git a/README.md b/README.md index 55afcc57..34f6e841 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,7 @@ The goal of this project is to design an open-source firmware for the Pinetime s ## Overview -![Pinetime screens](images/0.14.0/collage1.png "PinetimeScreens") -![Pinetime screens](images/0.14.0/collage2.png "PinetimeScreens") +![Pinetime screens](images/1.0.0/collage.png "PinetimeScreens") As of now, here is the list of achievements of this project: @@ -37,10 +36,15 @@ As of now, here is the list of achievements of this project: - Heart rate measurements - Step counting - Wake-up on wrist rotation - - Multiple 'apps' : - * Clock (displays the date, time, battery level, ble connection status, heart rate) - * System info (displays various info : BLE MAC, build date/time, uptime, version,...) - * Brightess (allows the user to configure the brightness of the display) + - Quick actions + * Disable vibration on notification + * Brightness settings + * Flashlight + * Settings + - 2 watch faces: + * Digital + * Analog + - Multiple 'apps' : * Music (control the playback of the music on your phone) * Heart rate (controls the heart rate sensor and display current heartbeat) * Navigation (displays navigation instructions coming from the companion app) @@ -48,13 +52,22 @@ As of now, here is the list of achievements of this project: * Paddle (single player pong-like game) * Two (2048 clone game) * Stopwatch (with all the necessary functions such as play, pause, lap, stop) + * Motion sensor and step counter (displays the number of steps and the state of the motion sensor in real-time) + - User settings: + * Display timeout + * Wake-up condition + * Time format (12/24h) + * Default watch face + * Battery status + * Firmware validation + * System information - Supported by 3 companion apps (development is in progress): * [Gadgetbridge](https://codeberg.org/Freeyourgadget/Gadgetbridge/) (on Android) * [Amazfish](https://openrepos.net/content/piggz/amazfish) (on SailfishOS and Linux) * [Siglo](https://github.com/alexr4535/siglo) (on Linux) * **[Experimental]** [WebBLEWatch](https://hubmartin.github.io/WebBLEWatch/) Synchronize time directly from your web browser. [video](https://youtu.be/IakiuhVDdrY) - - **[Experimental]** OTA (Over-the-air) update via BLE - - **[Experimental]** Bootloader based on [MCUBoot](https://juullabs-oss.github.io/mcuboot/) + - OTA (Over-the-air) update via BLE + - [Bootloader](https://github.com/JF002/pinetime-mcuboot-bootloader) based on [MCUBoot](https://juullabs-oss.github.io/mcuboot/) ## Documentation @@ -62,7 +75,7 @@ As of now, here is the list of achievements of this project: - [Flash, upgrade (OTA), time synchronization,...](doc/gettingStarted/gettingStarted.md) ### Develop - - [Generate the fonts and symbols](src/displayapp/fonts/Readme.md) + - [Generate the fonts and symbols](src/displayapp/fonts/README.md) - [Creating a stopwatch in Pinetime(article)](https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html) ### Build, flash and debug diff --git a/images/1.0.0/collage.png b/images/1.0.0/collage.png new file mode 100644 index 00000000..b9ffaa88 Binary files /dev/null and b/images/1.0.0/collage.png differ diff --git a/src/BootloaderVersion.cpp b/src/BootloaderVersion.cpp index 8555593f..5eba7a1d 100644 --- a/src/BootloaderVersion.cpp +++ b/src/BootloaderVersion.cpp @@ -17,7 +17,7 @@ uint32_t BootloaderVersion::Patch() { return 0; } -const char *BootloaderVersion::VersionString() { +const char* BootloaderVersion::VersionString() { return "0.0.0"; } diff --git a/src/BootloaderVersion.h b/src/BootloaderVersion.h index c7fcbd98..c1ede0f5 100644 --- a/src/BootloaderVersion.h +++ b/src/BootloaderVersion.h @@ -2,11 +2,11 @@ namespace Pinetime { class BootloaderVersion { - public: - static uint32_t Major(); - static uint32_t Minor(); - static uint32_t Patch(); - static const char* VersionString(); - static bool IsValid(); + public: + static uint32_t Major(); + static uint32_t Minor(); + static uint32_t Patch(); + static const char* VersionString(); + static bool IsValid(); }; } \ No newline at end of file diff --git a/src/FreeRTOSConfig.h b/src/FreeRTOSConfig.h index b4de26fa..15185766 100644 --- a/src/FreeRTOSConfig.h +++ b/src/FreeRTOSConfig.h @@ -26,20 +26,19 @@ * 1 tab == 4 spaces! */ - #ifndef FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H #ifdef SOFTDEVICE_PRESENT -#include "nrf_soc.h" + #include "nrf_soc.h" #endif #include "app_util_platform.h" /*----------------------------------------------------------- * Possible configurations for system timer */ -#define FREERTOS_USE_RTC 0 /**< Use real time clock for the system */ -#define FREERTOS_USE_SYSTICK 1 /**< Use SysTick timer for system */ +#define FREERTOS_USE_RTC 0 /**< Use real time clock for the system */ +#define FREERTOS_USE_SYSTICK 1 /**< Use SysTick timer for system */ /*----------------------------------------------------------- * Application specific definitions. @@ -55,153 +54,150 @@ #define configTICK_SOURCE FREERTOS_USE_RTC -#define configUSE_PREEMPTION 1 +#define configUSE_PREEMPTION 1 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 -#define configUSE_TICKLESS_IDLE 1 -#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 0 /* See into vPortSuppressTicksAndSleep source code for explanation */ -#define configCPU_CLOCK_HZ ( SystemCoreClock ) -#define configTICK_RATE_HZ 1024 -#define configMAX_PRIORITIES ( 3 ) -#define configMINIMAL_STACK_SIZE ( 120 ) -#define configTOTAL_HEAP_SIZE ( 1024*16 ) -#define configMAX_TASK_NAME_LEN ( 4 ) -#define configUSE_16_BIT_TICKS 0 -#define configIDLE_SHOULD_YIELD 1 -#define configUSE_MUTEXES 1 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_COUNTING_SEMAPHORES 1 -#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */ -#define configQUEUE_REGISTRY_SIZE 2 -#define configUSE_QUEUE_SETS 0 -#define configUSE_TIME_SLICING 0 -#define configUSE_NEWLIB_REENTRANT 0 -#define configENABLE_BACKWARD_COMPATIBILITY 1 +#define configUSE_TICKLESS_IDLE 1 +#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 0 /* See into vPortSuppressTicksAndSleep source code for explanation */ +#define configCPU_CLOCK_HZ (SystemCoreClock) +#define configTICK_RATE_HZ 1024 +#define configMAX_PRIORITIES (3) +#define configMINIMAL_STACK_SIZE (120) +#define configTOTAL_HEAP_SIZE (1024 * 16) +#define configMAX_TASK_NAME_LEN (4) +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 1 +#define configUSE_MUTEXES 1 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */ +#define configQUEUE_REGISTRY_SIZE 2 +#define configUSE_QUEUE_SETS 0 +#define configUSE_TIME_SLICING 0 +#define configUSE_NEWLIB_REENTRANT 0 +#define configENABLE_BACKWARD_COMPATIBILITY 1 /* Hook function related definitions. */ -#define configUSE_IDLE_HOOK 1 -#define configUSE_TICK_HOOK 0 -#define configCHECK_FOR_STACK_OVERFLOW 0 -#define configUSE_MALLOC_FAILED_HOOK 0 +#define configUSE_IDLE_HOOK 1 +#define configUSE_TICK_HOOK 0 +#define configCHECK_FOR_STACK_OVERFLOW 0 +#define configUSE_MALLOC_FAILED_HOOK 0 /* Run time and task stats gathering related definitions. */ -#define configGENERATE_RUN_TIME_STATS 0 -#define configUSE_TRACE_FACILITY 1 -#define configUSE_STATS_FORMATTING_FUNCTIONS 0 +#define configGENERATE_RUN_TIME_STATS 0 +#define configUSE_TRACE_FACILITY 1 +#define configUSE_STATS_FORMATTING_FUNCTIONS 0 /* Co-routine definitions. */ -#define configUSE_CO_ROUTINES 0 -#define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES (2) /* Software timer definitions. */ -#define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY ( 0 ) -#define configTIMER_QUEUE_LENGTH 32 -#define configTIMER_TASK_STACK_DEPTH ( 300 ) +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY (0) +#define configTIMER_QUEUE_LENGTH 32 +#define configTIMER_TASK_STACK_DEPTH (300) /* Tickless Idle configuration. */ -#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2 +#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2 /* Tickless idle/low power functionality. */ - /* Define to trap errors during development. */ #if defined(DEBUG_NRF) || defined(DEBUG_NRF_USER) -#define configASSERT( x ) ASSERT(x) + #define configASSERT(x) ASSERT(x) #endif /* FreeRTOS MPU specific definitions. */ -#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 1 +#define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 1 /* Optional functions - most linkers will remove unused functions anyway. */ -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_xResumeFromISR 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_xTaskGetSchedulerState 1 -#define INCLUDE_xTaskGetCurrentTaskHandle 1 -#define INCLUDE_uxTaskGetStackHighWaterMark 1 -#define INCLUDE_xTaskGetIdleTaskHandle 1 -#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1 -#define INCLUDE_pcTaskGetTaskName 1 -#define INCLUDE_eTaskGetState 1 -#define INCLUDE_xEventGroupSetBitFromISR 1 -#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_xResumeFromISR 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTaskGetSchedulerState 1 +#define INCLUDE_xTaskGetCurrentTaskHandle 1 +#define INCLUDE_uxTaskGetStackHighWaterMark 1 +#define INCLUDE_xTaskGetIdleTaskHandle 1 +#define INCLUDE_xTimerGetTimerDaemonTaskHandle 1 +#define INCLUDE_pcTaskGetTaskName 1 +#define INCLUDE_eTaskGetState 1 +#define INCLUDE_xEventGroupSetBitFromISR 1 +#define INCLUDE_xTimerPendFunctionCall 1 /* The lowest interrupt priority that can be used in a call to a "set priority" function. */ -#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf +#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf /* The highest interrupt priority that can be used by any interrupt service routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values. */ -#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY _PRIO_APP_HIGH - +#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY _PRIO_APP_HIGH /* Interrupt priorities used by the kernel port layer itself. These are generic to all Cortex-M ports, and do not rely on any particular library functions. */ -#define configKERNEL_INTERRUPT_PRIORITY configLIBRARY_LOWEST_INTERRUPT_PRIORITY +#define configKERNEL_INTERRUPT_PRIORITY configLIBRARY_LOWEST_INTERRUPT_PRIORITY /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ -#define configMAX_SYSCALL_INTERRUPT_PRIORITY configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY +#define configMAX_SYSCALL_INTERRUPT_PRIORITY configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS standard names - or at least those used in the unmodified vector table. */ -#define vPortSVCHandler SVC_Handler -#define xPortPendSVHandler PendSV_Handler - +#define vPortSVCHandler SVC_Handler +#define xPortPendSVHandler PendSV_Handler /*----------------------------------------------------------- * Settings that are generated automatically * basing on the settings above */ #if (configTICK_SOURCE == FREERTOS_USE_SYSTICK) - // do not define configSYSTICK_CLOCK_HZ for SysTick to be configured automatically - // to CPU clock source - #define xPortSysTickHandler SysTick_Handler + // do not define configSYSTICK_CLOCK_HZ for SysTick to be configured automatically + // to CPU clock source + #define xPortSysTickHandler SysTick_Handler #elif (configTICK_SOURCE == FREERTOS_USE_RTC) - #define configSYSTICK_CLOCK_HZ ( 32768UL ) - #define xPortSysTickHandler RTC1_IRQHandler + #define configSYSTICK_CLOCK_HZ (32768UL) + #define xPortSysTickHandler RTC1_IRQHandler #else - #error Unsupported configTICK_SOURCE value + #error Unsupported configTICK_SOURCE value #endif /* Code below should be only used by the compiler, and not the assembler. */ #if !(defined(__ASSEMBLY__) || defined(__ASSEMBLER__)) - #include "nrf.h" - #include "nrf_assert.h" + #include "nrf.h" + #include "nrf_assert.h" - /* This part of definitions may be problematic in assembly - it uses definitions from files that are not assembly compatible. */ - /* Cortex-M specific definitions. */ - #ifdef __NVIC_PRIO_BITS - /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ - #define configPRIO_BITS __NVIC_PRIO_BITS - #else - #error "This port requires __NVIC_PRIO_BITS to be defined" - #endif + /* This part of definitions may be problematic in assembly - it uses definitions from files that are not assembly compatible. */ + /* Cortex-M specific definitions. */ + #ifdef __NVIC_PRIO_BITS + /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ + #define configPRIO_BITS __NVIC_PRIO_BITS + #else + #error "This port requires __NVIC_PRIO_BITS to be defined" + #endif - /* Access to current system core clock is required only if we are ticking the system by systimer */ - #if (configTICK_SOURCE == FREERTOS_USE_SYSTICK) - #include - extern uint32_t SystemCoreClock; - #endif + /* Access to current system core clock is required only if we are ticking the system by systimer */ + #if (configTICK_SOURCE == FREERTOS_USE_SYSTICK) + #include +extern uint32_t SystemCoreClock; + #endif #endif /* !assembler */ /** Implementation note: Use this with caution and set this to 1 ONLY for debugging * ---------------------------------------------------------- - * Set the value of configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to below for enabling or disabling RTOS tick auto correction: - * 0. This is default. If the RTC tick interrupt is masked for more than 1 tick by higher priority interrupts, then most likely - * one or more RTC ticks are lost. The tick interrupt inside RTOS will detect this and make a correction needed. This is needed - * for the RTOS internal timers to be more accurate. - * 1. The auto correction for RTOS tick is disabled even though few RTC tick interrupts were lost. This feature is desirable when debugging - * the RTOS application and stepping though the code. After stepping when the application is continued in debug mode, the auto-corrections of - * RTOS tick might cause asserts. Setting configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to 1 will make RTC and RTOS go out of sync but could be - * convenient for debugging. - */ -#define configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG 0 + * Set the value of configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to below for enabling or disabling RTOS tick auto correction: + * 0. This is default. If the RTC tick interrupt is masked for more than 1 tick by higher priority interrupts, then most likely + * one or more RTC ticks are lost. The tick interrupt inside RTOS will detect this and make a correction needed. This is needed + * for the RTOS internal timers to be more accurate. + * 1. The auto correction for RTOS tick is disabled even though few RTC tick interrupts were lost. This feature is desirable when debugging + * the RTOS application and stepping though the code. After stepping when the application is continued in debug mode, the + * auto-corrections of RTOS tick might cause asserts. Setting configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG to 1 will make RTC and RTOS go + * out of sync but could be convenient for debugging. + */ +#define configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG 0 #endif /* FREERTOS_CONFIG_H */ diff --git a/src/components/battery/BatteryController.cpp b/src/components/battery/BatteryController.cpp index 99afa55c..b39efefb 100644 --- a/src/components/battery/BatteryController.cpp +++ b/src/components/battery/BatteryController.cpp @@ -7,33 +7,33 @@ using namespace Pinetime::Controllers; -Battery *Battery::instance = nullptr; +Battery* Battery::instance = nullptr; Battery::Battery() { instance = this; } void Battery::Init() { - nrf_gpio_cfg_input(chargingPin, (nrf_gpio_pin_pull_t)GPIO_PIN_CNF_PULL_Pullup); - nrf_gpio_cfg_input(powerPresentPin, (nrf_gpio_pin_pull_t)GPIO_PIN_CNF_PULL_Pullup); + nrf_gpio_cfg_input(chargingPin, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pullup); + nrf_gpio_cfg_input(powerPresentPin, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pullup); } void Battery::Update() { isCharging = !nrf_gpio_pin_read(chargingPin); isPowerPresent = !nrf_gpio_pin_read(powerPresentPin); - - if ( isReading ) return; + + if (isReading) + return; // Non blocking read samples = 0; isReading = true; - SaadcInit(); + SaadcInit(); - nrfx_saadc_sample(); - + nrfx_saadc_sample(); } -void Battery::adcCallbackStatic(nrfx_saadc_evt_t const *event) { +void Battery::adcCallbackStatic(nrfx_saadc_evt_t const* event) { instance->SaadcEventHandler(event); } @@ -41,48 +41,44 @@ void Battery::SaadcInit() { nrfx_saadc_config_t adcConfig = NRFX_SAADC_DEFAULT_CONFIG; APP_ERROR_CHECK(nrfx_saadc_init(&adcConfig, adcCallbackStatic)); - nrf_saadc_channel_config_t adcChannelConfig = { - .resistor_p = NRF_SAADC_RESISTOR_DISABLED, - .resistor_n = NRF_SAADC_RESISTOR_DISABLED, - .gain = NRF_SAADC_GAIN1_5, - .reference = NRF_SAADC_REFERENCE_INTERNAL, - .acq_time = NRF_SAADC_ACQTIME_3US, - .mode = NRF_SAADC_MODE_SINGLE_ENDED, - .burst = NRF_SAADC_BURST_ENABLED, - .pin_p = batteryVoltageAdcInput, - .pin_n = NRF_SAADC_INPUT_DISABLED - }; + nrf_saadc_channel_config_t adcChannelConfig = {.resistor_p = NRF_SAADC_RESISTOR_DISABLED, + .resistor_n = NRF_SAADC_RESISTOR_DISABLED, + .gain = NRF_SAADC_GAIN1_5, + .reference = NRF_SAADC_REFERENCE_INTERNAL, + .acq_time = NRF_SAADC_ACQTIME_3US, + .mode = NRF_SAADC_MODE_SINGLE_ENDED, + .burst = NRF_SAADC_BURST_ENABLED, + .pin_p = batteryVoltageAdcInput, + .pin_n = NRF_SAADC_INPUT_DISABLED}; APP_ERROR_CHECK(nrfx_saadc_channel_init(0, &adcChannelConfig)); APP_ERROR_CHECK(nrfx_saadc_buffer_convert(&saadc_value, 1)); - } -void Battery::SaadcEventHandler(nrfx_saadc_evt_t const * p_event) { +void Battery::SaadcEventHandler(nrfx_saadc_evt_t const* p_event) { - const float battery_max = 4.18; // maximum voltage of battery ( max charging voltage is 4.21 ) - const float battery_min = 3.20; // minimum voltage of battery before shutdown ( depends on the battery ) + const float battery_max = 4.18; // maximum voltage of battery ( max charging voltage is 4.21 ) + const float battery_min = 3.20; // minimum voltage of battery before shutdown ( depends on the battery ) - if (p_event->type == NRFX_SAADC_EVT_DONE) { - - APP_ERROR_CHECK(nrfx_saadc_buffer_convert(&saadc_value, 1)); + if (p_event->type == NRFX_SAADC_EVT_DONE) { - voltage = (static_cast(p_event->data.done.p_buffer[0]) * 2.04f) / (1024 / 3.0f); - voltage = roundf(voltage * 100) / 100; + APP_ERROR_CHECK(nrfx_saadc_buffer_convert(&saadc_value, 1)); - percentRemaining = static_cast(((voltage - battery_min) / (battery_max - battery_min)) * 100); + voltage = (static_cast(p_event->data.done.p_buffer[0]) * 2.04f) / (1024 / 3.0f); + voltage = roundf(voltage * 100) / 100; - percentRemaining = std::max(percentRemaining, 0); - percentRemaining = std::min(percentRemaining, 100); + percentRemaining = static_cast(((voltage - battery_min) / (battery_max - battery_min)) * 100); - percentRemainingBuffer.insert(percentRemaining); + percentRemaining = std::max(percentRemaining, 0); + percentRemaining = std::min(percentRemaining, 100); - samples++; - if ( samples > percentRemainingSamples ) { - nrfx_saadc_uninit(); - isReading = false; - } else { - nrfx_saadc_sample(); - } + percentRemainingBuffer.insert(percentRemaining); + + samples++; + if (samples > percentRemainingSamples) { + nrfx_saadc_uninit(); + isReading = false; + } else { + nrfx_saadc_sample(); } } - +} diff --git a/src/components/battery/BatteryController.h b/src/components/battery/BatteryController.h index 47d7a6d1..04bcf6b8 100644 --- a/src/components/battery/BatteryController.h +++ b/src/components/battery/BatteryController.h @@ -7,18 +7,18 @@ namespace Pinetime { namespace Controllers { - /** A simple circular buffer that can be used to average - out the sensor values. The total capacity of the CircBuffer + /** A simple circular buffer that can be used to average + out the sensor values. The total capacity of the CircBuffer is given as the template parameter N. - */ - template - class CircBuffer { + */ + template class CircBuffer { public: - CircBuffer() : arr{}, sz{}, cap{N}, head{} {} + CircBuffer() : arr {}, sz {}, cap {N}, head {} { + } /** - insert member function overwrites the next data to the current + insert member function overwrites the next data to the current HEAD and moves the HEAD to the newly inserted value. - */ + */ void insert(const int num) { head %= cap; arr[head++] = num; @@ -34,49 +34,56 @@ namespace Pinetime { private: std::array arr; /**< internal array used to store the values*/ - uint8_t sz; /**< The current size of the array.*/ - uint8_t cap; /**< Total capacity of the CircBuffer.*/ - uint8_t head; /**< The current head of the CircBuffer*/ + uint8_t sz; /**< The current size of the array.*/ + uint8_t cap; /**< Total capacity of the CircBuffer.*/ + uint8_t head; /**< The current head of the CircBuffer*/ }; class Battery { - public: + public: + Battery(); - Battery(); + void Init(); + void Update(); - void Init(); - void Update(); - - int PercentRemaining() const { return percentRemainingBuffer.GetAverage(); } + int PercentRemaining() const { + return percentRemainingBuffer.GetAverage(); + } - float Voltage() const { return voltage; } + float Voltage() const { + return voltage; + } - bool IsCharging() const { return isCharging; } - bool IsPowerPresent() const { return isPowerPresent; } + bool IsCharging() const { + return isCharging; + } + bool IsPowerPresent() const { + return isPowerPresent; + } - private: - static Battery *instance; - nrf_saadc_value_t saadc_value; - - static constexpr uint8_t percentRemainingSamples = 5; - CircBuffer percentRemainingBuffer {}; + private: + static Battery* instance; + nrf_saadc_value_t saadc_value; - static constexpr uint32_t chargingPin = 12; - static constexpr uint32_t powerPresentPin = 19; - static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7; - float voltage = 0.0f; - int percentRemaining = -1; + static constexpr uint8_t percentRemainingSamples = 5; + CircBuffer percentRemainingBuffer {}; - bool isCharging = false; - bool isPowerPresent = false; - - void SaadcInit(); + static constexpr uint32_t chargingPin = 12; + static constexpr uint32_t powerPresentPin = 19; + static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7; + float voltage = 0.0f; + int percentRemaining = -1; - void SaadcEventHandler(nrfx_saadc_evt_t const * p_event); - static void adcCallbackStatic(nrfx_saadc_evt_t const *event); + bool isCharging = false; + bool isPowerPresent = false; - bool isReading = false; - uint8_t samples = 0; + void SaadcInit(); + + void SaadcEventHandler(nrfx_saadc_evt_t const* p_event); + static void adcCallbackStatic(nrfx_saadc_evt_t const* event); + + bool isReading = false; + uint8_t samples = 0; }; } } \ No newline at end of file diff --git a/src/components/ble/AlertNotificationClient.cpp b/src/components/ble/AlertNotificationClient.cpp index 9efede39..6043a129 100644 --- a/src/components/ble/AlertNotificationClient.cpp +++ b/src/components/ble/AlertNotificationClient.cpp @@ -12,50 +12,42 @@ constexpr ble_uuid16_t AlertNotificationClient::unreadAlertStatusUuid; constexpr ble_uuid16_t AlertNotificationClient::controlPointUuid; namespace { - int - OnDiscoveryEventCallback(uint16_t conn_handle, const struct ble_gatt_error *error, const struct ble_gatt_svc *service, - void *arg) { - auto client = static_cast(arg); + int OnDiscoveryEventCallback(uint16_t conn_handle, const struct ble_gatt_error* error, const struct ble_gatt_svc* service, void* arg) { + auto client = static_cast(arg); return client->OnDiscoveryEvent(conn_handle, error, service); } - int OnAlertNotificationCharacteristicDiscoveredCallback(uint16_t conn_handle, const struct ble_gatt_error *error, - const struct ble_gatt_chr *chr, void *arg) { - auto client = static_cast(arg); + int OnAlertNotificationCharacteristicDiscoveredCallback(uint16_t conn_handle, + const struct ble_gatt_error* error, + const struct ble_gatt_chr* chr, + void* arg) { + auto client = static_cast(arg); return client->OnCharacteristicsDiscoveryEvent(conn_handle, error, chr); } - int OnAlertNotificationDescriptorDiscoveryEventCallback(uint16_t conn_handle, - const struct ble_gatt_error *error, - uint16_t chr_val_handle, - const struct ble_gatt_dsc *dsc, - void *arg) { - auto client = static_cast(arg); + int OnAlertNotificationDescriptorDiscoveryEventCallback( + uint16_t conn_handle, const struct ble_gatt_error* error, uint16_t chr_val_handle, const struct ble_gatt_dsc* dsc, void* arg) { + auto client = static_cast(arg); return client->OnDescriptorDiscoveryEventCallback(conn_handle, error, chr_val_handle, dsc); } - int NewAlertSubcribeCallback(uint16_t conn_handle, - const struct ble_gatt_error *error, - struct ble_gatt_attr *attr, - void *arg) { - auto client = static_cast(arg); + int NewAlertSubcribeCallback(uint16_t conn_handle, const struct ble_gatt_error* error, struct ble_gatt_attr* attr, void* arg) { + auto client = static_cast(arg); return client->OnNewAlertSubcribe(conn_handle, error, attr); } } -AlertNotificationClient::AlertNotificationClient(Pinetime::System::SystemTask &systemTask, - Pinetime::Controllers::NotificationManager ¬ificationManager) : - systemTask{systemTask}, notificationManager{notificationManager} { +AlertNotificationClient::AlertNotificationClient(Pinetime::System::SystemTask& systemTask, + Pinetime::Controllers::NotificationManager& notificationManager) + : systemTask {systemTask}, notificationManager {notificationManager} { } -bool AlertNotificationClient::OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, - const ble_gatt_svc *service) { +bool AlertNotificationClient::OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_svc* service) { if (service == nullptr && error->status == BLE_HS_EDONE) { if (isDiscovered) { NRF_LOG_INFO("ANS Discovery found, starting characteristics discovery"); - ble_gattc_disc_all_chrs(connectionHandle, ansStartHandle, ansEndHandle, - OnAlertNotificationCharacteristicDiscoveredCallback, this); + ble_gattc_disc_all_chrs(connectionHandle, ansStartHandle, ansEndHandle, OnAlertNotificationCharacteristicDiscoveredCallback, this); } else { NRF_LOG_INFO("ANS not found"); onServiceDiscovered(connectionHandle); @@ -63,7 +55,7 @@ bool AlertNotificationClient::OnDiscoveryEvent(uint16_t connectionHandle, const return true; } - if (service != nullptr && ble_uuid_cmp(((ble_uuid_t *) &ansServiceUuid), &service->uuid.u) == 0) { + if (service != nullptr && ble_uuid_cmp(((ble_uuid_t*) &ansServiceUuid), &service->uuid.u) == 0) { NRF_LOG_INFO("ANS discovered : 0x%x - 0x%x", service->start_handle, service->end_handle); ansStartHandle = service->start_handle; ansEndHandle = service->end_handle; @@ -72,8 +64,9 @@ bool AlertNotificationClient::OnDiscoveryEvent(uint16_t connectionHandle, const return false; } -int AlertNotificationClient::OnCharacteristicsDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, - const ble_gatt_chr *characteristic) { +int AlertNotificationClient::OnCharacteristicsDiscoveryEvent(uint16_t connectionHandle, + const ble_gatt_error* error, + const ble_gatt_chr* characteristic) { if (error->status != 0 && error->status != BLE_HS_EDONE) { NRF_LOG_INFO("ANS Characteristic discovery ERROR"); onServiceDiscovered(connectionHandle); @@ -83,41 +76,34 @@ int AlertNotificationClient::OnCharacteristicsDiscoveryEvent(uint16_t connection if (characteristic == nullptr && error->status == BLE_HS_EDONE) { NRF_LOG_INFO("ANS Characteristic discovery complete"); if (isCharacteristicDiscovered) { - ble_gattc_disc_all_dscs(connectionHandle, - newAlertHandle, ansEndHandle, - OnAlertNotificationDescriptorDiscoveryEventCallback, this); + ble_gattc_disc_all_dscs(connectionHandle, newAlertHandle, ansEndHandle, OnAlertNotificationDescriptorDiscoveryEventCallback, this); } else onServiceDiscovered(connectionHandle); } else { - if (characteristic != nullptr && - ble_uuid_cmp(((ble_uuid_t *) &supportedNewAlertCategoryUuid), &characteristic->uuid.u) == 0) { + if (characteristic != nullptr && ble_uuid_cmp(((ble_uuid_t*) &supportedNewAlertCategoryUuid), &characteristic->uuid.u) == 0) { NRF_LOG_INFO("ANS Characteristic discovered : supportedNewAlertCategoryUuid"); supportedNewAlertCategoryHandle = characteristic->val_handle; - } else if (characteristic != nullptr && - ble_uuid_cmp(((ble_uuid_t *) &supportedUnreadAlertCategoryUuid), &characteristic->uuid.u) == 0) { + } else if (characteristic != nullptr && ble_uuid_cmp(((ble_uuid_t*) &supportedUnreadAlertCategoryUuid), &characteristic->uuid.u) == 0) { NRF_LOG_INFO("ANS Characteristic discovered : supportedUnreadAlertCategoryUuid"); supportedUnreadAlertCategoryHandle = characteristic->val_handle; - } else if (characteristic != nullptr && - ble_uuid_cmp(((ble_uuid_t *) &newAlertUuid), &characteristic->uuid.u) == 0) { + } else if (characteristic != nullptr && ble_uuid_cmp(((ble_uuid_t*) &newAlertUuid), &characteristic->uuid.u) == 0) { NRF_LOG_INFO("ANS Characteristic discovered : newAlertUuid"); newAlertHandle = characteristic->val_handle; newAlertDefHandle = characteristic->def_handle; isCharacteristicDiscovered = true; - } else if (characteristic != nullptr && - ble_uuid_cmp(((ble_uuid_t *) &unreadAlertStatusUuid), &characteristic->uuid.u) == 0) { + } else if (characteristic != nullptr && ble_uuid_cmp(((ble_uuid_t*) &unreadAlertStatusUuid), &characteristic->uuid.u) == 0) { NRF_LOG_INFO("ANS Characteristic discovered : unreadAlertStatusUuid"); unreadAlertStatusHandle = characteristic->val_handle; - } else if (characteristic != nullptr && - ble_uuid_cmp(((ble_uuid_t *) &controlPointUuid), &characteristic->uuid.u) == 0) { + } else if (characteristic != nullptr && ble_uuid_cmp(((ble_uuid_t*) &controlPointUuid), &characteristic->uuid.u) == 0) { NRF_LOG_INFO("ANS Characteristic discovered : controlPointUuid"); controlPointHandle = characteristic->val_handle; - } else NRF_LOG_INFO("ANS Characteristic discovered : 0x%x", characteristic->val_handle); + } else + NRF_LOG_INFO("ANS Characteristic discovered : 0x%x", characteristic->val_handle); } return 0; } -int AlertNotificationClient::OnNewAlertSubcribe(uint16_t connectionHandle, const ble_gatt_error *error, - ble_gatt_attr *attribute) { +int AlertNotificationClient::OnNewAlertSubcribe(uint16_t connectionHandle, const ble_gatt_error* error, ble_gatt_attr* attribute) { if (error->status == 0) { NRF_LOG_INFO("ANS New alert subscribe OK"); } else { @@ -128,12 +114,12 @@ int AlertNotificationClient::OnNewAlertSubcribe(uint16_t connectionHandle, const return 0; } -int AlertNotificationClient::OnDescriptorDiscoveryEventCallback(uint16_t connectionHandle, const ble_gatt_error *error, +int AlertNotificationClient::OnDescriptorDiscoveryEventCallback(uint16_t connectionHandle, + const ble_gatt_error* error, uint16_t characteristicValueHandle, - const ble_gatt_dsc *descriptor) { + const ble_gatt_dsc* descriptor) { if (error->status == 0) { - if (characteristicValueHandle == newAlertHandle && - ble_uuid_cmp(((ble_uuid_t *) &newAlertUuid), &descriptor->uuid.u)) { + if (characteristicValueHandle == newAlertHandle && ble_uuid_cmp(((ble_uuid_t*) &newAlertUuid), &descriptor->uuid.u)) { if (newAlertDescriptorHandle == 0) { NRF_LOG_INFO("ANS Descriptor discovered : %d", descriptor->handle); newAlertDescriptorHandle = descriptor->handle; @@ -151,16 +137,17 @@ int AlertNotificationClient::OnDescriptorDiscoveryEventCallback(uint16_t connect return 0; } -void AlertNotificationClient::OnNotification(ble_gap_event *event) { +void AlertNotificationClient::OnNotification(ble_gap_event* event) { if (event->notify_rx.attr_handle == newAlertHandle) { constexpr size_t stringTerminatorSize = 1; // end of string '\0' constexpr size_t headerSize = 3; - const auto maxMessageSize{NotificationManager::MaximumMessageSize()}; - const auto maxBufferSize{maxMessageSize + headerSize}; + const auto maxMessageSize {NotificationManager::MaximumMessageSize()}; + const auto maxBufferSize {maxMessageSize + headerSize}; // Ignore notifications with empty message const auto packetLen = OS_MBUF_PKTLEN(event->notify_rx.om); - if(packetLen <= headerSize) return; + if (packetLen <= headerSize) + return; size_t bufferSize = std::min(packetLen + stringTerminatorSize, maxBufferSize); auto messageSize = std::min(maxMessageSize, (bufferSize - headerSize)); diff --git a/src/components/ble/AlertNotificationClient.h b/src/components/ble/AlertNotificationClient.h index d49205e3..dfba8143 100644 --- a/src/components/ble/AlertNotificationClient.h +++ b/src/components/ble/AlertNotificationClient.h @@ -19,68 +19,52 @@ namespace Pinetime { class NotificationManager; class AlertNotificationClient : public BleClient { - public: - explicit AlertNotificationClient(Pinetime::System::SystemTask &systemTask, - Pinetime::Controllers::NotificationManager ¬ificationManager); + public: + explicit AlertNotificationClient(Pinetime::System::SystemTask& systemTask, + Pinetime::Controllers::NotificationManager& notificationManager); - bool OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, const ble_gatt_svc *service); - int OnCharacteristicsDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, - const ble_gatt_chr *characteristic); - int OnNewAlertSubcribe(uint16_t connectionHandle, const ble_gatt_error *error, ble_gatt_attr *attribute); - int OnDescriptorDiscoveryEventCallback(uint16_t connectionHandle, const ble_gatt_error *error, - uint16_t characteristicValueHandle, const ble_gatt_dsc *descriptor); - void OnNotification(ble_gap_event *event); - void Reset(); - void Discover(uint16_t connectionHandle, std::function lambda) override; + bool OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_svc* service); + int OnCharacteristicsDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_chr* characteristic); + int OnNewAlertSubcribe(uint16_t connectionHandle, const ble_gatt_error* error, ble_gatt_attr* attribute); + int OnDescriptorDiscoveryEventCallback(uint16_t connectionHandle, + const ble_gatt_error* error, + uint16_t characteristicValueHandle, + const ble_gatt_dsc* descriptor); + void OnNotification(ble_gap_event* event); + void Reset(); + void Discover(uint16_t connectionHandle, std::function lambda) override; - private: - static constexpr uint16_t ansServiceId{0x1811}; - static constexpr uint16_t supportedNewAlertCategoryId = 0x2a47; - static constexpr uint16_t supportedUnreadAlertCategoryId = 0x2a48; - static constexpr uint16_t newAlertId = 0x2a46; - static constexpr uint16_t unreadAlertStatusId = 0x2a45; - static constexpr uint16_t controlPointId = 0x2a44; + private: + static constexpr uint16_t ansServiceId {0x1811}; + static constexpr uint16_t supportedNewAlertCategoryId = 0x2a47; + static constexpr uint16_t supportedUnreadAlertCategoryId = 0x2a48; + static constexpr uint16_t newAlertId = 0x2a46; + static constexpr uint16_t unreadAlertStatusId = 0x2a45; + static constexpr uint16_t controlPointId = 0x2a44; - static constexpr ble_uuid16_t ansServiceUuid{ - .u {.type = BLE_UUID_TYPE_16}, - .value = ansServiceId - }; - static constexpr ble_uuid16_t supportedNewAlertCategoryUuid{ - .u {.type = BLE_UUID_TYPE_16}, - .value = supportedNewAlertCategoryId - }; - static constexpr ble_uuid16_t supportedUnreadAlertCategoryUuid{ - .u {.type = BLE_UUID_TYPE_16}, - .value = supportedUnreadAlertCategoryId - }; - static constexpr ble_uuid16_t newAlertUuid{ - .u {.type = BLE_UUID_TYPE_16}, - .value = newAlertId - }; - static constexpr ble_uuid16_t unreadAlertStatusUuid{ - .u {.type = BLE_UUID_TYPE_16}, - .value = unreadAlertStatusId - }; - static constexpr ble_uuid16_t controlPointUuid{ - .u {.type = BLE_UUID_TYPE_16}, - .value = controlPointId - }; + static constexpr ble_uuid16_t ansServiceUuid {.u {.type = BLE_UUID_TYPE_16}, .value = ansServiceId}; + static constexpr ble_uuid16_t supportedNewAlertCategoryUuid {.u {.type = BLE_UUID_TYPE_16}, .value = supportedNewAlertCategoryId}; + static constexpr ble_uuid16_t supportedUnreadAlertCategoryUuid {.u {.type = BLE_UUID_TYPE_16}, + .value = supportedUnreadAlertCategoryId}; + static constexpr ble_uuid16_t newAlertUuid {.u {.type = BLE_UUID_TYPE_16}, .value = newAlertId}; + static constexpr ble_uuid16_t unreadAlertStatusUuid {.u {.type = BLE_UUID_TYPE_16}, .value = unreadAlertStatusId}; + static constexpr ble_uuid16_t controlPointUuid {.u {.type = BLE_UUID_TYPE_16}, .value = controlPointId}; - uint16_t ansStartHandle = 0; - uint16_t ansEndHandle = 0; - uint16_t supportedNewAlertCategoryHandle = 0; - uint16_t supportedUnreadAlertCategoryHandle = 0; - uint16_t newAlertHandle = 0; - uint16_t newAlertDescriptorHandle = 0; - uint16_t newAlertDefHandle = 0; - uint16_t unreadAlertStatusHandle = 0; - uint16_t controlPointHandle = 0; - bool isDiscovered = false; - Pinetime::System::SystemTask &systemTask; - Pinetime::Controllers::NotificationManager ¬ificationManager; - std::function onServiceDiscovered; - bool isCharacteristicDiscovered = false; - bool isDescriptorFound = false; + uint16_t ansStartHandle = 0; + uint16_t ansEndHandle = 0; + uint16_t supportedNewAlertCategoryHandle = 0; + uint16_t supportedUnreadAlertCategoryHandle = 0; + uint16_t newAlertHandle = 0; + uint16_t newAlertDescriptorHandle = 0; + uint16_t newAlertDefHandle = 0; + uint16_t unreadAlertStatusHandle = 0; + uint16_t controlPointHandle = 0; + bool isDiscovered = false; + Pinetime::System::SystemTask& systemTask; + Pinetime::Controllers::NotificationManager& notificationManager; + std::function onServiceDiscovered; + bool isCharacteristicDiscovered = false; + bool isDescriptorFound = false; }; } } diff --git a/src/components/ble/AlertNotificationService.cpp b/src/components/ble/AlertNotificationService.cpp index d91e2090..e9f5941e 100644 --- a/src/components/ble/AlertNotificationService.cpp +++ b/src/components/ble/AlertNotificationService.cpp @@ -11,8 +11,7 @@ constexpr ble_uuid16_t AlertNotificationService::ansUuid; constexpr ble_uuid16_t AlertNotificationService::ansCharUuid; constexpr ble_uuid128_t AlertNotificationService::notificationEventUuid; - -int AlertNotificationCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) { +int AlertNotificationCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) { auto anService = static_cast(arg); return anService->OnAlert(conn_handle, attr_handle, ctxt); } @@ -26,62 +25,52 @@ void AlertNotificationService::Init() { ASSERT(res == 0); } -AlertNotificationService::AlertNotificationService ( System::SystemTask& systemTask, NotificationManager& notificationManager ) - : characteristicDefinition{ - { - .uuid = (ble_uuid_t *) &ansCharUuid, - .access_cb = AlertNotificationCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE - }, - { - .uuid = (ble_uuid_t *) ¬ificationEventUuid, - .access_cb = AlertNotificationCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_NOTIFY, - .val_handle = &eventHandle - }, - { - 0 - } - }, - serviceDefinition{ - { - /* Device Information Service */ - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &ansUuid, - .characteristics = characteristicDefinition - }, - { - 0 - }, - }, systemTask{systemTask}, notificationManager{notificationManager} { +AlertNotificationService::AlertNotificationService(System::SystemTask& systemTask, NotificationManager& notificationManager) + : characteristicDefinition {{.uuid = (ble_uuid_t*) &ansCharUuid, + .access_cb = AlertNotificationCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE}, + {.uuid = (ble_uuid_t*) ¬ificationEventUuid, + .access_cb = AlertNotificationCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_NOTIFY, + .val_handle = &eventHandle}, + {0}}, + serviceDefinition { + {/* Device Information Service */ + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = (ble_uuid_t*) &ansUuid, + .characteristics = characteristicDefinition}, + {0}, + }, + systemTask {systemTask}, + notificationManager {notificationManager} { } -int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt) { +int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) { if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { constexpr size_t stringTerminatorSize = 1; // end of string '\0' constexpr size_t headerSize = 3; const auto maxMessageSize {NotificationManager::MaximumMessageSize()}; - const auto maxBufferSize{maxMessageSize + headerSize}; + const auto maxBufferSize {maxMessageSize + headerSize}; // Ignore notifications with empty message const auto packetLen = OS_MBUF_PKTLEN(ctxt->om); - if(packetLen <= headerSize) return 0; + if (packetLen <= headerSize) + return 0; size_t bufferSize = std::min(packetLen + stringTerminatorSize, maxBufferSize); - auto messageSize = std::min(maxMessageSize, (bufferSize-headerSize)); + auto messageSize = std::min(maxMessageSize, (bufferSize - headerSize)); Categories category; NotificationManager::Notification notif; - os_mbuf_copydata(ctxt->om, headerSize, messageSize-1, notif.message.data()); + os_mbuf_copydata(ctxt->om, headerSize, messageSize - 1, notif.message.data()); os_mbuf_copydata(ctxt->om, 0, 1, &category); - notif.message[messageSize-1] = '\0'; + notif.message[messageSize - 1] = '\0'; notif.size = messageSize; // TODO convert all ANS categories to NotificationController categories - switch(category) { + switch (category) { case Categories::Call: notif.category = Pinetime::Controllers::NotificationManager::Categories::IncomingCall; break; @@ -99,7 +88,7 @@ int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle void AlertNotificationService::AcceptIncomingCall() { auto response = IncomingCallResponses::Answer; - auto *om = ble_hs_mbuf_from_flat(&response, 1); + auto* om = ble_hs_mbuf_from_flat(&response, 1); uint16_t connectionHandle = systemTask.nimble().connHandle(); @@ -112,7 +101,7 @@ void AlertNotificationService::AcceptIncomingCall() { void AlertNotificationService::RejectIncomingCall() { auto response = IncomingCallResponses::Reject; - auto *om = ble_hs_mbuf_from_flat(&response, 1); + auto* om = ble_hs_mbuf_from_flat(&response, 1); uint16_t connectionHandle = systemTask.nimble().connHandle(); @@ -125,7 +114,7 @@ void AlertNotificationService::RejectIncomingCall() { void AlertNotificationService::MuteIncomingCall() { auto response = IncomingCallResponses::Mute; - auto *om = ble_hs_mbuf_from_flat(&response, 1); + auto* om = ble_hs_mbuf_from_flat(&response, 1); uint16_t connectionHandle = systemTask.nimble().connHandle(); diff --git a/src/components/ble/AlertNotificationService.h b/src/components/ble/AlertNotificationService.h index caad7a2b..5c7d428c 100644 --- a/src/components/ble/AlertNotificationService.h +++ b/src/components/ble/AlertNotificationService.h @@ -7,8 +7,9 @@ #undef max #undef min -//00020001-78fc-48fe-8e23-433b3a1942d0 -#define NOTIFICATION_EVENT_SERVICE_UUID_BASE {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x01, 0x00, 0x02, 0x00} +// 00020001-78fc-48fe-8e23-433b3a1942d0 +#define NOTIFICATION_EVENT_SERVICE_UUID_BASE \ + { 0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x01, 0x00, 0x02, 0x00 } namespace Pinetime { @@ -19,64 +20,49 @@ namespace Pinetime { class NotificationManager; class AlertNotificationService { - public: - AlertNotificationService(Pinetime::System::SystemTask &systemTask, - Pinetime::Controllers::NotificationManager ¬ificationManager); - void Init(); + public: + AlertNotificationService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager); + void Init(); - int OnAlert(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt); + int OnAlert(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt); - void AcceptIncomingCall(); - void RejectIncomingCall(); - void MuteIncomingCall(); + void AcceptIncomingCall(); + void RejectIncomingCall(); + void MuteIncomingCall(); - enum class IncomingCallResponses : uint8_t { - Reject = 0x00, - Answer = 0x01, - Mute = 0x02 - }; + enum class IncomingCallResponses : uint8_t { Reject = 0x00, Answer = 0x01, Mute = 0x02 }; - private: - enum class Categories : uint8_t { - SimpleAlert = 0x00, - Email = 0x01, - News = 0x02, - Call = 0x03, - MissedCall = 0x04, - MmsSms = 0x05, - VoiceMail = 0x06, - Schedule = 0x07, - HighPrioritizedAlert = 0x08, - InstantMessage = 0x09, - All = 0xff - }; + private: + enum class Categories : uint8_t { + SimpleAlert = 0x00, + Email = 0x01, + News = 0x02, + Call = 0x03, + MissedCall = 0x04, + MmsSms = 0x05, + VoiceMail = 0x06, + Schedule = 0x07, + HighPrioritizedAlert = 0x08, + InstantMessage = 0x09, + All = 0xff + }; - static constexpr uint16_t ansId {0x1811}; - static constexpr uint16_t ansCharId {0x2a46}; + static constexpr uint16_t ansId {0x1811}; + static constexpr uint16_t ansCharId {0x2a46}; - static constexpr ble_uuid16_t ansUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = ansId - }; + static constexpr ble_uuid16_t ansUuid {.u {.type = BLE_UUID_TYPE_16}, .value = ansId}; - static constexpr ble_uuid16_t ansCharUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = ansCharId - }; + static constexpr ble_uuid16_t ansCharUuid {.u {.type = BLE_UUID_TYPE_16}, .value = ansCharId}; - static constexpr ble_uuid128_t notificationEventUuid { - .u { .type = BLE_UUID_TYPE_128 }, - .value = NOTIFICATION_EVENT_SERVICE_UUID_BASE - }; + static constexpr ble_uuid128_t notificationEventUuid {.u {.type = BLE_UUID_TYPE_128}, .value = NOTIFICATION_EVENT_SERVICE_UUID_BASE}; - struct ble_gatt_chr_def characteristicDefinition[3]; - struct ble_gatt_svc_def serviceDefinition[2]; + struct ble_gatt_chr_def characteristicDefinition[3]; + struct ble_gatt_svc_def serviceDefinition[2]; - Pinetime::System::SystemTask &systemTask; - NotificationManager ¬ificationManager; + Pinetime::System::SystemTask& systemTask; + NotificationManager& notificationManager; - uint16_t eventHandle; + uint16_t eventHandle; }; } } diff --git a/src/components/ble/BatteryInformationService.cpp b/src/components/ble/BatteryInformationService.cpp index bc66ff72..10a78d67 100644 --- a/src/components/ble/BatteryInformationService.cpp +++ b/src/components/ble/BatteryInformationService.cpp @@ -7,39 +7,26 @@ using namespace Pinetime::Controllers; constexpr ble_uuid16_t BatteryInformationService::batteryInformationServiceUuid; constexpr ble_uuid16_t BatteryInformationService::batteryLevelUuid; - - -int BatteryInformationServiceCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) { +int BatteryInformationServiceCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) { auto* batteryInformationService = static_cast(arg); return batteryInformationService->OnBatteryServiceRequested(conn_handle, attr_handle, ctxt); } -BatteryInformationService::BatteryInformationService(Controllers::Battery& batteryController) : - batteryController{batteryController}, - characteristicDefinition{ - { - .uuid = (ble_uuid_t *) &batteryLevelUuid, - .access_cb = BatteryInformationServiceCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_READ, - .val_handle = &batteryLevelHandle - }, - { - 0 - } - }, - serviceDefinition{ - { - /* Device Information Service */ - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &batteryInformationServiceUuid, - .characteristics = characteristicDefinition - }, - { - 0 - }, - }{ - +BatteryInformationService::BatteryInformationService(Controllers::Battery& batteryController) + : batteryController {batteryController}, + characteristicDefinition {{.uuid = (ble_uuid_t*) &batteryLevelUuid, + .access_cb = BatteryInformationServiceCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_READ, + .val_handle = &batteryLevelHandle}, + {0}}, + serviceDefinition { + {/* Device Information Service */ + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = (ble_uuid_t*) &batteryInformationServiceUuid, + .characteristics = characteristicDefinition}, + {0}, + } { } void BatteryInformationService::Init() { @@ -51,9 +38,10 @@ void BatteryInformationService::Init() { ASSERT(res == 0); } -int BatteryInformationService::OnBatteryServiceRequested(uint16_t connectionHandle, uint16_t attributeHandle, - ble_gatt_access_ctxt *context) { - if(attributeHandle == batteryLevelHandle) { +int BatteryInformationService::OnBatteryServiceRequested(uint16_t connectionHandle, + uint16_t attributeHandle, + ble_gatt_access_ctxt* context) { + if (attributeHandle == batteryLevelHandle) { NRF_LOG_INFO("BATTERY : handle = %d", batteryLevelHandle); static uint8_t batteryValue = batteryController.PercentRemaining(); int res = os_mbuf_append(context->om, &batteryValue, 1); diff --git a/src/components/ble/BatteryInformationService.h b/src/components/ble/BatteryInformationService.h index b00000a4..7d060909 100644 --- a/src/components/ble/BatteryInformationService.h +++ b/src/components/ble/BatteryInformationService.h @@ -12,33 +12,25 @@ namespace Pinetime { namespace Controllers { class Battery; class BatteryInformationService { - public: - BatteryInformationService(Controllers::Battery& batteryController); - void Init(); + public: + BatteryInformationService(Controllers::Battery& batteryController); + void Init(); - int - OnBatteryServiceRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt *context); + int OnBatteryServiceRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context); - private: - Controllers::Battery& batteryController; - static constexpr uint16_t batteryInformationServiceId {0x180F}; - static constexpr uint16_t batteryLevelId {0x2A19}; + private: + Controllers::Battery& batteryController; + static constexpr uint16_t batteryInformationServiceId {0x180F}; + static constexpr uint16_t batteryLevelId {0x2A19}; - static constexpr ble_uuid16_t batteryInformationServiceUuid { - .u {.type = BLE_UUID_TYPE_16}, - .value = batteryInformationServiceId - }; + static constexpr ble_uuid16_t batteryInformationServiceUuid {.u {.type = BLE_UUID_TYPE_16}, .value = batteryInformationServiceId}; - static constexpr ble_uuid16_t batteryLevelUuid { - .u {.type = BLE_UUID_TYPE_16}, - .value = batteryLevelId - }; + static constexpr ble_uuid16_t batteryLevelUuid {.u {.type = BLE_UUID_TYPE_16}, .value = batteryLevelId}; - struct ble_gatt_chr_def characteristicDefinition[3]; - struct ble_gatt_svc_def serviceDefinition[2]; - - uint16_t batteryLevelHandle; + struct ble_gatt_chr_def characteristicDefinition[3]; + struct ble_gatt_svc_def serviceDefinition[2]; + uint16_t batteryLevelHandle; }; } } diff --git a/src/components/ble/BleClient.h b/src/components/ble/BleClient.h index 559f6c8d..6067c15f 100644 --- a/src/components/ble/BleClient.h +++ b/src/components/ble/BleClient.h @@ -3,10 +3,10 @@ #include namespace Pinetime { - namespace Controllers{ + namespace Controllers { class BleClient { - public: - virtual void Discover(uint16_t connectionHandle, std::function lambda) = 0; + public: + virtual void Discover(uint16_t connectionHandle, std::function lambda) = 0; }; } } \ No newline at end of file diff --git a/src/components/ble/BleController.cpp b/src/components/ble/BleController.cpp index 650ec79f..7c14aeb7 100644 --- a/src/components/ble/BleController.cpp +++ b/src/components/ble/BleController.cpp @@ -25,5 +25,3 @@ void Ble::FirmwareUpdateTotalBytes(uint32_t totalBytes) { void Ble::FirmwareUpdateCurrentBytes(uint32_t currentBytes) { firmwareUpdateCurrentBytes = currentBytes; } - - diff --git a/src/components/ble/BleController.h b/src/components/ble/BleController.h index 0570c8d0..2cba26a9 100644 --- a/src/components/ble/BleController.h +++ b/src/components/ble/BleController.h @@ -6,39 +6,57 @@ namespace Pinetime { namespace Controllers { class Ble { - public: - using BleAddress = std::array; - enum class FirmwareUpdateStates {Idle, Running, Validated, Error}; - enum class AddressTypes { Public, Random }; + public: + using BleAddress = std::array; + enum class FirmwareUpdateStates { Idle, Running, Validated, Error }; + enum class AddressTypes { Public, Random }; - Ble() = default; - bool IsConnected() const {return isConnected;} - void Connect(); - void Disconnect(); + Ble() = default; + bool IsConnected() const { + return isConnected; + } + void Connect(); + void Disconnect(); - void StartFirmwareUpdate(); - void StopFirmwareUpdate(); - void FirmwareUpdateTotalBytes(uint32_t totalBytes); - void FirmwareUpdateCurrentBytes(uint32_t currentBytes); - void State(FirmwareUpdateStates state) { firmwareUpdateState = state; } + void StartFirmwareUpdate(); + void StopFirmwareUpdate(); + void FirmwareUpdateTotalBytes(uint32_t totalBytes); + void FirmwareUpdateCurrentBytes(uint32_t currentBytes); + void State(FirmwareUpdateStates state) { + firmwareUpdateState = state; + } - bool IsFirmwareUpdating() const { return isFirmwareUpdating; } - uint32_t FirmwareUpdateTotalBytes() const { return firmwareUpdateTotalBytes; } - uint32_t FirmwareUpdateCurrentBytes() const { return firmwareUpdateCurrentBytes; } - FirmwareUpdateStates State() const { return firmwareUpdateState; } + bool IsFirmwareUpdating() const { + return isFirmwareUpdating; + } + uint32_t FirmwareUpdateTotalBytes() const { + return firmwareUpdateTotalBytes; + } + uint32_t FirmwareUpdateCurrentBytes() const { + return firmwareUpdateCurrentBytes; + } + FirmwareUpdateStates State() const { + return firmwareUpdateState; + } - void Address(BleAddress&& addr) { address = addr; } - const BleAddress& Address() const { return address; } - void AddressType(AddressTypes t) { addressType = t;} - private: - bool isConnected = false; - bool isFirmwareUpdating = false; - uint32_t firmwareUpdateTotalBytes = 0; - uint32_t firmwareUpdateCurrentBytes = 0; - FirmwareUpdateStates firmwareUpdateState = FirmwareUpdateStates::Idle; - BleAddress address; - AddressTypes addressType; + void Address(BleAddress&& addr) { + address = addr; + } + const BleAddress& Address() const { + return address; + } + void AddressType(AddressTypes t) { + addressType = t; + } + private: + bool isConnected = false; + bool isFirmwareUpdating = false; + uint32_t firmwareUpdateTotalBytes = 0; + uint32_t firmwareUpdateCurrentBytes = 0; + FirmwareUpdateStates firmwareUpdateState = FirmwareUpdateStates::Idle; + BleAddress address; + AddressTypes addressType; }; } } \ No newline at end of file diff --git a/src/components/ble/CurrentTimeClient.cpp b/src/components/ble/CurrentTimeClient.cpp index 758f636c..c6e68312 100644 --- a/src/components/ble/CurrentTimeClient.cpp +++ b/src/components/ble/CurrentTimeClient.cpp @@ -9,39 +9,37 @@ constexpr ble_uuid16_t CurrentTimeClient::ctsServiceUuid; constexpr ble_uuid16_t CurrentTimeClient::currentTimeCharacteristicUuid; namespace { - int OnDiscoveryEventCallback(uint16_t conn_handle, const struct ble_gatt_error *error, const struct ble_gatt_svc *service, void *arg) { - auto client = static_cast(arg); + int OnDiscoveryEventCallback(uint16_t conn_handle, const struct ble_gatt_error* error, const struct ble_gatt_svc* service, void* arg) { + auto client = static_cast(arg); return client->OnDiscoveryEvent(conn_handle, error, service); } - int OnCurrentTimeCharacteristicDiscoveredCallback(uint16_t conn_handle, const struct ble_gatt_error *error, - const struct ble_gatt_chr *chr, void *arg) { - auto client = static_cast(arg); + int OnCurrentTimeCharacteristicDiscoveredCallback(uint16_t conn_handle, + const struct ble_gatt_error* error, + const struct ble_gatt_chr* chr, + void* arg) { + auto client = static_cast(arg); return client->OnCharacteristicDiscoveryEvent(conn_handle, error, chr); } - int CurrentTimeReadCallback(uint16_t conn_handle, const struct ble_gatt_error *error, struct ble_gatt_attr *attr, void *arg) { - auto client = static_cast(arg); + int CurrentTimeReadCallback(uint16_t conn_handle, const struct ble_gatt_error* error, struct ble_gatt_attr* attr, void* arg) { + auto client = static_cast(arg); return client->OnCurrentTimeReadResult(conn_handle, error, attr); } } -CurrentTimeClient::CurrentTimeClient(DateTime &dateTimeController) : dateTimeController{dateTimeController} { - +CurrentTimeClient::CurrentTimeClient(DateTime& dateTimeController) : dateTimeController {dateTimeController} { } void CurrentTimeClient::Init() { - } -bool CurrentTimeClient::OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, - const ble_gatt_svc *service) { +bool CurrentTimeClient::OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_svc* service) { if (service == nullptr && error->status == BLE_HS_EDONE) { if (isDiscovered) { NRF_LOG_INFO("CTS found, starting characteristics discovery"); - ble_gattc_disc_all_chrs(connectionHandle, ctsStartHandle, ctsEndHandle, - OnCurrentTimeCharacteristicDiscoveredCallback, this); + ble_gattc_disc_all_chrs(connectionHandle, ctsStartHandle, ctsEndHandle, OnCurrentTimeCharacteristicDiscoveredCallback, this); } else { NRF_LOG_INFO("CTS not found"); onServiceDiscovered(connectionHandle); @@ -49,7 +47,7 @@ bool CurrentTimeClient::OnDiscoveryEvent(uint16_t connectionHandle, const ble_ga return true; } - if (service != nullptr && ble_uuid_cmp(((ble_uuid_t *) &ctsServiceUuid), &service->uuid.u) == 0) { + if (service != nullptr && ble_uuid_cmp(((ble_uuid_t*) &ctsServiceUuid), &service->uuid.u) == 0) { NRF_LOG_INFO("CTS discovered : 0x%x - 0x%x", service->start_handle, service->end_handle); isDiscovered = true; ctsStartHandle = service->start_handle; @@ -59,8 +57,9 @@ bool CurrentTimeClient::OnDiscoveryEvent(uint16_t connectionHandle, const ble_ga return false; } -int CurrentTimeClient::OnCharacteristicDiscoveryEvent(uint16_t conn_handle, const ble_gatt_error *error, - const ble_gatt_chr *characteristic) { +int CurrentTimeClient::OnCharacteristicDiscoveryEvent(uint16_t conn_handle, + const ble_gatt_error* error, + const ble_gatt_chr* characteristic) { if (characteristic == nullptr && error->status == BLE_HS_EDONE) { if (isCharacteristicDiscovered) { NRF_LOG_INFO("CTS Characteristic discovery complete, fetching time"); @@ -73,8 +72,7 @@ int CurrentTimeClient::OnCharacteristicDiscoveryEvent(uint16_t conn_handle, cons return 0; } - if (characteristic != nullptr && - ble_uuid_cmp(((ble_uuid_t *) ¤tTimeCharacteristicUuid), &characteristic->uuid.u) == 0) { + if (characteristic != nullptr && ble_uuid_cmp(((ble_uuid_t*) ¤tTimeCharacteristicUuid), &characteristic->uuid.u) == 0) { NRF_LOG_INFO("CTS Characteristic discovered : 0x%x", characteristic->val_handle); isCharacteristicDiscovered = true; currentTimeHandle = characteristic->val_handle; @@ -82,17 +80,15 @@ int CurrentTimeClient::OnCharacteristicDiscoveryEvent(uint16_t conn_handle, cons return 0; } -int CurrentTimeClient::OnCurrentTimeReadResult(uint16_t conn_handle, const ble_gatt_error *error, - const ble_gatt_attr *attribute) { +int CurrentTimeClient::OnCurrentTimeReadResult(uint16_t conn_handle, const ble_gatt_error* error, const ble_gatt_attr* attribute) { if (error->status == 0) { // TODO check that attribute->handle equals the handle discovered in OnCharacteristicDiscoveryEvent CtsData result; os_mbuf_copydata(attribute->om, 0, sizeof(CtsData), &result); - NRF_LOG_INFO("Received data: %d-%d-%d %d:%d:%d", result.year, - result.month, result.dayofmonth, - result.hour, result.minute, result.second); - dateTimeController.SetTime(result.year, result.month, result.dayofmonth, - 0, result.hour, result.minute, result.second, nrf_rtc_counter_get(portNRF_RTC_REG)); + NRF_LOG_INFO( + "Received data: %d-%d-%d %d:%d:%d", result.year, result.month, result.dayofmonth, result.hour, result.minute, result.second); + dateTimeController.SetTime( + result.year, result.month, result.dayofmonth, 0, result.hour, result.minute, result.second, nrf_rtc_counter_get(portNRF_RTC_REG)); } else { NRF_LOG_INFO("Error retrieving current time: %d", error->status); } diff --git a/src/components/ble/CurrentTimeClient.h b/src/components/ble/CurrentTimeClient.h index 1b2e018c..6424c035 100644 --- a/src/components/ble/CurrentTimeClient.h +++ b/src/components/ble/CurrentTimeClient.h @@ -8,54 +8,51 @@ #include "BleClient.h" namespace Pinetime { - namespace Controllers { - class DateTime; + namespace Controllers { + class DateTime; - class CurrentTimeClient : public BleClient { - public: - explicit CurrentTimeClient(DateTime& dateTimeController); - void Init(); - void Reset(); - bool OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, const ble_gatt_svc *service); - int OnCharacteristicDiscoveryEvent(uint16_t conn_handle, const ble_gatt_error *error, - const ble_gatt_chr *characteristic); - int OnCurrentTimeReadResult(uint16_t conn_handle, const ble_gatt_error *error, const ble_gatt_attr *attribute); - static constexpr const ble_uuid16_t* Uuid() { return &CurrentTimeClient::ctsServiceUuid; } - static constexpr const ble_uuid16_t* CurrentTimeCharacteristicUuid() { return &CurrentTimeClient::currentTimeCharacteristicUuid; } - void Discover(uint16_t connectionHandle, std::function lambda) override; + class CurrentTimeClient : public BleClient { + public: + explicit CurrentTimeClient(DateTime& dateTimeController); + void Init(); + void Reset(); + bool OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_svc* service); + int OnCharacteristicDiscoveryEvent(uint16_t conn_handle, const ble_gatt_error* error, const ble_gatt_chr* characteristic); + int OnCurrentTimeReadResult(uint16_t conn_handle, const ble_gatt_error* error, const ble_gatt_attr* attribute); + static constexpr const ble_uuid16_t* Uuid() { + return &CurrentTimeClient::ctsServiceUuid; + } + static constexpr const ble_uuid16_t* CurrentTimeCharacteristicUuid() { + return &CurrentTimeClient::currentTimeCharacteristicUuid; + } + void Discover(uint16_t connectionHandle, std::function lambda) override; - private: - typedef struct __attribute__((packed)) { - uint16_t year; - uint8_t month; - uint8_t dayofmonth; - uint8_t hour; - uint8_t minute; - uint8_t second; - uint8_t millis; - uint8_t reason; - } CtsData; + private: + typedef struct __attribute__((packed)) { + uint16_t year; + uint8_t month; + uint8_t dayofmonth; + uint8_t hour; + uint8_t minute; + uint8_t second; + uint8_t millis; + uint8_t reason; + } CtsData; - static constexpr uint16_t ctsServiceId {0x1805}; - static constexpr uint16_t currentTimeCharacteristicId {0x2a2b}; + static constexpr uint16_t ctsServiceId {0x1805}; + static constexpr uint16_t currentTimeCharacteristicId {0x2a2b}; - static constexpr ble_uuid16_t ctsServiceUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = ctsServiceId - }; - static constexpr ble_uuid16_t currentTimeCharacteristicUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = currentTimeCharacteristicId - }; + static constexpr ble_uuid16_t ctsServiceUuid {.u {.type = BLE_UUID_TYPE_16}, .value = ctsServiceId}; + static constexpr ble_uuid16_t currentTimeCharacteristicUuid {.u {.type = BLE_UUID_TYPE_16}, .value = currentTimeCharacteristicId}; - DateTime& dateTimeController; - bool isDiscovered = false; - uint16_t ctsStartHandle; - uint16_t ctsEndHandle; + DateTime& dateTimeController; + bool isDiscovered = false; + uint16_t ctsStartHandle; + uint16_t ctsEndHandle; - bool isCharacteristicDiscovered = false; - uint16_t currentTimeHandle; - std::function onServiceDiscovered; - }; - } + bool isCharacteristicDiscovered = false; + uint16_t currentTimeHandle; + std::function onServiceDiscovered; + }; + } } \ No newline at end of file diff --git a/src/components/ble/CurrentTimeService.cpp b/src/components/ble/CurrentTimeService.cpp index 9f14edc7..b49be39c 100644 --- a/src/components/ble/CurrentTimeService.cpp +++ b/src/components/ble/CurrentTimeService.cpp @@ -7,8 +7,7 @@ using namespace Pinetime::Controllers; constexpr ble_uuid16_t CurrentTimeService::ctsUuid; constexpr ble_uuid16_t CurrentTimeService::ctChrUuid; - -int CTSCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) { +int CTSCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) { auto cts = static_cast(arg); return cts->OnTimeAccessed(conn_handle, attr_handle, ctxt); } @@ -22,22 +21,19 @@ void CurrentTimeService::Init() { ASSERT(res == 0); } +int CurrentTimeService::OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) { -int CurrentTimeService::OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt) { - - NRF_LOG_INFO("Setting time..."); + NRF_LOG_INFO("Setting time..."); if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { CtsData result; os_mbuf_copydata(ctxt->om, 0, sizeof(CtsData), &result); - NRF_LOG_INFO("Received data: %d-%d-%d %d:%d:%d", result.year, - result.month, result.dayofmonth, - result.hour, result.minute, result.second); + NRF_LOG_INFO( + "Received data: %d-%d-%d %d:%d:%d", result.year, result.month, result.dayofmonth, result.hour, result.minute, result.second); - m_dateTimeController.SetTime(result.year, result.month, result.dayofmonth, - 0, result.hour, result.minute, result.second, nrf_rtc_counter_get(portNRF_RTC_REG)); + m_dateTimeController.SetTime( + result.year, result.month, result.dayofmonth, 0, result.hour, result.minute, result.second, nrf_rtc_counter_get(portNRF_RTC_REG)); } else if (ctxt->op == BLE_GATT_ACCESS_OP_READ_CHR) { CtsData currentDateTime; @@ -49,39 +45,26 @@ int CurrentTimeService::OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handl currentDateTime.second = m_dateTimeController.Seconds(); currentDateTime.millis = 0; - int res = os_mbuf_append(ctxt->om, ¤tDateTime, sizeof(CtsData)); return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; - } return 0; } -CurrentTimeService::CurrentTimeService(DateTime &dateTimeController) : - characteristicDefinition{ - { - .uuid = (ble_uuid_t *) &ctChrUuid, - .access_cb = CTSCallback, - - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }, - { - 0 - } - }, - serviceDefinition{ - { - /* Device Information Service */ - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &ctsUuid, - .characteristics = characteristicDefinition - }, - { - 0 - }, - }, m_dateTimeController{dateTimeController} { +CurrentTimeService::CurrentTimeService(DateTime& dateTimeController) + : characteristicDefinition {{.uuid = (ble_uuid_t*) &ctChrUuid, + .access_cb = CTSCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}, + {0}}, + serviceDefinition { + {/* Device Information Service */ + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = (ble_uuid_t*) &ctsUuid, + .characteristics = characteristicDefinition}, + {0}, + }, + m_dateTimeController {dateTimeController} { } - diff --git a/src/components/ble/CurrentTimeService.h b/src/components/ble/CurrentTimeService.h index 23956283..ca87d970 100644 --- a/src/components/ble/CurrentTimeService.h +++ b/src/components/ble/CurrentTimeService.h @@ -12,42 +12,35 @@ namespace Pinetime { namespace Controllers { class CurrentTimeService { - public: - CurrentTimeService(DateTime &dateTimeController); - void Init(); + public: + CurrentTimeService(DateTime& dateTimeController); + void Init(); - int OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt); + int OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt); - private: - static constexpr uint16_t ctsId {0x1805}; - static constexpr uint16_t ctsCharId {0x2a2b}; + private: + static constexpr uint16_t ctsId {0x1805}; + static constexpr uint16_t ctsCharId {0x2a2b}; - static constexpr ble_uuid16_t ctsUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = ctsId - }; + static constexpr ble_uuid16_t ctsUuid {.u {.type = BLE_UUID_TYPE_16}, .value = ctsId}; - static constexpr ble_uuid16_t ctChrUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = ctsCharId - }; + static constexpr ble_uuid16_t ctChrUuid {.u {.type = BLE_UUID_TYPE_16}, .value = ctsCharId}; - struct ble_gatt_chr_def characteristicDefinition[2]; - struct ble_gatt_svc_def serviceDefinition[2]; + struct ble_gatt_chr_def characteristicDefinition[2]; + struct ble_gatt_svc_def serviceDefinition[2]; - typedef struct __attribute__((packed)) { - uint16_t year; - uint8_t month; - uint8_t dayofmonth; - uint8_t hour; - uint8_t minute; - uint8_t second; - uint8_t millis; - uint8_t reason; - } CtsData; + typedef struct __attribute__((packed)) { + uint16_t year; + uint8_t month; + uint8_t dayofmonth; + uint8_t hour; + uint8_t minute; + uint8_t second; + uint8_t millis; + uint8_t reason; + } CtsData; - DateTime &m_dateTimeController; + DateTime& m_dateTimeController; }; } } diff --git a/src/components/ble/DeviceInformationService.cpp b/src/components/ble/DeviceInformationService.cpp index 406db1cf..cf482079 100644 --- a/src/components/ble/DeviceInformationService.cpp +++ b/src/components/ble/DeviceInformationService.cpp @@ -10,8 +10,7 @@ constexpr ble_uuid16_t DeviceInformationService::deviceInfoUuid; constexpr ble_uuid16_t DeviceInformationService::hwRevisionUuid; constexpr ble_uuid16_t DeviceInformationService::swRevisionUuid; - -int DeviceInformationCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) { +int DeviceInformationCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) { auto deviceInformationService = static_cast(arg); return deviceInformationService->OnDeviceInfoRequested(conn_handle, attr_handle, ctxt); } @@ -25,10 +24,8 @@ void DeviceInformationService::Init() { ASSERT(res == 0); } - -int DeviceInformationService::OnDeviceInfoRequested(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt) { - const char *str; +int DeviceInformationService::OnDeviceInfoRequested(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) { + const char* str; switch (ble_uuid_u16(ctxt->chr->uuid)) { case manufacturerNameId: @@ -57,60 +54,49 @@ int DeviceInformationService::OnDeviceInfoRequested(uint16_t conn_handle, uint16 return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; } -DeviceInformationService::DeviceInformationService() : - characteristicDefinition{ - { - .uuid = (ble_uuid_t *) &manufacturerNameUuid, - .access_cb = DeviceInformationCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_READ, - }, - { - .uuid = (ble_uuid_t *) &modelNumberUuid, - .access_cb = DeviceInformationCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_READ, - }, - { - .uuid = (ble_uuid_t *) &serialNumberUuid, - .access_cb = DeviceInformationCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_READ, - }, - { - .uuid = (ble_uuid_t *) &fwRevisionUuid, - .access_cb = DeviceInformationCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_READ, - }, - { - .uuid = (ble_uuid_t *) &hwRevisionUuid, - .access_cb = DeviceInformationCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_READ, - }, - { - .uuid = (ble_uuid_t *) &swRevisionUuid, - .access_cb = DeviceInformationCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_READ, - }, - { - 0 - } - }, - serviceDefinition{ - { - /* Device Information Service */ - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &deviceInfoUuid, - .characteristics = characteristicDefinition - }, - { - 0 - }, - } - { - +DeviceInformationService::DeviceInformationService() + : characteristicDefinition {{ + .uuid = (ble_uuid_t*) &manufacturerNameUuid, + .access_cb = DeviceInformationCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_READ, + }, + { + .uuid = (ble_uuid_t*) &modelNumberUuid, + .access_cb = DeviceInformationCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_READ, + }, + { + .uuid = (ble_uuid_t*) &serialNumberUuid, + .access_cb = DeviceInformationCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_READ, + }, + { + .uuid = (ble_uuid_t*) &fwRevisionUuid, + .access_cb = DeviceInformationCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_READ, + }, + { + .uuid = (ble_uuid_t*) &hwRevisionUuid, + .access_cb = DeviceInformationCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_READ, + }, + { + .uuid = (ble_uuid_t*) &swRevisionUuid, + .access_cb = DeviceInformationCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_READ, + }, + {0}}, + serviceDefinition { + {/* Device Information Service */ + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = (ble_uuid_t*) &deviceInfoUuid, + .characteristics = characteristicDefinition}, + {0}, + } { } - diff --git a/src/components/ble/DeviceInformationService.h b/src/components/ble/DeviceInformationService.h index 94ca7bbf..54b3e961 100644 --- a/src/components/ble/DeviceInformationService.h +++ b/src/components/ble/DeviceInformationService.h @@ -9,69 +9,44 @@ namespace Pinetime { namespace Controllers { class DeviceInformationService { - public: - DeviceInformationService(); - void Init(); + public: + DeviceInformationService(); + void Init(); - int OnDeviceInfoRequested(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt); + int OnDeviceInfoRequested(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt); - private: - static constexpr uint16_t deviceInfoId {0x180a}; - static constexpr uint16_t manufacturerNameId {0x2a29}; - static constexpr uint16_t modelNumberId {0x2a24}; - static constexpr uint16_t serialNumberId {0x2a25}; - static constexpr uint16_t fwRevisionId {0x2a26}; - static constexpr uint16_t hwRevisionId {0x2a27}; - static constexpr uint16_t swRevisionId {0x2a28}; + private: + static constexpr uint16_t deviceInfoId {0x180a}; + static constexpr uint16_t manufacturerNameId {0x2a29}; + static constexpr uint16_t modelNumberId {0x2a24}; + static constexpr uint16_t serialNumberId {0x2a25}; + static constexpr uint16_t fwRevisionId {0x2a26}; + static constexpr uint16_t hwRevisionId {0x2a27}; + static constexpr uint16_t swRevisionId {0x2a28}; - static constexpr const char* manufacturerName = "PINE64"; - static constexpr const char* modelNumber = "PineTime"; - static constexpr const char* hwRevision = "1.0.0"; - static constexpr const char* serialNumber = "0"; - static constexpr const char* fwRevision = Version::VersionString(); - static constexpr const char* swRevision = "InfiniTime"; + static constexpr const char* manufacturerName = "PINE64"; + static constexpr const char* modelNumber = "PineTime"; + static constexpr const char* hwRevision = "1.0.0"; + static constexpr const char* serialNumber = "0"; + static constexpr const char* fwRevision = Version::VersionString(); + static constexpr const char* swRevision = "InfiniTime"; + static constexpr ble_uuid16_t deviceInfoUuid {.u {.type = BLE_UUID_TYPE_16}, .value = deviceInfoId}; - static constexpr ble_uuid16_t deviceInfoUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = deviceInfoId - }; + static constexpr ble_uuid16_t manufacturerNameUuid {.u {.type = BLE_UUID_TYPE_16}, .value = manufacturerNameId}; - static constexpr ble_uuid16_t manufacturerNameUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = manufacturerNameId - }; + static constexpr ble_uuid16_t modelNumberUuid {.u {.type = BLE_UUID_TYPE_16}, .value = modelNumberId}; - static constexpr ble_uuid16_t modelNumberUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = modelNumberId - }; + static constexpr ble_uuid16_t serialNumberUuid {.u {.type = BLE_UUID_TYPE_16}, .value = serialNumberId}; - static constexpr ble_uuid16_t serialNumberUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = serialNumberId - }; + static constexpr ble_uuid16_t fwRevisionUuid {.u {.type = BLE_UUID_TYPE_16}, .value = fwRevisionId}; - static constexpr ble_uuid16_t fwRevisionUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = fwRevisionId - }; - - static constexpr ble_uuid16_t hwRevisionUuid { - .u {.type = BLE_UUID_TYPE_16}, - .value = hwRevisionId - }; - - static constexpr ble_uuid16_t swRevisionUuid { - .u {.type = BLE_UUID_TYPE_16}, - .value = swRevisionId - }; - - struct ble_gatt_chr_def characteristicDefinition[7]; - struct ble_gatt_svc_def serviceDefinition[2]; + static constexpr ble_uuid16_t hwRevisionUuid {.u {.type = BLE_UUID_TYPE_16}, .value = hwRevisionId}; + static constexpr ble_uuid16_t swRevisionUuid {.u {.type = BLE_UUID_TYPE_16}, .value = swRevisionId}; + struct ble_gatt_chr_def characteristicDefinition[7]; + struct ble_gatt_svc_def serviceDefinition[2]; }; } } \ No newline at end of file diff --git a/src/components/ble/DfuService.cpp b/src/components/ble/DfuService.cpp index 90795b49..2031668e 100644 --- a/src/components/ble/DfuService.cpp +++ b/src/components/ble/DfuService.cpp @@ -11,67 +11,60 @@ constexpr ble_uuid128_t DfuService::controlPointCharacteristicUuid; constexpr ble_uuid128_t DfuService::revisionCharacteristicUuid; constexpr ble_uuid128_t DfuService::packetCharacteristicUuid; -int DfuServiceCallback(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt, void *arg) { - auto dfuService = static_cast(arg); +int DfuServiceCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) { + auto dfuService = static_cast(arg); return dfuService->OnServiceData(conn_handle, attr_handle, ctxt); } void NotificationTimerCallback(TimerHandle_t xTimer) { - auto notificationManager = static_cast(pvTimerGetTimerID(xTimer)); + auto notificationManager = static_cast(pvTimerGetTimerID(xTimer)); notificationManager->OnNotificationTimer(); } void TimeoutTimerCallback(TimerHandle_t xTimer) { - auto dfuService = static_cast(pvTimerGetTimerID(xTimer)); + auto dfuService = static_cast(pvTimerGetTimerID(xTimer)); dfuService->OnTimeout(); } -DfuService::DfuService(Pinetime::System::SystemTask &systemTask, Pinetime::Controllers::Ble &bleController, - Pinetime::Drivers::SpiNorFlash &spiNorFlash) : - systemTask{systemTask}, - bleController{bleController}, - dfuImage{spiNorFlash}, - characteristicDefinition{ - { - .uuid = (ble_uuid_t *) &packetCharacteristicUuid, - .access_cb = DfuServiceCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE_NO_RSP, - .val_handle = nullptr, - }, - { - .uuid = (ble_uuid_t *) &controlPointCharacteristicUuid, - .access_cb = DfuServiceCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_NOTIFY, - .val_handle = nullptr, - }, - { - .uuid = (ble_uuid_t *) &revisionCharacteristicUuid, - .access_cb = DfuServiceCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_READ, - .val_handle = &revision, +DfuService::DfuService(Pinetime::System::SystemTask& systemTask, + Pinetime::Controllers::Ble& bleController, + Pinetime::Drivers::SpiNorFlash& spiNorFlash) + : systemTask {systemTask}, + bleController {bleController}, + dfuImage {spiNorFlash}, + characteristicDefinition {{ + .uuid = (ble_uuid_t*) &packetCharacteristicUuid, + .access_cb = DfuServiceCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE_NO_RSP, + .val_handle = nullptr, + }, + { + .uuid = (ble_uuid_t*) &controlPointCharacteristicUuid, + .access_cb = DfuServiceCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_NOTIFY, + .val_handle = nullptr, + }, + { + .uuid = (ble_uuid_t*) &revisionCharacteristicUuid, + .access_cb = DfuServiceCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_READ, + .val_handle = &revision, - }, - { - 0 - } + }, + {0} - }, - serviceDefinition{ - { - /* Device Information Service */ - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &serviceUuid, - .characteristics = characteristicDefinition - }, - { - 0 - }, - } { - timeoutTimer = xTimerCreate ("notificationTimer", 10000, pdFALSE, this, TimeoutTimerCallback); + }, + serviceDefinition { + {/* Device Information Service */ + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = (ble_uuid_t*) &serviceUuid, + .characteristics = characteristicDefinition}, + {0}, + } { + timeoutTimer = xTimerCreate("notificationTimer", 10000, pdFALSE, this, TimeoutTimerCallback); } void DfuService::Init() { @@ -83,55 +76,54 @@ void DfuService::Init() { ASSERT(res == 0); } -int DfuService::OnServiceData(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt *context) { - if(bleController.IsFirmwareUpdating()){ +int DfuService::OnServiceData(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context) { + if (bleController.IsFirmwareUpdating()) { xTimerStart(timeoutTimer, 0); } - - ble_gatts_find_chr((ble_uuid_t *) &serviceUuid, (ble_uuid_t *) &packetCharacteristicUuid, nullptr, - &packetCharacteristicHandle); - ble_gatts_find_chr((ble_uuid_t *) &serviceUuid, (ble_uuid_t *) &controlPointCharacteristicUuid, nullptr, - &controlPointCharacteristicHandle); - ble_gatts_find_chr((ble_uuid_t *) &serviceUuid, (ble_uuid_t *) &revisionCharacteristicUuid, nullptr, - &revisionCharacteristicHandle); + ble_gatts_find_chr((ble_uuid_t*) &serviceUuid, (ble_uuid_t*) &packetCharacteristicUuid, nullptr, &packetCharacteristicHandle); + ble_gatts_find_chr((ble_uuid_t*) &serviceUuid, (ble_uuid_t*) &controlPointCharacteristicUuid, nullptr, &controlPointCharacteristicHandle); + ble_gatts_find_chr((ble_uuid_t*) &serviceUuid, (ble_uuid_t*) &revisionCharacteristicUuid, nullptr, &revisionCharacteristicHandle); if (attributeHandle == packetCharacteristicHandle) { if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) return WritePacketHandler(connectionHandle, context->om); - else return 0; + else + return 0; } else if (attributeHandle == controlPointCharacteristicHandle) { if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) return ControlPointHandler(connectionHandle, context->om); - else return 0; + else + return 0; } else if (attributeHandle == revisionCharacteristicHandle) { if (context->op == BLE_GATT_ACCESS_OP_READ_CHR) return SendDfuRevision(context->om); - else return 0; + else + return 0; } else { NRF_LOG_INFO("[DFU] Unknown Characteristic : %d", attributeHandle); return 0; } } -int DfuService::SendDfuRevision(os_mbuf *om) const { +int DfuService::SendDfuRevision(os_mbuf* om) const { int res = os_mbuf_append(om, &revision, sizeof(revision)); return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; } -int DfuService::WritePacketHandler(uint16_t connectionHandle, os_mbuf *om) { +int DfuService::WritePacketHandler(uint16_t connectionHandle, os_mbuf* om) { switch (state) { case States::Start: { softdeviceSize = om->om_data[0] + (om->om_data[1] << 8) + (om->om_data[2] << 16) + (om->om_data[3] << 24); bootloaderSize = om->om_data[4] + (om->om_data[5] << 8) + (om->om_data[6] << 16) + (om->om_data[7] << 24); applicationSize = om->om_data[8] + (om->om_data[9] << 8) + (om->om_data[10] << 16) + (om->om_data[11] << 24); bleController.FirmwareUpdateTotalBytes(applicationSize); - NRF_LOG_INFO("[DFU] -> Start data received : SD size : %d, BT size : %d, app size : %d", softdeviceSize, - bootloaderSize, applicationSize); + NRF_LOG_INFO( + "[DFU] -> Start data received : SD size : %d, BT size : %d, app size : %d", softdeviceSize, bootloaderSize, applicationSize); dfuImage.Erase(); - uint8_t data[]{16, 1, 1}; + uint8_t data[] {16, 1, 1}; notificationManager.Send(connectionHandle, controlPointCharacteristicHandle, data, 3); state = States::Init; } @@ -139,19 +131,22 @@ int DfuService::WritePacketHandler(uint16_t connectionHandle, os_mbuf *om) { case States::Init: { uint16_t deviceType = om->om_data[0] + (om->om_data[1] << 8); uint16_t deviceRevision = om->om_data[2] + (om->om_data[3] << 8); - uint32_t applicationVersion = - om->om_data[4] + (om->om_data[5] << 8) + (om->om_data[6] << 16) + (om->om_data[7] << 24); + uint32_t applicationVersion = om->om_data[4] + (om->om_data[5] << 8) + (om->om_data[6] << 16) + (om->om_data[7] << 24); uint16_t softdeviceArrayLength = om->om_data[8] + (om->om_data[9] << 8); uint16_t sd[softdeviceArrayLength]; for (int i = 0; i < softdeviceArrayLength; i++) { sd[i] = om->om_data[10 + (i * 2)] + (om->om_data[10 + (i * 2) + 1] << 8); } - expectedCrc = - om->om_data[10 + (softdeviceArrayLength * 2)] + (om->om_data[10 + (softdeviceArrayLength * 2) + 1] << 8); + expectedCrc = om->om_data[10 + (softdeviceArrayLength * 2)] + (om->om_data[10 + (softdeviceArrayLength * 2) + 1] << 8); NRF_LOG_INFO( - "[DFU] -> Init data received : deviceType = %d, deviceRevision = %d, applicationVersion = %d, nb SD = %d, First SD = %d, CRC = %u", - deviceType, deviceRevision, applicationVersion, softdeviceArrayLength, sd[0], expectedCrc); + "[DFU] -> Init data received : deviceType = %d, deviceRevision = %d, applicationVersion = %d, nb SD = %d, First SD = %d, CRC = %u", + deviceType, + deviceRevision, + applicationVersion, + softdeviceArrayLength, + sd[0], + expectedCrc); return 0; } @@ -163,16 +158,18 @@ int DfuService::WritePacketHandler(uint16_t connectionHandle, os_mbuf *om) { bleController.FirmwareUpdateCurrentBytes(bytesReceived); if ((nbPacketReceived % nbPacketsToNotify) == 0 && bytesReceived != applicationSize) { - uint8_t data[5]{static_cast(Opcodes::PacketReceiptNotification), - (uint8_t) (bytesReceived & 0x000000FFu), (uint8_t) (bytesReceived >> 8u), - (uint8_t) (bytesReceived >> 16u), (uint8_t) (bytesReceived >> 24u)}; + uint8_t data[5] {static_cast(Opcodes::PacketReceiptNotification), + (uint8_t) (bytesReceived & 0x000000FFu), + (uint8_t) (bytesReceived >> 8u), + (uint8_t) (bytesReceived >> 16u), + (uint8_t) (bytesReceived >> 24u)}; NRF_LOG_INFO("[DFU] -> Send packet notification: %d bytes received", bytesReceived); notificationManager.Send(connectionHandle, controlPointCharacteristicHandle, data, 5); } if (dfuImage.IsComplete()) { - uint8_t data[3]{static_cast(Opcodes::Response), - static_cast(Opcodes::ReceiveFirmwareImage), - static_cast(ErrorCodes::NoError)}; + uint8_t data[3] {static_cast(Opcodes::Response), + static_cast(Opcodes::ReceiveFirmwareImage), + static_cast(ErrorCodes::NoError)}; NRF_LOG_INFO("[DFU] -> Send packet notification : all bytes received!"); notificationManager.Send(connectionHandle, controlPointCharacteristicHandle, data, 3); state = States::Validate; @@ -186,7 +183,7 @@ int DfuService::WritePacketHandler(uint16_t connectionHandle, os_mbuf *om) { return 0; } -int DfuService::ControlPointHandler(uint16_t connectionHandle, os_mbuf *om) { +int DfuService::ControlPointHandler(uint16_t connectionHandle, os_mbuf* om) { auto opcode = static_cast(om->om_data[0]); NRF_LOG_INFO("[DFU] -> ControlPointHandler"); @@ -214,8 +211,7 @@ int DfuService::ControlPointHandler(uint16_t connectionHandle, os_mbuf *om) { NRF_LOG_INFO("[DFU] -> Start DFU, mode %d not supported!", imageType); return 0; } - } - break; + } break; case Opcodes::InitDFUParameters: { if (state != States::Init) { NRF_LOG_INFO("[DFU] -> Init DFU requested, but we are not in Init state"); @@ -225,11 +221,9 @@ int DfuService::ControlPointHandler(uint16_t connectionHandle, os_mbuf *om) { NRF_LOG_INFO("[DFU] -> Init DFU parameters %s", isInitComplete ? " complete" : " not complete"); if (isInitComplete) { - uint8_t data[3] { - static_cast(Opcodes::Response), - static_cast(Opcodes::InitDFUParameters), - (isInitComplete ? uint8_t{1} : uint8_t{0}) - }; + uint8_t data[3] {static_cast(Opcodes::Response), + static_cast(Opcodes::InitDFUParameters), + (isInitComplete ? uint8_t {1} : uint8_t {0})}; notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3); return 0; } @@ -257,26 +251,22 @@ int DfuService::ControlPointHandler(uint16_t connectionHandle, os_mbuf *om) { NRF_LOG_INFO("[DFU] -> Validate firmware image requested -- %d", connectionHandle); - if(dfuImage.Validate()){ + if (dfuImage.Validate()) { state = States::Validated; bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated); NRF_LOG_INFO("Image OK"); - uint8_t data[3] { - static_cast(Opcodes::Response), - static_cast(Opcodes::ValidateFirmware), - static_cast(ErrorCodes::NoError) - }; + uint8_t data[3] {static_cast(Opcodes::Response), + static_cast(Opcodes::ValidateFirmware), + static_cast(ErrorCodes::NoError)}; notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3); } else { bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Error); NRF_LOG_INFO("Image Error : bad CRC"); - uint8_t data[3] { - static_cast(Opcodes::Response), - static_cast(Opcodes::ValidateFirmware), - static_cast(ErrorCodes::CrcError) - }; + uint8_t data[3] {static_cast(Opcodes::Response), + static_cast(Opcodes::ValidateFirmware), + static_cast(ErrorCodes::CrcError)}; notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3); } @@ -318,11 +308,11 @@ void DfuService::Reset() { } DfuService::NotificationManager::NotificationManager() { - timer = xTimerCreate ("notificationTimer", 1000, pdFALSE, this, NotificationTimerCallback); + timer = xTimerCreate("notificationTimer", 1000, pdFALSE, this, NotificationTimerCallback); } -bool DfuService::NotificationManager::AsyncSend(uint16_t connection, uint16_t charactHandle, uint8_t *data, size_t s) { - if(size != 0 || s > 10) +bool DfuService::NotificationManager::AsyncSend(uint16_t connection, uint16_t charactHandle, uint8_t* data, size_t s) { + if (size != 0 || s > 10) return false; connectionHandle = connection; @@ -334,14 +324,14 @@ bool DfuService::NotificationManager::AsyncSend(uint16_t connection, uint16_t ch } void DfuService::NotificationManager::OnNotificationTimer() { - if(size > 0) { + if (size > 0) { Send(connectionHandle, characteristicHandle, buffer, size); size = 0; } } -void DfuService::NotificationManager::Send(uint16_t connection, uint16_t charactHandle, const uint8_t *data, const size_t s) { - auto *om = ble_hs_mbuf_from_flat(data, s); +void DfuService::NotificationManager::Send(uint16_t connection, uint16_t charactHandle, const uint8_t* data, const size_t s) { + auto* om = ble_hs_mbuf_from_flat(data, s); auto ret = ble_gattc_notify_custom(connection, charactHandle, om); ASSERT(ret == 0); } @@ -354,27 +344,29 @@ void DfuService::NotificationManager::Reset() { } void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc) { - if(chunkSize != 20) return; + if (chunkSize != 20) + return; this->chunkSize = chunkSize; this->totalSize = totalSize; this->expectedCrc = expectedCrc; this->ready = true; } -void DfuService::DfuImage::Append(uint8_t *data, size_t size) { - if(!ready) return; +void DfuService::DfuImage::Append(uint8_t* data, size_t size) { + if (!ready) + return; ASSERT(size <= 20); std::memcpy(tempBuffer + bufferWriteIndex, data, size); bufferWriteIndex += size; - if(bufferWriteIndex == bufferSize) { + if (bufferWriteIndex == bufferSize) { spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); totalWriteIndex += bufferWriteIndex; bufferWriteIndex = 0; } - if(bufferWriteIndex > 0 && totalWriteIndex + bufferWriteIndex == totalSize) { + if (bufferWriteIndex > 0 && totalWriteIndex + bufferWriteIndex == totalSize) { spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); totalWriteIndex += bufferWriteIndex; if (totalSize < maxSize) @@ -383,15 +375,16 @@ void DfuService::DfuImage::Append(uint8_t *data, size_t size) { } void DfuService::DfuImage::WriteMagicNumber() { - uint32_t magic[4] = { // TODO When this variable is a static constexpr, the values written to the memory are not correct. Why? - 0xf395c277, - 0x7fefd260, - 0x0f505235, - 0x8079b62c, + uint32_t magic[4] = { + // TODO When this variable is a static constexpr, the values written to the memory are not correct. Why? + 0xf395c277, + 0x7fefd260, + 0x0f505235, + 0x8079b62c, }; uint32_t offset = writeOffset + (maxSize - (4 * sizeof(uint32_t))); - spiNorFlash.Write(offset, reinterpret_cast(magic), 4 * sizeof(uint32_t)); + spiNorFlash.Write(offset, reinterpret_cast(magic), 4 * sizeof(uint32_t)); } void DfuService::DfuImage::Erase() { @@ -421,7 +414,7 @@ bool DfuService::DfuImage::Validate() { return (crc == expectedCrc); } -uint16_t DfuService::DfuImage::ComputeCrc(uint8_t const *p_data, uint32_t size, uint16_t const *p_crc) { +uint16_t DfuService::DfuImage::ComputeCrc(uint8_t const* p_data, uint32_t size, uint16_t const* p_crc) { uint16_t crc = (p_crc == NULL) ? 0xFFFF : *p_crc; for (uint32_t i = 0; i < size; i++) { @@ -436,6 +429,7 @@ uint16_t DfuService::DfuImage::ComputeCrc(uint8_t const *p_data, uint32_t size, } bool DfuService::DfuImage::IsComplete() { - if(!ready) return false; + if (!ready) + return false; return totalWriteIndex == totalSize; } diff --git a/src/components/ble/DfuService.h b/src/components/ble/DfuService.h index 096bd99a..4708a4a6 100644 --- a/src/components/ble/DfuService.h +++ b/src/components/ble/DfuService.h @@ -20,146 +20,139 @@ namespace Pinetime { class Ble; class DfuService { + public: + DfuService(Pinetime::System::SystemTask& systemTask, + Pinetime::Controllers::Ble& bleController, + Pinetime::Drivers::SpiNorFlash& spiNorFlash); + void Init(); + int OnServiceData(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context); + void OnTimeout(); + void Reset(); + + class NotificationManager { public: - DfuService(Pinetime::System::SystemTask &systemTask, Pinetime::Controllers::Ble &bleController, - Pinetime::Drivers::SpiNorFlash &spiNorFlash); - void Init(); - int OnServiceData(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt *context); - void OnTimeout(); - void Reset(); - - class NotificationManager { - public: - NotificationManager(); - bool AsyncSend(uint16_t connection, uint16_t charactHandle, uint8_t *data, size_t size); - void Send(uint16_t connection, uint16_t characteristicHandle, const uint8_t *data, const size_t s); - private: - TimerHandle_t timer; - uint16_t connectionHandle = 0; - uint16_t characteristicHandle = 0; - size_t size = 0; - uint8_t buffer[10]; - public: - void OnNotificationTimer(); - void Reset(); - }; - class DfuImage { - public: - DfuImage(Pinetime::Drivers::SpiNorFlash& spiNorFlash) : spiNorFlash{spiNorFlash} {} - void Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc); - void Erase(); - void Append(uint8_t* data, size_t size); - bool Validate(); - bool IsComplete(); - - private: - Pinetime::Drivers::SpiNorFlash& spiNorFlash; - static constexpr size_t bufferSize = 200; - bool ready = false; - size_t chunkSize = 0; - size_t totalSize = 0; - size_t maxSize = 475136; - size_t bufferWriteIndex = 0; - size_t totalWriteIndex = 0; - static constexpr size_t writeOffset = 0x40000; - uint8_t tempBuffer[bufferSize]; - uint16_t expectedCrc = 0; - - void WriteMagicNumber(); - uint16_t ComputeCrc(uint8_t const *p_data, uint32_t size, uint16_t const *p_crc); - - }; + NotificationManager(); + bool AsyncSend(uint16_t connection, uint16_t charactHandle, uint8_t* data, size_t size); + void Send(uint16_t connection, uint16_t characteristicHandle, const uint8_t* data, const size_t s); private: - Pinetime::System::SystemTask &systemTask; - Pinetime::Controllers::Ble &bleController; - DfuImage dfuImage; - NotificationManager notificationManager; + TimerHandle_t timer; + uint16_t connectionHandle = 0; + uint16_t characteristicHandle = 0; + size_t size = 0; + uint8_t buffer[10]; - static constexpr uint16_t dfuServiceId{0x1530}; - static constexpr uint16_t packetCharacteristicId{0x1532}; - static constexpr uint16_t controlPointCharacteristicId{0x1531}; - static constexpr uint16_t revisionCharacteristicId{0x1534}; + public: + void OnNotificationTimer(); + void Reset(); + }; + class DfuImage { + public: + DfuImage(Pinetime::Drivers::SpiNorFlash& spiNorFlash) : spiNorFlash {spiNorFlash} { + } + void Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc); + void Erase(); + void Append(uint8_t* data, size_t size); + bool Validate(); + bool IsComplete(); - uint16_t revision{0x0008}; - - static constexpr ble_uuid128_t serviceUuid{ - .u {.type = BLE_UUID_TYPE_128}, - .value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, - 0xDE, 0xEF, 0x12, 0x12, 0x30, 0x15, 0x00, 0x00} - }; - - static constexpr ble_uuid128_t packetCharacteristicUuid{ - .u {.type = BLE_UUID_TYPE_128}, - .value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, - 0xDE, 0xEF, 0x12, 0x12, 0x32, 0x15, 0x00, 0x00} - }; - - static constexpr ble_uuid128_t controlPointCharacteristicUuid{ - .u {.type = BLE_UUID_TYPE_128}, - .value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, - 0xDE, 0xEF, 0x12, 0x12, 0x31, 0x15, 0x00, 0x00} - }; - - static constexpr ble_uuid128_t revisionCharacteristicUuid{ - .u {.type = BLE_UUID_TYPE_128}, - .value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, - 0xDE, 0xEF, 0x12, 0x12, 0x34, 0x15, 0x00, 0x00} - }; - - struct ble_gatt_chr_def characteristicDefinition[4]; - struct ble_gatt_svc_def serviceDefinition[2]; - uint16_t packetCharacteristicHandle; - uint16_t controlPointCharacteristicHandle; - uint16_t revisionCharacteristicHandle; - - enum class States : uint8_t { - Idle, Init, Start, Data, Validate, Validated - }; - States state = States::Idle; - - enum class ImageTypes : uint8_t { - NoImage = 0x00, - SoftDevice = 0x01, - Bootloader = 0x02, - SoftDeviceAndBootloader = 0x03, - Application = 0x04 - }; - - enum class Opcodes : uint8_t { - StartDFU = 0x01, - InitDFUParameters = 0x02, - ReceiveFirmwareImage = 0x03, - ValidateFirmware = 0x04, - ActivateImageAndReset = 0x05, - PacketReceiptNotificationRequest = 0x08, - Response = 0x10, - PacketReceiptNotification = 0x11 - }; - - enum class ErrorCodes { - NoError = 0x01, - InvalidState = 0x02, - NotSupported = 0x03, - DataSizeExceedsLimits = 0x04, - CrcError = 0x05, - OperationFailed = 0x06 - }; - - uint8_t nbPacketsToNotify = 0; - uint32_t nbPacketReceived = 0; - uint32_t bytesReceived = 0; - - uint32_t softdeviceSize = 0; - uint32_t bootloaderSize = 0; - uint32_t applicationSize = 0; + private: + Pinetime::Drivers::SpiNorFlash& spiNorFlash; + static constexpr size_t bufferSize = 200; + bool ready = false; + size_t chunkSize = 0; + size_t totalSize = 0; + size_t maxSize = 475136; + size_t bufferWriteIndex = 0; + size_t totalWriteIndex = 0; + static constexpr size_t writeOffset = 0x40000; + uint8_t tempBuffer[bufferSize]; uint16_t expectedCrc = 0; - int SendDfuRevision(os_mbuf *om) const; - int WritePacketHandler(uint16_t connectionHandle, os_mbuf *om); - int ControlPointHandler(uint16_t connectionHandle, os_mbuf *om); + void WriteMagicNumber(); + uint16_t ComputeCrc(uint8_t const* p_data, uint32_t size, uint16_t const* p_crc); + }; - TimerHandle_t timeoutTimer; + private: + Pinetime::System::SystemTask& systemTask; + Pinetime::Controllers::Ble& bleController; + DfuImage dfuImage; + NotificationManager notificationManager; + + static constexpr uint16_t dfuServiceId {0x1530}; + static constexpr uint16_t packetCharacteristicId {0x1532}; + static constexpr uint16_t controlPointCharacteristicId {0x1531}; + static constexpr uint16_t revisionCharacteristicId {0x1534}; + + uint16_t revision {0x0008}; + + static constexpr ble_uuid128_t serviceUuid { + .u {.type = BLE_UUID_TYPE_128}, + .value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x30, 0x15, 0x00, 0x00}}; + + static constexpr ble_uuid128_t packetCharacteristicUuid { + .u {.type = BLE_UUID_TYPE_128}, + .value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x32, 0x15, 0x00, 0x00}}; + + static constexpr ble_uuid128_t controlPointCharacteristicUuid { + .u {.type = BLE_UUID_TYPE_128}, + .value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x31, 0x15, 0x00, 0x00}}; + + static constexpr ble_uuid128_t revisionCharacteristicUuid { + .u {.type = BLE_UUID_TYPE_128}, + .value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x34, 0x15, 0x00, 0x00}}; + + struct ble_gatt_chr_def characteristicDefinition[4]; + struct ble_gatt_svc_def serviceDefinition[2]; + uint16_t packetCharacteristicHandle; + uint16_t controlPointCharacteristicHandle; + uint16_t revisionCharacteristicHandle; + + enum class States : uint8_t { Idle, Init, Start, Data, Validate, Validated }; + States state = States::Idle; + + enum class ImageTypes : uint8_t { + NoImage = 0x00, + SoftDevice = 0x01, + Bootloader = 0x02, + SoftDeviceAndBootloader = 0x03, + Application = 0x04 + }; + + enum class Opcodes : uint8_t { + StartDFU = 0x01, + InitDFUParameters = 0x02, + ReceiveFirmwareImage = 0x03, + ValidateFirmware = 0x04, + ActivateImageAndReset = 0x05, + PacketReceiptNotificationRequest = 0x08, + Response = 0x10, + PacketReceiptNotification = 0x11 + }; + + enum class ErrorCodes { + NoError = 0x01, + InvalidState = 0x02, + NotSupported = 0x03, + DataSizeExceedsLimits = 0x04, + CrcError = 0x05, + OperationFailed = 0x06 + }; + + uint8_t nbPacketsToNotify = 0; + uint32_t nbPacketReceived = 0; + uint32_t bytesReceived = 0; + + uint32_t softdeviceSize = 0; + uint32_t bootloaderSize = 0; + uint32_t applicationSize = 0; + uint16_t expectedCrc = 0; + + int SendDfuRevision(os_mbuf* om) const; + int WritePacketHandler(uint16_t connectionHandle, os_mbuf* om); + int ControlPointHandler(uint16_t connectionHandle, os_mbuf* om); + + TimerHandle_t timeoutTimer; }; } } \ No newline at end of file diff --git a/src/components/ble/HeartRateService.cpp b/src/components/ble/HeartRateService.cpp index ee115ed0..c556566b 100644 --- a/src/components/ble/HeartRateService.cpp +++ b/src/components/ble/HeartRateService.cpp @@ -8,39 +8,29 @@ constexpr ble_uuid16_t HeartRateService::heartRateServiceUuid; constexpr ble_uuid16_t HeartRateService::heartRateMeasurementUuid; namespace { - int HeartRateServiceServiceCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) { + int HeartRateServiceServiceCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) { auto* heartRateService = static_cast(arg); return heartRateService->OnHeartRateRequested(conn_handle, attr_handle, ctxt); } } // TODO Refactoring - remove dependency to SystemTask -HeartRateService::HeartRateService(Pinetime::System::SystemTask &system, Controllers::HeartRateController& heartRateController) : - system{system}, - heartRateController{heartRateController}, - characteristicDefinition{ - { - .uuid = (ble_uuid_t *) &heartRateMeasurementUuid, - .access_cb = HeartRateServiceServiceCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_NOTIFY, - .val_handle = &heartRateMeasurementHandle - }, - { - 0 - } - }, - serviceDefinition{ - { - /* Device Information Service */ - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &heartRateServiceUuid, - .characteristics = characteristicDefinition - }, - { - 0 - }, - }{ +HeartRateService::HeartRateService(Pinetime::System::SystemTask& system, Controllers::HeartRateController& heartRateController) + : system {system}, + heartRateController {heartRateController}, + characteristicDefinition {{.uuid = (ble_uuid_t*) &heartRateMeasurementUuid, + .access_cb = HeartRateServiceServiceCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_READ | BLE_GATT_CHR_F_NOTIFY, + .val_handle = &heartRateMeasurementHandle}, + {0}}, + serviceDefinition { + {/* Device Information Service */ + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = (ble_uuid_t*) &heartRateServiceUuid, + .characteristics = characteristicDefinition}, + {0}, + } { // TODO refactor to prevent this loop dependency (service depends on controller and controller depends on service) heartRateController.SetService(this); } @@ -54,9 +44,8 @@ void HeartRateService::Init() { ASSERT(res == 0); } -int HeartRateService::OnHeartRateRequested(uint16_t connectionHandle, uint16_t attributeHandle, - ble_gatt_access_ctxt *context) { - if(attributeHandle == heartRateMeasurementHandle) { +int HeartRateService::OnHeartRateRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context) { + if (attributeHandle == heartRateMeasurementHandle) { NRF_LOG_INFO("HEARTRATE : handle = %d", heartRateMeasurementHandle); uint8_t buffer[2] = {0, heartRateController.HeartRate()}; // [0] = flags, [1] = hr value @@ -68,7 +57,7 @@ int HeartRateService::OnHeartRateRequested(uint16_t connectionHandle, uint16_t a void HeartRateService::OnNewHeartRateValue(uint8_t heartRateValue) { uint8_t buffer[2] = {0, heartRateController.HeartRate()}; // [0] = flags, [1] = hr value - auto *om = ble_hs_mbuf_from_flat(buffer, 2); + auto* om = ble_hs_mbuf_from_flat(buffer, 2); uint16_t connectionHandle = system.nimble().connHandle(); diff --git a/src/components/ble/HeartRateService.h b/src/components/ble/HeartRateService.h index 835e2941..0b16703f 100644 --- a/src/components/ble/HeartRateService.h +++ b/src/components/ble/HeartRateService.h @@ -12,33 +12,26 @@ namespace Pinetime { namespace Controllers { class HeartRateController; class HeartRateService { - public: - HeartRateService(Pinetime::System::SystemTask &system, Controllers::HeartRateController& heartRateController); - void Init(); - int OnHeartRateRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt *context); - void OnNewHeartRateValue(uint8_t hearRateValue); + public: + HeartRateService(Pinetime::System::SystemTask& system, Controllers::HeartRateController& heartRateController); + void Init(); + int OnHeartRateRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context); + void OnNewHeartRateValue(uint8_t hearRateValue); private: - Pinetime::System::SystemTask &system; - Controllers::HeartRateController& heartRateController; - static constexpr uint16_t heartRateServiceId {0x180D}; - static constexpr uint16_t heartRateMeasurementId {0x2A37}; + Pinetime::System::SystemTask& system; + Controllers::HeartRateController& heartRateController; + static constexpr uint16_t heartRateServiceId {0x180D}; + static constexpr uint16_t heartRateMeasurementId {0x2A37}; - static constexpr ble_uuid16_t heartRateServiceUuid { - .u {.type = BLE_UUID_TYPE_16}, - .value = heartRateServiceId - }; + static constexpr ble_uuid16_t heartRateServiceUuid {.u {.type = BLE_UUID_TYPE_16}, .value = heartRateServiceId}; - static constexpr ble_uuid16_t heartRateMeasurementUuid { - .u {.type = BLE_UUID_TYPE_16}, - .value = heartRateMeasurementId - }; + static constexpr ble_uuid16_t heartRateMeasurementUuid {.u {.type = BLE_UUID_TYPE_16}, .value = heartRateMeasurementId}; - struct ble_gatt_chr_def characteristicDefinition[3]; - struct ble_gatt_svc_def serviceDefinition[2]; - - uint16_t heartRateMeasurementHandle; + struct ble_gatt_chr_def characteristicDefinition[3]; + struct ble_gatt_svc_def serviceDefinition[2]; + uint16_t heartRateMeasurementHandle; }; } } diff --git a/src/components/ble/ImmediateAlertService.cpp b/src/components/ble/ImmediateAlertService.cpp index 0f6bf6cf..fd6430af 100644 --- a/src/components/ble/ImmediateAlertService.cpp +++ b/src/components/ble/ImmediateAlertService.cpp @@ -9,49 +9,42 @@ constexpr ble_uuid16_t ImmediateAlertService::immediateAlertServiceUuid; constexpr ble_uuid16_t ImmediateAlertService::alertLevelUuid; namespace { - int AlertLevelCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) { - auto *immediateAlertService = static_cast(arg); + int AlertLevelCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) { + auto* immediateAlertService = static_cast(arg); return immediateAlertService->OnAlertLevelChanged(conn_handle, attr_handle, ctxt); } const char* ToString(ImmediateAlertService::Levels level) { switch (level) { - case ImmediateAlertService::Levels::NoAlert: return "Alert : None"; - case ImmediateAlertService::Levels::HighAlert: return "Alert : High"; - case ImmediateAlertService::Levels::MildAlert: return "Alert : Mild"; - default: return ""; + case ImmediateAlertService::Levels::NoAlert: + return "Alert : None"; + case ImmediateAlertService::Levels::HighAlert: + return "Alert : High"; + case ImmediateAlertService::Levels::MildAlert: + return "Alert : Mild"; + default: + return ""; } } } -ImmediateAlertService::ImmediateAlertService(Pinetime::System::SystemTask &systemTask, - Pinetime::Controllers::NotificationManager ¬ificationManager) : - systemTask{systemTask}, - notificationManager{notificationManager}, - characteristicDefinition{ - { - .uuid = (ble_uuid_t *) &alertLevelUuid, - .access_cb = AlertLevelCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE_NO_RSP, - .val_handle = &alertLevelHandle - }, - { - 0 - } - }, - serviceDefinition{ - { - /* Device Information Service */ - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &immediateAlertServiceUuid, - .characteristics = characteristicDefinition - }, - { - 0 - }, - }{ - +ImmediateAlertService::ImmediateAlertService(Pinetime::System::SystemTask& systemTask, + Pinetime::Controllers::NotificationManager& notificationManager) + : systemTask {systemTask}, + notificationManager {notificationManager}, + characteristicDefinition {{.uuid = (ble_uuid_t*) &alertLevelUuid, + .access_cb = AlertLevelCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE_NO_RSP, + .val_handle = &alertLevelHandle}, + {0}}, + serviceDefinition { + {/* Device Information Service */ + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = (ble_uuid_t*) &immediateAlertServiceUuid, + .characteristics = characteristicDefinition}, + {0}, + } { } void ImmediateAlertService::Init() { @@ -63,9 +56,9 @@ void ImmediateAlertService::Init() { ASSERT(res == 0); } -int ImmediateAlertService::OnAlertLevelChanged(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt *context) { - if(attributeHandle == alertLevelHandle) { - if(context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { +int ImmediateAlertService::OnAlertLevelChanged(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context) { + if (attributeHandle == alertLevelHandle) { + if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { auto alertLevel = static_cast(context->om->om_data[0]); auto* alertString = ToString(alertLevel); diff --git a/src/components/ble/ImmediateAlertService.h b/src/components/ble/ImmediateAlertService.h index 2bc9cba5..1f778acd 100644 --- a/src/components/ble/ImmediateAlertService.h +++ b/src/components/ble/ImmediateAlertService.h @@ -12,39 +12,28 @@ namespace Pinetime { namespace Controllers { class NotificationManager; class ImmediateAlertService { - public: - enum class Levels : uint8_t { - NoAlert = 0, - MildAlert = 1, - HighAlert = 2 - }; + public: + enum class Levels : uint8_t { NoAlert = 0, MildAlert = 1, HighAlert = 2 }; - ImmediateAlertService(Pinetime::System::SystemTask &systemTask, - Pinetime::Controllers::NotificationManager ¬ificationManager); - void Init(); - int OnAlertLevelChanged(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt *context); + ImmediateAlertService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager); + void Init(); + int OnAlertLevelChanged(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context); - private: - Pinetime::System::SystemTask& systemTask; - NotificationManager& notificationManager; + private: + Pinetime::System::SystemTask& systemTask; + NotificationManager& notificationManager; - static constexpr uint16_t immediateAlertServiceId {0x1802}; - static constexpr uint16_t alertLevelId {0x2A06}; + static constexpr uint16_t immediateAlertServiceId {0x1802}; + static constexpr uint16_t alertLevelId {0x2A06}; - static constexpr ble_uuid16_t immediateAlertServiceUuid { - .u {.type = BLE_UUID_TYPE_16}, - .value = immediateAlertServiceId - }; + static constexpr ble_uuid16_t immediateAlertServiceUuid {.u {.type = BLE_UUID_TYPE_16}, .value = immediateAlertServiceId}; - static constexpr ble_uuid16_t alertLevelUuid { - .u {.type = BLE_UUID_TYPE_16}, - .value = alertLevelId - }; + static constexpr ble_uuid16_t alertLevelUuid {.u {.type = BLE_UUID_TYPE_16}, .value = alertLevelId}; - struct ble_gatt_chr_def characteristicDefinition[3]; - struct ble_gatt_svc_def serviceDefinition[2]; + struct ble_gatt_chr_def characteristicDefinition[3]; + struct ble_gatt_svc_def serviceDefinition[2]; - uint16_t alertLevelHandle; + uint16_t alertLevelHandle; }; } } diff --git a/src/components/ble/MusicService.cpp b/src/components/ble/MusicService.cpp index 1230ad57..36bf2709 100644 --- a/src/components/ble/MusicService.cpp +++ b/src/components/ble/MusicService.cpp @@ -18,12 +18,12 @@ #include "MusicService.h" #include "systemtask/SystemTask.h" -int MSCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) { - auto musicService = static_cast(arg); +int MSCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) { + auto musicService = static_cast(arg); return musicService->OnCommand(conn_handle, attr_handle, ctxt); } -Pinetime::Controllers::MusicService::MusicService(Pinetime::System::SystemTask &system) : m_system(system) { +Pinetime::Controllers::MusicService::MusicService(Pinetime::System::SystemTask& system) : m_system(system) { msUuid.value[14] = msId[0]; msUuid.value[15] = msId[1]; @@ -86,82 +86,51 @@ Pinetime::Controllers::MusicService::MusicService(Pinetime::System::SystemTask & msShuffleCharUuid.value[13] = msShuffleCharId[1]; msShuffleCharUuid.value[14] = msId[0]; msShuffleCharUuid.value[15] = msId[1]; - - characteristicDefinition[0] = {.uuid = (ble_uuid_t *) (&msEventCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_NOTIFY, - .val_handle = &eventHandle - }; - characteristicDefinition[1] = {.uuid = (ble_uuid_t *) (&msStatusCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[2] = {.uuid = (ble_uuid_t *) (&msTrackCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[3] = {.uuid = (ble_uuid_t *) (&msArtistCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[4] = {.uuid = (ble_uuid_t *) (&msAlbumCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[5] = {.uuid = (ble_uuid_t *) (&msPositionCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[6] = {.uuid = (ble_uuid_t *) (&msTotalLengthCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[7] = {.uuid = (ble_uuid_t *) (&msTotalLengthCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[8] = {.uuid = (ble_uuid_t *) (&msTrackNumberCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[9] = {.uuid = (ble_uuid_t *) (&msTrackTotalCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[10] = {.uuid = (ble_uuid_t *) (&msPlaybackSpeedCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[11] = {.uuid = (ble_uuid_t *) (&msRepeatCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[12] = {.uuid = (ble_uuid_t *) (&msShuffleCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; + + characteristicDefinition[0] = {.uuid = (ble_uuid_t*) (&msEventCharUuid), + .access_cb = MSCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_NOTIFY, + .val_handle = &eventHandle}; + characteristicDefinition[1] = { + .uuid = (ble_uuid_t*) (&msStatusCharUuid), .access_cb = MSCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[2] = { + .uuid = (ble_uuid_t*) (&msTrackCharUuid), .access_cb = MSCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[3] = { + .uuid = (ble_uuid_t*) (&msArtistCharUuid), .access_cb = MSCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[4] = { + .uuid = (ble_uuid_t*) (&msAlbumCharUuid), .access_cb = MSCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[5] = { + .uuid = (ble_uuid_t*) (&msPositionCharUuid), .access_cb = MSCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[6] = {.uuid = (ble_uuid_t*) (&msTotalLengthCharUuid), + .access_cb = MSCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[7] = {.uuid = (ble_uuid_t*) (&msTotalLengthCharUuid), + .access_cb = MSCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[8] = {.uuid = (ble_uuid_t*) (&msTrackNumberCharUuid), + .access_cb = MSCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[9] = {.uuid = (ble_uuid_t*) (&msTrackTotalCharUuid), + .access_cb = MSCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[10] = {.uuid = (ble_uuid_t*) (&msPlaybackSpeedCharUuid), + .access_cb = MSCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[11] = { + .uuid = (ble_uuid_t*) (&msRepeatCharUuid), .access_cb = MSCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[12] = { + .uuid = (ble_uuid_t*) (&msShuffleCharUuid), .access_cb = MSCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; characteristicDefinition[13] = {0}; - - serviceDefinition[0] = { - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &msUuid, - .characteristics = characteristicDefinition - }; + + serviceDefinition[0] = {.type = BLE_GATT_SVC_TYPE_PRIMARY, .uuid = (ble_uuid_t*) &msUuid, .characteristics = characteristicDefinition}; serviceDefinition[1] = {0}; - + artistName = "Waiting for"; albumName = ""; trackName = "track information.."; @@ -177,41 +146,40 @@ void Pinetime::Controllers::MusicService::Init() { int res = 0; res = ble_gatts_count_cfg(serviceDefinition); ASSERT(res == 0); - + res = ble_gatts_add_svcs(serviceDefinition); ASSERT(res == 0); } -int Pinetime::Controllers::MusicService::OnCommand(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt) { - +int Pinetime::Controllers::MusicService::OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) { + if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { size_t notifSize = OS_MBUF_PKTLEN(ctxt->om); uint8_t data[notifSize + 1]; data[notifSize] = '\0'; os_mbuf_copydata(ctxt->om, 0, notifSize, data); - char *s = (char *) &data[0]; - if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msArtistCharUuid) == 0) { + char* s = (char*) &data[0]; + if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &msArtistCharUuid) == 0) { artistName = s; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msTrackCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &msTrackCharUuid) == 0) { trackName = s; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msAlbumCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &msAlbumCharUuid) == 0) { albumName = s; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msStatusCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &msStatusCharUuid) == 0) { playing = s[0]; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msRepeatCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &msRepeatCharUuid) == 0) { repeat = s[0]; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msShuffleCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &msShuffleCharUuid) == 0) { shuffle = s[0]; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msPositionCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &msPositionCharUuid) == 0) { trackProgress = (s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3]; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msTotalLengthCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &msTotalLengthCharUuid) == 0) { trackLength = (s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3]; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msTrackNumberCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &msTrackNumberCharUuid) == 0) { trackNumber = (s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3]; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msTrackTotalCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &msTrackTotalCharUuid) == 0) { tracksTotal = (s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3]; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &msPlaybackSpeedCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &msPlaybackSpeedCharUuid) == 0) { playbackSpeed = static_cast(((s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3])) / 100.0f; } } @@ -239,14 +207,14 @@ float Pinetime::Controllers::MusicService::getPlaybackSpeed() { } void Pinetime::Controllers::MusicService::event(char event) { - auto *om = ble_hs_mbuf_from_flat(&event, 1); - + auto* om = ble_hs_mbuf_from_flat(&event, 1); + uint16_t connectionHandle = m_system.nimble().connHandle(); - + if (connectionHandle == 0 || connectionHandle == BLE_HS_CONN_HANDLE_NONE) { return; } - + ble_gattc_notify_custom(connectionHandle, eventHandle, om); } @@ -257,4 +225,3 @@ int Pinetime::Controllers::MusicService::getProgress() { int Pinetime::Controllers::MusicService::getTrackLength() { return trackLength; } - diff --git a/src/components/ble/MusicService.h b/src/components/ble/MusicService.h index 172ab61c..5f5343e4 100644 --- a/src/components/ble/MusicService.h +++ b/src/components/ble/MusicService.h @@ -26,40 +26,40 @@ #undef max #undef min -//00000000-78fc-48fe-8e23-433b3a1942d0 -#define MUSIC_SERVICE_UUID_BASE {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0x00, 0x00} +// 00000000-78fc-48fe-8e23-433b3a1942d0 +#define MUSIC_SERVICE_UUID_BASE \ + { 0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0x00, 0x00 } namespace Pinetime { namespace System { class SystemTask; } namespace Controllers { - + class MusicService { public: - explicit MusicService(Pinetime::System::SystemTask &system); - + explicit MusicService(Pinetime::System::SystemTask& system); + void Init(); - - int OnCommand(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt); - + + int OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt); + void event(char event); - + std::string getArtist(); - + std::string getTrack(); - + std::string getAlbum(); - + int getProgress(); - + int getTrackLength(); - + float getPlaybackSpeed(); - + bool isPlaying(); - + static const char EVENT_MUSIC_OPEN = 0xe0; static const char EVENT_MUSIC_PLAY = 0x00; static const char EVENT_MUSIC_PAUSE = 0x01; @@ -67,11 +67,9 @@ namespace Pinetime { static const char EVENT_MUSIC_PREV = 0x04; static const char EVENT_MUSIC_VOLUP = 0x05; static const char EVENT_MUSIC_VOLDOWN = 0x06; - - enum MusicStatus { - NotPlaying = 0x00, - Playing = 0x01 - }; + + enum MusicStatus { NotPlaying = 0x00, Playing = 0x01 }; + private: static constexpr uint8_t msId[2] = {0x00, 0x00}; static constexpr uint8_t msEventCharId[2] = {0x01, 0x00}; @@ -86,84 +84,44 @@ namespace Pinetime { static constexpr uint8_t msPlaybackSpeedCharId[2] = {0x0a, 0x00}; static constexpr uint8_t msRepeatCharId[2] = {0x0b, 0x00}; static constexpr uint8_t msShuffleCharId[2] = {0x0c, 0x00}; - - ble_uuid128_t msUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - - ble_uuid128_t msEventCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - ble_uuid128_t msStatusCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - ble_uuid128_t msArtistCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - ble_uuid128_t msTrackCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - ble_uuid128_t msAlbumCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - ble_uuid128_t msPositionCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - ble_uuid128_t msTotalLengthCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - ble_uuid128_t msTrackNumberCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - ble_uuid128_t msTrackTotalCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - ble_uuid128_t msPlaybackSpeedCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - ble_uuid128_t msRepeatCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - ble_uuid128_t msShuffleCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = MUSIC_SERVICE_UUID_BASE - }; - + + ble_uuid128_t msUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + + ble_uuid128_t msEventCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + ble_uuid128_t msStatusCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + ble_uuid128_t msArtistCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + ble_uuid128_t msTrackCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + ble_uuid128_t msAlbumCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + ble_uuid128_t msPositionCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + ble_uuid128_t msTotalLengthCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + ble_uuid128_t msTrackNumberCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + ble_uuid128_t msTrackTotalCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + ble_uuid128_t msPlaybackSpeedCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + ble_uuid128_t msRepeatCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + ble_uuid128_t msShuffleCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = MUSIC_SERVICE_UUID_BASE}; + struct ble_gatt_chr_def characteristicDefinition[14]; struct ble_gatt_svc_def serviceDefinition[2]; - + uint16_t eventHandle; - + std::string artistName; std::string albumName; std::string trackName; - + bool playing; - + int trackProgress; int trackLength; int trackNumber; int tracksTotal; - + float playbackSpeed; - + bool repeat; bool shuffle; - - Pinetime::System::SystemTask &m_system; + + Pinetime::System::SystemTask& m_system; }; } } - diff --git a/src/components/ble/NavigationService.cpp b/src/components/ble/NavigationService.cpp index 545c44da..e1c20bf1 100644 --- a/src/components/ble/NavigationService.cpp +++ b/src/components/ble/NavigationService.cpp @@ -20,12 +20,12 @@ #include "systemtask/SystemTask.h" -int NAVCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) { - auto navService = static_cast(arg); +int NAVCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt, void* arg) { + auto navService = static_cast(arg); return navService->OnCommand(conn_handle, attr_handle, ctxt); } -Pinetime::Controllers::NavigationService::NavigationService(Pinetime::System::SystemTask &system) : m_system(system) { +Pinetime::Controllers::NavigationService::NavigationService(Pinetime::System::SystemTask& system) : m_system(system) { navUuid.value[14] = navId[0]; navUuid.value[15] = navId[1]; @@ -49,35 +49,25 @@ Pinetime::Controllers::NavigationService::NavigationService(Pinetime::System::Sy navProgressCharUuid.value[14] = navId[0]; navProgressCharUuid.value[15] = navId[1]; - characteristicDefinition[0] = {.uuid = (ble_uuid_t *) (&navFlagCharUuid), - .access_cb = NAVCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; + characteristicDefinition[0] = { + .uuid = (ble_uuid_t*) (&navFlagCharUuid), .access_cb = NAVCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; - characteristicDefinition[1] = {.uuid = (ble_uuid_t *) (&navNarrativeCharUuid), - .access_cb = NAVCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[2] = {.uuid = (ble_uuid_t *) (&navManDistCharUuid), - .access_cb = NAVCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; - characteristicDefinition[3] = {.uuid = (ble_uuid_t *) (&navProgressCharUuid), - .access_cb = NAVCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ - }; + characteristicDefinition[1] = {.uuid = (ble_uuid_t*) (&navNarrativeCharUuid), + .access_cb = NAVCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[2] = {.uuid = (ble_uuid_t*) (&navManDistCharUuid), + .access_cb = NAVCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; + characteristicDefinition[3] = {.uuid = (ble_uuid_t*) (&navProgressCharUuid), + .access_cb = NAVCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_WRITE | BLE_GATT_CHR_F_READ}; characteristicDefinition[4] = {0}; - serviceDefinition[0] = { - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &navUuid, - .characteristics = characteristicDefinition - }; + serviceDefinition[0] = {.type = BLE_GATT_SVC_TYPE_PRIMARY, .uuid = (ble_uuid_t*) &navUuid, .characteristics = characteristicDefinition}; serviceDefinition[1] = {0}; m_progress = 0; @@ -92,45 +82,39 @@ void Pinetime::Controllers::NavigationService::Init() { ASSERT(res == 0); } -int Pinetime::Controllers::NavigationService::OnCommand(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt) { +int Pinetime::Controllers::NavigationService::OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt) { if (ctxt->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { size_t notifSize = OS_MBUF_PKTLEN(ctxt->om); uint8_t data[notifSize + 1]; data[notifSize] = '\0'; os_mbuf_copydata(ctxt->om, 0, notifSize, data); - char *s = (char *) &data[0]; - if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &navFlagCharUuid) == 0) { + char* s = (char*) &data[0]; + if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &navFlagCharUuid) == 0) { m_flag = s; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &navNarrativeCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &navNarrativeCharUuid) == 0) { m_narrative = s; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &navManDistCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &navManDistCharUuid) == 0) { m_manDist = s; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *) &navProgressCharUuid) == 0) { + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t*) &navProgressCharUuid) == 0) { m_progress = data[0]; } } return 0; } -std::string Pinetime::Controllers::NavigationService::getFlag() -{ - return m_flag; +std::string Pinetime::Controllers::NavigationService::getFlag() { + return m_flag; } -std::string Pinetime::Controllers::NavigationService::getNarrative() -{ - return m_narrative; +std::string Pinetime::Controllers::NavigationService::getNarrative() { + return m_narrative; } -std::string Pinetime::Controllers::NavigationService::getManDist() -{ - return m_manDist; +std::string Pinetime::Controllers::NavigationService::getManDist() { + return m_manDist; } -int Pinetime::Controllers::NavigationService::getProgress() -{ - return m_progress; +int Pinetime::Controllers::NavigationService::getProgress() { + return m_progress; } - diff --git a/src/components/ble/NavigationService.h b/src/components/ble/NavigationService.h index 29b17582..5aab263c 100644 --- a/src/components/ble/NavigationService.h +++ b/src/components/ble/NavigationService.h @@ -26,8 +26,9 @@ #undef max #undef min -//c7e60000-78fc-48fe-8e23-433b3a1942d0 -#define NAVIGATION_SERVICE_UUID_BASE {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0x00, 0x00} +// c7e60000-78fc-48fe-8e23-433b3a1942d0 +#define NAVIGATION_SERVICE_UUID_BASE \ + { 0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0x00, 0x00 } namespace Pinetime { namespace System { @@ -37,12 +38,11 @@ namespace Pinetime { class NavigationService { public: - explicit NavigationService(Pinetime::System::SystemTask &system); + explicit NavigationService(Pinetime::System::SystemTask& system); void Init(); - int OnCommand(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt); + int OnCommand(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt); std::string getFlag(); @@ -59,27 +59,12 @@ namespace Pinetime { static constexpr uint8_t navManDistCharId[2] = {0x03, 0x00}; static constexpr uint8_t navProgressCharId[2] = {0x04, 0x00}; - ble_uuid128_t navUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = NAVIGATION_SERVICE_UUID_BASE - }; + ble_uuid128_t navUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = NAVIGATION_SERVICE_UUID_BASE}; - ble_uuid128_t navFlagCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = NAVIGATION_SERVICE_UUID_BASE - }; - ble_uuid128_t navNarrativeCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = NAVIGATION_SERVICE_UUID_BASE - }; - ble_uuid128_t navManDistCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = NAVIGATION_SERVICE_UUID_BASE - }; - ble_uuid128_t navProgressCharUuid{ - .u = {.type = BLE_UUID_TYPE_128}, - .value = NAVIGATION_SERVICE_UUID_BASE - }; + ble_uuid128_t navFlagCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = NAVIGATION_SERVICE_UUID_BASE}; + ble_uuid128_t navNarrativeCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = NAVIGATION_SERVICE_UUID_BASE}; + ble_uuid128_t navManDistCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = NAVIGATION_SERVICE_UUID_BASE}; + ble_uuid128_t navProgressCharUuid {.u = {.type = BLE_UUID_TYPE_128}, .value = NAVIGATION_SERVICE_UUID_BASE}; struct ble_gatt_chr_def characteristicDefinition[5]; struct ble_gatt_svc_def serviceDefinition[2]; @@ -89,8 +74,7 @@ namespace Pinetime { std::string m_manDist; int m_progress; - Pinetime::System::SystemTask &m_system; + Pinetime::System::SystemTask& m_system; }; } } - diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index eb83c709..67a6d691 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -19,36 +19,37 @@ using namespace Pinetime::Controllers; NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::Ble& bleController, - DateTime& dateTimeController, - Pinetime::Controllers::NotificationManager& notificationManager, - Controllers::Battery& batteryController, - Pinetime::Drivers::SpiNorFlash& spiNorFlash, - Controllers::HeartRateController& heartRateController) : - systemTask{systemTask}, - bleController{bleController}, - dateTimeController{dateTimeController}, - notificationManager{notificationManager}, - spiNorFlash{spiNorFlash}, - dfuService{systemTask, bleController, spiNorFlash}, - currentTimeClient{dateTimeController}, - anService{systemTask, notificationManager}, - alertNotificationClient{systemTask, notificationManager}, - currentTimeService{dateTimeController}, - musicService{systemTask}, - navService{systemTask}, - batteryInformationService{batteryController}, - immediateAlertService{systemTask, notificationManager}, - heartRateService{systemTask, heartRateController}, - serviceDiscovery({¤tTimeClient, &alertNotificationClient}) { + DateTime& dateTimeController, + Pinetime::Controllers::NotificationManager& notificationManager, + Controllers::Battery& batteryController, + Pinetime::Drivers::SpiNorFlash& spiNorFlash, + Controllers::HeartRateController& heartRateController) + : systemTask {systemTask}, + bleController {bleController}, + dateTimeController {dateTimeController}, + notificationManager {notificationManager}, + spiNorFlash {spiNorFlash}, + dfuService {systemTask, bleController, spiNorFlash}, + currentTimeClient {dateTimeController}, + anService {systemTask, notificationManager}, + alertNotificationClient {systemTask, notificationManager}, + currentTimeService {dateTimeController}, + musicService {systemTask}, + navService {systemTask}, + batteryInformationService {batteryController}, + immediateAlertService {systemTask, notificationManager}, + heartRateService {systemTask, heartRateController}, + serviceDiscovery({¤tTimeClient, &alertNotificationClient}) { } -int GAPEventCallback(struct ble_gap_event *event, void *arg) { +int GAPEventCallback(struct ble_gap_event* event, void* arg) { auto nimbleController = static_cast(arg); return nimbleController->OnGAPEvent(event); } void NimbleController::Init() { - while (!ble_hs_synced()) {} + while (!ble_hs_synced()) { + } ble_svc_gap_init(); ble_svc_gatt_init(); @@ -81,7 +82,8 @@ void NimbleController::Init() { } void NimbleController::StartAdvertising() { - if(bleController.IsConnected() || ble_gap_conn_active() || ble_gap_adv_active()) return; + if (bleController.IsConnected() || ble_gap_conn_active() || ble_gap_adv_active()) + return; ble_svc_gap_device_name_set(deviceName); @@ -101,29 +103,27 @@ void NimbleController::StartAdvertising() { adv_params.conn_mode = BLE_GAP_CONN_MODE_UND; adv_params.disc_mode = BLE_GAP_DISC_MODE_GEN; - fields.flags = BLE_HS_ADV_F_DISC_GEN | - BLE_HS_ADV_F_BREDR_UNSUP; -// fields.uuids128 = BLE_UUID128(BLE_UUID128_DECLARE( -// 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, -// 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff)); + fields.flags = BLE_HS_ADV_F_DISC_GEN | BLE_HS_ADV_F_BREDR_UNSUP; + // fields.uuids128 = BLE_UUID128(BLE_UUID128_DECLARE( + // 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, + // 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff)); fields.uuids128 = &dfuServiceUuid; fields.num_uuids128 = 1; fields.uuids128_is_complete = 1; fields.tx_pwr_lvl = BLE_HS_ADV_TX_PWR_LVL_AUTO; - rsp_fields.name = (uint8_t *)deviceName; + rsp_fields.name = (uint8_t*) deviceName; rsp_fields.name_len = strlen(deviceName); rsp_fields.name_is_complete = 1; ble_gap_adv_set_fields(&fields); -// ASSERT(res == 0); // TODO this one sometimes fails with error 22 (notsync) + // ASSERT(res == 0); // TODO this one sometimes fails with error 22 (notsync) ble_gap_adv_rsp_set_fields(&rsp_fields); -// ASSERT(res == 0); + // ASSERT(res == 0); - ble_gap_adv_start(addrType, NULL, 180000, - &adv_params, GAPEventCallback, this); -// ASSERT(res == 0);// TODO I've disabled these ASSERT as they sometime asserts and reset the mcu. + ble_gap_adv_start(addrType, NULL, 180000, &adv_params, GAPEventCallback, this); + // ASSERT(res == 0);// TODO I've disabled these ASSERT as they sometime asserts and reset the mcu. // For now, the advertising is restarted as soon as it ends. There may be a race condition // that prevent the advertising from restarting reliably. // I remove the assert to prevent this uncesseray crash, but in the long term, the management of @@ -131,7 +131,7 @@ void NimbleController::StartAdvertising() { // the application has been woken up, for example. } -int NimbleController::OnGAPEvent(ble_gap_event *event) { +int NimbleController::OnGAPEvent(ble_gap_event* event) { switch (event->type) { case BLE_GAP_EVENT_ADV_COMPLETE: NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_ADV_COMPLETE"); @@ -141,8 +141,7 @@ int NimbleController::OnGAPEvent(ble_gap_event *event) { NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_CONNECT"); /* A new connection was established or a connection attempt failed. */ - NRF_LOG_INFO("connection %s; status=%d ", event->connect.status == 0 ? "established" : "failed", - event->connect.status); + NRF_LOG_INFO("connection %s; status=%d ", event->connect.status == 0 ? "established" : "failed", event->connect.status); if (event->connect.status != 0) { /* Connection failed; resume advertising. */ @@ -154,8 +153,7 @@ int NimbleController::OnGAPEvent(ble_gap_event *event) { connectionHandle = event->connect.conn_handle; // Service discovery is deffered via systemtask } - } - break; + } break; case BLE_GAP_EVENT_DISCONNECT: NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_DISCONNECT"); NRF_LOG_INFO("disconnect; reason=%d", event->disconnect.reason); @@ -178,19 +176,16 @@ int NimbleController::OnGAPEvent(ble_gap_event *event) { return 0; case BLE_GAP_EVENT_SUBSCRIBE: NRF_LOG_INFO("subscribe event; conn_handle=%d attr_handle=%d " - "reason=%d prevn=%d curn=%d previ=%d curi=???\n", - event->subscribe.conn_handle, - event->subscribe.attr_handle, - event->subscribe.reason, - event->subscribe.prev_notify, - event->subscribe.cur_notify, - event->subscribe.prev_indicate); + "reason=%d prevn=%d curn=%d previ=%d curi=???\n", + event->subscribe.conn_handle, + event->subscribe.attr_handle, + event->subscribe.reason, + event->subscribe.prev_notify, + event->subscribe.cur_notify, + event->subscribe.prev_indicate); return 0; case BLE_GAP_EVENT_MTU: - NRF_LOG_INFO("mtu update event; conn_handle=%d cid=%d mtu=%d\n", - event->mtu.conn_handle, - event->mtu.channel_id, - event->mtu.value); + NRF_LOG_INFO("mtu update event; conn_handle=%d cid=%d mtu=%d\n", event->mtu.conn_handle, event->mtu.channel_id, event->mtu.value); return 0; case BLE_GAP_EVENT_REPEAT_PAIRING: { @@ -216,9 +211,7 @@ int NimbleController::OnGAPEvent(ble_gap_event *event) { NRF_LOG_INFO("received %s; conn_handle=%d attr_handle=%d " "attr_len=%d", - event->notify_rx.indication ? - "indication" : - "notification", + event->notify_rx.indication ? "indication" : "notification", event->notify_rx.conn_handle, event->notify_rx.attr_handle, notifSize); @@ -229,7 +222,7 @@ int NimbleController::OnGAPEvent(ble_gap_event *event) { /* Attribute data is contained in event->notify_rx.attr_data. */ default: -// NRF_LOG_INFO("Advertising event : %d", event->type); + // NRF_LOG_INFO("Advertising event : %d", event->type); break; } return 0; @@ -239,8 +232,6 @@ void NimbleController::StartDiscovery() { serviceDiscovery.StartDiscovery(connectionHandle); } - uint16_t NimbleController::connHandle() { - return connectionHandle; + return connectionHandle; } - diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h index 7bb135da..5dd01e42 100644 --- a/src/components/ble/NimbleController.h +++ b/src/components/ble/NimbleController.h @@ -36,62 +36,69 @@ namespace Pinetime { class NimbleController { - public: - NimbleController(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::Ble& bleController, - DateTime& dateTimeController, Pinetime::Controllers::NotificationManager& notificationManager, - Controllers::Battery& batteryController, Pinetime::Drivers::SpiNorFlash& spiNorFlash, - Controllers::HeartRateController& heartRateController); - void Init(); - void StartAdvertising(); - int OnGAPEvent(ble_gap_event *event); + public: + NimbleController(Pinetime::System::SystemTask& systemTask, + Pinetime::Controllers::Ble& bleController, + DateTime& dateTimeController, + Pinetime::Controllers::NotificationManager& notificationManager, + Controllers::Battery& batteryController, + Pinetime::Drivers::SpiNorFlash& spiNorFlash, + Controllers::HeartRateController& heartRateController); + void Init(); + void StartAdvertising(); + int OnGAPEvent(ble_gap_event* event); - int OnDiscoveryEvent(uint16_t i, const ble_gatt_error *pError, const ble_gatt_svc *pSvc); - int OnCTSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, - const ble_gatt_chr *characteristic); - int OnANSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, - const ble_gatt_chr *characteristic); - int OnCurrentTimeReadResult(uint16_t connectionHandle, const ble_gatt_error *error, ble_gatt_attr *attribute); - int OnANSDescriptorDiscoveryEventCallback(uint16_t connectionHandle, const ble_gatt_error *error, - uint16_t characteristicValueHandle, const ble_gatt_dsc *descriptor); + int OnDiscoveryEvent(uint16_t i, const ble_gatt_error* pError, const ble_gatt_svc* pSvc); + int OnCTSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_chr* characteristic); + int OnANSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_chr* characteristic); + int OnCurrentTimeReadResult(uint16_t connectionHandle, const ble_gatt_error* error, ble_gatt_attr* attribute); + int OnANSDescriptorDiscoveryEventCallback(uint16_t connectionHandle, + const ble_gatt_error* error, + uint16_t characteristicValueHandle, + const ble_gatt_dsc* descriptor); - void StartDiscovery(); + void StartDiscovery(); - Pinetime::Controllers::MusicService& music() {return musicService;}; - Pinetime::Controllers::NavigationService& navigation() {return navService;}; - Pinetime::Controllers::AlertNotificationService& alertService() {return anService;}; + Pinetime::Controllers::MusicService& music() { + return musicService; + }; + Pinetime::Controllers::NavigationService& navigation() { + return navService; + }; + Pinetime::Controllers::AlertNotificationService& alertService() { + return anService; + }; - uint16_t connHandle(); + uint16_t connHandle(); - private: - static constexpr const char* deviceName = "InfiniTime"; - Pinetime::System::SystemTask& systemTask; - Pinetime::Controllers::Ble& bleController; - DateTime& dateTimeController; - Pinetime::Controllers::NotificationManager& notificationManager; - Pinetime::Drivers::SpiNorFlash& spiNorFlash; - Pinetime::Controllers::DfuService dfuService; + private: + static constexpr const char* deviceName = "InfiniTime"; + Pinetime::System::SystemTask& systemTask; + Pinetime::Controllers::Ble& bleController; + DateTime& dateTimeController; + Pinetime::Controllers::NotificationManager& notificationManager; + Pinetime::Drivers::SpiNorFlash& spiNorFlash; + Pinetime::Controllers::DfuService dfuService; - DeviceInformationService deviceInformationService; - CurrentTimeClient currentTimeClient; - AlertNotificationService anService; - AlertNotificationClient alertNotificationClient; - CurrentTimeService currentTimeService; - MusicService musicService; - NavigationService navService; - BatteryInformationService batteryInformationService; - ImmediateAlertService immediateAlertService; - HeartRateService heartRateService; + DeviceInformationService deviceInformationService; + CurrentTimeClient currentTimeClient; + AlertNotificationService anService; + AlertNotificationClient alertNotificationClient; + CurrentTimeService currentTimeService; + MusicService musicService; + NavigationService navService; + BatteryInformationService batteryInformationService; + ImmediateAlertService immediateAlertService; + HeartRateService heartRateService; - uint8_t addrType; // 1 = Random, 0 = PUBLIC - uint16_t connectionHandle = 0; + uint8_t addrType; // 1 = Random, 0 = PUBLIC + uint16_t connectionHandle = 0; - ble_uuid128_t dfuServiceUuid { - .u { .type = BLE_UUID_TYPE_128}, - .value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, - 0xDE, 0xEF, 0x12, 0x12, 0x30, 0x15, 0x00, 0x00} - }; + ble_uuid128_t dfuServiceUuid { + .u {.type = BLE_UUID_TYPE_128}, + .value = {0x23, 0xD1, 0xBC, 0xEA, 0x5F, 0x78, 0x23, 0x15, 0xDE, 0xEF, 0x12, 0x12, 0x30, 0x15, 0x00, 0x00}}; - ServiceDiscovery serviceDiscovery; + ServiceDiscovery serviceDiscovery; }; } } diff --git a/src/components/ble/NotificationManager.cpp b/src/components/ble/NotificationManager.cpp index 88e83b92..b1b0e6b2 100644 --- a/src/components/ble/NotificationManager.cpp +++ b/src/components/ble/NotificationManager.cpp @@ -6,15 +6,15 @@ using namespace Pinetime::Controllers; constexpr uint8_t NotificationManager::MessageSize; - -void NotificationManager::Push(NotificationManager::Notification &¬if) { +void NotificationManager::Push(NotificationManager::Notification&& notif) { notif.id = GetNextId(); notif.valid = true; notifications[writeIndex] = std::move(notif); writeIndex = (writeIndex + 1 < TotalNbNotifications) ? writeIndex + 1 : 0; - if(!empty) + if (!empty) readIndex = (readIndex + 1 < TotalNbNotifications) ? readIndex + 1 : 0; - else empty = false; + else + empty = false; newNotification = true; } @@ -30,40 +30,48 @@ NotificationManager::Notification::Id NotificationManager::GetNextId() { } NotificationManager::Notification NotificationManager::GetNext(NotificationManager::Notification::Id id) { - auto currentIterator = std::find_if(notifications.begin(), notifications.end(), [id](const Notification& n){return n.valid && n.id == id;}); - if(currentIterator == notifications.end() || currentIterator->id != id) return Notification{}; + auto currentIterator = std::find_if(notifications.begin(), notifications.end(), [id](const Notification& n) { + return n.valid && n.id == id; + }); + if (currentIterator == notifications.end() || currentIterator->id != id) + return Notification {}; auto& lastNotification = notifications[readIndex]; NotificationManager::Notification result; - if(currentIterator == (notifications.end()-1)) + if (currentIterator == (notifications.end() - 1)) result = *(notifications.begin()); else - result = *(currentIterator+1); + result = *(currentIterator + 1); - if(result.id <= id) return {}; + if (result.id <= id) + return {}; - result.index = (lastNotification.id - result.id)+1; + result.index = (lastNotification.id - result.id) + 1; return result; } NotificationManager::Notification NotificationManager::GetPrevious(NotificationManager::Notification::Id id) { - auto currentIterator = std::find_if(notifications.begin(), notifications.end(), [id](const Notification& n){return n.valid && n.id == id;}); - if(currentIterator == notifications.end() || currentIterator->id != id) return Notification{}; + auto currentIterator = std::find_if(notifications.begin(), notifications.end(), [id](const Notification& n) { + return n.valid && n.id == id; + }); + if (currentIterator == notifications.end() || currentIterator->id != id) + return Notification {}; auto& lastNotification = notifications[readIndex]; NotificationManager::Notification result; - if(currentIterator == notifications.begin()) - result = *(notifications.end()-1); + if (currentIterator == notifications.begin()) + result = *(notifications.end() - 1); else - result = *(currentIterator-1); + result = *(currentIterator - 1); - if(result.id >= id) return {}; + if (result.id >= id) + return {}; - result.index = (lastNotification.id - result.id)+1; + result.index = (lastNotification.id - result.id) + 1; return result; } @@ -76,7 +84,7 @@ bool NotificationManager::IsVibrationEnabled() { } void NotificationManager::ToggleVibrations() { - vibrationEnabled = !vibrationEnabled; + vibrationEnabled = !vibrationEnabled; } bool NotificationManager::ClearNewNotificationFlag() { @@ -84,21 +92,23 @@ bool NotificationManager::ClearNewNotificationFlag() { } size_t NotificationManager::NbNotifications() const { - return std::count_if(notifications.begin(), notifications.end(), [](const Notification& n){ return n.valid;}); + return std::count_if(notifications.begin(), notifications.end(), [](const Notification& n) { + return n.valid; + }); } const char* NotificationManager::Notification::Message() const { - const char* itField = std::find(message.begin(), message.begin()+size-1, '\0'); - if(itField != message.begin()+size-1) { - const char* ptr = (itField)+1; + const char* itField = std::find(message.begin(), message.begin() + size - 1, '\0'); + if (itField != message.begin() + size - 1) { + const char* ptr = (itField) + 1; return ptr; } return const_cast(message.data()); } const char* NotificationManager::Notification::Title() const { - const char * itField = std::find(message.begin(), message.begin()+size-1, '\0'); - if(itField != message.begin()+size-1) { + const char* itField = std::find(message.begin(), message.begin() + size - 1, '\0'); + if (itField != message.begin() + size - 1) { return message.data(); } return {}; diff --git a/src/components/ble/NotificationManager.h b/src/components/ble/NotificationManager.h index 486bba15..d4072cc2 100644 --- a/src/components/ble/NotificationManager.h +++ b/src/components/ble/NotificationManager.h @@ -8,23 +8,35 @@ namespace Pinetime { namespace Controllers { class NotificationManager { - public: - enum class Categories {Unknown, SimpleAlert, Email, News, IncomingCall, MissedCall, Sms, VoiceMail, Schedule, HighProriotyAlert, InstantMessage }; - static constexpr uint8_t MessageSize{100}; + public: + enum class Categories { + Unknown, + SimpleAlert, + Email, + News, + IncomingCall, + MissedCall, + Sms, + VoiceMail, + Schedule, + HighProriotyAlert, + InstantMessage + }; + static constexpr uint8_t MessageSize {100}; - struct Notification { - using Id = uint8_t; - Id id; - bool valid = false; - uint8_t index; - uint8_t size; - std::array message; - Categories category = Categories::Unknown; + struct Notification { + using Id = uint8_t; + Id id; + bool valid = false; + uint8_t index; + uint8_t size; + std::array message; + Categories category = Categories::Unknown; - const char* Message() const; - const char* Title() const; - }; - Notification::Id nextId {0}; + const char* Message() const; + const char* Title() const; + }; + Notification::Id nextId {0}; void Push(Notification&& notif); Notification GetLastNotification(); @@ -35,18 +47,20 @@ namespace Pinetime { bool IsVibrationEnabled(); void ToggleVibrations(); - static constexpr size_t MaximumMessageSize() { return MessageSize; }; + static constexpr size_t MaximumMessageSize() { + return MessageSize; + }; size_t NbNotifications() const; - private: - Notification::Id GetNextId(); - static constexpr uint8_t TotalNbNotifications = 5; - std::array notifications; - uint8_t readIndex = 0; - uint8_t writeIndex = 0; - bool empty = true; - std::atomic newNotification{false}; - bool vibrationEnabled = true; + private: + Notification::Id GetNextId(); + static constexpr uint8_t TotalNbNotifications = 5; + std::array notifications; + uint8_t readIndex = 0; + uint8_t writeIndex = 0; + bool empty = true; + std::atomic newNotification {false}; + bool vibrationEnabled = true; }; } } \ No newline at end of file diff --git a/src/components/ble/ServiceDiscovery.cpp b/src/components/ble/ServiceDiscovery.cpp index 4d37b8bd..b36b241c 100644 --- a/src/components/ble/ServiceDiscovery.cpp +++ b/src/components/ble/ServiceDiscovery.cpp @@ -4,8 +4,7 @@ using namespace Pinetime::Controllers; -ServiceDiscovery::ServiceDiscovery(std::array&& clients) : clients{clients} { - +ServiceDiscovery::ServiceDiscovery(std::array&& clients) : clients {clients} { } void ServiceDiscovery::StartDiscovery(uint16_t connectionHandle) { @@ -16,7 +15,7 @@ void ServiceDiscovery::StartDiscovery(uint16_t connectionHandle) { void ServiceDiscovery::OnServiceDiscovered(uint16_t connectionHandle) { clientIterator++; - if(clientIterator != clients.end()) { + if (clientIterator != clients.end()) { DiscoverNextService(connectionHandle); } else { NRF_LOG_INFO("End of service discovery"); @@ -26,7 +25,7 @@ void ServiceDiscovery::OnServiceDiscovered(uint16_t connectionHandle) { void ServiceDiscovery::DiscoverNextService(uint16_t connectionHandle) { NRF_LOG_INFO("[Discovery] Discover next service"); - auto discoverNextService = [this](uint16_t connectionHandle){ + auto discoverNextService = [this](uint16_t connectionHandle) { this->OnServiceDiscovered(connectionHandle); }; (*clientIterator)->Discover(connectionHandle, discoverNextService); diff --git a/src/components/ble/ServiceDiscovery.h b/src/components/ble/ServiceDiscovery.h index 0b26bd1d..fc3b38c0 100644 --- a/src/components/ble/ServiceDiscovery.h +++ b/src/components/ble/ServiceDiscovery.h @@ -8,17 +8,16 @@ namespace Pinetime { class BleClient; class ServiceDiscovery { - public: - ServiceDiscovery(std::array&& bleClients); + public: + ServiceDiscovery(std::array&& bleClients); - void StartDiscovery(uint16_t connectionHandle); + void StartDiscovery(uint16_t connectionHandle); - - private: - BleClient** clientIterator; - std::array clients; - void OnServiceDiscovered(uint16_t connectionHandle); - void DiscoverNextService(uint16_t connectionHandle); + private: + BleClient** clientIterator; + std::array clients; + void OnServiceDiscovered(uint16_t connectionHandle); + void DiscoverNextService(uint16_t connectionHandle); }; } } diff --git a/src/components/brightness/BrightnessController.cpp b/src/components/brightness/BrightnessController.cpp index 0d8f366a..8ad987d1 100644 --- a/src/components/brightness/BrightnessController.cpp +++ b/src/components/brightness/BrightnessController.cpp @@ -4,7 +4,6 @@ using namespace Pinetime::Controllers; - void BrightnessController::Init() { nrf_gpio_cfg_output(pinLcdBacklight1); nrf_gpio_cfg_output(pinLcdBacklight2); @@ -14,7 +13,7 @@ void BrightnessController::Init() { void BrightnessController::Set(BrightnessController::Levels level) { this->level = level; - switch(level) { + switch (level) { default: case Levels::High: nrf_gpio_pin_clear(pinLcdBacklight1); @@ -40,20 +39,34 @@ void BrightnessController::Set(BrightnessController::Levels level) { } void BrightnessController::Lower() { - switch(level) { - case Levels::High: Set(Levels::Medium); break; - case Levels::Medium: Set(Levels::Low); break; - case Levels::Low: Set(Levels::Off); break; - default: break; + switch (level) { + case Levels::High: + Set(Levels::Medium); + break; + case Levels::Medium: + Set(Levels::Low); + break; + case Levels::Low: + Set(Levels::Off); + break; + default: + break; } } void BrightnessController::Higher() { - switch(level) { - case Levels::Off: Set(Levels::Low); break; - case Levels::Low: Set(Levels::Medium); break; - case Levels::Medium: Set(Levels::High); break; - default: break; + switch (level) { + case Levels::Off: + Set(Levels::Low); + break; + case Levels::Low: + Set(Levels::Medium); + break; + case Levels::Medium: + Set(Levels::High); + break; + default: + break; } } @@ -70,29 +83,44 @@ void BrightnessController::Restore() { } void BrightnessController::Step() { - switch(level) { - case Levels::Low: Set(Levels::Medium); break; - case Levels::Medium: Set(Levels::High); break; - case Levels::High: Set(Levels::Low); break; - default: break; + switch (level) { + case Levels::Low: + Set(Levels::Medium); + break; + case Levels::Medium: + Set(Levels::High); + break; + case Levels::High: + Set(Levels::Low); + break; + default: + break; } } const char* BrightnessController::GetIcon() { - switch(level) { - case Levels::Medium: return Applications::Screens::Symbols::brightnessMedium; - case Levels::High: return Applications::Screens::Symbols::brightnessHigh; - default: break; + switch (level) { + case Levels::Medium: + return Applications::Screens::Symbols::brightnessMedium; + case Levels::High: + return Applications::Screens::Symbols::brightnessHigh; + default: + break; } return Applications::Screens::Symbols::brightnessLow; } const char* BrightnessController::ToString() { - switch(level) { - case Levels::Off: return "Off"; - case Levels::Low: return "Low"; - case Levels::Medium: return "Medium"; - case Levels::High: return "High"; - default : return "???"; + switch (level) { + case Levels::Off: + return "Off"; + case Levels::Low: + return "Low"; + case Levels::Medium: + return "Medium"; + case Levels::High: + return "High"; + default: + return "???"; } } \ No newline at end of file diff --git a/src/components/brightness/BrightnessController.h b/src/components/brightness/BrightnessController.h index efff7e81..c47158a9 100644 --- a/src/components/brightness/BrightnessController.h +++ b/src/components/brightness/BrightnessController.h @@ -6,7 +6,7 @@ namespace Pinetime { namespace Controllers { class BrightnessController { public: - enum class Levels {Off, Low, Medium, High}; + enum class Levels { Off, Low, Medium, High }; void Init(); void Set(Levels level); diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp index 9c1f2684..4f9302eb 100644 --- a/src/components/datetime/DateTimeController.cpp +++ b/src/components/datetime/DateTimeController.cpp @@ -5,22 +5,21 @@ using namespace Pinetime::Controllers; -DateTime::DateTime(System::SystemTask& systemTask) : systemTask{systemTask} { - +DateTime::DateTime(System::SystemTask& systemTask) : systemTask {systemTask} { } - -void DateTime::SetTime(uint16_t year, uint8_t month, uint8_t day, uint8_t dayOfWeek, uint8_t hour, uint8_t minute, - uint8_t second, uint32_t systickCounter) { - std::tm tm = { /* .tm_sec = */ second, - /* .tm_min = */ minute, - /* .tm_hour = */ hour, - /* .tm_mday = */ day, - /* .tm_mon = */ month - 1, - /* .tm_year = */ year - 1900, +void DateTime::SetTime( + uint16_t year, uint8_t month, uint8_t day, uint8_t dayOfWeek, uint8_t hour, uint8_t minute, uint8_t second, uint32_t systickCounter) { + std::tm tm = { + /* .tm_sec = */ second, + /* .tm_min = */ minute, + /* .tm_hour = */ hour, + /* .tm_mday = */ day, + /* .tm_mon = */ month - 1, + /* .tm_year = */ year - 1900, }; tm.tm_isdst = -1; // Use DST value from local time zone - currentDateTime = std::chrono::system_clock::from_time_t(std::mktime(&tm)); + currentDateTime = std::chrono::system_clock::from_time_t(std::mktime(&tm)); NRF_LOG_INFO("%d %d %d ", day, month, year); NRF_LOG_INFO("%d %d %d ", hour, minute, second); @@ -34,7 +33,7 @@ void DateTime::SetTime(uint16_t year, uint8_t month, uint8_t day, uint8_t dayOfW void DateTime::UpdateTime(uint32_t systickCounter) { // Handle systick counter overflow uint32_t systickDelta = 0; - if(systickCounter < previousSystickCounter) { + if (systickCounter < previousSystickCounter) { systickDelta = 0xffffff - previousSystickCounter; systickDelta += systickCounter + 1; } else { @@ -42,11 +41,11 @@ void DateTime::UpdateTime(uint32_t systickCounter) { } /* - * 1000 ms = 1024 ticks - */ + * 1000 ms = 1024 ticks + */ auto correctedDelta = systickDelta / 1024; - auto rest = (systickDelta - (correctedDelta*1024)); - if(systickCounter >= rest) { + auto rest = (systickDelta - (correctedDelta * 1024)); + if (systickCounter >= rest) { previousSystickCounter = systickCounter - rest; } else { previousSystickCounter = 0xffffff - (rest - systickCounter); @@ -56,12 +55,12 @@ void DateTime::UpdateTime(uint32_t systickCounter) { uptime += std::chrono::seconds(correctedDelta); auto dp = date::floor(currentDateTime); - auto time = date::make_time(currentDateTime-dp); + auto time = date::make_time(currentDateTime - dp); auto yearMonthDay = date::year_month_day(dp); - year = (int)yearMonthDay.year(); - month = static_cast((unsigned)yearMonthDay.month()); - day = (unsigned)yearMonthDay.day(); + year = (int) yearMonthDay.year(); + month = static_cast((unsigned) yearMonthDay.month()); + day = (unsigned) yearMonthDay.day(); dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); hour = time.hours().count(); @@ -69,7 +68,7 @@ void DateTime::UpdateTime(uint32_t systickCounter) { second = time.seconds().count(); // Notify new day to SystemTask - if(hour == 0 and not isMidnightAlreadyNotified) { + if (hour == 0 and not isMidnightAlreadyNotified) { isMidnightAlreadyNotified = true; systemTask.PushMessage(System::SystemTask::Messages::OnNewDay); } else if (hour != 0) { @@ -77,123 +76,45 @@ void DateTime::UpdateTime(uint32_t systickCounter) { } } -const char *DateTime::MonthShortToString() { - return DateTime::MonthsString[(uint8_t)month]; +const char* DateTime::MonthShortToString() { + return DateTime::MonthsString[(uint8_t) month]; } -const char *DateTime::MonthShortToStringLow() { - return DateTime::MonthsStringLow[(uint8_t)month]; +const char* DateTime::MonthShortToStringLow() { + return DateTime::MonthsStringLow[(uint8_t) month]; } -const char *DateTime::MonthsToStringLow() { - return DateTime::MonthsLow[(uint8_t)month]; +const char* DateTime::MonthsToStringLow() { + return DateTime::MonthsLow[(uint8_t) month]; } -const char *DateTime::DayOfWeekToString() { - return DateTime::DaysString[(uint8_t)dayOfWeek]; +const char* DateTime::DayOfWeekToString() { + return DateTime::DaysString[(uint8_t) dayOfWeek]; } -const char *DateTime::DayOfWeekShortToString() { - return DateTime::DaysStringShort[(uint8_t)dayOfWeek]; +const char* DateTime::DayOfWeekShortToString() { + return DateTime::DaysStringShort[(uint8_t) dayOfWeek]; } -const char *DateTime::DayOfWeekToStringLow() { - return DateTime::DaysStringLow[(uint8_t)dayOfWeek]; +const char* DateTime::DayOfWeekToStringLow() { + return DateTime::DaysStringLow[(uint8_t) dayOfWeek]; } -const char *DateTime::DayOfWeekShortToStringLow() { - return DateTime::DaysStringShortLow[(uint8_t)dayOfWeek]; +const char* DateTime::DayOfWeekShortToStringLow() { + return DateTime::DaysStringShortLow[(uint8_t) dayOfWeek]; } +char const* DateTime::DaysStringLow[] = {"--", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}; -char const *DateTime::DaysStringLow[] = { - "--", - "Monday", - "Tuesday", - "Wednesday", - "Thursday", - "Friday", - "Saturday", - "Sunday" -}; +char const* DateTime::DaysStringShortLow[] = {"--", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"}; -char const *DateTime::DaysStringShortLow[] = { - "--", - "Mon", - "Tue", - "Wed", - "Thu", - "Fri", - "Sat", - "Sun" -}; +char const* DateTime::DaysStringShort[] = {"--", "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"}; -char const *DateTime::DaysStringShort[] = { - "--", - "MON", - "TUE", - "WED", - "THU", - "FRI", - "SAT", - "SUN" -}; +char const* DateTime::DaysString[] = {"--", "MONDAY", "TUESDAY", "WEDNESDAY", "THURSDAY", "FRIDAY", "SATURDAY", "SUNDAY"}; -char const *DateTime::DaysString[] = { - "--", - "MONDAY", - "TUESDAY", - "WEDNESDAY", - "THURSDAY", - "FRIDAY", - "SATURDAY", - "SUNDAY" -}; +char const* DateTime::MonthsString[] = {"--", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}; -char const *DateTime::MonthsString[] = { - "--", - "JAN", - "FEB", - "MAR", - "APR", - "MAY", - "JUN", - "JUL", - "AUG", - "SEP", - "OCT", - "NOV", - "DEC" -}; +char const* DateTime::MonthsStringLow[] = {"--", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; -char const *DateTime::MonthsStringLow[] = { - "--", - "Jan", - "Feb", - "Mar", - "Apr", - "May", - "Jun", - "Jul", - "Aug", - "Sep", - "Oct", - "Nov", - "Dec" -}; - -char const *DateTime::MonthsLow[] = { - "--", - "January", - "February", - "March", - "April", - "May", - "June", - "July", - "August", - "September", - "October", - "November", - "December" -}; \ No newline at end of file +char const* DateTime::MonthsLow[] = { + "--", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; \ No newline at end of file diff --git a/src/components/datetime/DateTimeController.h b/src/components/datetime/DateTimeController.h index fb0969d1..d0ae727e 100644 --- a/src/components/datetime/DateTimeController.h +++ b/src/components/datetime/DateTimeController.h @@ -9,56 +9,95 @@ namespace Pinetime { } namespace Controllers { class DateTime { - public: - enum class Days : uint8_t {Unknown, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday}; - enum class Months : uint8_t {Unknown, January, February, March, April, May, June, July, August, September, October, November, December}; + public: + enum class Days : uint8_t { Unknown, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday }; + enum class Months : uint8_t { + Unknown, + January, + February, + March, + April, + May, + June, + July, + August, + September, + October, + November, + December + }; - DateTime(System::SystemTask& systemTask); + DateTime(System::SystemTask& systemTask); - void SetTime(uint16_t year, uint8_t month, uint8_t day, uint8_t dayOfWeek, uint8_t hour, uint8_t minute, uint8_t second, uint32_t systickCounter); - void UpdateTime(uint32_t systickCounter); - uint16_t Year() const { return year; } - Months Month() const { return month; } - uint8_t Day() const { return day; } - Days DayOfWeek() const { return dayOfWeek; } - uint8_t Hours() const { return hour; } - uint8_t Minutes() const { return minute; } - uint8_t Seconds() const { return second; } + void SetTime(uint16_t year, + uint8_t month, + uint8_t day, + uint8_t dayOfWeek, + uint8_t hour, + uint8_t minute, + uint8_t second, + uint32_t systickCounter); + void UpdateTime(uint32_t systickCounter); + uint16_t Year() const { + return year; + } + Months Month() const { + return month; + } + uint8_t Day() const { + return day; + } + Days DayOfWeek() const { + return dayOfWeek; + } + uint8_t Hours() const { + return hour; + } + uint8_t Minutes() const { + return minute; + } + uint8_t Seconds() const { + return second; + } - const char *MonthShortToString(); - const char *MonthShortToStringLow(); - const char *MonthsToStringLow(); - const char *DayOfWeekToString(); - const char *DayOfWeekShortToString(); - const char *DayOfWeekToStringLow(); - const char *DayOfWeekShortToStringLow(); + const char* MonthShortToString(); + const char* MonthShortToStringLow(); + const char* MonthsToStringLow(); + const char* DayOfWeekToString(); + const char* DayOfWeekShortToString(); + const char* DayOfWeekToStringLow(); + const char* DayOfWeekShortToStringLow(); - std::chrono::time_point CurrentDateTime() const { return currentDateTime; } - std::chrono::seconds Uptime() const { return uptime; } - private: - System::SystemTask& systemTask; - uint16_t year = 0; - Months month = Months::Unknown; - uint8_t day = 0; - Days dayOfWeek = Days::Unknown; - uint8_t hour = 0; - uint8_t minute = 0; - uint8_t second = 0; + std::chrono::time_point CurrentDateTime() const { + return currentDateTime; + } + std::chrono::seconds Uptime() const { + return uptime; + } - uint32_t previousSystickCounter = 0; - std::chrono::time_point currentDateTime; - std::chrono::seconds uptime {0}; + private: + System::SystemTask& systemTask; + uint16_t year = 0; + Months month = Months::Unknown; + uint8_t day = 0; + Days dayOfWeek = Days::Unknown; + uint8_t hour = 0; + uint8_t minute = 0; + uint8_t second = 0; - bool isMidnightAlreadyNotified = false; + uint32_t previousSystickCounter = 0; + std::chrono::time_point currentDateTime; + std::chrono::seconds uptime {0}; - static char const *DaysString[]; - static char const *DaysStringShort[]; - static char const *DaysStringLow[]; - static char const *DaysStringShortLow[]; - static char const *MonthsString[]; - static char const *MonthsStringLow[]; - static char const *MonthsLow[]; + bool isMidnightAlreadyNotified = false; + static char const* DaysString[]; + static char const* DaysStringShort[]; + static char const* DaysStringLow[]; + static char const* DaysStringShortLow[]; + static char const* MonthsString[]; + static char const* MonthsStringLow[]; + static char const* MonthsLow[]; }; } } \ No newline at end of file diff --git a/src/components/firmwarevalidator/FirmwareValidator.cpp b/src/components/firmwarevalidator/FirmwareValidator.cpp index 48f98550..68e66d37 100644 --- a/src/components/firmwarevalidator/FirmwareValidator.cpp +++ b/src/components/firmwarevalidator/FirmwareValidator.cpp @@ -6,12 +6,12 @@ using namespace Pinetime::Controllers; bool FirmwareValidator::IsValidated() const { - auto* imageOkPtr = reinterpret_cast(validBitAdress); + auto* imageOkPtr = reinterpret_cast(validBitAdress); return (*imageOkPtr) == validBitValue; } void FirmwareValidator::Validate() { - if(!IsValidated()) + if (!IsValidated()) Pinetime::Drivers::InternalFlash::WriteWord(validBitAdress, validBitValue); } diff --git a/src/components/firmwarevalidator/FirmwareValidator.h b/src/components/firmwarevalidator/FirmwareValidator.h index aa576d88..ce644f97 100644 --- a/src/components/firmwarevalidator/FirmwareValidator.h +++ b/src/components/firmwarevalidator/FirmwareValidator.h @@ -5,14 +5,15 @@ namespace Pinetime { namespace Controllers { class FirmwareValidator { - public: - void Validate(); - bool IsValidated() const; + public: + void Validate(); + bool IsValidated() const; - void Reset(); - private: - static constexpr uint32_t validBitAdress {0x7BFE8}; - static constexpr uint32_t validBitValue {1}; + void Reset(); + + private: + static constexpr uint32_t validBitAdress {0x7BFE8}; + static constexpr uint32_t validBitValue {1}; }; } } diff --git a/src/components/gfx/Gfx.cpp b/src/components/gfx/Gfx.cpp index 59fa8164..cf271032 100644 --- a/src/components/gfx/Gfx.cpp +++ b/src/components/gfx/Gfx.cpp @@ -2,11 +2,10 @@ #include "drivers/St7789.h" using namespace Pinetime::Components; -Gfx::Gfx(Pinetime::Drivers::St7789 &lcd) : lcd{lcd} { +Gfx::Gfx(Pinetime::Drivers::St7789& lcd) : lcd {lcd} { } void Gfx::Init() { - } void Gfx::ClearScreen() { @@ -17,10 +16,9 @@ void Gfx::ClearScreen() { state.busy = true; state.action = Action::FillRectangle; state.taskToNotify = xTaskGetCurrentTaskHandle(); - - lcd.DrawBuffer(0, 0, width, height, reinterpret_cast(buffer), width * 2); - WaitTransferFinished(); + lcd.DrawBuffer(0, 0, width, height, reinterpret_cast(buffer), width * 2); + WaitTransferFinished(); } void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t color) { @@ -33,7 +31,7 @@ void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t col state.color = color; state.taskToNotify = xTaskGetCurrentTaskHandle(); - lcd.DrawBuffer(x, y, w, h, reinterpret_cast(buffer), width * 2); + lcd.DrawBuffer(x, y, w, h, reinterpret_cast(buffer), width * 2); WaitTransferFinished(); } @@ -46,12 +44,12 @@ void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t* b) state.color = 0x00; state.taskToNotify = xTaskGetCurrentTaskHandle(); - lcd.DrawBuffer(x, y, w, h, reinterpret_cast(b), width * 2); + lcd.DrawBuffer(x, y, w, h, reinterpret_cast(b), width * 2); WaitTransferFinished(); } -void Gfx::DrawString(uint8_t x, uint8_t y, uint16_t color, const char *text, const FONT_INFO *p_font, bool wrap) { +void Gfx::DrawString(uint8_t x, uint8_t y, uint16_t color, const char* text, const FONT_INFO* p_font, bool wrap) { if (y > (height - p_font->height)) { // Not enough space to write even single char. return; @@ -86,7 +84,7 @@ void Gfx::DrawString(uint8_t x, uint8_t y, uint16_t color, const char *text, con } } -void Gfx::DrawChar(const FONT_INFO *font, uint8_t c, uint8_t *x, uint8_t y, uint16_t color) { +void Gfx::DrawChar(const FONT_INFO* font, uint8_t c, uint8_t* x, uint8_t y, uint16_t color) { uint8_t char_idx = c - font->startChar; uint16_t bytes_in_line = CEIL_DIV(font->charInfo[char_idx].widthBits, 8); uint16_t bg = 0x0000; @@ -100,10 +98,9 @@ void Gfx::DrawChar(const FONT_INFO *font, uint8_t c, uint8_t *x, uint8_t y, uint for (uint16_t j = 0; j < bytes_in_line; j++) { for (uint8_t k = 0; k < 8; k++) { if ((1 << (7 - k)) & font->data[font->charInfo[char_idx].offset + j]) { - buffer[(j*8)+k] = color; - } - else { - buffer[(j*8)+k] = bg; + buffer[(j * 8) + k] = color; + } else { + buffer[(j * 8) + k] = bg; } } } @@ -112,12 +109,12 @@ void Gfx::DrawChar(const FONT_INFO *font, uint8_t c, uint8_t *x, uint8_t y, uint state.currentIteration = 0; state.busy = true; state.action = Action::DrawChar; - state.font = const_cast(font); + state.font = const_cast(font); state.character = c; state.color = color; state.taskToNotify = xTaskGetCurrentTaskHandle(); - lcd.DrawBuffer(*x, y, bytes_in_line*8, font->height, reinterpret_cast(&buffer), bytes_in_line*8*2); + lcd.DrawBuffer(*x, y, bytes_in_line * 8, font->height, reinterpret_cast(&buffer), bytes_in_line * 8 * 2); WaitTransferFinished(); *x += font->charInfo[char_idx].widthBits + font->spacePixels; @@ -136,13 +133,14 @@ void Gfx::Wakeup() { } void Gfx::SetBackgroundColor(uint16_t color) { - for(int i = 0; i < width; i++) { + for (int i = 0; i < width; i++) { buffer[i] = color; } } -bool Gfx::GetNextBuffer(uint8_t **data, size_t &size) { - if(!state.busy) return false; +bool Gfx::GetNextBuffer(uint8_t** data, size_t& size) { + if (!state.busy) + return false; state.remainingIterations--; if (state.remainingIterations == 0) { state.busy = false; @@ -150,27 +148,26 @@ bool Gfx::GetNextBuffer(uint8_t **data, size_t &size) { return false; } - if(state.action == Action::FillRectangle) { - *data = reinterpret_cast(buffer); + if (state.action == Action::FillRectangle) { + *data = reinterpret_cast(buffer); size = width * 2; - } else if(state.action == Action::DrawChar) { + } else if (state.action == Action::DrawChar) { uint16_t bg = 0x0000; uint8_t char_idx = state.character - state.font->startChar; uint16_t bytes_in_line = CEIL_DIV(state.font->charInfo[char_idx].widthBits, 8); for (uint16_t j = 0; j < bytes_in_line; j++) { for (uint8_t k = 0; k < 8; k++) { - if ((1 << (7 - k)) & state.font->data[state.font->charInfo[char_idx].offset + ((state.currentIteration+1) * bytes_in_line) + j]) { - buffer[(j*8)+k] = state.color; - } - else { - buffer[(j*8)+k] = bg; + if ((1 << (7 - k)) & state.font->data[state.font->charInfo[char_idx].offset + ((state.currentIteration + 1) * bytes_in_line) + j]) { + buffer[(j * 8) + k] = state.color; + } else { + buffer[(j * 8) + k] = bg; } } } - *data = reinterpret_cast(buffer); - size = bytes_in_line*8*2; + *data = reinterpret_cast(buffer); + size = bytes_in_line * 8 * 2; } state.currentIteration++; @@ -179,7 +176,7 @@ bool Gfx::GetNextBuffer(uint8_t **data, size_t &size) { } void Gfx::NotifyEndOfTransfer(TaskHandle_t task) { - if(task != nullptr) { + if (task != nullptr) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; vTaskNotifyGiveFromISR(task, &xHigherPriorityTaskWoken); portYIELD_FROM_ISR(xHigherPriorityTaskWoken); diff --git a/src/components/gfx/Gfx.h b/src/components/gfx/Gfx.h index 4c0fc8ee..54c4a8b7 100644 --- a/src/components/gfx/Gfx.h +++ b/src/components/gfx/Gfx.h @@ -12,49 +12,48 @@ namespace Pinetime { } namespace Components { class Gfx : public Pinetime::Drivers::BufferProvider { - public: - explicit Gfx(Drivers::St7789& lcd); - void Init(); - void ClearScreen(); - void DrawString(uint8_t x, uint8_t y, uint16_t color, const char* text, const FONT_INFO *p_font, bool wrap); - void DrawChar(const FONT_INFO *font, uint8_t c, uint8_t *x, uint8_t y, uint16_t color); - void FillRectangle(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint16_t color); - void FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t* b); - void SetScrollArea(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines); - void SetScrollStartLine(uint16_t line); + public: + explicit Gfx(Drivers::St7789& lcd); + void Init(); + void ClearScreen(); + void DrawString(uint8_t x, uint8_t y, uint16_t color, const char* text, const FONT_INFO* p_font, bool wrap); + void DrawChar(const FONT_INFO* font, uint8_t c, uint8_t* x, uint8_t y, uint16_t color); + void FillRectangle(uint8_t x, uint8_t y, uint8_t width, uint8_t height, uint16_t color); + void FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t* b); + void SetScrollArea(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines); + void SetScrollStartLine(uint16_t line); + void Sleep(); + void Wakeup(); + bool GetNextBuffer(uint8_t** buffer, size_t& size) override; + void pixel_draw(uint8_t x, uint8_t y, uint16_t color); - void Sleep(); - void Wakeup(); - bool GetNextBuffer(uint8_t **buffer, size_t &size) override; - void pixel_draw(uint8_t x, uint8_t y, uint16_t color); + private: + static constexpr uint8_t width = 240; + static constexpr uint8_t height = 240; + enum class Action { None, FillRectangle, DrawChar }; + struct State { + State() : busy {false}, action {Action::None}, remainingIterations {0}, currentIteration {0} { + } + volatile bool busy; + volatile Action action; + volatile uint16_t remainingIterations; + volatile uint16_t currentIteration; + volatile FONT_INFO* font; + volatile uint16_t color; + volatile uint8_t character; + volatile TaskHandle_t taskToNotify = nullptr; + }; - private: - static constexpr uint8_t width = 240; - static constexpr uint8_t height = 240; + volatile State state; - enum class Action { None, FillRectangle, DrawChar}; - struct State { - State() : busy{false}, action{Action::None}, remainingIterations{0}, currentIteration{0} {} - volatile bool busy; - volatile Action action; - volatile uint16_t remainingIterations; - volatile uint16_t currentIteration; - volatile FONT_INFO *font; - volatile uint16_t color; - volatile uint8_t character; - volatile TaskHandle_t taskToNotify = nullptr; - }; + uint16_t buffer[width]; // 1 line buffer + Drivers::St7789& lcd; - volatile State state; - - uint16_t buffer[width]; // 1 line buffer - Drivers::St7789& lcd; - - void SetBackgroundColor(uint16_t color); - void WaitTransferFinished() const; - void NotifyEndOfTransfer(TaskHandle_t task); + void SetBackgroundColor(uint16_t color); + void WaitTransferFinished() const; + void NotifyEndOfTransfer(TaskHandle_t task); }; } } diff --git a/src/components/heartrate/Biquad.cpp b/src/components/heartrate/Biquad.cpp index 6a4b8181..0341eda6 100644 --- a/src/components/heartrate/Biquad.cpp +++ b/src/components/heartrate/Biquad.cpp @@ -9,8 +9,7 @@ using namespace Pinetime::Controllers; /** Original implementation from wasp-os : https://github.com/daniel-thompson/wasp-os/blob/master/wasp/ppg.py */ -Biquad::Biquad(float b0, float b1, float b2, float a1, float a2) : b0{b0}, b1{b1}, b2{b2}, a1{a1}, a2{a2} { - +Biquad::Biquad(float b0, float b1, float b2, float a1, float a2) : b0 {b0}, b1 {b1}, b2 {b2}, a1 {a1}, a2 {a2} { } float Biquad::Step(float x) { diff --git a/src/components/heartrate/Biquad.h b/src/components/heartrate/Biquad.h index dc9b97f6..7c8ca58f 100644 --- a/src/components/heartrate/Biquad.h +++ b/src/components/heartrate/Biquad.h @@ -5,7 +5,7 @@ namespace Pinetime { /// Direct Form II Biquad Filter class Biquad { public: - Biquad(float b0, float b1, float b2, float a1, float a2); + Biquad(float b0, float b1, float b2, float a1, float a2); float Step(float x); private: diff --git a/src/components/heartrate/HeartRateController.cpp b/src/components/heartrate/HeartRateController.cpp index d0b0d513..e84d665a 100644 --- a/src/components/heartrate/HeartRateController.cpp +++ b/src/components/heartrate/HeartRateController.cpp @@ -4,38 +4,35 @@ using namespace Pinetime::Controllers; -HeartRateController::HeartRateController(Pinetime::System::SystemTask &systemTask) : systemTask{systemTask} { - +HeartRateController::HeartRateController(Pinetime::System::SystemTask& systemTask) : systemTask {systemTask} { } - void HeartRateController::Update(HeartRateController::States newState, uint8_t heartRate) { this->state = newState; - if(this->heartRate != heartRate) { + if (this->heartRate != heartRate) { this->heartRate = heartRate; service->OnNewHeartRateValue(heartRate); } } void HeartRateController::Start() { - if(task != nullptr) { + if (task != nullptr) { state = States::NotEnoughData; task->PushMessage(Pinetime::Applications::HeartRateTask::Messages::StartMeasurement); } } void HeartRateController::Stop() { - if(task != nullptr) { + if (task != nullptr) { state = States::Stopped; task->PushMessage(Pinetime::Applications::HeartRateTask::Messages::StopMeasurement); } } -void HeartRateController::SetHeartRateTask(Pinetime::Applications::HeartRateTask *task) { +void HeartRateController::SetHeartRateTask(Pinetime::Applications::HeartRateTask* task) { this->task = task; } -void HeartRateController::SetService(Pinetime::Controllers::HeartRateService *service) { +void HeartRateController::SetService(Pinetime::Controllers::HeartRateService* service) { this->service = service; } - diff --git a/src/components/heartrate/HeartRateController.h b/src/components/heartrate/HeartRateController.h index 001111b5..d3a8460d 100644 --- a/src/components/heartrate/HeartRateController.h +++ b/src/components/heartrate/HeartRateController.h @@ -13,7 +13,7 @@ namespace Pinetime { namespace Controllers { class HeartRateController { public: - enum class States { Stopped, NotEnoughData, NoTouch, Running}; + enum class States { Stopped, NotEnoughData, NoTouch, Running }; explicit HeartRateController(System::SystemTask& systemTask); @@ -22,10 +22,14 @@ namespace Pinetime { void Update(States newState, uint8_t heartRate); void SetHeartRateTask(Applications::HeartRateTask* task); - States State() const { return state; } - uint8_t HeartRate() const { return heartRate; } + States State() const { + return state; + } + uint8_t HeartRate() const { + return heartRate; + } - void SetService(Pinetime::Controllers::HeartRateService *service); + void SetService(Pinetime::Controllers::HeartRateService* service); private: System::SystemTask& systemTask; diff --git a/src/components/heartrate/Ppg.cpp b/src/components/heartrate/Ppg.cpp index e84cbdf3..578e2895 100644 --- a/src/components/heartrate/Ppg.cpp +++ b/src/components/heartrate/Ppg.cpp @@ -13,7 +13,7 @@ using namespace Pinetime::Controllers; namespace { int Compare(int* d1, int* d2, size_t count) { int e = 0; - for(size_t i = 0; i < count; i++) { + for (size_t i = 0; i < count; i++) { auto d = d1[i] - d2[i]; e += d * d; } @@ -21,15 +21,15 @@ namespace { } int CompareShift(int* d, int shift, size_t count) { - return Compare(d +shift, d, count - shift); + return Compare(d + shift, d, count - shift); } int Trough(int* d, size_t size, float mn, float mx) { - auto z2 = CompareShift(d, mn-2, size); - auto z1 = CompareShift(d, mn-1, size); - for(int i = mn; i < mx + 1; i++) { + auto z2 = CompareShift(d, mn - 2, size); + auto z1 = CompareShift(d, mn - 1, size); + for (int i = mn; i < mx + 1; i++) { auto z = CompareShift(d, i, size); - if(z2 > z1 && z1 < z) + if (z2 > z1 && z1 < z) return i; z2 = z1; z1 = z; @@ -38,11 +38,11 @@ namespace { } } -Ppg::Ppg(float spl) : offset{spl}, - hpf{0.87033078, -1.74066156, 0.87033078,-1.72377617, 0.75754694}, - agc{20, 0.971, 2}, - lpf{0.11595249, 0.23190498, 0.11595249,-0.72168143, 0.18549138} { - +Ppg::Ppg(float spl) + : offset {spl}, + hpf {0.87033078, -1.74066156, 0.87033078, -1.72377617, 0.75754694}, + agc {20, 0.971, 2}, + lpf {0.11595249, 0.23190498, 0.11595249, -0.72168143, 0.18549138} { } int Ppg::Preprocess(float spl) { @@ -53,13 +53,13 @@ int Ppg::Preprocess(float spl) { auto spl_int = static_cast(spl); - if(dataIndex < 200) + if (dataIndex < 200) data[dataIndex++] = spl_int; return spl_int; } float Ppg::HeartRate() { - if(dataIndex < 200) + if (dataIndex < 200) return 0; NRF_LOG_INFO("PREPROCESS, offset = %d", offset); @@ -71,26 +71,26 @@ float Ppg::HeartRate() { int cccount = 0; float Ppg::ProcessHeartRate() { - if(cccount > 2) + if (cccount > 2) asm("nop"); - cccount ++; + cccount++; auto t0 = Trough(data.data(), dataIndex, 7, 48); - if(t0 < 0) + if (t0 < 0) return 0; float t1 = t0 * 2; - t1 = Trough(data.data(), dataIndex, t1-5, t1+5); - if(t1 < 0) + t1 = Trough(data.data(), dataIndex, t1 - 5, t1 + 5); + if (t1 < 0) return 0; float t2 = static_cast(t1 * 3) / 2; t2 = Trough(data.data(), dataIndex, t2 - 5, t2 + 5); - if(t2 < 0) + if (t2 < 0) return 0; float t3 = static_cast(t2 * 4) / 3; t3 = Trough(data.data(), dataIndex, t3 - 4, t3 + 4); - if(t3 < 0) + if (t3 < 0) return static_cast(60 * 24 * 3) / static_cast(t2); return static_cast(60 * 24 * 4) / static_cast(t3); diff --git a/src/components/heartrate/Ppg.h b/src/components/heartrate/Ppg.h index 747ae019..6a2fcf18 100644 --- a/src/components/heartrate/Ppg.h +++ b/src/components/heartrate/Ppg.h @@ -24,7 +24,6 @@ namespace Pinetime { Ptagc agc; Biquad lpf; - float ProcessHeartRate(); }; } diff --git a/src/components/heartrate/Ptagc.cpp b/src/components/heartrate/Ptagc.cpp index dd7c4411..e358371e 100644 --- a/src/components/heartrate/Ptagc.cpp +++ b/src/components/heartrate/Ptagc.cpp @@ -10,17 +10,16 @@ using namespace Pinetime::Controllers; /** Original implementation from wasp-os : https://github.com/daniel-thompson/wasp-os/blob/master/wasp/ppg.py */ -Ptagc::Ptagc(float start, float decay, float threshold) : peak{start}, decay{decay}, boost{1.0f/decay}, threshold{threshold} { - +Ptagc::Ptagc(float start, float decay, float threshold) : peak {start}, decay {decay}, boost {1.0f / decay}, threshold {threshold} { } float Ptagc::Step(float spl) { - if(std::abs(spl) > peak) + if (std::abs(spl) > peak) peak *= boost; else peak *= decay; - if((spl > (peak * threshold)) || (spl < (peak * -threshold))) + if ((spl > (peak * threshold)) || (spl < (peak * -threshold))) return 0.0f; spl = 100.0f * spl / (2.0f * peak); diff --git a/src/components/heartrate/Ptagc.h b/src/components/heartrate/Ptagc.h index c20de4c0..3476636b 100644 --- a/src/components/heartrate/Ptagc.h +++ b/src/components/heartrate/Ptagc.h @@ -12,7 +12,6 @@ namespace Pinetime { float decay; float boost; float threshold; - }; } } diff --git a/src/components/motion/MotionController.h b/src/components/motion/MotionController.h index d56fc7a5..3a238262 100644 --- a/src/components/motion/MotionController.h +++ b/src/components/motion/MotionController.h @@ -8,14 +8,24 @@ namespace Pinetime { public: void Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps); - int16_t X() const { return x; } - int16_t Y() const { return y; } - int16_t Z() const { return z; } - uint32_t NbSteps() const { return nbSteps; } + int16_t X() const { + return x; + } + int16_t Y() const { + return y; + } + int16_t Z() const { + return z; + } + uint32_t NbSteps() const { + return nbSteps; + } bool ShouldWakeUp(bool isSleeping); void IsSensorOk(bool isOk); - bool IsSensorOk() const { return isSensorOk; } + bool IsSensorOk() const { + return isSensorOk; + } private: uint32_t nbSteps; diff --git a/src/components/motor/MotorController.cpp b/src/components/motor/MotorController.cpp index 345234b3..a834ab6b 100644 --- a/src/components/motor/MotorController.cpp +++ b/src/components/motor/MotorController.cpp @@ -7,24 +7,26 @@ APP_TIMER_DEF(vibTimer); using namespace Pinetime::Controllers; -MotorController::MotorController( Controllers::Settings &settingsController ) : settingsController{settingsController} {} +MotorController::MotorController(Controllers::Settings& settingsController) : settingsController {settingsController} { +} void MotorController::Init() { - nrf_gpio_cfg_output(pinMotor); - nrf_gpio_pin_set(pinMotor); - app_timer_init(); - app_timer_create(&vibTimer, APP_TIMER_MODE_SINGLE_SHOT, vibrate); + nrf_gpio_cfg_output(pinMotor); + nrf_gpio_pin_set(pinMotor); + app_timer_init(); + app_timer_create(&vibTimer, APP_TIMER_MODE_SINGLE_SHOT, vibrate); } void MotorController::SetDuration(uint8_t motorDuration) { - if ( settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF ) return; - - nrf_gpio_pin_clear(pinMotor); - /* Start timer for motorDuration miliseconds and timer triggers vibrate() when it finishes*/ - app_timer_start(vibTimer, APP_TIMER_TICKS(motorDuration), NULL); + if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::OFF) + return; + + nrf_gpio_pin_clear(pinMotor); + /* Start timer for motorDuration miliseconds and timer triggers vibrate() when it finishes*/ + app_timer_start(vibTimer, APP_TIMER_TICKS(motorDuration), NULL); } -void MotorController::vibrate(void * p_context) { - nrf_gpio_pin_set(pinMotor); +void MotorController::vibrate(void* p_context) { + nrf_gpio_pin_set(pinMotor); } \ No newline at end of file diff --git a/src/components/motor/MotorController.h b/src/components/motor/MotorController.h index 2f2e0343..df61af78 100644 --- a/src/components/motor/MotorController.h +++ b/src/components/motor/MotorController.h @@ -9,14 +9,14 @@ namespace Pinetime { static constexpr uint8_t pinMotor = 16; class MotorController { - public: - MotorController( Controllers::Settings &settingsController ); - void Init(); - void SetDuration(uint8_t motorDuration); + public: + MotorController(Controllers::Settings& settingsController); + void Init(); + void SetDuration(uint8_t motorDuration); - private: - Controllers::Settings& settingsController; - static void vibrate(void * p_context); + private: + Controllers::Settings& settingsController; + static void vibrate(void* p_context); }; } } diff --git a/src/components/rle/RleDecoder.cpp b/src/components/rle/RleDecoder.cpp index 19a90fda..df2bcb6b 100644 --- a/src/components/rle/RleDecoder.cpp +++ b/src/components/rle/RleDecoder.cpp @@ -2,18 +2,16 @@ using namespace Pinetime::Tools; -RleDecoder::RleDecoder(const uint8_t *buffer, size_t size) : buffer{buffer}, size{size} { - +RleDecoder::RleDecoder(const uint8_t* buffer, size_t size) : buffer {buffer}, size {size} { } -RleDecoder::RleDecoder(const uint8_t *buffer, size_t size, uint16_t foregroundColor, uint16_t backgroundColor) : RleDecoder{buffer, size} { +RleDecoder::RleDecoder(const uint8_t* buffer, size_t size, uint16_t foregroundColor, uint16_t backgroundColor) : RleDecoder {buffer, size} { this->foregroundColor = foregroundColor; this->backgroundColor = backgroundColor; } - -void RleDecoder::DecodeNext(uint8_t *output, size_t maxBytes) { - for (;encodedBufferIndex> 8; @@ -36,4 +34,3 @@ void RleDecoder::DecodeNext(uint8_t *output, size_t maxBytes) { color = backgroundColor; } } - diff --git a/src/components/settings/Settings.cpp b/src/components/settings/Settings.cpp index 454df577..071940b8 100644 --- a/src/components/settings/Settings.cpp +++ b/src/components/settings/Settings.cpp @@ -5,110 +5,107 @@ using namespace Pinetime::Controllers; struct SettingsHeader { - uint8_t isActive; // 0xF1 = Block is active, 0xF0 = Block is inactive - uint16_t version; // Current version, to verify if the saved data is for the current Version + uint8_t isActive; // 0xF1 = Block is active, 0xF0 = Block is inactive + uint16_t version; // Current version, to verify if the saved data is for the current Version }; #define HEADER_SIZE sizeof(SettingsHeader) - -Settings::Settings( Pinetime::Drivers::SpiNorFlash &spiNorFlash ) : spiNorFlash{spiNorFlash} {} +Settings::Settings(Pinetime::Drivers::SpiNorFlash& spiNorFlash) : spiNorFlash {spiNorFlash} { +} void Settings::Init() { - // Load default settings from Flash - LoadSettingsFromFlash(); - + // Load default settings from Flash + LoadSettingsFromFlash(); } void Settings::SaveSettings() { - // verify if is necessary to save - if ( settingsChanged ) { - SaveSettingsToFlash(); - } - settingsChanged = false; + // verify if is necessary to save + if (settingsChanged) { + SaveSettingsToFlash(); + } + settingsChanged = false; } - bool Settings::FindHeader() { - SettingsHeader settingsHeader; - uint8_t bufferHead[sizeof(settingsHeader)]; + SettingsHeader settingsHeader; + uint8_t bufferHead[sizeof(settingsHeader)]; - for (uint8_t block = 0; block < 10; block++) { - - spiNorFlash.Read( settingsBaseAddr + (block * 0x1000), bufferHead, sizeof(settingsHeader) ); - std::memcpy(&settingsHeader, bufferHead, sizeof(settingsHeader)); - if ( settingsHeader.isActive == 0xF1 && settingsHeader.version == settingsVersion ) { - settingsFlashBlock = block; - return true; - } + for (uint8_t block = 0; block < 10; block++) { + + spiNorFlash.Read(settingsBaseAddr + (block * 0x1000), bufferHead, sizeof(settingsHeader)); + std::memcpy(&settingsHeader, bufferHead, sizeof(settingsHeader)); + if (settingsHeader.isActive == 0xF1 && settingsHeader.version == settingsVersion) { + settingsFlashBlock = block; + return true; } - return false; + } + return false; } void Settings::ReadSettingsData() { - uint8_t bufferSettings[sizeof(settings)]; - spiNorFlash.Read( settingsBaseAddr + (settingsFlashBlock * 0x1000) + HEADER_SIZE, bufferSettings, sizeof(settings) ); - std::memcpy(&settings, bufferSettings, sizeof(settings)); + uint8_t bufferSettings[sizeof(settings)]; + spiNorFlash.Read(settingsBaseAddr + (settingsFlashBlock * 0x1000) + HEADER_SIZE, bufferSettings, sizeof(settings)); + std::memcpy(&settings, bufferSettings, sizeof(settings)); } void Settings::EraseBlock() { - spiNorFlash.SectorErase(settingsBaseAddr + (settingsFlashBlock * 0x1000)); + spiNorFlash.SectorErase(settingsBaseAddr + (settingsFlashBlock * 0x1000)); } -void Settings::SetHeader( bool state ) { - SettingsHeader settingsHeader; - uint8_t bufferHead[sizeof(settingsHeader)]; - settingsHeader.isActive = state ? 0xF1 : 0xF0; - settingsHeader.version = settingsVersion; - - std::memcpy(bufferHead, &settingsHeader, sizeof(settingsHeader)); - spiNorFlash.Write(settingsBaseAddr + (settingsFlashBlock * 0x1000), bufferHead, sizeof(settingsHeader)); +void Settings::SetHeader(bool state) { + SettingsHeader settingsHeader; + uint8_t bufferHead[sizeof(settingsHeader)]; + settingsHeader.isActive = state ? 0xF1 : 0xF0; + settingsHeader.version = settingsVersion; + std::memcpy(bufferHead, &settingsHeader, sizeof(settingsHeader)); + spiNorFlash.Write(settingsBaseAddr + (settingsFlashBlock * 0x1000), bufferHead, sizeof(settingsHeader)); } void Settings::SaveSettingsData() { - uint8_t bufferSettings[sizeof(settings)]; - std::memcpy(bufferSettings, &settings, sizeof(settings)); - spiNorFlash.Write(settingsBaseAddr + (settingsFlashBlock * 0x1000) + HEADER_SIZE, bufferSettings, sizeof(settings)); + uint8_t bufferSettings[sizeof(settings)]; + std::memcpy(bufferSettings, &settings, sizeof(settings)); + spiNorFlash.Write(settingsBaseAddr + (settingsFlashBlock * 0x1000) + HEADER_SIZE, bufferSettings, sizeof(settings)); } void Settings::LoadSettingsFromFlash() { - if ( settingsFlashBlock == 99 ) { - // Find current Block, if can't find use default settings and set block to 0 ans save ! - if ( FindHeader() ) { - ReadSettingsData(); - } else { - SaveSettingsToFlash(); - } + if (settingsFlashBlock == 99) { + // Find current Block, if can't find use default settings and set block to 0 ans save ! + if (FindHeader()) { + ReadSettingsData(); } else { - // Read Settings from flash... - // never used :) - ReadSettingsData(); + SaveSettingsToFlash(); } - + } else { + // Read Settings from flash... + // never used :) + ReadSettingsData(); + } } void Settings::SaveSettingsToFlash() { - - // calculate where to save... - // mark current to inactive - // erase the new location and save - // set settingsFlashBlock - // if first time hever, only saves to block 0 and set settingsFlashBlock + // calculate where to save... + // mark current to inactive + // erase the new location and save + // set settingsFlashBlock - if ( settingsFlashBlock != 99 ) { - SetHeader( false ); - } + // if first time hever, only saves to block 0 and set settingsFlashBlock - settingsFlashBlock++; - if ( settingsFlashBlock > 9 ) settingsFlashBlock = 0; + if (settingsFlashBlock != 99) { + SetHeader(false); + } - EraseBlock(); - SetHeader( true ); - SaveSettingsData(); + settingsFlashBlock++; + if (settingsFlashBlock > 9) + settingsFlashBlock = 0; + + EraseBlock(); + SetHeader(true); + SaveSettingsData(); } diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 1c412d24..4409425b 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -8,104 +8,129 @@ namespace Pinetime { namespace Controllers { class Settings { - public: - enum class ClockType {H24, H12}; - enum class Vibration {ON, OFF}; - enum class WakeUpMode {None, SingleTap, DoubleTap, RaiseWrist}; + public: + enum class ClockType { H24, H12 }; + enum class Vibration { ON, OFF }; + enum class WakeUpMode { None, SingleTap, DoubleTap, RaiseWrist }; - Settings( Pinetime::Drivers::SpiNorFlash &spiNorFlash ); + Settings(Pinetime::Drivers::SpiNorFlash& spiNorFlash); - void Init(); - void SaveSettings(); + void Init(); + void SaveSettings(); - void SetClockFace( uint8_t face ) { - if ( face != settings.clockFace ) settingsChanged = true; - settings.clockFace = face; - }; - uint8_t GetClockFace() const { return settings.clockFace; }; + void SetClockFace(uint8_t face) { + if (face != settings.clockFace) + settingsChanged = true; + settings.clockFace = face; + }; + uint8_t GetClockFace() const { + return settings.clockFace; + }; - void SetAppMenu( uint8_t menu ) { appMenu = menu; }; - uint8_t GetAppMenu() { return appMenu; }; + void SetAppMenu(uint8_t menu) { + appMenu = menu; + }; + uint8_t GetAppMenu() { + return appMenu; + }; - void SetSettingsMenu( uint8_t menu ) { settingsMenu = menu; }; - uint8_t GetSettingsMenu() const { return settingsMenu; }; + void SetSettingsMenu(uint8_t menu) { + settingsMenu = menu; + }; + uint8_t GetSettingsMenu() const { + return settingsMenu; + }; - void SetClockType( ClockType clocktype ) { - if ( clocktype != settings.clockType ) settingsChanged = true; - settings.clockType = clocktype; - }; - ClockType GetClockType() const { return settings.clockType; }; + void SetClockType(ClockType clocktype) { + if (clocktype != settings.clockType) + settingsChanged = true; + settings.clockType = clocktype; + }; + ClockType GetClockType() const { + return settings.clockType; + }; - void SetVibrationStatus( Vibration status ) { - if ( status != settings.vibrationStatus ) settingsChanged = true; - settings.vibrationStatus = status; - }; - Vibration GetVibrationStatus() const { return settings.vibrationStatus; }; + void SetVibrationStatus(Vibration status) { + if (status != settings.vibrationStatus) + settingsChanged = true; + settings.vibrationStatus = status; + }; + Vibration GetVibrationStatus() const { + return settings.vibrationStatus; + }; - void SetScreenTimeOut( uint32_t timeout ) { - if ( timeout != settings.screenTimeOut ) settingsChanged = true; - settings.screenTimeOut = timeout; - }; - uint32_t GetScreenTimeOut() const { return settings.screenTimeOut; }; + void SetScreenTimeOut(uint32_t timeout) { + if (timeout != settings.screenTimeOut) + settingsChanged = true; + settings.screenTimeOut = timeout; + }; + uint32_t GetScreenTimeOut() const { + return settings.screenTimeOut; + }; - void setWakeUpMode( WakeUpMode wakeUp ) { - if ( wakeUp != settings.wakeUpMode ) settingsChanged = true; - settings.wakeUpMode = wakeUp; - }; - WakeUpMode getWakeUpMode() const { return settings.wakeUpMode; }; + void setWakeUpMode(WakeUpMode wakeUp) { + if (wakeUp != settings.wakeUpMode) + settingsChanged = true; + settings.wakeUpMode = wakeUp; + }; + WakeUpMode getWakeUpMode() const { + return settings.wakeUpMode; + }; - void SetBrightness( Controllers::BrightnessController::Levels level ) { - if ( level != settings.brightLevel ) settingsChanged = true; - settings.brightLevel = level; - }; - Controllers::BrightnessController::Levels GetBrightness() const { return settings.brightLevel; }; + void SetBrightness(Controllers::BrightnessController::Levels level) { + if (level != settings.brightLevel) + settingsChanged = true; + settings.brightLevel = level; + }; + Controllers::BrightnessController::Levels GetBrightness() const { + return settings.brightLevel; + }; - void SetStepsGoal( uint32_t goal ) { - if ( goal != settings.stepsGoal ) settingsChanged = true; - settings.stepsGoal = goal; - }; - uint32_t GetStepsGoal() const { return settings.stepsGoal; }; + void SetStepsGoal( uint32_t goal ) { + if ( goal != settings.stepsGoal ) + settingsChanged = true; + settings.stepsGoal = goal; + }; + + uint32_t GetStepsGoal() const { return settings.stepsGoal; }; - private: + private: + Pinetime::Drivers::SpiNorFlash& spiNorFlash; + struct SettingsData { - Pinetime::Drivers::SpiNorFlash& spiNorFlash; - struct SettingsData { + ClockType clockType = ClockType::H24; + Vibration vibrationStatus = Vibration::ON; - ClockType clockType = ClockType::H24; - Vibration vibrationStatus = Vibration::ON; + uint8_t clockFace = 0; - uint8_t clockFace = 0; + uint32_t stepsGoal = 10000; + uint32_t screenTimeOut = 15000; - uint32_t stepsGoal = 10000; - uint32_t screenTimeOut = 15000; + WakeUpMode wakeUpMode = WakeUpMode::None; - WakeUpMode wakeUpMode = WakeUpMode::None; + Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium; + }; - Controllers::BrightnessController::Levels brightLevel = Controllers::BrightnessController::Levels::Medium; + SettingsData settings; + bool settingsChanged = false; - }; + uint8_t appMenu = 0; + uint8_t settingsMenu = 0; - SettingsData settings; - bool settingsChanged = false; + // There are 10 blocks of reserved flash to save settings + // to minimize wear, the recording is done in a rotating way by the 10 blocks + uint8_t settingsFlashBlock = 99; // default to indicate it needs to find the active block - uint8_t appMenu = 0; - uint8_t settingsMenu = 0; - - // There are 10 blocks of reserved flash to save settings - // to minimize wear, the recording is done in a rotating way by the 10 blocks - uint8_t settingsFlashBlock = 99; // default to indicate it needs to find the active block - - static constexpr uint32_t settingsBaseAddr = 0x3F6000; // Flash Settings Location - static constexpr uint16_t settingsVersion = 0x0100; // Flash Settings Version - - bool FindHeader(); - void ReadSettingsData(); - void EraseBlock(); - void SetHeader( bool state ); - void SaveSettingsData(); - void LoadSettingsFromFlash(); - void SaveSettingsToFlash(); + static constexpr uint32_t settingsBaseAddr = 0x3F6000; // Flash Settings Location + static constexpr uint16_t settingsVersion = 0x0100; // Flash Settings Version + bool FindHeader(); + void ReadSettingsData(); + void EraseBlock(); + void SetHeader(bool state); + void SaveSettingsData(); + void LoadSettingsFromFlash(); + void SaveSettingsToFlash(); }; } } \ No newline at end of file diff --git a/src/displayapp/Apps.h b/src/displayapp/Apps.h index 338ef629..09a20181 100644 --- a/src/displayapp/Apps.h +++ b/src/displayapp/Apps.h @@ -3,9 +3,32 @@ namespace Pinetime { namespace Applications { enum class Apps { - None, Launcher, Clock, SysInfo, FirmwareUpdate, FirmwareValidation, NotificationsPreview, Notifications, FlashLight, BatteryInfo, - Music, Paint, Paddle, Twos, HeartRate, Navigation, StopWatch, Motion, Steps, - QuickSettings, Settings, SettingWatchFace, SettingTimeFormat, SettingDisplay, SettingWakeUp, SettingSteps + None, + Launcher, + Clock, + SysInfo, + FirmwareUpdate, + FirmwareValidation, + NotificationsPreview, + Notifications, + FlashLight, + BatteryInfo, + Music, + Paint, + Paddle, + Twos, + HeartRate, + Navigation, + StopWatch, + Motion, + Steps, + QuickSettings, + Settings, + SettingWatchFace, + SettingTimeFormat, + SettingDisplay, + SettingWakeUp, + SettingSteps }; } } diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index ffc5d3fc..3e25ec83 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -42,29 +42,33 @@ using namespace Pinetime::Applications; using namespace Pinetime::Applications::Display; -DisplayApp::DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &touchPanel, - Controllers::Battery &batteryController, Controllers::Ble &bleController, - Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog, - System::SystemTask &systemTask, +DisplayApp::DisplayApp(Drivers::St7789& lcd, + Components::LittleVgl& lvgl, + Drivers::Cst816S& touchPanel, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::DateTime& dateTimeController, + Drivers::WatchdogView& watchdog, + System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::HeartRateController& heartRateController, - Controllers::Settings &settingsController, - Pinetime::Controllers::MotionController& motionController) : - lcd{lcd}, - lvgl{lvgl}, - touchPanel{touchPanel}, - batteryController{batteryController}, - bleController{bleController}, - dateTimeController{dateTimeController}, - watchdog{watchdog}, - systemTask{systemTask}, - notificationManager{notificationManager}, - heartRateController{heartRateController}, - settingsController{settingsController}, - motionController{motionController} { + Controllers::Settings& settingsController, + Pinetime::Controllers::MotionController& motionController) + : lcd {lcd}, + lvgl {lvgl}, + touchPanel {touchPanel}, + batteryController {batteryController}, + bleController {bleController}, + dateTimeController {dateTimeController}, + watchdog {watchdog}, + systemTask {systemTask}, + notificationManager {notificationManager}, + heartRateController {heartRateController}, + settingsController {settingsController}, + motionController {motionController} { msgQueue = xQueueCreate(queueSize, itemSize); // Start clock when smartwatch boots - LoadApp( Apps::Clock, DisplayApp::FullRefreshDirections::None ); + LoadApp(Apps::Clock, DisplayApp::FullRefreshDirections::None); } void DisplayApp::Start() { @@ -72,8 +76,8 @@ void DisplayApp::Start() { APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); } -void DisplayApp::Process(void *instance) { - auto *app = static_cast(instance); +void DisplayApp::Process(void* instance) { + auto* app = static_cast(instance); NRF_LOG_INFO("displayapp task started!"); app->InitHw(); @@ -114,7 +118,7 @@ void DisplayApp::Refresh() { switch (msg) { case Messages::GoToSleep: brightnessController.Backup(); - while(brightnessController.Level() != Controllers::BrightnessController::Levels::Off) { + while (brightnessController.Level() != Controllers::BrightnessController::Levels::Off) { brightnessController.Lower(); vTaskDelay(100); } @@ -129,30 +133,32 @@ void DisplayApp::Refresh() { break; case Messages::UpdateTimeOut: systemTask.PushMessage(System::SystemTask::Messages::UpdateTimeOut); - break; + break; case Messages::UpdateBleConnection: -// clockScreen.SetBleConnectionState(bleController.IsConnected() ? Screens::Clock::BleConnectionStates::Connected : Screens::Clock::BleConnectionStates::NotConnected); + // clockScreen.SetBleConnectionState(bleController.IsConnected() ? Screens::Clock::BleConnectionStates::Connected : + // Screens::Clock::BleConnectionStates::NotConnected); break; case Messages::UpdateBatteryLevel: batteryController.Update(); break; case Messages::NewNotification: - LoadApp( Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down ); + LoadApp(Apps::NotificationsPreview, DisplayApp::FullRefreshDirections::Down); break; case Messages::TouchEvent: { - if (state != States::Running) break; + if (state != States::Running) + break; auto gesture = OnTouchEvent(); - if(!currentScreen->OnTouchEvent(gesture)) { - if ( currentApp == Apps::Clock ) { + if (!currentScreen->OnTouchEvent(gesture)) { + if (currentApp == Apps::Clock) { switch (gesture) { case TouchEvents::SwipeUp: - LoadApp( Apps::Launcher, DisplayApp::FullRefreshDirections::Up ); + LoadApp(Apps::Launcher, DisplayApp::FullRefreshDirections::Up); break; case TouchEvents::SwipeDown: - LoadApp( Apps::Notifications, DisplayApp::FullRefreshDirections::Down ); + LoadApp(Apps::Notifications, DisplayApp::FullRefreshDirections::Down); break; case TouchEvents::SwipeRight: - LoadApp( Apps::QuickSettings, DisplayApp::FullRefreshDirections::RightAnim ); + LoadApp(Apps::QuickSettings, DisplayApp::FullRefreshDirections::RightAnim); break; case TouchEvents::DoubleTap: systemTask.PushMessage(System::SystemTask::Messages::GoToSleep); @@ -160,36 +166,35 @@ void DisplayApp::Refresh() { default: break; } - } else if ( returnTouchEvent == gesture ) { - LoadApp( returnToApp, returnDirection ); + } else if (returnTouchEvent == gesture) { + LoadApp(returnToApp, returnDirection); } } - } - break; + } break; case Messages::ButtonPushed: - if( currentApp == Apps::Clock ) { + if (currentApp == Apps::Clock) { systemTask.PushMessage(System::SystemTask::Messages::GoToSleep); } else { - if ( !currentScreen->OnButtonPushed() ) { - LoadApp( returnToApp, returnDirection ); + if (!currentScreen->OnButtonPushed()) { + LoadApp(returnToApp, returnDirection); } } break; case Messages::BleFirmwareUpdateStarted: - LoadApp( Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down ); + LoadApp(Apps::FirmwareUpdate, DisplayApp::FullRefreshDirections::Down); + break; + case Messages::UpdateDateTime: + // Added to remove warning + // What should happen here? break; - case Messages::UpdateDateTime: - // Added to remove warning - // What should happen here? - break; } } - if(state != States::Idle && touchMode == TouchModes::Polling) { + if (state != States::Idle && touchMode == TouchModes::Polling) { auto info = touchPanel.GetTouchInfo(); - if(info.action == 2) {// 2 = contact - if(!currentScreen->OnTouchEvent(info.x, info.y)) { + if (info.action == 2) { // 2 = contact + if (!currentScreen->OnTouchEvent(info.x, info.y)) { lvgl.SetNewTapEvent(info.x, info.y); } } @@ -197,14 +202,14 @@ void DisplayApp::Refresh() { } void DisplayApp::RunningState() { - if(!currentScreen->Refresh()) { - LoadApp( returnToApp, returnDirection ); + if (!currentScreen->Refresh()) { + LoadApp(returnToApp, returnDirection); } lv_task_handler(); } void DisplayApp::StartApp(Apps app, DisplayApp::FullRefreshDirections direction) { - LoadApp( app, direction ); + LoadApp(app, direction); } void DisplayApp::returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent) { @@ -215,19 +220,26 @@ void DisplayApp::returnApp(Apps app, DisplayApp::FullRefreshDirections direction void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) { currentScreen.reset(nullptr); - SetFullRefresh( direction ); + SetFullRefresh(direction); // default return to launcher returnApp(Apps::Launcher, FullRefreshDirections::Down, TouchEvents::SwipeDown); - switch(app) { + switch (app) { case Apps::Launcher: currentScreen = std::make_unique(this, settingsController, batteryController, dateTimeController); returnApp(Apps::Clock, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::None: case Apps::Clock: - currentScreen = std::make_unique(this, dateTimeController, batteryController, bleController, notificationManager, settingsController, heartRateController, motionController); + currentScreen = std::make_unique(this, + dateTimeController, + batteryController, + bleController, + notificationManager, + settingsController, + heartRateController, + motionController); break; case Apps::FirmwareValidation: @@ -239,17 +251,20 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) break; case Apps::Notifications: - currentScreen = std::make_unique(this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal); + currentScreen = std::make_unique( + this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal); returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); break; case Apps::NotificationsPreview: - currentScreen = std::make_unique(this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview); + currentScreen = std::make_unique( + this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview); returnApp(Apps::Clock, FullRefreshDirections::Up, TouchEvents::SwipeUp); break; // Settings case Apps::QuickSettings: - currentScreen = std::make_unique(this, batteryController, dateTimeController, brightnessController, settingsController); + currentScreen = + std::make_unique(this, batteryController, dateTimeController, brightnessController, settingsController); returnApp(Apps::Clock, FullRefreshDirections::LeftAnim, TouchEvents::SwipeLeft); break; case Apps::Settings: @@ -281,10 +296,11 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; case Apps::SysInfo: - currentScreen = std::make_unique(this, dateTimeController, batteryController, brightnessController, bleController, watchdog); + currentScreen = + std::make_unique(this, dateTimeController, batteryController, brightnessController, bleController, watchdog); returnApp(Apps::Settings, FullRefreshDirections::Down, TouchEvents::SwipeDown); break; - // + // case Apps::FlashLight: currentScreen = std::make_unique(this, systemTask, brightnessController); @@ -322,7 +338,6 @@ void DisplayApp::LoadApp(Apps app, DisplayApp::FullRefreshDirections direction) } void DisplayApp::IdleState() { - } void DisplayApp::PushMessage(Messages msg) { @@ -337,10 +352,10 @@ void DisplayApp::PushMessage(Messages msg) { TouchEvents DisplayApp::OnTouchEvent() { auto info = touchPanel.GetTouchInfo(); - if(info.isTouch) { - switch(info.gesture) { + if (info.isTouch) { + switch (info.gesture) { case Pinetime::Drivers::Cst816S::Gestures::SingleTap: - if(touchMode == TouchModes::Gestures) + if (touchMode == TouchModes::Gestures) lvgl.SetNewTapEvent(info.x, info.y); return TouchEvents::Tap; case Pinetime::Drivers::Cst816S::Gestures::LongPress: @@ -364,7 +379,7 @@ TouchEvents DisplayApp::OnTouchEvent() { } void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) { - switch(direction){ + switch (direction) { case DisplayApp::FullRefreshDirections::Down: lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down); break; @@ -383,11 +398,11 @@ void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) { case DisplayApp::FullRefreshDirections::RightAnim: lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::RightAnim); break; - default: break; + default: + break; } } void DisplayApp::SetTouchMode(DisplayApp::TouchModes mode) { touchMode = mode; } - diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index 85aee0fe..ff5ddac8 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -35,74 +35,73 @@ namespace Pinetime { }; namespace Applications { class DisplayApp { - public: - enum class States {Idle, Running}; - enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim }; - enum class TouchModes { Gestures, Polling }; + public: + enum class States { Idle, Running }; + enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim }; + enum class TouchModes { Gestures, Polling }; - DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &, - Controllers::Battery &batteryController, Controllers::Ble &bleController, - Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog, - System::SystemTask &systemTask, - Pinetime::Controllers::NotificationManager& notificationManager, - Pinetime::Controllers::HeartRateController& heartRateController, - Controllers::Settings &settingsController, - Pinetime::Controllers::MotionController& motionController - ); - void Start(); - void PushMessage(Display::Messages msg); + DisplayApp(Drivers::St7789& lcd, + Components::LittleVgl& lvgl, + Drivers::Cst816S&, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::DateTime& dateTimeController, + Drivers::WatchdogView& watchdog, + System::SystemTask& systemTask, + Pinetime::Controllers::NotificationManager& notificationManager, + Pinetime::Controllers::HeartRateController& heartRateController, + Controllers::Settings& settingsController, + Pinetime::Controllers::MotionController& motionController); + void Start(); + void PushMessage(Display::Messages msg); - void StartApp(Apps app, DisplayApp::FullRefreshDirections direction); + void StartApp(Apps app, DisplayApp::FullRefreshDirections direction); - void SetFullRefresh(FullRefreshDirections direction); - void SetTouchMode(TouchModes mode); + void SetFullRefresh(FullRefreshDirections direction); + void SetTouchMode(TouchModes mode); - private: + private: + Pinetime::Drivers::St7789& lcd; + Pinetime::Components::LittleVgl& lvgl; + Pinetime::Drivers::Cst816S& touchPanel; + Pinetime::Controllers::Battery& batteryController; + Pinetime::Controllers::Ble& bleController; + Pinetime::Controllers::DateTime& dateTimeController; + Pinetime::Drivers::WatchdogView& watchdog; + Pinetime::System::SystemTask& systemTask; + Pinetime::Controllers::NotificationManager& notificationManager; + Pinetime::Controllers::HeartRateController& heartRateController; + Pinetime::Controllers::Settings& settingsController; + Pinetime::Controllers::MotionController& motionController; - Pinetime::Drivers::St7789& lcd; - Pinetime::Components::LittleVgl& lvgl; - Pinetime::Drivers::Cst816S& touchPanel; - Pinetime::Controllers::Battery &batteryController; - Pinetime::Controllers::Ble &bleController; - Pinetime::Controllers::DateTime& dateTimeController; - Pinetime::Drivers::WatchdogView& watchdog; - Pinetime::System::SystemTask& systemTask; - Pinetime::Controllers::NotificationManager& notificationManager; - Pinetime::Controllers::HeartRateController& heartRateController; - Pinetime::Controllers::Settings& settingsController; - Pinetime::Controllers::MotionController& motionController; + Pinetime::Controllers::FirmwareValidator validator; + Controllers::BrightnessController brightnessController; - Pinetime::Controllers::FirmwareValidator validator; - Controllers::BrightnessController brightnessController; + TaskHandle_t taskHandle; - TaskHandle_t taskHandle; + States state = States::Running; + QueueHandle_t msgQueue; - States state = States::Running; - QueueHandle_t msgQueue; + static constexpr uint8_t queueSize = 10; + static constexpr uint8_t itemSize = 1; - static constexpr uint8_t queueSize = 10; - static constexpr uint8_t itemSize = 1; + std::unique_ptr currentScreen; - std::unique_ptr currentScreen; + Apps currentApp = Apps::None; + Apps returnToApp = Apps::None; + FullRefreshDirections returnDirection = FullRefreshDirections::None; + TouchEvents returnTouchEvent = TouchEvents::None; - Apps currentApp = Apps::None; - Apps returnToApp = Apps::None; - FullRefreshDirections returnDirection = FullRefreshDirections::None; - TouchEvents returnTouchEvent = TouchEvents::None; - - TouchModes touchMode = TouchModes::Gestures; - - TouchEvents OnTouchEvent(); - void RunningState(); - void IdleState(); - static void Process(void* instance); - void InitHw(); - void Refresh(); - void returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent); - void LoadApp(Apps app, DisplayApp::FullRefreshDirections direction); + TouchModes touchMode = TouchModes::Gestures; + TouchEvents OnTouchEvent(); + void RunningState(); + void IdleState(); + static void Process(void* instance); + void InitHw(); + void Refresh(); + void returnApp(Apps app, DisplayApp::FullRefreshDirections direction, TouchEvents touchEvent); + void LoadApp(Apps app, DisplayApp::FullRefreshDirections direction); }; } } - - diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp index d5723835..5c7dd03d 100644 --- a/src/displayapp/DisplayAppRecovery.cpp +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -7,17 +7,20 @@ using namespace Pinetime::Applications; -DisplayApp::DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &touchPanel, - Controllers::Battery &batteryController, Controllers::Ble &bleController, - Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog, - System::SystemTask &systemTask, +DisplayApp::DisplayApp(Drivers::St7789& lcd, + Components::LittleVgl& lvgl, + Drivers::Cst816S& touchPanel, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::DateTime& dateTimeController, + Drivers::WatchdogView& watchdog, + System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::HeartRateController& heartRateController, Pinetime::Controllers::Settings& settingsController, - Pinetime::Controllers::MotionController& motionController): - lcd{lcd}, bleController{bleController} { + Pinetime::Controllers::MotionController& motionController) + : lcd {lcd}, bleController {bleController} { msgQueue = xQueueCreate(queueSize, itemSize); - } void DisplayApp::Start() { @@ -25,8 +28,8 @@ void DisplayApp::Start() { APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); } -void DisplayApp::Process(void *instance) { - auto *app = static_cast(instance); +void DisplayApp::Process(void* instance) { + auto* app = static_cast(instance); NRF_LOG_INFO("displayapp task started!"); // Send a dummy notification to unlock the lvgl display driver for the first iteration @@ -61,8 +64,9 @@ void DisplayApp::Refresh() { } if (bleController.IsFirmwareUpdating()) { - uint8_t percent = (static_cast(bleController.FirmwareUpdateCurrentBytes()) / - static_cast(bleController.FirmwareUpdateTotalBytes())) * 100.0f; + uint8_t percent = + (static_cast(bleController.FirmwareUpdateCurrentBytes()) / static_cast(bleController.FirmwareUpdateTotalBytes())) * + 100.0f; switch (bleController.State()) { case Controllers::Ble::FirmwareUpdateStates::Running: DisplayOtaProgress(percent, colorWhite); @@ -81,20 +85,20 @@ void DisplayApp::Refresh() { void DisplayApp::DisplayLogo(uint16_t color) { Pinetime::Tools::RleDecoder rleDecoder(infinitime_nb, sizeof(infinitime_nb), color, colorBlack); - for(int i = 0; i < displayWidth; i++) { + for (int i = 0; i < displayWidth; i++) { rleDecoder.DecodeNext(displayBuffer, displayWidth * bytesPerPixel); ulTaskNotifyTake(pdTRUE, 500); - lcd.DrawBuffer(0, i, displayWidth, 1, reinterpret_cast(displayBuffer), displayWidth * bytesPerPixel); + lcd.DrawBuffer(0, i, displayWidth, 1, reinterpret_cast(displayBuffer), displayWidth * bytesPerPixel); } } void DisplayApp::DisplayOtaProgress(uint8_t percent, uint16_t color) { const uint8_t barHeight = 20; - std::fill(displayBuffer, displayBuffer+(displayWidth * bytesPerPixel), color); - for(int i = 0; i < barHeight; i++) { + std::fill(displayBuffer, displayBuffer + (displayWidth * bytesPerPixel), color); + for (int i = 0; i < barHeight; i++) { ulTaskNotifyTake(pdTRUE, 500); uint16_t barWidth = std::min(static_cast(percent) * 2.4f, static_cast(displayWidth)); - lcd.DrawBuffer(0, displayWidth - barHeight + i, barWidth, 1, reinterpret_cast(displayBuffer), barWidth * bytesPerPixel); + lcd.DrawBuffer(0, displayWidth - barHeight + i, barWidth, 1, reinterpret_cast(displayBuffer), barWidth * bytesPerPixel); } } diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h index c35fa729..025be6c0 100644 --- a/src/displayapp/DisplayAppRecovery.h +++ b/src/displayapp/DisplayAppRecovery.h @@ -30,10 +30,14 @@ namespace Pinetime { namespace Applications { class DisplayApp { public: - DisplayApp(Drivers::St7789 &lcd, Components::LittleVgl &lvgl, Drivers::Cst816S &, - Controllers::Battery &batteryController, Controllers::Ble &bleController, - Controllers::DateTime &dateTimeController, Drivers::WatchdogView &watchdog, - System::SystemTask &systemTask, + DisplayApp(Drivers::St7789& lcd, + Components::LittleVgl& lvgl, + Drivers::Cst816S&, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::DateTime& dateTimeController, + Drivers::WatchdogView& watchdog, + System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::HeartRateController& heartRateController, Pinetime::Controllers::Settings& settingsController, @@ -49,7 +53,7 @@ namespace Pinetime { void InitHw(); void Refresh(); Pinetime::Drivers::St7789& lcd; - Controllers::Ble &bleController; + Controllers::Ble& bleController; static constexpr uint8_t queueSize = 10; static constexpr uint8_t itemSize = 1; @@ -66,10 +70,6 @@ namespace Pinetime { static constexpr uint16_t colorRedSwapped = 0x00ff; static constexpr uint16_t colorBlack = 0x0000; uint8_t displayBuffer[displayWidth * bytesPerPixel]; - - }; } } - - diff --git a/src/displayapp/DummyLittleVgl.h b/src/displayapp/DummyLittleVgl.h index 1c60911c..96cf153f 100644 --- a/src/displayapp/DummyLittleVgl.h +++ b/src/displayapp/DummyLittleVgl.h @@ -9,22 +9,25 @@ namespace Pinetime { namespace Components { class LittleVgl { - public: - enum class FullRefreshDirections { None, Up, Down }; - LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) {} - - LittleVgl(const LittleVgl&) = delete; - LittleVgl& operator=(const LittleVgl&) = delete; - LittleVgl(LittleVgl&&) = delete; - LittleVgl& operator=(LittleVgl&&) = delete; - - void FlushDisplay(const lv_area_t * area, lv_color_t * color_p) {} - bool GetTouchPadInfo(lv_indev_data_t *ptr) {return false;} - void SetFullRefresh(FullRefreshDirections direction) {} - void SetNewTapEvent(uint16_t x, uint16_t y) {} + public: + enum class FullRefreshDirections { None, Up, Down }; + LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) { + } + LittleVgl(const LittleVgl&) = delete; + LittleVgl& operator=(const LittleVgl&) = delete; + LittleVgl(LittleVgl&&) = delete; + LittleVgl& operator=(LittleVgl&&) = delete; + void FlushDisplay(const lv_area_t* area, lv_color_t* color_p) { + } + bool GetTouchPadInfo(lv_indev_data_t* ptr) { + return false; + } + void SetFullRefresh(FullRefreshDirections direction) { + } + void SetNewTapEvent(uint16_t x, uint16_t y) { + } }; } } - diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp index 500fd752..36df51b4 100644 --- a/src/displayapp/LittleVgl.cpp +++ b/src/displayapp/LittleVgl.cpp @@ -11,17 +11,18 @@ using namespace Pinetime::Components; lv_style_t* LabelBigStyle = nullptr; -static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p) { +static void disp_flush(lv_disp_drv_t* disp_drv, const lv_area_t* area, lv_color_t* color_p) { auto* lvgl = static_cast(disp_drv->user_data); lvgl->FlushDisplay(area, color_p); } -bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data) { +bool touchpad_read(lv_indev_drv_t* indev_drv, lv_indev_data_t* data) { auto* lvgl = static_cast(indev_drv->user_data); return lvgl->GetTouchPadInfo(data); } -LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) : lcd{lcd}, touchPanel{touchPanel}, previousClick{0,0} { +LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) + : lcd {lcd}, touchPanel {touchPanel}, previousClick {0, 0} { lv_init(); InitTheme(); InitDisplay(); @@ -29,8 +30,8 @@ LittleVgl::LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& } void LittleVgl::InitDisplay() { - lv_disp_buf_init(&disp_buf_2, buf2_1, buf2_2, LV_HOR_RES_MAX * 4); /*Initialize the display buffer*/ - lv_disp_drv_init(&disp_drv); /*Basic initialization*/ + lv_disp_buf_init(&disp_buf_2, buf2_1, buf2_2, LV_HOR_RES_MAX * 4); /*Initialize the display buffer*/ + lv_disp_drv_init(&disp_drv); /*Basic initialization*/ /*Set up the functions to access to your display*/ @@ -59,7 +60,7 @@ void LittleVgl::InitTouchpad() { } void LittleVgl::SetFullRefresh(FullRefreshDirections direction) { - if(scrollDirection == FullRefreshDirections::None) { + if (scrollDirection == FullRefreshDirections::None) { scrollDirection = direction; if (scrollDirection == FullRefreshDirections::Down) { lv_disp_set_direction(lv_disp_get_default(), 1); @@ -75,16 +76,16 @@ void LittleVgl::SetFullRefresh(FullRefreshDirections direction) { } } -void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) { +void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) { uint16_t y1, y2, width, height = 0; ulTaskNotifyTake(pdTRUE, 200); // NOtification is still needed (even if there is a mutex on SPI) because of the DataCommand pin // which cannot be set/clear during a transfert. - - if( (scrollDirection == LittleVgl::FullRefreshDirections::Down) && (area->y2 == visibleNbLines - 1)) { + + if ((scrollDirection == LittleVgl::FullRefreshDirections::Down) && (area->y2 == visibleNbLines - 1)) { writeOffset = ((writeOffset + totalNbLines) - visibleNbLines) % totalNbLines; - } else if( (scrollDirection == FullRefreshDirections::Up) && (area->y1 == 0) ) { + } else if ((scrollDirection == FullRefreshDirections::Up) && (area->y1 == 0)) { writeOffset = (writeOffset + visibleNbLines) % totalNbLines; } @@ -94,11 +95,11 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) { width = (area->x2 - area->x1) + 1; height = (area->y2 - area->y1) + 1; - if(scrollDirection == LittleVgl::FullRefreshDirections::Down) { + if (scrollDirection == LittleVgl::FullRefreshDirections::Down) { - if(area->y2 < visibleNbLines - 1) { + if (area->y2 < visibleNbLines - 1) { uint16_t toScroll = 0; - if(area->y1 == 0) { + if (area->y1 == 0) { toScroll = height * 2; scrollDirection = FullRefreshDirections::None; lv_disp_set_direction(lv_disp_get_default(), 0); @@ -106,19 +107,19 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) { toScroll = height; } - if(scrollOffset >= toScroll) + if (scrollOffset >= toScroll) scrollOffset -= toScroll; else { toScroll -= scrollOffset; - scrollOffset = (totalNbLines) - toScroll; + scrollOffset = (totalNbLines) -toScroll; } lcd.VerticalScrollStartAddress(scrollOffset); } - } else if(scrollDirection == FullRefreshDirections::Up) { + } else if (scrollDirection == FullRefreshDirections::Up) { - if(area->y1 > 0) { - if(area->y2 == visibleNbLines - 1) { + if (area->y1 > 0) { + if (area->y2 == visibleNbLines - 1) { scrollOffset += (height * 2); scrollDirection = FullRefreshDirections::None; lv_disp_set_direction(lv_disp_get_default(), 0); @@ -128,13 +129,13 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) { scrollOffset = scrollOffset % totalNbLines; lcd.VerticalScrollStartAddress(scrollOffset); } - } else if(scrollDirection == FullRefreshDirections::Left or scrollDirection == FullRefreshDirections::LeftAnim) { - if(area->x2 == visibleNbLines - 1) { + } else if (scrollDirection == FullRefreshDirections::Left or scrollDirection == FullRefreshDirections::LeftAnim) { + if (area->x2 == visibleNbLines - 1) { scrollDirection = FullRefreshDirections::None; lv_disp_set_direction(lv_disp_get_default(), 0); } - } else if(scrollDirection == FullRefreshDirections::Right or scrollDirection == FullRefreshDirections::RightAnim) { - if(area->x1 == 0) { + } else if (scrollDirection == FullRefreshDirections::Right or scrollDirection == FullRefreshDirections::RightAnim) { + if (area->x1 == 0) { scrollDirection = FullRefreshDirections::None; lv_disp_set_direction(lv_disp_get_default(), 0); } @@ -143,17 +144,17 @@ void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) { if (y2 < y1) { height = totalNbLines - y1; - if ( height > 0 ) { - lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast(color_p), width * height * 2); + if (height > 0) { + lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast(color_p), width * height * 2); ulTaskNotifyTake(pdTRUE, 100); } - + uint16_t pixOffset = width * height; height = y2 + 1; - lcd.DrawBuffer(area->x1, 0, width, height, reinterpret_cast(color_p + pixOffset), width * height * 2); + lcd.DrawBuffer(area->x1, 0, width, height, reinterpret_cast(color_p + pixOffset), width * height * 2); } else { - lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast(color_p), width * height * 2); + lcd.DrawBuffer(area->x1, y1, width, height, reinterpret_cast(color_p), width * height * 2); } // IMPORTANT!!! @@ -167,8 +168,8 @@ void LittleVgl::SetNewTapEvent(uint16_t x, uint16_t y) { tapped = true; } -bool LittleVgl::GetTouchPadInfo(lv_indev_data_t *ptr) { - if(tapped) { +bool LittleVgl::GetTouchPadInfo(lv_indev_data_t* ptr) { + if (tapped) { ptr->point.x = tap_x; ptr->point.y = tap_y; ptr->state = LV_INDEV_STATE_PR; @@ -202,14 +203,8 @@ bool LittleVgl::GetTouchPadInfo(lv_indev_data_t *ptr) { void LittleVgl::InitTheme() { - lv_theme_t * th = lv_pinetime_theme_init( - LV_COLOR_WHITE, LV_COLOR_SILVER, - 0, - &jetbrains_mono_bold_20, - &jetbrains_mono_bold_20, - &jetbrains_mono_bold_20, - &jetbrains_mono_bold_20); + lv_theme_t* th = lv_pinetime_theme_init( + LV_COLOR_WHITE, LV_COLOR_SILVER, 0, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20, &jetbrains_mono_bold_20); lv_theme_set_act(th); - } diff --git a/src/displayapp/LittleVgl.h b/src/displayapp/LittleVgl.h index 28a02e0b..7f7b76e0 100644 --- a/src/displayapp/LittleVgl.h +++ b/src/displayapp/LittleVgl.h @@ -10,50 +10,49 @@ namespace Pinetime { namespace Components { class LittleVgl { - public: - enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim }; - LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel); + public: + enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim }; + LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel); - LittleVgl(const LittleVgl&) = delete; - LittleVgl& operator=(const LittleVgl&) = delete; - LittleVgl(LittleVgl&&) = delete; - LittleVgl& operator=(LittleVgl&&) = delete; + LittleVgl(const LittleVgl&) = delete; + LittleVgl& operator=(const LittleVgl&) = delete; + LittleVgl(LittleVgl&&) = delete; + LittleVgl& operator=(LittleVgl&&) = delete; - void FlushDisplay(const lv_area_t * area, lv_color_t * color_p); - bool GetTouchPadInfo(lv_indev_data_t *ptr); - void SetFullRefresh(FullRefreshDirections direction); - void SetNewTapEvent(uint16_t x, uint16_t y); + void FlushDisplay(const lv_area_t* area, lv_color_t* color_p); + bool GetTouchPadInfo(lv_indev_data_t* ptr); + void SetFullRefresh(FullRefreshDirections direction); + void SetNewTapEvent(uint16_t x, uint16_t y); - private: - void InitDisplay(); - void InitTouchpad(); - void InitTheme(); + private: + void InitDisplay(); + void InitTouchpad(); + void InitTheme(); + Pinetime::Drivers::St7789& lcd; + Pinetime::Drivers::Cst816S& touchPanel; - Pinetime::Drivers::St7789& lcd; - Pinetime::Drivers::Cst816S& touchPanel; + lv_disp_buf_t disp_buf_2; + lv_color_t buf2_1[LV_HOR_RES_MAX * 4]; + lv_color_t buf2_2[LV_HOR_RES_MAX * 4]; + lv_disp_drv_t disp_drv; + lv_point_t previousClick; - lv_disp_buf_t disp_buf_2; - lv_color_t buf2_1[LV_HOR_RES_MAX * 4]; - lv_color_t buf2_2[LV_HOR_RES_MAX * 4]; + bool firstTouch = true; + static constexpr uint8_t nbWriteLines = 4; + static constexpr uint16_t totalNbLines = 320; + static constexpr uint16_t visibleNbLines = 240; + static constexpr uint8_t MaxScrollOffset() { + return LV_VER_RES_MAX - nbWriteLines; + } + FullRefreshDirections scrollDirection = FullRefreshDirections::None; + uint16_t writeOffset = 0; + uint16_t scrollOffset = 0; - lv_disp_drv_t disp_drv; - lv_point_t previousClick; - - bool firstTouch = true; - static constexpr uint8_t nbWriteLines = 4; - static constexpr uint16_t totalNbLines = 320; - static constexpr uint16_t visibleNbLines = 240; - static constexpr uint8_t MaxScrollOffset() { return LV_VER_RES_MAX - nbWriteLines; } - FullRefreshDirections scrollDirection = FullRefreshDirections::None; - uint16_t writeOffset = 0; - uint16_t scrollOffset = 0; - - uint16_t tap_x = 0; - uint16_t tap_y = 0; - bool tapped = false; + uint16_t tap_x = 0; + uint16_t tap_y = 0; + bool tapped = false; }; } } - diff --git a/src/displayapp/Messages.h b/src/displayapp/Messages.h index b0690e3a..81871c54 100644 --- a/src/displayapp/Messages.h +++ b/src/displayapp/Messages.h @@ -3,8 +3,16 @@ namespace Pinetime { namespace Applications { namespace Display { enum class Messages : uint8_t { - GoToSleep, GoToRunning, UpdateDateTime, UpdateBleConnection, UpdateBatteryLevel, TouchEvent, ButtonPushed, - NewNotification, BleFirmwareUpdateStarted, UpdateTimeOut + GoToSleep, + GoToRunning, + UpdateDateTime, + UpdateBleConnection, + UpdateBatteryLevel, + TouchEvent, + ButtonPushed, + NewNotification, + BleFirmwareUpdateStarted, + UpdateTimeOut }; } } diff --git a/src/displayapp/TouchEvents.h b/src/displayapp/TouchEvents.h index cf2f88dd..6a37713a 100644 --- a/src/displayapp/TouchEvents.h +++ b/src/displayapp/TouchEvents.h @@ -3,6 +3,6 @@ namespace Pinetime { namespace Applications { - enum class TouchEvents { None, Tap, SwipeLeft, SwipeRight, SwipeUp, SwipeDown, LongTap, DoubleTap}; + enum class TouchEvents { None, Tap, SwipeLeft, SwipeRight, SwipeUp, SwipeDown, LongTap, DoubleTap }; } } \ No newline at end of file diff --git a/src/displayapp/fonts/README.md b/src/displayapp/fonts/README.md new file mode 100644 index 00000000..494654cd --- /dev/null +++ b/src/displayapp/fonts/README.md @@ -0,0 +1,44 @@ +# Fonts + +* [Jetbrains Mono](https://www.jetbrains.com/fr-fr/lp/mono/) +* [Awesome font from LVGL](https://lvgl.io/assets/others/FontAwesome5-Solid+Brands+Regular.woff) + +## Generate the fonts: + +* Open the [LVGL font converter](https://lvgl.io/tools/fontconverter) +* Name : jetbrains_mono_bold_20 +* Size : 20 +* Bpp : 1 bit-per-pixel +* Do not enable font compression and horizontal subpixel hinting +* Load the file `JetBrainsMono-Bold.tff` and specify the following range : `0x20-0x7f, 0x410-0x44f` +* Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following + range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024` +* Click on Convert, and download the file `jetbrains_mono_bold_20.c` and copy it in `src/DisplayApp/Fonts` + +Add new symbols: + +* Browse the [cheatsheet](https://fontawesome.com/cheatsheet/free/solid) and find your new symbols +* For each symbol, add its hex code (0xf641 for the 'Ad' icon, for example) to the *Range* list (Remember to keep this + readme updated with newest range list) +* Convert this hex value into a UTF-8 code + using [this site](http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=f185&mode=hex) +* Define the new symbols in `src/DisplayApp/Screens/Symbols.h`: + +``` +static constex char* newSymbol = "\xEF\x86\x85"; +``` + +#### Navigation font + +To create the navigtion.ttf I use the web app [icomoon](https://icomoon.io/app) +this app can import the svg files from the folder *src/displayapp/icons/navigation/unique* and creat a ttf file the +project for the site is *lv_font_navi_80.json* you can import it to add or remove icons + +You can also use the online LVGL tool to create the .c + +ttf file : navigation.ttf name : lv_font_navi_80 size : 80px Bpp : 2 bit-per-pixel range : 0xe900-0xe929 + +$lv_font_conv --font navigation.ttf -r '0xe900-0xe929' --size 80 --format lvgl --bpp 2 --no-prefilter -o +lv_font_navi_80.c + +#### I use the method above to create the other ttf \ No newline at end of file diff --git a/src/displayapp/fonts/Readme.md b/src/displayapp/fonts/Readme.md deleted file mode 100644 index 3bfe4239..00000000 --- a/src/displayapp/fonts/Readme.md +++ /dev/null @@ -1,41 +0,0 @@ -#Fonts -* [Jetbrains Mono](https://www.jetbrains.com/fr-fr/lp/mono/) -* [Awesome font from LVGL](https://lvgl.io/assets/others/FontAwesome5-Solid+Brands+Regular.woff) - -## Generate the fonts: - - * Open the [LVGL font converter](https://lvgl.io/tools/fontconverter) - * Name : jetbrains_mono_bold_20 - * Size : 20 - * Bpp : 1 bit-per-pixel - * Do not enable font compression and horizontal subpixel hinting - * Load the file `JetBrainsMono-Bold.tff` and specify the following range : `0x20-0x7f, 0x410-0x44f` - * Add a 2nd font, load the file `FontAwesome5-Solid+Brands+Regular.woff` and specify the following range : `0xf293, 0xf294, 0xf244, 0xf240, 0xf242, 0xf243, 0xf241, 0xf54b, 0xf21e, 0xf1e6, 0xf54b, 0xf017, 0xf129, 0xf03a, 0xf185, 0xf560, 0xf001, 0xf3fd, 0xf069, 0xf1fc, 0xf45d, 0xf59f, 0xf5a0, 0xf029, 0xf027, 0xf028, 0xf6a9, 0xf04b, 0xf04c, 0xf048, 0xf051, 0xf095, 0xf3dd, 0xf04d, 0xf2f2, 0xf024` - * Click on Convert, and download the file `jetbrains_mono_bold_20.c` and copy it in `src/DisplayApp/Fonts` - -Add new symbols: - * Browse the [cheatsheet](https://fontawesome.com/cheatsheet/free/solid) and find your new symbols - * For each symbol, add its hex code (0xf641 for the 'Ad' icon, for example) to the *Range* list (Remember to keep this readme updated with newest range list) - * Convert this hex value into a UTF-8 code using [this site](http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=f185&mode=hex) - * Define the new symbols in `src/DisplayApp/Screens/Symbols.h`: -``` -static constex char* newSymbol = "\xEF\x86\x85"; -``` - -#### Navigation font - -To create the navigtion.ttf I use the web app [icomoon](https://icomoon.io/app) -this app can import the svg files from the folder *src/displayapp/icons/navigation/unique* and creat a ttf file -the project for the site is *lv_font_navi_80.json* you can import it to add or remove icons - -You can also use the online LVGL tool to create the .c - -ttf file : navigation.ttf -name : lv_font_navi_80 -size : 80px -Bpp : 2 bit-per-pixel -range : 0xe900-0xe929 - -$lv_font_conv --font navigation.ttf -r '0xe900-0xe929' --size 80 --format lvgl --bpp 2 --no-prefilter -o lv_font_navi_80.c - -#### I use the method above to create the other ttf \ No newline at end of file diff --git a/src/displayapp/lv_pinetime_theme.c b/src/displayapp/lv_pinetime_theme.c index c153e42d..b003a411 100644 --- a/src/displayapp/lv_pinetime_theme.c +++ b/src/displayapp/lv_pinetime_theme.c @@ -19,7 +19,7 @@ /********************** * STATIC PROTOTYPES **********************/ -static void theme_apply(lv_obj_t * obj, lv_theme_style_t name); +static void theme_apply(lv_obj_t* obj, lv_theme_style_t name); /********************** * STATIC VARIABLES @@ -67,244 +67,240 @@ static bool inited; * STATIC FUNCTIONS **********************/ -static void style_init_reset(lv_style_t * style) -{ - if(inited) lv_style_reset(style); - else lv_style_init(style); +static void style_init_reset(lv_style_t* style) { + if (inited) + lv_style_reset(style); + else + lv_style_init(style); } +static void basic_init(void) { -static void basic_init(void) -{ + style_init_reset(&style_pad); + lv_style_set_pad_top(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 30); + lv_style_set_pad_bottom(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 30); + lv_style_set_pad_left(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 40); + lv_style_set_pad_right(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 40); - style_init_reset(&style_pad); - lv_style_set_pad_top(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 30); - lv_style_set_pad_bottom(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 30); - lv_style_set_pad_left(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 40); - lv_style_set_pad_right(&style_pad, LV_STATE_DEFAULT, LV_VER_RES / 40); + style_init_reset(&style_circle); + lv_style_set_radius(&style_circle, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - style_init_reset(&style_circle); - lv_style_set_radius(&style_circle, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + style_init_reset(&style_bg); + lv_style_set_bg_opa(&style_bg, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_bg, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_style_set_text_font(&style_bg, LV_STATE_DEFAULT, theme.font_normal); - style_init_reset(&style_bg); - lv_style_set_bg_opa(&style_bg, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_bg, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_style_set_text_font(&style_bg, LV_STATE_DEFAULT, theme.font_normal); + style_init_reset(&style_box); + lv_style_set_bg_opa(&style_box, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_radius(&style_box, LV_STATE_DEFAULT, 10); + lv_style_set_value_color(&style_box, LV_STATE_DEFAULT, LV_PINETIME_BLUE); + lv_style_set_value_font(&style_box, LV_STATE_DEFAULT, theme.font_normal); - style_init_reset(&style_box); - lv_style_set_bg_opa(&style_box, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_radius(&style_box, LV_STATE_DEFAULT, 10); - lv_style_set_value_color(&style_box, LV_STATE_DEFAULT, LV_PINETIME_BLUE); - lv_style_set_value_font(&style_box, LV_STATE_DEFAULT, theme.font_normal); + style_init_reset(&style_box_border); + lv_style_set_bg_opa(&style_box_border, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_style_set_border_width(&style_box_border, LV_STATE_DEFAULT, 2); + lv_style_set_border_color(&style_box_border, LV_STATE_DEFAULT, LV_PINETIME_GRAY); + lv_style_set_text_color(&style_box, LV_STATE_DEFAULT, LV_PINETIME_BLUE); - style_init_reset(&style_box_border); - lv_style_set_bg_opa(&style_box_border, LV_STATE_DEFAULT, LV_OPA_TRANSP); - lv_style_set_border_width(&style_box_border, LV_STATE_DEFAULT, 2); - lv_style_set_border_color(&style_box_border, LV_STATE_DEFAULT, LV_PINETIME_GRAY); - lv_style_set_text_color(&style_box, LV_STATE_DEFAULT, LV_PINETIME_BLUE); + style_init_reset(&style_title); + lv_style_set_text_color(&style_title, LV_STATE_DEFAULT, LV_PINETIME_WHITE); + lv_style_set_text_font(&style_title, LV_STATE_DEFAULT, theme.font_subtitle); + style_init_reset(&style_label_white); + lv_style_set_text_color(&style_label_white, LV_STATE_DEFAULT, LV_PINETIME_WHITE); - style_init_reset(&style_title); - lv_style_set_text_color(&style_title, LV_STATE_DEFAULT, LV_PINETIME_WHITE); - lv_style_set_text_font(&style_title, LV_STATE_DEFAULT, theme.font_subtitle); + style_init_reset(&style_btn); + lv_style_set_radius(&style_btn, LV_STATE_DEFAULT, 10); + lv_style_set_bg_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0x2F3540)); + lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED, LV_COLOR_GREEN); + lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED, lv_color_hex(0x2F3540)); + lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED | LV_STATE_CHECKED, lv_color_hex3(0x888)); + lv_style_set_border_color(&style_btn, LV_STATE_DEFAULT, theme.color_primary); + lv_style_set_border_width(&style_btn, LV_STATE_DEFAULT, 0); + lv_style_set_border_opa(&style_btn, LV_STATE_CHECKED, LV_OPA_TRANSP); - style_init_reset(&style_label_white); - lv_style_set_text_color(&style_label_white, LV_STATE_DEFAULT, LV_PINETIME_WHITE); + lv_style_set_text_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0xffffff)); + lv_style_set_text_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff)); + lv_style_set_text_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff)); + lv_style_set_text_color(&style_btn, LV_STATE_DISABLED, lv_color_hex(0x888888)); - style_init_reset(&style_btn); - lv_style_set_radius(&style_btn, LV_STATE_DEFAULT, 10); - lv_style_set_bg_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0x2F3540)); - lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED, LV_COLOR_GREEN); - lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED, lv_color_hex(0x2F3540)); - lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED | LV_STATE_CHECKED, lv_color_hex3(0x888)); - lv_style_set_border_color(&style_btn, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_border_width(&style_btn, LV_STATE_DEFAULT, 0); - lv_style_set_border_opa(&style_btn, LV_STATE_CHECKED, LV_OPA_TRANSP); + lv_style_set_value_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0xffffff)); + lv_style_set_value_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff)); + lv_style_set_value_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff)); + lv_style_set_value_color(&style_btn, LV_STATE_DISABLED, lv_color_hex(0x888888)); - lv_style_set_text_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0xffffff)); - lv_style_set_text_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff)); - lv_style_set_text_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff)); - lv_style_set_text_color(&style_btn, LV_STATE_DISABLED, lv_color_hex(0x888888)); + lv_style_set_pad_left(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_right(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_top(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_bottom(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_inner(&style_btn, LV_STATE_DEFAULT, LV_DPX(15)); + lv_style_set_outline_width(&style_btn, LV_STATE_DEFAULT, LV_DPX(2)); + lv_style_set_outline_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_0); + lv_style_set_outline_color(&style_btn, LV_STATE_DEFAULT, theme.color_primary); + lv_style_set_transition_time(&style_btn, LV_STATE_DEFAULT, 0); + lv_style_set_transition_delay(&style_btn, LV_STATE_DEFAULT, 0); - lv_style_set_value_color(&style_btn, LV_STATE_DEFAULT, lv_color_hex(0xffffff)); - lv_style_set_value_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff)); - lv_style_set_value_color(&style_btn, LV_STATE_CHECKED, lv_color_hex(0xffffff)); - lv_style_set_value_color(&style_btn, LV_STATE_DISABLED, lv_color_hex(0x888888)); + style_init_reset(&style_btn_border); + lv_style_set_radius(&style_btn_border, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_border_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE); + lv_style_set_border_width(&style_btn_border, LV_STATE_DEFAULT, 2); + lv_style_set_bg_opa(&style_btn_border, LV_STATE_DEFAULT, LV_OPA_TRANSP); + lv_style_set_bg_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE); + lv_style_set_text_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE); + lv_style_set_value_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE); + lv_style_set_transition_prop_3(&style_btn_border, LV_STATE_DEFAULT, LV_STYLE_BG_OPA); - lv_style_set_pad_left(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_right(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_top(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_bottom(&style_btn, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_inner(&style_btn, LV_STATE_DEFAULT, LV_DPX(15)); - lv_style_set_outline_width(&style_btn, LV_STATE_DEFAULT, LV_DPX(2)); - lv_style_set_outline_opa(&style_btn, LV_STATE_DEFAULT, LV_OPA_0); - lv_style_set_outline_color(&style_btn, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_transition_time(&style_btn, LV_STATE_DEFAULT, 0); - lv_style_set_transition_delay(&style_btn, LV_STATE_DEFAULT, 0); + style_init_reset(&style_icon); + lv_style_set_text_color(&style_icon, LV_STATE_DEFAULT, LV_PINETIME_WHITE); - style_init_reset(&style_btn_border); - lv_style_set_radius(&style_btn_border, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_border_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE); - lv_style_set_border_width(&style_btn_border, LV_STATE_DEFAULT, 2); - lv_style_set_bg_opa(&style_btn_border, LV_STATE_DEFAULT, LV_OPA_TRANSP); - lv_style_set_bg_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE); - lv_style_set_text_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE); - lv_style_set_value_color(&style_btn_border, LV_STATE_DEFAULT, LV_PINETIME_WHITE); - lv_style_set_transition_prop_3(&style_btn_border, LV_STATE_DEFAULT, LV_STYLE_BG_OPA); + style_init_reset(&style_back); + lv_style_set_value_color(&style_back, LV_STATE_DEFAULT, LV_PINETIME_GRAY); + lv_style_set_value_str(&style_back, LV_STATE_DEFAULT, LV_SYMBOL_LEFT); + lv_style_set_value_font(&style_back, LV_STATE_DEFAULT, theme.font_subtitle); - style_init_reset(&style_icon); - lv_style_set_text_color(&style_icon, LV_STATE_DEFAULT, LV_PINETIME_WHITE); + style_init_reset(&style_bar_indic); + lv_style_set_bg_opa(&style_bar_indic, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_radius(&style_bar_indic, LV_STATE_DEFAULT, 10); - style_init_reset(&style_back); - lv_style_set_value_color(&style_back, LV_STATE_DEFAULT, LV_PINETIME_GRAY); - lv_style_set_value_str(&style_back, LV_STATE_DEFAULT, LV_SYMBOL_LEFT); - lv_style_set_value_font(&style_back, LV_STATE_DEFAULT, theme.font_subtitle); + style_init_reset(&style_scrollbar); + lv_style_set_bg_opa(&style_scrollbar, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_radius(&style_scrollbar, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_bg_color(&style_scrollbar, LV_STATE_DEFAULT, LV_PINETIME_LIGHT_GRAY); + lv_style_set_size(&style_scrollbar, LV_STATE_DEFAULT, LV_HOR_RES / 80); + lv_style_set_pad_right(&style_scrollbar, LV_STATE_DEFAULT, LV_HOR_RES / 60); - style_init_reset(&style_bar_indic); - lv_style_set_bg_opa(&style_bar_indic, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_radius(&style_bar_indic, LV_STATE_DEFAULT, 10); + style_init_reset(&style_list_btn); + lv_style_set_bg_opa(&style_list_btn, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_list_btn, LV_STATE_DEFAULT, LV_PINETIME_WHITE); + lv_style_set_bg_color(&style_list_btn, LV_STATE_CHECKED, LV_PINETIME_GRAY); + lv_style_set_bg_color(&style_list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(LV_PINETIME_GRAY, LV_OPA_20)); + lv_style_set_text_color(&style_list_btn, LV_STATE_DEFAULT, LV_PINETIME_BLUE); + lv_style_set_text_color(&style_list_btn, LV_STATE_CHECKED, LV_PINETIME_WHITE); + lv_style_set_text_color(&style_list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, LV_PINETIME_WHITE); + lv_style_set_image_recolor(&style_list_btn, LV_STATE_DEFAULT, LV_PINETIME_BLUE); + lv_style_set_image_recolor(&style_list_btn, LV_STATE_CHECKED, LV_PINETIME_WHITE); + lv_style_set_image_recolor(&style_list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, LV_PINETIME_WHITE); + lv_style_set_pad_left(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 25); + lv_style_set_pad_right(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 25); + lv_style_set_pad_top(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 100); + lv_style_set_pad_bottom(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 100); + lv_style_set_pad_inner(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 50); - style_init_reset(&style_scrollbar); - lv_style_set_bg_opa(&style_scrollbar, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_radius(&style_scrollbar, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_bg_color(&style_scrollbar, LV_STATE_DEFAULT, LV_PINETIME_LIGHT_GRAY); - lv_style_set_size(&style_scrollbar, LV_STATE_DEFAULT, LV_HOR_RES / 80); - lv_style_set_pad_right(&style_scrollbar, LV_STATE_DEFAULT, LV_HOR_RES / 60); + style_init_reset(&style_ddlist_list); + lv_style_set_text_line_space(&style_ddlist_list, LV_STATE_DEFAULT, LV_VER_RES / 25); + lv_style_set_shadow_width(&style_ddlist_list, LV_STATE_DEFAULT, LV_VER_RES / 20); + lv_style_set_shadow_color(&style_ddlist_list, LV_STATE_DEFAULT, LV_PINETIME_GRAY); - style_init_reset(&style_list_btn); - lv_style_set_bg_opa(&style_list_btn, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_list_btn, LV_STATE_DEFAULT, LV_PINETIME_WHITE); - lv_style_set_bg_color(&style_list_btn, LV_STATE_CHECKED, LV_PINETIME_GRAY); - lv_style_set_bg_color(&style_list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(LV_PINETIME_GRAY, LV_OPA_20)); - lv_style_set_text_color(&style_list_btn, LV_STATE_DEFAULT, LV_PINETIME_BLUE); - lv_style_set_text_color(&style_list_btn, LV_STATE_CHECKED, LV_PINETIME_WHITE); - lv_style_set_text_color(&style_list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, LV_PINETIME_WHITE); - lv_style_set_image_recolor(&style_list_btn, LV_STATE_DEFAULT, LV_PINETIME_BLUE); - lv_style_set_image_recolor(&style_list_btn, LV_STATE_CHECKED, LV_PINETIME_WHITE); - lv_style_set_image_recolor(&style_list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, LV_PINETIME_WHITE); - lv_style_set_pad_left(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 25); - lv_style_set_pad_right(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 25); - lv_style_set_pad_top(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 100); - lv_style_set_pad_bottom(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 100); - lv_style_set_pad_inner(&style_list_btn, LV_STATE_DEFAULT, LV_HOR_RES / 50); + style_init_reset(&style_ddlist_selected); + lv_style_set_bg_opa(&style_ddlist_selected, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_ddlist_selected, LV_STATE_DEFAULT, LV_PINETIME_BLUE); - style_init_reset(&style_ddlist_list); - lv_style_set_text_line_space(&style_ddlist_list, LV_STATE_DEFAULT, LV_VER_RES / 25); - lv_style_set_shadow_width(&style_ddlist_list, LV_STATE_DEFAULT, LV_VER_RES / 20); - lv_style_set_shadow_color(&style_ddlist_list, LV_STATE_DEFAULT, LV_PINETIME_GRAY); + style_init_reset(&style_sw_bg); + lv_style_set_bg_opa(&style_sw_bg, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_sw_bg, LV_STATE_DEFAULT, LV_PINETIME_LIGHT_GRAY); + lv_style_set_radius(&style_sw_bg, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_value_color(&style_sw_bg, LV_STATE_DEFAULT, LV_PINETIME_BLUE); - style_init_reset(&style_ddlist_selected); - lv_style_set_bg_opa(&style_ddlist_selected, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_ddlist_selected, LV_STATE_DEFAULT, LV_PINETIME_BLUE); + style_init_reset(&style_sw_indic); + lv_style_set_bg_opa(&style_sw_indic, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_sw_indic, LV_STATE_DEFAULT, LV_PINETIME_GREEN); - style_init_reset(&style_sw_bg); - lv_style_set_bg_opa(&style_sw_bg, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_sw_bg, LV_STATE_DEFAULT, LV_PINETIME_LIGHT_GRAY); - lv_style_set_radius(&style_sw_bg, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_value_color(&style_sw_bg, LV_STATE_DEFAULT, LV_PINETIME_BLUE); + style_init_reset(&style_sw_knob); + lv_style_set_bg_opa(&style_sw_knob, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_sw_knob, LV_STATE_DEFAULT, LV_PINETIME_WHITE); + lv_style_set_radius(&style_sw_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_pad_top(&style_sw_knob, LV_STATE_DEFAULT, -4); + lv_style_set_pad_bottom(&style_sw_knob, LV_STATE_DEFAULT, -4); + lv_style_set_pad_left(&style_sw_knob, LV_STATE_DEFAULT, -4); + lv_style_set_pad_right(&style_sw_knob, LV_STATE_DEFAULT, -4); - style_init_reset(&style_sw_indic); - lv_style_set_bg_opa(&style_sw_indic, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_sw_indic, LV_STATE_DEFAULT, LV_PINETIME_GREEN); + style_init_reset(&style_slider_knob); + lv_style_set_bg_opa(&style_slider_knob, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&style_slider_knob, LV_STATE_DEFAULT, LV_COLOR_RED); + lv_style_set_border_color(&style_slider_knob, LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_style_set_border_width(&style_slider_knob, LV_STATE_DEFAULT, 6); + lv_style_set_radius(&style_slider_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_pad_top(&style_slider_knob, LV_STATE_DEFAULT, 10); + lv_style_set_pad_bottom(&style_slider_knob, LV_STATE_DEFAULT, 10); + lv_style_set_pad_left(&style_slider_knob, LV_STATE_DEFAULT, 10); + lv_style_set_pad_right(&style_slider_knob, LV_STATE_DEFAULT, 10); + lv_style_set_pad_top(&style_slider_knob, LV_STATE_PRESSED, 14); + lv_style_set_pad_bottom(&style_slider_knob, LV_STATE_PRESSED, 14); + lv_style_set_pad_left(&style_slider_knob, LV_STATE_PRESSED, 14); + lv_style_set_pad_right(&style_slider_knob, LV_STATE_PRESSED, 14); - style_init_reset(&style_sw_knob); - lv_style_set_bg_opa(&style_sw_knob, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_sw_knob, LV_STATE_DEFAULT, LV_PINETIME_WHITE); - lv_style_set_radius(&style_sw_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_pad_top(&style_sw_knob, LV_STATE_DEFAULT, - 4); - lv_style_set_pad_bottom(&style_sw_knob, LV_STATE_DEFAULT, - 4); - lv_style_set_pad_left(&style_sw_knob, LV_STATE_DEFAULT, - 4); - lv_style_set_pad_right(&style_sw_knob, LV_STATE_DEFAULT, - 4); + style_init_reset(&style_arc_indic); + lv_style_set_line_color(&style_arc_indic, LV_STATE_DEFAULT, LV_PINETIME_BLUE); + lv_style_set_line_width(&style_arc_indic, LV_STATE_DEFAULT, LV_DPX(25)); + lv_style_set_line_rounded(&style_arc_indic, LV_STATE_DEFAULT, true); - style_init_reset(&style_slider_knob); - lv_style_set_bg_opa(&style_slider_knob, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&style_slider_knob, LV_STATE_DEFAULT, LV_COLOR_RED); - lv_style_set_border_color(&style_slider_knob, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_border_width(&style_slider_knob, LV_STATE_DEFAULT, 6); - lv_style_set_radius(&style_slider_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_pad_top(&style_slider_knob, LV_STATE_DEFAULT, 10); - lv_style_set_pad_bottom(&style_slider_knob, LV_STATE_DEFAULT, 10); - lv_style_set_pad_left(&style_slider_knob, LV_STATE_DEFAULT, 10); - lv_style_set_pad_right(&style_slider_knob, LV_STATE_DEFAULT, 10); - lv_style_set_pad_top(&style_slider_knob, LV_STATE_PRESSED, 14); - lv_style_set_pad_bottom(&style_slider_knob, LV_STATE_PRESSED, 14); - lv_style_set_pad_left(&style_slider_knob, LV_STATE_PRESSED, 14); - lv_style_set_pad_right(&style_slider_knob, LV_STATE_PRESSED, 14); + style_init_reset(&style_arc_bg); + lv_style_set_line_color(&style_arc_bg, LV_STATE_DEFAULT, LV_PINETIME_GRAY); + lv_style_set_line_width(&style_arc_bg, LV_STATE_DEFAULT, LV_DPX(25)); + lv_style_set_line_rounded(&style_arc_bg, LV_STATE_DEFAULT, true); - style_init_reset(&style_arc_indic); - lv_style_set_line_color(&style_arc_indic, LV_STATE_DEFAULT, LV_PINETIME_BLUE); - lv_style_set_line_width(&style_arc_indic, LV_STATE_DEFAULT, LV_DPX(25)); - lv_style_set_line_rounded(&style_arc_indic, LV_STATE_DEFAULT, true); + style_init_reset(&style_table_cell); + lv_style_set_border_color(&style_table_cell, LV_STATE_DEFAULT, LV_PINETIME_GRAY); + lv_style_set_border_width(&style_table_cell, LV_STATE_DEFAULT, 1); + lv_style_set_border_side(&style_table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_FULL); + lv_style_set_pad_left(&style_table_cell, LV_STATE_DEFAULT, 5); + lv_style_set_pad_right(&style_table_cell, LV_STATE_DEFAULT, 5); + lv_style_set_pad_top(&style_table_cell, LV_STATE_DEFAULT, 2); + lv_style_set_pad_bottom(&style_table_cell, LV_STATE_DEFAULT, 2); - style_init_reset(&style_arc_bg); - lv_style_set_line_color(&style_arc_bg, LV_STATE_DEFAULT, LV_PINETIME_GRAY); - lv_style_set_line_width(&style_arc_bg, LV_STATE_DEFAULT, LV_DPX(25)); - lv_style_set_line_rounded(&style_arc_bg, LV_STATE_DEFAULT, true); + style_init_reset(&style_pad_small); + lv_style_int_t pad_small_value = 10; + lv_style_set_pad_left(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); + lv_style_set_pad_right(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); + lv_style_set_pad_top(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); + lv_style_set_pad_bottom(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); + lv_style_set_pad_inner(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); - style_init_reset(&style_table_cell); - lv_style_set_border_color(&style_table_cell, LV_STATE_DEFAULT, LV_PINETIME_GRAY); - lv_style_set_border_width(&style_table_cell, LV_STATE_DEFAULT, 1); - lv_style_set_border_side(&style_table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_FULL); - lv_style_set_pad_left(&style_table_cell, LV_STATE_DEFAULT, 5); - lv_style_set_pad_right(&style_table_cell, LV_STATE_DEFAULT, 5); - lv_style_set_pad_top(&style_table_cell, LV_STATE_DEFAULT, 2); - lv_style_set_pad_bottom(&style_table_cell, LV_STATE_DEFAULT, 2); + style_init_reset(&style_bg_grad); + lv_style_set_bg_color(&style_bg_grad, LV_STATE_DEFAULT, lv_color_hsv_to_rgb(10, 10, 40)); + lv_style_set_bg_grad_color(&style_bg_grad, LV_STATE_DEFAULT, lv_color_hsv_to_rgb(10, 10, 20)); + lv_style_set_bg_grad_dir(&style_bg_grad, LV_STATE_DEFAULT, LV_GRAD_DIR_VER); - style_init_reset(&style_pad_small); - lv_style_int_t pad_small_value = 10; - lv_style_set_pad_left(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); - lv_style_set_pad_right(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); - lv_style_set_pad_top(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); - lv_style_set_pad_bottom(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); - lv_style_set_pad_inner(&style_pad_small, LV_STATE_DEFAULT, pad_small_value); + style_init_reset(&style_lmeter); + lv_style_set_radius(&style_lmeter, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_pad_left(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_right(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_top(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_pad_inner(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(30)); + lv_style_set_scale_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(25)); - style_init_reset(&style_bg_grad); - lv_style_set_bg_color(&style_bg_grad, LV_STATE_DEFAULT, lv_color_hsv_to_rgb(10, 10, 40)); - lv_style_set_bg_grad_color(&style_bg_grad, LV_STATE_DEFAULT, lv_color_hsv_to_rgb(10, 10, 20)); - lv_style_set_bg_grad_dir(&style_bg_grad, LV_STATE_DEFAULT, LV_GRAD_DIR_VER); + lv_style_set_line_color(&style_lmeter, LV_STATE_DEFAULT, theme.color_primary); + lv_style_set_scale_grad_color(&style_lmeter, LV_STATE_DEFAULT, theme.color_primary); + lv_style_set_scale_end_color(&style_lmeter, LV_STATE_DEFAULT, lv_color_hex3(0x888)); + lv_style_set_line_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(10)); + lv_style_set_scale_end_line_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(7)); - style_init_reset(&style_lmeter); - lv_style_set_radius(&style_lmeter, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_pad_left(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_right(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_top(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_pad_inner(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(30)); - lv_style_set_scale_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(25)); + style_init_reset(&style_chart_serie); + lv_style_set_line_color(&style_chart_serie, LV_STATE_DEFAULT, LV_PINETIME_WHITE); + lv_style_set_line_width(&style_chart_serie, LV_STATE_DEFAULT, 4); + lv_style_set_size(&style_chart_serie, LV_STATE_DEFAULT, 4); + lv_style_set_bg_opa(&style_chart_serie, LV_STATE_DEFAULT, 0); - lv_style_set_line_color(&style_lmeter, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_scale_grad_color(&style_lmeter, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_scale_end_color(&style_lmeter, LV_STATE_DEFAULT, lv_color_hex3(0x888)); - lv_style_set_line_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(10)); - lv_style_set_scale_end_line_width(&style_lmeter, LV_STATE_DEFAULT, LV_DPX(7)); - - style_init_reset(&style_chart_serie); - lv_style_set_line_color(&style_chart_serie, LV_STATE_DEFAULT, LV_PINETIME_WHITE); - lv_style_set_line_width(&style_chart_serie, LV_STATE_DEFAULT, 4); - lv_style_set_size(&style_chart_serie, LV_STATE_DEFAULT, 4); - lv_style_set_bg_opa(&style_chart_serie, LV_STATE_DEFAULT, 0); - - lv_style_reset(&style_cb_bg); - lv_style_set_radius(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(4)); - lv_style_set_pad_inner(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(10)); - lv_style_set_outline_color(&style_cb_bg, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_outline_width(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(2)); - lv_style_set_outline_pad(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(20)); - lv_style_set_transition_time(&style_cb_bg, LV_STATE_DEFAULT, 0); - lv_style_set_transition_prop_6(&style_cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA); - - lv_style_reset(&style_cb_bullet); - lv_style_set_outline_opa(&style_cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP); - lv_style_set_radius(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(4)); - lv_style_set_pattern_recolor(&style_cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE); - lv_style_set_pad_left(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); - lv_style_set_pad_right(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); - lv_style_set_pad_top(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); - lv_style_set_pad_bottom(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); + lv_style_reset(&style_cb_bg); + lv_style_set_radius(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(4)); + lv_style_set_pad_inner(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(10)); + lv_style_set_outline_color(&style_cb_bg, LV_STATE_DEFAULT, theme.color_primary); + lv_style_set_outline_width(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(2)); + lv_style_set_outline_pad(&style_cb_bg, LV_STATE_DEFAULT, LV_DPX(20)); + lv_style_set_transition_time(&style_cb_bg, LV_STATE_DEFAULT, 0); + lv_style_set_transition_prop_6(&style_cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA); + lv_style_reset(&style_cb_bullet); + lv_style_set_outline_opa(&style_cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP); + lv_style_set_radius(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(4)); + lv_style_set_pattern_recolor(&style_cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE); + lv_style_set_pad_left(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); + lv_style_set_pad_right(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); + lv_style_set_pad_top(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); + lv_style_set_pad_bottom(&style_cb_bullet, LV_STATE_DEFAULT, LV_DPX(8)); } - /********************** * GLOBAL FUNCTIONS **********************/ @@ -320,221 +316,216 @@ static void basic_init(void) * @param font_title pointer to a extra large font * @return a pointer to reference this theme later */ -lv_theme_t * lv_pinetime_theme_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, - const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, - const lv_font_t * font_title) -{ - theme.color_primary = color_primary; - theme.color_secondary = color_secondary; - theme.font_small = font_small; - theme.font_normal = font_normal; - theme.font_subtitle = font_subtitle; - theme.font_title = font_title; - theme.flags = flags; +lv_theme_t* lv_pinetime_theme_init(lv_color_t color_primary, + lv_color_t color_secondary, + uint32_t flags, + const lv_font_t* font_small, + const lv_font_t* font_normal, + const lv_font_t* font_subtitle, + const lv_font_t* font_title) { + theme.color_primary = color_primary; + theme.color_secondary = color_secondary; + theme.font_small = font_small; + theme.font_normal = font_normal; + theme.font_subtitle = font_subtitle; + theme.font_title = font_title; + theme.flags = flags; - basic_init(); + basic_init(); - theme.apply_xcb = theme_apply; + theme.apply_xcb = theme_apply; - inited = true; + inited = true; - return &theme; + return &theme; } +static void theme_apply(lv_obj_t* obj, lv_theme_style_t name) { + lv_style_list_t* list; -static void theme_apply(lv_obj_t * obj, lv_theme_style_t name) -{ - lv_style_list_t * list; + /*To avoid warnings*/ + uint32_t name_int = (uint32_t) name; + switch (name_int) { + case LV_THEME_NONE: + break; - /*To avoid warnings*/ - uint32_t name_int = (uint32_t) name; - switch(name_int) { - case LV_THEME_NONE: - break; + case LV_THEME_SCR: + lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN); + _lv_style_list_add_style(list, &style_bg); + _lv_style_list_add_style(list, &style_label_white); + break; - case LV_THEME_SCR: - lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN); - _lv_style_list_add_style(list, &style_bg); - _lv_style_list_add_style(list, &style_label_white); - break; + case LV_THEME_OBJ: + lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN); + _lv_style_list_add_style(list, &style_box); + break; - case LV_THEME_OBJ: - lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN); - _lv_style_list_add_style(list, &style_box); - break; + case LV_THEME_CONT: + lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN); + _lv_style_list_add_style(list, &style_box); + break; - case LV_THEME_CONT: - lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN); - _lv_style_list_add_style(list, &style_box); - break; + case LV_THEME_BTN: + lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); + _lv_style_list_add_style(list, &style_btn); + //_lv_style_list_add_style(list, &style_bg_grad); + break; - case LV_THEME_BTN: - lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); - _lv_style_list_add_style(list, &style_btn); - //_lv_style_list_add_style(list, &style_bg_grad); - break; + case LV_THEME_BTNMATRIX: + list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG); + _lv_style_list_add_style(list, &style_bg); + _lv_style_list_add_style(list, &style_pad_small); - case LV_THEME_BTNMATRIX: - list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG); - _lv_style_list_add_style(list, &style_bg); - _lv_style_list_add_style(list, &style_pad_small); + list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN); + _lv_style_list_add_style(list, &style_btn); + //_lv_style_list_add_style(list, &style_bg_grad); + //_lv_style_list_add_style(list, &style_bg_click); + break; - list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN); - _lv_style_list_add_style(list, &style_btn); - //_lv_style_list_add_style(list, &style_bg_grad); - //_lv_style_list_add_style(list, &style_bg_click); - break; + case LV_THEME_BAR: + lv_obj_clean_style_list(obj, LV_BAR_PART_BG); + list = lv_obj_get_style_list(obj, LV_BAR_PART_BG); - case LV_THEME_BAR: - lv_obj_clean_style_list(obj, LV_BAR_PART_BG); - list = lv_obj_get_style_list(obj, LV_BAR_PART_BG); + lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC); + list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC); + _lv_style_list_add_style(list, &style_bar_indic); + break; - lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC); - list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC); - _lv_style_list_add_style(list, &style_bar_indic); - break; + case LV_THEME_IMAGE: + lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN); + _lv_style_list_add_style(list, &style_icon); + break; - case LV_THEME_IMAGE: - lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN); - _lv_style_list_add_style(list, &style_icon); - break; + case LV_THEME_LABEL: + lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN); + _lv_style_list_add_style(list, &style_label_white); + break; - case LV_THEME_LABEL: - lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN); - _lv_style_list_add_style(list, &style_label_white); - break; + case LV_THEME_SLIDER: + lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG); + list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG); + _lv_style_list_add_style(list, &style_sw_bg); - case LV_THEME_SLIDER: - lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG); - list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG); - _lv_style_list_add_style(list, &style_sw_bg); + lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC); + list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC); - lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC); - list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC); + lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB); + list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB); + _lv_style_list_add_style(list, &style_slider_knob); + break; - lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB); - list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB); - _lv_style_list_add_style(list, &style_slider_knob); - break; + case LV_THEME_LIST: + lv_obj_clean_style_list(obj, LV_LIST_PART_BG); + list = lv_obj_get_style_list(obj, LV_LIST_PART_BG); + _lv_style_list_add_style(list, &style_box); - case LV_THEME_LIST: - lv_obj_clean_style_list(obj, LV_LIST_PART_BG); - list = lv_obj_get_style_list(obj, LV_LIST_PART_BG); - _lv_style_list_add_style(list, &style_box); + lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE); + list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE); - lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE); - list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE); + lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR); + _lv_style_list_add_style(list, &style_scrollbar); + break; - lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR); - list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR); - _lv_style_list_add_style(list, &style_scrollbar); - break; + case LV_THEME_LIST_BTN: + lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); + _lv_style_list_add_style(list, &style_list_btn); + break; - case LV_THEME_LIST_BTN: - lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); - _lv_style_list_add_style(list, &style_list_btn); - break; + case LV_THEME_ARC: + lv_obj_clean_style_list(obj, LV_ARC_PART_BG); + list = lv_obj_get_style_list(obj, LV_ARC_PART_BG); + _lv_style_list_add_style(list, &style_arc_bg); + lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC); + list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC); + _lv_style_list_add_style(list, &style_arc_indic); + break; - case LV_THEME_ARC: - lv_obj_clean_style_list(obj, LV_ARC_PART_BG); - list = lv_obj_get_style_list(obj, LV_ARC_PART_BG); - _lv_style_list_add_style(list, &style_arc_bg); + case LV_THEME_SWITCH: + lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG); + list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG); + _lv_style_list_add_style(list, &style_sw_bg); - lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC); - list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC); - _lv_style_list_add_style(list, &style_arc_indic); - break; + lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC); + list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC); + _lv_style_list_add_style(list, &style_sw_indic); + lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB); + list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB); + _lv_style_list_add_style(list, &style_sw_knob); + break; - case LV_THEME_SWITCH: - lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG); - list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG); - _lv_style_list_add_style(list, &style_sw_bg); + case LV_THEME_DROPDOWN: + lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN); + list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN); + _lv_style_list_add_style(list, &style_btn); + _lv_style_list_add_style(list, &style_pad); - lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC); - list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC); - _lv_style_list_add_style(list, &style_sw_indic); + lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST); + list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST); + _lv_style_list_add_style(list, &style_box); + _lv_style_list_add_style(list, &style_ddlist_list); + _lv_style_list_add_style(list, &style_pad); - lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB); - list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB); - _lv_style_list_add_style(list, &style_sw_knob); - break; + lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED); + list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED); + _lv_style_list_add_style(list, &style_ddlist_selected); - case LV_THEME_DROPDOWN: - lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN); - list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN); - _lv_style_list_add_style(list, &style_btn); - _lv_style_list_add_style(list, &style_pad); + lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR); + list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR); + _lv_style_list_add_style(list, &style_scrollbar); + break; - lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST); - list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST); - _lv_style_list_add_style(list, &style_box); - _lv_style_list_add_style(list, &style_ddlist_list); - _lv_style_list_add_style(list, &style_pad); + case LV_THEME_TABLE: + list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG); + _lv_style_list_add_style(list, &style_bg); - lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED); - list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED); - _lv_style_list_add_style(list, &style_ddlist_selected); + int idx = 1; /* start value should be 1, not zero, since cell styles + start at 1 due to presence of LV_TABLE_PART_BG=0 + in the enum (lv_table.h) */ + /* declaring idx outside loop to work with older compilers */ + for (; idx <= LV_TABLE_CELL_STYLE_CNT; idx++) { + list = lv_obj_get_style_list(obj, idx); + _lv_style_list_add_style(list, &style_table_cell); + _lv_style_list_add_style(list, &style_label_white); + } + break; - lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR); - list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR); - _lv_style_list_add_style(list, &style_scrollbar); - break; + case LV_THEME_LINEMETER: + list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN); + _lv_style_list_add_style(list, &style_bg); + _lv_style_list_add_style(list, &style_lmeter); + break; - case LV_THEME_TABLE: - list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG); - _lv_style_list_add_style(list, &style_bg); + case LV_THEME_CHART: + lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES); + list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES); + _lv_style_list_add_style(list, &style_btn); + _lv_style_list_add_style(list, &style_chart_serie); + break; - int idx = 1; /* start value should be 1, not zero, since cell styles - start at 1 due to presence of LV_TABLE_PART_BG=0 - in the enum (lv_table.h) */ - /* declaring idx outside loop to work with older compilers */ - for(; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++) { - list = lv_obj_get_style_list(obj, idx); - _lv_style_list_add_style(list, &style_table_cell); - _lv_style_list_add_style(list, &style_label_white); - } - break; + case LV_THEME_CHECKBOX: + list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG); + _lv_style_list_add_style(list, &style_cb_bg); - case LV_THEME_LINEMETER: - list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN); - _lv_style_list_add_style(list, &style_bg); - _lv_style_list_add_style(list, &style_lmeter); - break; - - case LV_THEME_CHART: - lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES); - list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES); - _lv_style_list_add_style(list, &style_btn); - _lv_style_list_add_style(list, &style_chart_serie); - break; - - case LV_THEME_CHECKBOX: - list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG); - _lv_style_list_add_style(list, &style_cb_bg); - - list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET); - _lv_style_list_add_style(list, &style_btn); - _lv_style_list_add_style(list, &style_cb_bullet); - break; - - - default: - break; - } - - - lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL); + list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET); + _lv_style_list_add_style(list, &style_btn); + _lv_style_list_add_style(list, &style_cb_bullet); + break; + default: + break; + } + lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL); } /********************** diff --git a/src/displayapp/lv_pinetime_theme.h b/src/displayapp/lv_pinetime_theme.h index 6697015e..f914516d 100644 --- a/src/displayapp/lv_pinetime_theme.h +++ b/src/displayapp/lv_pinetime_theme.h @@ -19,24 +19,22 @@ extern "C" { * DEFINES *********************/ /*Colors*/ -#define LV_PINETIME_WHITE lv_color_hex(0xffffff) -#define LV_PINETIME_LIGHT lv_color_hex(0xf3f8fe) -#define LV_PINETIME_GRAY lv_color_hex(0x8a8a8a) -#define LV_PINETIME_LIGHT_GRAY lv_color_hex(0xc4c4c4) -#define LV_PINETIME_BLUE lv_color_hex(0x2f3243) //006fb6 -#define LV_PINETIME_GREEN lv_color_hex(0x4cb242) -#define LV_PINETIME_RED lv_color_hex(0xd51732) +#define LV_PINETIME_WHITE lv_color_hex(0xffffff) +#define LV_PINETIME_LIGHT lv_color_hex(0xf3f8fe) +#define LV_PINETIME_GRAY lv_color_hex(0x8a8a8a) +#define LV_PINETIME_LIGHT_GRAY lv_color_hex(0xc4c4c4) +#define LV_PINETIME_BLUE lv_color_hex(0x2f3243) // 006fb6 +#define LV_PINETIME_GREEN lv_color_hex(0x4cb242) +#define LV_PINETIME_RED lv_color_hex(0xd51732) /********************** * TYPEDEFS **********************/ - /********************** * GLOBAL PROTOTYPES **********************/ - /** * Initialize the default * @param color_primary the primary color of the theme @@ -48,9 +46,13 @@ extern "C" { * @param font_title pointer to a extra large font * @return a pointer to reference this theme later */ -lv_theme_t * lv_pinetime_theme_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, - const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle, - const lv_font_t * font_title); +lv_theme_t* lv_pinetime_theme_init(lv_color_t color_primary, + lv_color_t color_secondary, + uint32_t flags, + const lv_font_t* font_small, + const lv_font_t* font_normal, + const lv_font_t* font_subtitle, + const lv_font_t* font_title); /********************** * MACROS **********************/ diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp index 3fd8d737..1eb36999 100644 --- a/src/displayapp/screens/ApplicationList.cpp +++ b/src/displayapp/screens/ApplicationList.cpp @@ -8,31 +8,34 @@ using namespace Pinetime::Applications::Screens; -ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp *app, - Pinetime::Controllers::Settings &settingsController, - Pinetime::Controllers::Battery& batteryController, - Controllers::DateTime& dateTimeController) : - Screen(app), - settingsController{settingsController}, - batteryController{batteryController}, - dateTimeController{dateTimeController}, - screens{app, - settingsController.GetAppMenu(), - { - [this]() -> std::unique_ptr { return CreateScreen1(); }, - [this]() -> std::unique_ptr { return CreateScreen2(); }, - //[this]() -> std::unique_ptr { return CreateScreen3(); } - }, - Screens::ScreenListModes::UpDown - } {} - +ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp* app, + Pinetime::Controllers::Settings& settingsController, + Pinetime::Controllers::Battery& batteryController, + Controllers::DateTime& dateTimeController) + : Screen(app), + settingsController {settingsController}, + batteryController {batteryController}, + dateTimeController {dateTimeController}, + screens {app, + settingsController.GetAppMenu(), + { + [this]() -> std::unique_ptr { + return CreateScreen1(); + }, + [this]() -> std::unique_ptr { + return CreateScreen2(); + }, + //[this]() -> std::unique_ptr { return CreateScreen3(); } + }, + Screens::ScreenListModes::UpDown} { +} ApplicationList::~ApplicationList() { lv_obj_clean(lv_scr_act()); } bool ApplicationList::Refresh() { - if(running) + if (running) running = screens.Refresh(); return running; } @@ -42,31 +45,27 @@ bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } std::unique_ptr ApplicationList::CreateScreen1() { - std::array applications { - { - {Symbols::stopWatch, Apps::StopWatch}, - {Symbols::music, Apps::Music}, - {Symbols::map, Apps::Navigation}, - {Symbols::shoe, Apps::Steps}, - {Symbols::heartBeat, Apps::HeartRate}, - {"", Apps::None}, - } - }; + std::array applications {{ + {Symbols::stopWatch, Apps::StopWatch}, + {Symbols::music, Apps::Music}, + {Symbols::map, Apps::Navigation}, + {Symbols::shoe, Apps::Steps}, + {Symbols::heartBeat, Apps::HeartRate}, + {"", Apps::None}, + }}; return std::make_unique(0, 2, app, settingsController, batteryController, dateTimeController, applications); } std::unique_ptr ApplicationList::CreateScreen2() { - std::array applications { - { - {Symbols::paintbrush, Apps::Paint}, - {Symbols::paddle, Apps::Paddle}, - {"2", Apps::Twos}, - {"M", Apps::Motion}, - {"", Apps::None}, - {"", Apps::None}, - } - }; + std::array applications {{ + {Symbols::paintbrush, Apps::Paint}, + {Symbols::paddle, Apps::Paddle}, + {"2", Apps::Twos}, + {"M", Apps::Motion}, + {"", Apps::None}, + {"", Apps::None}, + }}; return std::make_unique(1, 2, app, settingsController, batteryController, dateTimeController, applications); } @@ -84,4 +83,3 @@ std::unique_ptr ApplicationList::CreateScreen2() { return std::make_unique(2, 3, app, settingsController, batteryController, dateTimeController, applications); }*/ - diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h index e334ccde..88534ec4 100644 --- a/src/displayapp/screens/ApplicationList.h +++ b/src/displayapp/screens/ApplicationList.h @@ -12,24 +12,24 @@ namespace Pinetime { namespace Applications { namespace Screens { class ApplicationList : public Screen { - public: - explicit ApplicationList(DisplayApp* app, - Pinetime::Controllers::Settings &settingsController, - Pinetime::Controllers::Battery& batteryController, - Controllers::DateTime& dateTimeController); - ~ApplicationList() override; - bool Refresh() override; - bool OnTouchEvent(TouchEvents event) override; - private: + public: + explicit ApplicationList(DisplayApp* app, + Pinetime::Controllers::Settings& settingsController, + Pinetime::Controllers::Battery& batteryController, + Controllers::DateTime& dateTimeController); + ~ApplicationList() override; + bool Refresh() override; + bool OnTouchEvent(TouchEvents event) override; - Controllers::Settings& settingsController; - Pinetime::Controllers::Battery& batteryController; - Controllers::DateTime& dateTimeController; + private: + Controllers::Settings& settingsController; + Pinetime::Controllers::Battery& batteryController; + Controllers::DateTime& dateTimeController; - ScreenList<2> screens; - std::unique_ptr CreateScreen1(); - std::unique_ptr CreateScreen2(); - //std::unique_ptr CreateScreen3(); + ScreenList<2> screens; + std::unique_ptr CreateScreen1(); + std::unique_ptr CreateScreen2(); + // std::unique_ptr CreateScreen3(); }; } } diff --git a/src/displayapp/screens/BatteryIcon.cpp b/src/displayapp/screens/BatteryIcon.cpp index 455b0c6d..6b54a305 100644 --- a/src/displayapp/screens/BatteryIcon.cpp +++ b/src/displayapp/screens/BatteryIcon.cpp @@ -4,10 +4,14 @@ using namespace Pinetime::Applications::Screens; const char* BatteryIcon::GetBatteryIcon(int batteryPercent) { - if(batteryPercent > 90) return Symbols::batteryFull; - if(batteryPercent > 75) return Symbols::batteryThreeQuarter; - if(batteryPercent > 50) return Symbols::batteryHalf; - if(batteryPercent > 25) return Symbols::batteryOneQuarter; + if (batteryPercent > 90) + return Symbols::batteryFull; + if (batteryPercent > 75) + return Symbols::batteryThreeQuarter; + if (batteryPercent > 50) + return Symbols::batteryHalf; + if (batteryPercent > 25) + return Symbols::batteryOneQuarter; return Symbols::batteryEmpty; } @@ -15,8 +19,9 @@ const char* BatteryIcon::GetUnknownIcon() { return Symbols::batteryEmpty; } -const char *BatteryIcon::GetPlugIcon(bool isCharging) { - if(isCharging) +const char* BatteryIcon::GetPlugIcon(bool isCharging) { + if (isCharging) return Symbols::plug; - else return ""; + else + return ""; } diff --git a/src/displayapp/screens/BatteryIcon.h b/src/displayapp/screens/BatteryIcon.h index 006e5621..9c192ff7 100644 --- a/src/displayapp/screens/BatteryIcon.h +++ b/src/displayapp/screens/BatteryIcon.h @@ -6,8 +6,8 @@ namespace Pinetime { class BatteryIcon { public: static const char* GetUnknownIcon(); - static const char* GetBatteryIcon(int batteryPercent); - static const char* GetPlugIcon(bool isCharging); + static const char* GetBatteryIcon(int batteryPercent); + static const char* GetPlugIcon(bool isCharging); }; } } diff --git a/src/displayapp/screens/BatteryInfo.cpp b/src/displayapp/screens/BatteryInfo.cpp index e616d67f..1ab8b0ad 100644 --- a/src/displayapp/screens/BatteryInfo.cpp +++ b/src/displayapp/screens/BatteryInfo.cpp @@ -4,22 +4,18 @@ using namespace Pinetime::Applications::Screens; -static void lv_update_task(struct _lv_task_t *task) { - auto user_data = static_cast(task->user_data); +static void lv_update_task(struct _lv_task_t* task) { + auto user_data = static_cast(task->user_data); user_data->UpdateScreen(); } -static void lv_anim_task(struct _lv_task_t *task) { - auto user_data = static_cast(task->user_data); +static void lv_anim_task(struct _lv_task_t* task) { + auto user_data = static_cast(task->user_data); user_data->UpdateAnim(); } -BatteryInfo::BatteryInfo( - Pinetime::Applications::DisplayApp *app, - Pinetime::Controllers::Battery& batteryController) : - Screen(app), - batteryController{batteryController} -{ +BatteryInfo::BatteryInfo(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Battery& batteryController) + : Screen(app), batteryController {batteryController} { batteryPercent = batteryController.PercentRemaining(); batteryVoltage = batteryController.Voltage(); @@ -32,37 +28,38 @@ BatteryInfo::BatteryInfo( lv_obj_set_style_local_radius(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, lv_color_hex(0x222222)); lv_obj_set_style_local_bg_opa(charging_bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_OPA_100); - lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, lv_color_hex(0xFF0000)); + lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, lv_color_hex(0xFF0000)); lv_bar_set_value(charging_bar, batteryPercent, LV_ANIM_OFF); - status = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(status,"Reading Battery status"); + status = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(status, "Reading Battery status"); lv_label_set_align(status, LV_LABEL_ALIGN_CENTER); lv_obj_align(status, charging_bar, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); - + percent = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(percent, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); - if ( batteryPercent >= 0) { - lv_label_set_text_fmt(percent,"%02i%%", batteryPercent); + if (batteryPercent >= 0) { + lv_label_set_text_fmt(percent, "%02i%%", batteryPercent); } else { - lv_label_set_text(percent,"--%"); + lv_label_set_text(percent, "--%"); } lv_label_set_align(percent, LV_LABEL_ALIGN_LEFT); lv_obj_align(percent, nullptr, LV_ALIGN_CENTER, 0, -60); // hack to not use the flot functions from printf uint8_t batteryVoltageBytes[2]; - batteryVoltageBytes[1] = static_cast(batteryVoltage); //truncate whole numbers - batteryVoltageBytes[0] = static_cast((batteryVoltage - batteryVoltageBytes[1]) * 100); //remove whole part of flt and shift 2 places over + batteryVoltageBytes[1] = static_cast(batteryVoltage); // truncate whole numbers + batteryVoltageBytes[0] = + static_cast((batteryVoltage - batteryVoltageBytes[1]) * 100); // remove whole part of flt and shift 2 places over // - voltage = lv_label_create(lv_scr_act(), nullptr); + voltage = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(voltage, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xC6A600)); - lv_label_set_text_fmt(voltage,"%1i.%02i volts", batteryVoltageBytes[1], batteryVoltageBytes[0]); + lv_label_set_text_fmt(voltage, "%1i.%02i volts", batteryVoltageBytes[1], batteryVoltageBytes[0]); lv_label_set_align(voltage, LV_LABEL_ALIGN_CENTER); lv_obj_align(voltage, nullptr, LV_ALIGN_CENTER, 0, 95); - lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); @@ -73,7 +70,6 @@ BatteryInfo::BatteryInfo( UpdateScreen(); } - BatteryInfo::~BatteryInfo() { lv_task_del(taskUpdate); lv_task_del(taskAnim); @@ -83,9 +79,9 @@ BatteryInfo::~BatteryInfo() { void BatteryInfo::UpdateAnim() { batteryPercent = batteryController.PercentRemaining(); - if ( batteryPercent >= 0 ) { - if ( batteryController.IsCharging() and batteryPercent < 100 ) { - animation +=1; + if (batteryPercent >= 0) { + if (batteryController.IsCharging() and batteryPercent < 100) { + animation += 1; if (animation >= 100) { animation = 0; } @@ -110,40 +106,39 @@ void BatteryInfo::UpdateScreen() { batteryPercent = batteryController.PercentRemaining(); batteryVoltage = batteryController.Voltage(); - if ( batteryPercent >= 0 ) { - if ( batteryController.IsCharging() and batteryPercent < 100 ) { - lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_RED); - lv_label_set_text_static(status,"Battery charging"); - } else if ( batteryPercent == 100 ) { - lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_BLUE); - lv_label_set_text_static(status,"Battery is fully charged"); - } else if ( batteryPercent < 10 ) { - lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_YELLOW); - lv_label_set_text_static(status,"Battery is low"); + if (batteryPercent >= 0) { + if (batteryController.IsCharging() and batteryPercent < 100) { + lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED); + lv_label_set_text_static(status, "Battery charging"); + } else if (batteryPercent == 100) { + lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_BLUE); + lv_label_set_text_static(status, "Battery is fully charged"); + } else if (batteryPercent < 10) { + lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_YELLOW); + lv_label_set_text_static(status, "Battery is low"); } else { - lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_GREEN); - lv_label_set_text_static(status,"Battery discharging"); + lv_obj_set_style_local_bg_color(charging_bar, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_GREEN); + lv_label_set_text_static(status, "Battery discharging"); } - - lv_label_set_text_fmt(percent,"%02i%%", batteryPercent); - + + lv_label_set_text_fmt(percent, "%02i%%", batteryPercent); + } else { - lv_label_set_text_static(status,"Reading Battery status"); - lv_label_set_text(percent,"--%"); + lv_label_set_text_static(status, "Reading Battery status"); + lv_label_set_text(percent, "--%"); } lv_obj_align(status, charging_bar, LV_ALIGN_OUT_BOTTOM_MID, 0, 20); // hack to not use the flot functions from printf uint8_t batteryVoltageBytes[2]; - batteryVoltageBytes[1] = static_cast(batteryVoltage); //truncate whole numbers - batteryVoltageBytes[0] = static_cast((batteryVoltage - batteryVoltageBytes[1]) * 100); //remove whole part of flt and shift 2 places over + batteryVoltageBytes[1] = static_cast(batteryVoltage); // truncate whole numbers + batteryVoltageBytes[0] = + static_cast((batteryVoltage - batteryVoltageBytes[1]) * 100); // remove whole part of flt and shift 2 places over // - lv_label_set_text_fmt(voltage,"%1i.%02i volts", batteryVoltageBytes[1], batteryVoltageBytes[0]); - + lv_label_set_text_fmt(voltage, "%1i.%02i volts", batteryVoltageBytes[1], batteryVoltageBytes[0]); } bool BatteryInfo::Refresh() { - + return running; } - diff --git a/src/displayapp/screens/BatteryInfo.h b/src/displayapp/screens/BatteryInfo.h index 206f1ab0..8805db58 100644 --- a/src/displayapp/screens/BatteryInfo.h +++ b/src/displayapp/screens/BatteryInfo.h @@ -6,7 +6,6 @@ #include "Screen.h" #include - namespace Pinetime { namespace Controllers { class Battery; @@ -15,34 +14,30 @@ namespace Pinetime { namespace Applications { namespace Screens { - class BatteryInfo : public Screen{ - public: - BatteryInfo(DisplayApp* app, - Pinetime::Controllers::Battery& batteryController); - ~BatteryInfo() override; + class BatteryInfo : public Screen { + public: + BatteryInfo(DisplayApp* app, Pinetime::Controllers::Battery& batteryController); + ~BatteryInfo() override; - bool Refresh() override; - + bool Refresh() override; - void UpdateScreen(); - void UpdateAnim(); + void UpdateScreen(); + void UpdateAnim(); - private: + private: + Pinetime::Controllers::Battery& batteryController; - Pinetime::Controllers::Battery& batteryController; + lv_obj_t* voltage; + lv_obj_t* percent; + lv_obj_t* charging_bar; + lv_obj_t* status; - lv_obj_t* voltage; - lv_obj_t* percent; - lv_obj_t* charging_bar; - lv_obj_t* status; - - lv_task_t* taskUpdate; - lv_task_t* taskAnim; - - int8_t animation = 0; - int8_t batteryPercent = -1; - float batteryVoltage = 0.0f; + lv_task_t* taskUpdate; + lv_task_t* taskAnim; + int8_t animation = 0; + int8_t batteryPercent = -1; + float batteryVoltage = 0.0f; }; } } diff --git a/src/displayapp/screens/BleIcon.cpp b/src/displayapp/screens/BleIcon.cpp index 1bbbd053..da3d15e7 100644 --- a/src/displayapp/screens/BleIcon.cpp +++ b/src/displayapp/screens/BleIcon.cpp @@ -3,6 +3,8 @@ using namespace Pinetime::Applications::Screens; const char* BleIcon::GetIcon(bool isConnected) { - if(isConnected) return Symbols::bluetooth; - else return ""; + if (isConnected) + return Symbols::bluetooth; + else + return ""; } \ No newline at end of file diff --git a/src/displayapp/screens/Brightness.cpp b/src/displayapp/screens/Brightness.cpp index 38469cf5..47c10561 100644 --- a/src/displayapp/screens/Brightness.cpp +++ b/src/displayapp/screens/Brightness.cpp @@ -3,14 +3,15 @@ using namespace Pinetime::Applications::Screens; -void slider_event_cb(lv_obj_t * slider, lv_event_t event) { - if(event == LV_EVENT_VALUE_CHANGED) { +void slider_event_cb(lv_obj_t* slider, lv_event_t event) { + if (event == LV_EVENT_VALUE_CHANGED) { auto* brightnessSlider = static_cast(slider->user_data); brightnessSlider->OnValueChanged(); } } -Brightness::Brightness(Pinetime::Applications::DisplayApp *app, Controllers::BrightnessController& brightness) : Screen(app), brightness{brightness} { +Brightness::Brightness(Pinetime::Applications::DisplayApp* app, Controllers::BrightnessController& brightness) + : Screen(app), brightness {brightness} { slider = lv_slider_create(lv_scr_act(), nullptr); lv_obj_set_user_data(slider, this); lv_obj_set_width(slider, LV_DPI * 2); @@ -33,13 +34,18 @@ bool Brightness::Refresh() { return running; } -const char *Brightness::LevelToString(Pinetime::Controllers::BrightnessController::Levels level) { - switch(level) { - case Pinetime::Controllers::BrightnessController::Levels::Off: return "Off"; - case Pinetime::Controllers::BrightnessController::Levels::Low: return "Low"; - case Pinetime::Controllers::BrightnessController::Levels::Medium: return "Medium"; - case Pinetime::Controllers::BrightnessController::Levels::High: return "High"; - default : return "???"; +const char* Brightness::LevelToString(Pinetime::Controllers::BrightnessController::Levels level) { + switch (level) { + case Pinetime::Controllers::BrightnessController::Levels::Off: + return "Off"; + case Pinetime::Controllers::BrightnessController::Levels::Low: + return "Low"; + case Pinetime::Controllers::BrightnessController::Levels::Medium: + return "Medium"; + case Pinetime::Controllers::BrightnessController::Levels::High: + return "High"; + default: + return "???"; } } @@ -48,29 +54,40 @@ void Brightness::OnValueChanged() { } void Brightness::SetValue(uint8_t value) { - switch(value) { - case 0: brightness.Set(Controllers::BrightnessController::Levels::Low); break; - case 1: brightness.Set(Controllers::BrightnessController::Levels::Medium); break; - case 2: brightness.Set(Controllers::BrightnessController::Levels::High); break; + switch (value) { + case 0: + brightness.Set(Controllers::BrightnessController::Levels::Low); + break; + case 1: + brightness.Set(Controllers::BrightnessController::Levels::Medium); + break; + case 2: + brightness.Set(Controllers::BrightnessController::Levels::High); + break; } lv_label_set_text(slider_label, LevelToString(brightness.Level())); } uint8_t Brightness::LevelToInt(Pinetime::Controllers::BrightnessController::Levels level) { - switch(level) { - case Pinetime::Controllers::BrightnessController::Levels::Off: return 0; - case Pinetime::Controllers::BrightnessController::Levels::Low: return 0; - case Pinetime::Controllers::BrightnessController::Levels::Medium: return 1; - case Pinetime::Controllers::BrightnessController::Levels::High: return 2; - default : return 0; + switch (level) { + case Pinetime::Controllers::BrightnessController::Levels::Off: + return 0; + case Pinetime::Controllers::BrightnessController::Levels::Low: + return 0; + case Pinetime::Controllers::BrightnessController::Levels::Medium: + return 1; + case Pinetime::Controllers::BrightnessController::Levels::High: + return 2; + default: + return 0; } } bool Brightness::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - switch(event) { + switch (event) { case TouchEvents::SwipeLeft: brightness.Lower(); - if ( brightness.Level() == Pinetime::Controllers::BrightnessController::Levels::Off) { + if (brightness.Level() == Pinetime::Controllers::BrightnessController::Levels::Off) { brightness.Set(Controllers::BrightnessController::Levels::Low); } SetValue(); diff --git a/src/displayapp/screens/Brightness.h b/src/displayapp/screens/Brightness.h index 60b33cfd..9ee33753 100644 --- a/src/displayapp/screens/Brightness.h +++ b/src/displayapp/screens/Brightness.h @@ -9,25 +9,25 @@ namespace Pinetime { namespace Applications { namespace Screens { class Brightness : public Screen { - public: - Brightness(DisplayApp* app, Controllers::BrightnessController& brightness); - ~Brightness() override; - bool Refresh() override; - - bool OnTouchEvent(TouchEvents event) override; + public: + Brightness(DisplayApp* app, Controllers::BrightnessController& brightness); + ~Brightness() override; + bool Refresh() override; - void OnValueChanged(); - private: - - Controllers::BrightnessController& brightness; + bool OnTouchEvent(TouchEvents event) override; - lv_obj_t * slider_label; - lv_obj_t * slider; + void OnValueChanged(); - const char* LevelToString(Controllers::BrightnessController::Levels level); - uint8_t LevelToInt(Controllers::BrightnessController::Levels level); - void SetValue(uint8_t value); - void SetValue(); + private: + Controllers::BrightnessController& brightness; + + lv_obj_t* slider_label; + lv_obj_t* slider; + + const char* LevelToString(Controllers::BrightnessController::Levels level); + uint8_t LevelToInt(Controllers::BrightnessController::Levels level); + void SetValue(uint8_t value); + void SetValue(); }; } } diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index c218aa5c..14299840 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -15,45 +15,48 @@ #include "WatchFaceDigital.h" #include "WatchFaceAnalog.h" - using namespace Pinetime::Applications::Screens; Clock::Clock(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController, - Controllers::NotificationManager& notificatioManager, - Controllers::Settings &settingsController, - Controllers::HeartRateController& heartRateController, - Controllers::MotionController& motionController) : Screen(app), - dateTimeController{dateTimeController}, batteryController{batteryController}, - bleController{bleController}, notificatioManager{notificatioManager}, - settingsController{settingsController}, - heartRateController{heartRateController}, - motionController{motionController}, - screens{app, - settingsController.GetClockFace(), - { - [this]() -> std::unique_ptr { return WatchFaceDigitalScreen(); }, - [this]() -> std::unique_ptr { return WatchFaceAnalogScreen(); }, - // Examples for more watch faces - //[this]() -> std::unique_ptr { return WatchFaceMinimalScreen(); }, - //[this]() -> std::unique_ptr { return WatchFaceCustomScreen(); } - }, - Screens::ScreenListModes::LongPress - } { + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::NotificationManager& notificatioManager, + Controllers::Settings& settingsController, + Controllers::HeartRateController& heartRateController, + Controllers::MotionController& motionController) + : Screen(app), + dateTimeController {dateTimeController}, + batteryController {batteryController}, + bleController {bleController}, + notificatioManager {notificatioManager}, + settingsController {settingsController}, + heartRateController {heartRateController}, + motionController {motionController}, + screens {app, + settingsController.GetClockFace(), + { + [this]() -> std::unique_ptr { + return WatchFaceDigitalScreen(); + }, + [this]() -> std::unique_ptr { + return WatchFaceAnalogScreen(); + }, + // Examples for more watch faces + //[this]() -> std::unique_ptr { return WatchFaceMinimalScreen(); }, + //[this]() -> std::unique_ptr { return WatchFaceCustomScreen(); } + }, + Screens::ScreenListModes::LongPress} { - settingsController.SetAppMenu(0); - - } + settingsController.SetAppMenu(0); +} Clock::~Clock() { lv_obj_clean(lv_scr_act()); } - -bool Clock::Refresh() { - screens.Refresh(); +bool Clock::Refresh() { + screens.Refresh(); return running; } @@ -61,21 +64,31 @@ bool Clock::OnTouchEvent(Pinetime::Applications::TouchEvents event) { return screens.OnTouchEvent(event); } -std::unique_ptr Clock::WatchFaceDigitalScreen() { - return std::make_unique(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, heartRateController, motionController); +std::unique_ptr Clock::WatchFaceDigitalScreen() { + return std::make_unique(app, + dateTimeController, + batteryController, + bleController, + notificatioManager, + settingsController, + heartRateController, + motionController); } -std::unique_ptr Clock::WatchFaceAnalogScreen() { - return std::make_unique(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); +std::unique_ptr Clock::WatchFaceAnalogScreen() { + return std::make_unique( + app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); } /* // Examples for more watch faces -std::unique_ptr Clock::WatchFaceMinimalScreen() { - return std::make_unique(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); +std::unique_ptr Clock::WatchFaceMinimalScreen() { + return std::make_unique(app, dateTimeController, batteryController, bleController, notificatioManager, +settingsController); } -std::unique_ptr Clock::WatchFaceCustomScreen() { - return std::make_unique(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController); +std::unique_ptr Clock::WatchFaceCustomScreen() { + return std::make_unique(app, dateTimeController, batteryController, bleController, notificatioManager, +settingsController); } */ \ No newline at end of file diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index 1a4e0ebd..9879985f 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -23,42 +23,37 @@ namespace Pinetime { namespace Applications { namespace Screens { class Clock : public Screen { - public: - Clock(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController, - Controllers::NotificationManager& notificatioManager, - Controllers::Settings &settingsController, - Controllers::HeartRateController& heartRateController, - Controllers::MotionController& motionController); - ~Clock() override; + public: + Clock(DisplayApp* app, + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::NotificationManager& notificatioManager, + Controllers::Settings& settingsController, + Controllers::HeartRateController& heartRateController, + Controllers::MotionController& motionController); + ~Clock() override; - bool Refresh() override; - - bool OnTouchEvent(TouchEvents event) override; + bool Refresh() override; - private: + bool OnTouchEvent(TouchEvents event) override; - Controllers::DateTime& dateTimeController; - Controllers::Battery& batteryController; - Controllers::Ble& bleController; - Controllers::NotificationManager& notificatioManager; - Controllers::Settings& settingsController; - Controllers::HeartRateController& heartRateController; - Controllers::MotionController& motionController; + private: + Controllers::DateTime& dateTimeController; + Controllers::Battery& batteryController; + Controllers::Ble& bleController; + Controllers::NotificationManager& notificatioManager; + Controllers::Settings& settingsController; + Controllers::HeartRateController& heartRateController; + Controllers::MotionController& motionController; + ScreenList<2> screens; + std::unique_ptr WatchFaceDigitalScreen(); + std::unique_ptr WatchFaceAnalogScreen(); - ScreenList<2> screens; - std::unique_ptr WatchFaceDigitalScreen(); - std::unique_ptr WatchFaceAnalogScreen(); - - // Examples for more watch faces - //std::unique_ptr WatchFaceMinimalScreen(); - //std::unique_ptr WatchFaceCustomScreen(); - - - + // Examples for more watch faces + // std::unique_ptr WatchFaceMinimalScreen(); + // std::unique_ptr WatchFaceCustomScreen(); }; } } diff --git a/src/displayapp/screens/DropDownDemo.cpp b/src/displayapp/screens/DropDownDemo.cpp index c3ec5d7d..9043c20d 100644 --- a/src/displayapp/screens/DropDownDemo.cpp +++ b/src/displayapp/screens/DropDownDemo.cpp @@ -5,20 +5,21 @@ using namespace Pinetime::Applications::Screens; -DropDownDemo::DropDownDemo(Pinetime::Applications::DisplayApp *app) : Screen(app) { +DropDownDemo::DropDownDemo(Pinetime::Applications::DisplayApp* app) : Screen(app) { // Create the dropdown object, with many item, and fix its height ddlist = lv_ddlist_create(lv_scr_act(), nullptr); - lv_ddlist_set_options(ddlist, "Apple\n" - "Banana\n" - "Orange\n" - "Melon\n" - "Grape\n" - "Raspberry\n" - "A\n" - "B\n" - "C\n" - "D\n" - "E"); + lv_ddlist_set_options(ddlist, + "Apple\n" + "Banana\n" + "Orange\n" + "Melon\n" + "Grape\n" + "Raspberry\n" + "A\n" + "B\n" + "C\n" + "D\n" + "E"); lv_ddlist_set_fix_width(ddlist, 150); lv_ddlist_set_draw_arrow(ddlist, true); lv_ddlist_set_fix_height(ddlist, 150); @@ -32,12 +33,12 @@ DropDownDemo::~DropDownDemo() { } bool DropDownDemo::Refresh() { - auto* list = static_cast(ddlist->ext_attr); + auto* list = static_cast(ddlist->ext_attr); // Switch touchmode to Polling if the dropdown is opened. This will allow to scroll inside the // dropdown while it is opened. // Disable the polling mode when the dropdown is closed to be able to handle the gestures. - if(list->opened) + if (list->opened) app->SetTouchMode(DisplayApp::TouchModes::Polling); else app->SetTouchMode(DisplayApp::TouchModes::Gestures); @@ -47,11 +48,10 @@ bool DropDownDemo::Refresh() { bool DropDownDemo::OnTouchEvent(Pinetime::Applications::TouchEvents event) { // If the dropdown is opened, notify Display app that it doesn't need to handle the event // (this will prevent displayApp from going back to the menu or clock scree). - auto* list = static_cast(ddlist->ext_attr); - if(list->opened) { + auto* list = static_cast(ddlist->ext_attr); + if (list->opened) { return true; } else { return false; } } - diff --git a/src/displayapp/screens/DropDownDemo.h b/src/displayapp/screens/DropDownDemo.h index 821ae528..ff388c57 100644 --- a/src/displayapp/screens/DropDownDemo.h +++ b/src/displayapp/screens/DropDownDemo.h @@ -9,18 +9,18 @@ namespace Pinetime { namespace Screens { class DropDownDemo : public Screen { - public: - DropDownDemo(DisplayApp* app); - ~DropDownDemo() override; + public: + DropDownDemo(DisplayApp* app); + ~DropDownDemo() override; - bool Refresh() override; - - bool OnTouchEvent(TouchEvents event) override; + bool Refresh() override; - private: - lv_obj_t * ddlist; - - bool isDropDownOpened = false; + bool OnTouchEvent(TouchEvents event) override; + + private: + lv_obj_t* ddlist; + + bool isDropDownOpened = false; }; } } diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp index 26cc9a9c..4086b152 100644 --- a/src/displayapp/screens/FirmwareUpdate.cpp +++ b/src/displayapp/screens/FirmwareUpdate.cpp @@ -5,11 +5,10 @@ using namespace Pinetime::Applications::Screens; +FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Ble& bleController) + : Screen(app), bleController {bleController} { -FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Ble& bleController) : - Screen(app), bleController{bleController} { - - lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); @@ -38,21 +37,21 @@ FirmwareUpdate::~FirmwareUpdate() { } bool FirmwareUpdate::Refresh() { - switch(bleController.State()) { + switch (bleController.State()) { default: case Pinetime::Controllers::Ble::FirmwareUpdateStates::Idle: case Pinetime::Controllers::Ble::FirmwareUpdateStates::Running: - if(state != States::Running) + if (state != States::Running) state = States::Running; return DisplayProgression(); case Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated: - if(state != States::Validated) { + if (state != States::Validated) { UpdateValidated(); state = States::Validated; } return running; case Pinetime::Controllers::Ble::FirmwareUpdateStates::Error: - if(state != States::Error) { + if (state != States::Error) { UpdateError(); state = States::Error; } diff --git a/src/displayapp/screens/FirmwareUpdate.h b/src/displayapp/screens/FirmwareUpdate.h index 27be3631..f4d34df0 100644 --- a/src/displayapp/screens/FirmwareUpdate.h +++ b/src/displayapp/screens/FirmwareUpdate.h @@ -10,29 +10,28 @@ namespace Pinetime { namespace Applications { namespace Screens { - class FirmwareUpdate : public Screen{ - public: - FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController); - ~FirmwareUpdate() override; + class FirmwareUpdate : public Screen { + public: + FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController); + ~FirmwareUpdate() override; - bool Refresh() override; - + bool Refresh() override; - private: - enum class States { Idle, Running, Validated, Error }; - Pinetime::Controllers::Ble& bleController; - lv_obj_t* bar1; - lv_obj_t* percentLabel; - lv_obj_t* titleLabel; - mutable char percentStr[10]; - - States state; + private: + enum class States { Idle, Running, Validated, Error }; + Pinetime::Controllers::Ble& bleController; + lv_obj_t* bar1; + lv_obj_t* percentLabel; + lv_obj_t* titleLabel; + mutable char percentStr[10]; - bool DisplayProgression() const; + States state; - void UpdateValidated(); + bool DisplayProgression() const; - void UpdateError(); + void UpdateValidated(); + + void UpdateError(); }; } } diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp index f78b1a67..873a22f5 100644 --- a/src/displayapp/screens/FirmwareValidation.cpp +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -7,23 +7,20 @@ using namespace Pinetime::Applications::Screens; namespace { - static void ButtonEventHandler(lv_obj_t * obj, lv_event_t event) - { - FirmwareValidation* screen = static_cast(obj->user_data); + static void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) { + FirmwareValidation* screen = static_cast(obj->user_data); screen->OnButtonEvent(obj, event); } } -FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app, - Pinetime::Controllers::FirmwareValidator &validator) - : Screen{app}, validator{validator} { +FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator) + : Screen {app}, validator {validator} { labelVersionInfo = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(labelVersionInfo, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 0); lv_label_set_text(labelVersionInfo, "Version : "); lv_label_set_align(labelVersionInfo, LV_LABEL_ALIGN_LEFT); - labelVersionValue = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(labelVersionValue, labelVersionInfo, LV_ALIGN_OUT_RIGHT_MID, 0, 0); lv_label_set_recolor(labelVersionValue, true); @@ -36,11 +33,10 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app, lv_label_set_long_mode(labelIsValidated, LV_LABEL_LONG_BREAK); lv_obj_set_width(labelIsValidated, 240); - if(validator.IsValidated()) + if (validator.IsValidated()) lv_label_set_text(labelIsValidated, "You have already\n#00ff00 validated# this firmware#"); else { - lv_label_set_text(labelIsValidated, - "Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version."); + lv_label_set_text(labelIsValidated, "Please #00ff00 Validate# this version or\n#ff0000 Reset# to rollback to the previous version."); buttonValidate = lv_btn_create(lv_scr_act(), nullptr); lv_obj_align(buttonValidate, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); @@ -49,19 +45,18 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app, lv_obj_set_style_local_bg_color(buttonValidate, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x009900)); labelButtonValidate = lv_label_create(buttonValidate, nullptr); - lv_label_set_text_static(labelButtonValidate, "Validate"); + lv_label_set_text_static(labelButtonValidate, "Validate"); buttonReset = lv_btn_create(lv_scr_act(), nullptr); buttonReset->user_data = this; lv_obj_align(buttonReset, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); lv_obj_set_style_local_bg_color(buttonReset, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x990000)); lv_obj_set_event_cb(buttonReset, ButtonEventHandler); - - labelButtonReset = lv_label_create(buttonReset, nullptr); - lv_label_set_text_static(labelButtonReset, "Reset"); - } -} + labelButtonReset = lv_label_create(buttonReset, nullptr); + lv_label_set_text_static(labelButtonReset, "Reset"); + } +} FirmwareValidation::~FirmwareValidation() { lv_obj_clean(lv_scr_act()); @@ -71,12 +66,11 @@ bool FirmwareValidation::Refresh() { return running; } -void FirmwareValidation::OnButtonEvent(lv_obj_t *object, lv_event_t event) { - if(object == buttonValidate && event == LV_EVENT_PRESSED) { +void FirmwareValidation::OnButtonEvent(lv_obj_t* object, lv_event_t event) { + if (object == buttonValidate && event == LV_EVENT_PRESSED) { validator.Validate(); - running = false; - } else if(object == buttonReset && event == LV_EVENT_PRESSED) { + running = false; + } else if (object == buttonReset && event == LV_EVENT_PRESSED) { validator.Reset(); } - } diff --git a/src/displayapp/screens/FirmwareValidation.h b/src/displayapp/screens/FirmwareValidation.h index b83f8238..67662fd9 100644 --- a/src/displayapp/screens/FirmwareValidation.h +++ b/src/displayapp/screens/FirmwareValidation.h @@ -11,28 +11,26 @@ namespace Pinetime { namespace Applications { namespace Screens { - class FirmwareValidation : public Screen{ - public: - FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator); - ~FirmwareValidation() override; + class FirmwareValidation : public Screen { + public: + FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator); + ~FirmwareValidation() override; - bool Refresh() override; - + bool Refresh() override; - void OnButtonEvent(lv_obj_t *object, lv_event_t event); + void OnButtonEvent(lv_obj_t* object, lv_event_t event); - private: - Pinetime::Controllers::FirmwareValidator& validator; + private: + Pinetime::Controllers::FirmwareValidator& validator; - lv_obj_t* labelVersionInfo; - lv_obj_t* labelVersionValue; - char version[9]; - lv_obj_t* labelIsValidated; - lv_obj_t* buttonValidate; - lv_obj_t* labelButtonValidate; - lv_obj_t* buttonReset; - lv_obj_t* labelButtonReset; - + lv_obj_t* labelVersionInfo; + lv_obj_t* labelVersionValue; + char version[9]; + lv_obj_t* labelIsValidated; + lv_obj_t* buttonValidate; + lv_obj_t* labelButtonValidate; + lv_obj_t* buttonReset; + lv_obj_t* labelButtonReset; }; } } diff --git a/src/displayapp/screens/FlashLight.cpp b/src/displayapp/screens/FlashLight.cpp index 0ef1b333..4568db40 100644 --- a/src/displayapp/screens/FlashLight.cpp +++ b/src/displayapp/screens/FlashLight.cpp @@ -5,46 +5,43 @@ using namespace Pinetime::Applications::Screens; namespace { - static void event_handler(lv_obj_t * obj, lv_event_t event) { - FlashLight* screen = static_cast(obj->user_data); + static void event_handler(lv_obj_t* obj, lv_event_t event) { + FlashLight* screen = static_cast(obj->user_data); screen->OnClickEvent(obj, event); } } -FlashLight::FlashLight( - Pinetime::Applications::DisplayApp *app, - System::SystemTask &systemTask, - Controllers::BrightnessController& brightness) : - Screen(app), - systemTask{systemTask}, - brightness{brightness} - +FlashLight::FlashLight(Pinetime::Applications::DisplayApp* app, + System::SystemTask& systemTask, + Controllers::BrightnessController& brightness) + : Screen(app), + systemTask {systemTask}, + brightness {brightness} + { brightness.Backup(); brightness.Set(Controllers::BrightnessController::Levels::High); // Set the background lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF)); - - flashLight = lv_label_create(lv_scr_act(), NULL); + + flashLight = lv_label_create(lv_scr_act(), NULL); lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); lv_obj_set_style_local_text_font(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); lv_label_set_text_static(flashLight, Symbols::highlight); lv_obj_align(flashLight, NULL, LV_ALIGN_CENTER, 0, 0); - backgroundAction = lv_label_create(lv_scr_act(), nullptr); + backgroundAction = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(backgroundAction, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundAction, 240, 240); lv_obj_set_pos(backgroundAction, 0, 0); lv_label_set_text(backgroundAction, ""); lv_obj_set_click(backgroundAction, true); - backgroundAction->user_data = this; + backgroundAction->user_data = this; lv_obj_set_event_cb(backgroundAction, event_handler); - + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping); - } - FlashLight::~FlashLight() { lv_obj_clean(lv_scr_act()); lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); @@ -52,19 +49,18 @@ FlashLight::~FlashLight() { systemTask.PushMessage(Pinetime::System::SystemTask::Messages::EnableSleeping); } -void FlashLight::OnClickEvent(lv_obj_t *obj, lv_event_t event) { - if(obj == backgroundAction) { +void FlashLight::OnClickEvent(lv_obj_t* obj, lv_event_t event) { + if (obj == backgroundAction) { if (event == LV_EVENT_CLICKED) { isOn = !isOn; - if ( isOn ) { + if (isOn) { lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF)); lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); } else { lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x000000)); lv_obj_set_style_local_text_color(flashLight, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xFFFFFF)); } - } } } @@ -76,4 +72,3 @@ bool FlashLight::Refresh() { bool FlashLight::OnTouchEvent(Pinetime::Applications::TouchEvents event) { return true; } - diff --git a/src/displayapp/screens/FlashLight.h b/src/displayapp/screens/FlashLight.h index c62472ab..a862ffdb 100644 --- a/src/displayapp/screens/FlashLight.h +++ b/src/displayapp/screens/FlashLight.h @@ -6,30 +6,28 @@ #include "systemtask/SystemTask.h" #include "components/brightness/BrightnessController.h" - namespace Pinetime { - + namespace Applications { namespace Screens { - class FlashLight : public Screen{ - public: - FlashLight(DisplayApp* app, System::SystemTask &systemTask, Controllers::BrightnessController& brightness); - ~FlashLight() override; + class FlashLight : public Screen { + public: + FlashLight(DisplayApp* app, System::SystemTask& systemTask, Controllers::BrightnessController& brightness); + ~FlashLight() override; - bool Refresh() override; - - bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; - void OnClickEvent(lv_obj_t *obj, lv_event_t event); + bool Refresh() override; - private: - Pinetime::System::SystemTask& systemTask; - Controllers::BrightnessController& brightness; + bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; + void OnClickEvent(lv_obj_t* obj, lv_event_t event); - lv_obj_t* flashLight; - lv_obj_t* backgroundAction; - bool isOn = true; + private: + Pinetime::System::SystemTask& systemTask; + Controllers::BrightnessController& brightness; + lv_obj_t* flashLight; + lv_obj_t* backgroundAction; + bool isOn = true; }; } } diff --git a/src/displayapp/screens/HeartRate.cpp b/src/displayapp/screens/HeartRate.cpp index e735c18d..90f6bc26 100644 --- a/src/displayapp/screens/HeartRate.cpp +++ b/src/displayapp/screens/HeartRate.cpp @@ -7,7 +7,7 @@ using namespace Pinetime::Applications::Screens; namespace { - const char *ToString(Pinetime::Controllers::HeartRateController::States s) { + const char* ToString(Pinetime::Controllers::HeartRateController::States s) { switch (s) { case Pinetime::Controllers::HeartRateController::States::NotEnoughData: return "Not enough data,\nplease wait..."; @@ -21,35 +21,37 @@ namespace { return ""; } - static void btnStartStopEventHandler(lv_obj_t *obj, lv_event_t event) { - HeartRate *screen = static_cast(obj->user_data); + static void btnStartStopEventHandler(lv_obj_t* obj, lv_event_t event) { + HeartRate* screen = static_cast(obj->user_data); screen->OnStartStopEvent(event); } } -HeartRate::HeartRate(Pinetime::Applications::DisplayApp *app, Controllers::HeartRateController& heartRateController, System::SystemTask &systemTask) : - Screen(app), heartRateController{heartRateController}, systemTask{systemTask} { +HeartRate::HeartRate(Pinetime::Applications::DisplayApp* app, + Controllers::HeartRateController& heartRateController, + System::SystemTask& systemTask) + : Screen(app), heartRateController {heartRateController}, systemTask {systemTask} { bool isHrRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped; label_hr = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); - if(isHrRunning) + if (isHrRunning) lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); else lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); lv_label_set_text(label_hr, "000"); - lv_obj_align(label_hr, nullptr, LV_ALIGN_CENTER, 0, -40); + lv_obj_align(label_hr, nullptr, LV_ALIGN_CENTER, 0, -40); label_bpm = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text(label_bpm, "Heart rate BPM"); + lv_label_set_text(label_bpm, "Heart rate BPM"); lv_obj_align(label_bpm, label_hr, LV_ALIGN_OUT_TOP_MID, 0, -20); label_status = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(label_status, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x222222)); lv_label_set_text(label_status, ToString(Pinetime::Controllers::HeartRateController::States::NotEnoughData)); - + lv_obj_align(label_status, label_hr, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); btn_startStop = lv_btn_create(lv_scr_act(), nullptr); @@ -60,7 +62,7 @@ HeartRate::HeartRate(Pinetime::Applications::DisplayApp *app, Controllers::Heart label_startStop = lv_label_create(btn_startStop, nullptr); UpdateStartStopButton(isHrRunning); - if(isHrRunning) + if (isHrRunning) systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping); } @@ -72,10 +74,10 @@ HeartRate::~HeartRate() { bool HeartRate::Refresh() { auto state = heartRateController.State(); - switch(state) { + switch (state) { case Controllers::HeartRateController::States::NoTouch: case Controllers::HeartRateController::States::NotEnoughData: - //case Controllers::HeartRateController::States::Stopped: + // case Controllers::HeartRateController::States::Stopped: lv_label_set_text(label_hr, "000"); break; default: @@ -90,13 +92,12 @@ bool HeartRate::Refresh() { void HeartRate::OnStartStopEvent(lv_event_t event) { if (event == LV_EVENT_CLICKED) { - if(heartRateController.State() == Controllers::HeartRateController::States::Stopped) { + if (heartRateController.State() == Controllers::HeartRateController::States::Stopped) { heartRateController.Start(); UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped); systemTask.PushMessage(Pinetime::System::SystemTask::Messages::DisableSleeping); lv_obj_set_style_local_text_color(label_hr, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GREEN); - } - else { + } else { heartRateController.Stop(); UpdateStartStopButton(heartRateController.State() != Controllers::HeartRateController::States::Stopped); systemTask.PushMessage(Pinetime::System::SystemTask::Messages::EnableSleeping); @@ -106,7 +107,7 @@ void HeartRate::OnStartStopEvent(lv_event_t event) { } void HeartRate::UpdateStartStopButton(bool isRunning) { - if(isRunning) + if (isRunning) lv_label_set_text(label_startStop, "Stop"); else lv_label_set_text(label_startStop, "Start"); diff --git a/src/displayapp/screens/HeartRate.h b/src/displayapp/screens/HeartRate.h index c8f36999..a23c5af8 100644 --- a/src/displayapp/screens/HeartRate.h +++ b/src/displayapp/screens/HeartRate.h @@ -15,13 +15,13 @@ namespace Pinetime { namespace Applications { namespace Screens { - class HeartRate : public Screen{ + class HeartRate : public Screen { public: - HeartRate(DisplayApp* app, Controllers::HeartRateController& HeartRateController, System::SystemTask &systemTask); + HeartRate(DisplayApp* app, Controllers::HeartRateController& HeartRateController, System::SystemTask& systemTask); ~HeartRate() override; bool Refresh() override; - + void OnStartStopEvent(lv_event_t event); private: @@ -33,9 +33,6 @@ namespace Pinetime { lv_obj_t* label_status; lv_obj_t* btn_startStop; lv_obj_t* label_startStop; - - - }; } } diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp index b6a7e3e4..32240084 100644 --- a/src/displayapp/screens/InfiniPaint.cpp +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -4,7 +4,7 @@ using namespace Pinetime::Applications::Screens; -InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl{lvgl} { +InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} { app->SetTouchMode(DisplayApp::TouchModes::Polling); std::fill(b, b + bufferSize, selectColor); } @@ -20,8 +20,8 @@ bool InfiniPaint::Refresh() { } bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - switch(event) { - case Pinetime::Applications::TouchEvents::LongTap: + switch (event) { + case Pinetime::Applications::TouchEvents::LongTap: switch (color) { case 0: selectColor = LV_COLOR_MAGENTA; @@ -47,13 +47,13 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { case 7: selectColor = LV_COLOR_BLACK; break; - + default: color = 0; break; } - std::fill(b, b + bufferSize, selectColor); + std::fill(b, b + bufferSize, selectColor); color++; return true; default: @@ -72,4 +72,3 @@ bool InfiniPaint::OnTouchEvent(uint16_t x, uint16_t y) { lvgl.FlushDisplay(&area, b); return true; } - diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h index da9c39ba..6251752a 100644 --- a/src/displayapp/screens/InfiniPaint.h +++ b/src/displayapp/screens/InfiniPaint.h @@ -31,7 +31,6 @@ namespace Pinetime { lv_color_t b[bufferSize]; lv_color_t selectColor = LV_COLOR_WHITE; uint8_t color = 2; - }; } } diff --git a/src/displayapp/screens/Label.cpp b/src/displayapp/screens/Label.cpp index cc268775..0132dbd2 100644 --- a/src/displayapp/screens/Label.cpp +++ b/src/displayapp/screens/Label.cpp @@ -2,24 +2,21 @@ using namespace Pinetime::Applications::Screens; -Label::Label(uint8_t screenID, uint8_t numScreens, - Pinetime::Applications::DisplayApp *app, lv_obj_t* labelText) : - Screen(app), - labelText{labelText} { - - if ( numScreens > 1 ) { +Label::Label(uint8_t screenID, uint8_t numScreens, Pinetime::Applications::DisplayApp* app, lv_obj_t* labelText) + : Screen(app), labelText {labelText} { + + if (numScreens > 1) { pageIndicatorBasePoints[0].x = 240 - 1; pageIndicatorBasePoints[0].y = 6; pageIndicatorBasePoints[1].x = 240 - 1; pageIndicatorBasePoints[1].y = 240 - 6; - + pageIndicatorBase = lv_line_create(lv_scr_act(), NULL); lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); lv_obj_set_style_local_line_rounded(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true); lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2); - uint16_t indicatorSize = 228 / numScreens; uint16_t indicatorPos = indicatorSize * screenID; @@ -34,7 +31,6 @@ Label::Label(uint8_t screenID, uint8_t numScreens, lv_obj_set_style_local_line_rounded(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true); lv_line_set_points(pageIndicator, pageIndicatorPoints, 2); } - } Label::~Label() { diff --git a/src/displayapp/screens/Label.h b/src/displayapp/screens/Label.h index a1bcba95..62b80bec 100644 --- a/src/displayapp/screens/Label.h +++ b/src/displayapp/screens/Label.h @@ -8,23 +8,20 @@ namespace Pinetime { namespace Screens { class Label : public Screen { - public: - Label( uint8_t screenID, uint8_t numScreens, - DisplayApp* app, lv_obj_t* labelText ); - ~Label() override; - - bool Refresh() override; - + public: + Label(uint8_t screenID, uint8_t numScreens, DisplayApp* app, lv_obj_t* labelText); + ~Label() override; - private: + bool Refresh() override; - bool running = true; - - lv_obj_t * labelText = nullptr; - lv_point_t pageIndicatorBasePoints[2]; - lv_point_t pageIndicatorPoints[2]; - lv_obj_t* pageIndicatorBase; - lv_obj_t* pageIndicator; + private: + bool running = true; + + lv_obj_t* labelText = nullptr; + lv_point_t pageIndicatorBasePoints[2]; + lv_point_t pageIndicatorPoints[2]; + lv_obj_t* pageIndicatorBase; + lv_obj_t* pageIndicator; }; } } diff --git a/src/displayapp/screens/List.cpp b/src/displayapp/screens/List.cpp index 82da4d4c..b4f4d2cf 100644 --- a/src/displayapp/screens/List.cpp +++ b/src/displayapp/screens/List.cpp @@ -5,39 +5,37 @@ using namespace Pinetime::Applications::Screens; namespace { - static void ButtonEventHandler(lv_obj_t * obj, lv_event_t event) { - List* screen = static_cast(obj->user_data); + static void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) { + List* screen = static_cast(obj->user_data); screen->OnButtonEvent(obj, event); } } -List::List(uint8_t screenID, uint8_t numScreens, - DisplayApp* app, - Controllers::Settings &settingsController, - std::array& applications) : - Screen(app), - settingsController{settingsController} -{ +List::List(uint8_t screenID, + uint8_t numScreens, + DisplayApp* app, + Controllers::Settings& settingsController, + std::array& applications) + : Screen(app), settingsController {settingsController} { // Set the background to Black lv_obj_set_style_local_bg_color(lv_scr_act(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(0, 0, 0)); settingsController.SetSettingsMenu(screenID); - if ( numScreens > 1 ) { + if (numScreens > 1) { pageIndicatorBasePoints[0].x = 240 - 1; pageIndicatorBasePoints[0].y = 6; pageIndicatorBasePoints[1].x = 240 - 1; pageIndicatorBasePoints[1].y = 240 - 6; - + pageIndicatorBase = lv_line_create(lv_scr_act(), NULL); lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); lv_obj_set_style_local_line_rounded(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true); lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2); - uint16_t indicatorSize = 228 / numScreens; uint16_t indicatorPos = indicatorSize * screenID; @@ -53,10 +51,9 @@ List::List(uint8_t screenID, uint8_t numScreens, lv_line_set_points(pageIndicator, pageIndicatorPoints, 2); } - lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); - //lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); + // lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5); @@ -67,12 +64,12 @@ List::List(uint8_t screenID, uint8_t numScreens, lv_obj_set_height(container1, LV_VER_RES); lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); - lv_obj_t * labelBt; - lv_obj_t * labelBtIco; + lv_obj_t* labelBt; + lv_obj_t* labelBtIco; - for(int i = 0; i < MAXLISTITEMS; i++) { + for (int i = 0; i < MAXLISTITEMS; i++) { apps[i] = applications[i].application; - if ( applications[i].application != Apps::None) { + if (applications[i].application != Apps::None) { itemApps[i] = lv_btn_create(container1, nullptr); lv_obj_set_style_local_bg_opa(itemApps[i], LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20); @@ -91,19 +88,17 @@ List::List(uint8_t screenID, uint8_t numScreens, labelBt = lv_label_create(itemApps[i], nullptr); lv_label_set_text_fmt(labelBt, " %s", applications[i].name); - } } - lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, LV_HOR_RES, LV_VER_RES); lv_obj_set_pos(backgroundLabel, 0, 0); lv_label_set_text_static(backgroundLabel, ""); - } -List::~List() { +List::~List() { lv_obj_clean(lv_scr_act()); } @@ -112,10 +107,10 @@ bool List::Refresh() { return running; } -void List::OnButtonEvent(lv_obj_t * object, lv_event_t event) { - if ( event == LV_EVENT_RELEASED ) { - for(int i = 0; i < MAXLISTITEMS; i++) { - if ( apps[i] != Apps::None && object == itemApps[i] ) { +void List::OnButtonEvent(lv_obj_t* object, lv_event_t event) { + if (event == LV_EVENT_RELEASED) { + for (int i = 0; i < MAXLISTITEMS; i++) { + if (apps[i] != Apps::None && object == itemApps[i]) { app->StartApp(apps[i], DisplayApp::FullRefreshDirections::Up); running = false; return; @@ -123,4 +118,3 @@ void List::OnButtonEvent(lv_obj_t * object, lv_event_t event) { } } } - diff --git a/src/displayapp/screens/List.h b/src/displayapp/screens/List.h index 739a91c3..a45fd1d3 100644 --- a/src/displayapp/screens/List.h +++ b/src/displayapp/screens/List.h @@ -13,36 +13,34 @@ namespace Pinetime { namespace Applications { namespace Screens { class List : public Screen { - public: - struct Applications { - const char* icon; - const char* name; - Pinetime::Applications::Apps application; - }; + public: + struct Applications { + const char* icon; + const char* name; + Pinetime::Applications::Apps application; + }; - explicit List(uint8_t screenID, uint8_t numScreens, - DisplayApp* app, - Controllers::Settings& settingsController, - std::array& applications); - ~List() override; + explicit List(uint8_t screenID, + uint8_t numScreens, + DisplayApp* app, + Controllers::Settings& settingsController, + std::array& applications); + ~List() override; - bool Refresh() override; - + bool Refresh() override; - void OnButtonEvent(lv_obj_t *object, lv_event_t event); + void OnButtonEvent(lv_obj_t* object, lv_event_t event); - private: + private: + Controllers::Settings& settingsController; + Pinetime::Applications::Apps apps[MAXLISTITEMS]; - Controllers::Settings& settingsController; - Pinetime::Applications::Apps apps[MAXLISTITEMS]; + lv_obj_t* itemApps[MAXLISTITEMS]; - lv_obj_t * itemApps[MAXLISTITEMS]; - - lv_point_t pageIndicatorBasePoints[2]; - lv_point_t pageIndicatorPoints[2]; - lv_obj_t* pageIndicatorBase; - lv_obj_t* pageIndicator; - + lv_point_t pageIndicatorBasePoints[2]; + lv_point_t pageIndicatorPoints[2]; + lv_obj_t* pageIndicatorBase; + lv_obj_t* pageIndicator; }; } } diff --git a/src/displayapp/screens/Meter.cpp b/src/displayapp/screens/Meter.cpp index 2c042cac..e0dbdfad 100644 --- a/src/displayapp/screens/Meter.cpp +++ b/src/displayapp/screens/Meter.cpp @@ -4,35 +4,33 @@ using namespace Pinetime::Applications::Screens; - -Meter::Meter(Pinetime::Applications::DisplayApp *app) : Screen(app) { +Meter::Meter(Pinetime::Applications::DisplayApp* app) : Screen(app) { /*Create a line meter */ lmeter = lv_linemeter_create(lv_scr_act(), nullptr); - lv_linemeter_set_range(lmeter, 0, 60); /*Set the range*/ - lv_linemeter_set_value(lmeter, value); /*Set the current value*/ + lv_linemeter_set_range(lmeter, 0, 60); /*Set the range*/ + lv_linemeter_set_value(lmeter, value); /*Set the current value*/ lv_linemeter_set_angle_offset(lmeter, 180); - lv_linemeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/ + lv_linemeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/ - lv_obj_set_style_local_scale_end_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(255,0,0)); - lv_obj_set_style_local_scale_grad_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(160,0,0)); + lv_obj_set_style_local_scale_end_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(255, 0, 0)); + lv_obj_set_style_local_scale_grad_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, lv_color_make(160, 0, 0)); lv_obj_set_style_local_line_width(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, 2); lv_obj_set_style_local_line_color(lmeter, LV_LINEMETER_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_SILVER); lv_obj_set_size(lmeter, 200, 200); lv_obj_align(lmeter, nullptr, LV_ALIGN_CENTER, 0, 0); - } Meter::~Meter() { - lv_obj_clean(lv_scr_act()); } bool Meter::Refresh() { - lv_linemeter_set_value(lmeter, value++); /*Set the current value*/ - if(value>=60) value = 0; + lv_linemeter_set_value(lmeter, value++); /*Set the current value*/ + if (value >= 60) + value = 0; return running; } diff --git a/src/displayapp/screens/Meter.h b/src/displayapp/screens/Meter.h index 6a1fc3bf..24af15ad 100644 --- a/src/displayapp/screens/Meter.h +++ b/src/displayapp/screens/Meter.h @@ -9,20 +9,18 @@ namespace Pinetime { namespace Applications { namespace Screens { - class Meter : public Screen{ - public: - Meter(DisplayApp* app); - ~Meter() override; + class Meter : public Screen { + public: + Meter(DisplayApp* app); + ~Meter() override; - bool Refresh() override; + bool Refresh() override; - private: - lv_style_t style_lmeter; - lv_obj_t * lmeter; - - uint32_t value=0; - + private: + lv_style_t style_lmeter; + lv_obj_t* lmeter; + uint32_t value = 0; }; } } diff --git a/src/displayapp/screens/Motion.cpp b/src/displayapp/screens/Motion.cpp index 96460659..a8bb3c18 100644 --- a/src/displayapp/screens/Motion.cpp +++ b/src/displayapp/screens/Motion.cpp @@ -4,13 +4,14 @@ using namespace Pinetime::Applications::Screens; -Motion::Motion(Pinetime::Applications::DisplayApp *app, Controllers::MotionController& motionController) : Screen(app), motionController{motionController} { +Motion::Motion(Pinetime::Applications::DisplayApp* app, Controllers::MotionController& motionController) + : Screen(app), motionController {motionController} { chart = lv_chart_create(lv_scr_act(), NULL); lv_obj_set_size(chart, 240, 240); lv_obj_align(chart, NULL, LV_ALIGN_IN_TOP_MID, 0, 0); - lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/ - //lv_chart_set_series_opa(chart, LV_OPA_70); /*Opacity of the data series*/ - //lv_chart_set_series_width(chart, 4); /*Line width and point radious*/ + lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/ + // lv_chart_set_series_opa(chart, LV_OPA_70); /*Opacity of the data series*/ + // lv_chart_set_series_width(chart, 4); /*Line width and point radious*/ lv_chart_set_range(chart, -1100, 1100); lv_chart_set_update_mode(chart, LV_CHART_UPDATE_MODE_SHIFT); diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h index 6ba0fd6d..132b20ec 100644 --- a/src/displayapp/screens/Motion.h +++ b/src/displayapp/screens/Motion.h @@ -12,7 +12,7 @@ namespace Pinetime { namespace Applications { namespace Screens { - class Motion : public Screen{ + class Motion : public Screen { public: Motion(DisplayApp* app, Controllers::MotionController& motionController); ~Motion() override; @@ -22,17 +22,16 @@ namespace Pinetime { private: Controllers::MotionController& motionController; - lv_obj_t * chart; - lv_chart_series_t * ser1; - lv_chart_series_t * ser2; - lv_chart_series_t * ser3; - lv_obj_t * label; + lv_obj_t* chart; + lv_chart_series_t* ser1; + lv_chart_series_t* ser2; + lv_chart_series_t* ser3; + lv_obj_t* label; lv_obj_t* labelStep; static constexpr uint8_t nbStepsBufferSize = 9; - char nbStepsBuffer[nbStepsBufferSize+1]; + char nbStepsBuffer[nbStepsBufferSize + 1]; bool running = true; - }; } } diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp index d8c950fa..9f10f508 100644 --- a/src/displayapp/screens/Music.cpp +++ b/src/displayapp/screens/Music.cpp @@ -26,8 +26,8 @@ using namespace Pinetime::Applications::Screens; -static void event_handler(lv_obj_t *obj, lv_event_t event) { - Music *screen = static_cast(obj->user_data); +static void event_handler(lv_obj_t* obj, lv_event_t event) { + Music* screen = static_cast(obj->user_data); screen->OnObjectEvent(obj, event); } @@ -38,7 +38,7 @@ static void event_handler(lv_obj_t *obj, lv_event_t event) { * @param img pointer to an image object * @param data the image array */ -inline void lv_img_set_src_arr(lv_obj_t *img, const lv_img_dsc_t *src_img) { +inline void lv_img_set_src_arr(lv_obj_t* img, const lv_img_dsc_t* src_img) { lv_img_set_src(img, src_img); } @@ -47,9 +47,9 @@ inline void lv_img_set_src_arr(lv_obj_t *img, const lv_img_dsc_t *src_img) { * * TODO: Investigate Apple Media Service and AVRCPv1.6 support for seamless integration */ -Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::MusicService &music) : Screen(app), musicService(music) { - lv_obj_t *label; - +Music::Music(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::MusicService& music) : Screen(app), musicService(music) { + lv_obj_t* label; + btnVolDown = lv_btn_create(lv_scr_act(), nullptr); btnVolDown->user_data = this; lv_obj_set_event_cb(btnVolDown, event_handler); @@ -61,7 +61,7 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus label = lv_label_create(btnVolDown, nullptr); lv_label_set_text(label, Symbols::volumDown); lv_obj_set_hidden(btnVolDown, !displayVolumeButtons); - + btnVolUp = lv_btn_create(lv_scr_act(), nullptr); btnVolUp->user_data = this; lv_obj_set_event_cb(btnVolUp, event_handler); @@ -73,7 +73,7 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus label = lv_label_create(btnVolUp, nullptr); lv_label_set_text(label, Symbols::volumUp); lv_obj_set_hidden(btnVolUp, !displayVolumeButtons); - + btnPrev = lv_btn_create(lv_scr_act(), nullptr); btnPrev->user_data = this; lv_obj_set_event_cb(btnPrev, event_handler); @@ -84,7 +84,7 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus lv_obj_set_style_local_bg_opa(btnPrev, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20); label = lv_label_create(btnPrev, nullptr); lv_label_set_text(label, Symbols::stepBackward); - + btnNext = lv_btn_create(lv_scr_act(), nullptr); btnNext->user_data = this; lv_obj_set_event_cb(btnNext, event_handler); @@ -95,7 +95,7 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus lv_obj_set_style_local_bg_opa(btnNext, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20); label = lv_label_create(btnNext, nullptr); lv_label_set_text(label, Symbols::stepForward); - + btnPlayPause = lv_btn_create(lv_scr_act(), nullptr); btnPlayPause->user_data = this; lv_obj_set_event_cb(btnPlayPause, event_handler); @@ -106,7 +106,7 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus lv_obj_set_style_local_bg_opa(btnPlayPause, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20); txtPlayPause = lv_label_create(btnPlayPause, nullptr); lv_label_set_text(txtPlayPause, Symbols::play); - + txtTrackDuration = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(txtTrackDuration, LV_LABEL_LONG_SROLL); lv_obj_align(txtTrackDuration, nullptr, LV_ALIGN_IN_TOP_LEFT, 12, 20); @@ -122,30 +122,29 @@ Music::Music(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Mus lv_label_set_anim_speed(txtArtist, 1); lv_obj_align(txtArtist, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 1 * FONT_HEIGHT); lv_label_set_align(txtArtist, LV_ALIGN_IN_LEFT_MID); - lv_obj_set_width(txtArtist, LV_HOR_RES-12); + lv_obj_set_width(txtArtist, LV_HOR_RES - 12); lv_label_set_text(txtArtist, "Artist Name"); - txtTrack = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_SROLL_CIRC); lv_label_set_anim_speed(txtTrack, 1); lv_obj_align(txtTrack, nullptr, LV_ALIGN_IN_LEFT_MID, 12, MIDDLE_OFFSET + 2 * FONT_HEIGHT + LINE_PAD); lv_label_set_align(txtTrack, LV_ALIGN_IN_LEFT_MID); - lv_obj_set_width(txtTrack, LV_HOR_RES-12); + lv_obj_set_width(txtTrack, LV_HOR_RES - 12); lv_label_set_text(txtTrack, "This is a very long getTrack name"); /** Init animation */ imgDisc = lv_img_create(lv_scr_act(), nullptr); lv_img_set_src_arr(imgDisc, &disc); lv_obj_align(imgDisc, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15, 15); - + imgDiscAnim = lv_img_create(lv_scr_act(), nullptr); lv_img_set_src_arr(imgDiscAnim, &disc_f_1); lv_obj_align(imgDiscAnim, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15 - 32, 15); - + frameB = false; - + musicService.event(Controllers::MusicService::EVENT_MUSIC_OPEN); } @@ -159,22 +158,22 @@ bool Music::Refresh() { currentLength = 0; lv_label_set_text(txtArtist, artist.data()); } - + if (track != musicService.getTrack()) { track = musicService.getTrack(); currentLength = 0; lv_label_set_text(txtTrack, track.data()); } - + if (album != musicService.getAlbum()) { album = musicService.getAlbum(); currentLength = 0; } - + if (playing != musicService.isPlaying()) { playing = musicService.isPlaying(); } - + // Because we increment this ourselves, // we can't compare with the old data directly // have to update it when there's actually new data @@ -184,26 +183,26 @@ bool Music::Refresh() { lastLength = currentLength; UpdateLength(); } - + if (totalLength != musicService.getTrackLength()) { totalLength = musicService.getTrackLength(); UpdateLength(); } - + if (playing == Pinetime::Controllers::MusicService::MusicStatus::Playing) { lv_label_set_text(txtPlayPause, Symbols::pause); if (xTaskGetTickCount() - 1024 >= lastIncrement) { - + if (frameB) { lv_img_set_src(imgDiscAnim, &disc_f_1); } else { lv_img_set_src(imgDiscAnim, &disc_f_2); } frameB = !frameB; - + if (currentLength < totalLength) { - currentLength += static_cast((static_cast(xTaskGetTickCount() - lastIncrement) / 1024.0f) * - musicService.getPlaybackSpeed()); + currentLength += + static_cast((static_cast(xTaskGetTickCount() - lastIncrement) / 1024.0f) * musicService.getPlaybackSpeed()); } else { // Let's assume the getTrack finished, paused when the timer ends // and there's no new getTrack being sent to us @@ -211,13 +210,13 @@ bool Music::Refresh() { playing = false; } lastIncrement = xTaskGetTickCount(); - + UpdateLength(); } } else { lv_label_set_text(txtPlayPause, Symbols::play); } - + return running; } @@ -226,26 +225,26 @@ void Music::UpdateLength() { lv_label_set_text(txtTrackDuration, "Inf/Inf"); } else if (totalLength > (99 * 60)) { char timer[12]; - sprintf(timer, "%02d:%02d/%02d:%02d", + sprintf(timer, + "%02d:%02d/%02d:%02d", (currentLength / (60 * 60)) % 100, ((currentLength % (60 * 60)) / 60) % 100, (totalLength / (60 * 60)) % 100, - ((totalLength % (60 * 60)) / 60) % 100 - ); + ((totalLength % (60 * 60)) / 60) % 100); lv_label_set_text(txtTrackDuration, timer); } else { char timer[12]; - sprintf(timer, "%02d:%02d/%02d:%02d", + sprintf(timer, + "%02d:%02d/%02d:%02d", (currentLength / 60) % 100, (currentLength % 60) % 100, (totalLength / 60) % 100, - (totalLength % 60) % 100 - ); + (totalLength % 60) % 100); lv_label_set_text(txtTrackDuration, timer); } } -void Music::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { +void Music::OnObjectEvent(lv_obj_t* obj, lv_event_t event) { if (event == LV_EVENT_CLICKED) { if (obj == btnVolDown) { musicService.event(Controllers::MusicService::EVENT_MUSIC_VOLDOWN); @@ -256,12 +255,12 @@ void Music::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { } else if (obj == btnPlayPause) { if (playing == Pinetime::Controllers::MusicService::MusicStatus::Playing) { musicService.event(Controllers::MusicService::EVENT_MUSIC_PAUSE); - + // Let's assume it stops playing instantly playing = Controllers::MusicService::NotPlaying; } else { musicService.event(Controllers::MusicService::EVENT_MUSIC_PLAY); - + // Let's assume it starts playing instantly // TODO: In the future should check for BT connection for better UX playing = Controllers::MusicService::Playing; @@ -272,14 +271,13 @@ void Music::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { } } - bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) { switch (event) { case TouchEvents::SwipeUp: { displayVolumeButtons = true; lv_obj_set_hidden(btnVolDown, !displayVolumeButtons); lv_obj_set_hidden(btnVolUp, !displayVolumeButtons); - + lv_obj_set_hidden(btnNext, displayVolumeButtons); lv_obj_set_hidden(btnPrev, displayVolumeButtons); return true; @@ -288,7 +286,7 @@ bool Music::OnTouchEvent(Pinetime::Applications::TouchEvents event) { displayVolumeButtons = false; lv_obj_set_hidden(btnNext, displayVolumeButtons); lv_obj_set_hidden(btnPrev, displayVolumeButtons); - + lv_obj_set_hidden(btnVolDown, !displayVolumeButtons); lv_obj_set_hidden(btnVolUp, !displayVolumeButtons); return true; diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h index 55859811..ef8f1fec 100644 --- a/src/displayapp/screens/Music.h +++ b/src/displayapp/screens/Music.h @@ -31,44 +31,42 @@ namespace Pinetime { namespace Screens { class Music : public Screen { public: - Music(DisplayApp *app, Pinetime::Controllers::MusicService &music); - + Music(DisplayApp* app, Pinetime::Controllers::MusicService& music); + ~Music() override; - + bool Refresh() override; - - - - void OnObjectEvent(lv_obj_t *obj, lv_event_t event); - + + void OnObjectEvent(lv_obj_t* obj, lv_event_t event); + private: bool OnTouchEvent(TouchEvents event); - + void UpdateLength(); - - lv_obj_t *btnPrev; - lv_obj_t *btnPlayPause; - lv_obj_t *btnNext; - lv_obj_t *btnVolDown; - lv_obj_t *btnVolUp; - lv_obj_t *txtArtist; - lv_obj_t *txtTrack; - lv_obj_t *txtPlayPause; - - lv_obj_t *imgDisc; - lv_obj_t *imgDiscAnim; - lv_obj_t *txtTrackDuration; - + + lv_obj_t* btnPrev; + lv_obj_t* btnPlayPause; + lv_obj_t* btnNext; + lv_obj_t* btnVolDown; + lv_obj_t* btnVolUp; + lv_obj_t* txtArtist; + lv_obj_t* txtTrack; + lv_obj_t* txtPlayPause; + + lv_obj_t* imgDisc; + lv_obj_t* imgDiscAnim; + lv_obj_t* txtTrackDuration; + /** For the spinning disc animation */ bool frameB; - + bool displayVolumeButtons = false; - Pinetime::Controllers::MusicService &musicService; - + Pinetime::Controllers::MusicService& musicService; + std::string artist; std::string album; std::string track; - + /** Total length in seconds */ int totalLength; /** Current length in seconds */ @@ -77,11 +75,10 @@ namespace Pinetime { int lastLength; /** Last time an animation update or timer was incremented */ TickType_t lastIncrement = 0; - + bool playing; - + /** Watchapp */ - }; } } diff --git a/src/displayapp/screens/Navigation.cpp b/src/displayapp/screens/Navigation.cpp index cfe60e23..fe9b5a83 100644 --- a/src/displayapp/screens/Navigation.cpp +++ b/src/displayapp/screens/Navigation.cpp @@ -28,15 +28,15 @@ LV_FONT_DECLARE(lv_font_navi_80) * Navigation watchapp * */ -Navigation::Navigation(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::NavigationService &nav) : Screen(app), navService(nav) { +Navigation::Navigation(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::NavigationService& nav) + : Screen(app), navService(nav) { - imgFlag = lv_label_create(lv_scr_act(), nullptr); + imgFlag = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(imgFlag, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_navi_80); lv_obj_set_style_local_text_color(imgFlag, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_CYAN); lv_label_set_text(imgFlag, iconForName("flag")); lv_obj_align(imgFlag, nullptr, LV_ALIGN_CENTER, 0, -60); - txtNarrative = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(txtNarrative, LV_LABEL_LONG_BREAK); lv_obj_set_width(txtNarrative, LV_HOR_RES); @@ -50,14 +50,14 @@ Navigation::Navigation(Pinetime::Applications::DisplayApp *app, Pinetime::Contro lv_obj_set_width(txtManDist, LV_HOR_RES); lv_label_set_text(txtManDist, "--M"); lv_label_set_align(txtManDist, LV_LABEL_ALIGN_CENTER); - lv_obj_align(txtManDist, nullptr, LV_ALIGN_CENTER, 0, 60); + lv_obj_align(txtManDist, nullptr, LV_ALIGN_CENTER, 0, 60); - //Route Progress + // Route Progress barProgress = lv_bar_create(lv_scr_act(), nullptr); lv_obj_set_size(barProgress, 200, 20); lv_obj_align(barProgress, nullptr, LV_ALIGN_IN_BOTTOM_MID, 0, -10); lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_BG, LV_STATE_DEFAULT, lv_color_hex(0x222222)); - lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_ORANGE); lv_bar_set_anim_time(barProgress, 500); lv_bar_set_range(barProgress, 0, 100); lv_bar_set_value(barProgress, 0, LV_ANIM_OFF); @@ -72,7 +72,7 @@ bool Navigation::Refresh() { if (m_flag != navService.getFlag()) { m_flag = navService.getFlag(); lv_label_set_text(imgFlag, iconForName(m_flag)); - //lv_img_set_src_arr(imgFlag, iconForName(m_flag)); + // lv_img_set_src_arr(imgFlag, iconForName(m_flag)); } if (m_narrative != navService.getNarrative()) { @@ -88,10 +88,10 @@ bool Navigation::Refresh() { if (m_progress != navService.getProgress()) { m_progress = navService.getProgress(); lv_bar_set_value(barProgress, m_progress, LV_ANIM_OFF); - if ( m_progress > 90 ) { - lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_RED); + if (m_progress > 90) { + lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_RED); } else { - lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC , LV_STATE_DEFAULT, LV_COLOR_ORANGE); + lv_obj_set_style_local_bg_color(barProgress, LV_BAR_PART_INDIC, LV_STATE_DEFAULT, LV_COLOR_ORANGE); } } diff --git a/src/displayapp/screens/Navigation.h b/src/displayapp/screens/Navigation.h index 53108f98..46816c33 100644 --- a/src/displayapp/screens/Navigation.h +++ b/src/displayapp/screens/Navigation.h @@ -23,7 +23,6 @@ #include "Screen.h" #include - namespace Pinetime { namespace Controllers { class NavigationService; @@ -33,19 +32,18 @@ namespace Pinetime { namespace Screens { class Navigation : public Screen { public: - Navigation(DisplayApp *app, Pinetime::Controllers::NavigationService &nav); + Navigation(DisplayApp* app, Pinetime::Controllers::NavigationService& nav); ~Navigation() override; bool Refresh() override; - + private: + lv_obj_t* imgFlag; + lv_obj_t* txtNarrative; + lv_obj_t* txtManDist; + lv_obj_t* barProgress; - lv_obj_t *imgFlag; - lv_obj_t *txtNarrative; - lv_obj_t *txtManDist; - lv_obj_t *barProgress; - - Pinetime::Controllers::NavigationService &navService; + Pinetime::Controllers::NavigationService& navService; std::string m_flag; std::string m_narrative; @@ -53,97 +51,97 @@ namespace Pinetime { int m_progress; /** Watchapp */ - + const char* iconForName(std::string icon); - - std::array, 89 > m_iconMap = { { - {"arrive-left" ,"\xEE\xA4\x81" }, - {"arrive-right" ,"\xEE\xA4\x82" }, - {"arrive-straight" ,"\xEE\xA4\x80" }, - {"arrive" ,"\xEE\xA4\x80" }, - {"close" ,"\xEE\xA4\x83" }, - {"continue-left" ,"\xEE\xA4\x85" }, - {"continue-right" ,"\xEE\xA4\x86" }, - {"continue-slight-left" ,"\xEE\xA4\x87" }, - {"continue-slight-right" ,"\xEE\xA4\x88" }, - {"continue-straight" ,"\xEE\xA4\x84" }, - {"continue-uturn" ,"\xEE\xA4\x89" }, - {"continue" ,"\xEE\xA4\x84" }, - {"depart-left" ,"\xEE\xA4\x8B" }, - {"depart-right" ,"\xEE\xA4\x8C" }, - {"depart-straight" ,"\xEE\xA4\x8A" }, - {"end-of-road-left" ,"\xEE\xA4\x8D" }, - {"end-of-road-right" ,"\xEE\xA4\x8E" }, - {"ferry" ,"\xEE\xA4\x8F" }, - {"flag" ,"\xEE\xA4\x90" }, - {"fork-left" ,"\xEE\xA4\x92" }, - {"fork-right" ,"\xEE\xA4\x93" }, - {"fork-slight-left" ,"\xEE\xA4\x94" }, - {"fork-slight-right" ,"\xEE\xA4\x95" }, - {"fork-straight" ,"\xEE\xA4\x96" }, - {"invalid" ,"\xEE\xA4\x84" }, - {"invalid-left" ,"\xEE\xA4\x85" }, - {"invalid-right" ,"\xEE\xA4\x86" }, - {"invalid-slight-left" ,"\xEE\xA4\x87" }, - {"invalid-slight-right" ,"\xEE\xA4\x88" }, - {"invalid-straight" ,"\xEE\xA4\x84" }, - {"invalid-uturn" ,"\xEE\xA4\x89" }, - {"merge-left" ,"\xEE\xA4\x97" }, - {"merge-right" ,"\xEE\xA4\x98" }, - {"merge-slight-left" ,"\xEE\xA4\x99" }, - {"merge-slight-right" ,"\xEE\xA4\x9A" }, - {"merge-straight" ,"\xEE\xA4\x84" }, - {"new-name-left" ,"\xEE\xA4\x85" }, - {"new-name-right" ,"\xEE\xA4\x86" }, - {"new-name-sharp-left" ,"\xEE\xA4\x9B" }, - {"new-name-sharp-right" ,"\xEE\xA4\x9C" }, - {"new-name-slight-left" ,"\xEE\xA4\x87" }, - {"new-name-slight-right" ,"\xEE\xA4\x88" }, - {"new-name-straight" ,"\xEE\xA4\x84" }, - {"notification-left" ,"\xEE\xA4\x85" }, - {"notification-right" ,"\xEE\xA4\x86" }, - {"notification-sharp-left" ,"\xEE\xA4\x9B" }, - {"notification-sharp-right" ,"\xEE\xA4\xA5" }, - {"notification-slight-left" ,"\xEE\xA4\x87" }, - {"notification-slight-right" ,"\xEE\xA4\x88" }, - {"notification-straight" ,"\xEE\xA4\x84" }, - {"off-ramp-left" ,"\xEE\xA4\x9D" }, - {"off-ramp-right" ,"\xEE\xA4\x9E" }, - {"off-ramp-slight-left" ,"\xEE\xA4\x9F" }, - {"off-ramp-slight-right" ,"\xEE\xA4\xA0" }, - {"on-ramp-left" ,"\xEE\xA4\x85" }, - {"on-ramp-right" ,"\xEE\xA4\x86" }, - {"on-ramp-sharp-left" ,"\xEE\xA4\x9B" }, - {"on-ramp-sharp-right" ,"\xEE\xA4\xA5" }, - {"on-ramp-slight-left" ,"\xEE\xA4\x87" }, - {"on-ramp-slight-right" ,"\xEE\xA4\x88" }, - {"on-ramp-straight" ,"\xEE\xA4\x84" }, - {"rotary" ,"\xEE\xA4\xA1" }, - {"rotary-left" ,"\xEE\xA4\xA2" }, - {"rotary-right" ,"\xEE\xA4\xA3" }, - {"rotary-sharp-left" ,"\xEE\xA4\xA4" }, - {"rotary-sharp-right" ,"\xEE\xA4\xA5" }, - {"rotary-slight-left" ,"\xEE\xA4\xA6" }, - {"rotary-slight-right" ,"\xEE\xA4\xA7" }, - {"rotary-straight" ,"\xEE\xA4\xA8" }, - {"roundabout" ,"\xEE\xA4\xA1" }, - {"roundabout-left" ,"\xEE\xA4\xA2" }, - {"roundabout-right" ,"\xEE\xA4\xA3" }, - {"roundabout-sharp-left" ,"\xEE\xA4\xA4" }, - {"roundabout-sharp-right" ,"\xEE\xA4\xA5" }, - {"roundabout-slight-left" ,"\xEE\xA4\xA6" }, - {"roundabout-slight-right" ,"\xEE\xA4\xA7" }, - {"roundabout-straight" ,"\xEE\xA4\xA8" }, - {"turn-left" ,"\xEE\xA4\x85" }, - {"turn-right" ,"\xEE\xA4\x86" }, - {"turn-sharp-left" ,"\xEE\xA4\x9B" }, - {"turn-sharp-right" ,"\xEE\xA4\xA5" }, - {"turn-slight-left" ,"\xEE\xA4\x87" }, - {"turn-slight-right" ,"\xEE\xA4\x88" }, - {"turn-straight" ,"\xEE\xA4\x84" }, - {"updown" ,"\xEE\xA4\xA9" }, - {"uturn" ,"\xEE\xA4\x89" }, - } }; + + std::array, 89> m_iconMap = {{ + {"arrive-left", "\xEE\xA4\x81"}, + {"arrive-right", "\xEE\xA4\x82"}, + {"arrive-straight", "\xEE\xA4\x80"}, + {"arrive", "\xEE\xA4\x80"}, + {"close", "\xEE\xA4\x83"}, + {"continue-left", "\xEE\xA4\x85"}, + {"continue-right", "\xEE\xA4\x86"}, + {"continue-slight-left", "\xEE\xA4\x87"}, + {"continue-slight-right", "\xEE\xA4\x88"}, + {"continue-straight", "\xEE\xA4\x84"}, + {"continue-uturn", "\xEE\xA4\x89"}, + {"continue", "\xEE\xA4\x84"}, + {"depart-left", "\xEE\xA4\x8B"}, + {"depart-right", "\xEE\xA4\x8C"}, + {"depart-straight", "\xEE\xA4\x8A"}, + {"end-of-road-left", "\xEE\xA4\x8D"}, + {"end-of-road-right", "\xEE\xA4\x8E"}, + {"ferry", "\xEE\xA4\x8F"}, + {"flag", "\xEE\xA4\x90"}, + {"fork-left", "\xEE\xA4\x92"}, + {"fork-right", "\xEE\xA4\x93"}, + {"fork-slight-left", "\xEE\xA4\x94"}, + {"fork-slight-right", "\xEE\xA4\x95"}, + {"fork-straight", "\xEE\xA4\x96"}, + {"invalid", "\xEE\xA4\x84"}, + {"invalid-left", "\xEE\xA4\x85"}, + {"invalid-right", "\xEE\xA4\x86"}, + {"invalid-slight-left", "\xEE\xA4\x87"}, + {"invalid-slight-right", "\xEE\xA4\x88"}, + {"invalid-straight", "\xEE\xA4\x84"}, + {"invalid-uturn", "\xEE\xA4\x89"}, + {"merge-left", "\xEE\xA4\x97"}, + {"merge-right", "\xEE\xA4\x98"}, + {"merge-slight-left", "\xEE\xA4\x99"}, + {"merge-slight-right", "\xEE\xA4\x9A"}, + {"merge-straight", "\xEE\xA4\x84"}, + {"new-name-left", "\xEE\xA4\x85"}, + {"new-name-right", "\xEE\xA4\x86"}, + {"new-name-sharp-left", "\xEE\xA4\x9B"}, + {"new-name-sharp-right", "\xEE\xA4\x9C"}, + {"new-name-slight-left", "\xEE\xA4\x87"}, + {"new-name-slight-right", "\xEE\xA4\x88"}, + {"new-name-straight", "\xEE\xA4\x84"}, + {"notification-left", "\xEE\xA4\x85"}, + {"notification-right", "\xEE\xA4\x86"}, + {"notification-sharp-left", "\xEE\xA4\x9B"}, + {"notification-sharp-right", "\xEE\xA4\xA5"}, + {"notification-slight-left", "\xEE\xA4\x87"}, + {"notification-slight-right", "\xEE\xA4\x88"}, + {"notification-straight", "\xEE\xA4\x84"}, + {"off-ramp-left", "\xEE\xA4\x9D"}, + {"off-ramp-right", "\xEE\xA4\x9E"}, + {"off-ramp-slight-left", "\xEE\xA4\x9F"}, + {"off-ramp-slight-right", "\xEE\xA4\xA0"}, + {"on-ramp-left", "\xEE\xA4\x85"}, + {"on-ramp-right", "\xEE\xA4\x86"}, + {"on-ramp-sharp-left", "\xEE\xA4\x9B"}, + {"on-ramp-sharp-right", "\xEE\xA4\xA5"}, + {"on-ramp-slight-left", "\xEE\xA4\x87"}, + {"on-ramp-slight-right", "\xEE\xA4\x88"}, + {"on-ramp-straight", "\xEE\xA4\x84"}, + {"rotary", "\xEE\xA4\xA1"}, + {"rotary-left", "\xEE\xA4\xA2"}, + {"rotary-right", "\xEE\xA4\xA3"}, + {"rotary-sharp-left", "\xEE\xA4\xA4"}, + {"rotary-sharp-right", "\xEE\xA4\xA5"}, + {"rotary-slight-left", "\xEE\xA4\xA6"}, + {"rotary-slight-right", "\xEE\xA4\xA7"}, + {"rotary-straight", "\xEE\xA4\xA8"}, + {"roundabout", "\xEE\xA4\xA1"}, + {"roundabout-left", "\xEE\xA4\xA2"}, + {"roundabout-right", "\xEE\xA4\xA3"}, + {"roundabout-sharp-left", "\xEE\xA4\xA4"}, + {"roundabout-sharp-right", "\xEE\xA4\xA5"}, + {"roundabout-slight-left", "\xEE\xA4\xA6"}, + {"roundabout-slight-right", "\xEE\xA4\xA7"}, + {"roundabout-straight", "\xEE\xA4\xA8"}, + {"turn-left", "\xEE\xA4\x85"}, + {"turn-right", "\xEE\xA4\x86"}, + {"turn-sharp-left", "\xEE\xA4\x9B"}, + {"turn-sharp-right", "\xEE\xA4\xA5"}, + {"turn-slight-left", "\xEE\xA4\x87"}, + {"turn-slight-right", "\xEE\xA4\x88"}, + {"turn-straight", "\xEE\xA4\x84"}, + {"updown", "\xEE\xA4\xA9"}, + {"uturn", "\xEE\xA4\x89"}, + }}; }; } } diff --git a/src/displayapp/screens/NotificationIcon.cpp b/src/displayapp/screens/NotificationIcon.cpp index 64898c2c..d8792f9d 100644 --- a/src/displayapp/screens/NotificationIcon.cpp +++ b/src/displayapp/screens/NotificationIcon.cpp @@ -3,6 +3,8 @@ using namespace Pinetime::Applications::Screens; const char* NotificationIcon::GetIcon(bool newNotificationAvailable) { - if(newNotificationAvailable) return Symbols::info; - else return ""; + if (newNotificationAvailable) + return Symbols::info; + else + return ""; } \ No newline at end of file diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 33cebe86..f0fd2f66 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -8,34 +8,34 @@ using namespace Pinetime::Applications::Screens; extern lv_font_t jetbrains_mono_extrabold_compressed; extern lv_font_t jetbrains_mono_bold_20; -Notifications::Notifications(DisplayApp *app, - Pinetime::Controllers::NotificationManager ¬ificationManager, +Notifications::Notifications(DisplayApp* app, + Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::AlertNotificationService& alertNotificationService, - Modes mode) : - Screen(app), notificationManager{notificationManager}, alertNotificationService{alertNotificationService}, mode{mode} { + Modes mode) + : Screen(app), notificationManager {notificationManager}, alertNotificationService {alertNotificationService}, mode {mode} { notificationManager.ClearNewNotificationFlag(); auto notification = notificationManager.GetLastNotification(); - if(notification.valid) { + if (notification.valid) { currentId = notification.id; currentItem = std::make_unique(notification.Title(), - notification.Message(), - notification.index, - notification.category, - notificationManager.NbNotifications(), - mode, - alertNotificationService); + notification.Message(), + notification.index, + notification.category, + notificationManager.NbNotifications(), + mode, + alertNotificationService); validDisplay = true; } else { currentItem = std::make_unique("Notification", - "No notification to display", - 0, - notification.category, - notificationManager.NbNotifications(), - Modes::Preview, - alertNotificationService); + "No notification to display", + 0, + notification.category, + notificationManager.NbNotifications(), + Modes::Preview, + alertNotificationService); } - if(mode == Modes::Preview) { + if (mode == Modes::Preview) { timeoutLine = lv_line_create(lv_scr_act(), nullptr); @@ -45,7 +45,7 @@ Notifications::Notifications(DisplayApp *app, lv_line_set_points(timeoutLine, timeoutLinePoints, 2); timeoutTickCountStart = xTaskGetTickCount(); - timeoutTickCountEnd = timeoutTickCountStart + (5*1024); + timeoutTickCountEnd = timeoutTickCountStart + (5 * 1024); } } @@ -68,34 +68,36 @@ bool Notifications::Refresh() { } bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - if(mode != Modes::Normal) return true; + if (mode != Modes::Normal) + return true; switch (event) { case Pinetime::Applications::TouchEvents::SwipeDown: { Controllers::NotificationManager::Notification previousNotification; - if(validDisplay) + if (validDisplay) previousNotification = notificationManager.GetPrevious(currentId); else previousNotification = notificationManager.GetLastNotification(); - if (!previousNotification.valid) return true; + if (!previousNotification.valid) + return true; validDisplay = true; currentId = previousNotification.id; currentItem.reset(nullptr); app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); currentItem = std::make_unique(previousNotification.Title(), - previousNotification.Message(), - previousNotification.index, - previousNotification.category, - notificationManager.NbNotifications(), - mode, - alertNotificationService); + previousNotification.Message(), + previousNotification.index, + previousNotification.category, + notificationManager.NbNotifications(), + mode, + alertNotificationService); } return true; case Pinetime::Applications::TouchEvents::SwipeUp: { Controllers::NotificationManager::Notification nextNotification; - if(validDisplay) + if (validDisplay) nextNotification = notificationManager.GetNext(currentId); else nextNotification = notificationManager.GetLastNotification(); @@ -110,16 +112,16 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) { currentItem.reset(nullptr); app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up); currentItem = std::make_unique(nextNotification.Title(), - nextNotification.Message(), - nextNotification.index, - nextNotification.category, - notificationManager.NbNotifications(), - mode, - alertNotificationService); + nextNotification.Message(), + nextNotification.index, + nextNotification.category, + notificationManager.NbNotifications(), + mode, + alertNotificationService); } return true; case Pinetime::Applications::TouchEvents::LongTap: { - //notificationManager.ToggleVibrations(); + // notificationManager.ToggleVibrations(); return true; } default: @@ -138,20 +140,20 @@ namespace { item->OnMuteIncomingCall(event); } - static void RejectIncomingCallEventHandler(lv_obj_t *obj, lv_event_t event) { - auto* item = static_cast(obj->user_data); + static void RejectIncomingCallEventHandler(lv_obj_t* obj, lv_event_t event) { + auto* item = static_cast(obj->user_data); item->OnRejectIncomingCall(event); } } - Notifications::NotificationItem::NotificationItem(const char *title, - const char *msg, - uint8_t notifNr, - Controllers::NotificationManager::Categories category, - uint8_t notifNb, - Modes mode, - Pinetime::Controllers::AlertNotificationService& alertNotificationService) - : notifNr{notifNr}, notifNb{notifNb}, mode{mode}, alertNotificationService{alertNotificationService} { +Notifications::NotificationItem::NotificationItem(const char* title, + const char* msg, + uint8_t notifNr, + Controllers::NotificationManager::Categories category, + uint8_t notifNb, + Modes mode, + Pinetime::Controllers::AlertNotificationService& alertNotificationService) + : notifNr {notifNr}, notifNb {notifNb}, mode {mode}, alertNotificationService {alertNotificationService} { lv_obj_t* container1 = lv_cont_create(lv_scr_act(), NULL); @@ -172,20 +174,20 @@ namespace { lv_obj_t* alert_type = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(alert_type, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x888888)); - if(title == nullptr) title = "Notification"; + if (title == nullptr) + title = "Notification"; lv_label_set_text(alert_type, title); lv_obj_align(alert_type, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 16); ///////// - switch(category) { + switch (category) { default: { lv_obj_t* alert_subject = lv_label_create(container1, nullptr); lv_obj_set_style_local_text_color(alert_subject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); lv_label_set_long_mode(alert_subject, LV_LABEL_LONG_BREAK); lv_obj_set_width(alert_subject, LV_HOR_RES - 20); lv_label_set_text(alert_subject, msg); - } - break; + } break; case Controllers::NotificationManager::Categories::IncomingCall: { lv_obj_t* alert_subject = lv_label_create(container1, nullptr); lv_obj_set_style_local_text_color(alert_subject, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); @@ -234,8 +236,7 @@ namespace { label_mute = lv_label_create(bt_mute, nullptr); lv_label_set_text(label_mute, Symbols::volumMute); lv_obj_set_style_local_bg_color(bt_mute, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); - } - break; + } break; } lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); @@ -246,19 +247,22 @@ namespace { } void Notifications::NotificationItem::OnAcceptIncomingCall(lv_event_t event) { - if (event != LV_EVENT_CLICKED) return; + if (event != LV_EVENT_CLICKED) + return; alertNotificationService.AcceptIncomingCall(); } void Notifications::NotificationItem::OnMuteIncomingCall(lv_event_t event) { - if (event != LV_EVENT_CLICKED) return; + if (event != LV_EVENT_CLICKED) + return; alertNotificationService.MuteIncomingCall(); } void Notifications::NotificationItem::OnRejectIncomingCall(lv_event_t event) { - if (event != LV_EVENT_CLICKED) return; + if (event != LV_EVENT_CLICKED) + return; alertNotificationService.RejectIncomingCall(); } diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h index 0d54ddbe..51ca81da 100644 --- a/src/displayapp/screens/Notifications.h +++ b/src/displayapp/screens/Notifications.h @@ -14,19 +14,30 @@ namespace Pinetime { namespace Screens { class Notifications : public Screen { - public: - enum class Modes {Normal, Preview}; - explicit Notifications(DisplayApp* app, Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::AlertNotificationService& alertNotificationService, Modes mode); - ~Notifications() override; + public: + enum class Modes { Normal, Preview }; + explicit Notifications(DisplayApp* app, + Pinetime::Controllers::NotificationManager& notificationManager, + Pinetime::Controllers::AlertNotificationService& alertNotificationService, + Modes mode); + ~Notifications() override; - bool Refresh() override; - bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; + bool Refresh() override; + bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; class NotificationItem { public: - NotificationItem(const char* title, const char* msg, uint8_t notifNr, Controllers::NotificationManager::Categories, uint8_t notifNb, Modes mode, Pinetime::Controllers::AlertNotificationService& alertNotificationService); + NotificationItem(const char* title, + const char* msg, + uint8_t notifNr, + Controllers::NotificationManager::Categories, + uint8_t notifNb, + Modes mode, + Pinetime::Controllers::AlertNotificationService& alertNotificationService); ~NotificationItem(); - bool Refresh() {return false;} + bool Refresh() { + return false; + } void OnAcceptIncomingCall(lv_event_t event); void OnMuteIncomingCall(lv_event_t event); void OnRejectIncomingCall(lv_event_t event); @@ -49,28 +60,24 @@ namespace Pinetime { lv_obj_t* bottomPlaceholder; Modes mode; Pinetime::Controllers::AlertNotificationService& alertNotificationService; - - }; - private: - + private: + struct NotificationData { + const char* title; + const char* text; + }; + Pinetime::Controllers::NotificationManager& notificationManager; + Pinetime::Controllers::AlertNotificationService& alertNotificationService; + Modes mode = Modes::Normal; + std::unique_ptr currentItem; + Controllers::NotificationManager::Notification::Id currentId; + bool validDisplay = false; - struct NotificationData { - const char* title; - const char* text; - }; - Pinetime::Controllers::NotificationManager& notificationManager; - Pinetime::Controllers::AlertNotificationService& alertNotificationService; - Modes mode = Modes::Normal; - std::unique_ptr currentItem; - Controllers::NotificationManager::Notification::Id currentId; - bool validDisplay = false; - - lv_point_t timeoutLinePoints[2] { {0, 1}, {239, 1} }; - lv_obj_t* timeoutLine; - uint32_t timeoutTickCountStart; - uint32_t timeoutTickCountEnd; + lv_point_t timeoutLinePoints[2] {{0, 1}, {239, 1}}; + lv_obj_t* timeoutLine; + uint32_t timeoutTickCountStart; + uint32_t timeoutTickCountEnd; }; } } diff --git a/src/displayapp/screens/Paddle.cpp b/src/displayapp/screens/Paddle.cpp index e86cf01b..161f175b 100644 --- a/src/displayapp/screens/Paddle.cpp +++ b/src/displayapp/screens/Paddle.cpp @@ -4,124 +4,96 @@ using namespace Pinetime::Applications::Screens; -namespace{ -const uint8_t paddle_map[] = { - 0xfc, 0xfe, 0xfc, 0xff, /*Color of index 0*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 1*/ +namespace { + const uint8_t paddle_map[] = { + 0xfc, 0xfe, 0xfc, 0xff, /*Color of index 0*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 1*/ - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, - 0x00, -}; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; -const uint8_t ball_map[] = { - 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, - 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, - 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, - 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, - 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, - 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, - 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, - 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, - 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, - 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, - 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, - 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, - 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, - 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, - 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, - 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, -}; + const uint8_t ball_map[] = { + 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, + 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, + 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, + 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, + 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, + 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, + 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, + 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, + 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, 0x6f, 0xed, + }; } -Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl{lvgl} { +Paddle::Paddle(Pinetime::Applications::DisplayApp* app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl {lvgl} { app->SetTouchMode(DisplayApp::TouchModes::Polling); - + points = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(points, "0000"); lv_obj_set_style_local_text_color(points, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x444444)); lv_obj_align(points, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 0, 0); - + paddle.header.always_zero = 0; paddle.header.w = 4; paddle.header.h = 60; paddle.data_size = 68; paddle.header.cf = LV_IMG_CF_INDEXED_1BIT; - paddle.data = paddle_map; + paddle.data = paddle_map; paddle_image = lv_img_create(lv_scr_act(), nullptr); lv_img_set_src(paddle_image, &paddle); - + ball.header.always_zero = 0; ball.header.w = 24; ball.header.h = 24; ball.data_size = 24 * 24 * LV_COLOR_SIZE / 8; ball.header.cf = LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED; - ball.data = ball_map; + ball.data = ball_map; ball_image = lv_img_create(lv_scr_act(), nullptr); lv_img_set_src(ball_image, &ball); } @@ -133,51 +105,54 @@ Paddle::~Paddle() { } bool Paddle::Refresh() { - if((counter++ % 5) == 0){ - counter = 0; - + if ((counter++ % 5) == 0) { + counter = 0; + ballX += dx; - ballY += dy; - + ballY += dy; + lv_obj_set_pos(ball_image, ballX, ballY); - - //checks if it has touched the sides (floor and ceiling) - if(ballY <= 0 || ballY >= 215){ + + // checks if it has touched the sides (floor and ceiling) + if (ballY <= 0 || ballY >= 215) { dy *= -1; } - - //checks if it has touched the side (left side) - if(ballX >= 215){ - dx *= -1; + + // checks if it has touched the side (left side) + if (ballX >= 215) { + dx *= -1; } - - //checks if it is in the position of the paddle - if(ballY <= (paddleBottomY + 16) && ballY >= (paddleTopY - 8)){ - if(ballX >= 0 && ballX < 4){ - lv_obj_set_pos(ball_image, 5, ballY); - dx *= -1; - score++; - } - } - - //checks if it has gone behind the paddle - else if(ballX <= -40){ + + // checks if it is in the position of the paddle + if (ballY <= (paddleBottomY + 16) && ballY >= (paddleTopY - 8)) { + if (ballX >= 0 && ballX < 4) { + lv_obj_set_pos(ball_image, 5, ballY); + dx *= -1; + score++; + } + } + + // checks if it has gone behind the paddle + else if (ballX <= -40) { ballX = 107; - ballY = 107; - score = 0; + ballY = 107; + score = 0; } lv_label_set_text_fmt(points, "%04d", score); - } + } return running; } -bool Paddle::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - return true; +bool Paddle::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + return true; } bool Paddle::OnTouchEvent(uint16_t x, uint16_t y) { - lv_obj_set_pos(paddle_image, 0, y - 30); // sets the center paddle pos. (30px offset) with the the y_coordinate of the finger and defaults the x_coordinate to 0 - paddleTopY = y - 30; // refreshes the upper extreme of the paddle - paddleBottomY = y + 30; // refreshes the lower extreme of the paddle + lv_obj_set_pos( + paddle_image, + 0, + y - 30); // sets the center paddle pos. (30px offset) with the the y_coordinate of the finger and defaults the x_coordinate to 0 + paddleTopY = y - 30; // refreshes the upper extreme of the paddle + paddleBottomY = y + 30; // refreshes the lower extreme of the paddle return true; } diff --git a/src/displayapp/screens/Paddle.h b/src/displayapp/screens/Paddle.h index 453d99ae..e133244f 100644 --- a/src/displayapp/screens/Paddle.h +++ b/src/displayapp/screens/Paddle.h @@ -11,39 +11,37 @@ namespace Pinetime { namespace Applications { namespace Screens { - class Paddle : public Screen{ - public: - Paddle(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl); - ~Paddle() override; + class Paddle : public Screen { + public: + Paddle(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl); + ~Paddle() override; - bool Refresh() override; - - bool OnTouchEvent(TouchEvents event) override; - bool OnTouchEvent(uint16_t x, uint16_t y) override; - - private: - Pinetime::Components::LittleVgl& lvgl; - - int paddleBottomY = 90; // bottom extreme of the paddle - int paddleTopY = 150; //top extreme of the paddle + bool Refresh() override; - int ballX = 107; // Initial x_coordinate for the ball (12px offset from the center to counteract the ball's 24px size) - int ballY = 107; // Initial y_coordinate for the ball + bool OnTouchEvent(TouchEvents event) override; + bool OnTouchEvent(uint16_t x, uint16_t y) override; - int dx = 2; // Velocity of the ball in the x_coordinate - int dy = 3; // Velocity of the ball in the y_coordinate + private: + Pinetime::Components::LittleVgl& lvgl; - int counter = 0; // init Frame refresh limit counter - int score = 0; + int paddleBottomY = 90; // bottom extreme of the paddle + int paddleTopY = 150; // top extreme of the paddle - lv_img_dsc_t paddle; - lv_img_dsc_t ball; + int ballX = 107; // Initial x_coordinate for the ball (12px offset from the center to counteract the ball's 24px size) + int ballY = 107; // Initial y_coordinate for the ball - lv_obj_t* points; - lv_obj_t* paddle_image; // pointer to paddle image - lv_obj_t* ball_image; // pointer to ball image + int dx = 2; // Velocity of the ball in the x_coordinate + int dy = 3; // Velocity of the ball in the y_coordinate - + int counter = 0; // init Frame refresh limit counter + int score = 0; + + lv_img_dsc_t paddle; + lv_img_dsc_t ball; + + lv_obj_t* points; + lv_obj_t* paddle_image; // pointer to paddle image + lv_obj_t* ball_image; // pointer to ball image }; } } diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h index cf4f6994..8e49c9de 100644 --- a/src/displayapp/screens/Screen.h +++ b/src/displayapp/screens/Screen.h @@ -8,56 +8,68 @@ namespace Pinetime { class DisplayApp; namespace Screens { - template - class DirtyValue { - public: - DirtyValue() = default; // Use NSDMI - explicit DirtyValue(T const& v):value{v}{} // Use MIL and const-lvalue-ref - bool IsUpdated() const { return isUpdated; } - T const& Get() { this->isUpdated = false; return value; } // never expose a non-const lvalue-ref - DirtyValue& operator=(const T& other) { - if (this->value != other) { - this->value = other; - this->isUpdated = true; - } - return *this; + template class DirtyValue { + public: + DirtyValue() = default; // Use NSDMI + explicit DirtyValue(T const& v) : value {v} { + } // Use MIL and const-lvalue-ref + bool IsUpdated() const { + return isUpdated; + } + T const& Get() { + this->isUpdated = false; + return value; + } // never expose a non-const lvalue-ref + DirtyValue& operator=(const T& other) { + if (this->value != other) { + this->value = other; + this->isUpdated = true; } - private: - T value{}; // NSDMI - default initialise type - bool isUpdated{true}; // NSDMI - use brace initilisation + return *this; + } + + private: + T value {}; // NSDMI - default initialise type + bool isUpdated {true}; // NSDMI - use brace initilisation }; - + class Screen { - public: - explicit Screen(DisplayApp* app) : app{app} {} - virtual ~Screen() = default; + public: + explicit Screen(DisplayApp* app) : app {app} { + } + virtual ~Screen() = default; - /** - * Most of the time, apps only react to events (touch events, for example). - * In this case you don't need to do anything in this method. - * - * For example, InfiniPaint does nothing in Refresh(). - * But, if you want to update your display periodically, draw an animation... - * you cannot do it in a touch event handler because these handlers are not - * called if the user does not touch the screen. - * - * That's why Refresh() is there: update the display periodically. - * - * @return false if the app can be closed, true if it must continue to run - **/ - virtual bool Refresh() = 0; + /** + * Most of the time, apps only react to events (touch events, for example). + * In this case you don't need to do anything in this method. + * + * For example, InfiniPaint does nothing in Refresh(). + * But, if you want to update your display periodically, draw an animation... + * you cannot do it in a touch event handler because these handlers are not + * called if the user does not touch the screen. + * + * That's why Refresh() is there: update the display periodically. + * + * @return false if the app can be closed, true if it must continue to run + **/ + virtual bool Refresh() = 0; - /** @return false if the button hasn't been handled by the app, true if it has been handled */ - virtual bool OnButtonPushed() { return false; } + /** @return false if the button hasn't been handled by the app, true if it has been handled */ + virtual bool OnButtonPushed() { + return false; + } - /** @return false if the event hasn't been handled by the app, true if it has been handled */ - virtual bool OnTouchEvent(TouchEvents event) { return false; } - virtual bool OnTouchEvent(uint16_t x, uint16_t y) { return false; } - - protected: - DisplayApp* app; - bool running = true; + /** @return false if the event hasn't been handled by the app, true if it has been handled */ + virtual bool OnTouchEvent(TouchEvents event) { + return false; + } + virtual bool OnTouchEvent(uint16_t x, uint16_t y) { + return false; + } + protected: + DisplayApp* app; + bool running = true; }; } } diff --git a/src/displayapp/screens/ScreenList.h b/src/displayapp/screens/ScreenList.h index 23bcd98b..73ea4610 100644 --- a/src/displayapp/screens/ScreenList.h +++ b/src/displayapp/screens/ScreenList.h @@ -10,100 +10,98 @@ namespace Pinetime { namespace Applications { namespace Screens { - enum class ScreenListModes {UpDown, RightLeft, LongPress}; - template - class ScreenList : public Screen { - public: + enum class ScreenListModes { UpDown, RightLeft, LongPress }; + template class ScreenList : public Screen { + public: + ScreenList(DisplayApp* app, + uint8_t initScreen, + std::array()>, N>&& screens, + ScreenListModes mode) + : Screen(app), initScreen {initScreen}, screens {std::move(screens)}, mode {mode}, current {this->screens[initScreen]()} { + screenIndex = initScreen; + } - ScreenList(DisplayApp* app, uint8_t initScreen, std::array()>, N>&& screens, ScreenListModes mode) - : Screen(app), initScreen{initScreen}, screens{std::move(screens)}, mode{mode}, current{this->screens[initScreen]()} { - screenIndex = initScreen; - } + ~ScreenList() override { + lv_obj_clean(lv_scr_act()); + } - ~ScreenList() override { - lv_obj_clean(lv_scr_act()); - } + bool Refresh() override { + running = current->Refresh(); + return running; + } - bool Refresh() override { - running = current->Refresh(); - return running; - } + bool OnTouchEvent(TouchEvents event) override { - bool OnTouchEvent(TouchEvents event) override { - - if ( mode == ScreenListModes::UpDown) { - switch (event) { - case TouchEvents::SwipeDown: - if (screenIndex > 0) { - current.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); - screenIndex--; - current = screens[screenIndex](); - return true; - } else { - return false; - } - - case TouchEvents::SwipeUp: - if (screenIndex < screens.size() - 1) { - current.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up); - screenIndex++; - current = screens[screenIndex](); - } + if (mode == ScreenListModes::UpDown) { + switch (event) { + case TouchEvents::SwipeDown: + if (screenIndex > 0) { + current.reset(nullptr); + app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); + screenIndex--; + current = screens[screenIndex](); return true; - default: + } else { return false; - } - } else if ( mode == ScreenListModes::RightLeft) { - switch (event) { - case TouchEvents::SwipeRight: - if (screenIndex > 0) { - current.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::None); - screenIndex--; - current = screens[screenIndex](); - return true; - } else { - return false; - } - - case TouchEvents::SwipeLeft: - if (screenIndex < screens.size() - 1) { - current.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::None); - screenIndex++; - current = screens[screenIndex](); - } - return true; - default: - return false; - } - } else if ( event == TouchEvents::LongTap ) { - if (screenIndex < screens.size() - 1) { - screenIndex++; - } else { - screenIndex = 0; - } - current.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::None); - current = screens[screenIndex](); - return true; + } + + case TouchEvents::SwipeUp: + if (screenIndex < screens.size() - 1) { + current.reset(nullptr); + app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up); + screenIndex++; + current = screens[screenIndex](); + } + return true; + default: + return false; } + } else if (mode == ScreenListModes::RightLeft) { + switch (event) { + case TouchEvents::SwipeRight: + if (screenIndex > 0) { + current.reset(nullptr); + app->SetFullRefresh(DisplayApp::FullRefreshDirections::None); + screenIndex--; + current = screens[screenIndex](); + return true; + } else { + return false; + } - return false; + case TouchEvents::SwipeLeft: + if (screenIndex < screens.size() - 1) { + current.reset(nullptr); + app->SetFullRefresh(DisplayApp::FullRefreshDirections::None); + screenIndex++; + current = screens[screenIndex](); + } + return true; + default: + return false; + } + } else if (event == TouchEvents::LongTap) { + if (screenIndex < screens.size() - 1) { + screenIndex++; + } else { + screenIndex = 0; + } + current.reset(nullptr); + app->SetFullRefresh(DisplayApp::FullRefreshDirections::None); + current = screens[screenIndex](); + return true; } - private: - - uint8_t initScreen = 0; - std::array()>, N> screens; - ScreenListModes mode = ScreenListModes::UpDown; + return false; + } - uint8_t screenIndex = 0; - std::unique_ptr current; + private: + uint8_t initScreen = 0; + std::array()>, N> screens; + ScreenListModes mode = ScreenListModes::UpDown; - + uint8_t screenIndex = 0; + std::unique_ptr current; }; } } diff --git a/src/displayapp/screens/StopWatch.cpp b/src/displayapp/screens/StopWatch.cpp index 371b4e6c..e06981af 100644 --- a/src/displayapp/screens/StopWatch.cpp +++ b/src/displayapp/screens/StopWatch.cpp @@ -46,8 +46,16 @@ static void stop_lap_event_handler(lv_obj_t* obj, lv_event_t event) { } StopWatch::StopWatch(DisplayApp* app) - : Screen(app), running {true}, currentState {States::Init}, currentEvent {Events::Stop}, startTime {}, oldTimeElapsed {}, - currentTimeSeparated {}, lapBuffer {}, lapNr {}, lapPressed {false} { + : Screen(app), + running {true}, + currentState {States::Init}, + currentEvent {Events::Stop}, + startTime {}, + oldTimeElapsed {}, + currentTimeSeparated {}, + lapBuffer {}, + lapNr {}, + lapPressed {false} { time = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_font(time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_76); @@ -56,7 +64,7 @@ StopWatch::StopWatch(DisplayApp* app) lv_obj_align(time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, -45); msecTime = lv_label_create(lv_scr_act(), nullptr); - //lv_obj_set_style_local_text_font(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); + // lv_obj_set_style_local_text_font(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); lv_obj_set_style_local_text_color(msecTime, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_GRAY); lv_label_set_text(msecTime, "00"); lv_obj_align(msecTime, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 108, 3); @@ -70,13 +78,13 @@ StopWatch::StopWatch(DisplayApp* app) lv_label_set_text(txtPlayPause, Symbols::play); lapOneText = lv_label_create(lv_scr_act(), nullptr); - //lv_obj_set_style_local_text_font(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); + // lv_obj_set_style_local_text_font(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); lv_obj_set_style_local_text_color(lapOneText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); lv_obj_align(lapOneText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 30); lv_label_set_text(lapOneText, ""); lapTwoText = lv_label_create(lv_scr_act(), nullptr); - //lv_obj_set_style_local_text_font(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); + // lv_obj_set_style_local_text_font(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_bold_20); lv_obj_set_style_local_text_color(lapTwoText, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_YELLOW); lv_obj_align(lapTwoText, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 50, 55); lv_label_set_text(lapTwoText, ""); @@ -145,10 +153,12 @@ bool StopWatch::Refresh() { if (lapPressed == true) { if (lapBuffer[1]) { - lv_label_set_text_fmt(lapOneText, "#2%d %2d:%02d.%02d", (lapNr - 1), lapBuffer[1]->mins, lapBuffer[1]->secs, lapBuffer[1]->hundredths); + lv_label_set_text_fmt( + lapOneText, "#%2d %2d:%02d.%02d", (lapNr - 1), lapBuffer[1]->mins, lapBuffer[1]->secs, lapBuffer[1]->hundredths); } if (lapBuffer[0]) { - lv_label_set_text_fmt(lapTwoText, "#2%d %2d:%02d.%02d", lapNr, lapBuffer[0]->mins, lapBuffer[0]->secs, lapBuffer[0]->hundredths); + lv_label_set_text_fmt( + lapTwoText, "#%2d %2d:%02d.%02d", lapNr, lapBuffer[0]->mins, lapBuffer[0]->secs, lapBuffer[0]->hundredths); } // Reset the bool to avoid setting the text in each cycle until there is a change lapPressed = false; diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h index 0750f2c1..e60825c1 100644 --- a/src/displayapp/screens/Symbols.h +++ b/src/displayapp/screens/Symbols.h @@ -26,7 +26,7 @@ namespace Pinetime { static constexpr const char* paintbrush = "\xEF\x87\xBC"; static constexpr const char* paddle = "\xEF\x91\x9D"; static constexpr const char* map = "\xEF\x96\xa0"; - static constexpr const char* qrcode = "\xEF\x80\xa9"; + static constexpr const char* qrcode = "\xEF\x80\xa9"; static constexpr const char* phone = "\xEF\x82\x95"; static constexpr const char* phoneSlash = "\xEF\x8F\x9D"; static constexpr const char* volumMute = "\xEF\x9A\xA9"; @@ -41,19 +41,18 @@ namespace Pinetime { static constexpr const char* lapsFlag = "\xEF\x80\xA4"; // lv_font_sys_48.c - static constexpr const char* settings = "\xEE\xA4\x82";//e902 + static constexpr const char* settings = "\xEE\xA4\x82"; // e902 - static constexpr const char* brightnessHigh = "\xEE\xA4\x84";//e904 - static constexpr const char* brightnessLow = "\xEE\xA4\x85";//e905 - static constexpr const char* brightnessMedium = "\xEE\xA4\x86";//e906 + static constexpr const char* brightnessHigh = "\xEE\xA4\x84"; // e904 + static constexpr const char* brightnessLow = "\xEE\xA4\x85"; // e905 + static constexpr const char* brightnessMedium = "\xEE\xA4\x86"; // e906 - static constexpr const char* notificationsOff = "\xEE\xA4\x8B";//e90b - static constexpr const char* notificationsOn = "\xEE\xA4\x8C";//e90c + static constexpr const char* notificationsOff = "\xEE\xA4\x8B"; // e90b + static constexpr const char* notificationsOn = "\xEE\xA4\x8C"; // e90c - static constexpr const char* highlight = "\xEE\xA4\x87";//e907 + static constexpr const char* highlight = "\xEE\xA4\x87"; // e907 } } } } - diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index 48dba547..f6e8d61a 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -11,27 +11,37 @@ using namespace Pinetime::Applications::Screens; -SystemInfo::SystemInfo(Pinetime::Applications::DisplayApp *app, - Pinetime::Controllers::DateTime &dateTimeController, +SystemInfo::SystemInfo(Pinetime::Applications::DisplayApp* app, + Pinetime::Controllers::DateTime& dateTimeController, Pinetime::Controllers::Battery& batteryController, Pinetime::Controllers::BrightnessController& brightnessController, Pinetime::Controllers::Ble& bleController, - Pinetime::Drivers::WatchdogView& watchdog) : - Screen(app), - dateTimeController{dateTimeController}, batteryController{batteryController}, - brightnessController{brightnessController}, bleController{bleController}, watchdog{watchdog}, - screens{app, - 0, - { - [this]() -> std::unique_ptr { return CreateScreen1(); }, - [this]() -> std::unique_ptr { return CreateScreen2(); }, - [this]() -> std::unique_ptr { return CreateScreen3(); }, - [this]() -> std::unique_ptr { return CreateScreen4(); }, - [this]() -> std::unique_ptr { return CreateScreen5(); } - }, - Screens::ScreenListModes::UpDown - } {} - + Pinetime::Drivers::WatchdogView& watchdog) + : Screen(app), + dateTimeController {dateTimeController}, + batteryController {batteryController}, + brightnessController {brightnessController}, + bleController {bleController}, + watchdog {watchdog}, + screens {app, + 0, + {[this]() -> std::unique_ptr { + return CreateScreen1(); + }, + [this]() -> std::unique_ptr { + return CreateScreen2(); + }, + [this]() -> std::unique_ptr { + return CreateScreen3(); + }, + [this]() -> std::unique_ptr { + return CreateScreen4(); + }, + [this]() -> std::unique_ptr { + return CreateScreen5(); + }}, + Screens::ScreenListModes::UpDown} { +} SystemInfo::~SystemInfo() { lv_obj_clean(lv_scr_act()); @@ -54,16 +64,19 @@ bool SystemInfo::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } std::unique_ptr SystemInfo::CreateScreen1() { - lv_obj_t * label = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(label, true); - lv_label_set_text_fmt(label, - "#FFFF00 InfiniTime#\n\n" - "#444444 Version# %ld.%ld.%ld\n\n" - "#444444 Build date#\n" - "\t%s\n" - "\t%s\n", - Version::Major(), Version::Minor(), Version::Patch(), - __DATE__, __TIME__); + lv_label_set_text_fmt(label, + "#FFFF00 InfiniTime#\n\n" + "#444444 Version# %ld.%ld.%ld\n\n" + "#444444 Build date#\n" + "\t%s\n" + "\t%s\n", + Version::Major(), + Version::Minor(), + Version::Patch(), + __DATE__, + __TIME__); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); return std::unique_ptr(new Screens::Label(0, 5, app, label)); @@ -75,22 +88,32 @@ std::unique_ptr SystemInfo::CreateScreen2() { auto resetReason = [this]() { switch (watchdog.ResetReason()) { - case Drivers::Watchdog::ResetReasons::Watchdog: return "wtdg"; - case Drivers::Watchdog::ResetReasons::HardReset: return "hardr"; - case Drivers::Watchdog::ResetReasons::NFC: return "nfc"; - case Drivers::Watchdog::ResetReasons::SoftReset: return "softr"; - case Drivers::Watchdog::ResetReasons::CpuLockup: return "cpulock"; - case Drivers::Watchdog::ResetReasons::SystemOff: return "off"; - case Drivers::Watchdog::ResetReasons::LpComp: return "lpcomp"; - case Drivers::Watchdog::ResetReasons::DebugInterface: return "dbg"; - case Drivers::Watchdog::ResetReasons::ResetPin: return "rst"; - default: return "?"; + case Drivers::Watchdog::ResetReasons::Watchdog: + return "wtdg"; + case Drivers::Watchdog::ResetReasons::HardReset: + return "hardr"; + case Drivers::Watchdog::ResetReasons::NFC: + return "nfc"; + case Drivers::Watchdog::ResetReasons::SoftReset: + return "softr"; + case Drivers::Watchdog::ResetReasons::CpuLockup: + return "cpulock"; + case Drivers::Watchdog::ResetReasons::SystemOff: + return "off"; + case Drivers::Watchdog::ResetReasons::LpComp: + return "lpcomp"; + case Drivers::Watchdog::ResetReasons::DebugInterface: + return "dbg"; + case Drivers::Watchdog::ResetReasons::ResetPin: + return "rst"; + default: + return "?"; } }(); // uptime - static constexpr uint32_t secondsInADay = 60*60*24; - static constexpr uint32_t secondsInAnHour = 60*60; + static constexpr uint32_t secondsInADay = 60 * 60 * 24; + static constexpr uint32_t secondsInAnHour = 60 * 60; static constexpr uint32_t secondsInAMinute = 60; uint32_t uptimeSeconds = dateTimeController.Uptime().count(); uint32_t uptimeDays = (uptimeSeconds / secondsInADay); @@ -101,67 +124,83 @@ std::unique_ptr SystemInfo::CreateScreen2() { uptimeSeconds = uptimeSeconds % secondsInAMinute; // TODO handle more than 100 days of uptime - if (batteryPercent == -1) batteryPercent = 0; + if (batteryPercent == -1) + batteryPercent = 0; // hack to not use the flot functions from printf uint8_t batteryVoltageBytes[2]; - batteryVoltageBytes[1] = static_cast(batteryVoltage); //truncate whole numbers - batteryVoltageBytes[0] = static_cast((batteryVoltage - batteryVoltageBytes[1]) * 100); //remove whole part of flt and shift 2 places over + batteryVoltageBytes[1] = static_cast(batteryVoltage); // truncate whole numbers + batteryVoltageBytes[0] = + static_cast((batteryVoltage - batteryVoltageBytes[1]) * 100); // remove whole part of flt and shift 2 places over // - lv_obj_t * label = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(label, true); - lv_label_set_text_fmt(label, - "#444444 Date# %02d/%02d/%04d\n" - "#444444 Time# %02d:%02d:%02d\n" - "#444444 Uptime#\n %02lud %02lu:%02lu:%02lu\n" - "#444444 Battery# %d%%/%1i.%02iv\n" - "#444444 Backlight# %s\n" - "#444444 Last reset# %s\n", - dateTimeController.Day(), static_cast(dateTimeController.Month()), dateTimeController.Year(), - dateTimeController.Hours(), dateTimeController.Minutes(), dateTimeController.Seconds(), - uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds, - batteryPercent, batteryVoltageBytes[1], batteryVoltageBytes[0], brightnessController.ToString(), resetReason - ); + lv_label_set_text_fmt(label, + "#444444 Date# %02d/%02d/%04d\n" + "#444444 Time# %02d:%02d:%02d\n" + "#444444 Uptime#\n %02lud %02lu:%02lu:%02lu\n" + "#444444 Battery# %d%%/%1i.%02iv\n" + "#444444 Backlight# %s\n" + "#444444 Last reset# %s\n", + dateTimeController.Day(), + static_cast(dateTimeController.Month()), + dateTimeController.Year(), + dateTimeController.Hours(), + dateTimeController.Minutes(), + dateTimeController.Seconds(), + uptimeDays, + uptimeHours, + uptimeMinutes, + uptimeSeconds, + batteryPercent, + batteryVoltageBytes[1], + batteryVoltageBytes[0], + brightnessController.ToString(), + resetReason); lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); return std::unique_ptr(new Screens::Label(1, 4, app, label)); - } std::unique_ptr SystemInfo::CreateScreen3() { lv_mem_monitor_t mon; - lv_mem_monitor(&mon); - - lv_obj_t * label = lv_label_create(lv_scr_act(), nullptr); + lv_mem_monitor(&mon); + + lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(label, true); auto& bleAddr = bleController.Address(); - lv_label_set_text_fmt(label, - "#444444 BLE MAC#\n" - " %02x:%02x:%02x:%02x:%02x:%02x" - "\n" - "#444444 Memory#\n" - " #444444 used# %d (%d%%)\n" - " #444444 frag# %d%%\n" - " #444444 free# %d" - "\n" - "#444444 Steps# %li", - bleAddr[5], bleAddr[4], bleAddr[3], bleAddr[2], bleAddr[1], bleAddr[0], - (int)mon.total_size - mon.free_size, - mon.used_pct, - mon.frag_pct, - (int)mon.free_biggest_size, - 0 - ); + lv_label_set_text_fmt(label, + "#444444 BLE MAC#\n" + " %02x:%02x:%02x:%02x:%02x:%02x" + "\n" + "#444444 Memory#\n" + " #444444 used# %d (%d%%)\n" + " #444444 frag# %d%%\n" + " #444444 free# %d" + "\n" + "#444444 Steps# %li", + bleAddr[5], + bleAddr[4], + bleAddr[3], + bleAddr[2], + bleAddr[1], + bleAddr[0], + (int) mon.total_size - mon.free_size, + mon.used_pct, + mon.frag_pct, + (int) mon.free_biggest_size, + 0); lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); return std::unique_ptr(new Screens::Label(2, 5, app, label)); } - -bool sortById(const TaskStatus_t &lhs, const TaskStatus_t &rhs) { return lhs.xTaskNumber < rhs.xTaskNumber; } +bool sortById(const TaskStatus_t& lhs, const TaskStatus_t& rhs) { + return lhs.xTaskNumber < rhs.xTaskNumber; +} std::unique_ptr SystemInfo::CreateScreen4() { TaskStatus_t tasksStatus[7]; - lv_obj_t * infoTask = lv_table_create(lv_scr_act(), NULL); + lv_obj_t* infoTask = lv_table_create(lv_scr_act(), NULL); lv_table_set_col_cnt(infoTask, 3); lv_table_set_row_cnt(infoTask, 8); lv_obj_set_pos(infoTask, 10, 10); @@ -176,31 +215,30 @@ std::unique_ptr SystemInfo::CreateScreen4() { auto nb = uxTaskGetSystemState(tasksStatus, 7, nullptr); std::sort(tasksStatus, tasksStatus + nb, sortById); for (uint8_t i = 0; i < nb; i++) { - + lv_table_set_cell_value(infoTask, i + 1, 0, std::to_string(tasksStatus[i].xTaskNumber).c_str()); - lv_table_set_cell_value(infoTask, i + 1, 1, tasksStatus[i].pcTaskName); + lv_table_set_cell_value(infoTask, i + 1, 1, tasksStatus[i].pcTaskName); if (tasksStatus[i].usStackHighWaterMark < 20) { std::string str1 = std::to_string(tasksStatus[i].usStackHighWaterMark) + " low"; lv_table_set_cell_value(infoTask, i + 1, 2, str1.c_str()); } else { lv_table_set_cell_value(infoTask, i + 1, 2, std::to_string(tasksStatus[i].usStackHighWaterMark).c_str()); } - } return std::unique_ptr(new Screens::Label(3, 5, app, infoTask)); } std::unique_ptr SystemInfo::CreateScreen5() { - lv_obj_t * label = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* label = lv_label_create(lv_scr_act(), nullptr); lv_label_set_recolor(label, true); lv_label_set_text_static(label, - "Software Licensed\n" - "under the terms of\n" - "the GNU General\n" - "Public License v3\n" - "#444444 Source code#\n" - "#FFFF00 https://github.com/#\n" - "#FFFF00 JF002/InfiniTime#"); + "Software Licensed\n" + "under the terms of\n" + "the GNU General\n" + "Public License v3\n" + "#444444 Source code#\n" + "#FFFF00 https://github.com/#\n" + "#FFFF00 JF002/InfiniTime#"); lv_label_set_align(label, LV_LABEL_ALIGN_CENTER); lv_obj_align(label, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); return std::unique_ptr(new Screens::Label(4, 5, app, label)); diff --git a/src/displayapp/screens/SystemInfo.h b/src/displayapp/screens/SystemInfo.h index f5f50a42..c0c65554 100644 --- a/src/displayapp/screens/SystemInfo.h +++ b/src/displayapp/screens/SystemInfo.h @@ -21,33 +21,33 @@ namespace Pinetime { namespace Screens { class SystemInfo : public Screen { - public: - explicit SystemInfo(DisplayApp* app, - Pinetime::Controllers::DateTime& dateTimeController, - Pinetime::Controllers::Battery& batteryController, - Pinetime::Controllers::BrightnessController& brightnessController, - Pinetime::Controllers::Ble& bleController, - Pinetime::Drivers::WatchdogView& watchdog); - ~SystemInfo() override; - bool Refresh() override; - bool OnButtonPushed() override; - bool OnTouchEvent(TouchEvents event) override; - private: - bool running = true; + public: + explicit SystemInfo(DisplayApp* app, + Pinetime::Controllers::DateTime& dateTimeController, + Pinetime::Controllers::Battery& batteryController, + Pinetime::Controllers::BrightnessController& brightnessController, + Pinetime::Controllers::Ble& bleController, + Pinetime::Drivers::WatchdogView& watchdog); + ~SystemInfo() override; + bool Refresh() override; + bool OnButtonPushed() override; + bool OnTouchEvent(TouchEvents event) override; - Pinetime::Controllers::DateTime& dateTimeController; - Pinetime::Controllers::Battery& batteryController; - Pinetime::Controllers::BrightnessController& brightnessController; - Pinetime::Controllers::Ble& bleController; - Pinetime::Drivers::WatchdogView& watchdog; + private: + bool running = true; - ScreenList<5> screens; - std::unique_ptr CreateScreen1(); - std::unique_ptr CreateScreen2(); - std::unique_ptr CreateScreen3(); - std::unique_ptr CreateScreen4(); - std::unique_ptr CreateScreen5(); + Pinetime::Controllers::DateTime& dateTimeController; + Pinetime::Controllers::Battery& batteryController; + Pinetime::Controllers::BrightnessController& brightnessController; + Pinetime::Controllers::Ble& bleController; + Pinetime::Drivers::WatchdogView& watchdog; + ScreenList<5> screens; + std::unique_ptr CreateScreen1(); + std::unique_ptr CreateScreen2(); + std::unique_ptr CreateScreen3(); + std::unique_ptr CreateScreen4(); + std::unique_ptr CreateScreen5(); }; } } diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index b1dfaf76..ec36af38 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -4,37 +4,35 @@ using namespace Pinetime::Applications::Screens; - namespace { - static void lv_update_task(struct _lv_task_t *task) { - auto user_data = static_cast(task->user_data); + static void lv_update_task(struct _lv_task_t* task) { + auto user_data = static_cast(task->user_data); user_data->UpdateScreen(); } - static void event_handler(lv_obj_t * obj, lv_event_t event) { - Tile* screen = static_cast(obj->user_data); + static void event_handler(lv_obj_t* obj, lv_event_t event) { + Tile* screen = static_cast(obj->user_data); uint32_t* eventDataPtr = (uint32_t*) lv_event_get_data(); uint32_t eventData = *eventDataPtr; screen->OnObjectEvent(obj, event, eventData); } } -Tile::Tile(uint8_t screenID, uint8_t numScreens, - DisplayApp* app, - Controllers::Settings& settingsController, - Pinetime::Controllers::Battery& batteryController, - Controllers::DateTime& dateTimeController, - std::array& applications) : - Screen(app), - batteryController{batteryController}, - dateTimeController{dateTimeController} { - +Tile::Tile(uint8_t screenID, + uint8_t numScreens, + DisplayApp* app, + Controllers::Settings& settingsController, + Pinetime::Controllers::Battery& batteryController, + Controllers::DateTime& dateTimeController, + std::array& applications) + : Screen(app), batteryController {batteryController}, dateTimeController {dateTimeController} { + settingsController.SetAppMenu(screenID); // Time - label_time = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes()); - lv_label_set_align( label_time, LV_LABEL_ALIGN_CENTER ); + label_time = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes()); + lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER); lv_obj_align(label_time, nullptr, LV_ALIGN_IN_TOP_LEFT, 15, 6); // Battery @@ -42,19 +40,18 @@ Tile::Tile(uint8_t screenID, uint8_t numScreens, lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15, 6); - if ( numScreens > 1 ) { + if (numScreens > 1) { pageIndicatorBasePoints[0].x = 240 - 1; pageIndicatorBasePoints[0].y = 6; pageIndicatorBasePoints[1].x = 240 - 1; pageIndicatorBasePoints[1].y = 240 - 6; - + pageIndicatorBase = lv_line_create(lv_scr_act(), nullptr); lv_obj_set_style_local_line_width(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 3); lv_obj_set_style_local_line_color(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); lv_obj_set_style_local_line_rounded(pageIndicatorBase, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true); lv_line_set_points(pageIndicatorBase, pageIndicatorBasePoints, 2); - uint16_t indicatorSize = 228 / numScreens; uint16_t indicatorPos = indicatorSize * screenID; @@ -69,11 +66,12 @@ Tile::Tile(uint8_t screenID, uint8_t numScreens, lv_obj_set_style_local_line_rounded(pageIndicator, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, true); lv_line_set_points(pageIndicator, pageIndicatorPoints, 2); } - + uint8_t btIndex = 0; - for(uint8_t i = 0; i < 6; i++) { - if(i == 3) btnmMap[btIndex++] = "\n"; - if ( applications[i].application == Apps::None ) { + for (uint8_t i = 0; i < 6; i++) { + if (i == 3) + btnmMap[btIndex++] = "\n"; + if (applications[i].application == Apps::None) { btnmMap[btIndex] = " "; } else { btnmMap[btIndex] = applications[i].icon; @@ -94,16 +92,16 @@ Tile::Tile(uint8_t screenID, uint8_t numScreens, lv_obj_set_style_local_bg_opa(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, LV_OPA_20); lv_obj_set_style_local_bg_color(btnm1, LV_BTNMATRIX_PART_BTN, LV_STATE_DISABLED, lv_color_hex(0x111111)); - for(uint8_t i = 0; i < 6; i++) { - if ( applications[i].application == Apps::None ) { - lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_DISABLED ); + for (uint8_t i = 0; i < 6; i++) { + if (applications[i].application == Apps::None) { + lv_btnmatrix_set_btn_ctrl(btnm1, i, LV_BTNMATRIX_CTRL_DISABLED); } } btnm1->user_data = this; lv_obj_set_event_cb(btnm1, event_handler); - lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); @@ -118,7 +116,7 @@ Tile::~Tile() { } void Tile::UpdateScreen() { - lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes()); + lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes()); lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); } @@ -126,11 +124,9 @@ bool Tile::Refresh() { return running; } -void Tile::OnObjectEvent(lv_obj_t *obj, lv_event_t event, uint32_t buttonId) { - if(event == LV_EVENT_VALUE_CHANGED) { +void Tile::OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId) { + if (event == LV_EVENT_VALUE_CHANGED) { app->StartApp(apps[buttonId], DisplayApp::FullRefreshDirections::Up); running = false; } } - - diff --git a/src/displayapp/screens/Tile.h b/src/displayapp/screens/Tile.h index 54ffcdae..4ebd81cd 100644 --- a/src/displayapp/screens/Tile.h +++ b/src/displayapp/screens/Tile.h @@ -14,42 +14,42 @@ namespace Pinetime { namespace Applications { namespace Screens { class Tile : public Screen { - public: - struct Applications { - const char* icon; - Pinetime::Applications::Apps application; - }; + public: + struct Applications { + const char* icon; + Pinetime::Applications::Apps application; + }; - explicit Tile(uint8_t screenID, uint8_t numScreens, - DisplayApp* app, - Controllers::Settings& settingsController, - Pinetime::Controllers::Battery& batteryController, - Controllers::DateTime& dateTimeController, - std::array& applications); + explicit Tile(uint8_t screenID, + uint8_t numScreens, + DisplayApp* app, + Controllers::Settings& settingsController, + Pinetime::Controllers::Battery& batteryController, + Controllers::DateTime& dateTimeController, + std::array& applications); - ~Tile() override; + ~Tile() override; - bool Refresh() override; - void UpdateScreen(); - void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId); + bool Refresh() override; + void UpdateScreen(); + void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId); - private: + private: + Pinetime::Controllers::Battery& batteryController; + Controllers::DateTime& dateTimeController; - Pinetime::Controllers::Battery& batteryController; - Controllers::DateTime& dateTimeController; + lv_task_t* taskUpdate; - lv_task_t* taskUpdate; + lv_obj_t* label_time; + lv_obj_t* batteryIcon; + lv_point_t pageIndicatorBasePoints[2]; + lv_point_t pageIndicatorPoints[2]; + lv_obj_t* pageIndicatorBase; + lv_obj_t* pageIndicator; + lv_obj_t* btnm1; - lv_obj_t* label_time; - lv_obj_t* batteryIcon; - lv_point_t pageIndicatorBasePoints[2]; - lv_point_t pageIndicatorPoints[2]; - lv_obj_t* pageIndicatorBase; - lv_obj_t* pageIndicator; - lv_obj_t* btnm1; - - const char* btnmMap[8]; - Pinetime::Applications::Apps apps[6]; + const char* btnmMap[8]; + Pinetime::Applications::Apps apps[6]; }; } } diff --git a/src/displayapp/screens/Twos.cpp b/src/displayapp/screens/Twos.cpp index bbee5e11..eb268077 100644 --- a/src/displayapp/screens/Twos.cpp +++ b/src/displayapp/screens/Twos.cpp @@ -8,7 +8,7 @@ using namespace Pinetime::Applications::Screens; -Twos::Twos(Pinetime::Applications::DisplayApp *app) : Screen(app) { +Twos::Twos(Pinetime::Applications::DisplayApp* app) : Screen(app) { // create styles to apply to different valued tiles lv_style_init(&style_cell1); @@ -50,8 +50,8 @@ Twos::Twos(Pinetime::Applications::DisplayApp *app) : Screen(app) { lv_style_set_pad_top(&style_cell5, LV_STATE_DEFAULT, 25); // format grid display - - gridDisplay = lv_table_create(lv_scr_act(), nullptr); + + gridDisplay = lv_table_create(lv_scr_act(), nullptr); lv_obj_add_style(gridDisplay, LV_TABLE_PART_CELL1, &style_cell1); lv_obj_add_style(gridDisplay, LV_TABLE_PART_CELL2, &style_cell2); lv_obj_add_style(gridDisplay, LV_TABLE_PART_CELL3, &style_cell3); @@ -59,17 +59,17 @@ Twos::Twos(Pinetime::Applications::DisplayApp *app) : Screen(app) { lv_obj_add_style(gridDisplay, LV_TABLE_PART_CELL4 + 1, &style_cell5); lv_table_set_col_cnt(gridDisplay, 4); lv_table_set_row_cnt(gridDisplay, 4); - lv_table_set_col_width(gridDisplay, 0, LV_HOR_RES/4); - lv_table_set_col_width(gridDisplay, 1, LV_HOR_RES/4); - lv_table_set_col_width(gridDisplay, 2, LV_HOR_RES/4); - lv_table_set_col_width(gridDisplay, 3, LV_HOR_RES/4); + lv_table_set_col_width(gridDisplay, 0, LV_HOR_RES / 4); + lv_table_set_col_width(gridDisplay, 1, LV_HOR_RES / 4); + lv_table_set_col_width(gridDisplay, 2, LV_HOR_RES / 4); + lv_table_set_col_width(gridDisplay, 3, LV_HOR_RES / 4); lv_obj_align(gridDisplay, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0); lv_obj_clean_style_list(gridDisplay, LV_TABLE_PART_BG); // initialize grid - for(int row = 0; row < 4; row++) { - for(int col = 0; col < 4; col++) { + for (int row = 0; row < 4; row++) { + for (int col = 0; col < 4; col++) { grid[row][col].value = 0; lv_table_set_cell_type(gridDisplay, row, col, 1); lv_table_set_cell_align(gridDisplay, row, col, LV_LABEL_ALIGN_CENTER); @@ -86,7 +86,7 @@ Twos::Twos(Pinetime::Applications::DisplayApp *app) : Screen(app) { lv_label_set_recolor(scoreText, true); lv_label_set_text_fmt(scoreText, "Score #FFFF00 %i#", score); - lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); @@ -107,10 +107,10 @@ bool Twos::Refresh() { } bool Twos::placeNewTile() { - std::vector< std::pair > availableCells; - for(int row = 0; row < 4; row++) { - for(int col = 0; col < 4; col++) { - if(!grid[row][col].value) { + std::vector> availableCells; + for (int row = 0; row < 4; row++) { + for (int col = 0; col < 4; col++) { + if (!grid[row][col].value) { availableCells.push_back(std::make_pair(row, col)); } } @@ -119,22 +119,24 @@ bool Twos::placeNewTile() { if (availableCells.size() == 0) { return false; // game lost } - + auto it = availableCells.cbegin(); int random = rand() % availableCells.size(); std::advance(it, random); - std::pair newCell = *it; + std::pair newCell = *it; - if ((rand() % 100) < 90) grid[newCell.first][newCell.second].value = 2; - else grid[newCell.first][newCell.second].value = 4; + if ((rand() % 100) < 90) + grid[newCell.first][newCell.second].value = 2; + else + grid[newCell.first][newCell.second].value = 4; updateGridDisplay(grid); return true; } -bool Twos::tryMerge(Tile grid[][4], int &newRow, int &newCol, int oldRow, int oldCol) { - if((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) { - if((newCol != oldCol) || (newRow != oldRow)) { - if(!grid[newRow][newCol].merged) { +bool Twos::tryMerge(Tile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol) { + if ((grid[newRow][newCol].value == grid[oldRow][oldCol].value)) { + if ((newCol != oldCol) || (newRow != oldRow)) { + if (!grid[newRow][newCol].merged) { unsigned int newVal = grid[oldRow][oldCol].value *= 2; grid[newRow][newCol].value = newVal; score += newVal; @@ -149,7 +151,7 @@ bool Twos::tryMerge(Tile grid[][4], int &newRow, int &newCol, int oldRow, int ol } bool Twos::tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol) { - if(((newCol >= 0) && (newCol != oldCol)) || ((newRow >= 0) && (newRow != oldRow))) { + if (((newCol >= 0) && (newCol != oldCol)) || ((newRow >= 0) && (newRow != oldRow))) { grid[newRow][newCol].value = grid[oldRow][oldCol].value; grid[oldRow][oldCol].value = 0; return true; @@ -159,27 +161,28 @@ bool Twos::tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCo bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) { bool validMove = false; - for(int row = 0; row < 4; row++) { - for(int col = 0; col < 4; col++) { + for (int row = 0; row < 4; row++) { + for (int col = 0; col < 4; col++) { grid[row][col].merged = false; // reinitialize merge state } } - switch(event) { + switch (event) { case TouchEvents::SwipeLeft: - for(int col = 1; col < 4; col++) { // ignore tiles already on far left - for(int row = 0; row < 4; row++) { - if(grid[row][col].value) { + for (int col = 1; col < 4; col++) { // ignore tiles already on far left + for (int row = 0; row < 4; row++) { + if (grid[row][col].value) { int newCol = -1; - for(int potentialNewCol = col - 1; potentialNewCol >= 0; potentialNewCol--) { - if(!grid[row][potentialNewCol].value) { + for (int potentialNewCol = col - 1; potentialNewCol >= 0; potentialNewCol--) { + if (!grid[row][potentialNewCol].value) { newCol = potentialNewCol; - } - else { // blocked by another tile - if(tryMerge(grid, row, potentialNewCol, row, col)) validMove = true; + } else { // blocked by another tile + if (tryMerge(grid, row, potentialNewCol, row, col)) + validMove = true; break; } } - if(tryMove(grid, row, newCol, row, col)) validMove = true; + if (tryMove(grid, row, newCol, row, col)) + validMove = true; } } } @@ -188,20 +191,21 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } return true; case TouchEvents::SwipeRight: - for(int col = 2; col >= 0; col--) { // ignore tiles already on far right - for(int row = 0; row < 4; row++) { - if(grid[row][col].value) { + for (int col = 2; col >= 0; col--) { // ignore tiles already on far right + for (int row = 0; row < 4; row++) { + if (grid[row][col].value) { int newCol = -1; - for(int potentialNewCol = col + 1; potentialNewCol < 4; potentialNewCol++) { - if(!grid[row][potentialNewCol].value) { + for (int potentialNewCol = col + 1; potentialNewCol < 4; potentialNewCol++) { + if (!grid[row][potentialNewCol].value) { newCol = potentialNewCol; - } - else { // blocked by another tile - if(tryMerge(grid, row, potentialNewCol, row, col)) validMove = true; + } else { // blocked by another tile + if (tryMerge(grid, row, potentialNewCol, row, col)) + validMove = true; break; } } - if(tryMove(grid, row, newCol, row, col)) validMove = true; + if (tryMove(grid, row, newCol, row, col)) + validMove = true; } } } @@ -210,20 +214,21 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } return true; case TouchEvents::SwipeUp: - for(int row = 1; row < 4; row++) { // ignore tiles already on top - for(int col = 0; col < 4; col++) { - if(grid[row][col].value) { + for (int row = 1; row < 4; row++) { // ignore tiles already on top + for (int col = 0; col < 4; col++) { + if (grid[row][col].value) { int newRow = -1; - for(int potentialNewRow = row - 1; potentialNewRow >= 0; potentialNewRow--) { - if(!grid[potentialNewRow][col].value) { + for (int potentialNewRow = row - 1; potentialNewRow >= 0; potentialNewRow--) { + if (!grid[potentialNewRow][col].value) { newRow = potentialNewRow; - } - else { // blocked by another tile - if(tryMerge(grid, potentialNewRow, col, row, col)) validMove = true; + } else { // blocked by another tile + if (tryMerge(grid, potentialNewRow, col, row, col)) + validMove = true; break; } } - if(tryMove(grid, newRow, col, row, col)) validMove = true; + if (tryMove(grid, newRow, col, row, col)) + validMove = true; } } } @@ -232,20 +237,21 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } return true; case TouchEvents::SwipeDown: - for(int row = 2; row >=0; row--) { // ignore tiles already on bottom - for(int col = 0; col < 4; col++) { - if(grid[row][col].value) { + for (int row = 2; row >= 0; row--) { // ignore tiles already on bottom + for (int col = 0; col < 4; col++) { + if (grid[row][col].value) { int newRow = -1; - for(int potentialNewRow = row + 1; potentialNewRow < 4; potentialNewRow++) { - if(!grid[potentialNewRow][col].value) { + for (int potentialNewRow = row + 1; potentialNewRow < 4; potentialNewRow++) { + if (!grid[potentialNewRow][col].value) { newRow = potentialNewRow; - } - else { // blocked by another tile - if(tryMerge(grid, potentialNewRow, col, row, col)) validMove = true; + } else { // blocked by another tile + if (tryMerge(grid, potentialNewRow, col, row, col)) + validMove = true; break; } } - if(tryMove(grid, newRow, col, row, col)) validMove = true; + if (tryMove(grid, newRow, col, row, col)) + validMove = true; } } } @@ -260,12 +266,11 @@ bool Twos::OnTouchEvent(Pinetime::Applications::TouchEvents event) { } void Twos::updateGridDisplay(Tile grid[][4]) { - for(int row = 0; row < 4; row++) { - for(int col = 0; col < 4; col++) { + for (int row = 0; row < 4; row++) { + for (int col = 0; col < 4; col++) { if (grid[row][col].value) { lv_table_set_cell_value(gridDisplay, row, col, (std::to_string(grid[row][col].value)).c_str()); - } - else { + } else { lv_table_set_cell_value(gridDisplay, row, col, ""); } switch (grid[row][col].value) { diff --git a/src/displayapp/screens/Twos.h b/src/displayapp/screens/Twos.h index 7223c7a8..3367618f 100644 --- a/src/displayapp/screens/Twos.h +++ b/src/displayapp/screens/Twos.h @@ -11,30 +11,28 @@ namespace Pinetime { }; namespace Screens { class Twos : public Screen { - public: - Twos(DisplayApp* app); - ~Twos() override; - bool Refresh() override; - - bool OnTouchEvent(TouchEvents event) override; + public: + Twos(DisplayApp* app); + ~Twos() override; + bool Refresh() override; - private: + bool OnTouchEvent(TouchEvents event) override; - lv_style_t style_cell1; - lv_style_t style_cell2; - lv_style_t style_cell3; - lv_style_t style_cell4; - lv_style_t style_cell5; - - - lv_obj_t *scoreText; - lv_obj_t *gridDisplay; - Tile grid[4][4]; - unsigned int score = 0; - void updateGridDisplay(Tile grid[][4]); - bool tryMerge(Tile grid[][4], int &newRow, int &newCol, int oldRow, int oldCol); - bool tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol); - bool placeNewTile(); + private: + lv_style_t style_cell1; + lv_style_t style_cell2; + lv_style_t style_cell3; + lv_style_t style_cell4; + lv_style_t style_cell5; + + lv_obj_t* scoreText; + lv_obj_t* gridDisplay; + Tile grid[4][4]; + unsigned int score = 0; + void updateGridDisplay(Tile grid[][4]); + bool tryMerge(Tile grid[][4], int& newRow, int& newCol, int oldRow, int oldCol); + bool tryMove(Tile grid[][4], int newRow, int newCol, int oldRow, int oldCol); + bool placeNewTile(); }; } } diff --git a/src/displayapp/screens/WatchFaceAnalog.cpp b/src/displayapp/screens/WatchFaceAnalog.cpp index 66af584a..02f1fc2a 100644 --- a/src/displayapp/screens/WatchFaceAnalog.cpp +++ b/src/displayapp/screens/WatchFaceAnalog.cpp @@ -14,44 +14,45 @@ using namespace Pinetime::Applications::Screens; #define HOUR_LENGTH 70 #define MINUTE_LENGTH 90 #define SECOND_LENGTH 110 -#define PI 3.14159265358979323846 +#define PI 3.14159265358979323846 // ## -static int16_t coordinate_x_relocate(int16_t x) -{ - return ((x) + LV_HOR_RES / 2); +static int16_t coordinate_x_relocate(int16_t x) { + return ((x) + LV_HOR_RES / 2); } // ## -static int16_t coordinate_y_relocate(int16_t y) -{ - return (((y) - LV_HOR_RES / 2) < 0) ? (0 - ((y) - LV_HOR_RES / 2)) : ((y) - LV_HOR_RES / 2); +static int16_t coordinate_y_relocate(int16_t y) { + return (((y) -LV_HOR_RES / 2) < 0) ? (0 - ((y) -LV_HOR_RES / 2)) : ((y) -LV_HOR_RES / 2); } -WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp *app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController, - Controllers::NotificationManager& notificatioManager, - Controllers::Settings &settingsController) : Screen(app), currentDateTime{{}}, - dateTimeController{dateTimeController}, batteryController{batteryController}, - bleController{bleController}, notificatioManager{notificatioManager}, - settingsController{settingsController} { +WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp* app, + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::NotificationManager& notificatioManager, + Controllers::Settings& settingsController) + : Screen(app), + currentDateTime {{}}, + dateTimeController {dateTimeController}, + batteryController {batteryController}, + bleController {bleController}, + notificatioManager {notificatioManager}, + settingsController {settingsController} { settingsController.SetClockFace(1); sHour = 99; sMinute = 99; - sSecond = 99; - - lv_obj_t * bg_clock_img = lv_img_create(lv_scr_act(), NULL); + sSecond = 99; + + lv_obj_t* bg_clock_img = lv_img_create(lv_scr_act(), NULL); lv_img_set_src(bg_clock_img, &bg_clock); lv_obj_align(bg_clock_img, NULL, LV_ALIGN_CENTER, 0, 0); - batteryIcon = lv_label_create(lv_scr_act(), nullptr); + batteryIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(batteryIcon, Symbols::batteryHalf); lv_obj_align(batteryIcon, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -8, -4); - notificationIcon = lv_label_create(lv_scr_act(), NULL); lv_obj_set_style_local_text_color(notificationIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x00FF00)); lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); @@ -61,17 +62,16 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp *app, label_date_day = lv_label_create(lv_scr_act(), NULL); lv_obj_set_style_local_text_color(label_date_day, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xf0a500)); - lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day()); - lv_label_set_align( label_date_day, LV_LABEL_ALIGN_CENTER ); - lv_obj_align(label_date_day, NULL, LV_ALIGN_CENTER, 50, 0); - + lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), dateTimeController.Day()); + lv_label_set_align(label_date_day, LV_LABEL_ALIGN_CENTER); + lv_obj_align(label_date_day, NULL, LV_ALIGN_CENTER, 50, 0); + minute_body = lv_line_create(lv_scr_act(), NULL); minute_body_trace = lv_line_create(lv_scr_act(), NULL); - hour_body = lv_line_create(lv_scr_act(), NULL); - hour_body_trace = lv_line_create(lv_scr_act(), NULL); + hour_body = lv_line_create(lv_scr_act(), NULL); + hour_body_trace = lv_line_create(lv_scr_act(), NULL); second_body = lv_line_create(lv_scr_act(), NULL); - lv_style_init(&second_line_style); lv_style_set_line_width(&second_line_style, LV_STATE_DEFAULT, 3); lv_style_set_line_color(&second_line_style, LV_STATE_DEFAULT, LV_COLOR_RED); @@ -90,7 +90,6 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp *app, lv_style_set_line_rounded(&minute_line_style_trace, LV_STATE_DEFAULT, false); lv_obj_add_style(minute_body_trace, LV_LINE_PART_MAIN, &minute_line_style_trace); - lv_style_init(&hour_line_style); lv_style_set_line_width(&hour_line_style, LV_STATE_DEFAULT, 7); lv_style_set_line_color(&hour_line_style, LV_STATE_DEFAULT, LV_COLOR_WHITE); @@ -104,7 +103,6 @@ WatchFaceAnalog::WatchFaceAnalog(Pinetime::Applications::DisplayApp *app, lv_obj_add_style(hour_body_trace, LV_LINE_PART_MAIN, &hour_line_style_trace); UpdateClock(); - } WatchFaceAnalog::~WatchFaceAnalog() { @@ -114,17 +112,17 @@ WatchFaceAnalog::~WatchFaceAnalog() { lv_style_reset(&minute_line_style); lv_style_reset(&minute_line_style_trace); lv_style_reset(&second_line_style); - + lv_obj_clean(lv_scr_act()); } void WatchFaceAnalog::UpdateClock() { - + hour = dateTimeController.Hours(); minute = dateTimeController.Minutes(); - second = dateTimeController.Seconds(); + second = dateTimeController.Seconds(); - if(sMinute != minute) { + if (sMinute != minute) { minute_point[0].x = coordinate_x_relocate(30 * sin(minute * 6 * PI / 180)); minute_point[0].y = coordinate_y_relocate(30 * cos(minute * 6 * PI / 180)); minute_point[1].x = coordinate_x_relocate(MINUTE_LENGTH * sin(minute * 6 * PI / 180)); @@ -134,40 +132,38 @@ void WatchFaceAnalog::UpdateClock() { minute_point_trace[0].y = coordinate_y_relocate(5 * cos(minute * 6 * PI / 180)); minute_point_trace[1].x = coordinate_x_relocate(31 * sin(minute * 6 * PI / 180)); minute_point_trace[1].y = coordinate_y_relocate(31 * cos(minute * 6 * PI / 180)); - + lv_line_set_points(minute_body, minute_point, 2); lv_line_set_points(minute_body_trace, minute_point_trace, 2); } - if(sHour != hour || sMinute != minute) { + if (sHour != hour || sMinute != minute) { sHour = hour; sMinute = minute; - hour_point[0].x = coordinate_x_relocate(30 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); - hour_point[0].y = coordinate_y_relocate(30 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); - hour_point[1].x = coordinate_x_relocate(HOUR_LENGTH * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); - hour_point[1].y = coordinate_y_relocate(HOUR_LENGTH * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); + hour_point[0].x = coordinate_x_relocate(30 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); + hour_point[0].y = coordinate_y_relocate(30 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); + hour_point[1].x = coordinate_x_relocate(HOUR_LENGTH * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); + hour_point[1].y = coordinate_y_relocate(HOUR_LENGTH * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); - hour_point_trace[0].x = coordinate_x_relocate(5 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); - hour_point_trace[0].y = coordinate_y_relocate(5 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); - hour_point_trace[1].x = coordinate_x_relocate(31 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); - hour_point_trace[1].y = coordinate_y_relocate(31 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); + hour_point_trace[0].x = coordinate_x_relocate(5 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); + hour_point_trace[0].y = coordinate_y_relocate(5 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); + hour_point_trace[1].x = coordinate_x_relocate(31 * sin((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); + hour_point_trace[1].y = coordinate_y_relocate(31 * cos((((hour > 12 ? hour - 12 : hour) * 30) + (minute * 0.5)) * PI / 180)); - lv_line_set_points(hour_body, hour_point, 2); - lv_line_set_points(hour_body_trace, hour_point_trace, 2); + lv_line_set_points(hour_body, hour_point, 2); + lv_line_set_points(hour_body_trace, hour_point_trace, 2); } - if(sSecond != second) { + if (sSecond != second) { sSecond = second; second_point[0].x = coordinate_x_relocate(20 * sin((180 + second * 6) * PI / 180)); second_point[0].y = coordinate_y_relocate(20 * cos((180 + second * 6) * PI / 180)); second_point[1].x = coordinate_x_relocate(SECOND_LENGTH * sin(second * 6 * PI / 180)); second_point[1].y = coordinate_y_relocate(SECOND_LENGTH * cos(second * 6 * PI / 180)); lv_line_set_points(second_body, second_point, 2); - } } - bool WatchFaceAnalog::Refresh() { batteryPercentRemaining = batteryController.PercentRemaining(); @@ -176,11 +172,10 @@ bool WatchFaceAnalog::Refresh() { lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); } - notificationState = notificatioManager.AreNewNotificationsAvailable(); - if(notificationState.IsUpdated()) { - if(notificationState.Get() == true) + if (notificationState.IsUpdated()) { + if (notificationState.Get() == true) lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true)); else lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); @@ -188,17 +183,17 @@ bool WatchFaceAnalog::Refresh() { currentDateTime = dateTimeController.CurrentDateTime(); - if(currentDateTime.IsUpdated()) { - + if (currentDateTime.IsUpdated()) { + month = dateTimeController.Month(); day = dateTimeController.Day(); dayOfWeek = dateTimeController.DayOfWeek(); UpdateClock(); - + if ((month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { - lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), day); + lv_label_set_text_fmt(label_date_day, "%s\n%02i", dateTimeController.DayOfWeekShortToString(), day); currentMonth = month; currentDayOfWeek = dayOfWeek; diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h index 56b086ab..667f6241 100644 --- a/src/displayapp/screens/WatchFaceAnalog.h +++ b/src/displayapp/screens/WatchFaceAnalog.h @@ -22,68 +22,67 @@ namespace Pinetime { namespace Screens { class WatchFaceAnalog : public Screen { - public: - WatchFaceAnalog(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController, - Controllers::NotificationManager& notificatioManager, - Controllers::Settings &settingsController); - - ~WatchFaceAnalog() override; + public: + WatchFaceAnalog(DisplayApp* app, + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::NotificationManager& notificatioManager, + Controllers::Settings& settingsController); - bool Refresh() override; + ~WatchFaceAnalog() override; - private: - uint8_t sHour, sMinute, sSecond; - uint8_t hour; - uint8_t minute; - uint8_t second; + bool Refresh() override; - Pinetime::Controllers::DateTime::Months month; - uint8_t day; - Pinetime::Controllers::DateTime::Days dayOfWeek; + private: + uint8_t sHour, sMinute, sSecond; + uint8_t hour; + uint8_t minute; + uint8_t second; - Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown; - Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; - uint8_t currentDay = 0; + Pinetime::Controllers::DateTime::Months month; + uint8_t day; + Pinetime::Controllers::DateTime::Days dayOfWeek; - DirtyValue batteryPercentRemaining {0}; - DirtyValue> currentDateTime; - DirtyValue notificationState {false}; + Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown; + Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; + uint8_t currentDay = 0; - lv_obj_t *hour_body; - lv_obj_t *hour_body_trace; - lv_obj_t *minute_body; - lv_obj_t *minute_body_trace; - lv_obj_t *second_body; + DirtyValue batteryPercentRemaining {0}; + DirtyValue> currentDateTime; + DirtyValue notificationState {false}; - // ## - lv_point_t hour_point[2]; - lv_point_t hour_point_trace[2]; - lv_point_t minute_point[2]; - lv_point_t minute_point_trace[2]; - lv_point_t second_point[2]; + lv_obj_t* hour_body; + lv_obj_t* hour_body_trace; + lv_obj_t* minute_body; + lv_obj_t* minute_body_trace; + lv_obj_t* second_body; - // ## - lv_style_t hour_line_style; - lv_style_t hour_line_style_trace; - lv_style_t minute_line_style; - lv_style_t minute_line_style_trace; - lv_style_t second_line_style; - - lv_obj_t* label_date_day; - lv_obj_t* batteryIcon; - lv_obj_t* notificationIcon; - + // ## + lv_point_t hour_point[2]; + lv_point_t hour_point_trace[2]; + lv_point_t minute_point[2]; + lv_point_t minute_point_trace[2]; + lv_point_t second_point[2]; - Controllers::DateTime& dateTimeController; - Controllers::Battery& batteryController; - Controllers::Ble& bleController; - Controllers::NotificationManager& notificatioManager; - Controllers::Settings& settingsController; + // ## + lv_style_t hour_line_style; + lv_style_t hour_line_style_trace; + lv_style_t minute_line_style; + lv_style_t minute_line_style_trace; + lv_style_t second_line_style; - void UpdateClock(); + lv_obj_t* label_date_day; + lv_obj_t* batteryIcon; + lv_obj_t* notificationIcon; + + Controllers::DateTime& dateTimeController; + Controllers::Battery& batteryController; + Controllers::Ble& bleController; + Controllers::NotificationManager& notificatioManager; + Controllers::Settings& settingsController; + + void UpdateClock(); }; } } diff --git a/src/displayapp/screens/WatchFaceDigital.cpp b/src/displayapp/screens/WatchFaceDigital.cpp index 15f73e8b..bf078d03 100644 --- a/src/displayapp/screens/WatchFaceDigital.cpp +++ b/src/displayapp/screens/WatchFaceDigital.cpp @@ -17,20 +17,23 @@ using namespace Pinetime::Applications::Screens; - WatchFaceDigital::WatchFaceDigital(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController, - Controllers::NotificationManager& notificatioManager, - Controllers::Settings &settingsController, - Controllers::HeartRateController& heartRateController, - Controllers::MotionController& motionController) : Screen(app), currentDateTime{{}}, - dateTimeController{dateTimeController}, batteryController{batteryController}, - bleController{bleController}, notificatioManager{notificatioManager}, - settingsController{settingsController}, - heartRateController{heartRateController}, - motionController{motionController} { + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::NotificationManager& notificatioManager, + Controllers::Settings& settingsController, + Controllers::HeartRateController& heartRateController, + Controllers::MotionController& motionController) + : Screen(app), + currentDateTime {{}}, + dateTimeController {dateTimeController}, + batteryController {batteryController}, + bleController {bleController}, + notificatioManager {notificatioManager}, + settingsController {settingsController}, + heartRateController {heartRateController}, + motionController {motionController} { settingsController.SetClockFace(0); displayedChar[0] = 0; @@ -62,15 +65,15 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app, lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_CENTER, 0, 60); lv_obj_set_style_local_text_color(label_date, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x999999)); - label_time = lv_label_create(lv_scr_act(), nullptr); - lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_extrabold_compressed); + label_time = lv_label_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_text_font(label_time, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &jetbrains_mono_extrabold_compressed); lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 0); label_time_ampm = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text_static(label_time_ampm, ""); - lv_obj_align(label_time_ampm, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -30, -55); - + lv_obj_align(label_time_ampm, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, -30, -55); + backgroundLabel = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_click(backgroundLabel, true); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); @@ -78,7 +81,6 @@ WatchFaceDigital::WatchFaceDigital(DisplayApp* app, lv_obj_set_pos(backgroundLabel, 0, 0); lv_label_set_text(backgroundLabel, ""); - heartbeatIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(heartbeatIcon, Symbols::heartBeat); lv_obj_set_style_local_text_color(heartbeatIcon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0xCE1B1B)); @@ -120,7 +122,7 @@ bool WatchFaceDigital::Refresh() { bleState = bleController.IsConnected(); if (bleState.IsUpdated()) { - if(bleState.Get() == true) { + if (bleState.Get() == true) { lv_label_set_text(bleIcon, BleIcon::GetIcon(true)); } else { lv_label_set_text(bleIcon, BleIcon::GetIcon(false)); @@ -131,8 +133,8 @@ bool WatchFaceDigital::Refresh() { lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); notificationState = notificatioManager.AreNewNotificationsAvailable(); - if(notificationState.IsUpdated()) { - if(notificationState.Get() == true) + if (notificationState.IsUpdated()) { + if (notificationState.Get() == true) lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(true)); else lv_label_set_text(notificationIcon, NotificationIcon::GetIcon(false)); @@ -140,16 +142,16 @@ bool WatchFaceDigital::Refresh() { currentDateTime = dateTimeController.CurrentDateTime(); - if(currentDateTime.IsUpdated()) { + if (currentDateTime.IsUpdated()) { auto newDateTime = currentDateTime.Get(); auto dp = date::floor(newDateTime); - auto time = date::make_time(newDateTime-dp); + auto time = date::make_time(newDateTime - dp); auto yearMonthDay = date::year_month_day(dp); - auto year = (int)yearMonthDay.year(); - auto month = static_cast((unsigned)yearMonthDay.month()); - auto day = (unsigned)yearMonthDay.day(); + auto year = (int) yearMonthDay.year(); + auto month = static_cast((unsigned) yearMonthDay.month()); + auto day = (unsigned) yearMonthDay.day(); auto dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); int hour = time.hours().count(); @@ -160,29 +162,26 @@ bool WatchFaceDigital::Refresh() { char hoursChar[3]; char ampmChar[3]; - if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H24 ) { + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) { sprintf(hoursChar, "%02d", hour); } else { if (hour == 0 && hour != 12) { - hour = 12; - sprintf(ampmChar, "AM"); - } - else if (hour == 12 && hour != 0) { - hour = 12; - sprintf(ampmChar, "PM"); - } - else if (hour < 12 && hour != 0) { - sprintf(ampmChar, "AM"); - } - else if (hour > 12 && hour != 0) - { - hour = hour - 12; - sprintf(ampmChar, "PM"); + hour = 12; + sprintf(ampmChar, "AM"); + } else if (hour == 12 && hour != 0) { + hour = 12; + sprintf(ampmChar, "PM"); + } else if (hour < 12 && hour != 0) { + sprintf(ampmChar, "AM"); + } else if (hour > 12 && hour != 0) { + hour = hour - 12; + sprintf(ampmChar, "PM"); } sprintf(hoursChar, "%02d", hour); } - if(hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] || minutesChar[1] != displayedChar[3]) { + if (hoursChar[0] != displayedChar[0] || hoursChar[1] != displayedChar[1] || minutesChar[0] != displayedChar[2] || + minutesChar[1] != displayedChar[3]) { displayedChar[0] = hoursChar[0]; displayedChar[1] = hoursChar[1]; displayedChar[2] = minutesChar[0]; @@ -190,25 +189,26 @@ bool WatchFaceDigital::Refresh() { char timeStr[6]; - if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H12 ) { + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { lv_label_set_text(label_time_ampm, ampmChar); - if ( hoursChar[0] == '0' ) { hoursChar[0] = ' '; } + if (hoursChar[0] == '0') { + hoursChar[0] = ' '; + } } - sprintf(timeStr, "%c%c:%c%c", hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]); + sprintf(timeStr, "%c%c:%c%c", hoursChar[0], hoursChar[1], minutesChar[0], minutesChar[1]); lv_label_set_text(label_time, timeStr); - - if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H12 ) { + + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_RIGHT_MID, 0, 0); } else { lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_CENTER, 0, 0); } - } if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { char dateStr[22]; - if ( settingsController.GetClockType() == Controllers::Settings::ClockType::H24 ) { + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) { sprintf(dateStr, "%s %d %s %d", dateTimeController.DayOfWeekShortToString(), day, dateTimeController.MonthShortToString(), year); } else { sprintf(dateStr, "%s %s %d %d", dateTimeController.DayOfWeekShortToString(), dateTimeController.MonthShortToString(), day, year); @@ -216,7 +216,6 @@ bool WatchFaceDigital::Refresh() { lv_label_set_text(label_date, dateStr); lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_CENTER, 0, 60); - currentYear = year; currentMonth = month; currentDayOfWeek = dayOfWeek; @@ -226,12 +225,12 @@ bool WatchFaceDigital::Refresh() { heartbeat = heartRateController.HeartRate(); heartbeatRunning = heartRateController.State() != Controllers::HeartRateController::States::Stopped; - if(heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { - if(heartbeatRunning.Get()) - lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get()); + if (heartbeat.IsUpdated() || heartbeatRunning.IsUpdated()) { + if (heartbeatRunning.Get()) + lv_label_set_text_fmt(heartbeatValue, "%d", heartbeat.Get()); else lv_label_set_text_static(heartbeatValue, "---"); - + lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2); lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0); lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0); @@ -239,7 +238,7 @@ bool WatchFaceDigital::Refresh() { stepCount = motionController.NbSteps(); motionSensorOk = motionController.IsSensorOk(); - if(stepCount.IsUpdated() || motionSensorOk.IsUpdated()) { + if (stepCount.IsUpdated() || motionSensorOk.IsUpdated()) { lv_label_set_text_fmt(stepValue, "%lu", stepCount.Get()); lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2); lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); @@ -247,5 +246,3 @@ bool WatchFaceDigital::Refresh() { return running; } - - diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index 67d32ff6..246efc95 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -22,64 +22,59 @@ namespace Pinetime { namespace Screens { class WatchFaceDigital : public Screen { - public: - WatchFaceDigital(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController, - Controllers::NotificationManager& notificatioManager, - Controllers::Settings &settingsController, - Controllers::HeartRateController& heartRateController, - Controllers::MotionController& motionController); - ~WatchFaceDigital() override; + public: + WatchFaceDigital(DisplayApp* app, + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Controllers::NotificationManager& notificatioManager, + Controllers::Settings& settingsController, + Controllers::HeartRateController& heartRateController, + Controllers::MotionController& motionController); + ~WatchFaceDigital() override; - bool Refresh() override; - + bool Refresh() override; - void OnObjectEvent(lv_obj_t *pObj, lv_event_t i); - private: + void OnObjectEvent(lv_obj_t* pObj, lv_event_t i); + private: + char displayedChar[5]; - char displayedChar[5]; + uint16_t currentYear = 1970; + Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown; + Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; + uint8_t currentDay = 0; - uint16_t currentYear = 1970; - Pinetime::Controllers::DateTime::Months currentMonth = Pinetime::Controllers::DateTime::Months::Unknown; - Pinetime::Controllers::DateTime::Days currentDayOfWeek = Pinetime::Controllers::DateTime::Days::Unknown; - uint8_t currentDay = 0; + DirtyValue batteryPercentRemaining {}; + DirtyValue bleState {}; + DirtyValue> currentDateTime {}; + DirtyValue motionSensorOk {}; + DirtyValue stepCount {}; + DirtyValue heartbeat {}; + DirtyValue heartbeatRunning {}; + DirtyValue notificationState {}; - DirtyValue batteryPercentRemaining {}; - DirtyValue bleState {}; - DirtyValue> currentDateTime{}; - DirtyValue motionSensorOk {}; - DirtyValue stepCount {}; - DirtyValue heartbeat {}; - DirtyValue heartbeatRunning {}; - DirtyValue notificationState {}; - - lv_obj_t* label_time; - lv_obj_t* label_time_ampm; - lv_obj_t* label_date; - lv_obj_t* backgroundLabel; - lv_obj_t* batteryIcon; - lv_obj_t* bleIcon; - lv_obj_t* batteryPlug; - lv_obj_t* heartbeatIcon; - lv_obj_t* heartbeatValue; - lv_obj_t* heartbeatBpm; - lv_obj_t* stepIcon; - lv_obj_t* stepValue; - lv_obj_t* notificationIcon; - - Controllers::DateTime& dateTimeController; - Controllers::Battery& batteryController; - Controllers::Ble& bleController; - Controllers::NotificationManager& notificatioManager; - Controllers::Settings& settingsController; - Controllers::HeartRateController& heartRateController; - Controllers::MotionController& motionController; - - + lv_obj_t* label_time; + lv_obj_t* label_time_ampm; + lv_obj_t* label_date; + lv_obj_t* backgroundLabel; + lv_obj_t* batteryIcon; + lv_obj_t* bleIcon; + lv_obj_t* batteryPlug; + lv_obj_t* heartbeatIcon; + lv_obj_t* heartbeatValue; + lv_obj_t* heartbeatBpm; + lv_obj_t* stepIcon; + lv_obj_t* stepValue; + lv_obj_t* notificationIcon; + Controllers::DateTime& dateTimeController; + Controllers::Battery& batteryController; + Controllers::Ble& bleController; + Controllers::NotificationManager& notificatioManager; + Controllers::Settings& settingsController; + Controllers::HeartRateController& heartRateController; + Controllers::MotionController& motionController; }; } } diff --git a/src/displayapp/screens/settings/QuickSettings.cpp b/src/displayapp/screens/settings/QuickSettings.cpp index 9fd051b8..d19e4222 100644 --- a/src/displayapp/screens/settings/QuickSettings.cpp +++ b/src/displayapp/screens/settings/QuickSettings.cpp @@ -3,66 +3,61 @@ #include "displayapp/screens/Symbols.h" #include "displayapp/screens/BatteryIcon.h" - using namespace Pinetime::Applications::Screens; namespace { - static void ButtonEventHandler(lv_obj_t * obj, lv_event_t event) { - QuickSettings* screen = static_cast(obj->user_data); + static void ButtonEventHandler(lv_obj_t* obj, lv_event_t event) { + QuickSettings* screen = static_cast(obj->user_data); screen->OnButtonEvent(obj, event); } - static void lv_update_task(struct _lv_task_t *task) { - auto user_data = static_cast(task->user_data); + static void lv_update_task(struct _lv_task_t* task) { + auto user_data = static_cast(task->user_data); user_data->UpdateScreen(); } } -QuickSettings::QuickSettings( - Pinetime::Applications::DisplayApp *app, - Pinetime::Controllers::Battery& batteryController, - Controllers::DateTime& dateTimeController, - Controllers::BrightnessController& brightness, - Pinetime::Controllers::Settings &settingsController) : - Screen(app), - batteryController{batteryController}, - dateTimeController{dateTimeController}, - brightness{brightness}, - settingsController{settingsController} -{ +QuickSettings::QuickSettings(Pinetime::Applications::DisplayApp* app, + Pinetime::Controllers::Battery& batteryController, + Controllers::DateTime& dateTimeController, + Controllers::BrightnessController& brightness, + Pinetime::Controllers::Settings& settingsController) + : Screen(app), + batteryController {batteryController}, + dateTimeController {dateTimeController}, + brightness {brightness}, + settingsController {settingsController} { // Time - label_time = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes()); - lv_label_set_align( label_time, LV_LABEL_ALIGN_CENTER ); + label_time = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes()); + lv_label_set_align(label_time, LV_LABEL_ALIGN_CENTER); lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_TOP_LEFT, 15, 4); batteryIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); lv_obj_align(batteryIcon, nullptr, LV_ALIGN_IN_TOP_RIGHT, -15, 4); - - lv_obj_t * lbl_btn; + lv_obj_t* lbl_btn; btn1 = lv_btn_create(lv_scr_act(), nullptr); btn1->user_data = this; lv_obj_set_event_cb(btn1, ButtonEventHandler); - lv_obj_align(btn1, nullptr, LV_ALIGN_CENTER, -50, -30); + lv_obj_align(btn1, nullptr, LV_ALIGN_CENTER, -50, -30); lv_obj_set_style_local_radius(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20); - lv_obj_set_style_local_bg_color(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); + lv_obj_set_style_local_bg_color(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); lv_obj_set_style_local_bg_grad_dir(btn1, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE); - lv_btn_set_fit2(btn1, LV_FIT_TIGHT, LV_FIT_TIGHT); + lv_btn_set_fit2(btn1, LV_FIT_TIGHT, LV_FIT_TIGHT); btn1_lvl = lv_label_create(btn1, nullptr); lv_obj_set_style_local_text_font(btn1_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); lv_label_set_text_static(btn1_lvl, brightness.GetIcon()); - btn2 = lv_btn_create(lv_scr_act(), nullptr); btn2->user_data = this; lv_obj_set_event_cb(btn2, ButtonEventHandler); - lv_obj_align(btn2, nullptr, LV_ALIGN_CENTER, 50, -30); + lv_obj_align(btn2, nullptr, LV_ALIGN_CENTER, 50, -30); lv_obj_set_style_local_radius(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20); lv_obj_set_style_local_bg_color(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); lv_obj_set_style_local_bg_grad_dir(btn2, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE); @@ -71,7 +66,6 @@ QuickSettings::QuickSettings( lbl_btn = lv_label_create(btn2, nullptr); lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); lv_label_set_text_static(lbl_btn, Symbols::highlight); - btn3 = lv_btn_create(lv_scr_act(), nullptr); btn3->user_data = this; @@ -86,9 +80,9 @@ QuickSettings::QuickSettings( lv_btn_set_fit2(btn3, LV_FIT_TIGHT, LV_FIT_TIGHT); btn3_lvl = lv_label_create(btn3, nullptr); - lv_obj_set_style_local_text_font(btn3_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); + lv_obj_set_style_local_text_font(btn3_lvl, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); - if ( settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::ON ) { + if (settingsController.GetVibrationStatus() == Controllers::Settings::Vibration::ON) { lv_obj_add_state(btn3, LV_STATE_CHECKED); lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn); } else { @@ -98,7 +92,7 @@ QuickSettings::QuickSettings( btn4 = lv_btn_create(lv_scr_act(), nullptr); btn4->user_data = this; lv_obj_set_event_cb(btn4, ButtonEventHandler); - lv_obj_align(btn4, nullptr, LV_ALIGN_CENTER, 50, 60); + lv_obj_align(btn4, nullptr, LV_ALIGN_CENTER, 50, 60); lv_obj_set_style_local_radius(btn4, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, 20); lv_obj_set_style_local_bg_color(btn4, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); lv_obj_set_style_local_bg_grad_dir(btn4, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_GRAD_DIR_NONE); @@ -108,17 +102,15 @@ QuickSettings::QuickSettings( lv_obj_set_style_local_text_font(lbl_btn, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, &lv_font_sys_48); lv_label_set_text_static(lbl_btn, Symbols::settings); - lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_pos(backgroundLabel, 0, 0); lv_label_set_text_static(backgroundLabel, ""); taskUpdate = lv_task_create(lv_update_task, 500000, LV_TASK_PRIO_MID, this); - } - QuickSettings::~QuickSettings() { lv_task_del(taskUpdate); lv_obj_clean(lv_scr_act()); @@ -126,39 +118,37 @@ QuickSettings::~QuickSettings() { } void QuickSettings::UpdateScreen() { - lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes()); + lv_label_set_text_fmt(label_time, "%02i:%02i", dateTimeController.Hours(), dateTimeController.Minutes()); lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryController.PercentRemaining())); } -void QuickSettings::OnButtonEvent(lv_obj_t *object, lv_event_t event) { - if(object == btn2 && event == LV_EVENT_PRESSED) { - +void QuickSettings::OnButtonEvent(lv_obj_t* object, lv_event_t event) { + if (object == btn2 && event == LV_EVENT_PRESSED) { + running = false; app->StartApp(Apps::FlashLight, DisplayApp::FullRefreshDirections::None); - } else if(object == btn1 && event == LV_EVENT_PRESSED) { - + } else if (object == btn1 && event == LV_EVENT_PRESSED) { + brightness.Step(); lv_label_set_text_static(btn1_lvl, brightness.GetIcon()); - settingsController.SetBrightness( brightness.Level() ); + settingsController.SetBrightness(brightness.Level()); - } else if(object == btn3 && event == LV_EVENT_VALUE_CHANGED) { - - if(lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) { - settingsController.SetVibrationStatus( Controllers::Settings::Vibration::ON ); + } else if (object == btn3 && event == LV_EVENT_VALUE_CHANGED) { + + if (lv_obj_get_state(btn3, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) { + settingsController.SetVibrationStatus(Controllers::Settings::Vibration::ON); lv_label_set_text_static(btn3_lvl, Symbols::notificationsOn); } else { settingsController.SetVibrationStatus(Controllers::Settings::Vibration::OFF); lv_label_set_text_static(btn3_lvl, Symbols::notificationsOff); } - } else if(object == btn4 && event == LV_EVENT_PRESSED) { + } else if (object == btn4 && event == LV_EVENT_PRESSED) { running = false; settingsController.SetSettingsMenu(0); app->StartApp(Apps::Settings, DisplayApp::FullRefreshDirections::Up); - } - } bool QuickSettings::OnTouchEvent(Pinetime::Applications::TouchEvents event) { diff --git a/src/displayapp/screens/settings/QuickSettings.h b/src/displayapp/screens/settings/QuickSettings.h index 329be55b..8d04bec3 100644 --- a/src/displayapp/screens/settings/QuickSettings.h +++ b/src/displayapp/screens/settings/QuickSettings.h @@ -10,47 +10,44 @@ #include "components/settings/Settings.h" #include "components/battery/BatteryController.h" - namespace Pinetime { namespace Applications { namespace Screens { - class QuickSettings : public Screen{ - public: - QuickSettings(DisplayApp* app, - Pinetime::Controllers::Battery& batteryController, - Controllers::DateTime& dateTimeController, - Controllers::BrightnessController& brightness, - Pinetime::Controllers::Settings &settingsController); + class QuickSettings : public Screen { + public: + QuickSettings(DisplayApp* app, + Pinetime::Controllers::Battery& batteryController, + Controllers::DateTime& dateTimeController, + Controllers::BrightnessController& brightness, + Pinetime::Controllers::Settings& settingsController); - ~QuickSettings() override; + ~QuickSettings() override; - bool Refresh() override; - - bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; - void OnButtonEvent(lv_obj_t *object, lv_event_t event); + bool Refresh() override; - void UpdateScreen(); + bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; + void OnButtonEvent(lv_obj_t* object, lv_event_t event); - private: + void UpdateScreen(); - Pinetime::Controllers::Battery& batteryController; - Controllers::DateTime& dateTimeController; - Controllers::BrightnessController& brightness; - Controllers::Settings& settingsController; + private: + Pinetime::Controllers::Battery& batteryController; + Controllers::DateTime& dateTimeController; + Controllers::BrightnessController& brightness; + Controllers::Settings& settingsController; - lv_task_t* taskUpdate; - lv_obj_t * batteryIcon; - lv_obj_t * label_time; - - lv_obj_t * btn1; - lv_obj_t * btn1_lvl; - lv_obj_t * btn2; - lv_obj_t * btn3; - lv_obj_t * btn3_lvl; - lv_obj_t * btn4; + lv_task_t* taskUpdate; + lv_obj_t* batteryIcon; + lv_obj_t* label_time; + lv_obj_t* btn1; + lv_obj_t* btn1_lvl; + lv_obj_t* btn2; + lv_obj_t* btn3; + lv_obj_t* btn3_lvl; + lv_obj_t* btn4; }; } } diff --git a/src/displayapp/screens/settings/SettingDisplay.cpp b/src/displayapp/screens/settings/SettingDisplay.cpp index 6c1bc9b5..4954185d 100644 --- a/src/displayapp/screens/settings/SettingDisplay.cpp +++ b/src/displayapp/screens/settings/SettingDisplay.cpp @@ -8,19 +8,16 @@ using namespace Pinetime::Applications::Screens; namespace { - static void event_handler(lv_obj_t * obj, lv_event_t event) { - SettingDisplay* screen = static_cast(obj->user_data); + static void event_handler(lv_obj_t* obj, lv_event_t event) { + SettingDisplay* screen = static_cast(obj->user_data); screen->UpdateSelected(obj, event); } } -SettingDisplay::SettingDisplay( - Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) : - Screen(app), - settingsController{settingsController} -{ +SettingDisplay::SettingDisplay(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) + : Screen(app), settingsController {settingsController} { - lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr); + lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); @@ -32,31 +29,31 @@ SettingDisplay::SettingDisplay( lv_obj_set_height(container1, LV_VER_RES - 50); lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); - lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(title,"Display timeout"); + lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(title, "Display timeout"); lv_label_set_align(title, LV_LABEL_ALIGN_CENTER); lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 10, 15); - lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); lv_label_set_text_static(icon, Symbols::sun); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); lv_obj_align(icon, title, LV_ALIGN_OUT_LEFT_MID, -10, 0); - + optionsTotal = 0; cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); lv_checkbox_set_text_static(cbOption[optionsTotal], " 5 seconds"); cbOption[optionsTotal]->user_data = this; - lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.GetScreenTimeOut() == 5000 ) { + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.GetScreenTimeOut() == 5000) { lv_checkbox_set_checked(cbOption[optionsTotal], true); } optionsTotal++; cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); lv_checkbox_set_text_static(cbOption[optionsTotal], " 15 seconds"); cbOption[optionsTotal]->user_data = this; - lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.GetScreenTimeOut() == 15000 ) { + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.GetScreenTimeOut() == 15000) { lv_checkbox_set_checked(cbOption[optionsTotal], true); } optionsTotal++; @@ -64,7 +61,7 @@ SettingDisplay::SettingDisplay( lv_checkbox_set_text_static(cbOption[optionsTotal], " 20 seconds"); cbOption[optionsTotal]->user_data = this; lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.GetScreenTimeOut() == 20000 ) { + if (settingsController.GetScreenTimeOut() == 20000) { lv_checkbox_set_checked(cbOption[optionsTotal], true); } optionsTotal++; @@ -72,7 +69,7 @@ SettingDisplay::SettingDisplay( lv_checkbox_set_text_static(cbOption[optionsTotal], " 30 seconds"); cbOption[optionsTotal]->user_data = this; lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.GetScreenTimeOut() == 30000 ) { + if (settingsController.GetScreenTimeOut() == 30000) { lv_checkbox_set_checked(cbOption[optionsTotal], true); } optionsTotal++; @@ -87,18 +84,25 @@ bool SettingDisplay::Refresh() { return running; } - -void SettingDisplay::UpdateSelected(lv_obj_t *object, lv_event_t event) { - if(event == LV_EVENT_VALUE_CHANGED) { - for(int i = 0; i < optionsTotal; i++) { - if ( object == cbOption[i] ) { +void SettingDisplay::UpdateSelected(lv_obj_t* object, lv_event_t event) { + if (event == LV_EVENT_VALUE_CHANGED) { + for (int i = 0; i < optionsTotal; i++) { + if (object == cbOption[i]) { lv_checkbox_set_checked(cbOption[i], true); - - if ( i == 0 ) { settingsController.SetScreenTimeOut(5000); }; - if ( i == 1 ) { settingsController.SetScreenTimeOut(15000); }; - if ( i == 2 ) { settingsController.SetScreenTimeOut(20000); }; - if ( i == 3 ) { settingsController.SetScreenTimeOut(30000); }; - + + if (i == 0) { + settingsController.SetScreenTimeOut(5000); + }; + if (i == 1) { + settingsController.SetScreenTimeOut(15000); + }; + if (i == 2) { + settingsController.SetScreenTimeOut(20000); + }; + if (i == 3) { + settingsController.SetScreenTimeOut(30000); + }; + app->PushMessage(Applications::Display::Messages::UpdateTimeOut); } else { diff --git a/src/displayapp/screens/settings/SettingDisplay.h b/src/displayapp/screens/settings/SettingDisplay.h index 9565d3c7..b8ed87ec 100644 --- a/src/displayapp/screens/settings/SettingDisplay.h +++ b/src/displayapp/screens/settings/SettingDisplay.h @@ -10,20 +10,18 @@ namespace Pinetime { namespace Applications { namespace Screens { - class SettingDisplay : public Screen{ - public: - SettingDisplay(DisplayApp* app, Pinetime::Controllers::Settings &settingsController); - ~SettingDisplay() override; + class SettingDisplay : public Screen { + public: + SettingDisplay(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); + ~SettingDisplay() override; - bool Refresh() override; - void UpdateSelected(lv_obj_t *object, lv_event_t event); - - private: + bool Refresh() override; + void UpdateSelected(lv_obj_t* object, lv_event_t event); - Controllers::Settings& settingsController; - uint8_t optionsTotal; - lv_obj_t * cbOption[4]; - + private: + Controllers::Settings& settingsController; + uint8_t optionsTotal; + lv_obj_t* cbOption[4]; }; } } diff --git a/src/displayapp/screens/settings/SettingTimeFormat.cpp b/src/displayapp/screens/settings/SettingTimeFormat.cpp index ff217bda..031a2a72 100644 --- a/src/displayapp/screens/settings/SettingTimeFormat.cpp +++ b/src/displayapp/screens/settings/SettingTimeFormat.cpp @@ -7,19 +7,16 @@ using namespace Pinetime::Applications::Screens; namespace { - static void event_handler(lv_obj_t * obj, lv_event_t event) { - SettingTimeFormat* screen = static_cast(obj->user_data); + static void event_handler(lv_obj_t* obj, lv_event_t event) { + SettingTimeFormat* screen = static_cast(obj->user_data); screen->UpdateSelected(obj, event); } } -SettingTimeFormat::SettingTimeFormat( - Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) : - Screen(app), - settingsController{settingsController} -{ +SettingTimeFormat::SettingTimeFormat(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) + : Screen(app), settingsController {settingsController} { - lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr); + lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); @@ -31,12 +28,12 @@ SettingTimeFormat::SettingTimeFormat( lv_obj_set_height(container1, LV_VER_RES - 50); lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); - lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(title,"Time format"); + lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(title, "Time format"); lv_label_set_align(title, LV_LABEL_ALIGN_CENTER); lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15); - lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); lv_label_set_text_static(icon, Symbols::clock); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); @@ -46,8 +43,8 @@ SettingTimeFormat::SettingTimeFormat( cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); lv_checkbox_set_text_static(cbOption[optionsTotal], " 12-hour"); cbOption[optionsTotal]->user_data = this; - lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12 ) { + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H12) { lv_checkbox_set_checked(cbOption[optionsTotal], true); } @@ -55,8 +52,8 @@ SettingTimeFormat::SettingTimeFormat( cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); lv_checkbox_set_text_static(cbOption[optionsTotal], " 24-hour"); cbOption[optionsTotal]->user_data = this; - lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24 ) { + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.GetClockType() == Controllers::Settings::ClockType::H24) { lv_checkbox_set_checked(cbOption[optionsTotal], true); } optionsTotal++; @@ -71,16 +68,19 @@ bool SettingTimeFormat::Refresh() { return running; } - -void SettingTimeFormat::UpdateSelected(lv_obj_t *object, lv_event_t event) { - if(event == LV_EVENT_VALUE_CHANGED) { - for(int i = 0; i < optionsTotal; i++) { - if ( object == cbOption[i] ) { +void SettingTimeFormat::UpdateSelected(lv_obj_t* object, lv_event_t event) { + if (event == LV_EVENT_VALUE_CHANGED) { + for (int i = 0; i < optionsTotal; i++) { + if (object == cbOption[i]) { lv_checkbox_set_checked(cbOption[i], true); - - if ( i == 0 ) { settingsController.SetClockType(Controllers::Settings::ClockType::H12); }; - if ( i == 1 ) { settingsController.SetClockType(Controllers::Settings::ClockType::H24); }; - + + if (i == 0) { + settingsController.SetClockType(Controllers::Settings::ClockType::H12); + }; + if (i == 1) { + settingsController.SetClockType(Controllers::Settings::ClockType::H24); + }; + } else { lv_checkbox_set_checked(cbOption[i], false); } diff --git a/src/displayapp/screens/settings/SettingTimeFormat.h b/src/displayapp/screens/settings/SettingTimeFormat.h index a6380493..9203b45b 100644 --- a/src/displayapp/screens/settings/SettingTimeFormat.h +++ b/src/displayapp/screens/settings/SettingTimeFormat.h @@ -10,20 +10,18 @@ namespace Pinetime { namespace Applications { namespace Screens { - class SettingTimeFormat : public Screen{ - public: - SettingTimeFormat(DisplayApp* app, Pinetime::Controllers::Settings &settingsController); - ~SettingTimeFormat() override; + class SettingTimeFormat : public Screen { + public: + SettingTimeFormat(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); + ~SettingTimeFormat() override; - bool Refresh() override; - void UpdateSelected(lv_obj_t *object, lv_event_t event); - - private: + bool Refresh() override; + void UpdateSelected(lv_obj_t* object, lv_event_t event); - Controllers::Settings& settingsController; - uint8_t optionsTotal; - lv_obj_t * cbOption[2]; - + private: + Controllers::Settings& settingsController; + uint8_t optionsTotal; + lv_obj_t* cbOption[2]; }; } } diff --git a/src/displayapp/screens/settings/SettingWakeUp.cpp b/src/displayapp/screens/settings/SettingWakeUp.cpp index 927a9e3a..89f0c098 100644 --- a/src/displayapp/screens/settings/SettingWakeUp.cpp +++ b/src/displayapp/screens/settings/SettingWakeUp.cpp @@ -8,19 +8,16 @@ using namespace Pinetime::Applications::Screens; namespace { - static void event_handler(lv_obj_t * obj, lv_event_t event) { - SettingWakeUp* screen = static_cast(obj->user_data); + static void event_handler(lv_obj_t* obj, lv_event_t event) { + SettingWakeUp* screen = static_cast(obj->user_data); screen->UpdateSelected(obj, event); } } -SettingWakeUp::SettingWakeUp( - Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) : - Screen(app), - settingsController{settingsController} -{ +SettingWakeUp::SettingWakeUp(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) + : Screen(app), settingsController {settingsController} { - lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr); + lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); @@ -32,12 +29,12 @@ SettingWakeUp::SettingWakeUp( lv_obj_set_height(container1, LV_VER_RES - 50); lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); - lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(title,"Wake Up"); + lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(title, "Wake Up"); lv_label_set_align(title, LV_LABEL_ALIGN_CENTER); lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 15, 15); - lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); lv_label_set_text_static(icon, Symbols::clock); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); @@ -47,32 +44,32 @@ SettingWakeUp::SettingWakeUp( cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); lv_checkbox_set_text_static(cbOption[optionsTotal], " None"); cbOption[optionsTotal]->user_data = this; - lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::None ) { + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::None) { lv_checkbox_set_checked(cbOption[optionsTotal], true); } optionsTotal++; cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); lv_checkbox_set_text_static(cbOption[optionsTotal], " Single Tap"); cbOption[optionsTotal]->user_data = this; - lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::SingleTap ) { + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::SingleTap) { lv_checkbox_set_checked(cbOption[optionsTotal], true); } optionsTotal++; cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); lv_checkbox_set_text_static(cbOption[optionsTotal], " Double Tap"); cbOption[optionsTotal]->user_data = this; - lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::DoubleTap ) { + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::DoubleTap) { lv_checkbox_set_checked(cbOption[optionsTotal], true); } optionsTotal++; cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); lv_checkbox_set_text_static(cbOption[optionsTotal], " Raise Wrist"); cbOption[optionsTotal]->user_data = this; - lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist ) { + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) { lv_checkbox_set_checked(cbOption[optionsTotal], true); } optionsTotal++; @@ -87,18 +84,25 @@ bool SettingWakeUp::Refresh() { return running; } - -void SettingWakeUp::UpdateSelected(lv_obj_t *object, lv_event_t event) { - if(event == LV_EVENT_VALUE_CHANGED) { - for(int i = 0; i < optionsTotal; i++) { - if ( object == cbOption[i] ) { +void SettingWakeUp::UpdateSelected(lv_obj_t* object, lv_event_t event) { + if (event == LV_EVENT_VALUE_CHANGED) { + for (int i = 0; i < optionsTotal; i++) { + if (object == cbOption[i]) { lv_checkbox_set_checked(cbOption[i], true); - - if ( i == 0 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::None); }; - if ( i == 1 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::SingleTap); }; - if ( i == 2 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap); }; - if ( i == 3 ) { settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist); }; - + + if (i == 0) { + settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::None); + }; + if (i == 1) { + settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::SingleTap); + }; + if (i == 2) { + settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap); + }; + if (i == 3) { + settingsController.setWakeUpMode(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist); + }; + } else { lv_checkbox_set_checked(cbOption[i], false); } diff --git a/src/displayapp/screens/settings/SettingWakeUp.h b/src/displayapp/screens/settings/SettingWakeUp.h index 86b52837..8b33eb06 100644 --- a/src/displayapp/screens/settings/SettingWakeUp.h +++ b/src/displayapp/screens/settings/SettingWakeUp.h @@ -10,20 +10,18 @@ namespace Pinetime { namespace Applications { namespace Screens { - class SettingWakeUp : public Screen{ - public: - SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings &settingsController); - ~SettingWakeUp() override; + class SettingWakeUp : public Screen { + public: + SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); + ~SettingWakeUp() override; - bool Refresh() override; - void UpdateSelected(lv_obj_t *object, lv_event_t event); - - private: + bool Refresh() override; + void UpdateSelected(lv_obj_t* object, lv_event_t event); - Controllers::Settings& settingsController; - uint8_t optionsTotal; - lv_obj_t * cbOption[4]; - + private: + Controllers::Settings& settingsController; + uint8_t optionsTotal; + lv_obj_t* cbOption[4]; }; } } diff --git a/src/displayapp/screens/settings/SettingWatchFace.cpp b/src/displayapp/screens/settings/SettingWatchFace.cpp index f763acd4..457cebf6 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.cpp +++ b/src/displayapp/screens/settings/SettingWatchFace.cpp @@ -7,21 +7,18 @@ using namespace Pinetime::Applications::Screens; namespace { - static void event_handler(lv_obj_t * obj, lv_event_t event) { - SettingWatchFace* screen = static_cast(obj->user_data); + static void event_handler(lv_obj_t* obj, lv_event_t event) { + SettingWatchFace* screen = static_cast(obj->user_data); screen->UpdateSelected(obj, event); } } -SettingWatchFace::SettingWatchFace( - Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Settings &settingsController) : - Screen(app), - settingsController{settingsController} -{ +SettingWatchFace::SettingWatchFace(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) + : Screen(app), settingsController {settingsController} { - lv_obj_t * container1 = lv_cont_create(lv_scr_act(), nullptr); + lv_obj_t* container1 = lv_cont_create(lv_scr_act(), nullptr); - //lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); + // lv_obj_set_style_local_bg_color(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, lv_color_hex(0x111111)); lv_obj_set_style_local_bg_opa(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_TRANSP); lv_obj_set_style_local_pad_all(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 10); lv_obj_set_style_local_pad_inner(container1, LV_CONT_PART_MAIN, LV_STATE_DEFAULT, 5); @@ -32,12 +29,12 @@ SettingWatchFace::SettingWatchFace( lv_obj_set_height(container1, LV_VER_RES - 50); lv_cont_set_layout(container1, LV_LAYOUT_COLUMN_LEFT); - lv_obj_t * title = lv_label_create(lv_scr_act(), nullptr); - lv_label_set_text_static(title,"Watch face"); + lv_obj_t* title = lv_label_create(lv_scr_act(), nullptr); + lv_label_set_text_static(title, "Watch face"); lv_label_set_align(title, LV_LABEL_ALIGN_CENTER); lv_obj_align(title, lv_scr_act(), LV_ALIGN_IN_TOP_MID, 10, 15); - lv_obj_t * icon = lv_label_create(lv_scr_act(), nullptr); + lv_obj_t* icon = lv_label_create(lv_scr_act(), nullptr); lv_obj_set_style_local_text_color(icon, LV_LABEL_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_ORANGE); lv_label_set_text_static(icon, Symbols::clock); lv_label_set_align(icon, LV_LABEL_ALIGN_CENTER); @@ -47,8 +44,8 @@ SettingWatchFace::SettingWatchFace( cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); lv_checkbox_set_text_static(cbOption[optionsTotal], " Digital face"); cbOption[optionsTotal]->user_data = this; - lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.GetClockFace() == 0 ) { + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.GetClockFace() == 0) { lv_checkbox_set_checked(cbOption[optionsTotal], true); } @@ -56,8 +53,8 @@ SettingWatchFace::SettingWatchFace( cbOption[optionsTotal] = lv_checkbox_create(container1, nullptr); lv_checkbox_set_text_static(cbOption[optionsTotal], " Analog face"); cbOption[optionsTotal]->user_data = this; - lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); - if (settingsController.GetClockFace() == 1 ) { + lv_obj_set_event_cb(cbOption[optionsTotal], event_handler); + if (settingsController.GetClockFace() == 1) { lv_checkbox_set_checked(cbOption[optionsTotal], true); } @@ -73,11 +70,10 @@ bool SettingWatchFace::Refresh() { return running; } - -void SettingWatchFace::UpdateSelected(lv_obj_t *object, lv_event_t event) { - if(event == LV_EVENT_VALUE_CHANGED) { - for(uint8_t i = 0; i < optionsTotal; i++) { - if ( object == cbOption[i] ) { +void SettingWatchFace::UpdateSelected(lv_obj_t* object, lv_event_t event) { + if (event == LV_EVENT_VALUE_CHANGED) { + for (uint8_t i = 0; i < optionsTotal; i++) { + if (object == cbOption[i]) { lv_checkbox_set_checked(cbOption[i], true); settingsController.SetClockFace(i); } else { diff --git a/src/displayapp/screens/settings/SettingWatchFace.h b/src/displayapp/screens/settings/SettingWatchFace.h index 8c30ed28..1930a228 100644 --- a/src/displayapp/screens/settings/SettingWatchFace.h +++ b/src/displayapp/screens/settings/SettingWatchFace.h @@ -10,20 +10,18 @@ namespace Pinetime { namespace Applications { namespace Screens { - class SettingWatchFace : public Screen{ - public: - SettingWatchFace(DisplayApp* app, Pinetime::Controllers::Settings &settingsController); - ~SettingWatchFace() override; + class SettingWatchFace : public Screen { + public: + SettingWatchFace(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); + ~SettingWatchFace() override; - bool Refresh() override; - void UpdateSelected(lv_obj_t *object, lv_event_t event); - - private: + bool Refresh() override; + void UpdateSelected(lv_obj_t* object, lv_event_t event); - Controllers::Settings& settingsController; - uint8_t optionsTotal; - lv_obj_t * cbOption[2]; - + private: + Controllers::Settings& settingsController; + uint8_t optionsTotal; + lv_obj_t* cbOption[2]; }; } } diff --git a/src/displayapp/screens/settings/Settings.cpp b/src/displayapp/screens/settings/Settings.cpp index 06776525..2c72c832 100644 --- a/src/displayapp/screens/settings/Settings.cpp +++ b/src/displayapp/screens/settings/Settings.cpp @@ -8,27 +8,27 @@ using namespace Pinetime::Applications::Screens; -Settings::Settings( - Pinetime::Applications::DisplayApp *app, - Pinetime::Controllers::Settings &settingsController) : - Screen(app), - settingsController{settingsController}, - screens{app, - settingsController.GetSettingsMenu(), - { - [this]() -> std::unique_ptr { return CreateScreen1(); }, - [this]() -> std::unique_ptr { return CreateScreen2(); } - }, - Screens::ScreenListModes::UpDown - } {} +Settings::Settings(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) + : Screen(app), + settingsController {settingsController}, + screens {app, + settingsController.GetSettingsMenu(), + {[this]() -> std::unique_ptr { + return CreateScreen1(); + }, + [this]() -> std::unique_ptr { + return CreateScreen2(); + }}, + Screens::ScreenListModes::UpDown} { +} Settings::~Settings() { lv_obj_clean(lv_scr_act()); } bool Settings::Refresh() { - - if(running) + + if (running) running = screens.Refresh(); return running; } @@ -39,31 +39,24 @@ bool Settings::OnTouchEvent(Pinetime::Applications::TouchEvents event) { std::unique_ptr Settings::CreateScreen1() { - std::array applications { - { - {Symbols::sun, "Display", Apps::SettingDisplay}, - {Symbols::clock, "Wake Up", Apps::SettingWakeUp}, - {Symbols::clock, "Time format", Apps::SettingTimeFormat}, - {Symbols::clock, "Watch face", Apps::SettingWatchFace}, - } - - }; + std::array applications {{ + {Symbols::sun, "Display", Apps::SettingDisplay}, + {Symbols::clock, "Wake Up", Apps::SettingWakeUp}, + {Symbols::clock, "Time format", Apps::SettingTimeFormat}, + {Symbols::clock, "Watch face", Apps::SettingWatchFace}, + }}; return std::unique_ptr(new Screens::List(0, 2, app, settingsController, applications)); } - std::unique_ptr Settings::CreateScreen2() { - std::array applications { - { - {Symbols::shoe, "Steps", Apps::SettingSteps}, - {Symbols::batteryHalf, "Battery", Apps::BatteryInfo}, - {Symbols::check, "Firmware", Apps::FirmwareValidation}, - {Symbols::list, "About", Apps::SysInfo}, - } - - }; + std::array applications {{ + {Symbols::shoe, "Steps", Apps::SettingSteps}, + {Symbols::batteryHalf, "Battery", Apps::BatteryInfo}, + {Symbols::check, "Firmware", Apps::FirmwareValidation}, + {Symbols::list, "About", Apps::SysInfo}, + }}; return std::unique_ptr(new Screens::List(1, 2, app, settingsController, applications)); } diff --git a/src/displayapp/screens/settings/Settings.h b/src/displayapp/screens/settings/Settings.h index 9955e1d4..7e332dfe 100644 --- a/src/displayapp/screens/settings/Settings.h +++ b/src/displayapp/screens/settings/Settings.h @@ -6,31 +6,26 @@ namespace Pinetime { - namespace Applications { namespace Screens { - class Settings : public Screen{ - public: - Settings(DisplayApp* app, - Pinetime::Controllers::Settings &settingsController); - ~Settings() override; + class Settings : public Screen { + public: + Settings(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); + ~Settings() override; - bool Refresh() override; - - void OnButtonEvent(lv_obj_t *object, lv_event_t event); - bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; + bool Refresh() override; - private: + void OnButtonEvent(lv_obj_t* object, lv_event_t event); + bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; - Controllers::Settings& settingsController; - - ScreenList<2> screens; - - std::unique_ptr CreateScreen1(); - std::unique_ptr CreateScreen2(); + private: + Controllers::Settings& settingsController; + ScreenList<2> screens; + std::unique_ptr CreateScreen1(); + std::unique_ptr CreateScreen2(); }; } } diff --git a/src/drivers/Bma421.cpp b/src/drivers/Bma421.cpp index d7a59cf0..925b66c7 100644 --- a/src/drivers/Bma421.cpp +++ b/src/drivers/Bma421.cpp @@ -24,7 +24,7 @@ namespace { } } -Bma421::Bma421(TwiMaster& twiMaster, uint8_t twiAddress) : twiMaster{twiMaster}, deviceAddress{twiAddress} { +Bma421::Bma421(TwiMaster& twiMaster, uint8_t twiAddress) : twiMaster {twiMaster}, deviceAddress {twiAddress} { bma.intf = BMA4_I2C_INTF; bma.bus_read = user_i2c_read; bma.bus_write = user_i2c_write; @@ -35,25 +35,32 @@ Bma421::Bma421(TwiMaster& twiMaster, uint8_t twiAddress) : twiMaster{twiMaster}, } void Bma421::Init() { - if(not isResetOk) return; // Call SoftReset (and reset TWI device) first! + if (not isResetOk) + return; // Call SoftReset (and reset TWI device) first! auto ret = bma423_init(&bma); - if(ret != BMA4_OK) return; + if (ret != BMA4_OK) + return; ret = bma423_write_config_file(&bma); - if(ret != BMA4_OK) return; + if (ret != BMA4_OK) + return; ret = bma4_set_interrupt_mode(BMA4_LATCH_MODE, &bma); - if(ret != BMA4_OK) return; + if (ret != BMA4_OK) + return; ret = bma423_feature_enable(BMA423_STEP_CNTR, 1, &bma); - if(ret != BMA4_OK) return; + if (ret != BMA4_OK) + return; ret = bma423_step_detector_enable(0, &bma); - if(ret != BMA4_OK) return; + if (ret != BMA4_OK) + return; ret = bma4_set_accel_enable(1, &bma); - if(ret != BMA4_OK) return; + if (ret != BMA4_OK) + return; struct bma4_accel_config accel_conf; accel_conf.odr = BMA4_OUTPUT_DATA_RATE_100HZ; @@ -61,7 +68,8 @@ void Bma421::Init() { accel_conf.bandwidth = BMA4_ACCEL_NORMAL_AVG4; accel_conf.perf_mode = BMA4_CIC_AVG_MODE; ret = bma4_set_accel_config(&accel_conf, &bma); - if(ret != BMA4_OK) return; + if (ret != BMA4_OK) + return; isOk = true; } @@ -71,16 +79,17 @@ void Bma421::Reset() { twiMaster.Write(deviceAddress, 0x7E, &data, 1); } -void Bma421::Read(uint8_t registerAddress, uint8_t *buffer, size_t size) { +void Bma421::Read(uint8_t registerAddress, uint8_t* buffer, size_t size) { twiMaster.Read(deviceAddress, registerAddress, buffer, size); } -void Bma421::Write(uint8_t registerAddress, const uint8_t *data, size_t size) { +void Bma421::Write(uint8_t registerAddress, const uint8_t* data, size_t size) { twiMaster.Write(deviceAddress, registerAddress, data, size); } Bma421::Values Bma421::Process() { - if(not isOk) return {}; + if (not isOk) + return {}; struct bma4_accel data; bma4_read_accel_xyz(&data, &bma); @@ -109,7 +118,7 @@ void Bma421::ResetStepCounter() { void Bma421::SoftReset() { auto ret = bma4_soft_reset(&bma); - if(ret == BMA4_OK) { + if (ret == BMA4_OK) { isResetOk = true; nrf_delay_ms(1); } diff --git a/src/drivers/Bma421.h b/src/drivers/Bma421.h index da021cbf..e4d925f5 100644 --- a/src/drivers/Bma421.h +++ b/src/drivers/Bma421.h @@ -25,8 +25,8 @@ namespace Pinetime { Values Process(); void ResetStepCounter(); - void Read(uint8_t registerAddress, uint8_t *buffer, size_t size); - void Write(uint8_t registerAddress, const uint8_t *data, size_t size); + void Read(uint8_t registerAddress, uint8_t* buffer, size_t size); + void Write(uint8_t registerAddress, const uint8_t* data, size_t size); bool IsOk() const; diff --git a/src/drivers/BufferProvider.h b/src/drivers/BufferProvider.h index 1be4317a..53571133 100644 --- a/src/drivers/BufferProvider.h +++ b/src/drivers/BufferProvider.h @@ -5,8 +5,8 @@ namespace Pinetime { namespace Drivers { class BufferProvider { - public: - virtual bool GetNextBuffer(uint8_t** buffer, size_t& size) = 0; + public: + virtual bool GetNextBuffer(uint8_t** buffer, size_t& size) = 0; }; } } \ No newline at end of file diff --git a/src/drivers/Cst816s.cpp b/src/drivers/Cst816s.cpp index e3a37b1b..fd9792b3 100644 --- a/src/drivers/Cst816s.cpp +++ b/src/drivers/Cst816s.cpp @@ -7,14 +7,14 @@ using namespace Pinetime::Drivers; /* References : - * This implementation is based on this article : https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 - * Touch panel datasheet (weird chinese translation) : https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf + * This implementation is based on this article : + * https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Touch panel datasheet (weird chinese + * translation) : https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf * * TODO : we need a complete datasheet and protocol reference! * */ -Cst816S::Cst816S(TwiMaster &twiMaster, uint8_t twiAddress) : twiMaster{twiMaster}, twiAddress{twiAddress} { - +Cst816S::Cst816S(TwiMaster& twiMaster, uint8_t twiAddress) : twiMaster {twiMaster}, twiAddress {twiAddress} { } void Cst816S::Init() { @@ -32,7 +32,7 @@ void Cst816S::Init() { vTaskDelay(5); twiMaster.Read(twiAddress, 0xa7, &dummy, 1); vTaskDelay(5); - + /* [2] EnConLR - Continuous operation can slide around [1] EnConUD - Slide up and down to enable continuous operation @@ -40,23 +40,22 @@ void Cst816S::Init() { */ static constexpr uint8_t motionMask = 0b00000101; twiMaster.Write(twiAddress, 0xEC, &motionMask, 1); - } - Cst816S::TouchInfos Cst816S::GetTouchInfo() { Cst816S::TouchInfos info; auto ret = twiMaster.Read(twiAddress, 0, touchData, sizeof(touchData)); - if(ret != TwiMaster::ErrorCodes::NoError) return {}; + if (ret != TwiMaster::ErrorCodes::NoError) + return {}; auto nbTouchPoints = touchData[2] & 0x0f; uint8_t i = 0; uint8_t pointId = (touchData[touchIdIndex + (touchStep * i)]) >> 4; - if(nbTouchPoints == 0 && pointId == lastTouchId) return info; - + if (nbTouchPoints == 0 && pointId == lastTouchId) + return info; info.isTouch = true; diff --git a/src/drivers/Cst816s.h b/src/drivers/Cst816s.h index 63007860..14c296ea 100644 --- a/src/drivers/Cst816s.h +++ b/src/drivers/Cst816s.h @@ -5,57 +5,58 @@ namespace Pinetime { namespace Drivers { class Cst816S { - public : - enum class Gestures : uint8_t { - None = 0x00, - SlideDown = 0x01, - SlideUp = 0x02, - SlideLeft = 0x03, - SlideRight = 0x04, - SingleTap = 0x05, - DoubleTap = 0x0B, - LongPress = 0x0C - }; - struct TouchInfos { - uint16_t x = 0; - uint16_t y = 0; - uint8_t action = 0; - uint8_t finger = 0; - uint8_t pressure = 0; - uint8_t area = 0; - Gestures gesture = Gestures::None; - bool isTouch = false; - }; + public: + enum class Gestures : uint8_t { + None = 0x00, + SlideDown = 0x01, + SlideUp = 0x02, + SlideLeft = 0x03, + SlideRight = 0x04, + SingleTap = 0x05, + DoubleTap = 0x0B, + LongPress = 0x0C + }; + struct TouchInfos { + uint16_t x = 0; + uint16_t y = 0; + uint8_t action = 0; + uint8_t finger = 0; + uint8_t pressure = 0; + uint8_t area = 0; + Gestures gesture = Gestures::None; + bool isTouch = false; + }; - Cst816S(TwiMaster& twiMaster, uint8_t twiAddress); - Cst816S(const Cst816S&) = delete; - Cst816S& operator=(const Cst816S&) = delete; - Cst816S(Cst816S&&) = delete; - Cst816S& operator=(Cst816S&&) = delete; + Cst816S(TwiMaster& twiMaster, uint8_t twiAddress); + Cst816S(const Cst816S&) = delete; + Cst816S& operator=(const Cst816S&) = delete; + Cst816S(Cst816S&&) = delete; + Cst816S& operator=(Cst816S&&) = delete; - void Init(); - TouchInfos GetTouchInfo(); - void Sleep(); - void Wakeup(); - private: - static constexpr uint8_t pinIrq = 28; - static constexpr uint8_t pinReset = 10; - static constexpr uint8_t lastTouchId = 0x0f; - static constexpr uint8_t touchPointNumIndex = 2; - static constexpr uint8_t touchMiscIndex = 8; - static constexpr uint8_t touchXYIndex = 7; - static constexpr uint8_t touchEventIndex = 3; - static constexpr uint8_t touchXHighIndex = 3; - static constexpr uint8_t touchXLowIndex = 4; - static constexpr uint8_t touchYHighIndex = 5; - static constexpr uint8_t touchYLowIndex = 6; - static constexpr uint8_t touchIdIndex = 5; - static constexpr uint8_t touchStep = 6; - static constexpr uint8_t gestureIndex = 1; + void Init(); + TouchInfos GetTouchInfo(); + void Sleep(); + void Wakeup(); - uint8_t touchData[10]; - TwiMaster& twiMaster; - uint8_t twiAddress; + private: + static constexpr uint8_t pinIrq = 28; + static constexpr uint8_t pinReset = 10; + static constexpr uint8_t lastTouchId = 0x0f; + static constexpr uint8_t touchPointNumIndex = 2; + static constexpr uint8_t touchMiscIndex = 8; + static constexpr uint8_t touchXYIndex = 7; + static constexpr uint8_t touchEventIndex = 3; + static constexpr uint8_t touchXHighIndex = 3; + static constexpr uint8_t touchXLowIndex = 4; + static constexpr uint8_t touchYHighIndex = 5; + static constexpr uint8_t touchYLowIndex = 6; + static constexpr uint8_t touchIdIndex = 5; + static constexpr uint8_t touchStep = 6; + static constexpr uint8_t gestureIndex = 1; + + uint8_t touchData[10]; + TwiMaster& twiMaster; + uint8_t twiAddress; }; } diff --git a/src/drivers/DebugPins.cpp b/src/drivers/DebugPins.cpp index 8457ba5f..56fd1458 100644 --- a/src/drivers/DebugPins.cpp +++ b/src/drivers/DebugPins.cpp @@ -19,31 +19,27 @@ void debugpins_init() { nrf_gpio_pin_clear(DebugPin4); } void debugpins_set(debugpins_pins pin) { - nrf_gpio_pin_set((uint32_t)(pin)); + nrf_gpio_pin_set((uint32_t) (pin)); } void debugpins_clear(debugpins_pins pin) { - nrf_gpio_pin_clear((uint32_t)(pin)); + nrf_gpio_pin_clear((uint32_t) (pin)); } void debugpins_pulse(debugpins_pins pin) { - nrf_gpio_pin_set((uint32_t)(pin)); - nrf_gpio_pin_clear((uint32_t)(pin)); + nrf_gpio_pin_set((uint32_t) (pin)); + nrf_gpio_pin_clear((uint32_t) (pin)); } #else void debugpins_init() { - } void debugpins_set(debugpins_pins pin) { - } void debugpins_clear(debugpins_pins pin) { - } void debugpins_pulse(debugpins_pins pin) { - } #endif \ No newline at end of file diff --git a/src/drivers/DebugPins.h b/src/drivers/DebugPins.h index cb20bac5..b30cd222 100644 --- a/src/drivers/DebugPins.h +++ b/src/drivers/DebugPins.h @@ -22,4 +22,3 @@ void debugpins_pulse(debugpins_pins pin); #ifdef __cplusplus } #endif - diff --git a/src/drivers/Hrs3300.cpp b/src/drivers/Hrs3300.cpp index dc9f9cd8..edb9e81d 100644 --- a/src/drivers/Hrs3300.cpp +++ b/src/drivers/Hrs3300.cpp @@ -16,8 +16,7 @@ using namespace Pinetime::Drivers; /** Driver for the HRS3300 heart rate sensor. * Original implementation from wasp-os : https://github.com/daniel-thompson/wasp-os/blob/master/wasp/drivers/hrs3300.py */ -Hrs3300::Hrs3300(TwiMaster &twiMaster, uint8_t twiAddress) : twiMaster{twiMaster}, twiAddress{twiAddress} { - +Hrs3300::Hrs3300(TwiMaster& twiMaster, uint8_t twiAddress) : twiMaster {twiMaster}, twiAddress {twiAddress} { } void Hrs3300::Init() { @@ -73,7 +72,7 @@ void Hrs3300::SetGain(uint8_t gain) { constexpr uint8_t maxGain = 64U; gain = std::min(gain, maxGain); uint8_t hgain = 0; - while((1 << hgain) < gain){ + while ((1 << hgain) < gain) { ++hgain; } @@ -93,25 +92,14 @@ void Hrs3300::SetDrive(uint8_t drive) { void Hrs3300::WriteRegister(uint8_t reg, uint8_t data) { auto ret = twiMaster.Write(twiAddress, reg, &data, 1); - if(ret != TwiMaster::ErrorCodes::NoError) + if (ret != TwiMaster::ErrorCodes::NoError) NRF_LOG_INFO("WRITE ERROR"); } uint8_t Hrs3300::ReadRegister(uint8_t reg) { uint8_t value; auto ret = twiMaster.Read(twiAddress, reg, &value, 1); - if(ret != TwiMaster::ErrorCodes::NoError) + if (ret != TwiMaster::ErrorCodes::NoError) NRF_LOG_INFO("READ ERROR"); return value; } - - - - - - - - - - - diff --git a/src/drivers/Hrs3300.h b/src/drivers/Hrs3300.h index c34d55c6..c4f28900 100644 --- a/src/drivers/Hrs3300.h +++ b/src/drivers/Hrs3300.h @@ -41,7 +41,6 @@ namespace Pinetime { void WriteRegister(uint8_t reg, uint8_t data); uint8_t ReadRegister(uint8_t reg); - }; } } diff --git a/src/drivers/InternalFlash.cpp b/src/drivers/InternalFlash.cpp index 33c14473..0840c6e5 100644 --- a/src/drivers/InternalFlash.cpp +++ b/src/drivers/InternalFlash.cpp @@ -25,7 +25,7 @@ void InternalFlash::WriteWord(uint32_t address, uint32_t value) { __DSB(); // Write word - *(uint32_t*)address = value; + *(uint32_t*) address = value; Wait(); // Disable write @@ -35,5 +35,7 @@ void InternalFlash::WriteWord(uint32_t address, uint32_t value) { } void InternalFlash::Wait() { - while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {;} + while (NRF_NVMC->READY == NVMC_READY_READY_Busy) { + ; + } } diff --git a/src/drivers/InternalFlash.h b/src/drivers/InternalFlash.h index fd25bf46..3a3c79dc 100644 --- a/src/drivers/InternalFlash.h +++ b/src/drivers/InternalFlash.h @@ -8,6 +8,7 @@ namespace Pinetime { public: static void ErasePage(uint32_t address); static void WriteWord(uint32_t address, uint32_t value); + private: static inline void Wait(); }; diff --git a/src/drivers/Spi.cpp b/src/drivers/Spi.cpp index 0e7de4d5..a55d2888 100644 --- a/src/drivers/Spi.cpp +++ b/src/drivers/Spi.cpp @@ -4,17 +4,16 @@ using namespace Pinetime::Drivers; -Spi::Spi(SpiMaster& spiMaster, uint8_t pinCsn) : - spiMaster{spiMaster}, pinCsn{pinCsn} { +Spi::Spi(SpiMaster& spiMaster, uint8_t pinCsn) : spiMaster {spiMaster}, pinCsn {pinCsn} { nrf_gpio_cfg_output(pinCsn); nrf_gpio_pin_set(pinCsn); } -bool Spi::Write(const uint8_t *data, size_t size) { +bool Spi::Write(const uint8_t* data, size_t size) { return spiMaster.Write(pinCsn, data, size); } -bool Spi::Read(uint8_t* cmd, size_t cmdSize, uint8_t *data, size_t dataSize) { +bool Spi::Read(uint8_t* cmd, size_t cmdSize, uint8_t* data, size_t dataSize) { return spiMaster.Read(pinCsn, cmd, cmdSize, data, dataSize); } @@ -23,7 +22,7 @@ void Spi::Sleep() { NRF_LOG_INFO("[SPI] Sleep") } -bool Spi::WriteCmdAndBuffer(const uint8_t *cmd, size_t cmdSize, const uint8_t *data, size_t dataSize) { +bool Spi::WriteCmdAndBuffer(const uint8_t* cmd, size_t cmdSize, const uint8_t* data, size_t dataSize) { return spiMaster.WriteCmdAndBuffer(pinCsn, cmd, cmdSize, data, dataSize); } @@ -37,5 +36,3 @@ void Spi::Wakeup() { nrf_gpio_pin_set(pinCsn); NRF_LOG_INFO("[SPI] Wakeup") } - - diff --git a/src/drivers/Spi.h b/src/drivers/Spi.h index e3cab459..6875710d 100644 --- a/src/drivers/Spi.h +++ b/src/drivers/Spi.h @@ -6,23 +6,23 @@ namespace Pinetime { namespace Drivers { class Spi { - public: - Spi(SpiMaster& spiMaster, uint8_t pinCsn); - Spi(const Spi&) = delete; - Spi& operator=(const Spi&) = delete; - Spi(Spi&&) = delete; - Spi& operator=(Spi&&) = delete; + public: + Spi(SpiMaster& spiMaster, uint8_t pinCsn); + Spi(const Spi&) = delete; + Spi& operator=(const Spi&) = delete; + Spi(Spi&&) = delete; + Spi& operator=(Spi&&) = delete; - bool Init(); - bool Write(const uint8_t* data, size_t size); - bool Read(uint8_t* cmd, size_t cmdSize, uint8_t *data, size_t dataSize); - bool WriteCmdAndBuffer(const uint8_t* cmd, size_t cmdSize, const uint8_t *data, size_t dataSize); - void Sleep(); - void Wakeup(); + bool Init(); + bool Write(const uint8_t* data, size_t size); + bool Read(uint8_t* cmd, size_t cmdSize, uint8_t* data, size_t dataSize); + bool WriteCmdAndBuffer(const uint8_t* cmd, size_t cmdSize, const uint8_t* data, size_t dataSize); + void Sleep(); + void Wakeup(); - private: - SpiMaster& spiMaster; - uint8_t pinCsn; + private: + SpiMaster& spiMaster; + uint8_t pinCsn; }; } } diff --git a/src/drivers/SpiMaster.cpp b/src/drivers/SpiMaster.cpp index 5f7c0642..34fcc08a 100644 --- a/src/drivers/SpiMaster.cpp +++ b/src/drivers/SpiMaster.cpp @@ -6,8 +6,7 @@ using namespace Pinetime::Drivers; -SpiMaster::SpiMaster(const SpiMaster::SpiModule spi, const SpiMaster::Parameters ¶ms) : - spi{spi}, params{params} { +SpiMaster::SpiMaster(const SpiMaster::SpiModule spi, const SpiMaster::Parameters& params) : spi {spi}, params {params} { mutex = xSemaphoreCreateBinary(); ASSERT(mutex != NULL); } @@ -19,39 +18,58 @@ bool SpiMaster::Init() { nrf_gpio_pin_clear(params.pinMOSI); nrf_gpio_cfg_output(params.pinMOSI); nrf_gpio_cfg_input(params.pinMISO, NRF_GPIO_PIN_NOPULL); -// nrf_gpio_cfg_output(params.pinCSN); -// pinCsn = params.pinCSN; + // nrf_gpio_cfg_output(params.pinCSN); + // pinCsn = params.pinCSN; - switch(spi) { - case SpiModule::SPI0: spiBaseAddress = NRF_SPIM0; break; - case SpiModule::SPI1: spiBaseAddress = NRF_SPIM1; break; - default: return false; + switch (spi) { + case SpiModule::SPI0: + spiBaseAddress = NRF_SPIM0; + break; + case SpiModule::SPI1: + spiBaseAddress = NRF_SPIM1; + break; + default: + return false; } /* Configure pins, frequency and mode */ - spiBaseAddress->PSELSCK = params.pinSCK; + spiBaseAddress->PSELSCK = params.pinSCK; spiBaseAddress->PSELMOSI = params.pinMOSI; spiBaseAddress->PSELMISO = params.pinMISO; uint32_t frequency; - switch(params.Frequency) { - case Frequencies::Freq8Mhz: frequency = 0x80000000; break; - default: return false; + switch (params.Frequency) { + case Frequencies::Freq8Mhz: + frequency = 0x80000000; + break; + default: + return false; } spiBaseAddress->FREQUENCY = frequency; uint32_t regConfig = 0; - switch(params.bitOrder) { - case BitOrder::Msb_Lsb: break; - case BitOrder::Lsb_Msb: regConfig = 1; - default: return false; + switch (params.bitOrder) { + case BitOrder::Msb_Lsb: + break; + case BitOrder::Lsb_Msb: + regConfig = 1; + default: + return false; } - switch(params.mode) { - case Modes::Mode0: break; - case Modes::Mode1: regConfig |= (0x01 << 1); break; - case Modes::Mode2: regConfig |= (0x02 << 1); break; - case Modes::Mode3: regConfig |= (0x03 << 1); break; - default: return false; + switch (params.mode) { + case Modes::Mode0: + break; + case Modes::Mode1: + regConfig |= (0x01 << 1); + break; + case Modes::Mode2: + regConfig |= (0x02 << 1); + break; + case Modes::Mode3: + regConfig |= (0x03 << 1); + break; + default: + return false; } spiBaseAddress->CONFIG = regConfig; @@ -59,24 +77,22 @@ bool SpiMaster::Init() { spiBaseAddress->EVENTS_ENDTX = 0; spiBaseAddress->EVENTS_END = 0; - spiBaseAddress->INTENSET = ((unsigned)1 << (unsigned)6); - spiBaseAddress->INTENSET = ((unsigned)1 << (unsigned)1); - spiBaseAddress->INTENSET = ((unsigned)1 << (unsigned)19); + spiBaseAddress->INTENSET = ((unsigned) 1 << (unsigned) 6); + spiBaseAddress->INTENSET = ((unsigned) 1 << (unsigned) 1); + spiBaseAddress->INTENSET = ((unsigned) 1 << (unsigned) 19); spiBaseAddress->ENABLE = (SPIM_ENABLE_ENABLE_Enabled << SPIM_ENABLE_ENABLE_Pos); - NRFX_IRQ_PRIORITY_SET(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn,2); + NRFX_IRQ_PRIORITY_SET(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn, 2); NRFX_IRQ_ENABLE(SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQn); xSemaphoreGive(mutex); return true; } - -void SpiMaster::SetupWorkaroundForFtpan58(NRF_SPIM_Type *spim, uint32_t ppi_channel, uint32_t gpiote_channel) { +void SpiMaster::SetupWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel) { // Create an event when SCK toggles. - NRF_GPIOTE->CONFIG[gpiote_channel] = (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos) | - (spim->PSEL.SCK << GPIOTE_CONFIG_PSEL_Pos) | + NRF_GPIOTE->CONFIG[gpiote_channel] = (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos) | (spim->PSEL.SCK << GPIOTE_CONFIG_PSEL_Pos) | (GPIOTE_CONFIG_POLARITY_Toggle << GPIOTE_CONFIG_POLARITY_Pos); // Stop the spim instance when SCK toggles. @@ -86,29 +102,29 @@ void SpiMaster::SetupWorkaroundForFtpan58(NRF_SPIM_Type *spim, uint32_t ppi_chan spiBaseAddress->EVENTS_END = 0; // Disable IRQ - spim->INTENCLR = (1<<6); - spim->INTENCLR = (1<<1); - spim->INTENCLR = (1<<19); + spim->INTENCLR = (1 << 6); + spim->INTENCLR = (1 << 1); + spim->INTENCLR = (1 << 19); } -void SpiMaster::DisableWorkaroundForFtpan58(NRF_SPIM_Type *spim, uint32_t ppi_channel, uint32_t gpiote_channel) { +void SpiMaster::DisableWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel) { NRF_GPIOTE->CONFIG[gpiote_channel] = 0; NRF_PPI->CH[ppi_channel].EEP = 0; NRF_PPI->CH[ppi_channel].TEP = 0; NRF_PPI->CHENSET = ppi_channel; spiBaseAddress->EVENTS_END = 0; - spim->INTENSET = (1<<6); - spim->INTENSET = (1<<1); - spim->INTENSET = (1<<19); + spim->INTENSET = (1 << 6); + spim->INTENSET = (1 << 1); + spim->INTENSET = (1 << 19); } void SpiMaster::OnEndEvent() { - if(currentBufferAddr == 0) { + if (currentBufferAddr == 0) { return; } auto s = currentBufferSize; - if(s > 0) { + if (s > 0) { auto currentSize = std::min((size_t) 255, s); PrepareTx(currentBufferAddr, currentSize); currentBufferAddr += currentSize; @@ -116,17 +132,17 @@ void SpiMaster::OnEndEvent() { spiBaseAddress->TASKS_START = 1; } else { - if(taskToNotify != nullptr) { - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - vTaskNotifyGiveFromISR(taskToNotify, &xHigherPriorityTaskWoken); - portYIELD_FROM_ISR(xHigherPriorityTaskWoken); - } - - nrf_gpio_pin_set(this->pinCsn); - currentBufferAddr = 0; + if (taskToNotify != nullptr) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; - xSemaphoreGiveFromISR(mutex, &xHigherPriorityTaskWoken); + vTaskNotifyGiveFromISR(taskToNotify, &xHigherPriorityTaskWoken); portYIELD_FROM_ISR(xHigherPriorityTaskWoken); + } + + nrf_gpio_pin_set(this->pinCsn); + currentBufferAddr = 0; + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + xSemaphoreGiveFromISR(mutex, &xHigherPriorityTaskWoken); + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); } } @@ -143,7 +159,10 @@ void SpiMaster::PrepareTx(const volatile uint32_t bufferAddress, const volatile spiBaseAddress->EVENTS_END = 0; } -void SpiMaster::PrepareRx(const volatile uint32_t cmdAddress, const volatile size_t cmdSize, const volatile uint32_t bufferAddress, const volatile size_t size) { +void SpiMaster::PrepareRx(const volatile uint32_t cmdAddress, + const volatile size_t cmdSize, + const volatile uint32_t bufferAddress, + const volatile size_t size) { spiBaseAddress->TXD.PTR = 0; spiBaseAddress->TXD.MAXCNT = 0; spiBaseAddress->TXD.LIST = 0; @@ -153,35 +172,35 @@ void SpiMaster::PrepareRx(const volatile uint32_t cmdAddress, const volatile siz spiBaseAddress->EVENTS_END = 0; } - -bool SpiMaster::Write(uint8_t pinCsn, const uint8_t *data, size_t size) { - if(data == nullptr) return false; +bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size) { + if (data == nullptr) + return false; auto ok = xSemaphoreTake(mutex, portMAX_DELAY); ASSERT(ok == true); taskToNotify = xTaskGetCurrentTaskHandle(); - this->pinCsn = pinCsn; - if(size == 1) { - SetupWorkaroundForFtpan58(spiBaseAddress, 0,0); + if (size == 1) { + SetupWorkaroundForFtpan58(spiBaseAddress, 0, 0); } else { DisableWorkaroundForFtpan58(spiBaseAddress, 0, 0); } nrf_gpio_pin_clear(this->pinCsn); - currentBufferAddr = (uint32_t)data; + currentBufferAddr = (uint32_t) data; currentBufferSize = size; - auto currentSize = std::min((size_t)255, (size_t)currentBufferSize); + auto currentSize = std::min((size_t) 255, (size_t) currentBufferSize); PrepareTx(currentBufferAddr, currentSize); currentBufferSize -= currentSize; currentBufferAddr += currentSize; spiBaseAddress->TASKS_START = 1; - if(size == 1) { - while (spiBaseAddress->EVENTS_END == 0); + if (size == 1) { + while (spiBaseAddress->EVENTS_END == 0) + ; nrf_gpio_pin_set(this->pinCsn); currentBufferAddr = 0; xSemaphoreGive(mutex); @@ -190,41 +209,41 @@ bool SpiMaster::Write(uint8_t pinCsn, const uint8_t *data, size_t size) { return true; } -bool SpiMaster::Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t *data, size_t dataSize) { - xSemaphoreTake(mutex, portMAX_DELAY); +bool SpiMaster::Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t* data, size_t dataSize) { + xSemaphoreTake(mutex, portMAX_DELAY); - taskToNotify = nullptr; + taskToNotify = nullptr; - this->pinCsn = pinCsn; - DisableWorkaroundForFtpan58(spiBaseAddress, 0,0); - spiBaseAddress->INTENCLR = (1<<6); - spiBaseAddress->INTENCLR = (1<<1); - spiBaseAddress->INTENCLR = (1<<19); + this->pinCsn = pinCsn; + DisableWorkaroundForFtpan58(spiBaseAddress, 0, 0); + spiBaseAddress->INTENCLR = (1 << 6); + spiBaseAddress->INTENCLR = (1 << 1); + spiBaseAddress->INTENCLR = (1 << 19); - nrf_gpio_pin_clear(this->pinCsn); + nrf_gpio_pin_clear(this->pinCsn); + currentBufferAddr = 0; + currentBufferSize = 0; - currentBufferAddr = 0; - currentBufferSize = 0; + PrepareTx((uint32_t) cmd, cmdSize); + spiBaseAddress->TASKS_START = 1; + while (spiBaseAddress->EVENTS_END == 0) + ; - PrepareTx((uint32_t)cmd, cmdSize); - spiBaseAddress->TASKS_START = 1; - while (spiBaseAddress->EVENTS_END == 0); + PrepareRx((uint32_t) cmd, cmdSize, (uint32_t) data, dataSize); + spiBaseAddress->TASKS_START = 1; - PrepareRx((uint32_t)cmd, cmdSize, (uint32_t)data, dataSize); - spiBaseAddress->TASKS_START = 1; + while (spiBaseAddress->EVENTS_END == 0) + ; + nrf_gpio_pin_set(this->pinCsn); - while (spiBaseAddress->EVENTS_END == 0); - nrf_gpio_pin_set(this->pinCsn); + xSemaphoreGive(mutex); - xSemaphoreGive(mutex); - - return true; + return true; } - void SpiMaster::Sleep() { - while(spiBaseAddress->ENABLE != 0) { + while (spiBaseAddress->ENABLE != 0) { spiBaseAddress->ENABLE = (SPIM_ENABLE_ENABLE_Disabled << SPIM_ENABLE_ENABLE_Pos); } nrf_gpio_cfg_default(params.pinSCK); @@ -239,37 +258,35 @@ void SpiMaster::Wakeup() { NRF_LOG_INFO("[SPIMASTER] Wakeup"); } -bool SpiMaster::WriteCmdAndBuffer(uint8_t pinCsn, const uint8_t *cmd, size_t cmdSize, const uint8_t *data, size_t dataSize) { +bool SpiMaster::WriteCmdAndBuffer(uint8_t pinCsn, const uint8_t* cmd, size_t cmdSize, const uint8_t* data, size_t dataSize) { xSemaphoreTake(mutex, portMAX_DELAY); taskToNotify = nullptr; this->pinCsn = pinCsn; - DisableWorkaroundForFtpan58(spiBaseAddress, 0,0); - spiBaseAddress->INTENCLR = (1<<6); - spiBaseAddress->INTENCLR = (1<<1); - spiBaseAddress->INTENCLR = (1<<19); + DisableWorkaroundForFtpan58(spiBaseAddress, 0, 0); + spiBaseAddress->INTENCLR = (1 << 6); + spiBaseAddress->INTENCLR = (1 << 1); + spiBaseAddress->INTENCLR = (1 << 19); nrf_gpio_pin_clear(this->pinCsn); - currentBufferAddr = 0; currentBufferSize = 0; - PrepareTx((uint32_t)cmd, cmdSize); + PrepareTx((uint32_t) cmd, cmdSize); spiBaseAddress->TASKS_START = 1; - while (spiBaseAddress->EVENTS_END == 0); + while (spiBaseAddress->EVENTS_END == 0) + ; - PrepareTx((uint32_t)data, dataSize); + PrepareTx((uint32_t) data, dataSize); spiBaseAddress->TASKS_START = 1; - while (spiBaseAddress->EVENTS_END == 0); + while (spiBaseAddress->EVENTS_END == 0) + ; nrf_gpio_pin_set(this->pinCsn); xSemaphoreGive(mutex); return true; } - - - diff --git a/src/drivers/SpiMaster.h b/src/drivers/SpiMaster.h index cb79d90c..dfc195b7 100644 --- a/src/drivers/SpiMaster.h +++ b/src/drivers/SpiMaster.h @@ -9,54 +9,58 @@ namespace Pinetime { namespace Drivers { class SpiMaster { - public:; - enum class SpiModule : uint8_t {SPI0, SPI1}; - enum class BitOrder : uint8_t {Msb_Lsb, Lsb_Msb}; - enum class Modes : uint8_t {Mode0, Mode1, Mode2, Mode3}; - enum class Frequencies : uint8_t {Freq8Mhz}; - struct Parameters { - BitOrder bitOrder; - Modes mode; - Frequencies Frequency; - uint8_t pinSCK; - uint8_t pinMOSI; - uint8_t pinMISO; - }; + public: + ; + enum class SpiModule : uint8_t { SPI0, SPI1 }; + enum class BitOrder : uint8_t { Msb_Lsb, Lsb_Msb }; + enum class Modes : uint8_t { Mode0, Mode1, Mode2, Mode3 }; + enum class Frequencies : uint8_t { Freq8Mhz }; + struct Parameters { + BitOrder bitOrder; + Modes mode; + Frequencies Frequency; + uint8_t pinSCK; + uint8_t pinMOSI; + uint8_t pinMISO; + }; - SpiMaster(const SpiModule spi, const Parameters& params); - SpiMaster(const SpiMaster&) = delete; - SpiMaster& operator=(const SpiMaster&) = delete; - SpiMaster(SpiMaster&&) = delete; - SpiMaster& operator=(SpiMaster&&) = delete; + SpiMaster(const SpiModule spi, const Parameters& params); + SpiMaster(const SpiMaster&) = delete; + SpiMaster& operator=(const SpiMaster&) = delete; + SpiMaster(SpiMaster&&) = delete; + SpiMaster& operator=(SpiMaster&&) = delete; - bool Init(); - bool Write(uint8_t pinCsn, const uint8_t* data, size_t size); - bool Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t *data, size_t dataSize); + bool Init(); + bool Write(uint8_t pinCsn, const uint8_t* data, size_t size); + bool Read(uint8_t pinCsn, uint8_t* cmd, size_t cmdSize, uint8_t* data, size_t dataSize); - bool WriteCmdAndBuffer(uint8_t pinCsn, const uint8_t* cmd, size_t cmdSize, const uint8_t *data, size_t dataSize); + bool WriteCmdAndBuffer(uint8_t pinCsn, const uint8_t* cmd, size_t cmdSize, const uint8_t* data, size_t dataSize); - void OnStartedEvent(); - void OnEndEvent(); + void OnStartedEvent(); + void OnEndEvent(); - void Sleep(); - void Wakeup(); + void Sleep(); + void Wakeup(); - private: - void SetupWorkaroundForFtpan58(NRF_SPIM_Type *spim, uint32_t ppi_channel, uint32_t gpiote_channel); - void DisableWorkaroundForFtpan58(NRF_SPIM_Type *spim, uint32_t ppi_channel, uint32_t gpiote_channel); - void PrepareTx(const volatile uint32_t bufferAddress, const volatile size_t size); - void PrepareRx(const volatile uint32_t cmdAddress, const volatile size_t cmdSize, const volatile uint32_t bufferAddress, const volatile size_t size); + private: + void SetupWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel); + void DisableWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel); + void PrepareTx(const volatile uint32_t bufferAddress, const volatile size_t size); + void PrepareRx(const volatile uint32_t cmdAddress, + const volatile size_t cmdSize, + const volatile uint32_t bufferAddress, + const volatile size_t size); - NRF_SPIM_Type * spiBaseAddress; - uint8_t pinCsn; + NRF_SPIM_Type* spiBaseAddress; + uint8_t pinCsn; - SpiMaster::SpiModule spi; - SpiMaster::Parameters params; + SpiMaster::SpiModule spi; + SpiMaster::Parameters params; - volatile uint32_t currentBufferAddr = 0; - volatile size_t currentBufferSize = 0; - volatile TaskHandle_t taskToNotify; - SemaphoreHandle_t mutex; + volatile uint32_t currentBufferAddr = 0; + volatile size_t currentBufferSize = 0; + volatile TaskHandle_t taskToNotify; + SemaphoreHandle_t mutex; }; } } diff --git a/src/drivers/SpiNorFlash.cpp b/src/drivers/SpiNorFlash.cpp index 3ea5afe7..068d1d02 100644 --- a/src/drivers/SpiNorFlash.cpp +++ b/src/drivers/SpiNorFlash.cpp @@ -6,17 +6,16 @@ using namespace Pinetime::Drivers; -SpiNorFlash::SpiNorFlash(Spi& spi) : spi{spi} { - +SpiNorFlash::SpiNorFlash(Spi& spi) : spi {spi} { } void SpiNorFlash::Init() { device_id = ReadIdentificaion(); - NRF_LOG_INFO("[SpiNorFlash] Manufacturer : %d, Memory type : %d, memory density : %d", device_id.manufacturer, device_id.type, device_id.density); + NRF_LOG_INFO( + "[SpiNorFlash] Manufacturer : %d, Memory type : %d, memory density : %d", device_id.manufacturer, device_id.type, device_id.density); } void SpiNorFlash::Uninit() { - } void SpiNorFlash::Sleep() { @@ -30,12 +29,11 @@ void SpiNorFlash::Wakeup() { static constexpr uint8_t cmdSize = 4; uint8_t cmd[cmdSize] = {static_cast(Commands::ReleaseFromDeepPowerDown), 0x01, 0x02, 0x03}; uint8_t id = 0; - spi.Read(reinterpret_cast(&cmd), cmdSize, &id, 1); - auto devId = device_id = ReadIdentificaion(); - if(devId.type != device_id.type) { + spi.Read(reinterpret_cast(&cmd), cmdSize, &id, 1); + auto devId = device_id = ReadIdentificaion(); + if (devId.type != device_id.type) { NRF_LOG_INFO("[SpiNorFlash] ID on Wakeup: Failed"); - } - else { + } else { NRF_LOG_INFO("[SpiNorFlash] ID on Wakeup: %d", id); } NRF_LOG_INFO("[SpiNorFlash] Wakeup") @@ -44,7 +42,7 @@ void SpiNorFlash::Wakeup() { SpiNorFlash::Identification SpiNorFlash::ReadIdentificaion() { auto cmd = static_cast(Commands::ReadIdentification); Identification identification; - spi.Read(&cmd, 1, reinterpret_cast(&identification), sizeof(Identification)); + spi.Read(&cmd, 1, reinterpret_cast(&identification), sizeof(Identification)); return identification; } @@ -70,11 +68,10 @@ uint8_t SpiNorFlash::ReadConfigurationRegister() { return status; } -void SpiNorFlash::Read(uint32_t address, uint8_t *buffer, size_t size) { +void SpiNorFlash::Read(uint32_t address, uint8_t* buffer, size_t size) { static constexpr uint8_t cmdSize = 4; - uint8_t cmd[cmdSize] = { static_cast(Commands::Read), (uint8_t)(address >> 16U), (uint8_t)(address >> 8U), - (uint8_t)address }; - spi.Read(reinterpret_cast(&cmd), cmdSize, buffer, size); + uint8_t cmd[cmdSize] = {static_cast(Commands::Read), (uint8_t) (address >> 16U), (uint8_t) (address >> 8U), (uint8_t) address}; + spi.Read(reinterpret_cast(&cmd), cmdSize, buffer, size); } void SpiNorFlash::WriteEnable() { @@ -84,15 +81,19 @@ void SpiNorFlash::WriteEnable() { void SpiNorFlash::SectorErase(uint32_t sectorAddress) { static constexpr uint8_t cmdSize = 4; - uint8_t cmd[cmdSize] = { static_cast(Commands::SectorErase), (uint8_t)(sectorAddress >> 16U), (uint8_t)(sectorAddress >> 8U), - (uint8_t)sectorAddress }; + uint8_t cmd[cmdSize] = {static_cast(Commands::SectorErase), + (uint8_t) (sectorAddress >> 16U), + (uint8_t) (sectorAddress >> 8U), + (uint8_t) sectorAddress}; WriteEnable(); - while(!WriteEnabled()) vTaskDelay(1); + while (!WriteEnabled()) + vTaskDelay(1); - spi.Read(reinterpret_cast(&cmd), cmdSize, nullptr, 0); + spi.Read(reinterpret_cast(&cmd), cmdSize, nullptr, 0); - while(WriteInProgress()) vTaskDelay(1); + while (WriteInProgress()) + vTaskDelay(1); } uint8_t SpiNorFlash::ReadSecurityRegister() { @@ -110,29 +111,29 @@ bool SpiNorFlash::EraseFailed() { return (ReadSecurityRegister() & 0x40u) == 0x40u; } -void SpiNorFlash::Write(uint32_t address, const uint8_t *buffer, size_t size) { +void SpiNorFlash::Write(uint32_t address, const uint8_t* buffer, size_t size) { static constexpr uint8_t cmdSize = 4; size_t len = size; uint32_t addr = address; const uint8_t* b = buffer; - while(len > 0) { + while (len > 0) { uint32_t pageLimit = (addr & ~(pageSize - 1u)) + pageSize; - uint32_t toWrite = pageLimit - addr > len ? len : pageLimit - addr; + uint32_t toWrite = pageLimit - addr > len ? len : pageLimit - addr; - uint8_t cmd[cmdSize] = { static_cast(Commands::PageProgram), (uint8_t)(addr >> 16U), (uint8_t)(addr >> 8U), - (uint8_t)addr }; + uint8_t cmd[cmdSize] = {static_cast(Commands::PageProgram), (uint8_t) (addr >> 16U), (uint8_t) (addr >> 8U), (uint8_t) addr}; WriteEnable(); - while(!WriteEnabled()) vTaskDelay(1); + while (!WriteEnabled()) + vTaskDelay(1); spi.WriteCmdAndBuffer(cmd, cmdSize, b, toWrite); - while(WriteInProgress()) vTaskDelay(1); + while (WriteInProgress()) + vTaskDelay(1); addr += toWrite; b += toWrite; len -= toWrite; } - } diff --git a/src/drivers/SpiNorFlash.h b/src/drivers/SpiNorFlash.h index 7702d434..ed6ab315 100644 --- a/src/drivers/SpiNorFlash.h +++ b/src/drivers/SpiNorFlash.h @@ -6,58 +6,55 @@ namespace Pinetime { namespace Drivers { class Spi; class SpiNorFlash { - public: - explicit SpiNorFlash(Spi& spi); - SpiNorFlash(const SpiNorFlash&) = delete; - SpiNorFlash& operator=(const SpiNorFlash&) = delete; - SpiNorFlash(SpiNorFlash&&) = delete; - SpiNorFlash& operator=(SpiNorFlash&&) = delete; + public: + explicit SpiNorFlash(Spi& spi); + SpiNorFlash(const SpiNorFlash&) = delete; + SpiNorFlash& operator=(const SpiNorFlash&) = delete; + SpiNorFlash(SpiNorFlash&&) = delete; + SpiNorFlash& operator=(SpiNorFlash&&) = delete; - typedef struct __attribute__((packed)) { - uint8_t manufacturer = 0; - uint8_t type = 0; - uint8_t density = 0; - } Identification; + typedef struct __attribute__((packed)) { + uint8_t manufacturer = 0; + uint8_t type = 0; + uint8_t density = 0; + } Identification; - Identification ReadIdentificaion(); - uint8_t ReadStatusRegister(); - bool WriteInProgress(); - bool WriteEnabled(); - uint8_t ReadConfigurationRegister(); - void Read(uint32_t address, uint8_t* buffer, size_t size); - void Write(uint32_t address, const uint8_t *buffer, size_t size); - void WriteEnable(); - void SectorErase(uint32_t sectorAddress); - uint8_t ReadSecurityRegister(); - bool ProgramFailed(); - bool EraseFailed(); + Identification ReadIdentificaion(); + uint8_t ReadStatusRegister(); + bool WriteInProgress(); + bool WriteEnabled(); + uint8_t ReadConfigurationRegister(); + void Read(uint32_t address, uint8_t* buffer, size_t size); + void Write(uint32_t address, const uint8_t* buffer, size_t size); + void WriteEnable(); + void SectorErase(uint32_t sectorAddress); + uint8_t ReadSecurityRegister(); + bool ProgramFailed(); + bool EraseFailed(); + void Init(); + void Uninit(); - void Init(); - void Uninit(); + void Sleep(); + void Wakeup(); + private: + enum class Commands : uint8_t { + PageProgram = 0x02, + Read = 0x03, + ReadStatusRegister = 0x05, + WriteEnable = 0x06, + ReadConfigurationRegister = 0x15, + SectorErase = 0x20, + ReadSecurityRegister = 0x2B, + ReadIdentification = 0x9F, + ReleaseFromDeepPowerDown = 0xAB, + DeepPowerDown = 0xB9 + }; + static constexpr uint16_t pageSize = 256; - void Sleep(); - void Wakeup(); - private: - enum class Commands : uint8_t { - PageProgram = 0x02, - Read = 0x03, - ReadStatusRegister = 0x05, - WriteEnable = 0x06, - ReadConfigurationRegister = 0x15, - SectorErase = 0x20, - ReadSecurityRegister = 0x2B, - ReadIdentification = 0x9F, - ReleaseFromDeepPowerDown = 0xAB, - DeepPowerDown = 0xB9 - }; - static constexpr uint16_t pageSize = 256; - - Spi& spi; - Identification device_id; + Spi& spi; + Identification device_id; }; } } - - diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index 87cbb639..39218e77 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/St7789.cpp @@ -6,11 +6,9 @@ using namespace Pinetime::Drivers; -St7789::St7789(Spi &spi, uint8_t pinDataCommand) : spi{spi}, pinDataCommand{pinDataCommand} { - +St7789::St7789(Spi& spi, uint8_t pinDataCommand) : spi {spi}, pinDataCommand {pinDataCommand} { } - void St7789::Init() { spi.Init(); nrf_gpio_cfg_output(pinDataCommand); @@ -38,9 +36,8 @@ void St7789::WriteData(uint8_t data) { WriteSpi(&data, 1); } - void St7789::WriteSpi(const uint8_t* data, size_t size) { - spi.Write(data, size); + spi.Write(data, size); } void St7789::SoftwareReset() { @@ -105,7 +102,7 @@ void St7789::SetAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1) { WriteData(x1 & 0xff); WriteCommand(static_cast(Commands::RowAddressSet)); - WriteData(y0>>8); + WriteData(y0 >> 8); WriteData(y0 & 0xff); WriteData(y1 >> 8); WriteData(y1 & 0xff); @@ -139,21 +136,20 @@ void St7789::VerticalScrollStartAddress(uint16_t line) { WriteData(line & 0x00ffu); } - void St7789::Uninit() { - } void St7789::DrawPixel(uint16_t x, uint16_t y, uint32_t color) { - if((x < 0) ||(x >= Width) || (y < 0) || (y >= Height)) return; + if ((x < 0) || (x >= Width) || (y < 0) || (y >= Height)) + return; - SetAddrWindow(x, y, x+1, y+1); + SetAddrWindow(x, y, x + 1, y + 1); nrf_gpio_pin_set(pinDataCommand); - WriteSpi(reinterpret_cast(&color), 2); + WriteSpi(reinterpret_cast(&color), 2); } -void St7789::DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t *data, size_t size) { +void St7789::DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t* data, size_t size) { SetAddrWindow(x, y, x + width - 1, y + height - 1); nrf_gpio_pin_set(pinDataCommand); WriteSpi(data, size); diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h index 2c6f9b6b..4fbccbeb 100644 --- a/src/drivers/St7789.h +++ b/src/drivers/St7789.h @@ -6,69 +6,68 @@ namespace Pinetime { namespace Drivers { class Spi; class St7789 { - public: - explicit St7789(Spi& spi, uint8_t pinDataCommand); - St7789(const St7789&) = delete; - St7789& operator=(const St7789&) = delete; - St7789(St7789&&) = delete; - St7789& operator=(St7789&&) = delete; + public: + explicit St7789(Spi& spi, uint8_t pinDataCommand); + St7789(const St7789&) = delete; + St7789& operator=(const St7789&) = delete; + St7789(St7789&&) = delete; + St7789& operator=(St7789&&) = delete; - void Init(); - void Uninit(); - void DrawPixel(uint16_t x, uint16_t y, uint32_t color); + void Init(); + void Uninit(); + void DrawPixel(uint16_t x, uint16_t y, uint32_t color); - void VerticalScrollDefinition(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines); - void VerticalScrollStartAddress(uint16_t line); + void VerticalScrollDefinition(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines); + void VerticalScrollStartAddress(uint16_t line); - void DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t *data, size_t size); + void DrawBuffer(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t* data, size_t size); - void DisplayOn(); - void DisplayOff(); + void DisplayOn(); + void DisplayOff(); - void Sleep(); - void Wakeup(); - private: - Spi& spi; - uint8_t pinDataCommand; - uint8_t verticalScrollingStartAddress = 0; + void Sleep(); + void Wakeup(); - void HardwareReset(); - void SoftwareReset(); - void SleepOut(); - void SleepIn(); - void ColMod(); - void MemoryDataAccessControl(); - void DisplayInversionOn(); - void NormalModeOn(); - void WriteToRam(); - void SetAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); - void WriteCommand(uint8_t cmd); - void WriteSpi(const uint8_t* data, size_t size); + private: + Spi& spi; + uint8_t pinDataCommand; + uint8_t verticalScrollingStartAddress = 0; - enum class Commands : uint8_t { - SoftwareReset = 0x01, - SleepIn = 0x10, - SleepOut = 0x11, - NormalModeOn = 0x13, - DisplayInversionOn = 0x21, - DisplayOff = 0x28, - DisplayOn = 0x29, - ColumnAddressSet = 0x2a, - RowAddressSet = 0x2b, - WriteToRam = 0x2c, - MemoryDataAccessControl = 0x36, - VerticalScrollDefinition = 0x33, - VerticalScrollStartAddress = 0x37, - ColMod = 0x3a, - }; - void WriteData(uint8_t data); - void ColumnAddressSet(); + void HardwareReset(); + void SoftwareReset(); + void SleepOut(); + void SleepIn(); + void ColMod(); + void MemoryDataAccessControl(); + void DisplayInversionOn(); + void NormalModeOn(); + void WriteToRam(); + void SetAddrWindow(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1); + void WriteCommand(uint8_t cmd); + void WriteSpi(const uint8_t* data, size_t size); - static constexpr uint16_t Width = 240; - static constexpr uint16_t Height = 320; - void RowAddressSet(); + enum class Commands : uint8_t { + SoftwareReset = 0x01, + SleepIn = 0x10, + SleepOut = 0x11, + NormalModeOn = 0x13, + DisplayInversionOn = 0x21, + DisplayOff = 0x28, + DisplayOn = 0x29, + ColumnAddressSet = 0x2a, + RowAddressSet = 0x2b, + WriteToRam = 0x2c, + MemoryDataAccessControl = 0x36, + VerticalScrollDefinition = 0x33, + VerticalScrollStartAddress = 0x37, + ColMod = 0x3a, + }; + void WriteData(uint8_t data); + void ColumnAddressSet(); + + static constexpr uint16_t Width = 240; + static constexpr uint16_t Height = 320; + void RowAddressSet(); }; } } - - diff --git a/src/drivers/TwiMaster.cpp b/src/drivers/TwiMaster.cpp index 271b714f..7b6582dd 100644 --- a/src/drivers/TwiMaster.cpp +++ b/src/drivers/TwiMaster.cpp @@ -8,33 +8,39 @@ using namespace Pinetime::Drivers; // TODO use shortcut to automatically send STOP when receive LastTX, for example // TODO use DMA/IRQ -TwiMaster::TwiMaster(const Modules module, const Parameters& params) : module{module}, params{params} { +TwiMaster::TwiMaster(const Modules module, const Parameters& params) : module {module}, params {params} { mutex = xSemaphoreCreateBinary(); } void TwiMaster::Init() { - NRF_GPIO->PIN_CNF[params.pinScl] = ((uint32_t)GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) - | ((uint32_t)GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) - | ((uint32_t)GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) - | ((uint32_t)GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) - | ((uint32_t)GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos); + NRF_GPIO->PIN_CNF[params.pinScl] = + ((uint32_t) GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) | ((uint32_t) GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | + ((uint32_t) GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) | ((uint32_t) GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) | + ((uint32_t) GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos); - NRF_GPIO->PIN_CNF[params.pinSda] = ((uint32_t)GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) - | ((uint32_t)GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) - | ((uint32_t)GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) - | ((uint32_t)GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) - | ((uint32_t)GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos); + NRF_GPIO->PIN_CNF[params.pinSda] = + ((uint32_t) GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) | ((uint32_t) GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | + ((uint32_t) GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) | ((uint32_t) GPIO_PIN_CNF_DRIVE_S0D1 << GPIO_PIN_CNF_DRIVE_Pos) | + ((uint32_t) GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos); - switch(module) { - case Modules::TWIM1: twiBaseAddress = NRF_TWIM1; break; + switch (module) { + case Modules::TWIM1: + twiBaseAddress = NRF_TWIM1; + break; default: return; } - switch(static_cast(params.frequency)) { - case Frequencies::Khz100 : twiBaseAddress->FREQUENCY = TWIM_FREQUENCY_FREQUENCY_K100; break; - case Frequencies::Khz250 : twiBaseAddress->FREQUENCY = TWIM_FREQUENCY_FREQUENCY_K250; break; - case Frequencies::Khz400 : twiBaseAddress->FREQUENCY = TWIM_FREQUENCY_FREQUENCY_K400; break; + switch (static_cast(params.frequency)) { + case Frequencies::Khz100: + twiBaseAddress->FREQUENCY = TWIM_FREQUENCY_FREQUENCY_K100; + break; + case Frequencies::Khz250: + twiBaseAddress->FREQUENCY = TWIM_FREQUENCY_FREQUENCY_K250; + break; + case Frequencies::Khz400: + twiBaseAddress->FREQUENCY = TWIM_FREQUENCY_FREQUENCY_K400; + break; } twiBaseAddress->PSEL.SCL = params.pinScl; @@ -49,7 +55,6 @@ void TwiMaster::Init() { twiBaseAddress->ENABLE = (TWIM_ENABLE_ENABLE_Enabled << TWIM_ENABLE_ENABLE_Pos); - /* // IRQ NVIC_ClearPendingIRQ(_IRQn); NVIC_SetPriority(_IRQn, 2); @@ -57,10 +62,9 @@ void TwiMaster::Init() { */ xSemaphoreGive(mutex); - } -TwiMaster::ErrorCodes TwiMaster::Read(uint8_t deviceAddress, uint8_t registerAddress, uint8_t *data, size_t size) { +TwiMaster::ErrorCodes TwiMaster::Read(uint8_t deviceAddress, uint8_t registerAddress, uint8_t* data, size_t size) { xSemaphoreTake(mutex, portMAX_DELAY); auto ret = Write(deviceAddress, ®isterAddress, 1, false); ret = Read(deviceAddress, data, size, true); @@ -68,7 +72,7 @@ TwiMaster::ErrorCodes TwiMaster::Read(uint8_t deviceAddress, uint8_t registerAdd return ret; } -TwiMaster::ErrorCodes TwiMaster::Write(uint8_t deviceAddress, uint8_t registerAddress, const uint8_t *data, size_t size) { +TwiMaster::ErrorCodes TwiMaster::Write(uint8_t deviceAddress, uint8_t registerAddress, const uint8_t* data, size_t size) { ASSERT(size <= maxDataSize); xSemaphoreTake(mutex, portMAX_DELAY); internalBuffer[0] = registerAddress; @@ -78,22 +82,23 @@ TwiMaster::ErrorCodes TwiMaster::Write(uint8_t deviceAddress, uint8_t registerAd return ret; } -TwiMaster::ErrorCodes TwiMaster::Read(uint8_t deviceAddress, uint8_t *buffer, size_t size, bool stop) { +TwiMaster::ErrorCodes TwiMaster::Read(uint8_t deviceAddress, uint8_t* buffer, size_t size, bool stop) { twiBaseAddress->ADDRESS = deviceAddress; twiBaseAddress->TASKS_RESUME = 0x1UL; - twiBaseAddress->RXD.PTR = (uint32_t)buffer; + twiBaseAddress->RXD.PTR = (uint32_t) buffer; twiBaseAddress->RXD.MAXCNT = size; twiBaseAddress->TASKS_STARTRX = 1; - while(!twiBaseAddress->EVENTS_RXSTARTED && !twiBaseAddress->EVENTS_ERROR); + while (!twiBaseAddress->EVENTS_RXSTARTED && !twiBaseAddress->EVENTS_ERROR) + ; twiBaseAddress->EVENTS_RXSTARTED = 0x0UL; txStartedCycleCount = DWT->CYCCNT; uint32_t currentCycleCount; - while(!twiBaseAddress->EVENTS_LASTRX && !twiBaseAddress->EVENTS_ERROR) { + while (!twiBaseAddress->EVENTS_LASTRX && !twiBaseAddress->EVENTS_ERROR) { currentCycleCount = DWT->CYCCNT; - if ((currentCycleCount-txStartedCycleCount) > HwFreezedDelay) { + if ((currentCycleCount - txStartedCycleCount) > HwFreezedDelay) { FixHwFreezed(); return ErrorCodes::TransactionFailed; } @@ -102,12 +107,13 @@ TwiMaster::ErrorCodes TwiMaster::Read(uint8_t deviceAddress, uint8_t *buffer, si if (stop || twiBaseAddress->EVENTS_ERROR) { twiBaseAddress->TASKS_STOP = 0x1UL; - while(!twiBaseAddress->EVENTS_STOPPED); + while (!twiBaseAddress->EVENTS_STOPPED) + ; twiBaseAddress->EVENTS_STOPPED = 0x0UL; - } - else { + } else { twiBaseAddress->TASKS_SUSPEND = 0x1UL; - while(!twiBaseAddress->EVENTS_SUSPENDED); + while (!twiBaseAddress->EVENTS_SUSPENDED) + ; twiBaseAddress->EVENTS_SUSPENDED = 0x0UL; } @@ -117,22 +123,23 @@ TwiMaster::ErrorCodes TwiMaster::Read(uint8_t deviceAddress, uint8_t *buffer, si return ErrorCodes::NoError; } -TwiMaster::ErrorCodes TwiMaster::Write(uint8_t deviceAddress, const uint8_t *data, size_t size, bool stop) { +TwiMaster::ErrorCodes TwiMaster::Write(uint8_t deviceAddress, const uint8_t* data, size_t size, bool stop) { twiBaseAddress->ADDRESS = deviceAddress; twiBaseAddress->TASKS_RESUME = 0x1UL; - twiBaseAddress->TXD.PTR = (uint32_t)data; + twiBaseAddress->TXD.PTR = (uint32_t) data; twiBaseAddress->TXD.MAXCNT = size; twiBaseAddress->TASKS_STARTTX = 1; - while(!twiBaseAddress->EVENTS_TXSTARTED && !twiBaseAddress->EVENTS_ERROR); + while (!twiBaseAddress->EVENTS_TXSTARTED && !twiBaseAddress->EVENTS_ERROR) + ; twiBaseAddress->EVENTS_TXSTARTED = 0x0UL; txStartedCycleCount = DWT->CYCCNT; uint32_t currentCycleCount; - while(!twiBaseAddress->EVENTS_LASTTX && !twiBaseAddress->EVENTS_ERROR) { + while (!twiBaseAddress->EVENTS_LASTTX && !twiBaseAddress->EVENTS_ERROR) { currentCycleCount = DWT->CYCCNT; - if ((currentCycleCount-txStartedCycleCount) > HwFreezedDelay) { + if ((currentCycleCount - txStartedCycleCount) > HwFreezedDelay) { FixHwFreezed(); return ErrorCodes::TransactionFailed; } @@ -141,12 +148,13 @@ TwiMaster::ErrorCodes TwiMaster::Write(uint8_t deviceAddress, const uint8_t *dat if (stop || twiBaseAddress->EVENTS_ERROR) { twiBaseAddress->TASKS_STOP = 0x1UL; - while(!twiBaseAddress->EVENTS_STOPPED); + while (!twiBaseAddress->EVENTS_STOPPED) + ; twiBaseAddress->EVENTS_STOPPED = 0x0UL; - } - else { + } else { twiBaseAddress->TASKS_SUSPEND = 0x1UL; - while(!twiBaseAddress->EVENTS_SUSPENDED); + while (!twiBaseAddress->EVENTS_SUSPENDED) + ; twiBaseAddress->EVENTS_SUSPENDED = 0x0UL; } @@ -160,7 +168,7 @@ TwiMaster::ErrorCodes TwiMaster::Write(uint8_t deviceAddress, const uint8_t *dat } void TwiMaster::Sleep() { - while(twiBaseAddress->ENABLE != 0) { + while (twiBaseAddress->ENABLE != 0) { twiBaseAddress->ENABLE = (TWIM_ENABLE_ENABLE_Disabled << TWIM_ENABLE_ENABLE_Pos); } nrf_gpio_cfg_default(6); @@ -184,17 +192,15 @@ void TwiMaster::FixHwFreezed() { uint32_t twi_state = NRF_TWI1->ENABLE; twiBaseAddress->ENABLE = TWIM_ENABLE_ENABLE_Disabled << TWI_ENABLE_ENABLE_Pos; - NRF_GPIO->PIN_CNF[params.pinScl] = ((uint32_t)GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) - | ((uint32_t)GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) - | ((uint32_t)GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) - | ((uint32_t)GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) - | ((uint32_t)GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos); + NRF_GPIO->PIN_CNF[params.pinScl] = + ((uint32_t) GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) | ((uint32_t) GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | + ((uint32_t) GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) | ((uint32_t) GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) | + ((uint32_t) GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos); - NRF_GPIO->PIN_CNF[params.pinSda] = ((uint32_t)GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) - | ((uint32_t)GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) - | ((uint32_t)GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) - | ((uint32_t)GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) - | ((uint32_t)GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos); + NRF_GPIO->PIN_CNF[params.pinSda] = + ((uint32_t) GPIO_PIN_CNF_DIR_Input << GPIO_PIN_CNF_DIR_Pos) | ((uint32_t) GPIO_PIN_CNF_INPUT_Connect << GPIO_PIN_CNF_INPUT_Pos) | + ((uint32_t) GPIO_PIN_CNF_PULL_Pullup << GPIO_PIN_CNF_PULL_Pos) | ((uint32_t) GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos) | + ((uint32_t) GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos); // Re-enable I²C twiBaseAddress->ENABLE = twi_state; diff --git a/src/drivers/TwiMaster.h b/src/drivers/TwiMaster.h index f3c87b0a..1c0648a2 100644 --- a/src/drivers/TwiMaster.h +++ b/src/drivers/TwiMaster.h @@ -7,39 +7,38 @@ namespace Pinetime { namespace Drivers { class TwiMaster { - public: - enum class Modules { TWIM1 }; - enum class Frequencies {Khz100, Khz250, Khz400}; - enum class ErrorCodes {NoError, TransactionFailed}; - struct Parameters { - uint32_t frequency; - uint8_t pinSda; - uint8_t pinScl; - }; + public: + enum class Modules { TWIM1 }; + enum class Frequencies { Khz100, Khz250, Khz400 }; + enum class ErrorCodes { NoError, TransactionFailed }; + struct Parameters { + uint32_t frequency; + uint8_t pinSda; + uint8_t pinScl; + }; - TwiMaster(const Modules module, const Parameters& params); + TwiMaster(const Modules module, const Parameters& params); - void Init(); - ErrorCodes Read(uint8_t deviceAddress, uint8_t registerAddress, uint8_t* buffer, size_t size); - ErrorCodes Write(uint8_t deviceAddress, uint8_t registerAddress, const uint8_t* data, size_t size); + void Init(); + ErrorCodes Read(uint8_t deviceAddress, uint8_t registerAddress, uint8_t* buffer, size_t size); + ErrorCodes Write(uint8_t deviceAddress, uint8_t registerAddress, const uint8_t* data, size_t size); - void Sleep(); - void Wakeup(); + void Sleep(); + void Wakeup(); - private: - - ErrorCodes Read(uint8_t deviceAddress, uint8_t* buffer, size_t size, bool stop); - ErrorCodes Write(uint8_t deviceAddress, const uint8_t* data, size_t size, bool stop); - void FixHwFreezed(); - NRF_TWIM_Type* twiBaseAddress; - SemaphoreHandle_t mutex; - const Modules module; - const Parameters params; - static constexpr uint8_t maxDataSize{16}; - static constexpr uint8_t registerSize{1}; - uint8_t internalBuffer[maxDataSize + registerSize]; - uint32_t txStartedCycleCount = 0; - static constexpr uint32_t HwFreezedDelay{161000}; + private: + ErrorCodes Read(uint8_t deviceAddress, uint8_t* buffer, size_t size, bool stop); + ErrorCodes Write(uint8_t deviceAddress, const uint8_t* data, size_t size, bool stop); + void FixHwFreezed(); + NRF_TWIM_Type* twiBaseAddress; + SemaphoreHandle_t mutex; + const Modules module; + const Parameters params; + static constexpr uint8_t maxDataSize {16}; + static constexpr uint8_t registerSize {1}; + uint8_t internalBuffer[maxDataSize + registerSize]; + uint32_t txStartedCycleCount = 0; + static constexpr uint32_t HwFreezedDelay {161000}; }; } } \ No newline at end of file diff --git a/src/drivers/Watchdog.cpp b/src/drivers/Watchdog.cpp index d09fbcd1..a6ad263a 100644 --- a/src/drivers/Watchdog.cpp +++ b/src/drivers/Watchdog.cpp @@ -2,7 +2,6 @@ #include using namespace Pinetime::Drivers; - void Watchdog::Setup(uint8_t timeoutSeconds) { NRF_WDT->CONFIG &= ~(WDT_CONFIG_SLEEP_Msk << WDT_CONFIG_SLEEP_Pos); NRF_WDT->CONFIG |= (WDT_CONFIG_HALT_Run << WDT_CONFIG_SLEEP_Pos); @@ -12,7 +11,7 @@ void Watchdog::Setup(uint8_t timeoutSeconds) { /* timeout (s) = (CRV + 1) / 32768 */ // JF : 7500 = 7.5s - uint32_t crv = (((timeoutSeconds*1000u) << 15u) / 1000) - 1; + uint32_t crv = (((timeoutSeconds * 1000u) << 15u) / 1000) - 1; NRF_WDT->CRV = crv; /* Enable reload requests */ @@ -33,28 +32,46 @@ Watchdog::ResetReasons Watchdog::ActualResetReason() const { uint32_t reason = NRF_POWER->RESETREAS; NRF_POWER->RESETREAS = 0xffffffff; - if(reason & 0x01u) return ResetReasons::ResetPin; - if((reason >> 1u) & 0x01u) return ResetReasons::Watchdog; - if((reason >> 2u) & 0x01u) return ResetReasons::SoftReset; - if((reason >> 3u) & 0x01u) return ResetReasons::CpuLockup; - if((reason >> 16u) & 0x01u) return ResetReasons::SystemOff; - if((reason >> 17u) & 0x01u) return ResetReasons::LpComp; - if((reason) & 0x01u) return ResetReasons::DebugInterface; - if((reason >> 19u) & 0x01u) return ResetReasons::NFC; + if (reason & 0x01u) + return ResetReasons::ResetPin; + if ((reason >> 1u) & 0x01u) + return ResetReasons::Watchdog; + if ((reason >> 2u) & 0x01u) + return ResetReasons::SoftReset; + if ((reason >> 3u) & 0x01u) + return ResetReasons::CpuLockup; + if ((reason >> 16u) & 0x01u) + return ResetReasons::SystemOff; + if ((reason >> 17u) & 0x01u) + return ResetReasons::LpComp; + if ((reason) &0x01u) + return ResetReasons::DebugInterface; + if ((reason >> 19u) & 0x01u) + return ResetReasons::NFC; return ResetReasons::HardReset; } -const char *Watchdog::ResetReasonToString(Watchdog::ResetReasons reason) { - switch(reason) { - case ResetReasons::ResetPin: return "Reset pin"; - case ResetReasons::Watchdog: return "Watchdog"; - case ResetReasons::DebugInterface: return "Debug interface"; - case ResetReasons::LpComp: return "LPCOMP"; - case ResetReasons::SystemOff: return "System OFF"; - case ResetReasons::CpuLockup: return "CPU Lock-up"; - case ResetReasons::SoftReset: return "Soft reset"; - case ResetReasons::NFC: return "NFC"; - case ResetReasons::HardReset: return "Hard reset"; - default: return "Unknown"; +const char* Watchdog::ResetReasonToString(Watchdog::ResetReasons reason) { + switch (reason) { + case ResetReasons::ResetPin: + return "Reset pin"; + case ResetReasons::Watchdog: + return "Watchdog"; + case ResetReasons::DebugInterface: + return "Debug interface"; + case ResetReasons::LpComp: + return "LPCOMP"; + case ResetReasons::SystemOff: + return "System OFF"; + case ResetReasons::CpuLockup: + return "CPU Lock-up"; + case ResetReasons::SoftReset: + return "Soft reset"; + case ResetReasons::NFC: + return "NFC"; + case ResetReasons::HardReset: + return "Hard reset"; + default: + return "Unknown"; } } diff --git a/src/drivers/Watchdog.h b/src/drivers/Watchdog.h index 0c816a4e..03807d61 100644 --- a/src/drivers/Watchdog.h +++ b/src/drivers/Watchdog.h @@ -4,25 +4,31 @@ namespace Pinetime { namespace Drivers { class Watchdog { - public: - enum class ResetReasons { ResetPin, Watchdog, SoftReset, CpuLockup, SystemOff, LpComp, DebugInterface, NFC, HardReset }; - void Setup(uint8_t timeoutSeconds); - void Start(); - void Kick(); - ResetReasons ResetReason() const { return resetReason; } - static const char* ResetReasonToString(ResetReasons reason); - private: - ResetReasons resetReason; - ResetReasons ActualResetReason() const; + public: + enum class ResetReasons { ResetPin, Watchdog, SoftReset, CpuLockup, SystemOff, LpComp, DebugInterface, NFC, HardReset }; + void Setup(uint8_t timeoutSeconds); + void Start(); + void Kick(); + ResetReasons ResetReason() const { + return resetReason; + } + static const char* ResetReasonToString(ResetReasons reason); + + private: + ResetReasons resetReason; + ResetReasons ActualResetReason() const; }; class WatchdogView { - public: - WatchdogView(const Watchdog& watchdog) : watchdog{watchdog} { } - Watchdog::ResetReasons ResetReason() const { return watchdog.ResetReason();} + public: + WatchdogView(const Watchdog& watchdog) : watchdog {watchdog} { + } + Watchdog::ResetReasons ResetReason() const { + return watchdog.ResetReason(); + } - private: - const Watchdog& watchdog; + private: + const Watchdog& watchdog; }; } } diff --git a/src/heartratetask/HeartRateTask.cpp b/src/heartratetask/HeartRateTask.cpp index 5a6d2a5e..36c8cc18 100644 --- a/src/heartratetask/HeartRateTask.cpp +++ b/src/heartratetask/HeartRateTask.cpp @@ -5,10 +5,8 @@ using namespace Pinetime::Applications; -HeartRateTask::HeartRateTask(Drivers::Hrs3300 &heartRateSensor, Controllers::HeartRateController& controller) : - heartRateSensor{heartRateSensor}, - controller{controller}, - ppg{static_cast(heartRateSensor.ReadHrs())} { +HeartRateTask::HeartRateTask(Drivers::Hrs3300& heartRateSensor, Controllers::HeartRateController& controller) + : heartRateSensor {heartRateSensor}, controller {controller}, ppg {static_cast(heartRateSensor.ReadHrs())} { messageQueue = xQueueCreate(10, 1); controller.SetHeartRateTask(this); } @@ -18,8 +16,8 @@ void HeartRateTask::Start() { APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); } -void HeartRateTask::Process(void *instance) { - auto *app = static_cast(instance); +void HeartRateTask::Process(void* instance) { + auto* app = static_cast(instance); app->Work(); } @@ -29,8 +27,10 @@ void HeartRateTask::Work() { Messages msg; uint32_t delay; if (state == States::Running) { - if (measurementStarted) delay = 40; - else delay = 100; + if (measurementStarted) + delay = 40; + else + delay = 100; } else delay = portMAX_DELAY; @@ -42,19 +42,21 @@ void HeartRateTask::Work() { break; case Messages::WakeUp: state = States::Running; - if(measurementStarted) { + if (measurementStarted) { lastBpm = 0; StartMeasurement(); } break; case Messages::StartMeasurement: - if(measurementStarted) break; + if (measurementStarted) + break; lastBpm = 0; StartMeasurement(); measurementStarted = true; break; case Messages::StopMeasurement: - if(!measurementStarted) break; + if (!measurementStarted) + break; StopMeasurement(); measurementStarted = false; break; @@ -66,8 +68,9 @@ void HeartRateTask::Work() { ppg.Preprocess(hrs); auto bpm = ppg.HeartRate(); - if (lastBpm == 0 && bpm == 0) controller.Update(Controllers::HeartRateController::States::NotEnoughData, 0); - if(bpm != 0) { + if (lastBpm == 0 && bpm == 0) + controller.Update(Controllers::HeartRateController::States::NotEnoughData, 0); + if (bpm != 0) { lastBpm = bpm; controller.Update(Controllers::HeartRateController::States::Running, lastBpm); } diff --git a/src/heartratetask/HeartRateTask.h b/src/heartratetask/HeartRateTask.h index f142af1a..0796dc74 100644 --- a/src/heartratetask/HeartRateTask.h +++ b/src/heartratetask/HeartRateTask.h @@ -4,19 +4,18 @@ #include #include - namespace Pinetime { namespace Drivers { class Hrs3300; } - namespace Controllers{ + namespace Controllers { class HeartRateController; } namespace Applications { class HeartRateTask { public: - enum class Messages : uint8_t {GoToSleep, WakeUp, StartMeasurement, StopMeasurement }; - enum class States {Idle, Running}; + enum class Messages : uint8_t { GoToSleep, WakeUp, StartMeasurement, StopMeasurement }; + enum class States { Idle, Running }; explicit HeartRateTask(Drivers::Hrs3300& heartRateSensor, Controllers::HeartRateController& controller); void Start(); @@ -31,13 +30,11 @@ namespace Pinetime { TaskHandle_t taskHandle; QueueHandle_t messageQueue; States state = States::Running; - Drivers::Hrs3300 &heartRateSensor; + Drivers::Hrs3300& heartRateSensor; Controllers::HeartRateController& controller; Controllers::Ppg ppg; bool measurementStarted = false; - }; } } - diff --git a/src/logging/DummyLogger.h b/src/logging/DummyLogger.h index 0aa72882..8732dff5 100644 --- a/src/logging/DummyLogger.h +++ b/src/logging/DummyLogger.h @@ -2,12 +2,13 @@ #include "Logger.h" namespace Pinetime { - namespace Logging{ - class DummyLogger : public Logger { + namespace Logging { + class DummyLogger : public Logger { public: - void Init() override {} - void Resume() override {} - }; + void Init() override { + } + void Resume() override { + } + }; } } - diff --git a/src/logging/Logger.h b/src/logging/Logger.h index 95d21dc4..093a9420 100644 --- a/src/logging/Logger.h +++ b/src/logging/Logger.h @@ -3,9 +3,9 @@ namespace Pinetime { namespace Logging { class Logger { - public: - virtual void Init() = 0; - virtual void Resume() = 0; + public: + virtual void Init() = 0; + virtual void Resume() = 0; }; } } \ No newline at end of file diff --git a/src/logging/NrfLogger.cpp b/src/logging/NrfLogger.cpp index 9f7624be..70a00e61 100644 --- a/src/logging/NrfLogger.cpp +++ b/src/logging/NrfLogger.cpp @@ -18,19 +18,17 @@ void NrfLogger::Init() { void NrfLogger::Process(void*) { NRF_LOG_INFO("Logger task started!"); - // Suppress endless loop diagnostic - #pragma clang diagnostic push - #pragma ide diagnostic ignored "EndlessLoop" +// Suppress endless loop diagnostic +#pragma clang diagnostic push +#pragma ide diagnostic ignored "EndlessLoop" while (1) { NRF_LOG_FLUSH(); vTaskDelay(100); // Not good for power consumption, it will wake up every 100ms... } - // Clear diagnostic suppression - #pragma clang diagnostic pop +// Clear diagnostic suppression +#pragma clang diagnostic pop } void NrfLogger::Resume() { vTaskResume(m_logger_thread); } - - diff --git a/src/logging/NrfLogger.h b/src/logging/NrfLogger.h index fb68b919..060c4e76 100644 --- a/src/logging/NrfLogger.h +++ b/src/logging/NrfLogger.h @@ -5,16 +5,15 @@ #include namespace Pinetime { - namespace Logging{ + namespace Logging { class NrfLogger : public Logger { - public: - void Init() override; - void Resume() override; + public: + void Init() override; + void Resume() override; - private: - static void Process(void*); - TaskHandle_t m_logger_thread; + private: + static void Process(void*); + TaskHandle_t m_logger_thread; }; } } - diff --git a/src/main.cpp b/src/main.cpp index 9470bdb9..04cef6b5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,10 +43,10 @@ #include "systemtask/SystemTask.h" #if NRF_LOG_ENABLED -#include "logging/NrfLogger.h" + #include "logging/NrfLogger.h" Pinetime::Logging::NrfLogger logger; #else -#include "logging/DummyLogger.h" + #include "logging/DummyLogger.h" Pinetime::Logging::DummyLogger logger; #endif @@ -64,15 +64,13 @@ static constexpr uint8_t touchPanelTwiAddress = 0x15; static constexpr uint8_t motionSensorTwiAddress = 0x18; static constexpr uint8_t heartRateSensorTwiAddress = 0x44; -Pinetime::Drivers::SpiMaster spi{Pinetime::Drivers::SpiMaster::SpiModule::SPI0, { - Pinetime::Drivers::SpiMaster::BitOrder::Msb_Lsb, - Pinetime::Drivers::SpiMaster::Modes::Mode3, - Pinetime::Drivers::SpiMaster::Frequencies::Freq8Mhz, - pinSpiSck, - pinSpiMosi, - pinSpiMiso - } -}; +Pinetime::Drivers::SpiMaster spi {Pinetime::Drivers::SpiMaster::SpiModule::SPI0, + {Pinetime::Drivers::SpiMaster::BitOrder::Msb_Lsb, + Pinetime::Drivers::SpiMaster::Modes::Mode3, + Pinetime::Drivers::SpiMaster::Frequencies::Freq8Mhz, + pinSpiSck, + pinSpiMosi, + pinSpiMiso}}; Pinetime::Drivers::Spi lcdSpi {spi, pinLcdCsn}; Pinetime::Drivers::St7789 lcd {lcdSpi, pinLcdDataCommand}; @@ -83,27 +81,25 @@ Pinetime::Drivers::SpiNorFlash spiNorFlash {flashSpi}; // The TWI device should work @ up to 400Khz but there is a HW bug which prevent it from // respecting correct timings. According to erratas heet, this magic value makes it run // at ~390Khz with correct timings. -static constexpr uint32_t MaxTwiFrequencyWithoutHardwareBug{0x06200000}; -Pinetime::Drivers::TwiMaster twiMaster{Pinetime::Drivers::TwiMaster::Modules::TWIM1, - Pinetime::Drivers::TwiMaster::Parameters { - MaxTwiFrequencyWithoutHardwareBug, pinTwiSda, pinTwiScl}}; +static constexpr uint32_t MaxTwiFrequencyWithoutHardwareBug {0x06200000}; +Pinetime::Drivers::TwiMaster twiMaster {Pinetime::Drivers::TwiMaster::Modules::TWIM1, + Pinetime::Drivers::TwiMaster::Parameters {MaxTwiFrequencyWithoutHardwareBug, pinTwiSda, pinTwiScl}}; Pinetime::Drivers::Cst816S touchPanel {twiMaster, touchPanelTwiAddress}; #ifdef PINETIME_IS_RECOVERY static constexpr bool isFactory = true; -#include "displayapp/DummyLittleVgl.h" -#include "displayapp/DisplayAppRecovery.h" + #include "displayapp/DummyLittleVgl.h" + #include "displayapp/DisplayAppRecovery.h" Pinetime::Components::LittleVgl lvgl {lcd, touchPanel}; #else static constexpr bool isFactory = false; -#include "displayapp/LittleVgl.h" -#include "displayapp/DisplayApp.h" + #include "displayapp/LittleVgl.h" + #include "displayapp/DisplayApp.h" Pinetime::Components::LittleVgl lvgl {lcd, touchPanel}; #endif -Pinetime::Drivers::Bma421 motionSensor{twiMaster, motionSensorTwiAddress}; +Pinetime::Drivers::Bma421 motionSensor {twiMaster, motionSensorTwiAddress}; Pinetime::Drivers::Hrs3300 heartRateSensor {twiMaster, heartRateSensorTwiAddress}; - TimerHandle_t debounceTimer; Pinetime::Controllers::Battery batteryController; Pinetime::Controllers::Ble bleController; @@ -112,14 +108,14 @@ void ble_manager_set_ble_disconnection_callback(void (*disconnection)()); static constexpr uint8_t pinTouchIrq = 28; std::unique_ptr systemTask; -Pinetime::Controllers::Settings settingsController{spiNorFlash}; +Pinetime::Controllers::Settings settingsController {spiNorFlash}; -Pinetime::Controllers::MotorController motorController{settingsController}; +Pinetime::Controllers::MotorController motorController {settingsController}; void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) { - if(pin == pinTouchIrq) { + if (pin == pinTouchIrq) { systemTask->OnTouchEvent(); - return ; + return; } BaseType_t xHigherPriorityTaskWoken = pdFALSE; @@ -128,10 +124,10 @@ void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action } extern "C" { - void vApplicationIdleHook(void) { - if(!isFactory) - lv_tick_inc(1); - } +void vApplicationIdleHook(void) { + if (!isFactory) + lv_tick_inc(1); +} } void DebounceTimerCallback(TimerHandle_t xTimer) { @@ -140,25 +136,24 @@ void DebounceTimerCallback(TimerHandle_t xTimer) { } void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void) { - if(((NRF_SPIM0->INTENSET & (1<<6)) != 0) && NRF_SPIM0->EVENTS_END == 1) { + if (((NRF_SPIM0->INTENSET & (1 << 6)) != 0) && NRF_SPIM0->EVENTS_END == 1) { NRF_SPIM0->EVENTS_END = 0; spi.OnEndEvent(); } - if(((NRF_SPIM0->INTENSET & (1<<19)) != 0) && NRF_SPIM0->EVENTS_STARTED == 1) { + if (((NRF_SPIM0->INTENSET & (1 << 19)) != 0) && NRF_SPIM0->EVENTS_STARTED == 1) { NRF_SPIM0->EVENTS_STARTED = 0; spi.OnStartedEvent(); } - if(((NRF_SPIM0->INTENSET & (1<<1)) != 0) && NRF_SPIM0->EVENTS_STOPPED == 1) { + if (((NRF_SPIM0->INTENSET & (1 << 1)) != 0) && NRF_SPIM0->EVENTS_STOPPED == 1) { NRF_SPIM0->EVENTS_STOPPED = 0; } } -static void (*radio_isr_addr)(void) ; -static void (*rng_isr_addr)(void) ; -static void (*rtc0_isr_addr)(void) ; - +static void (*radio_isr_addr)(void); +static void (*rng_isr_addr)(void); +static void (*rtc0_isr_addr)(void); /* Some interrupt handlers required for NimBLE radio driver */ extern "C" { @@ -192,8 +187,7 @@ void npl_freertos_hw_set_isr(int irqn, void (*addr)(void)) { } } -uint32_t -npl_freertos_hw_enter_critical(void) { +uint32_t npl_freertos_hw_enter_critical(void) { uint32_t ctx = __get_PRIMASK(); __disable_irq(); return (ctx & 0x01); @@ -205,16 +199,14 @@ void npl_freertos_hw_exit_critical(uint32_t ctx) { } } - static struct ble_npl_eventq g_eventq_dflt; -struct ble_npl_eventq * -nimble_port_get_dflt_eventq(void) { +struct ble_npl_eventq* nimble_port_get_dflt_eventq(void) { return &g_eventq_dflt; } void nimble_port_run(void) { - struct ble_npl_event *ev; + struct ble_npl_event* ev; while (1) { ev = ble_npl_eventq_get(&g_eventq_dflt, BLE_NPL_TIME_FOREVER); @@ -222,7 +214,7 @@ void nimble_port_run(void) { } } -void BleHost(void *) { +void BleHost(void*) { nimble_port_run(); } @@ -244,8 +236,8 @@ void nimble_port_init(void) { nimble_port_freertos_init(BleHost); } -void nimble_port_ll_task_func(void *args) { - extern void ble_ll_task(void *); +void nimble_port_ll_task_func(void* args) { + extern void ble_ll_task(void*); ble_ll_task(args); } } @@ -255,10 +247,20 @@ int main(void) { nrf_drv_clock_init(); - debounceTimer = xTimerCreate ("debounceTimer", 200, pdFALSE, (void *) 0, DebounceTimerCallback); + debounceTimer = xTimerCreate("debounceTimer", 200, pdFALSE, (void*) 0, DebounceTimerCallback); - systemTask = std::make_unique(spi, lcd, spiNorFlash, twiMaster, touchPanel, lvgl, batteryController, bleController, - motorController, heartRateSensor, motionSensor, settingsController); + systemTask = std::make_unique(spi, + lcd, + spiNorFlash, + twiMaster, + touchPanel, + lvgl, + batteryController, + bleController, + motorController, + heartRateSensor, + motionSensor, + settingsController); systemTask->Start(); nimble_port_init(); @@ -268,7 +270,3 @@ int main(void) { APP_ERROR_HANDLER(NRF_ERROR_FORBIDDEN); } } - - - - diff --git a/src/recoveryLoader.cpp b/src/recoveryLoader.cpp index 9ed062e2..9818179d 100644 --- a/src/recoveryLoader.cpp +++ b/src/recoveryLoader.cpp @@ -19,12 +19,11 @@ #include "displayapp/icons/infinitime/infinitime-nb.c" #include "components/rle/RleDecoder.h" - #if NRF_LOG_ENABLED -#include "logging/NrfLogger.h" + #include "logging/NrfLogger.h" Pinetime::Logging::NrfLogger logger; #else -#include "logging/DummyLogger.h" + #include "logging/DummyLogger.h" Pinetime::Logging::DummyLogger logger; #endif @@ -42,22 +41,20 @@ static constexpr uint8_t bytesPerPixel = 2; static constexpr uint16_t colorWhite = 0xFFFF; static constexpr uint16_t colorGreen = 0xE007; -Pinetime::Drivers::SpiMaster spi{Pinetime::Drivers::SpiMaster::SpiModule::SPI0, { - Pinetime::Drivers::SpiMaster::BitOrder::Msb_Lsb, - Pinetime::Drivers::SpiMaster::Modes::Mode3, - Pinetime::Drivers::SpiMaster::Frequencies::Freq8Mhz, - pinSpiSck, - pinSpiMosi, - pinSpiMiso -} -}; -Pinetime::Drivers::Spi flashSpi{spi, pinSpiFlashCsn}; -Pinetime::Drivers::SpiNorFlash spiNorFlash{flashSpi}; +Pinetime::Drivers::SpiMaster spi {Pinetime::Drivers::SpiMaster::SpiModule::SPI0, + {Pinetime::Drivers::SpiMaster::BitOrder::Msb_Lsb, + Pinetime::Drivers::SpiMaster::Modes::Mode3, + Pinetime::Drivers::SpiMaster::Frequencies::Freq8Mhz, + pinSpiSck, + pinSpiMosi, + pinSpiMiso}}; +Pinetime::Drivers::Spi flashSpi {spi, pinSpiFlashCsn}; +Pinetime::Drivers::SpiNorFlash spiNorFlash {flashSpi}; Pinetime::Drivers::Spi lcdSpi {spi, pinLcdCsn}; Pinetime::Drivers::St7789 lcd {lcdSpi, pinLcdDataCommand}; -Pinetime::Components::Gfx gfx{lcd}; +Pinetime::Components::Gfx gfx {lcd}; Pinetime::Controllers::BrightnessController brightnessController; void DisplayProgressBar(uint8_t percent, uint16_t color); @@ -66,21 +63,20 @@ void DisplayLogo(); extern "C" { void vApplicationIdleHook(void) { - } void SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler(void) { - if(((NRF_SPIM0->INTENSET & (1<<6)) != 0) && NRF_SPIM0->EVENTS_END == 1) { + if (((NRF_SPIM0->INTENSET & (1 << 6)) != 0) && NRF_SPIM0->EVENTS_END == 1) { NRF_SPIM0->EVENTS_END = 0; spi.OnEndEvent(); } - if(((NRF_SPIM0->INTENSET & (1<<19)) != 0) && NRF_SPIM0->EVENTS_STARTED == 1) { + if (((NRF_SPIM0->INTENSET & (1 << 19)) != 0) && NRF_SPIM0->EVENTS_STARTED == 1) { NRF_SPIM0->EVENTS_STARTED = 0; spi.OnStartedEvent(); } - if(((NRF_SPIM0->INTENSET & (1<<1)) != 0) && NRF_SPIM0->EVENTS_STOPPED == 1) { + if (((NRF_SPIM0->INTENSET & (1 << 1)) != 0) && NRF_SPIM0->EVENTS_STOPPED == 1) { NRF_SPIM0->EVENTS_STOPPED = 0; } } @@ -115,7 +111,7 @@ void Process(void* instance) { NRF_LOG_INFO("Writing factory image..."); static constexpr uint32_t memoryChunkSize = 200; uint8_t writeBuffer[memoryChunkSize]; - for(size_t offset = 0; offset < sizeof(recoveryImage); offset+=memoryChunkSize) { + for (size_t offset = 0; offset < sizeof(recoveryImage); offset += memoryChunkSize) { std::memcpy(writeBuffer, &recoveryImage[offset], memoryChunkSize); spiNorFlash.Write(offset, writeBuffer, memoryChunkSize); DisplayProgressBar((static_cast(offset) / static_cast(sizeof(recoveryImage))) * 100.0f, colorWhite); @@ -124,27 +120,27 @@ void Process(void* instance) { NRF_LOG_INFO("Writing factory image done!"); DisplayProgressBar(100.0f, colorGreen); - while(1) { - asm("nop" ); + while (1) { + asm("nop"); } } void DisplayLogo() { Pinetime::Tools::RleDecoder rleDecoder(infinitime_nb, sizeof(infinitime_nb)); - for(int i = 0; i < displayWidth; i++) { + for (int i = 0; i < displayWidth; i++) { rleDecoder.DecodeNext(displayBuffer, displayWidth * bytesPerPixel); ulTaskNotifyTake(pdTRUE, 500); - lcd.DrawBuffer(0, i, displayWidth, 1, reinterpret_cast(displayBuffer), displayWidth * bytesPerPixel); + lcd.DrawBuffer(0, i, displayWidth, 1, reinterpret_cast(displayBuffer), displayWidth * bytesPerPixel); } } void DisplayProgressBar(uint8_t percent, uint16_t color) { static constexpr uint8_t barHeight = 20; - std::fill(displayBuffer, displayBuffer+(displayWidth * bytesPerPixel), color); - for(int i = 0; i < barHeight; i++) { + std::fill(displayBuffer, displayBuffer + (displayWidth * bytesPerPixel), color); + for (int i = 0; i < barHeight; i++) { ulTaskNotifyTake(pdTRUE, 500); uint16_t barWidth = std::min(static_cast(percent) * 2.4f, static_cast(displayWidth)); - lcd.DrawBuffer(0, displayWidth - barHeight + i, barWidth, 1, reinterpret_cast(displayBuffer), barWidth * bytesPerPixel); + lcd.DrawBuffer(0, displayWidth - barHeight + i, barWidth, 1, reinterpret_cast(displayBuffer), barWidth * bytesPerPixel); } } diff --git a/src/sdk_config.h b/src/sdk_config.h index bc97ef14..38d47a7f 100644 --- a/src/sdk_config.h +++ b/src/sdk_config.h @@ -38,115 +38,110 @@ * */ - - #ifndef SDK_CONFIG_H #define SDK_CONFIG_H // <<< Use Configuration Wizard in Context Menu >>>\n #ifdef USE_APP_CONFIG -#include "app_config.h" + #include "app_config.h" #endif -// nRF_ANT +// nRF_ANT //========================================================== // ANTFS_ENABLED - ant_fs - ANT File Share module. //========================================================== #ifndef ANTFS_ENABLED -#define ANTFS_ENABLED 0 + #define ANTFS_ENABLED 0 #endif -// ANTFS_CONFIG_NETWORK_NUMBER - ANT-FS network number. +// ANTFS_CONFIG_NETWORK_NUMBER - ANT-FS network number. #ifndef ANTFS_CONFIG_NETWORK_NUMBER -#define ANTFS_CONFIG_NETWORK_NUMBER 0 + #define ANTFS_CONFIG_NETWORK_NUMBER 0 #endif -// ANTFS_CONFIG_CHANNEL_NUMBER - ANT-FS channel number. +// ANTFS_CONFIG_CHANNEL_NUMBER - ANT-FS channel number. #ifndef ANTFS_CONFIG_CHANNEL_NUMBER -#define ANTFS_CONFIG_CHANNEL_NUMBER 0 + #define ANTFS_CONFIG_CHANNEL_NUMBER 0 #endif -// ANTFS_CONFIG_PAIRING_TIMEOUT - Pairing timeout - how long the UI will wait for a response to a pairing request before switching to the link layer, in seconds. +// ANTFS_CONFIG_PAIRING_TIMEOUT - Pairing timeout - how long the UI will wait for a response to a pairing request before switching to +// the link layer, in seconds. #ifndef ANTFS_CONFIG_PAIRING_TIMEOUT -#define ANTFS_CONFIG_PAIRING_TIMEOUT 120 + #define ANTFS_CONFIG_PAIRING_TIMEOUT 120 #endif -// ANTFS_CONFIG_LINK_COMMAND_TIMEOUT - Command timeout - how long the client will wait without receiving any commands before switching to the link layer, in seconds. +// ANTFS_CONFIG_LINK_COMMAND_TIMEOUT - Command timeout - how long the client will wait without receiving any commands before switching +// to the link layer, in seconds. #ifndef ANTFS_CONFIG_LINK_COMMAND_TIMEOUT -#define ANTFS_CONFIG_LINK_COMMAND_TIMEOUT 10 + #define ANTFS_CONFIG_LINK_COMMAND_TIMEOUT 10 #endif -// ANTFS_CONFIG_TRANS_TYPE - ANT-FS Transmission Type. +// ANTFS_CONFIG_TRANS_TYPE - ANT-FS Transmission Type. #ifndef ANTFS_CONFIG_TRANS_TYPE -#define ANTFS_CONFIG_TRANS_TYPE 10 + #define ANTFS_CONFIG_TRANS_TYPE 10 #endif -// ANTFS_CONFIG_DEVICE_TYPE - ANT device type for channel configuration. +// ANTFS_CONFIG_DEVICE_TYPE - ANT device type for channel configuration. #ifndef ANTFS_CONFIG_DEVICE_TYPE -#define ANTFS_CONFIG_DEVICE_TYPE 1 + #define ANTFS_CONFIG_DEVICE_TYPE 1 #endif // ANTFS_CONFIG_BEACON_STATUS_PERIOD - ANT-FS Beacon Message Period. -// <0=> 0.5 Hz -// <1=> 1 Hz -// <2=> 2 Hz -// <3=> 4 Hz -// <4=> 8 Hz +// <0=> 0.5 Hz +// <1=> 1 Hz +// <2=> 2 Hz +// <3=> 4 Hz +// <4=> 8 Hz #ifndef ANTFS_CONFIG_BEACON_STATUS_PERIOD -#define ANTFS_CONFIG_BEACON_STATUS_PERIOD 3 + #define ANTFS_CONFIG_BEACON_STATUS_PERIOD 3 #endif // ANTFS_CONFIG_TRANSMIT_POWER - ANT Transmit Power. -// <0=> Lowest ANT Tx power level setting. (-20dBm) -// <1=> ANT Tx power > Lvl 0. (-12dBm) -// <2=> ANT Tx power > Lvl 1. (-4dBm) -// <3=> ANT Tx power > Lvl 2. Default tx power level. (0dBm) -// <4=> ANT Tx power > Lvl 3. (+4dBm) -// <128=> Custom tx power selection +// <0=> Lowest ANT Tx power level setting. (-20dBm) +// <1=> ANT Tx power > Lvl 0. (-12dBm) +// <2=> ANT Tx power > Lvl 1. (-4dBm) +// <3=> ANT Tx power > Lvl 2. Default tx power level. (0dBm) +// <4=> ANT Tx power > Lvl 3. (+4dBm) +// <128=> Custom tx power selection #ifndef ANTFS_CONFIG_TRANSMIT_POWER -#define ANTFS_CONFIG_TRANSMIT_POWER 3 + #define ANTFS_CONFIG_TRANSMIT_POWER 3 #endif -// ANTFS_CONFIG_CUSTOM_TRANSMIT_POWER - ANT Custom Transmit Power. +// ANTFS_CONFIG_CUSTOM_TRANSMIT_POWER - ANT Custom Transmit Power. #ifndef ANTFS_CONFIG_CUSTOM_TRANSMIT_POWER -#define ANTFS_CONFIG_CUSTOM_TRANSMIT_POWER 0 + #define ANTFS_CONFIG_CUSTOM_TRANSMIT_POWER 0 #endif // ANTFS_CONFIG_AUTH_TYPE_PAIRING_ENABLED - Use pairing and key exchange authentication. - #ifndef ANTFS_CONFIG_AUTH_TYPE_PAIRING_ENABLED -#define ANTFS_CONFIG_AUTH_TYPE_PAIRING_ENABLED 0 + #define ANTFS_CONFIG_AUTH_TYPE_PAIRING_ENABLED 0 #endif // ANTFS_CONFIG_AUTH_TYPE_PASSKEY_ENABLED - Use passkey authentication. - #ifndef ANTFS_CONFIG_AUTH_TYPE_PASSKEY_ENABLED -#define ANTFS_CONFIG_AUTH_TYPE_PASSKEY_ENABLED 0 + #define ANTFS_CONFIG_AUTH_TYPE_PASSKEY_ENABLED 0 #endif // ANTFS_CONFIG_AUTH_TYPE_PASSTHROUGH_ENABLED - Allow host to bypass authentication. - #ifndef ANTFS_CONFIG_AUTH_TYPE_PASSTHROUGH_ENABLED -#define ANTFS_CONFIG_AUTH_TYPE_PASSTHROUGH_ENABLED 0 + #define ANTFS_CONFIG_AUTH_TYPE_PASSTHROUGH_ENABLED 0 #endif // ANTFS_CONFIG_UPLOAD_ENABLED - Support upload operation. - #ifndef ANTFS_CONFIG_UPLOAD_ENABLED -#define ANTFS_CONFIG_UPLOAD_ENABLED 0 + #define ANTFS_CONFIG_UPLOAD_ENABLED 0 #endif // ANTFS_CONFIG_DEBUG_LED_ENABLED - Enables LED debug in the module. - #ifndef ANTFS_CONFIG_DEBUG_LED_ENABLED -#define ANTFS_CONFIG_DEBUG_LED_ENABLED 0 + #define ANTFS_CONFIG_DEBUG_LED_ENABLED 0 #endif // @@ -154,39 +149,39 @@ // ANT_BPWR_ENABLED - ant_bpwr - Bicycle Power Profile //========================================================== #ifndef ANT_BPWR_ENABLED -#define ANT_BPWR_ENABLED 0 + #define ANT_BPWR_ENABLED 0 #endif // ANT_BPWR_LOG_ENABLED - Enables general logging in the module. //========================================================== #ifndef ANT_BPWR_LOG_ENABLED -#define ANT_BPWR_LOG_ENABLED 0 + #define ANT_BPWR_LOG_ENABLED 0 #endif // ANT_BPWR_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BPWR_LOG_LEVEL -#define ANT_BPWR_LOG_LEVEL 3 + #define ANT_BPWR_LOG_LEVEL 3 #endif // ANT_BPWR_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BPWR_INFO_COLOR -#define ANT_BPWR_INFO_COLOR 0 + #define ANT_BPWR_INFO_COLOR 0 #endif // @@ -194,34 +189,34 @@ // ANT_BPWR_COMMON_LOG_ENABLED - Enables logging of BPWR tracing common data. //========================================================== #ifndef ANT_BPWR_COMMON_LOG_ENABLED -#define ANT_BPWR_COMMON_LOG_ENABLED 0 + #define ANT_BPWR_COMMON_LOG_ENABLED 0 #endif // ANT_BPWR_COMMON_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BPWR_COMMON_LOG_LEVEL -#define ANT_BPWR_COMMON_LOG_LEVEL 3 + #define ANT_BPWR_COMMON_LOG_LEVEL 3 #endif // ANT_BPWR_COMMON_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BPWR_COMMON_INFO_COLOR -#define ANT_BPWR_COMMON_INFO_COLOR 0 + #define ANT_BPWR_COMMON_INFO_COLOR 0 #endif // @@ -229,34 +224,34 @@ // ANT_BPWR_PAGE_TORQUE_LOG_ENABLED - Enables logging of BPWR torque page in the module. //========================================================== #ifndef ANT_BPWR_PAGE_TORQUE_LOG_ENABLED -#define ANT_BPWR_PAGE_TORQUE_LOG_ENABLED 0 + #define ANT_BPWR_PAGE_TORQUE_LOG_ENABLED 0 #endif // ANT_BPWR_PAGE_TORQUE_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BPWR_PAGE_TORQUE_LOG_LEVEL -#define ANT_BPWR_PAGE_TORQUE_LOG_LEVEL 3 + #define ANT_BPWR_PAGE_TORQUE_LOG_LEVEL 3 #endif // ANT_BPWR_PAGE_TORQUE_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BPWR_PAGE_TORQUE_INFO_COLOR -#define ANT_BPWR_PAGE_TORQUE_INFO_COLOR 0 + #define ANT_BPWR_PAGE_TORQUE_INFO_COLOR 0 #endif // @@ -264,34 +259,34 @@ // ANT_BPWR_PAGE_1_LOG_ENABLED - Enables logging of BPWR page 1 in the module. //========================================================== #ifndef ANT_BPWR_PAGE_1_LOG_ENABLED -#define ANT_BPWR_PAGE_1_LOG_ENABLED 0 + #define ANT_BPWR_PAGE_1_LOG_ENABLED 0 #endif // ANT_BPWR_PAGE_1_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BPWR_PAGE_1_LOG_LEVEL -#define ANT_BPWR_PAGE_1_LOG_LEVEL 3 + #define ANT_BPWR_PAGE_1_LOG_LEVEL 3 #endif // ANT_BPWR_PAGE_1_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BPWR_PAGE_1_INFO_COLOR -#define ANT_BPWR_PAGE_1_INFO_COLOR 0 + #define ANT_BPWR_PAGE_1_INFO_COLOR 0 #endif // @@ -299,34 +294,34 @@ // ANT_BPWR_PAGE_16_LOG_ENABLED - Enables logging of BPWR page 16 in the module. //========================================================== #ifndef ANT_BPWR_PAGE_16_LOG_ENABLED -#define ANT_BPWR_PAGE_16_LOG_ENABLED 0 + #define ANT_BPWR_PAGE_16_LOG_ENABLED 0 #endif // ANT_BPWR_PAGE_16_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BPWR_PAGE_16_LOG_LEVEL -#define ANT_BPWR_PAGE_16_LOG_LEVEL 3 + #define ANT_BPWR_PAGE_16_LOG_LEVEL 3 #endif // ANT_BPWR_PAGE_16_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BPWR_PAGE_16_INFO_COLOR -#define ANT_BPWR_PAGE_16_INFO_COLOR 0 + #define ANT_BPWR_PAGE_16_INFO_COLOR 0 #endif // @@ -334,34 +329,34 @@ // ANT_BPWR_PAGE_17_LOG_ENABLED - Enables logging of BPWR page 17 in the module. //========================================================== #ifndef ANT_BPWR_PAGE_17_LOG_ENABLED -#define ANT_BPWR_PAGE_17_LOG_ENABLED 0 + #define ANT_BPWR_PAGE_17_LOG_ENABLED 0 #endif // ANT_BPWR_PAGE_17_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BPWR_PAGE_17_LOG_LEVEL -#define ANT_BPWR_PAGE_17_LOG_LEVEL 3 + #define ANT_BPWR_PAGE_17_LOG_LEVEL 3 #endif // ANT_BPWR_PAGE_17_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BPWR_PAGE_17_INFO_COLOR -#define ANT_BPWR_PAGE_17_INFO_COLOR 0 + #define ANT_BPWR_PAGE_17_INFO_COLOR 0 #endif // @@ -369,34 +364,34 @@ // ANT_BPWR_PAGE_18_LOG_ENABLED - Enables logging of BPWR page 18 in the module. //========================================================== #ifndef ANT_BPWR_PAGE_18_LOG_ENABLED -#define ANT_BPWR_PAGE_18_LOG_ENABLED 0 + #define ANT_BPWR_PAGE_18_LOG_ENABLED 0 #endif // ANT_BPWR_PAGE_18_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BPWR_PAGE_18_LOG_LEVEL -#define ANT_BPWR_PAGE_18_LOG_LEVEL 3 + #define ANT_BPWR_PAGE_18_LOG_LEVEL 3 #endif // ANT_BPWR_PAGE_18_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BPWR_PAGE_18_INFO_COLOR -#define ANT_BPWR_PAGE_18_INFO_COLOR 0 + #define ANT_BPWR_PAGE_18_INFO_COLOR 0 #endif // @@ -406,39 +401,39 @@ // ANT_BSC_ENABLED - ant_bsc - Bicycle Speed and Cadence Profile //========================================================== #ifndef ANT_BSC_ENABLED -#define ANT_BSC_ENABLED 0 + #define ANT_BSC_ENABLED 0 #endif // ANT_BSC_LOG_ENABLED - Enables general logging in the module. //========================================================== #ifndef ANT_BSC_LOG_ENABLED -#define ANT_BSC_LOG_ENABLED 0 + #define ANT_BSC_LOG_ENABLED 0 #endif // ANT_BSC_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BSC_LOG_LEVEL -#define ANT_BSC_LOG_LEVEL 3 + #define ANT_BSC_LOG_LEVEL 3 #endif // ANT_BSC_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BSC_INFO_COLOR -#define ANT_BSC_INFO_COLOR 0 + #define ANT_BSC_INFO_COLOR 0 #endif // @@ -446,34 +441,34 @@ // ANT_BSC_COMBINED_PAGE_0_LOG_ENABLED - Enables logging of BSC Combined page 0 in the module. //========================================================== #ifndef ANT_BSC_COMBINED_PAGE_0_LOG_ENABLED -#define ANT_BSC_COMBINED_PAGE_0_LOG_ENABLED 0 + #define ANT_BSC_COMBINED_PAGE_0_LOG_ENABLED 0 #endif // ANT_BSC_COMBINED_PAGE_0_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BSC_COMBINED_PAGE_0_LOG_LEVEL -#define ANT_BSC_COMBINED_PAGE_0_LOG_LEVEL 3 + #define ANT_BSC_COMBINED_PAGE_0_LOG_LEVEL 3 #endif // ANT_BSC_COMBINED_PAGE_0_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BSC_COMBINED_PAGE_0_INFO_COLOR -#define ANT_BSC_COMBINED_PAGE_0_INFO_COLOR 0 + #define ANT_BSC_COMBINED_PAGE_0_INFO_COLOR 0 #endif // @@ -481,34 +476,34 @@ // ANT_BSC_PAGE_0_LOG_ENABLED - Enables logging of BSC page 0 in the module. //========================================================== #ifndef ANT_BSC_PAGE_0_LOG_ENABLED -#define ANT_BSC_PAGE_0_LOG_ENABLED 0 + #define ANT_BSC_PAGE_0_LOG_ENABLED 0 #endif // ANT_BSC_PAGE_0_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BSC_PAGE_0_LOG_LEVEL -#define ANT_BSC_PAGE_0_LOG_LEVEL 3 + #define ANT_BSC_PAGE_0_LOG_LEVEL 3 #endif // ANT_BSC_PAGE_0_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BSC_PAGE_0_INFO_COLOR -#define ANT_BSC_PAGE_0_INFO_COLOR 0 + #define ANT_BSC_PAGE_0_INFO_COLOR 0 #endif // @@ -516,34 +511,34 @@ // ANT_BSC_PAGE_1_LOG_ENABLED - Enables logging of BSC page 1 in the module. //========================================================== #ifndef ANT_BSC_PAGE_1_LOG_ENABLED -#define ANT_BSC_PAGE_1_LOG_ENABLED 0 + #define ANT_BSC_PAGE_1_LOG_ENABLED 0 #endif // ANT_BSC_PAGE_1_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BSC_PAGE_1_LOG_LEVEL -#define ANT_BSC_PAGE_1_LOG_LEVEL 3 + #define ANT_BSC_PAGE_1_LOG_LEVEL 3 #endif // ANT_BSC_PAGE_1_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BSC_PAGE_1_INFO_COLOR -#define ANT_BSC_PAGE_1_INFO_COLOR 0 + #define ANT_BSC_PAGE_1_INFO_COLOR 0 #endif // @@ -551,34 +546,34 @@ // ANT_BSC_PAGE_2_LOG_ENABLED - Enables logging of BSC page 2 in the module. //========================================================== #ifndef ANT_BSC_PAGE_2_LOG_ENABLED -#define ANT_BSC_PAGE_2_LOG_ENABLED 0 + #define ANT_BSC_PAGE_2_LOG_ENABLED 0 #endif // ANT_BSC_PAGE_2_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BSC_PAGE_2_LOG_LEVEL -#define ANT_BSC_PAGE_2_LOG_LEVEL 3 + #define ANT_BSC_PAGE_2_LOG_LEVEL 3 #endif // ANT_BSC_PAGE_2_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BSC_PAGE_2_INFO_COLOR -#define ANT_BSC_PAGE_2_INFO_COLOR 0 + #define ANT_BSC_PAGE_2_INFO_COLOR 0 #endif // @@ -586,34 +581,34 @@ // ANT_BSC_PAGE_3_LOG_ENABLED - Enables logging of BSC page 3 in the module. //========================================================== #ifndef ANT_BSC_PAGE_3_LOG_ENABLED -#define ANT_BSC_PAGE_3_LOG_ENABLED 0 + #define ANT_BSC_PAGE_3_LOG_ENABLED 0 #endif // ANT_BSC_PAGE_3_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BSC_PAGE_3_LOG_LEVEL -#define ANT_BSC_PAGE_3_LOG_LEVEL 3 + #define ANT_BSC_PAGE_3_LOG_LEVEL 3 #endif // ANT_BSC_PAGE_3_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BSC_PAGE_3_INFO_COLOR -#define ANT_BSC_PAGE_3_INFO_COLOR 0 + #define ANT_BSC_PAGE_3_INFO_COLOR 0 #endif // @@ -621,34 +616,34 @@ // ANT_BSC_PAGE_4_LOG_ENABLED - Enables logging of BSC page 4 in the module. //========================================================== #ifndef ANT_BSC_PAGE_4_LOG_ENABLED -#define ANT_BSC_PAGE_4_LOG_ENABLED 0 + #define ANT_BSC_PAGE_4_LOG_ENABLED 0 #endif // ANT_BSC_PAGE_4_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BSC_PAGE_4_LOG_LEVEL -#define ANT_BSC_PAGE_4_LOG_LEVEL 3 + #define ANT_BSC_PAGE_4_LOG_LEVEL 3 #endif // ANT_BSC_PAGE_4_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BSC_PAGE_4_INFO_COLOR -#define ANT_BSC_PAGE_4_INFO_COLOR 0 + #define ANT_BSC_PAGE_4_INFO_COLOR 0 #endif // @@ -656,34 +651,34 @@ // ANT_BSC_PAGE_5_LOG_ENABLED - Enables logging of BSC page 5 in the module. //========================================================== #ifndef ANT_BSC_PAGE_5_LOG_ENABLED -#define ANT_BSC_PAGE_5_LOG_ENABLED 0 + #define ANT_BSC_PAGE_5_LOG_ENABLED 0 #endif // ANT_BSC_PAGE_5_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_BSC_PAGE_5_LOG_LEVEL -#define ANT_BSC_PAGE_5_LOG_LEVEL 3 + #define ANT_BSC_PAGE_5_LOG_LEVEL 3 #endif // ANT_BSC_PAGE_5_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_BSC_PAGE_5_INFO_COLOR -#define ANT_BSC_PAGE_5_INFO_COLOR 0 + #define ANT_BSC_PAGE_5_INFO_COLOR 0 #endif // @@ -692,47 +687,46 @@ // ANT_CHANNEL_CONFIG_ENABLED - ant_channel_config - ANT common channel configuration - #ifndef ANT_CHANNEL_CONFIG_ENABLED -#define ANT_CHANNEL_CONFIG_ENABLED 0 + #define ANT_CHANNEL_CONFIG_ENABLED 0 #endif // ANT_COMMON_PAGE_70_ENABLED - ant_common_page_70 - ANT+ common page 70 //========================================================== #ifndef ANT_COMMON_PAGE_70_ENABLED -#define ANT_COMMON_PAGE_70_ENABLED 0 + #define ANT_COMMON_PAGE_70_ENABLED 0 #endif // ANT_COMMON_PAGE_70_LOG_ENABLED - Enables logging of common page 70 in the module. //========================================================== #ifndef ANT_COMMON_PAGE_70_LOG_ENABLED -#define ANT_COMMON_PAGE_70_LOG_ENABLED 0 + #define ANT_COMMON_PAGE_70_LOG_ENABLED 0 #endif // ANT_COMMON_PAGE_70_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_COMMON_PAGE_70_LOG_LEVEL -#define ANT_COMMON_PAGE_70_LOG_LEVEL 3 + #define ANT_COMMON_PAGE_70_LOG_LEVEL 3 #endif // ANT_COMMON_PAGE_70_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_COMMON_PAGE_70_INFO_COLOR -#define ANT_COMMON_PAGE_70_INFO_COLOR 0 + #define ANT_COMMON_PAGE_70_INFO_COLOR 0 #endif // @@ -742,39 +736,39 @@ // ANT_COMMON_PAGE_80_ENABLED - ant_common_page_80 - ANT+ common page 80 //========================================================== #ifndef ANT_COMMON_PAGE_80_ENABLED -#define ANT_COMMON_PAGE_80_ENABLED 0 + #define ANT_COMMON_PAGE_80_ENABLED 0 #endif // ANT_COMMON_PAGE_80_LOG_ENABLED - Enables logging of common page 80 in the module. //========================================================== #ifndef ANT_COMMON_PAGE_80_LOG_ENABLED -#define ANT_COMMON_PAGE_80_LOG_ENABLED 0 + #define ANT_COMMON_PAGE_80_LOG_ENABLED 0 #endif // ANT_COMMON_PAGE_80_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_COMMON_PAGE_80_LOG_LEVEL -#define ANT_COMMON_PAGE_80_LOG_LEVEL 3 + #define ANT_COMMON_PAGE_80_LOG_LEVEL 3 #endif // ANT_COMMON_PAGE_80_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_COMMON_PAGE_80_INFO_COLOR -#define ANT_COMMON_PAGE_80_INFO_COLOR 0 + #define ANT_COMMON_PAGE_80_INFO_COLOR 0 #endif // @@ -784,39 +778,39 @@ // ANT_COMMON_PAGE_81_ENABLED - ant_common_page_81 - ANT+ common page 81 //========================================================== #ifndef ANT_COMMON_PAGE_81_ENABLED -#define ANT_COMMON_PAGE_81_ENABLED 0 + #define ANT_COMMON_PAGE_81_ENABLED 0 #endif // ANT_COMMON_PAGE_81_LOG_ENABLED - Enables logging of common page 81 in the module. //========================================================== #ifndef ANT_COMMON_PAGE_81_LOG_ENABLED -#define ANT_COMMON_PAGE_81_LOG_ENABLED 0 + #define ANT_COMMON_PAGE_81_LOG_ENABLED 0 #endif // ANT_COMMON_PAGE_81_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_COMMON_PAGE_81_LOG_LEVEL -#define ANT_COMMON_PAGE_81_LOG_LEVEL 3 + #define ANT_COMMON_PAGE_81_LOG_LEVEL 3 #endif // ANT_COMMON_PAGE_81_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_COMMON_PAGE_81_INFO_COLOR -#define ANT_COMMON_PAGE_81_INFO_COLOR 0 + #define ANT_COMMON_PAGE_81_INFO_COLOR 0 #endif // @@ -825,54 +819,52 @@ // ANT_ENCRYPT_CONFIG_ENABLED - ant_encrypt_config - Cryptographic ANT stack configuration - #ifndef ANT_ENCRYPT_CONFIG_ENABLED -#define ANT_ENCRYPT_CONFIG_ENABLED 0 + #define ANT_ENCRYPT_CONFIG_ENABLED 0 #endif // ANT_ENCRYPT_NEGOTIATION_SLAVE_ENABLED - ant_encrypt_negotiation_slave - Encryption negotiation for encrypted ANT slave channels - #ifndef ANT_ENCRYPT_NEGOTIATION_SLAVE_ENABLED -#define ANT_ENCRYPT_NEGOTIATION_SLAVE_ENABLED 0 + #define ANT_ENCRYPT_NEGOTIATION_SLAVE_ENABLED 0 #endif // ANT_HRM_ENABLED - ant_hrm - Heart Rate Monitor Profile //========================================================== #ifndef ANT_HRM_ENABLED -#define ANT_HRM_ENABLED 0 + #define ANT_HRM_ENABLED 0 #endif // ANT_HRM_LOG_ENABLED - Enables general logging in the module. //========================================================== #ifndef ANT_HRM_LOG_ENABLED -#define ANT_HRM_LOG_ENABLED 0 + #define ANT_HRM_LOG_ENABLED 0 #endif // ANT_HRM_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_HRM_LOG_LEVEL -#define ANT_HRM_LOG_LEVEL 3 + #define ANT_HRM_LOG_LEVEL 3 #endif // ANT_HRM_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_HRM_INFO_COLOR -#define ANT_HRM_INFO_COLOR 0 + #define ANT_HRM_INFO_COLOR 0 #endif // @@ -880,34 +872,34 @@ // ANT_HRM_PAGE_0_LOG_ENABLED - Enables logging of HRM page 0 in the module. //========================================================== #ifndef ANT_HRM_PAGE_0_LOG_ENABLED -#define ANT_HRM_PAGE_0_LOG_ENABLED 0 + #define ANT_HRM_PAGE_0_LOG_ENABLED 0 #endif // ANT_HRM_PAGE_0_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_HRM_PAGE_0_LOG_LEVEL -#define ANT_HRM_PAGE_0_LOG_LEVEL 3 + #define ANT_HRM_PAGE_0_LOG_LEVEL 3 #endif // ANT_HRM_PAGE_0_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_HRM_PAGE_0_INFO_COLOR -#define ANT_HRM_PAGE_0_INFO_COLOR 0 + #define ANT_HRM_PAGE_0_INFO_COLOR 0 #endif // @@ -915,34 +907,34 @@ // ANT_HRM_PAGE_1_LOG_ENABLED - Enables logging of HRM page 1 in the module. //========================================================== #ifndef ANT_HRM_PAGE_1_LOG_ENABLED -#define ANT_HRM_PAGE_1_LOG_ENABLED 0 + #define ANT_HRM_PAGE_1_LOG_ENABLED 0 #endif // ANT_HRM_PAGE_1_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_HRM_PAGE_1_LOG_LEVEL -#define ANT_HRM_PAGE_1_LOG_LEVEL 3 + #define ANT_HRM_PAGE_1_LOG_LEVEL 3 #endif // ANT_HRM_PAGE_1_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_HRM_PAGE_1_INFO_COLOR -#define ANT_HRM_PAGE_1_INFO_COLOR 0 + #define ANT_HRM_PAGE_1_INFO_COLOR 0 #endif // @@ -950,34 +942,34 @@ // ANT_HRM_PAGE_2_LOG_ENABLED - Enables logging of HRM page 2 in the module. //========================================================== #ifndef ANT_HRM_PAGE_2_LOG_ENABLED -#define ANT_HRM_PAGE_2_LOG_ENABLED 0 + #define ANT_HRM_PAGE_2_LOG_ENABLED 0 #endif // ANT_HRM_PAGE_2_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_HRM_PAGE_2_LOG_LEVEL -#define ANT_HRM_PAGE_2_LOG_LEVEL 3 + #define ANT_HRM_PAGE_2_LOG_LEVEL 3 #endif // ANT_HRM_PAGE_2_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_HRM_PAGE_2_INFO_COLOR -#define ANT_HRM_PAGE_2_INFO_COLOR 0 + #define ANT_HRM_PAGE_2_INFO_COLOR 0 #endif // @@ -985,34 +977,34 @@ // ANT_HRM_PAGE_3_LOG_ENABLED - Enables logging of HRM page 3 in the module. //========================================================== #ifndef ANT_HRM_PAGE_3_LOG_ENABLED -#define ANT_HRM_PAGE_3_LOG_ENABLED 0 + #define ANT_HRM_PAGE_3_LOG_ENABLED 0 #endif // ANT_HRM_PAGE_3_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_HRM_PAGE_3_LOG_LEVEL -#define ANT_HRM_PAGE_3_LOG_LEVEL 3 + #define ANT_HRM_PAGE_3_LOG_LEVEL 3 #endif // ANT_HRM_PAGE_3_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_HRM_PAGE_3_INFO_COLOR -#define ANT_HRM_PAGE_3_INFO_COLOR 0 + #define ANT_HRM_PAGE_3_INFO_COLOR 0 #endif // @@ -1020,34 +1012,34 @@ // ANT_HRM_PAGE_4_LOG_ENABLED - Enables logging of HRM page 4 in the module. //========================================================== #ifndef ANT_HRM_PAGE_4_LOG_ENABLED -#define ANT_HRM_PAGE_4_LOG_ENABLED 0 + #define ANT_HRM_PAGE_4_LOG_ENABLED 0 #endif // ANT_HRM_PAGE_4_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_HRM_PAGE_4_LOG_LEVEL -#define ANT_HRM_PAGE_4_LOG_LEVEL 3 + #define ANT_HRM_PAGE_4_LOG_LEVEL 3 #endif // ANT_HRM_PAGE_4_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_HRM_PAGE_4_INFO_COLOR -#define ANT_HRM_PAGE_4_INFO_COLOR 0 + #define ANT_HRM_PAGE_4_INFO_COLOR 0 #endif // @@ -1056,57 +1048,54 @@ // ANT_KEY_MANAGER_ENABLED - ant_key_manager - Software Component - #ifndef ANT_KEY_MANAGER_ENABLED -#define ANT_KEY_MANAGER_ENABLED 0 + #define ANT_KEY_MANAGER_ENABLED 0 #endif // ANT_REQUEST_CONTROLLER_ENABLED - ant_request_controller - ANT+ request controller - #ifndef ANT_REQUEST_CONTROLLER_ENABLED -#define ANT_REQUEST_CONTROLLER_ENABLED 0 + #define ANT_REQUEST_CONTROLLER_ENABLED 0 #endif // ANT_SDM_ENABLED - ant_sdm - Stride Based Speed and Distance Monitor Profile //========================================================== #ifndef ANT_SDM_ENABLED -#define ANT_SDM_ENABLED 0 + #define ANT_SDM_ENABLED 0 #endif // ANT_SDM_LOG_ENABLED - Enables general logging in the module. //========================================================== // BSP_BTN_BLE_ENABLED - bsp_btn_ble - Button Control for BLE - #ifndef BSP_BTN_BLE_ENABLED -#define BSP_BTN_BLE_ENABLED 1 + #define BSP_BTN_BLE_ENABLED 1 #endif // ANT_SDM_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef ANT_SDM_LOG_LEVEL -#define ANT_SDM_LOG_LEVEL 3 + #define ANT_SDM_LOG_LEVEL 3 #endif // ANT_SDM_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef ANT_SDM_INFO_COLOR -#define ANT_SDM_INFO_COLOR 0 + #define ANT_SDM_INFO_COLOR 0 #endif // @@ -1116,20 +1105,18 @@ // ANT_SEARCH_CONFIG_ENABLED - ant_search_config - ANT common search configuration //========================================================== #ifndef ANT_SEARCH_CONFIG_ENABLED -#define ANT_SEARCH_CONFIG_ENABLED 0 + #define ANT_SEARCH_CONFIG_ENABLED 0 #endif -// ANT_DEFAULT_LOW_PRIORITY_TIMEOUT - Default low priority search time-out. <0-255> - +// ANT_DEFAULT_LOW_PRIORITY_TIMEOUT - Default low priority search time-out. <0-255> #ifndef ANT_DEFAULT_LOW_PRIORITY_TIMEOUT -#define ANT_DEFAULT_LOW_PRIORITY_TIMEOUT 2 + #define ANT_DEFAULT_LOW_PRIORITY_TIMEOUT 2 #endif -// ANT_DEFAULT_HIGH_PRIORITY_TIMEOUT - Default high priority search time-out. <0-255> - +// ANT_DEFAULT_HIGH_PRIORITY_TIMEOUT - Default high priority search time-out. <0-255> #ifndef ANT_DEFAULT_HIGH_PRIORITY_TIMEOUT -#define ANT_DEFAULT_HIGH_PRIORITY_TIMEOUT 10 + #define ANT_DEFAULT_HIGH_PRIORITY_TIMEOUT 10 #endif // @@ -1137,78 +1124,75 @@ // ANT_STATE_INDICATOR_ENABLED - ant_state_indicator - ANT state indicator using BSP //========================================================== #ifndef ANT_STATE_INDICATOR_ENABLED -#define ANT_STATE_INDICATOR_ENABLED 0 + #define ANT_STATE_INDICATOR_ENABLED 0 #endif -// ANT_STATE_INDICATOR_CONFIG_SHUTDOWN_HANDLER_PRIORITY - Shutdown observer priority. +// ANT_STATE_INDICATOR_CONFIG_SHUTDOWN_HANDLER_PRIORITY - Shutdown observer priority. #ifndef ANT_STATE_INDICATOR_CONFIG_SHUTDOWN_HANDLER_PRIORITY -#define ANT_STATE_INDICATOR_CONFIG_SHUTDOWN_HANDLER_PRIORITY 1 + #define ANT_STATE_INDICATOR_CONFIG_SHUTDOWN_HANDLER_PRIORITY 1 #endif // -// +// //========================================================== -// nRF_BLE +// nRF_BLE //========================================================== // BLE_ADVERTISING_ENABLED - ble_advertising - Advertising module - #ifndef BLE_ADVERTISING_ENABLED -#define BLE_ADVERTISING_ENABLED 1 + #define BLE_ADVERTISING_ENABLED 1 #endif // BLE_DTM_ENABLED - ble_dtm - Module for testing RF/PHY using DTM commands - #ifndef BLE_DTM_ENABLED -#define BLE_DTM_ENABLED 0 + #define BLE_DTM_ENABLED 0 #endif // BLE_RACP_ENABLED - ble_racp - Record Access Control Point library - #ifndef BLE_RACP_ENABLED -#define BLE_RACP_ENABLED 0 + #define BLE_RACP_ENABLED 0 #endif // NRF_BLE_CONN_PARAMS_ENABLED - ble_conn_params - Initiating and executing a connection parameters negotiation procedure //========================================================== #ifndef NRF_BLE_CONN_PARAMS_ENABLED -#define NRF_BLE_CONN_PARAMS_ENABLED 1 + #define NRF_BLE_CONN_PARAMS_ENABLED 1 #endif // NRF_BLE_CONN_PARAMS_MAX_SLAVE_LATENCY_DEVIATION - The largest acceptable deviation in slave latency. // The largest deviation (+ or -) from the requested slave latency that will not be renegotiated. #ifndef NRF_BLE_CONN_PARAMS_MAX_SLAVE_LATENCY_DEVIATION -#define NRF_BLE_CONN_PARAMS_MAX_SLAVE_LATENCY_DEVIATION 499 + #define NRF_BLE_CONN_PARAMS_MAX_SLAVE_LATENCY_DEVIATION 499 #endif // NRF_BLE_CONN_PARAMS_MAX_SUPERVISION_TIMEOUT_DEVIATION - The largest acceptable deviation (in 10 ms units) in supervision timeout. // The largest deviation (+ or -, in 10 ms units) from the requested supervision timeout that will not be renegotiated. #ifndef NRF_BLE_CONN_PARAMS_MAX_SUPERVISION_TIMEOUT_DEVIATION -#define NRF_BLE_CONN_PARAMS_MAX_SUPERVISION_TIMEOUT_DEVIATION 65535 + #define NRF_BLE_CONN_PARAMS_MAX_SUPERVISION_TIMEOUT_DEVIATION 65535 #endif // // NRF_BLE_GATT_ENABLED - nrf_ble_gatt - GATT module - #ifndef NRF_BLE_GATT_ENABLED -#define NRF_BLE_GATT_ENABLED 1 + #define NRF_BLE_GATT_ENABLED 1 #endif // NRF_BLE_QWR_ENABLED - nrf_ble_qwr - Queued writes support module (prepare/execute write) //========================================================== #ifndef NRF_BLE_QWR_ENABLED -#define NRF_BLE_QWR_ENABLED 1 + #define NRF_BLE_QWR_ENABLED 1 #endif -// NRF_BLE_QWR_MAX_ATTR - Maximum number of attribute handles that can be registered. This number must be adjusted according to the number of attributes for which Queued Writes will be enabled. If it is zero, the module will reject all Queued Write requests. +// NRF_BLE_QWR_MAX_ATTR - Maximum number of attribute handles that can be registered. This number must be adjusted according to the +// number of attributes for which Queued Writes will be enabled. If it is zero, the module will reject all Queued Write requests. #ifndef NRF_BLE_QWR_MAX_ATTR -#define NRF_BLE_QWR_MAX_ATTR 0 + #define NRF_BLE_QWR_MAX_ATTR 0 #endif // @@ -1216,182 +1200,176 @@ // PEER_MANAGER_ENABLED - peer_manager - Peer Manager //========================================================== #ifndef PEER_MANAGER_ENABLED -#define PEER_MANAGER_ENABLED 1 + #define PEER_MANAGER_ENABLED 1 #endif -// PM_MAX_REGISTRANTS - Number of event handlers that can be registered. +// PM_MAX_REGISTRANTS - Number of event handlers that can be registered. #ifndef PM_MAX_REGISTRANTS -#define PM_MAX_REGISTRANTS 3 + #define PM_MAX_REGISTRANTS 3 #endif -// PM_FLASH_BUFFERS - Number of internal buffers for flash operations. +// PM_FLASH_BUFFERS - Number of internal buffers for flash operations. // Decrease this value to lower RAM usage. #ifndef PM_FLASH_BUFFERS -#define PM_FLASH_BUFFERS 4 + #define PM_FLASH_BUFFERS 4 #endif // PM_CENTRAL_ENABLED - Enable/disable central-specific Peer Manager functionality. - // Enable/disable central-specific Peer Manager functionality. #ifndef PM_CENTRAL_ENABLED -#define PM_CENTRAL_ENABLED 0 + #define PM_CENTRAL_ENABLED 0 #endif // PM_SERVICE_CHANGED_ENABLED - Enable/disable the service changed management for GATT server in Peer Manager. - // If not using a GATT server, or using a server wihout a service changed characteristic, // disable this to save code space. #ifndef PM_SERVICE_CHANGED_ENABLED -#define PM_SERVICE_CHANGED_ENABLED 1 + #define PM_SERVICE_CHANGED_ENABLED 1 #endif // PM_PEER_RANKS_ENABLED - Enable/disable the peer rank management in Peer Manager. - // Set this to false to save code space if not using the peer rank API. #ifndef PM_PEER_RANKS_ENABLED -#define PM_PEER_RANKS_ENABLED 1 + #define PM_PEER_RANKS_ENABLED 1 #endif // PM_LESC_ENABLED - Enable/disable LESC support in Peer Manager. - -// If set to true, you need to call nrf_ble_lesc_request_handler() in the main loop to respond to LESC-related BLE events. If LESC support is not required, set this to false to save code space. +// If set to true, you need to call nrf_ble_lesc_request_handler() in the main loop to respond to LESC-related BLE events. If LESC +// support is not required, set this to false to save code space. #ifndef PM_LESC_ENABLED -#define PM_LESC_ENABLED 0 + #define PM_LESC_ENABLED 0 #endif // PM_RA_PROTECTION_ENABLED - Enable/disable protection against repeated pairing attempts in Peer Manager. //========================================================== #ifndef PM_RA_PROTECTION_ENABLED -#define PM_RA_PROTECTION_ENABLED 0 + #define PM_RA_PROTECTION_ENABLED 0 #endif -// PM_RA_PROTECTION_TRACKED_PEERS_NUM - Maximum number of peers whose authorization status can be tracked. +// PM_RA_PROTECTION_TRACKED_PEERS_NUM - Maximum number of peers whose authorization status can be tracked. #ifndef PM_RA_PROTECTION_TRACKED_PEERS_NUM -#define PM_RA_PROTECTION_TRACKED_PEERS_NUM 8 + #define PM_RA_PROTECTION_TRACKED_PEERS_NUM 8 #endif -// PM_RA_PROTECTION_MIN_WAIT_INTERVAL - Minimum waiting interval (in ms) before a new pairing attempt can be initiated. +// PM_RA_PROTECTION_MIN_WAIT_INTERVAL - Minimum waiting interval (in ms) before a new pairing attempt can be initiated. #ifndef PM_RA_PROTECTION_MIN_WAIT_INTERVAL -#define PM_RA_PROTECTION_MIN_WAIT_INTERVAL 4000 + #define PM_RA_PROTECTION_MIN_WAIT_INTERVAL 4000 #endif -// PM_RA_PROTECTION_MAX_WAIT_INTERVAL - Maximum waiting interval (in ms) before a new pairing attempt can be initiated. +// PM_RA_PROTECTION_MAX_WAIT_INTERVAL - Maximum waiting interval (in ms) before a new pairing attempt can be initiated. #ifndef PM_RA_PROTECTION_MAX_WAIT_INTERVAL -#define PM_RA_PROTECTION_MAX_WAIT_INTERVAL 64000 + #define PM_RA_PROTECTION_MAX_WAIT_INTERVAL 64000 #endif -// PM_RA_PROTECTION_REWARD_PERIOD - Reward period (in ms). +// PM_RA_PROTECTION_REWARD_PERIOD - Reward period (in ms). // The waiting interval is gradually decreased when no new failed pairing attempts are made during reward period. #ifndef PM_RA_PROTECTION_REWARD_PERIOD -#define PM_RA_PROTECTION_REWARD_PERIOD 10000 + #define PM_RA_PROTECTION_REWARD_PERIOD 10000 #endif // -// PM_HANDLER_SEC_DELAY_MS - Delay before starting security. +// PM_HANDLER_SEC_DELAY_MS - Delay before starting security. // This might be necessary for interoperability reasons, especially as peripheral. #ifndef PM_HANDLER_SEC_DELAY_MS -#define PM_HANDLER_SEC_DELAY_MS 0 + #define PM_HANDLER_SEC_DELAY_MS 0 #endif // -// +// //========================================================== -// nRF_BLE_Services +// nRF_BLE_Services //========================================================== // BLE_ANCS_C_ENABLED - ble_ancs_c - Apple Notification Service Client - #ifndef BLE_ANCS_C_ENABLED -#define BLE_ANCS_C_ENABLED 0 + #define BLE_ANCS_C_ENABLED 0 #endif // BLE_ANS_C_ENABLED - ble_ans_c - Alert Notification Service Client - #ifndef BLE_ANS_C_ENABLED -#define BLE_ANS_C_ENABLED 1 + #define BLE_ANS_C_ENABLED 1 #endif #ifndef BLE_ANS_C_LOG_ENABLED -#define BLE_ANS_C_LOG_ENABLED 1 + #define BLE_ANS_C_LOG_ENABLED 1 #endif #ifndef BLE_ANS_C_LOG_LEVEL -#define BLE_ANS_C_LOG_LEVEL 3 + #define BLE_ANS_C_LOG_LEVEL 3 #endif // BLE_BAS_C_ENABLED - ble_bas_c - Battery Service Client - #ifndef BLE_BAS_C_ENABLED -#define BLE_BAS_C_ENABLED 0 + #define BLE_BAS_C_ENABLED 0 #endif // BLE_BAS_ENABLED - ble_bas - Battery Service //========================================================== #ifndef BLE_BAS_ENABLED -#define BLE_BAS_ENABLED 1 + #define BLE_BAS_ENABLED 1 #endif // BLE_BAS_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef BLE_BAS_CONFIG_LOG_ENABLED -#define BLE_BAS_CONFIG_LOG_ENABLED 0 + #define BLE_BAS_CONFIG_LOG_ENABLED 0 #endif // BLE_BAS_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef BLE_BAS_CONFIG_LOG_LEVEL -#define BLE_BAS_CONFIG_LOG_LEVEL 3 + #define BLE_BAS_CONFIG_LOG_LEVEL 3 #endif // BLE_BAS_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef BLE_BAS_CONFIG_INFO_COLOR -#define BLE_BAS_CONFIG_INFO_COLOR 0 + #define BLE_BAS_CONFIG_INFO_COLOR 0 #endif // BLE_BAS_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef BLE_BAS_CONFIG_DEBUG_COLOR -#define BLE_BAS_CONFIG_DEBUG_COLOR 0 + #define BLE_BAS_CONFIG_DEBUG_COLOR 0 #endif // @@ -1400,123 +1378,114 @@ // BLE_CSCS_ENABLED - ble_cscs - Cycling Speed and Cadence Service - #ifndef BLE_CSCS_ENABLED -#define BLE_CSCS_ENABLED 0 + #define BLE_CSCS_ENABLED 0 #endif // BLE_CTS_C_ENABLED - ble_cts_c - Current Time Service Client - #ifndef BLE_CTS_C_ENABLED -#define BLE_CTS_C_ENABLED 1 + #define BLE_CTS_C_ENABLED 1 #endif #ifndef BLE_DB_DISCOVERY_ENABLED -#define BLE_DB_DISCOVERY_ENABLED 1 + #define BLE_DB_DISCOVERY_ENABLED 1 #endif // BLE_DIS_ENABLED - ble_dis - Device Information Service - #ifndef BLE_DIS_ENABLED -#define BLE_DIS_ENABLED 1 + #define BLE_DIS_ENABLED 1 #endif // BLE_GLS_ENABLED - ble_gls - Glucose Service - #ifndef BLE_GLS_ENABLED -#define BLE_GLS_ENABLED 0 + #define BLE_GLS_ENABLED 0 #endif // BLE_HIDS_ENABLED - ble_hids - Human Interface Device Service - #ifndef BLE_HIDS_ENABLED -#define BLE_HIDS_ENABLED 0 + #define BLE_HIDS_ENABLED 0 #endif // BLE_HRS_C_ENABLED - ble_hrs_c - Heart Rate Service Client - #ifndef BLE_HRS_C_ENABLED -#define BLE_HRS_C_ENABLED 0 + #define BLE_HRS_C_ENABLED 0 #endif // BLE_HRS_ENABLED - ble_hrs - Heart Rate Service - #ifndef BLE_HRS_ENABLED -#define BLE_HRS_ENABLED 1 + #define BLE_HRS_ENABLED 1 #endif // BLE_HTS_ENABLED - ble_hts - Health Thermometer Service - #ifndef BLE_HTS_ENABLED -#define BLE_HTS_ENABLED 0 + #define BLE_HTS_ENABLED 0 #endif // BLE_IAS_C_ENABLED - ble_ias_c - Immediate Alert Service Client - #ifndef BLE_IAS_C_ENABLED -#define BLE_IAS_C_ENABLED 0 + #define BLE_IAS_C_ENABLED 0 #endif // BLE_IAS_ENABLED - ble_ias - Immediate Alert Service //========================================================== #ifndef BLE_IAS_ENABLED -#define BLE_IAS_ENABLED 0 + #define BLE_IAS_ENABLED 0 #endif // BLE_IAS_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef BLE_IAS_CONFIG_LOG_ENABLED -#define BLE_IAS_CONFIG_LOG_ENABLED 0 + #define BLE_IAS_CONFIG_LOG_ENABLED 0 #endif // BLE_IAS_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef BLE_IAS_CONFIG_LOG_LEVEL -#define BLE_IAS_CONFIG_LOG_LEVEL 3 + #define BLE_IAS_CONFIG_LOG_LEVEL 3 #endif // BLE_IAS_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef BLE_IAS_CONFIG_INFO_COLOR -#define BLE_IAS_CONFIG_INFO_COLOR 0 + #define BLE_IAS_CONFIG_INFO_COLOR 0 #endif // BLE_IAS_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef BLE_IAS_CONFIG_DEBUG_COLOR -#define BLE_IAS_CONFIG_DEBUG_COLOR 0 + #define BLE_IAS_CONFIG_DEBUG_COLOR 0 #endif // @@ -1525,84 +1494,80 @@ // BLE_LBS_C_ENABLED - ble_lbs_c - Nordic LED Button Service Client - #ifndef BLE_LBS_C_ENABLED -#define BLE_LBS_C_ENABLED 0 + #define BLE_LBS_C_ENABLED 0 #endif // BLE_LBS_ENABLED - ble_lbs - LED Button Service - #ifndef BLE_LBS_ENABLED -#define BLE_LBS_ENABLED 0 + #define BLE_LBS_ENABLED 0 #endif // BLE_LLS_ENABLED - ble_lls - Link Loss Service - #ifndef BLE_LLS_ENABLED -#define BLE_LLS_ENABLED 0 + #define BLE_LLS_ENABLED 0 #endif // BLE_NUS_C_ENABLED - ble_nus_c - Nordic UART Central Service - #ifndef BLE_NUS_C_ENABLED -#define BLE_NUS_C_ENABLED 0 + #define BLE_NUS_C_ENABLED 0 #endif // BLE_NUS_ENABLED - ble_nus - Nordic UART Service //========================================================== #ifndef BLE_NUS_ENABLED -#define BLE_NUS_ENABLED 0 + #define BLE_NUS_ENABLED 0 #endif // BLE_NUS_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef BLE_NUS_CONFIG_LOG_ENABLED -#define BLE_NUS_CONFIG_LOG_ENABLED 0 + #define BLE_NUS_CONFIG_LOG_ENABLED 0 #endif // BLE_NUS_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef BLE_NUS_CONFIG_LOG_LEVEL -#define BLE_NUS_CONFIG_LOG_LEVEL 3 + #define BLE_NUS_CONFIG_LOG_LEVEL 3 #endif // BLE_NUS_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef BLE_NUS_CONFIG_INFO_COLOR -#define BLE_NUS_CONFIG_INFO_COLOR 0 + #define BLE_NUS_CONFIG_INFO_COLOR 0 #endif // BLE_NUS_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef BLE_NUS_CONFIG_DEBUG_COLOR -#define BLE_NUS_CONFIG_DEBUG_COLOR 0 + #define BLE_NUS_CONFIG_DEBUG_COLOR 0 #endif // @@ -1611,41 +1576,37 @@ // BLE_RSCS_C_ENABLED - ble_rscs_c - Running Speed and Cadence Client - #ifndef BLE_RSCS_C_ENABLED -#define BLE_RSCS_C_ENABLED 0 + #define BLE_RSCS_C_ENABLED 0 #endif // BLE_RSCS_ENABLED - ble_rscs - Running Speed and Cadence Service - #ifndef BLE_RSCS_ENABLED -#define BLE_RSCS_ENABLED 0 + #define BLE_RSCS_ENABLED 0 #endif // BLE_TPS_ENABLED - ble_tps - TX Power Service - #ifndef BLE_TPS_ENABLED -#define BLE_TPS_ENABLED 0 + #define BLE_TPS_ENABLED 0 #endif -// +// //========================================================== -// nRF_Core +// nRF_Core //========================================================== // NRF_MPU_LIB_ENABLED - nrf_mpu_lib - Module for MPU //========================================================== #ifndef NRF_MPU_LIB_ENABLED -#define NRF_MPU_LIB_ENABLED 0 + #define NRF_MPU_LIB_ENABLED 0 #endif // NRF_MPU_LIB_CLI_CMDS - Enable CLI commands specific to the module. - #ifndef NRF_MPU_LIB_CLI_CMDS -#define NRF_MPU_LIB_CLI_CMDS 0 + #define NRF_MPU_LIB_CLI_CMDS 0 #endif // @@ -1653,48 +1614,44 @@ // NRF_STACK_GUARD_ENABLED - nrf_stack_guard - Stack guard //========================================================== #ifndef NRF_STACK_GUARD_ENABLED -#define NRF_STACK_GUARD_ENABLED 0 + #define NRF_STACK_GUARD_ENABLED 0 #endif // NRF_STACK_GUARD_CONFIG_SIZE - Size of the stack guard. -// <5=> 32 bytes -// <6=> 64 bytes -// <7=> 128 bytes -// <8=> 256 bytes -// <9=> 512 bytes -// <10=> 1024 bytes -// <11=> 2048 bytes -// <12=> 4096 bytes +// <5=> 32 bytes +// <6=> 64 bytes +// <7=> 128 bytes +// <8=> 256 bytes +// <9=> 512 bytes +// <10=> 1024 bytes +// <11=> 2048 bytes +// <12=> 4096 bytes #ifndef NRF_STACK_GUARD_CONFIG_SIZE -#define NRF_STACK_GUARD_CONFIG_SIZE 7 + #define NRF_STACK_GUARD_CONFIG_SIZE 7 #endif // -// +// //========================================================== -// nRF_Crypto +// nRF_Crypto //========================================================== // NRF_CRYPTO_ENABLED - nrf_crypto - Cryptography library. //========================================================== #ifndef NRF_CRYPTO_ENABLED -#define NRF_CRYPTO_ENABLED 1 + #define NRF_CRYPTO_ENABLED 1 #endif // NRF_CRYPTO_ALLOCATOR - Memory allocator - -// Choose memory allocator used by nrf_crypto. Default is alloca if possible or nrf_malloc otherwise. If 'User macros' are selected, the user has to create 'nrf_crypto_allocator.h' file that contains NRF_CRYPTO_ALLOC, NRF_CRYPTO_FREE, and NRF_CRYPTO_ALLOC_ON_STACK. -// <0=> Default -// <1=> User macros -// <2=> On stack (alloca) -// <3=> C dynamic memory (malloc) -// <4=> SDK Memory Manager (nrf_malloc) +// Choose memory allocator used by nrf_crypto. Default is alloca if possible or nrf_malloc otherwise. If 'User macros' are selected, the +// user has to create 'nrf_crypto_allocator.h' file that contains NRF_CRYPTO_ALLOC, NRF_CRYPTO_FREE, and NRF_CRYPTO_ALLOC_ON_STACK. <0=> +// Default <1=> User macros <2=> On stack (alloca) <3=> C dynamic memory (malloc) <4=> SDK Memory Manager (nrf_malloc) #ifndef NRF_CRYPTO_ALLOCATOR -#define NRF_CRYPTO_ALLOCATOR 0 + #define NRF_CRYPTO_ALLOCATOR 0 #endif // NRF_CRYPTO_BACKEND_CC310_BL_ENABLED - Enable the ARM Cryptocell CC310 reduced backend. @@ -1702,54 +1659,50 @@ // The CC310 hardware-accelerated cryptography backend with reduced functionality and footprint (only available on nRF52840). //========================================================== #ifndef NRF_CRYPTO_BACKEND_CC310_BL_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_BL_ENABLED 0 + #define NRF_CRYPTO_BACKEND_CC310_BL_ENABLED 0 #endif // NRF_CRYPTO_BACKEND_CC310_BL_ECC_SECP224R1_ENABLED - Enable the secp224r1 elliptic curve support using CC310_BL. - #ifndef NRF_CRYPTO_BACKEND_CC310_BL_ECC_SECP224R1_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_BL_ECC_SECP224R1_ENABLED 0 + #define NRF_CRYPTO_BACKEND_CC310_BL_ECC_SECP224R1_ENABLED 0 #endif // NRF_CRYPTO_BACKEND_CC310_BL_ECC_SECP256R1_ENABLED - Enable the secp256r1 elliptic curve support using CC310_BL. - #ifndef NRF_CRYPTO_BACKEND_CC310_BL_ECC_SECP256R1_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_BL_ECC_SECP256R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_BL_ECC_SECP256R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_BL_HASH_SHA256_ENABLED - CC310_BL SHA-256 hash functionality. - // CC310_BL backend implementation for hardware-accelerated SHA-256. #ifndef NRF_CRYPTO_BACKEND_CC310_BL_HASH_SHA256_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_BL_HASH_SHA256_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_BL_HASH_SHA256_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_BL_HASH_AUTOMATIC_RAM_BUFFER_ENABLED - nrf_cc310_bl buffers to RAM before running hash operation - -// Enabling this makes hashing of addresses in FLASH range possible. Size of buffer allocated for hashing is set by NRF_CRYPTO_BACKEND_CC310_BL_HASH_AUTOMATIC_RAM_BUFFER_SIZE +// Enabling this makes hashing of addresses in FLASH range possible. Size of buffer allocated for hashing is set by +// NRF_CRYPTO_BACKEND_CC310_BL_HASH_AUTOMATIC_RAM_BUFFER_SIZE #ifndef NRF_CRYPTO_BACKEND_CC310_BL_HASH_AUTOMATIC_RAM_BUFFER_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_BL_HASH_AUTOMATIC_RAM_BUFFER_ENABLED 0 + #define NRF_CRYPTO_BACKEND_CC310_BL_HASH_AUTOMATIC_RAM_BUFFER_ENABLED 0 #endif -// NRF_CRYPTO_BACKEND_CC310_BL_HASH_AUTOMATIC_RAM_BUFFER_SIZE - nrf_cc310_bl hash outputs digests in little endian +// NRF_CRYPTO_BACKEND_CC310_BL_HASH_AUTOMATIC_RAM_BUFFER_SIZE - nrf_cc310_bl hash outputs digests in little endian // Makes the nrf_cc310_bl hash functions output digests in little endian format. Only for use in nRF SDK DFU! #ifndef NRF_CRYPTO_BACKEND_CC310_BL_HASH_AUTOMATIC_RAM_BUFFER_SIZE -#define NRF_CRYPTO_BACKEND_CC310_BL_HASH_AUTOMATIC_RAM_BUFFER_SIZE 4096 + #define NRF_CRYPTO_BACKEND_CC310_BL_HASH_AUTOMATIC_RAM_BUFFER_SIZE 4096 #endif // NRF_CRYPTO_BACKEND_CC310_BL_INTERRUPTS_ENABLED - Enable Interrupts while support using CC310 bl. - // Select a library version compatible with the configuration. When interrupts are disable, a version named _noint must be used #ifndef NRF_CRYPTO_BACKEND_CC310_BL_INTERRUPTS_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_BL_INTERRUPTS_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_BL_INTERRUPTS_ENABLED 1 #endif // @@ -1759,205 +1712,178 @@ // The CC310 hardware-accelerated cryptography backend (only available on nRF52840). //========================================================== #ifndef NRF_CRYPTO_BACKEND_CC310_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ENABLED 0 + #define NRF_CRYPTO_BACKEND_CC310_ENABLED 0 #endif // NRF_CRYPTO_BACKEND_CC310_AES_CBC_ENABLED - Enable the AES CBC mode using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_AES_CBC_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_AES_CBC_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_AES_CBC_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_AES_CTR_ENABLED - Enable the AES CTR mode using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_AES_CTR_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_AES_CTR_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_AES_CTR_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_AES_ECB_ENABLED - Enable the AES ECB mode using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_AES_ECB_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_AES_ECB_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_AES_ECB_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_AES_CBC_MAC_ENABLED - Enable the AES CBC_MAC mode using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_AES_CBC_MAC_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_AES_CBC_MAC_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_AES_CBC_MAC_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_AES_CMAC_ENABLED - Enable the AES CMAC mode using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_AES_CMAC_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_AES_CMAC_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_AES_CMAC_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_AES_CCM_ENABLED - Enable the AES CCM mode using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_AES_CCM_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_AES_CCM_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_AES_CCM_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_AES_CCM_STAR_ENABLED - Enable the AES CCM* mode using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_AES_CCM_STAR_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_AES_CCM_STAR_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_AES_CCM_STAR_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_CHACHA_POLY_ENABLED - Enable the CHACHA-POLY mode using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_CHACHA_POLY_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_CHACHA_POLY_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_CHACHA_POLY_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_SECP160R1_ENABLED - Enable the secp160r1 elliptic curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_SECP160R1_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_SECP160R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_SECP160R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_SECP160R2_ENABLED - Enable the secp160r2 elliptic curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_SECP160R2_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_SECP160R2_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_SECP160R2_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_SECP192R1_ENABLED - Enable the secp192r1 elliptic curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_SECP192R1_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_SECP192R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_SECP192R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_SECP224R1_ENABLED - Enable the secp224r1 elliptic curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_SECP224R1_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_SECP224R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_SECP224R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_SECP256R1_ENABLED - Enable the secp256r1 elliptic curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_SECP256R1_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_SECP256R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_SECP256R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_SECP384R1_ENABLED - Enable the secp384r1 elliptic curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_SECP384R1_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_SECP384R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_SECP384R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_SECP521R1_ENABLED - Enable the secp521r1 elliptic curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_SECP521R1_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_SECP521R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_SECP521R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_SECP160K1_ENABLED - Enable the secp160k1 elliptic curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_SECP160K1_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_SECP160K1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_SECP160K1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_SECP192K1_ENABLED - Enable the secp192k1 elliptic curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_SECP192K1_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_SECP192K1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_SECP192K1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_SECP224K1_ENABLED - Enable the secp224k1 elliptic curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_SECP224K1_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_SECP224K1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_SECP224K1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_SECP256K1_ENABLED - Enable the secp256k1 elliptic curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_SECP256K1_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_SECP256K1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_SECP256K1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_CURVE25519_ENABLED - Enable the Curve25519 curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_CURVE25519_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_CURVE25519_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_CURVE25519_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_ECC_ED25519_ENABLED - Enable the Ed25519 curve support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_ECC_ED25519_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_ECC_ED25519_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_ECC_ED25519_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_HASH_SHA256_ENABLED - CC310 SHA-256 hash functionality. - // CC310 backend implementation for hardware-accelerated SHA-256. #ifndef NRF_CRYPTO_BACKEND_CC310_HASH_SHA256_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_HASH_SHA256_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_HASH_SHA256_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_HASH_SHA512_ENABLED - CC310 SHA-512 hash functionality - // CC310 backend implementation for SHA-512 (in software). #ifndef NRF_CRYPTO_BACKEND_CC310_HASH_SHA512_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_HASH_SHA512_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_HASH_SHA512_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_HMAC_SHA256_ENABLED - CC310 HMAC using SHA-256 - // CC310 backend implementation for HMAC using hardware-accelerated SHA-256. #ifndef NRF_CRYPTO_BACKEND_CC310_HMAC_SHA256_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_HMAC_SHA256_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_HMAC_SHA256_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_HMAC_SHA512_ENABLED - CC310 HMAC using SHA-512 - // CC310 backend implementation for HMAC using SHA-512 (in software). #ifndef NRF_CRYPTO_BACKEND_CC310_HMAC_SHA512_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_HMAC_SHA512_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_HMAC_SHA512_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_RNG_ENABLED - Enable RNG support using CC310. - #ifndef NRF_CRYPTO_BACKEND_CC310_RNG_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_RNG_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_RNG_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_CC310_INTERRUPTS_ENABLED - Enable Interrupts while support using CC310. - // Select a library version compatible with the configuration. When interrupts are disable, a version named _noint must be used #ifndef NRF_CRYPTO_BACKEND_CC310_INTERRUPTS_ENABLED -#define NRF_CRYPTO_BACKEND_CC310_INTERRUPTS_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CC310_INTERRUPTS_ENABLED 1 #endif // @@ -1965,13 +1891,12 @@ // NRF_CRYPTO_BACKEND_CIFRA_ENABLED - Enable the Cifra backend. //========================================================== #ifndef NRF_CRYPTO_BACKEND_CIFRA_ENABLED -#define NRF_CRYPTO_BACKEND_CIFRA_ENABLED 0 + #define NRF_CRYPTO_BACKEND_CIFRA_ENABLED 0 #endif // NRF_CRYPTO_BACKEND_CIFRA_AES_EAX_ENABLED - Enable the AES EAX mode using Cifra. - #ifndef NRF_CRYPTO_BACKEND_CIFRA_AES_EAX_ENABLED -#define NRF_CRYPTO_BACKEND_CIFRA_AES_EAX_ENABLED 1 + #define NRF_CRYPTO_BACKEND_CIFRA_AES_EAX_ENABLED 1 #endif // @@ -1979,206 +1904,182 @@ // NRF_CRYPTO_BACKEND_MBEDTLS_ENABLED - Enable the mbed TLS backend. //========================================================== #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ENABLED 0 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ENABLED 0 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_AES_CBC_ENABLED - Enable the AES CBC mode mbed TLS. - #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_AES_CBC_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_AES_CBC_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_AES_CBC_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_AES_CTR_ENABLED - Enable the AES CTR mode using mbed TLS. - #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_AES_CTR_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_AES_CTR_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_AES_CTR_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_AES_CFB_ENABLED - Enable the AES CFB mode using mbed TLS. - #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_AES_CFB_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_AES_CFB_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_AES_CFB_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_AES_ECB_ENABLED - Enable the AES ECB mode using mbed TLS. - #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_AES_ECB_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_AES_ECB_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_AES_ECB_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_AES_CBC_MAC_ENABLED - Enable the AES CBC MAC mode using mbed TLS. - #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_AES_CBC_MAC_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_AES_CBC_MAC_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_AES_CBC_MAC_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_AES_CMAC_ENABLED - Enable the AES CMAC mode using mbed TLS. - #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_AES_CMAC_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_AES_CMAC_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_AES_CMAC_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_AES_CCM_ENABLED - Enable the AES CCM mode using mbed TLS. - #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_AES_CCM_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_AES_CCM_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_AES_CCM_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_AES_GCM_ENABLED - Enable the AES GCM mode using mbed TLS. - #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_AES_GCM_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_AES_GCM_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_AES_GCM_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP192R1_ENABLED - Enable secp192r1 (NIST 192-bit) curve - // Enable this setting if you need secp192r1 (NIST 192-bit) support using MBEDTLS #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP192R1_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP192R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP192R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP224R1_ENABLED - Enable secp224r1 (NIST 224-bit) curve - // Enable this setting if you need secp224r1 (NIST 224-bit) support using MBEDTLS #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP224R1_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP224R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP224R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP256R1_ENABLED - Enable secp256r1 (NIST 256-bit) curve - // Enable this setting if you need secp256r1 (NIST 256-bit) support using MBEDTLS #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP256R1_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP256R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP256R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP384R1_ENABLED - Enable secp384r1 (NIST 384-bit) curve - // Enable this setting if you need secp384r1 (NIST 384-bit) support using MBEDTLS #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP384R1_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP384R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP384R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP521R1_ENABLED - Enable secp521r1 (NIST 521-bit) curve - // Enable this setting if you need secp521r1 (NIST 521-bit) support using MBEDTLS #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP521R1_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP521R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP521R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP192K1_ENABLED - Enable secp192k1 (Koblitz 192-bit) curve - // Enable this setting if you need secp192k1 (Koblitz 192-bit) support using MBEDTLS #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP192K1_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP192K1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP192K1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP224K1_ENABLED - Enable secp224k1 (Koblitz 224-bit) curve - // Enable this setting if you need secp224k1 (Koblitz 224-bit) support using MBEDTLS #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP224K1_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP224K1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP224K1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP256K1_ENABLED - Enable secp256k1 (Koblitz 256-bit) curve - // Enable this setting if you need secp256k1 (Koblitz 256-bit) support using MBEDTLS #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP256K1_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP256K1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_SECP256K1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_ECC_BP256R1_ENABLED - Enable bp256r1 (Brainpool 256-bit) curve - // Enable this setting if you need bp256r1 (Brainpool 256-bit) support using MBEDTLS #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ECC_BP256R1_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_BP256R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_BP256R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_ECC_BP384R1_ENABLED - Enable bp384r1 (Brainpool 384-bit) curve - // Enable this setting if you need bp384r1 (Brainpool 384-bit) support using MBEDTLS #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ECC_BP384R1_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_BP384R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_BP384R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_ECC_BP512R1_ENABLED - Enable bp512r1 (Brainpool 512-bit) curve - // Enable this setting if you need bp512r1 (Brainpool 512-bit) support using MBEDTLS #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ECC_BP512R1_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_BP512R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_BP512R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_ECC_CURVE25519_ENABLED - Enable Curve25519 curve - // Enable this setting if you need Curve25519 support using MBEDTLS #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_ECC_CURVE25519_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_CURVE25519_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_ECC_CURVE25519_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_HASH_SHA256_ENABLED - Enable mbed TLS SHA-256 hash functionality. - // mbed TLS backend implementation for SHA-256. #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_HASH_SHA256_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_HASH_SHA256_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_HASH_SHA256_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_HASH_SHA512_ENABLED - Enable mbed TLS SHA-512 hash functionality. - // mbed TLS backend implementation for SHA-512. #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_HASH_SHA512_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_HASH_SHA512_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_HASH_SHA512_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_HMAC_SHA256_ENABLED - Enable mbed TLS HMAC using SHA-256. - // mbed TLS backend implementation for HMAC using SHA-256. #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_HMAC_SHA256_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_HMAC_SHA256_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_HMAC_SHA256_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MBEDTLS_HMAC_SHA512_ENABLED - Enable mbed TLS HMAC using SHA-512. - // mbed TLS backend implementation for HMAC using SHA-512. #ifndef NRF_CRYPTO_BACKEND_MBEDTLS_HMAC_SHA512_ENABLED -#define NRF_CRYPTO_BACKEND_MBEDTLS_HMAC_SHA512_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MBEDTLS_HMAC_SHA512_ENABLED 1 #endif // @@ -2186,42 +2087,38 @@ // NRF_CRYPTO_BACKEND_MICRO_ECC_ENABLED - Enable the micro-ecc backend. //========================================================== #ifndef NRF_CRYPTO_BACKEND_MICRO_ECC_ENABLED -#define NRF_CRYPTO_BACKEND_MICRO_ECC_ENABLED 0 + #define NRF_CRYPTO_BACKEND_MICRO_ECC_ENABLED 0 #endif // NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP192R1_ENABLED - Enable secp192r1 (NIST 192-bit) curve - // Enable this setting if you need secp192r1 (NIST 192-bit) support using micro-ecc #ifndef NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP192R1_ENABLED -#define NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP192R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP192R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP224R1_ENABLED - Enable secp224r1 (NIST 224-bit) curve - // Enable this setting if you need secp224r1 (NIST 224-bit) support using micro-ecc #ifndef NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP224R1_ENABLED -#define NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP224R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP224R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP256R1_ENABLED - Enable secp256r1 (NIST 256-bit) curve - // Enable this setting if you need secp256r1 (NIST 256-bit) support using micro-ecc #ifndef NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP256R1_ENABLED -#define NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP256R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP256R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP256K1_ENABLED - Enable secp256k1 (Koblitz 256-bit) curve - // Enable this setting if you need secp256k1 (Koblitz 256-bit) support using micro-ecc #ifndef NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP256K1_ENABLED -#define NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP256K1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP256K1_ENABLED 1 #endif // @@ -2231,15 +2128,14 @@ // The nRF HW backend provide access to RNG peripheral in nRF5x devices. //========================================================== #ifndef NRF_CRYPTO_BACKEND_NRF_HW_RNG_ENABLED -#define NRF_CRYPTO_BACKEND_NRF_HW_RNG_ENABLED 0 + #define NRF_CRYPTO_BACKEND_NRF_HW_RNG_ENABLED 0 #endif // NRF_CRYPTO_BACKEND_NRF_HW_RNG_MBEDTLS_CTR_DRBG_ENABLED - Enable mbed TLS CTR-DRBG algorithm. - // Enable mbed TLS CTR-DRBG standardized by NIST (NIST SP 800-90A Rev. 1). The nRF HW RNG is used as an entropy source for seeding. #ifndef NRF_CRYPTO_BACKEND_NRF_HW_RNG_MBEDTLS_CTR_DRBG_ENABLED -#define NRF_CRYPTO_BACKEND_NRF_HW_RNG_MBEDTLS_CTR_DRBG_ENABLED 1 + #define NRF_CRYPTO_BACKEND_NRF_HW_RNG_MBEDTLS_CTR_DRBG_ENABLED 1 #endif // @@ -2249,15 +2145,14 @@ // The nRF SW cryptography backend (only used in bootloader context). //========================================================== #ifndef NRF_CRYPTO_BACKEND_NRF_SW_ENABLED -#define NRF_CRYPTO_BACKEND_NRF_SW_ENABLED 0 + #define NRF_CRYPTO_BACKEND_NRF_SW_ENABLED 0 #endif // NRF_CRYPTO_BACKEND_NRF_SW_HASH_SHA256_ENABLED - nRF SW hash backend support for SHA-256 - // The nRF SW backend provide access to nRF SDK legacy hash implementation of SHA-256. #ifndef NRF_CRYPTO_BACKEND_NRF_SW_HASH_SHA256_ENABLED -#define NRF_CRYPTO_BACKEND_NRF_SW_HASH_SHA256_ENABLED 1 + #define NRF_CRYPTO_BACKEND_NRF_SW_HASH_SHA256_ENABLED 1 #endif // @@ -2267,76 +2162,68 @@ // The Oberon backend //========================================================== #ifndef NRF_CRYPTO_BACKEND_OBERON_ENABLED -#define NRF_CRYPTO_BACKEND_OBERON_ENABLED 0 + #define NRF_CRYPTO_BACKEND_OBERON_ENABLED 0 #endif // NRF_CRYPTO_BACKEND_OBERON_CHACHA_POLY_ENABLED - Enable the CHACHA-POLY mode using Oberon. - #ifndef NRF_CRYPTO_BACKEND_OBERON_CHACHA_POLY_ENABLED -#define NRF_CRYPTO_BACKEND_OBERON_CHACHA_POLY_ENABLED 1 + #define NRF_CRYPTO_BACKEND_OBERON_CHACHA_POLY_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_OBERON_ECC_SECP256R1_ENABLED - Enable secp256r1 curve - // Enable this setting if you need secp256r1 curve support using Oberon library #ifndef NRF_CRYPTO_BACKEND_OBERON_ECC_SECP256R1_ENABLED -#define NRF_CRYPTO_BACKEND_OBERON_ECC_SECP256R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_OBERON_ECC_SECP256R1_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_OBERON_ECC_CURVE25519_ENABLED - Enable Curve25519 ECDH - // Enable this setting if you need Curve25519 ECDH support using Oberon library #ifndef NRF_CRYPTO_BACKEND_OBERON_ECC_CURVE25519_ENABLED -#define NRF_CRYPTO_BACKEND_OBERON_ECC_CURVE25519_ENABLED 1 + #define NRF_CRYPTO_BACKEND_OBERON_ECC_CURVE25519_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_OBERON_ECC_ED25519_ENABLED - Enable Ed25519 signature scheme - // Enable this setting if you need Ed25519 support using Oberon library #ifndef NRF_CRYPTO_BACKEND_OBERON_ECC_ED25519_ENABLED -#define NRF_CRYPTO_BACKEND_OBERON_ECC_ED25519_ENABLED 1 + #define NRF_CRYPTO_BACKEND_OBERON_ECC_ED25519_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_OBERON_HASH_SHA256_ENABLED - Oberon SHA-256 hash functionality - // Oberon backend implementation for SHA-256. #ifndef NRF_CRYPTO_BACKEND_OBERON_HASH_SHA256_ENABLED -#define NRF_CRYPTO_BACKEND_OBERON_HASH_SHA256_ENABLED 1 + #define NRF_CRYPTO_BACKEND_OBERON_HASH_SHA256_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_OBERON_HASH_SHA512_ENABLED - Oberon SHA-512 hash functionality - // Oberon backend implementation for SHA-512. #ifndef NRF_CRYPTO_BACKEND_OBERON_HASH_SHA512_ENABLED -#define NRF_CRYPTO_BACKEND_OBERON_HASH_SHA512_ENABLED 1 + #define NRF_CRYPTO_BACKEND_OBERON_HASH_SHA512_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_OBERON_HMAC_SHA256_ENABLED - Oberon HMAC using SHA-256 - // Oberon backend implementation for HMAC using SHA-256. #ifndef NRF_CRYPTO_BACKEND_OBERON_HMAC_SHA256_ENABLED -#define NRF_CRYPTO_BACKEND_OBERON_HMAC_SHA256_ENABLED 1 + #define NRF_CRYPTO_BACKEND_OBERON_HMAC_SHA256_ENABLED 1 #endif // NRF_CRYPTO_BACKEND_OBERON_HMAC_SHA512_ENABLED - Oberon HMAC using SHA-512 - // Oberon backend implementation for HMAC using SHA-512. #ifndef NRF_CRYPTO_BACKEND_OBERON_HMAC_SHA512_ENABLED -#define NRF_CRYPTO_BACKEND_OBERON_HMAC_SHA512_ENABLED 1 + #define NRF_CRYPTO_BACKEND_OBERON_HMAC_SHA512_ENABLED 1 #endif // @@ -2346,43 +2233,40 @@ // Enables the nrf_crypto backend for Optiga Trust X devices. //========================================================== #ifndef NRF_CRYPTO_BACKEND_OPTIGA_ENABLED -#define NRF_CRYPTO_BACKEND_OPTIGA_ENABLED 0 + #define NRF_CRYPTO_BACKEND_OPTIGA_ENABLED 0 #endif // NRF_CRYPTO_BACKEND_OPTIGA_RNG_ENABLED - Optiga backend support for RNG - // The Optiga backend provide external chip RNG. #ifndef NRF_CRYPTO_BACKEND_OPTIGA_RNG_ENABLED -#define NRF_CRYPTO_BACKEND_OPTIGA_RNG_ENABLED 0 + #define NRF_CRYPTO_BACKEND_OPTIGA_RNG_ENABLED 0 #endif // NRF_CRYPTO_BACKEND_OPTIGA_ECC_SECP256R1_ENABLED - Optiga backend support for ECC secp256r1 - // The Optiga backend provide external chip ECC using secp256r1. #ifndef NRF_CRYPTO_BACKEND_OPTIGA_ECC_SECP256R1_ENABLED -#define NRF_CRYPTO_BACKEND_OPTIGA_ECC_SECP256R1_ENABLED 1 + #define NRF_CRYPTO_BACKEND_OPTIGA_ECC_SECP256R1_ENABLED 1 #endif // // NRF_CRYPTO_CURVE25519_BIG_ENDIAN_ENABLED - Big-endian byte order in raw Curve25519 data - // Enable big-endian byte order in Curve25519 API, if set to 1. Use little-endian, if set to 0. #ifndef NRF_CRYPTO_CURVE25519_BIG_ENDIAN_ENABLED -#define NRF_CRYPTO_CURVE25519_BIG_ENDIAN_ENABLED 0 + #define NRF_CRYPTO_CURVE25519_BIG_ENDIAN_ENABLED 0 #endif // -// +// //========================================================== -// nRF_DFU +// nRF_DFU //========================================================== // ble_dfu - Device Firmware Update @@ -2390,159 +2274,153 @@ //========================================================== // BLE_DFU_ENABLED - Enable DFU Service. - #ifndef BLE_DFU_ENABLED -#define BLE_DFU_ENABLED 0 + #define BLE_DFU_ENABLED 0 #endif // NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS - Buttonless DFU supports bonds. - #ifndef NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS -#define NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS 0 + #define NRF_DFU_BLE_BUTTONLESS_SUPPORTS_BONDS 0 #endif -// +// //========================================================== -// +// //========================================================== -// nRF_Drivers +// nRF_Drivers //========================================================== // COMP_ENABLED - nrf_drv_comp - COMP peripheral driver - legacy layer //========================================================== #ifndef COMP_ENABLED -#define COMP_ENABLED 0 + #define COMP_ENABLED 0 #endif // COMP_CONFIG_REF - Reference voltage -// <0=> Internal 1.2V -// <1=> Internal 1.8V -// <2=> Internal 2.4V -// <4=> VDD -// <7=> ARef +// <0=> Internal 1.2V +// <1=> Internal 1.8V +// <2=> Internal 2.4V +// <4=> VDD +// <7=> ARef #ifndef COMP_CONFIG_REF -#define COMP_CONFIG_REF 1 + #define COMP_CONFIG_REF 1 #endif // COMP_CONFIG_MAIN_MODE - Main mode -// <0=> Single ended -// <1=> Differential +// <0=> Single ended +// <1=> Differential #ifndef COMP_CONFIG_MAIN_MODE -#define COMP_CONFIG_MAIN_MODE 0 + #define COMP_CONFIG_MAIN_MODE 0 #endif // COMP_CONFIG_SPEED_MODE - Speed mode -// <0=> Low power -// <1=> Normal -// <2=> High speed +// <0=> Low power +// <1=> Normal +// <2=> High speed #ifndef COMP_CONFIG_SPEED_MODE -#define COMP_CONFIG_SPEED_MODE 2 + #define COMP_CONFIG_SPEED_MODE 2 #endif // COMP_CONFIG_HYST - Hystheresis -// <0=> No -// <1=> 50mV +// <0=> No +// <1=> 50mV #ifndef COMP_CONFIG_HYST -#define COMP_CONFIG_HYST 0 + #define COMP_CONFIG_HYST 0 #endif // COMP_CONFIG_ISOURCE - Current Source -// <0=> Off -// <1=> 2.5 uA -// <2=> 5 uA -// <3=> 10 uA +// <0=> Off +// <1=> 2.5 uA +// <2=> 5 uA +// <3=> 10 uA #ifndef COMP_CONFIG_ISOURCE -#define COMP_CONFIG_ISOURCE 0 + #define COMP_CONFIG_ISOURCE 0 #endif // COMP_CONFIG_INPUT - Analog input -// <0=> 0 -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef COMP_CONFIG_INPUT -#define COMP_CONFIG_INPUT 0 + #define COMP_CONFIG_INPUT 0 #endif // COMP_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef COMP_CONFIG_IRQ_PRIORITY -#define COMP_CONFIG_IRQ_PRIORITY 6 + #define COMP_CONFIG_IRQ_PRIORITY 6 #endif // // EGU_ENABLED - nrf_drv_swi - SWI(EGU) peripheral driver - legacy layer - #ifndef EGU_ENABLED -#define EGU_ENABLED 0 + #define EGU_ENABLED 0 #endif // GPIOTE_ENABLED - nrf_drv_gpiote - GPIOTE peripheral driver - legacy layer //========================================================== #ifndef GPIOTE_ENABLED -#define GPIOTE_ENABLED 1 + #define GPIOTE_ENABLED 1 #endif #ifndef GPIOTE_LOG_ENABLED -#define GPIOTE_LOG_ENABLED 0 + #define GPIOTE_LOG_ENABLED 0 #endif - #ifndef NRFX_GPIOTE_LOG_ENABLED -#define NRFX_GPIOTE_LOG_ENABLED 0 + #define NRFX_GPIOTE_LOG_ENABLED 0 #endif -// GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins +// GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins #ifndef GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 4 + #define GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 4 #endif // GPIOTE_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef GPIOTE_CONFIG_IRQ_PRIORITY -#define GPIOTE_CONFIG_IRQ_PRIORITY 6 + #define GPIOTE_CONFIG_IRQ_PRIORITY 6 #endif // @@ -2550,194 +2428,189 @@ // I2S_ENABLED - nrf_drv_i2s - I2S peripheral driver - legacy layer //========================================================== #ifndef I2S_ENABLED -#define I2S_ENABLED 0 + #define I2S_ENABLED 0 #endif -// I2S_CONFIG_SCK_PIN - SCK pin <0-31> - +// I2S_CONFIG_SCK_PIN - SCK pin <0-31> #ifndef I2S_CONFIG_SCK_PIN -#define I2S_CONFIG_SCK_PIN 31 + #define I2S_CONFIG_SCK_PIN 31 #endif -// I2S_CONFIG_LRCK_PIN - LRCK pin <1-31> - +// I2S_CONFIG_LRCK_PIN - LRCK pin <1-31> #ifndef I2S_CONFIG_LRCK_PIN -#define I2S_CONFIG_LRCK_PIN 30 + #define I2S_CONFIG_LRCK_PIN 30 #endif -// I2S_CONFIG_MCK_PIN - MCK pin +// I2S_CONFIG_MCK_PIN - MCK pin #ifndef I2S_CONFIG_MCK_PIN -#define I2S_CONFIG_MCK_PIN 255 + #define I2S_CONFIG_MCK_PIN 255 #endif -// I2S_CONFIG_SDOUT_PIN - SDOUT pin <0-31> - +// I2S_CONFIG_SDOUT_PIN - SDOUT pin <0-31> #ifndef I2S_CONFIG_SDOUT_PIN -#define I2S_CONFIG_SDOUT_PIN 29 + #define I2S_CONFIG_SDOUT_PIN 29 #endif -// I2S_CONFIG_SDIN_PIN - SDIN pin <0-31> - +// I2S_CONFIG_SDIN_PIN - SDIN pin <0-31> #ifndef I2S_CONFIG_SDIN_PIN -#define I2S_CONFIG_SDIN_PIN 28 + #define I2S_CONFIG_SDIN_PIN 28 #endif // I2S_CONFIG_MASTER - Mode -// <0=> Master -// <1=> Slave +// <0=> Master +// <1=> Slave #ifndef I2S_CONFIG_MASTER -#define I2S_CONFIG_MASTER 0 + #define I2S_CONFIG_MASTER 0 #endif // I2S_CONFIG_FORMAT - Format -// <0=> I2S -// <1=> Aligned +// <0=> I2S +// <1=> Aligned #ifndef I2S_CONFIG_FORMAT -#define I2S_CONFIG_FORMAT 0 + #define I2S_CONFIG_FORMAT 0 #endif // I2S_CONFIG_ALIGN - Alignment -// <0=> Left -// <1=> Right +// <0=> Left +// <1=> Right #ifndef I2S_CONFIG_ALIGN -#define I2S_CONFIG_ALIGN 0 + #define I2S_CONFIG_ALIGN 0 #endif // I2S_CONFIG_SWIDTH - Sample width (bits) -// <0=> 8 -// <1=> 16 -// <2=> 24 +// <0=> 8 +// <1=> 16 +// <2=> 24 #ifndef I2S_CONFIG_SWIDTH -#define I2S_CONFIG_SWIDTH 1 + #define I2S_CONFIG_SWIDTH 1 #endif // I2S_CONFIG_CHANNELS - Channels -// <0=> Stereo -// <1=> Left -// <2=> Right +// <0=> Stereo +// <1=> Left +// <2=> Right #ifndef I2S_CONFIG_CHANNELS -#define I2S_CONFIG_CHANNELS 1 + #define I2S_CONFIG_CHANNELS 1 #endif // I2S_CONFIG_MCK_SETUP - MCK behavior -// <0=> Disabled -// <2147483648=> 32MHz/2 -// <1342177280=> 32MHz/3 -// <1073741824=> 32MHz/4 -// <805306368=> 32MHz/5 -// <671088640=> 32MHz/6 -// <536870912=> 32MHz/8 -// <402653184=> 32MHz/10 -// <369098752=> 32MHz/11 -// <285212672=> 32MHz/15 -// <268435456=> 32MHz/16 -// <201326592=> 32MHz/21 -// <184549376=> 32MHz/23 -// <142606336=> 32MHz/30 -// <138412032=> 32MHz/31 -// <134217728=> 32MHz/32 -// <100663296=> 32MHz/42 -// <68157440=> 32MHz/63 -// <34340864=> 32MHz/125 +// <0=> Disabled +// <2147483648=> 32MHz/2 +// <1342177280=> 32MHz/3 +// <1073741824=> 32MHz/4 +// <805306368=> 32MHz/5 +// <671088640=> 32MHz/6 +// <536870912=> 32MHz/8 +// <402653184=> 32MHz/10 +// <369098752=> 32MHz/11 +// <285212672=> 32MHz/15 +// <268435456=> 32MHz/16 +// <201326592=> 32MHz/21 +// <184549376=> 32MHz/23 +// <142606336=> 32MHz/30 +// <138412032=> 32MHz/31 +// <134217728=> 32MHz/32 +// <100663296=> 32MHz/42 +// <68157440=> 32MHz/63 +// <34340864=> 32MHz/125 #ifndef I2S_CONFIG_MCK_SETUP -#define I2S_CONFIG_MCK_SETUP 536870912 + #define I2S_CONFIG_MCK_SETUP 536870912 #endif // I2S_CONFIG_RATIO - MCK/LRCK ratio -// <0=> 32x -// <1=> 48x -// <2=> 64x -// <3=> 96x -// <4=> 128x -// <5=> 192x -// <6=> 256x -// <7=> 384x -// <8=> 512x +// <0=> 32x +// <1=> 48x +// <2=> 64x +// <3=> 96x +// <4=> 128x +// <5=> 192x +// <6=> 256x +// <7=> 384x +// <8=> 512x #ifndef I2S_CONFIG_RATIO -#define I2S_CONFIG_RATIO 2000 + #define I2S_CONFIG_RATIO 2000 #endif // I2S_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef I2S_CONFIG_IRQ_PRIORITY -#define I2S_CONFIG_IRQ_PRIORITY 6 + #define I2S_CONFIG_IRQ_PRIORITY 6 #endif // I2S_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef I2S_CONFIG_LOG_ENABLED -#define I2S_CONFIG_LOG_ENABLED 0 + #define I2S_CONFIG_LOG_ENABLED 0 #endif // I2S_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef I2S_CONFIG_LOG_LEVEL -#define I2S_CONFIG_LOG_LEVEL 3 + #define I2S_CONFIG_LOG_LEVEL 3 #endif // I2S_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef I2S_CONFIG_INFO_COLOR -#define I2S_CONFIG_INFO_COLOR 0 + #define I2S_CONFIG_INFO_COLOR 0 #endif // I2S_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef I2S_CONFIG_DEBUG_COLOR -#define I2S_CONFIG_DEBUG_COLOR 0 + #define I2S_CONFIG_DEBUG_COLOR 0 #endif // @@ -2747,79 +2620,77 @@ // LPCOMP_ENABLED - nrf_drv_lpcomp - LPCOMP peripheral driver - legacy layer //========================================================== #ifndef LPCOMP_ENABLED -#define LPCOMP_ENABLED 0 + #define LPCOMP_ENABLED 0 #endif // LPCOMP_CONFIG_REFERENCE - Reference voltage -// <0=> Supply 1/8 -// <1=> Supply 2/8 -// <2=> Supply 3/8 -// <3=> Supply 4/8 -// <4=> Supply 5/8 -// <5=> Supply 6/8 -// <6=> Supply 7/8 -// <8=> Supply 1/16 (nRF52) -// <9=> Supply 3/16 (nRF52) -// <10=> Supply 5/16 (nRF52) -// <11=> Supply 7/16 (nRF52) -// <12=> Supply 9/16 (nRF52) -// <13=> Supply 11/16 (nRF52) -// <14=> Supply 13/16 (nRF52) -// <15=> Supply 15/16 (nRF52) -// <7=> External Ref 0 -// <65543=> External Ref 1 +// <0=> Supply 1/8 +// <1=> Supply 2/8 +// <2=> Supply 3/8 +// <3=> Supply 4/8 +// <4=> Supply 5/8 +// <5=> Supply 6/8 +// <6=> Supply 7/8 +// <8=> Supply 1/16 (nRF52) +// <9=> Supply 3/16 (nRF52) +// <10=> Supply 5/16 (nRF52) +// <11=> Supply 7/16 (nRF52) +// <12=> Supply 9/16 (nRF52) +// <13=> Supply 11/16 (nRF52) +// <14=> Supply 13/16 (nRF52) +// <15=> Supply 15/16 (nRF52) +// <7=> External Ref 0 +// <65543=> External Ref 1 #ifndef LPCOMP_CONFIG_REFERENCE -#define LPCOMP_CONFIG_REFERENCE 3 + #define LPCOMP_CONFIG_REFERENCE 3 #endif // LPCOMP_CONFIG_DETECTION - Detection -// <0=> Crossing -// <1=> Up -// <2=> Down +// <0=> Crossing +// <1=> Up +// <2=> Down #ifndef LPCOMP_CONFIG_DETECTION -#define LPCOMP_CONFIG_DETECTION 2 + #define LPCOMP_CONFIG_DETECTION 2 #endif // LPCOMP_CONFIG_INPUT - Analog input -// <0=> 0 -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef LPCOMP_CONFIG_INPUT -#define LPCOMP_CONFIG_INPUT 0 + #define LPCOMP_CONFIG_INPUT 0 #endif // LPCOMP_CONFIG_HYST - Hysteresis - #ifndef LPCOMP_CONFIG_HYST -#define LPCOMP_CONFIG_HYST 0 + #define LPCOMP_CONFIG_HYST 0 #endif // LPCOMP_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef LPCOMP_CONFIG_IRQ_PRIORITY -#define LPCOMP_CONFIG_IRQ_PRIORITY 6 + #define LPCOMP_CONFIG_IRQ_PRIORITY 6 #endif // @@ -2827,82 +2698,82 @@ // NRFX_CLOCK_ENABLED - nrfx_clock - CLOCK peripheral driver //========================================================== #ifndef NRFX_CLOCK_ENABLED -#define NRFX_CLOCK_ENABLED 1 + #define NRFX_CLOCK_ENABLED 1 #endif // NRFX_CLOCK_CONFIG_LF_SRC - LF Clock Source -// <0=> RC -// <1=> XTAL -// <2=> Synth -// <131073=> External Low Swing -// <196609=> External Full Swing +// <0=> RC +// <1=> XTAL +// <2=> Synth +// <131073=> External Low Swing +// <196609=> External Full Swing #ifndef NRFX_CLOCK_CONFIG_LF_SRC -#define NRFX_CLOCK_CONFIG_LF_SRC 1 + #define NRFX_CLOCK_CONFIG_LF_SRC 1 #endif // NRFX_CLOCK_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_CLOCK_CONFIG_IRQ_PRIORITY -#define NRFX_CLOCK_CONFIG_IRQ_PRIORITY 6 + #define NRFX_CLOCK_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_CLOCK_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_CLOCK_CONFIG_LOG_ENABLED -#define NRFX_CLOCK_CONFIG_LOG_ENABLED 0 + #define NRFX_CLOCK_CONFIG_LOG_ENABLED 0 #endif // NRFX_CLOCK_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_CLOCK_CONFIG_LOG_LEVEL -#define NRFX_CLOCK_CONFIG_LOG_LEVEL 3 + #define NRFX_CLOCK_CONFIG_LOG_LEVEL 3 #endif // NRFX_CLOCK_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_CLOCK_CONFIG_INFO_COLOR -#define NRFX_CLOCK_CONFIG_INFO_COLOR 0 + #define NRFX_CLOCK_CONFIG_INFO_COLOR 0 #endif // NRFX_CLOCK_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_CLOCK_CONFIG_DEBUG_COLOR -#define NRFX_CLOCK_CONFIG_DEBUG_COLOR 0 + #define NRFX_CLOCK_CONFIG_DEBUG_COLOR 0 #endif // @@ -2912,136 +2783,136 @@ // NRFX_COMP_ENABLED - nrfx_comp - COMP peripheral driver //========================================================== #ifndef NRFX_COMP_ENABLED -#define NRFX_COMP_ENABLED 0 + #define NRFX_COMP_ENABLED 0 #endif // NRFX_COMP_CONFIG_REF - Reference voltage -// <0=> Internal 1.2V -// <1=> Internal 1.8V -// <2=> Internal 2.4V -// <4=> VDD -// <7=> ARef +// <0=> Internal 1.2V +// <1=> Internal 1.8V +// <2=> Internal 2.4V +// <4=> VDD +// <7=> ARef #ifndef NRFX_COMP_CONFIG_REF -#define NRFX_COMP_CONFIG_REF 1 + #define NRFX_COMP_CONFIG_REF 1 #endif // NRFX_COMP_CONFIG_MAIN_MODE - Main mode -// <0=> Single ended -// <1=> Differential +// <0=> Single ended +// <1=> Differential #ifndef NRFX_COMP_CONFIG_MAIN_MODE -#define NRFX_COMP_CONFIG_MAIN_MODE 0 + #define NRFX_COMP_CONFIG_MAIN_MODE 0 #endif // NRFX_COMP_CONFIG_SPEED_MODE - Speed mode -// <0=> Low power -// <1=> Normal -// <2=> High speed +// <0=> Low power +// <1=> Normal +// <2=> High speed #ifndef NRFX_COMP_CONFIG_SPEED_MODE -#define NRFX_COMP_CONFIG_SPEED_MODE 2 + #define NRFX_COMP_CONFIG_SPEED_MODE 2 #endif // NRFX_COMP_CONFIG_HYST - Hystheresis -// <0=> No -// <1=> 50mV +// <0=> No +// <1=> 50mV #ifndef NRFX_COMP_CONFIG_HYST -#define NRFX_COMP_CONFIG_HYST 0 + #define NRFX_COMP_CONFIG_HYST 0 #endif // NRFX_COMP_CONFIG_ISOURCE - Current Source -// <0=> Off -// <1=> 2.5 uA -// <2=> 5 uA -// <3=> 10 uA +// <0=> Off +// <1=> 2.5 uA +// <2=> 5 uA +// <3=> 10 uA #ifndef NRFX_COMP_CONFIG_ISOURCE -#define NRFX_COMP_CONFIG_ISOURCE 0 + #define NRFX_COMP_CONFIG_ISOURCE 0 #endif // NRFX_COMP_CONFIG_INPUT - Analog input -// <0=> 0 -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_COMP_CONFIG_INPUT -#define NRFX_COMP_CONFIG_INPUT 0 + #define NRFX_COMP_CONFIG_INPUT 0 #endif // NRFX_COMP_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_COMP_CONFIG_IRQ_PRIORITY -#define NRFX_COMP_CONFIG_IRQ_PRIORITY 6 + #define NRFX_COMP_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_COMP_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_COMP_CONFIG_LOG_ENABLED -#define NRFX_COMP_CONFIG_LOG_ENABLED 0 + #define NRFX_COMP_CONFIG_LOG_ENABLED 0 #endif // NRFX_COMP_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_COMP_CONFIG_LOG_LEVEL -#define NRFX_COMP_CONFIG_LOG_LEVEL 3 + #define NRFX_COMP_CONFIG_LOG_LEVEL 3 #endif // NRFX_COMP_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_COMP_CONFIG_INFO_COLOR -#define NRFX_COMP_CONFIG_INFO_COLOR 0 + #define NRFX_COMP_CONFIG_INFO_COLOR 0 #endif // NRFX_COMP_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_COMP_CONFIG_DEBUG_COLOR -#define NRFX_COMP_CONFIG_DEBUG_COLOR 0 + #define NRFX_COMP_CONFIG_DEBUG_COLOR 0 #endif // @@ -3051,75 +2922,75 @@ // NRFX_GPIOTE_ENABLED - nrfx_gpiote - GPIOTE peripheral driver //========================================================== #ifndef NRFX_GPIOTE_ENABLED -#define NRFX_GPIOTE_ENABLED 1 + #define NRFX_GPIOTE_ENABLED 1 #endif -// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins +// NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS - Number of lower power input pins #ifndef NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS -#define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 4 + #define NRFX_GPIOTE_CONFIG_NUM_OF_LOW_POWER_EVENTS 4 #endif // NRFX_GPIOTE_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_GPIOTE_CONFIG_IRQ_PRIORITY -#define NRFX_GPIOTE_CONFIG_IRQ_PRIORITY 6 + #define NRFX_GPIOTE_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_GPIOTE_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_GPIOTE_CONFIG_LOG_ENABLED -#define NRFX_GPIOTE_CONFIG_LOG_ENABLED 0 + #define NRFX_GPIOTE_CONFIG_LOG_ENABLED 0 #endif // NRFX_GPIOTE_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_GPIOTE_CONFIG_LOG_LEVEL -#define NRFX_GPIOTE_CONFIG_LOG_LEVEL 3 + #define NRFX_GPIOTE_CONFIG_LOG_LEVEL 3 #endif // NRFX_GPIOTE_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_GPIOTE_CONFIG_INFO_COLOR -#define NRFX_GPIOTE_CONFIG_INFO_COLOR 0 + #define NRFX_GPIOTE_CONFIG_INFO_COLOR 0 #endif // NRFX_GPIOTE_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_GPIOTE_CONFIG_DEBUG_COLOR -#define NRFX_GPIOTE_CONFIG_DEBUG_COLOR 0 + #define NRFX_GPIOTE_CONFIG_DEBUG_COLOR 0 #endif // @@ -3129,192 +3000,188 @@ // NRFX_I2S_ENABLED - nrfx_i2s - I2S peripheral driver //========================================================== #ifndef NRFX_I2S_ENABLED -#define NRFX_I2S_ENABLED 0 + #define NRFX_I2S_ENABLED 0 #endif -// NRFX_I2S_CONFIG_SCK_PIN - SCK pin <0-31> - +// NRFX_I2S_CONFIG_SCK_PIN - SCK pin <0-31> #ifndef NRFX_I2S_CONFIG_SCK_PIN -#define NRFX_I2S_CONFIG_SCK_PIN 31 + #define NRFX_I2S_CONFIG_SCK_PIN 31 #endif -// NRFX_I2S_CONFIG_LRCK_PIN - LRCK pin <1-31> - +// NRFX_I2S_CONFIG_LRCK_PIN - LRCK pin <1-31> #ifndef NRFX_I2S_CONFIG_LRCK_PIN -#define NRFX_I2S_CONFIG_LRCK_PIN 30 + #define NRFX_I2S_CONFIG_LRCK_PIN 30 #endif -// NRFX_I2S_CONFIG_MCK_PIN - MCK pin +// NRFX_I2S_CONFIG_MCK_PIN - MCK pin #ifndef NRFX_I2S_CONFIG_MCK_PIN -#define NRFX_I2S_CONFIG_MCK_PIN 255 + #define NRFX_I2S_CONFIG_MCK_PIN 255 #endif -// NRFX_I2S_CONFIG_SDOUT_PIN - SDOUT pin <0-31> - +// NRFX_I2S_CONFIG_SDOUT_PIN - SDOUT pin <0-31> #ifndef NRFX_I2S_CONFIG_SDOUT_PIN -#define NRFX_I2S_CONFIG_SDOUT_PIN 29 + #define NRFX_I2S_CONFIG_SDOUT_PIN 29 #endif -// NRFX_I2S_CONFIG_SDIN_PIN - SDIN pin <0-31> - +// NRFX_I2S_CONFIG_SDIN_PIN - SDIN pin <0-31> #ifndef NRFX_I2S_CONFIG_SDIN_PIN -#define NRFX_I2S_CONFIG_SDIN_PIN 28 + #define NRFX_I2S_CONFIG_SDIN_PIN 28 #endif // NRFX_I2S_CONFIG_MASTER - Mode -// <0=> Master -// <1=> Slave +// <0=> Master +// <1=> Slave #ifndef NRFX_I2S_CONFIG_MASTER -#define NRFX_I2S_CONFIG_MASTER 0 + #define NRFX_I2S_CONFIG_MASTER 0 #endif // NRFX_I2S_CONFIG_FORMAT - Format -// <0=> I2S -// <1=> Aligned +// <0=> I2S +// <1=> Aligned #ifndef NRFX_I2S_CONFIG_FORMAT -#define NRFX_I2S_CONFIG_FORMAT 0 + #define NRFX_I2S_CONFIG_FORMAT 0 #endif // NRFX_I2S_CONFIG_ALIGN - Alignment -// <0=> Left -// <1=> Right +// <0=> Left +// <1=> Right #ifndef NRFX_I2S_CONFIG_ALIGN -#define NRFX_I2S_CONFIG_ALIGN 0 + #define NRFX_I2S_CONFIG_ALIGN 0 #endif // NRFX_I2S_CONFIG_SWIDTH - Sample width (bits) -// <0=> 8 -// <1=> 16 -// <2=> 24 +// <0=> 8 +// <1=> 16 +// <2=> 24 #ifndef NRFX_I2S_CONFIG_SWIDTH -#define NRFX_I2S_CONFIG_SWIDTH 1 + #define NRFX_I2S_CONFIG_SWIDTH 1 #endif // NRFX_I2S_CONFIG_CHANNELS - Channels -// <0=> Stereo -// <1=> Left -// <2=> Right +// <0=> Stereo +// <1=> Left +// <2=> Right #ifndef NRFX_I2S_CONFIG_CHANNELS -#define NRFX_I2S_CONFIG_CHANNELS 1 + #define NRFX_I2S_CONFIG_CHANNELS 1 #endif // NRFX_I2S_CONFIG_MCK_SETUP - MCK behavior -// <0=> Disabled -// <2147483648=> 32MHz/2 -// <1342177280=> 32MHz/3 -// <1073741824=> 32MHz/4 -// <805306368=> 32MHz/5 -// <671088640=> 32MHz/6 -// <536870912=> 32MHz/8 -// <402653184=> 32MHz/10 -// <369098752=> 32MHz/11 -// <285212672=> 32MHz/15 -// <268435456=> 32MHz/16 -// <201326592=> 32MHz/21 -// <184549376=> 32MHz/23 -// <142606336=> 32MHz/30 -// <138412032=> 32MHz/31 -// <134217728=> 32MHz/32 -// <100663296=> 32MHz/42 -// <68157440=> 32MHz/63 -// <34340864=> 32MHz/125 +// <0=> Disabled +// <2147483648=> 32MHz/2 +// <1342177280=> 32MHz/3 +// <1073741824=> 32MHz/4 +// <805306368=> 32MHz/5 +// <671088640=> 32MHz/6 +// <536870912=> 32MHz/8 +// <402653184=> 32MHz/10 +// <369098752=> 32MHz/11 +// <285212672=> 32MHz/15 +// <268435456=> 32MHz/16 +// <201326592=> 32MHz/21 +// <184549376=> 32MHz/23 +// <142606336=> 32MHz/30 +// <138412032=> 32MHz/31 +// <134217728=> 32MHz/32 +// <100663296=> 32MHz/42 +// <68157440=> 32MHz/63 +// <34340864=> 32MHz/125 #ifndef NRFX_I2S_CONFIG_MCK_SETUP -#define NRFX_I2S_CONFIG_MCK_SETUP 536870912 + #define NRFX_I2S_CONFIG_MCK_SETUP 536870912 #endif // NRFX_I2S_CONFIG_RATIO - MCK/LRCK ratio -// <0=> 32x -// <1=> 48x -// <2=> 64x -// <3=> 96x -// <4=> 128x -// <5=> 192x -// <6=> 256x -// <7=> 384x -// <8=> 512x +// <0=> 32x +// <1=> 48x +// <2=> 64x +// <3=> 96x +// <4=> 128x +// <5=> 192x +// <6=> 256x +// <7=> 384x +// <8=> 512x #ifndef NRFX_I2S_CONFIG_RATIO -#define NRFX_I2S_CONFIG_RATIO 2000 + #define NRFX_I2S_CONFIG_RATIO 2000 #endif // NRFX_I2S_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_I2S_CONFIG_IRQ_PRIORITY -#define NRFX_I2S_CONFIG_IRQ_PRIORITY 6 + #define NRFX_I2S_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_I2S_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_I2S_CONFIG_LOG_ENABLED -#define NRFX_I2S_CONFIG_LOG_ENABLED 0 + #define NRFX_I2S_CONFIG_LOG_ENABLED 0 #endif // NRFX_I2S_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_I2S_CONFIG_LOG_LEVEL -#define NRFX_I2S_CONFIG_LOG_LEVEL 3 + #define NRFX_I2S_CONFIG_LOG_LEVEL 3 #endif // NRFX_I2S_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_I2S_CONFIG_INFO_COLOR -#define NRFX_I2S_CONFIG_INFO_COLOR 0 + #define NRFX_I2S_CONFIG_INFO_COLOR 0 #endif // NRFX_I2S_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_I2S_CONFIG_DEBUG_COLOR -#define NRFX_I2S_CONFIG_DEBUG_COLOR 0 + #define NRFX_I2S_CONFIG_DEBUG_COLOR 0 #endif // @@ -3324,126 +3191,125 @@ // NRFX_LPCOMP_ENABLED - nrfx_lpcomp - LPCOMP peripheral driver //========================================================== #ifndef NRFX_LPCOMP_ENABLED -#define NRFX_LPCOMP_ENABLED 0 + #define NRFX_LPCOMP_ENABLED 0 #endif // NRFX_LPCOMP_CONFIG_REFERENCE - Reference voltage -// <0=> Supply 1/8 -// <1=> Supply 2/8 -// <2=> Supply 3/8 -// <3=> Supply 4/8 -// <4=> Supply 5/8 -// <5=> Supply 6/8 -// <6=> Supply 7/8 -// <8=> Supply 1/16 (nRF52) -// <9=> Supply 3/16 (nRF52) -// <10=> Supply 5/16 (nRF52) -// <11=> Supply 7/16 (nRF52) -// <12=> Supply 9/16 (nRF52) -// <13=> Supply 11/16 (nRF52) -// <14=> Supply 13/16 (nRF52) -// <15=> Supply 15/16 (nRF52) -// <7=> External Ref 0 -// <65543=> External Ref 1 +// <0=> Supply 1/8 +// <1=> Supply 2/8 +// <2=> Supply 3/8 +// <3=> Supply 4/8 +// <4=> Supply 5/8 +// <5=> Supply 6/8 +// <6=> Supply 7/8 +// <8=> Supply 1/16 (nRF52) +// <9=> Supply 3/16 (nRF52) +// <10=> Supply 5/16 (nRF52) +// <11=> Supply 7/16 (nRF52) +// <12=> Supply 9/16 (nRF52) +// <13=> Supply 11/16 (nRF52) +// <14=> Supply 13/16 (nRF52) +// <15=> Supply 15/16 (nRF52) +// <7=> External Ref 0 +// <65543=> External Ref 1 #ifndef NRFX_LPCOMP_CONFIG_REFERENCE -#define NRFX_LPCOMP_CONFIG_REFERENCE 3 + #define NRFX_LPCOMP_CONFIG_REFERENCE 3 #endif // NRFX_LPCOMP_CONFIG_DETECTION - Detection -// <0=> Crossing -// <1=> Up -// <2=> Down +// <0=> Crossing +// <1=> Up +// <2=> Down #ifndef NRFX_LPCOMP_CONFIG_DETECTION -#define NRFX_LPCOMP_CONFIG_DETECTION 2 + #define NRFX_LPCOMP_CONFIG_DETECTION 2 #endif // NRFX_LPCOMP_CONFIG_INPUT - Analog input -// <0=> 0 -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_LPCOMP_CONFIG_INPUT -#define NRFX_LPCOMP_CONFIG_INPUT 0 + #define NRFX_LPCOMP_CONFIG_INPUT 0 #endif // NRFX_LPCOMP_CONFIG_HYST - Hysteresis - #ifndef NRFX_LPCOMP_CONFIG_HYST -#define NRFX_LPCOMP_CONFIG_HYST 0 + #define NRFX_LPCOMP_CONFIG_HYST 0 #endif // NRFX_LPCOMP_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_LPCOMP_CONFIG_IRQ_PRIORITY -#define NRFX_LPCOMP_CONFIG_IRQ_PRIORITY 6 + #define NRFX_LPCOMP_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_LPCOMP_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_LPCOMP_CONFIG_LOG_ENABLED -#define NRFX_LPCOMP_CONFIG_LOG_ENABLED 0 + #define NRFX_LPCOMP_CONFIG_LOG_ENABLED 0 #endif // NRFX_LPCOMP_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_LPCOMP_CONFIG_LOG_LEVEL -#define NRFX_LPCOMP_CONFIG_LOG_LEVEL 3 + #define NRFX_LPCOMP_CONFIG_LOG_LEVEL 3 #endif // NRFX_LPCOMP_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_LPCOMP_CONFIG_INFO_COLOR -#define NRFX_LPCOMP_CONFIG_INFO_COLOR 0 + #define NRFX_LPCOMP_CONFIG_INFO_COLOR 0 #endif // NRFX_LPCOMP_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_LPCOMP_CONFIG_DEBUG_COLOR -#define NRFX_LPCOMP_CONFIG_DEBUG_COLOR 0 + #define NRFX_LPCOMP_CONFIG_DEBUG_COLOR 0 #endif // @@ -3453,98 +3319,98 @@ // NRFX_PDM_ENABLED - nrfx_pdm - PDM peripheral driver //========================================================== #ifndef NRFX_PDM_ENABLED -#define NRFX_PDM_ENABLED 0 + #define NRFX_PDM_ENABLED 0 #endif // NRFX_PDM_CONFIG_MODE - Mode -// <0=> Stereo -// <1=> Mono +// <0=> Stereo +// <1=> Mono #ifndef NRFX_PDM_CONFIG_MODE -#define NRFX_PDM_CONFIG_MODE 1 + #define NRFX_PDM_CONFIG_MODE 1 #endif // NRFX_PDM_CONFIG_EDGE - Edge -// <0=> Left falling -// <1=> Left rising +// <0=> Left falling +// <1=> Left rising #ifndef NRFX_PDM_CONFIG_EDGE -#define NRFX_PDM_CONFIG_EDGE 0 + #define NRFX_PDM_CONFIG_EDGE 0 #endif // NRFX_PDM_CONFIG_CLOCK_FREQ - Clock frequency -// <134217728=> 1000k -// <138412032=> 1032k (default) -// <142606336=> 1067k +// <134217728=> 1000k +// <138412032=> 1032k (default) +// <142606336=> 1067k #ifndef NRFX_PDM_CONFIG_CLOCK_FREQ -#define NRFX_PDM_CONFIG_CLOCK_FREQ 138412032 + #define NRFX_PDM_CONFIG_CLOCK_FREQ 138412032 #endif // NRFX_PDM_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_PDM_CONFIG_IRQ_PRIORITY -#define NRFX_PDM_CONFIG_IRQ_PRIORITY 6 + #define NRFX_PDM_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_PDM_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_PDM_CONFIG_LOG_ENABLED -#define NRFX_PDM_CONFIG_LOG_ENABLED 0 + #define NRFX_PDM_CONFIG_LOG_ENABLED 0 #endif // NRFX_PDM_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_PDM_CONFIG_LOG_LEVEL -#define NRFX_PDM_CONFIG_LOG_LEVEL 3 + #define NRFX_PDM_CONFIG_LOG_LEVEL 3 #endif // NRFX_PDM_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_PDM_CONFIG_INFO_COLOR -#define NRFX_PDM_CONFIG_INFO_COLOR 0 + #define NRFX_PDM_CONFIG_INFO_COLOR 0 #endif // NRFX_PDM_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_PDM_CONFIG_DEBUG_COLOR -#define NRFX_PDM_CONFIG_DEBUG_COLOR 0 + #define NRFX_PDM_CONFIG_DEBUG_COLOR 0 #endif // @@ -3554,39 +3420,37 @@ // NRFX_POWER_ENABLED - nrfx_power - POWER peripheral driver //========================================================== #ifndef NRFX_POWER_ENABLED -#define NRFX_POWER_ENABLED 0 + #define NRFX_POWER_ENABLED 0 #endif // NRFX_POWER_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_POWER_CONFIG_IRQ_PRIORITY -#define NRFX_POWER_CONFIG_IRQ_PRIORITY 6 + #define NRFX_POWER_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_POWER_CONFIG_DEFAULT_DCDCEN - The default configuration of main DCDC regulator - // This settings means only that components for DCDC regulator are installed and it can be enabled. #ifndef NRFX_POWER_CONFIG_DEFAULT_DCDCEN -#define NRFX_POWER_CONFIG_DEFAULT_DCDCEN 0 + #define NRFX_POWER_CONFIG_DEFAULT_DCDCEN 0 #endif // NRFX_POWER_CONFIG_DEFAULT_DCDCENHV - The default configuration of High Voltage DCDC regulator - // This settings means only that components for DCDC regulator are installed and it can be enabled. #ifndef NRFX_POWER_CONFIG_DEFAULT_DCDCENHV -#define NRFX_POWER_CONFIG_DEFAULT_DCDCENHV 0 + #define NRFX_POWER_CONFIG_DEFAULT_DCDCENHV 0 #endif // @@ -3594,55 +3458,55 @@ // NRFX_PPI_ENABLED - nrfx_ppi - PPI peripheral allocator //========================================================== #ifndef NRFX_PPI_ENABLED -#define NRFX_PPI_ENABLED 0 + #define NRFX_PPI_ENABLED 0 #endif // NRFX_PPI_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_PPI_CONFIG_LOG_ENABLED -#define NRFX_PPI_CONFIG_LOG_ENABLED 0 + #define NRFX_PPI_CONFIG_LOG_ENABLED 0 #endif // NRFX_PPI_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_PPI_CONFIG_LOG_LEVEL -#define NRFX_PPI_CONFIG_LOG_LEVEL 3 + #define NRFX_PPI_CONFIG_LOG_LEVEL 3 #endif // NRFX_PPI_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_PPI_CONFIG_INFO_COLOR -#define NRFX_PPI_CONFIG_INFO_COLOR 0 + #define NRFX_PPI_CONFIG_INFO_COLOR 0 #endif // NRFX_PPI_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_PPI_CONFIG_DEBUG_COLOR -#define NRFX_PPI_CONFIG_DEBUG_COLOR 0 + #define NRFX_PPI_CONFIG_DEBUG_COLOR 0 #endif // @@ -3652,47 +3516,42 @@ // NRFX_PRS_ENABLED - nrfx_prs - Peripheral Resource Sharing module //========================================================== #ifndef NRFX_PRS_ENABLED -#define NRFX_PRS_ENABLED 0 + #define NRFX_PRS_ENABLED 0 #endif // NRFX_PRS_BOX_0_ENABLED - Enables box 0 in the module. - #ifndef NRFX_PRS_BOX_0_ENABLED -#define NRFX_PRS_BOX_0_ENABLED 0 + #define NRFX_PRS_BOX_0_ENABLED 0 #endif // NRFX_PRS_BOX_1_ENABLED - Enables box 1 in the module. - #ifndef NRFX_PRS_BOX_1_ENABLED -#define NRFX_PRS_BOX_1_ENABLED 0 + #define NRFX_PRS_BOX_1_ENABLED 0 #endif // NRFX_PRS_BOX_2_ENABLED - Enables box 2 in the module. - #ifndef NRFX_PRS_BOX_2_ENABLED -#define NRFX_PRS_BOX_2_ENABLED 0 + #define NRFX_PRS_BOX_2_ENABLED 0 #endif // NRFX_PRS_BOX_3_ENABLED - Enables box 3 in the module. - #ifndef NRFX_PRS_BOX_3_ENABLED -#define NRFX_PRS_BOX_3_ENABLED 0 + #define NRFX_PRS_BOX_3_ENABLED 0 #endif // NRFX_PRS_BOX_4_ENABLED - Enables box 4 in the module. - #ifndef NRFX_PRS_BOX_4_ENABLED -#define NRFX_PRS_BOX_4_ENABLED 1 + #define NRFX_PRS_BOX_4_ENABLED 1 #endif // NRFX_PRS_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_PRS_CONFIG_LOG_ENABLED -#define NRFX_PRS_CONFIG_LOG_ENABLED 0 + #define NRFX_PRS_CONFIG_LOG_ENABLED 0 #endif // NRFX_PRS_CONFIG_LOG_LEVEL - Default Severity level @@ -3703,7 +3562,7 @@ // <4=> Debug #ifndef NRFX_PRS_CONFIG_LOG_LEVEL -#define NRFX_PRS_CONFIG_LOG_LEVEL 3 + #define NRFX_PRS_CONFIG_LOG_LEVEL 3 #endif // NRFX_PRS_CONFIG_INFO_COLOR - ANSI escape code prefix. @@ -3719,7 +3578,7 @@ // <8=> White #ifndef NRFX_PRS_CONFIG_INFO_COLOR -#define NRFX_PRS_CONFIG_INFO_COLOR 0 + #define NRFX_PRS_CONFIG_INFO_COLOR 0 #endif // NRFX_PRS_CONFIG_DEBUG_COLOR - ANSI escape code prefix. @@ -3735,7 +3594,7 @@ // <8=> White #ifndef NRFX_PRS_CONFIG_DEBUG_COLOR -#define NRFX_PRS_CONFIG_DEBUG_COLOR 0 + #define NRFX_PRS_CONFIG_DEBUG_COLOR 0 #endif // @@ -3745,168 +3604,161 @@ // NRFX_PWM_ENABLED - nrfx_pwm - PWM peripheral driver //========================================================== #ifndef NRFX_PWM_ENABLED -#define NRFX_PWM_ENABLED 0 + #define NRFX_PWM_ENABLED 0 #endif // NRFX_PWM0_ENABLED - Enable PWM0 instance - #ifndef NRFX_PWM0_ENABLED -#define NRFX_PWM0_ENABLED 0 + #define NRFX_PWM0_ENABLED 0 #endif // NRFX_PWM1_ENABLED - Enable PWM1 instance - #ifndef NRFX_PWM1_ENABLED -#define NRFX_PWM1_ENABLED 0 + #define NRFX_PWM1_ENABLED 0 #endif // NRFX_PWM2_ENABLED - Enable PWM2 instance - #ifndef NRFX_PWM2_ENABLED -#define NRFX_PWM2_ENABLED 0 + #define NRFX_PWM2_ENABLED 0 #endif -// NRFX_PWM_DEFAULT_CONFIG_OUT0_PIN - Out0 pin <0-31> - +// NRFX_PWM_DEFAULT_CONFIG_OUT0_PIN - Out0 pin <0-31> #ifndef NRFX_PWM_DEFAULT_CONFIG_OUT0_PIN -#define NRFX_PWM_DEFAULT_CONFIG_OUT0_PIN 31 + #define NRFX_PWM_DEFAULT_CONFIG_OUT0_PIN 31 #endif -// NRFX_PWM_DEFAULT_CONFIG_OUT1_PIN - Out1 pin <0-31> - +// NRFX_PWM_DEFAULT_CONFIG_OUT1_PIN - Out1 pin <0-31> #ifndef NRFX_PWM_DEFAULT_CONFIG_OUT1_PIN -#define NRFX_PWM_DEFAULT_CONFIG_OUT1_PIN 31 + #define NRFX_PWM_DEFAULT_CONFIG_OUT1_PIN 31 #endif -// NRFX_PWM_DEFAULT_CONFIG_OUT2_PIN - Out2 pin <0-31> - +// NRFX_PWM_DEFAULT_CONFIG_OUT2_PIN - Out2 pin <0-31> #ifndef NRFX_PWM_DEFAULT_CONFIG_OUT2_PIN -#define NRFX_PWM_DEFAULT_CONFIG_OUT2_PIN 31 + #define NRFX_PWM_DEFAULT_CONFIG_OUT2_PIN 31 #endif -// NRFX_PWM_DEFAULT_CONFIG_OUT3_PIN - Out3 pin <0-31> - +// NRFX_PWM_DEFAULT_CONFIG_OUT3_PIN - Out3 pin <0-31> #ifndef NRFX_PWM_DEFAULT_CONFIG_OUT3_PIN -#define NRFX_PWM_DEFAULT_CONFIG_OUT3_PIN 31 + #define NRFX_PWM_DEFAULT_CONFIG_OUT3_PIN 31 #endif // NRFX_PWM_DEFAULT_CONFIG_BASE_CLOCK - Base clock -// <0=> 16 MHz -// <1=> 8 MHz -// <2=> 4 MHz -// <3=> 2 MHz -// <4=> 1 MHz -// <5=> 500 kHz -// <6=> 250 kHz -// <7=> 125 kHz +// <0=> 16 MHz +// <1=> 8 MHz +// <2=> 4 MHz +// <3=> 2 MHz +// <4=> 1 MHz +// <5=> 500 kHz +// <6=> 250 kHz +// <7=> 125 kHz #ifndef NRFX_PWM_DEFAULT_CONFIG_BASE_CLOCK -#define NRFX_PWM_DEFAULT_CONFIG_BASE_CLOCK 4 + #define NRFX_PWM_DEFAULT_CONFIG_BASE_CLOCK 4 #endif // NRFX_PWM_DEFAULT_CONFIG_COUNT_MODE - Count mode -// <0=> Up -// <1=> Up and Down +// <0=> Up +// <1=> Up and Down #ifndef NRFX_PWM_DEFAULT_CONFIG_COUNT_MODE -#define NRFX_PWM_DEFAULT_CONFIG_COUNT_MODE 0 + #define NRFX_PWM_DEFAULT_CONFIG_COUNT_MODE 0 #endif -// NRFX_PWM_DEFAULT_CONFIG_TOP_VALUE - Top value +// NRFX_PWM_DEFAULT_CONFIG_TOP_VALUE - Top value #ifndef NRFX_PWM_DEFAULT_CONFIG_TOP_VALUE -#define NRFX_PWM_DEFAULT_CONFIG_TOP_VALUE 1000 + #define NRFX_PWM_DEFAULT_CONFIG_TOP_VALUE 1000 #endif // NRFX_PWM_DEFAULT_CONFIG_LOAD_MODE - Load mode -// <0=> Common -// <1=> Grouped -// <2=> Individual -// <3=> Waveform +// <0=> Common +// <1=> Grouped +// <2=> Individual +// <3=> Waveform #ifndef NRFX_PWM_DEFAULT_CONFIG_LOAD_MODE -#define NRFX_PWM_DEFAULT_CONFIG_LOAD_MODE 0 + #define NRFX_PWM_DEFAULT_CONFIG_LOAD_MODE 0 #endif // NRFX_PWM_DEFAULT_CONFIG_STEP_MODE - Step mode -// <0=> Auto -// <1=> Triggered +// <0=> Auto +// <1=> Triggered #ifndef NRFX_PWM_DEFAULT_CONFIG_STEP_MODE -#define NRFX_PWM_DEFAULT_CONFIG_STEP_MODE 0 + #define NRFX_PWM_DEFAULT_CONFIG_STEP_MODE 0 #endif // NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define NRFX_PWM_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_PWM_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_PWM_CONFIG_LOG_ENABLED -#define NRFX_PWM_CONFIG_LOG_ENABLED 0 + #define NRFX_PWM_CONFIG_LOG_ENABLED 0 #endif // NRFX_PWM_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_PWM_CONFIG_LOG_LEVEL -#define NRFX_PWM_CONFIG_LOG_LEVEL 3 + #define NRFX_PWM_CONFIG_LOG_LEVEL 3 #endif // NRFX_PWM_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_PWM_CONFIG_INFO_COLOR -#define NRFX_PWM_CONFIG_INFO_COLOR 0 + #define NRFX_PWM_CONFIG_INFO_COLOR 0 #endif // NRFX_PWM_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_PWM_CONFIG_DEBUG_COLOR -#define NRFX_PWM_CONFIG_DEBUG_COLOR 0 + #define NRFX_PWM_CONFIG_DEBUG_COLOR 0 #endif // @@ -3922,19 +3774,19 @@ // done for the next sequence to be played. //========================================================== #ifndef NRFX_PWM_NRF52_ANOMALY_109_WORKAROUND_ENABLED -#define NRFX_PWM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 + #define NRFX_PWM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 #endif // NRFX_PWM_NRF52_ANOMALY_109_EGU_INSTANCE - EGU instance used by the nRF52 Anomaly 109 workaround for PWM. -// <0=> EGU0 -// <1=> EGU1 -// <2=> EGU2 -// <3=> EGU3 -// <4=> EGU4 -// <5=> EGU5 +// <0=> EGU0 +// <1=> EGU1 +// <2=> EGU2 +// <3=> EGU3 +// <4=> EGU4 +// <5=> EGU5 #ifndef NRFX_PWM_NRF52_ANOMALY_109_EGU_INSTANCE -#define NRFX_PWM_NRF52_ANOMALY_109_EGU_INSTANCE 5 + #define NRFX_PWM_NRF52_ANOMALY_109_EGU_INSTANCE 5 #endif // @@ -3944,149 +3796,144 @@ // NRFX_QDEC_ENABLED - nrfx_qdec - QDEC peripheral driver //========================================================== #ifndef NRFX_QDEC_ENABLED -#define NRFX_QDEC_ENABLED 0 + #define NRFX_QDEC_ENABLED 0 #endif // NRFX_QDEC_CONFIG_REPORTPER - Report period -// <0=> 10 Samples -// <1=> 40 Samples -// <2=> 80 Samples -// <3=> 120 Samples -// <4=> 160 Samples -// <5=> 200 Samples -// <6=> 240 Samples -// <7=> 280 Samples +// <0=> 10 Samples +// <1=> 40 Samples +// <2=> 80 Samples +// <3=> 120 Samples +// <4=> 160 Samples +// <5=> 200 Samples +// <6=> 240 Samples +// <7=> 280 Samples #ifndef NRFX_QDEC_CONFIG_REPORTPER -#define NRFX_QDEC_CONFIG_REPORTPER 0 + #define NRFX_QDEC_CONFIG_REPORTPER 0 #endif // NRFX_QDEC_CONFIG_SAMPLEPER - Sample period -// <0=> 128 us -// <1=> 256 us -// <2=> 512 us -// <3=> 1024 us -// <4=> 2048 us -// <5=> 4096 us -// <6=> 8192 us -// <7=> 16384 us +// <0=> 128 us +// <1=> 256 us +// <2=> 512 us +// <3=> 1024 us +// <4=> 2048 us +// <5=> 4096 us +// <6=> 8192 us +// <7=> 16384 us #ifndef NRFX_QDEC_CONFIG_SAMPLEPER -#define NRFX_QDEC_CONFIG_SAMPLEPER 7 + #define NRFX_QDEC_CONFIG_SAMPLEPER 7 #endif -// NRFX_QDEC_CONFIG_PIO_A - A pin <0-31> - +// NRFX_QDEC_CONFIG_PIO_A - A pin <0-31> #ifndef NRFX_QDEC_CONFIG_PIO_A -#define NRFX_QDEC_CONFIG_PIO_A 31 + #define NRFX_QDEC_CONFIG_PIO_A 31 #endif -// NRFX_QDEC_CONFIG_PIO_B - B pin <0-31> - +// NRFX_QDEC_CONFIG_PIO_B - B pin <0-31> #ifndef NRFX_QDEC_CONFIG_PIO_B -#define NRFX_QDEC_CONFIG_PIO_B 31 + #define NRFX_QDEC_CONFIG_PIO_B 31 #endif -// NRFX_QDEC_CONFIG_PIO_LED - LED pin <0-31> - +// NRFX_QDEC_CONFIG_PIO_LED - LED pin <0-31> #ifndef NRFX_QDEC_CONFIG_PIO_LED -#define NRFX_QDEC_CONFIG_PIO_LED 31 + #define NRFX_QDEC_CONFIG_PIO_LED 31 #endif -// NRFX_QDEC_CONFIG_LEDPRE - LED pre +// NRFX_QDEC_CONFIG_LEDPRE - LED pre #ifndef NRFX_QDEC_CONFIG_LEDPRE -#define NRFX_QDEC_CONFIG_LEDPRE 511 + #define NRFX_QDEC_CONFIG_LEDPRE 511 #endif // NRFX_QDEC_CONFIG_LEDPOL - LED polarity -// <0=> Active low -// <1=> Active high +// <0=> Active low +// <1=> Active high #ifndef NRFX_QDEC_CONFIG_LEDPOL -#define NRFX_QDEC_CONFIG_LEDPOL 1 + #define NRFX_QDEC_CONFIG_LEDPOL 1 #endif // NRFX_QDEC_CONFIG_DBFEN - Debouncing enable - #ifndef NRFX_QDEC_CONFIG_DBFEN -#define NRFX_QDEC_CONFIG_DBFEN 0 + #define NRFX_QDEC_CONFIG_DBFEN 0 #endif // NRFX_QDEC_CONFIG_SAMPLE_INTEN - Sample ready interrupt enable - #ifndef NRFX_QDEC_CONFIG_SAMPLE_INTEN -#define NRFX_QDEC_CONFIG_SAMPLE_INTEN 0 + #define NRFX_QDEC_CONFIG_SAMPLE_INTEN 0 #endif // NRFX_QDEC_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_QDEC_CONFIG_IRQ_PRIORITY -#define NRFX_QDEC_CONFIG_IRQ_PRIORITY 6 + #define NRFX_QDEC_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_QDEC_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_QDEC_CONFIG_LOG_ENABLED -#define NRFX_QDEC_CONFIG_LOG_ENABLED 0 + #define NRFX_QDEC_CONFIG_LOG_ENABLED 0 #endif // NRFX_QDEC_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_QDEC_CONFIG_LOG_LEVEL -#define NRFX_QDEC_CONFIG_LOG_LEVEL 3 + #define NRFX_QDEC_CONFIG_LOG_LEVEL 3 #endif // NRFX_QDEC_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_QDEC_CONFIG_INFO_COLOR -#define NRFX_QDEC_CONFIG_INFO_COLOR 0 + #define NRFX_QDEC_CONFIG_INFO_COLOR 0 #endif // NRFX_QDEC_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_QDEC_CONFIG_DEBUG_COLOR -#define NRFX_QDEC_CONFIG_DEBUG_COLOR 0 + #define NRFX_QDEC_CONFIG_DEBUG_COLOR 0 #endif // @@ -4096,77 +3943,76 @@ // NRFX_RNG_ENABLED - nrfx_rng - RNG peripheral driver //========================================================== #ifndef NRFX_RNG_ENABLED -#define NRFX_RNG_ENABLED 0 + #define NRFX_RNG_ENABLED 0 #endif // NRFX_RNG_CONFIG_ERROR_CORRECTION - Error correction - #ifndef NRFX_RNG_CONFIG_ERROR_CORRECTION -#define NRFX_RNG_CONFIG_ERROR_CORRECTION 1 + #define NRFX_RNG_CONFIG_ERROR_CORRECTION 1 #endif // NRFX_RNG_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_RNG_CONFIG_IRQ_PRIORITY -#define NRFX_RNG_CONFIG_IRQ_PRIORITY 6 + #define NRFX_RNG_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_RNG_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_RNG_CONFIG_LOG_ENABLED -#define NRFX_RNG_CONFIG_LOG_ENABLED 0 + #define NRFX_RNG_CONFIG_LOG_ENABLED 0 #endif // NRFX_RNG_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_RNG_CONFIG_LOG_LEVEL -#define NRFX_RNG_CONFIG_LOG_LEVEL 3 + #define NRFX_RNG_CONFIG_LOG_LEVEL 3 #endif // NRFX_RNG_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_RNG_CONFIG_INFO_COLOR -#define NRFX_RNG_CONFIG_INFO_COLOR 0 + #define NRFX_RNG_CONFIG_INFO_COLOR 0 #endif // NRFX_RNG_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_RNG_CONFIG_DEBUG_COLOR -#define NRFX_RNG_CONFIG_DEBUG_COLOR 0 + #define NRFX_RNG_CONFIG_DEBUG_COLOR 0 #endif // @@ -4176,110 +4022,105 @@ // NRFX_RTC_ENABLED - nrfx_rtc - RTC peripheral driver //========================================================== #ifndef NRFX_RTC_ENABLED -#define NRFX_RTC_ENABLED 0 + #define NRFX_RTC_ENABLED 0 #endif // NRFX_RTC0_ENABLED - Enable RTC0 instance - #ifndef NRFX_RTC0_ENABLED -#define NRFX_RTC0_ENABLED 0 + #define NRFX_RTC0_ENABLED 0 #endif // NRFX_RTC1_ENABLED - Enable RTC1 instance - #ifndef NRFX_RTC1_ENABLED -#define NRFX_RTC1_ENABLED 0 + #define NRFX_RTC1_ENABLED 0 #endif // NRFX_RTC2_ENABLED - Enable RTC2 instance - #ifndef NRFX_RTC2_ENABLED -#define NRFX_RTC2_ENABLED 0 + #define NRFX_RTC2_ENABLED 0 #endif -// NRFX_RTC_MAXIMUM_LATENCY_US - Maximum possible time[us] in highest priority interrupt +// NRFX_RTC_MAXIMUM_LATENCY_US - Maximum possible time[us] in highest priority interrupt #ifndef NRFX_RTC_MAXIMUM_LATENCY_US -#define NRFX_RTC_MAXIMUM_LATENCY_US 2000 + #define NRFX_RTC_MAXIMUM_LATENCY_US 2000 #endif -// NRFX_RTC_DEFAULT_CONFIG_FREQUENCY - Frequency <16-32768> - +// NRFX_RTC_DEFAULT_CONFIG_FREQUENCY - Frequency <16-32768> #ifndef NRFX_RTC_DEFAULT_CONFIG_FREQUENCY -#define NRFX_RTC_DEFAULT_CONFIG_FREQUENCY 32768 + #define NRFX_RTC_DEFAULT_CONFIG_FREQUENCY 32768 #endif // NRFX_RTC_DEFAULT_CONFIG_RELIABLE - Ensures safe compare event triggering - #ifndef NRFX_RTC_DEFAULT_CONFIG_RELIABLE -#define NRFX_RTC_DEFAULT_CONFIG_RELIABLE 0 + #define NRFX_RTC_DEFAULT_CONFIG_RELIABLE 0 #endif // NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define NRFX_RTC_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_RTC_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_RTC_CONFIG_LOG_ENABLED -#define NRFX_RTC_CONFIG_LOG_ENABLED 0 + #define NRFX_RTC_CONFIG_LOG_ENABLED 0 #endif // NRFX_RTC_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_RTC_CONFIG_LOG_LEVEL -#define NRFX_RTC_CONFIG_LOG_LEVEL 3 + #define NRFX_RTC_CONFIG_LOG_LEVEL 3 #endif // NRFX_RTC_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_RTC_CONFIG_INFO_COLOR -#define NRFX_RTC_CONFIG_INFO_COLOR 0 + #define NRFX_RTC_CONFIG_INFO_COLOR 0 #endif // NRFX_RTC_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_RTC_CONFIG_DEBUG_COLOR -#define NRFX_RTC_CONFIG_DEBUG_COLOR 0 + #define NRFX_RTC_CONFIG_DEBUG_COLOR 0 #endif // @@ -4289,104 +4130,103 @@ // NRFX_SAADC_ENABLED - nrfx_saadc - SAADC peripheral driver //========================================================== #ifndef NRFX_SAADC_ENABLED -#define NRFX_SAADC_ENABLED 1 + #define NRFX_SAADC_ENABLED 1 #endif // NRFX_SAADC_CONFIG_RESOLUTION - Resolution -// <0=> 8 bit -// <1=> 10 bit -// <2=> 12 bit -// <3=> 14 bit +// <0=> 8 bit +// <1=> 10 bit +// <2=> 12 bit +// <3=> 14 bit #ifndef NRFX_SAADC_CONFIG_RESOLUTION -#define NRFX_SAADC_CONFIG_RESOLUTION 1 + #define NRFX_SAADC_CONFIG_RESOLUTION 1 #endif // NRFX_SAADC_CONFIG_OVERSAMPLE - Sample period -// <0=> Disabled -// <1=> 2x -// <2=> 4x -// <3=> 8x -// <4=> 16x -// <5=> 32x -// <6=> 64x -// <7=> 128x -// <8=> 256x +// <0=> Disabled +// <1=> 2x +// <2=> 4x +// <3=> 8x +// <4=> 16x +// <5=> 32x +// <6=> 64x +// <7=> 128x +// <8=> 256x #ifndef NRFX_SAADC_CONFIG_OVERSAMPLE -#define NRFX_SAADC_CONFIG_OVERSAMPLE 0 + #define NRFX_SAADC_CONFIG_OVERSAMPLE 0 #endif // NRFX_SAADC_CONFIG_LP_MODE - Enabling low power mode - #ifndef NRFX_SAADC_CONFIG_LP_MODE -#define NRFX_SAADC_CONFIG_LP_MODE 0 + #define NRFX_SAADC_CONFIG_LP_MODE 0 #endif // NRFX_SAADC_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_SAADC_CONFIG_IRQ_PRIORITY -#define NRFX_SAADC_CONFIG_IRQ_PRIORITY 6 + #define NRFX_SAADC_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_SAADC_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_SAADC_CONFIG_LOG_ENABLED -#define NRFX_SAADC_CONFIG_LOG_ENABLED 0 + #define NRFX_SAADC_CONFIG_LOG_ENABLED 0 #endif // NRFX_SAADC_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_SAADC_CONFIG_LOG_LEVEL -#define NRFX_SAADC_CONFIG_LOG_LEVEL 3 + #define NRFX_SAADC_CONFIG_LOG_LEVEL 3 #endif // NRFX_SAADC_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_SAADC_CONFIG_INFO_COLOR -#define NRFX_SAADC_CONFIG_INFO_COLOR 0 + #define NRFX_SAADC_CONFIG_INFO_COLOR 0 #endif // NRFX_SAADC_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_SAADC_CONFIG_DEBUG_COLOR -#define NRFX_SAADC_CONFIG_DEBUG_COLOR 0 + #define NRFX_SAADC_CONFIG_DEBUG_COLOR 0 #endif // @@ -4396,117 +4236,113 @@ // NRFX_SPIM_ENABLED - nrfx_spim - SPIM peripheral driver //========================================================== #ifndef NRFX_SPIM_ENABLED -#define NRFX_SPIM_ENABLED 0 + #define NRFX_SPIM_ENABLED 0 #endif // NRFX_SPIM0_ENABLED - Enable SPIM0 instance - #ifndef NRFX_SPIM0_ENABLED -#define NRFX_SPIM0_ENABLED 0 + #define NRFX_SPIM0_ENABLED 0 #endif // NRFX_SPIM1_ENABLED - Enable SPIM1 instance - #ifndef NRFX_SPIM1_ENABLED -#define NRFX_SPIM1_ENABLED 0 + #define NRFX_SPIM1_ENABLED 0 #endif // NRFX_SPIM2_ENABLED - Enable SPIM2 instance - #ifndef NRFX_SPIM2_ENABLED -#define NRFX_SPIM2_ENABLED 0 + #define NRFX_SPIM2_ENABLED 0 #endif // NRFX_SPIM_MISO_PULL_CFG - MISO pin pull configuration. -// <0=> NRF_GPIO_PIN_NOPULL -// <1=> NRF_GPIO_PIN_PULLDOWN -// <3=> NRF_GPIO_PIN_PULLUP +// <0=> NRF_GPIO_PIN_NOPULL +// <1=> NRF_GPIO_PIN_PULLDOWN +// <3=> NRF_GPIO_PIN_PULLUP #ifndef NRFX_SPIM_MISO_PULL_CFG -#define NRFX_SPIM_MISO_PULL_CFG 1 + #define NRFX_SPIM_MISO_PULL_CFG 1 #endif // NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define NRFX_SPIM_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_SPIM_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_SPIM_CONFIG_LOG_ENABLED -#define NRFX_SPIM_CONFIG_LOG_ENABLED 0 + #define NRFX_SPIM_CONFIG_LOG_ENABLED 0 #endif // NRFX_SPIM_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_SPIM_CONFIG_LOG_LEVEL -#define NRFX_SPIM_CONFIG_LOG_LEVEL 3 + #define NRFX_SPIM_CONFIG_LOG_LEVEL 3 #endif // NRFX_SPIM_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_SPIM_CONFIG_INFO_COLOR -#define NRFX_SPIM_CONFIG_INFO_COLOR 0 + #define NRFX_SPIM_CONFIG_INFO_COLOR 0 #endif // NRFX_SPIM_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_SPIM_CONFIG_DEBUG_COLOR -#define NRFX_SPIM_CONFIG_DEBUG_COLOR 0 + #define NRFX_SPIM_CONFIG_DEBUG_COLOR 0 #endif // // NRFX_SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED - Enables nRF52 anomaly 109 workaround for SPIM. - // The workaround uses interrupts to wake up the CPU by catching -// a start event of zero-length transmission to start the clock. This +// a start event of zero-length transmission to start the clock. This // ensures that the DMA transfer will be executed without issues and -// that the proper transfer will be started. See more in the Errata -// document or Anomaly 109 Addendum located at +// that the proper transfer will be started. See more in the Errata +// document or Anomaly 109 Addendum located at // https://infocenter.nordicsemi.com/ #ifndef NRFX_SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED -#define NRFX_SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 + #define NRFX_SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 #endif // @@ -4514,112 +4350,106 @@ // NRFX_SPIS_ENABLED - nrfx_spis - SPIS peripheral driver //========================================================== #ifndef NRFX_SPIS_ENABLED -#define NRFX_SPIS_ENABLED 0 + #define NRFX_SPIS_ENABLED 0 #endif // NRFX_SPIS0_ENABLED - Enable SPIS0 instance - #ifndef NRFX_SPIS0_ENABLED -#define NRFX_SPIS0_ENABLED 0 + #define NRFX_SPIS0_ENABLED 0 #endif // NRFX_SPIS1_ENABLED - Enable SPIS1 instance - #ifndef NRFX_SPIS1_ENABLED -#define NRFX_SPIS1_ENABLED 0 + #define NRFX_SPIS1_ENABLED 0 #endif // NRFX_SPIS2_ENABLED - Enable SPIS2 instance - #ifndef NRFX_SPIS2_ENABLED -#define NRFX_SPIS2_ENABLED 0 + #define NRFX_SPIS2_ENABLED 0 #endif // NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define NRFX_SPIS_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif -// NRFX_SPIS_DEFAULT_DEF - SPIS default DEF character <0-255> - +// NRFX_SPIS_DEFAULT_DEF - SPIS default DEF character <0-255> #ifndef NRFX_SPIS_DEFAULT_DEF -#define NRFX_SPIS_DEFAULT_DEF 255 + #define NRFX_SPIS_DEFAULT_DEF 255 #endif -// NRFX_SPIS_DEFAULT_ORC - SPIS default ORC character <0-255> - +// NRFX_SPIS_DEFAULT_ORC - SPIS default ORC character <0-255> #ifndef NRFX_SPIS_DEFAULT_ORC -#define NRFX_SPIS_DEFAULT_ORC 255 + #define NRFX_SPIS_DEFAULT_ORC 255 #endif // NRFX_SPIS_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_SPIS_CONFIG_LOG_ENABLED -#define NRFX_SPIS_CONFIG_LOG_ENABLED 0 + #define NRFX_SPIS_CONFIG_LOG_ENABLED 0 #endif // NRFX_SPIS_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_SPIS_CONFIG_LOG_LEVEL -#define NRFX_SPIS_CONFIG_LOG_LEVEL 3 + #define NRFX_SPIS_CONFIG_LOG_LEVEL 3 #endif // NRFX_SPIS_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black +// <0=> Default +// <1=> Black // <2=> Red < -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_SPIS_CONFIG_INFO_COLOR -#define NRFX_SPIS_CONFIG_INFO_COLOR 0 + #define NRFX_SPIS_CONFIG_INFO_COLOR 0 #endif // NRFX_SPIS_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_SPIS_CONFIG_DEBUG_COLOR -#define NRFX_SPIS_CONFIG_DEBUG_COLOR 0 + #define NRFX_SPIS_CONFIG_DEBUG_COLOR 0 #endif // // NRFX_SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED - Enables nRF52 Anomaly 109 workaround for SPIS. - // The workaround uses a GPIOTE channel to generate interrupts // on falling edges detected on the CSN line. This will make // the CPU active for the moment when SPIS starts DMA transfers, @@ -4628,7 +4458,7 @@ // enabled as well. #ifndef NRFX_SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED -#define NRFX_SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 + #define NRFX_SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 #endif // @@ -4636,101 +4466,98 @@ // NRFX_SPI_ENABLED - nrfx_spi - SPI peripheral driver //========================================================== #ifndef NRFX_SPI_ENABLED -#define NRFX_SPI_ENABLED 0 + #define NRFX_SPI_ENABLED 0 #endif // NRFX_SPI0_ENABLED - Enable SPI0 instance - #ifndef NRFX_SPI0_ENABLED -#define NRFX_SPI0_ENABLED 0 + #define NRFX_SPI0_ENABLED 0 #endif // NRFX_SPI1_ENABLED - Enable SPI1 instance - #ifndef NRFX_SPI1_ENABLED -#define NRFX_SPI1_ENABLED 0 + #define NRFX_SPI1_ENABLED 0 #endif // NRFX_SPI2_ENABLED - Enable SPI2 instance - #ifndef NRFX_SPI2_ENABLED -#define NRFX_SPI2_ENABLED 0 + #define NRFX_SPI2_ENABLED 0 #endif // NRFX_SPI_MISO_PULL_CFG - MISO pin pull configuration. -// <0=> NRF_GPIO_PIN_NOPULL -// <1=> NRF_GPIO_PIN_PULLDOWN -// <3=> NRF_GPIO_PIN_PULLUP +// <0=> NRF_GPIO_PIN_NOPULL +// <1=> NRF_GPIO_PIN_PULLDOWN +// <3=> NRF_GPIO_PIN_PULLUP #ifndef NRFX_SPI_MISO_PULL_CFG -#define NRFX_SPI_MISO_PULL_CFG 1 + #define NRFX_SPI_MISO_PULL_CFG 1 #endif // NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define NRFX_SPI_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_SPI_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_SPI_CONFIG_LOG_ENABLED -#define NRFX_SPI_CONFIG_LOG_ENABLED 0 + #define NRFX_SPI_CONFIG_LOG_ENABLED 0 #endif // NRFX_SPI_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_SPI_CONFIG_LOG_LEVEL -#define NRFX_SPI_CONFIG_LOG_LEVEL 3 + #define NRFX_SPI_CONFIG_LOG_LEVEL 3 #endif // NRFX_SPI_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_SPI_CONFIG_INFO_COLOR -#define NRFX_SPI_CONFIG_INFO_COLOR 0 + #define NRFX_SPI_CONFIG_INFO_COLOR 0 #endif // NRFX_SPI_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_SPI_CONFIG_DEBUG_COLOR -#define NRFX_SPI_CONFIG_DEBUG_COLOR 0 + #define NRFX_SPI_CONFIG_DEBUG_COLOR 0 #endif // @@ -4740,104 +4567,97 @@ // NRFX_SWI_ENABLED - nrfx_swi - SWI/EGU peripheral allocator //========================================================== #ifndef NRFX_SWI_ENABLED -#define NRFX_SWI_ENABLED 0 + #define NRFX_SWI_ENABLED 0 #endif // NRFX_EGU_ENABLED - Enable EGU support - #ifndef NRFX_EGU_ENABLED -#define NRFX_EGU_ENABLED 0 + #define NRFX_EGU_ENABLED 0 #endif // NRFX_SWI0_DISABLED - Exclude SWI0 from being utilized by the driver - #ifndef NRFX_SWI0_DISABLED -#define NRFX_SWI0_DISABLED 0 + #define NRFX_SWI0_DISABLED 0 #endif // NRFX_SWI1_DISABLED - Exclude SWI1 from being utilized by the driver - #ifndef NRFX_SWI1_DISABLED -#define NRFX_SWI1_DISABLED 0 + #define NRFX_SWI1_DISABLED 0 #endif // NRFX_SWI2_DISABLED - Exclude SWI2 from being utilized by the driver - #ifndef NRFX_SWI2_DISABLED -#define NRFX_SWI2_DISABLED 0 + #define NRFX_SWI2_DISABLED 0 #endif // NRFX_SWI3_DISABLED - Exclude SWI3 from being utilized by the driver - #ifndef NRFX_SWI3_DISABLED -#define NRFX_SWI3_DISABLED 0 + #define NRFX_SWI3_DISABLED 0 #endif // NRFX_SWI4_DISABLED - Exclude SWI4 from being utilized by the driver - #ifndef NRFX_SWI4_DISABLED -#define NRFX_SWI4_DISABLED 0 + #define NRFX_SWI4_DISABLED 0 #endif // NRFX_SWI5_DISABLED - Exclude SWI5 from being utilized by the driver - #ifndef NRFX_SWI5_DISABLED -#define NRFX_SWI5_DISABLED 0 + #define NRFX_SWI5_DISABLED 0 #endif // NRFX_SWI_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_SWI_CONFIG_LOG_ENABLED -#define NRFX_SWI_CONFIG_LOG_ENABLED 0 + #define NRFX_SWI_CONFIG_LOG_ENABLED 0 #endif // NRFX_SWI_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_SWI_CONFIG_LOG_LEVEL -#define NRFX_SWI_CONFIG_LOG_LEVEL 3 + #define NRFX_SWI_CONFIG_LOG_LEVEL 3 #endif // NRFX_SWI_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_SWI_CONFIG_INFO_COLOR -#define NRFX_SWI_CONFIG_INFO_COLOR 0 + #define NRFX_SWI_CONFIG_INFO_COLOR 0 #endif // NRFX_SWI_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_SWI_CONFIG_DEBUG_COLOR -#define NRFX_SWI_CONFIG_DEBUG_COLOR 0 + #define NRFX_SWI_CONFIG_DEBUG_COLOR 0 #endif // @@ -4847,142 +4667,137 @@ // NRFX_TIMER_ENABLED - nrfx_timer - TIMER periperal driver //========================================================== #ifndef NRFX_TIMER_ENABLED -#define NRFX_TIMER_ENABLED 1 + #define NRFX_TIMER_ENABLED 1 #endif // NRFX_TIMER0_ENABLED - Enable TIMER0 instance - #ifndef NRFX_TIMER0_ENABLED -#define NRFX_TIMER0_ENABLED 1 + #define NRFX_TIMER0_ENABLED 1 #endif // NRFX_TIMER1_ENABLED - Enable TIMER1 instance - #ifndef NRFX_TIMER1_ENABLED -#define NRFX_TIMER1_ENABLED 0 + #define NRFX_TIMER1_ENABLED 0 #endif // NRFX_TIMER2_ENABLED - Enable TIMER2 instance - #ifndef NRFX_TIMER2_ENABLED -#define NRFX_TIMER2_ENABLED 0 + #define NRFX_TIMER2_ENABLED 0 #endif // NRFX_TIMER3_ENABLED - Enable TIMER3 instance - #ifndef NRFX_TIMER3_ENABLED -#define NRFX_TIMER3_ENABLED 0 + #define NRFX_TIMER3_ENABLED 0 #endif // NRFX_TIMER4_ENABLED - Enable TIMER4 instance - #ifndef NRFX_TIMER4_ENABLED -#define NRFX_TIMER4_ENABLED 0 + #define NRFX_TIMER4_ENABLED 0 #endif // NRFX_TIMER_DEFAULT_CONFIG_FREQUENCY - Timer frequency if in Timer mode -// <0=> 16 MHz -// <1=> 8 MHz -// <2=> 4 MHz -// <3=> 2 MHz -// <4=> 1 MHz -// <5=> 500 kHz -// <6=> 250 kHz -// <7=> 125 kHz -// <8=> 62.5 kHz -// <9=> 31.25 kHz +// <0=> 16 MHz +// <1=> 8 MHz +// <2=> 4 MHz +// <3=> 2 MHz +// <4=> 1 MHz +// <5=> 500 kHz +// <6=> 250 kHz +// <7=> 125 kHz +// <8=> 62.5 kHz +// <9=> 31.25 kHz #ifndef NRFX_TIMER_DEFAULT_CONFIG_FREQUENCY -#define NRFX_TIMER_DEFAULT_CONFIG_FREQUENCY 0 + #define NRFX_TIMER_DEFAULT_CONFIG_FREQUENCY 0 #endif // NRFX_TIMER_DEFAULT_CONFIG_MODE - Timer mode or operation -// <0=> Timer -// <1=> Counter +// <0=> Timer +// <1=> Counter #ifndef NRFX_TIMER_DEFAULT_CONFIG_MODE -#define NRFX_TIMER_DEFAULT_CONFIG_MODE 0 + #define NRFX_TIMER_DEFAULT_CONFIG_MODE 0 #endif // NRFX_TIMER_DEFAULT_CONFIG_BIT_WIDTH - Timer counter bit width -// <0=> 16 bit -// <1=> 8 bit -// <2=> 24 bit -// <3=> 32 bit +// <0=> 16 bit +// <1=> 8 bit +// <2=> 24 bit +// <3=> 32 bit #ifndef NRFX_TIMER_DEFAULT_CONFIG_BIT_WIDTH -#define NRFX_TIMER_DEFAULT_CONFIG_BIT_WIDTH 0 + #define NRFX_TIMER_DEFAULT_CONFIG_BIT_WIDTH 0 #endif // NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define NRFX_TIMER_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_TIMER_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_TIMER_CONFIG_LOG_ENABLED -#define NRFX_TIMER_CONFIG_LOG_ENABLED 0 + #define NRFX_TIMER_CONFIG_LOG_ENABLED 0 #endif // NRFX_TIMER_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_TIMER_CONFIG_LOG_LEVEL -#define NRFX_TIMER_CONFIG_LOG_LEVEL 3 + #define NRFX_TIMER_CONFIG_LOG_LEVEL 3 #endif // NRFX_TIMER_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_TIMER_CONFIG_INFO_COLOR -#define NRFX_TIMER_CONFIG_INFO_COLOR 0 + #define NRFX_TIMER_CONFIG_INFO_COLOR 0 #endif // NRFX_TIMER_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_TIMER_CONFIG_DEBUG_COLOR -#define NRFX_TIMER_CONFIG_DEBUG_COLOR 0 + #define NRFX_TIMER_CONFIG_DEBUG_COLOR 0 #endif // @@ -4992,116 +4807,112 @@ // NRFX_TWIM_ENABLED - nrfx_twim - TWIM peripheral driver //========================================================== #ifndef NRFX_TWIM_ENABLED -#define NRFX_TWIM_ENABLED 1 + #define NRFX_TWIM_ENABLED 1 #endif // NRFX_TWIM0_ENABLED - Enable TWIM0 instance - #ifndef NRFX_TWIM0_ENABLED -#define NRFX_TWIM0_ENABLED 0 + #define NRFX_TWIM0_ENABLED 0 #endif // NRFX_TWIM1_ENABLED - Enable TWIM1 instance - #ifndef NRFX_TWIM1_ENABLED -#define NRFX_TWIM1_ENABLED 1 + #define NRFX_TWIM1_ENABLED 1 #endif // NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY - Frequency -// <26738688=> 100k -// <67108864=> 250k -// <104857600=> 400k +// <26738688=> 100k +// <67108864=> 250k +// <104857600=> 400k #ifndef NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY -#define NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY 26738688 + #define NRFX_TWIM_DEFAULT_CONFIG_FREQUENCY 26738688 #endif // NRFX_TWIM_DEFAULT_CONFIG_HOLD_BUS_UNINIT - Enables bus holding after uninit - #ifndef NRFX_TWIM_DEFAULT_CONFIG_HOLD_BUS_UNINIT -#define NRFX_TWIM_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0 + #define NRFX_TWIM_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0 #endif // NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define NRFX_TWIM_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_TWIM_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_TWIM_CONFIG_LOG_ENABLED -#define NRFX_TWIM_CONFIG_LOG_ENABLED 0 + #define NRFX_TWIM_CONFIG_LOG_ENABLED 0 #endif // NRFX_TWIM_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_TWIM_CONFIG_LOG_LEVEL -#define NRFX_TWIM_CONFIG_LOG_LEVEL 3 + #define NRFX_TWIM_CONFIG_LOG_LEVEL 3 #endif // NRFX_TWIM_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_TWIM_CONFIG_INFO_COLOR -#define NRFX_TWIM_CONFIG_INFO_COLOR 0 + #define NRFX_TWIM_CONFIG_INFO_COLOR 0 #endif // NRFX_TWIM_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_TWIM_CONFIG_DEBUG_COLOR -#define NRFX_TWIM_CONFIG_DEBUG_COLOR 0 + #define NRFX_TWIM_CONFIG_DEBUG_COLOR 0 #endif // // NRFX_TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED - Enables nRF52 anomaly 109 workaround for TWIM. - // The workaround uses interrupts to wake up the CPU by catching -// the start event of zero-frequency transmission, clear the +// the start event of zero-frequency transmission, clear the // peripheral, set desired frequency, start the peripheral, and // the proper transmission. See more in the Errata document or // Anomaly 109 Addendum located at https://infocenter.nordicsemi.com/ #ifndef NRFX_TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED -#define NRFX_TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 + #define NRFX_TWIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 #endif // @@ -5109,132 +4920,131 @@ // NRFX_TWIS_ENABLED - nrfx_twis - TWIS peripheral driver //========================================================== #ifndef NRFX_TWIS_ENABLED -#define NRFX_TWIS_ENABLED 0 + #define NRFX_TWIS_ENABLED 0 #endif // NRFX_TWIS0_ENABLED - Enable TWIS0 instance - #ifndef NRFX_TWIS0_ENABLED -#define NRFX_TWIS0_ENABLED 0 + #define NRFX_TWIS0_ENABLED 0 #endif // NRFX_TWIS1_ENABLED - Enable TWIS1 instance - #ifndef NRFX_TWIS1_ENABLED -#define NRFX_TWIS1_ENABLED 0 + #define NRFX_TWIS1_ENABLED 0 #endif // NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY - Assume that any instance would be initialized only once - -// Optimization flag. Registers used by TWIS are shared by other peripherals. Normally, during initialization driver tries to clear all registers to known state before doing the initialization itself. This gives initialization safe procedure, no matter when it would be called. If you activate TWIS only once and do never uninitialize it - set this flag to 1 what gives more optimal code. +// Optimization flag. Registers used by TWIS are shared by other peripherals. Normally, during initialization driver tries to clear all +// registers to known state before doing the initialization itself. This gives initialization safe procedure, no matter when it would be +// called. If you activate TWIS only once and do never uninitialize it - set this flag to 1 what gives more optimal code. #ifndef NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY -#define NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 + #define NRFX_TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 #endif // NRFX_TWIS_NO_SYNC_MODE - Remove support for synchronous mode - -// Synchronous mode would be used in specific situations. And it uses some additional code and data memory to safely process state machine by polling it in status functions. If this functionality is not required it may be disabled to free some resources. +// Synchronous mode would be used in specific situations. And it uses some additional code and data memory to safely process state +// machine by polling it in status functions. If this functionality is not required it may be disabled to free some resources. #ifndef NRFX_TWIS_NO_SYNC_MODE -#define NRFX_TWIS_NO_SYNC_MODE 0 + #define NRFX_TWIS_NO_SYNC_MODE 0 #endif -// NRFX_TWIS_DEFAULT_CONFIG_ADDR0 - Address0 +// NRFX_TWIS_DEFAULT_CONFIG_ADDR0 - Address0 #ifndef NRFX_TWIS_DEFAULT_CONFIG_ADDR0 -#define NRFX_TWIS_DEFAULT_CONFIG_ADDR0 0 + #define NRFX_TWIS_DEFAULT_CONFIG_ADDR0 0 #endif -// NRFX_TWIS_DEFAULT_CONFIG_ADDR1 - Address1 +// NRFX_TWIS_DEFAULT_CONFIG_ADDR1 - Address1 #ifndef NRFX_TWIS_DEFAULT_CONFIG_ADDR1 -#define NRFX_TWIS_DEFAULT_CONFIG_ADDR1 0 + #define NRFX_TWIS_DEFAULT_CONFIG_ADDR1 0 #endif // NRFX_TWIS_DEFAULT_CONFIG_SCL_PULL - SCL pin pull configuration -// <0=> Disabled -// <1=> Pull down -// <3=> Pull up +// <0=> Disabled +// <1=> Pull down +// <3=> Pull up #ifndef NRFX_TWIS_DEFAULT_CONFIG_SCL_PULL -#define NRFX_TWIS_DEFAULT_CONFIG_SCL_PULL 0 + #define NRFX_TWIS_DEFAULT_CONFIG_SCL_PULL 0 #endif // NRFX_TWIS_DEFAULT_CONFIG_SDA_PULL - SDA pin pull configuration -// <0=> Disabled -// <1=> Pull down -// <3=> Pull up +// <0=> Disabled +// <1=> Pull down +// <3=> Pull up #ifndef NRFX_TWIS_DEFAULT_CONFIG_SDA_PULL -#define NRFX_TWIS_DEFAULT_CONFIG_SDA_PULL 0 + #define NRFX_TWIS_DEFAULT_CONFIG_SDA_PULL 0 #endif // NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define NRFX_TWIS_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_TWIS_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_TWIS_CONFIG_LOG_ENABLED -#define NRFX_TWIS_CONFIG_LOG_ENABLED 0 + #define NRFX_TWIS_CONFIG_LOG_ENABLED 0 #endif // NRFX_TWIS_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_TWIS_CONFIG_LOG_LEVEL -#define NRFX_TWIS_CONFIG_LOG_LEVEL 3 + #define NRFX_TWIS_CONFIG_LOG_LEVEL 3 #endif // NRFX_TWIS_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_TWIS_CONFIG_INFO_COLOR -#define NRFX_TWIS_CONFIG_INFO_COLOR 0 + #define NRFX_TWIS_CONFIG_INFO_COLOR 0 #endif // NRFX_TWIS_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_TWIS_CONFIG_DEBUG_COLOR -#define NRFX_TWIS_CONFIG_DEBUG_COLOR 0 + #define NRFX_TWIS_CONFIG_DEBUG_COLOR 0 #endif // @@ -5244,101 +5054,98 @@ // NRFX_TWI_ENABLED - nrfx_twi - TWI peripheral driver //========================================================== #ifndef NRFX_TWI_ENABLED -#define NRFX_TWI_ENABLED 0 + #define NRFX_TWI_ENABLED 0 #endif // NRFX_TWI0_ENABLED - Enable TWI0 instance - #ifndef NRFX_TWI0_ENABLED -#define NRFX_TWI0_ENABLED 0 + #define NRFX_TWI0_ENABLED 0 #endif // NRFX_TWI1_ENABLED - Enable TWI1 instance - #ifndef NRFX_TWI1_ENABLED -#define NRFX_TWI1_ENABLED 0 + #define NRFX_TWI1_ENABLED 0 #endif // NRFX_TWI_DEFAULT_CONFIG_FREQUENCY - Frequency -// <26738688=> 100k -// <67108864=> 250k -// <104857600=> 400k +// <26738688=> 100k +// <67108864=> 250k +// <104857600=> 400k #ifndef NRFX_TWI_DEFAULT_CONFIG_FREQUENCY -#define NRFX_TWI_DEFAULT_CONFIG_FREQUENCY 26738688 + #define NRFX_TWI_DEFAULT_CONFIG_FREQUENCY 26738688 #endif // NRFX_TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT - Enables bus holding after uninit - #ifndef NRFX_TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT -#define NRFX_TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0 + #define NRFX_TWI_DEFAULT_CONFIG_HOLD_BUS_UNINIT 0 #endif // NRFX_TWI_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_TWI_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_TWI_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define NRFX_TWI_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_TWI_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_TWI_CONFIG_LOG_ENABLED -#define NRFX_TWI_CONFIG_LOG_ENABLED 0 + #define NRFX_TWI_CONFIG_LOG_ENABLED 0 #endif // NRFX_TWI_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_TWI_CONFIG_LOG_LEVEL -#define NRFX_TWI_CONFIG_LOG_LEVEL 3 + #define NRFX_TWI_CONFIG_LOG_LEVEL 3 #endif // NRFX_TWI_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_TWI_CONFIG_INFO_COLOR -#define NRFX_TWI_CONFIG_INFO_COLOR 0 + #define NRFX_TWI_CONFIG_INFO_COLOR 0 #endif // NRFX_TWI_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_TWI_CONFIG_DEBUG_COLOR -#define NRFX_TWI_CONFIG_DEBUG_COLOR 0 + #define NRFX_TWI_CONFIG_DEBUG_COLOR 0 #endif // @@ -5348,118 +5155,118 @@ // NRFX_UARTE_ENABLED - nrfx_uarte - UARTE peripheral driver //========================================================== #ifndef NRFX_UARTE_ENABLED -#define NRFX_UARTE_ENABLED 0 + #define NRFX_UARTE_ENABLED 0 #endif -// NRFX_UARTE0_ENABLED - Enable UARTE0 instance +// NRFX_UARTE0_ENABLED - Enable UARTE0 instance #ifndef NRFX_UARTE0_ENABLED -#define NRFX_UARTE0_ENABLED 0 + #define NRFX_UARTE0_ENABLED 0 #endif // NRFX_UARTE_DEFAULT_CONFIG_HWFC - Hardware Flow Control -// <0=> Disabled -// <1=> Enabled +// <0=> Disabled +// <1=> Enabled #ifndef NRFX_UARTE_DEFAULT_CONFIG_HWFC -#define NRFX_UARTE_DEFAULT_CONFIG_HWFC 0 + #define NRFX_UARTE_DEFAULT_CONFIG_HWFC 0 #endif // NRFX_UARTE_DEFAULT_CONFIG_PARITY - Parity -// <0=> Excluded -// <14=> Included +// <0=> Excluded +// <14=> Included #ifndef NRFX_UARTE_DEFAULT_CONFIG_PARITY -#define NRFX_UARTE_DEFAULT_CONFIG_PARITY 0 + #define NRFX_UARTE_DEFAULT_CONFIG_PARITY 0 #endif // NRFX_UARTE_DEFAULT_CONFIG_BAUDRATE - Default Baudrate -// <323584=> 1200 baud -// <643072=> 2400 baud -// <1290240=> 4800 baud -// <2576384=> 9600 baud -// <3862528=> 14400 baud -// <5152768=> 19200 baud -// <7716864=> 28800 baud -// <8388608=> 31250 baud -// <10289152=> 38400 baud -// <15007744=> 56000 baud -// <15400960=> 57600 baud -// <20615168=> 76800 baud -// <30801920=> 115200 baud -// <61865984=> 230400 baud -// <67108864=> 250000 baud -// <121634816=> 460800 baud -// <251658240=> 921600 baud -// <268435456=> 1000000 baud +// <323584=> 1200 baud +// <643072=> 2400 baud +// <1290240=> 4800 baud +// <2576384=> 9600 baud +// <3862528=> 14400 baud +// <5152768=> 19200 baud +// <7716864=> 28800 baud +// <8388608=> 31250 baud +// <10289152=> 38400 baud +// <15007744=> 56000 baud +// <15400960=> 57600 baud +// <20615168=> 76800 baud +// <30801920=> 115200 baud +// <61865984=> 230400 baud +// <67108864=> 250000 baud +// <121634816=> 460800 baud +// <251658240=> 921600 baud +// <268435456=> 1000000 baud #ifndef NRFX_UARTE_DEFAULT_CONFIG_BAUDRATE -#define NRFX_UARTE_DEFAULT_CONFIG_BAUDRATE 30801920 + #define NRFX_UARTE_DEFAULT_CONFIG_BAUDRATE 30801920 #endif // NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define NRFX_UARTE_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_UARTE_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_UARTE_CONFIG_LOG_ENABLED -#define NRFX_UARTE_CONFIG_LOG_ENABLED 0 + #define NRFX_UARTE_CONFIG_LOG_ENABLED 0 #endif // NRFX_UARTE_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_UARTE_CONFIG_LOG_LEVEL -#define NRFX_UARTE_CONFIG_LOG_LEVEL 3 + #define NRFX_UARTE_CONFIG_LOG_LEVEL 3 #endif // NRFX_UARTE_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_UARTE_CONFIG_INFO_COLOR -#define NRFX_UARTE_CONFIG_INFO_COLOR 0 + #define NRFX_UARTE_CONFIG_INFO_COLOR 0 #endif // NRFX_UARTE_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_UARTE_CONFIG_DEBUG_COLOR -#define NRFX_UARTE_CONFIG_DEBUG_COLOR 0 + #define NRFX_UARTE_CONFIG_DEBUG_COLOR 0 #endif // @@ -5469,118 +5276,118 @@ // NRFX_UART_ENABLED - nrfx_uart - UART peripheral driver //========================================================== #ifndef NRFX_UART_ENABLED -#define NRFX_UART_ENABLED 0 + #define NRFX_UART_ENABLED 0 #endif -// NRFX_UART0_ENABLED - Enable UART0 instance +// NRFX_UART0_ENABLED - Enable UART0 instance #ifndef NRFX_UART0_ENABLED -#define NRFX_UART0_ENABLED 0 + #define NRFX_UART0_ENABLED 0 #endif // NRFX_UART_DEFAULT_CONFIG_HWFC - Hardware Flow Control -// <0=> Disabled -// <1=> Enabled +// <0=> Disabled +// <1=> Enabled #ifndef NRFX_UART_DEFAULT_CONFIG_HWFC -#define NRFX_UART_DEFAULT_CONFIG_HWFC 0 + #define NRFX_UART_DEFAULT_CONFIG_HWFC 0 #endif // NRFX_UART_DEFAULT_CONFIG_PARITY - Parity -// <0=> Excluded -// <14=> Included +// <0=> Excluded +// <14=> Included #ifndef NRFX_UART_DEFAULT_CONFIG_PARITY -#define NRFX_UART_DEFAULT_CONFIG_PARITY 0 + #define NRFX_UART_DEFAULT_CONFIG_PARITY 0 #endif // NRFX_UART_DEFAULT_CONFIG_BAUDRATE - Default Baudrate -// <323584=> 1200 baud -// <643072=> 2400 baud -// <1290240=> 4800 baud -// <2576384=> 9600 baud -// <3866624=> 14400 baud -// <5152768=> 19200 baud -// <7729152=> 28800 baud -// <8388608=> 31250 baud -// <10309632=> 38400 baud -// <15007744=> 56000 baud -// <15462400=> 57600 baud -// <20615168=> 76800 baud -// <30924800=> 115200 baud -// <61845504=> 230400 baud -// <67108864=> 250000 baud -// <123695104=> 460800 baud -// <247386112=> 921600 baud -// <268435456=> 1000000 baud +// <323584=> 1200 baud +// <643072=> 2400 baud +// <1290240=> 4800 baud +// <2576384=> 9600 baud +// <3866624=> 14400 baud +// <5152768=> 19200 baud +// <7729152=> 28800 baud +// <8388608=> 31250 baud +// <10309632=> 38400 baud +// <15007744=> 56000 baud +// <15462400=> 57600 baud +// <20615168=> 76800 baud +// <30924800=> 115200 baud +// <61845504=> 230400 baud +// <67108864=> 250000 baud +// <123695104=> 460800 baud +// <247386112=> 921600 baud +// <268435456=> 1000000 baud #ifndef NRFX_UART_DEFAULT_CONFIG_BAUDRATE -#define NRFX_UART_DEFAULT_CONFIG_BAUDRATE 30924800 + #define NRFX_UART_DEFAULT_CONFIG_BAUDRATE 30924800 #endif // NRFX_UART_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_UART_DEFAULT_CONFIG_IRQ_PRIORITY -#define NRFX_UART_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define NRFX_UART_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_UART_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_UART_CONFIG_LOG_ENABLED -#define NRFX_UART_CONFIG_LOG_ENABLED 0 + #define NRFX_UART_CONFIG_LOG_ENABLED 0 #endif // NRFX_UART_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_UART_CONFIG_LOG_LEVEL -#define NRFX_UART_CONFIG_LOG_LEVEL 3 + #define NRFX_UART_CONFIG_LOG_LEVEL 3 #endif // NRFX_UART_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_UART_CONFIG_INFO_COLOR -#define NRFX_UART_CONFIG_INFO_COLOR 0 + #define NRFX_UART_CONFIG_INFO_COLOR 0 #endif // NRFX_UART_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_UART_CONFIG_DEBUG_COLOR -#define NRFX_UART_CONFIG_DEBUG_COLOR 0 + #define NRFX_UART_CONFIG_DEBUG_COLOR 0 #endif // @@ -5590,97 +5397,96 @@ // NRFX_WDT_ENABLED - nrfx_wdt - WDT peripheral driver //========================================================== #ifndef NRFX_WDT_ENABLED -#define NRFX_WDT_ENABLED 0 + #define NRFX_WDT_ENABLED 0 #endif // NRFX_WDT_CONFIG_BEHAVIOUR - WDT behavior in CPU SLEEP or HALT mode -// <1=> Run in SLEEP, Pause in HALT -// <8=> Pause in SLEEP, Run in HALT -// <9=> Run in SLEEP and HALT -// <0=> Pause in SLEEP and HALT +// <1=> Run in SLEEP, Pause in HALT +// <8=> Pause in SLEEP, Run in HALT +// <9=> Run in SLEEP and HALT +// <0=> Pause in SLEEP and HALT #ifndef NRFX_WDT_CONFIG_BEHAVIOUR -#define NRFX_WDT_CONFIG_BEHAVIOUR 1 + #define NRFX_WDT_CONFIG_BEHAVIOUR 1 #endif -// NRFX_WDT_CONFIG_RELOAD_VALUE - Reload value <15-4294967295> - +// NRFX_WDT_CONFIG_RELOAD_VALUE - Reload value <15-4294967295> #ifndef NRFX_WDT_CONFIG_RELOAD_VALUE -#define NRFX_WDT_CONFIG_RELOAD_VALUE 2000 + #define NRFX_WDT_CONFIG_RELOAD_VALUE 2000 #endif // NRFX_WDT_CONFIG_NO_IRQ - Remove WDT IRQ handling from WDT driver -// <0=> Include WDT IRQ handling -// <1=> Remove WDT IRQ handling +// <0=> Include WDT IRQ handling +// <1=> Remove WDT IRQ handling #ifndef NRFX_WDT_CONFIG_NO_IRQ -#define NRFX_WDT_CONFIG_NO_IRQ 0 + #define NRFX_WDT_CONFIG_NO_IRQ 0 #endif // NRFX_WDT_CONFIG_IRQ_PRIORITY - Interrupt priority -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef NRFX_WDT_CONFIG_IRQ_PRIORITY -#define NRFX_WDT_CONFIG_IRQ_PRIORITY 6 + #define NRFX_WDT_CONFIG_IRQ_PRIORITY 6 #endif // NRFX_WDT_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRFX_WDT_CONFIG_LOG_ENABLED -#define NRFX_WDT_CONFIG_LOG_ENABLED 0 + #define NRFX_WDT_CONFIG_LOG_ENABLED 0 #endif // NRFX_WDT_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_WDT_CONFIG_LOG_LEVEL -#define NRFX_WDT_CONFIG_LOG_LEVEL 3 + #define NRFX_WDT_CONFIG_LOG_LEVEL 3 #endif // NRFX_WDT_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_WDT_CONFIG_INFO_COLOR -#define NRFX_WDT_CONFIG_INFO_COLOR 0 + #define NRFX_WDT_CONFIG_INFO_COLOR 0 #endif // NRFX_WDT_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_WDT_CONFIG_DEBUG_COLOR -#define NRFX_WDT_CONFIG_DEBUG_COLOR 0 + #define NRFX_WDT_CONFIG_DEBUG_COLOR 0 #endif // @@ -5690,42 +5496,40 @@ // NRF_CLOCK_ENABLED - nrf_drv_clock - CLOCK peripheral driver - legacy layer //========================================================== #ifndef NRF_CLOCK_ENABLED -#define NRF_CLOCK_ENABLED 1 + #define NRF_CLOCK_ENABLED 1 #endif // CLOCK_CONFIG_LF_SRC - LF Clock Source -// <0=> RC -// <1=> XTAL -// <2=> Synth -// <131073=> External Low Swing -// <196609=> External Full Swing +// <0=> RC +// <1=> XTAL +// <2=> Synth +// <131073=> External Low Swing +// <196609=> External Full Swing #ifndef CLOCK_CONFIG_LF_SRC -#define CLOCK_CONFIG_LF_SRC 1 + #define CLOCK_CONFIG_LF_SRC 1 #endif // CLOCK_CONFIG_LF_CAL_ENABLED - Calibration enable for LF Clock Source - #ifndef CLOCK_CONFIG_LF_CAL_ENABLED -#define CLOCK_CONFIG_LF_CAL_ENABLED 0 + #define CLOCK_CONFIG_LF_CAL_ENABLED 0 #endif // CLOCK_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef CLOCK_CONFIG_IRQ_PRIORITY -#define CLOCK_CONFIG_IRQ_PRIORITY 6 + #define CLOCK_CONFIG_IRQ_PRIORITY 6 #endif // @@ -5733,51 +5537,50 @@ // PDM_ENABLED - nrf_drv_pdm - PDM peripheral driver - legacy layer //========================================================== #ifndef PDM_ENABLED -#define PDM_ENABLED 0 + #define PDM_ENABLED 0 #endif // PDM_CONFIG_MODE - Mode -// <0=> Stereo -// <1=> Mono +// <0=> Stereo +// <1=> Mono #ifndef PDM_CONFIG_MODE -#define PDM_CONFIG_MODE 1 + #define PDM_CONFIG_MODE 1 #endif // PDM_CONFIG_EDGE - Edge -// <0=> Left falling -// <1=> Left rising +// <0=> Left falling +// <1=> Left rising #ifndef PDM_CONFIG_EDGE -#define PDM_CONFIG_EDGE 0 + #define PDM_CONFIG_EDGE 0 #endif // PDM_CONFIG_CLOCK_FREQ - Clock frequency -// <134217728=> 1000k -// <138412032=> 1032k (default) -// <142606336=> 1067k +// <134217728=> 1000k +// <138412032=> 1032k (default) +// <142606336=> 1067k #ifndef PDM_CONFIG_CLOCK_FREQ -#define PDM_CONFIG_CLOCK_FREQ 138412032 + #define PDM_CONFIG_CLOCK_FREQ 138412032 #endif // PDM_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef PDM_CONFIG_IRQ_PRIORITY -#define PDM_CONFIG_IRQ_PRIORITY 6 + #define PDM_CONFIG_IRQ_PRIORITY 6 #endif // @@ -5785,170 +5588,158 @@ // POWER_ENABLED - nrf_drv_power - POWER peripheral driver - legacy layer //========================================================== #ifndef POWER_ENABLED -#define POWER_ENABLED 0 + #define POWER_ENABLED 0 #endif // POWER_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef POWER_CONFIG_IRQ_PRIORITY -#define POWER_CONFIG_IRQ_PRIORITY 6 + #define POWER_CONFIG_IRQ_PRIORITY 6 #endif // POWER_CONFIG_DEFAULT_DCDCEN - The default configuration of main DCDC regulator - // This settings means only that components for DCDC regulator are installed and it can be enabled. #ifndef POWER_CONFIG_DEFAULT_DCDCEN -#define POWER_CONFIG_DEFAULT_DCDCEN 0 + #define POWER_CONFIG_DEFAULT_DCDCEN 0 #endif // POWER_CONFIG_DEFAULT_DCDCENHV - The default configuration of High Voltage DCDC regulator - // This settings means only that components for DCDC regulator are installed and it can be enabled. #ifndef POWER_CONFIG_DEFAULT_DCDCENHV -#define POWER_CONFIG_DEFAULT_DCDCENHV 0 + #define POWER_CONFIG_DEFAULT_DCDCENHV 0 #endif // // PPI_ENABLED - nrf_drv_ppi - PPI peripheral driver - legacy layer - #ifndef PPI_ENABLED -#define PPI_ENABLED 0 + #define PPI_ENABLED 0 #endif // PWM_ENABLED - nrf_drv_pwm - PWM peripheral driver - legacy layer //========================================================== #ifndef PWM_ENABLED -#define PWM_ENABLED 0 + #define PWM_ENABLED 0 #endif -// PWM_DEFAULT_CONFIG_OUT0_PIN - Out0 pin <0-31> - +// PWM_DEFAULT_CONFIG_OUT0_PIN - Out0 pin <0-31> #ifndef PWM_DEFAULT_CONFIG_OUT0_PIN -#define PWM_DEFAULT_CONFIG_OUT0_PIN 31 + #define PWM_DEFAULT_CONFIG_OUT0_PIN 31 #endif -// PWM_DEFAULT_CONFIG_OUT1_PIN - Out1 pin <0-31> - +// PWM_DEFAULT_CONFIG_OUT1_PIN - Out1 pin <0-31> #ifndef PWM_DEFAULT_CONFIG_OUT1_PIN -#define PWM_DEFAULT_CONFIG_OUT1_PIN 31 + #define PWM_DEFAULT_CONFIG_OUT1_PIN 31 #endif -// PWM_DEFAULT_CONFIG_OUT2_PIN - Out2 pin <0-31> - +// PWM_DEFAULT_CONFIG_OUT2_PIN - Out2 pin <0-31> #ifndef PWM_DEFAULT_CONFIG_OUT2_PIN -#define PWM_DEFAULT_CONFIG_OUT2_PIN 31 + #define PWM_DEFAULT_CONFIG_OUT2_PIN 31 #endif -// PWM_DEFAULT_CONFIG_OUT3_PIN - Out3 pin <0-31> - +// PWM_DEFAULT_CONFIG_OUT3_PIN - Out3 pin <0-31> #ifndef PWM_DEFAULT_CONFIG_OUT3_PIN -#define PWM_DEFAULT_CONFIG_OUT3_PIN 31 + #define PWM_DEFAULT_CONFIG_OUT3_PIN 31 #endif // PWM_DEFAULT_CONFIG_BASE_CLOCK - Base clock -// <0=> 16 MHz -// <1=> 8 MHz -// <2=> 4 MHz -// <3=> 2 MHz -// <4=> 1 MHz -// <5=> 500 kHz -// <6=> 250 kHz -// <7=> 125 kHz +// <0=> 16 MHz +// <1=> 8 MHz +// <2=> 4 MHz +// <3=> 2 MHz +// <4=> 1 MHz +// <5=> 500 kHz +// <6=> 250 kHz +// <7=> 125 kHz #ifndef PWM_DEFAULT_CONFIG_BASE_CLOCK -#define PWM_DEFAULT_CONFIG_BASE_CLOCK 4 + #define PWM_DEFAULT_CONFIG_BASE_CLOCK 4 #endif // PWM_DEFAULT_CONFIG_COUNT_MODE - Count mode -// <0=> Up -// <1=> Up and Down +// <0=> Up +// <1=> Up and Down #ifndef PWM_DEFAULT_CONFIG_COUNT_MODE -#define PWM_DEFAULT_CONFIG_COUNT_MODE 0 + #define PWM_DEFAULT_CONFIG_COUNT_MODE 0 #endif -// PWM_DEFAULT_CONFIG_TOP_VALUE - Top value +// PWM_DEFAULT_CONFIG_TOP_VALUE - Top value #ifndef PWM_DEFAULT_CONFIG_TOP_VALUE -#define PWM_DEFAULT_CONFIG_TOP_VALUE 1000 + #define PWM_DEFAULT_CONFIG_TOP_VALUE 1000 #endif // PWM_DEFAULT_CONFIG_LOAD_MODE - Load mode -// <0=> Common -// <1=> Grouped -// <2=> Individual -// <3=> Waveform +// <0=> Common +// <1=> Grouped +// <2=> Individual +// <3=> Waveform #ifndef PWM_DEFAULT_CONFIG_LOAD_MODE -#define PWM_DEFAULT_CONFIG_LOAD_MODE 0 + #define PWM_DEFAULT_CONFIG_LOAD_MODE 0 #endif // PWM_DEFAULT_CONFIG_STEP_MODE - Step mode -// <0=> Auto -// <1=> Triggered +// <0=> Auto +// <1=> Triggered #ifndef PWM_DEFAULT_CONFIG_STEP_MODE -#define PWM_DEFAULT_CONFIG_STEP_MODE 0 + #define PWM_DEFAULT_CONFIG_STEP_MODE 0 #endif // PWM_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef PWM_DEFAULT_CONFIG_IRQ_PRIORITY -#define PWM_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define PWM_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // PWM0_ENABLED - Enable PWM0 instance - #ifndef PWM0_ENABLED -#define PWM0_ENABLED 0 + #define PWM0_ENABLED 0 #endif // PWM1_ENABLED - Enable PWM1 instance - #ifndef PWM1_ENABLED -#define PWM1_ENABLED 0 + #define PWM1_ENABLED 0 #endif // PWM2_ENABLED - Enable PWM2 instance - #ifndef PWM2_ENABLED -#define PWM2_ENABLED 0 + #define PWM2_ENABLED 0 #endif // PWM_NRF52_ANOMALY_109_WORKAROUND_ENABLED - Enables nRF52 Anomaly 109 workaround for PWM. @@ -5962,19 +5753,19 @@ // done for the next sequence to be played. //========================================================== #ifndef PWM_NRF52_ANOMALY_109_WORKAROUND_ENABLED -#define PWM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 + #define PWM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 #endif // PWM_NRF52_ANOMALY_109_EGU_INSTANCE - EGU instance used by the nRF52 Anomaly 109 workaround for PWM. -// <0=> EGU0 -// <1=> EGU1 -// <2=> EGU2 -// <3=> EGU3 -// <4=> EGU4 -// <5=> EGU5 +// <0=> EGU0 +// <1=> EGU1 +// <2=> EGU2 +// <3=> EGU3 +// <4=> EGU4 +// <5=> EGU5 #ifndef PWM_NRF52_ANOMALY_109_EGU_INSTANCE -#define PWM_NRF52_ANOMALY_109_EGU_INSTANCE 5 + #define PWM_NRF52_ANOMALY_109_EGU_INSTANCE 5 #endif // @@ -5984,102 +5775,96 @@ // QDEC_ENABLED - nrf_drv_qdec - QDEC peripheral driver - legacy layer //========================================================== #ifndef QDEC_ENABLED -#define QDEC_ENABLED 0 + #define QDEC_ENABLED 0 #endif // QDEC_CONFIG_REPORTPER - Report period -// <0=> 10 Samples -// <1=> 40 Samples -// <2=> 80 Samples -// <3=> 120 Samples -// <4=> 160 Samples -// <5=> 200 Samples -// <6=> 240 Samples -// <7=> 280 Samples +// <0=> 10 Samples +// <1=> 40 Samples +// <2=> 80 Samples +// <3=> 120 Samples +// <4=> 160 Samples +// <5=> 200 Samples +// <6=> 240 Samples +// <7=> 280 Samples #ifndef QDEC_CONFIG_REPORTPER -#define QDEC_CONFIG_REPORTPER 0 + #define QDEC_CONFIG_REPORTPER 0 #endif // QDEC_CONFIG_SAMPLEPER - Sample period -// <0=> 128 us -// <1=> 256 us -// <2=> 512 us -// <3=> 1024 us -// <4=> 2048 us -// <5=> 4096 us -// <6=> 8192 us -// <7=> 16384 us +// <0=> 128 us +// <1=> 256 us +// <2=> 512 us +// <3=> 1024 us +// <4=> 2048 us +// <5=> 4096 us +// <6=> 8192 us +// <7=> 16384 us #ifndef QDEC_CONFIG_SAMPLEPER -#define QDEC_CONFIG_SAMPLEPER 7 + #define QDEC_CONFIG_SAMPLEPER 7 #endif -// QDEC_CONFIG_PIO_A - A pin <0-31> - +// QDEC_CONFIG_PIO_A - A pin <0-31> #ifndef QDEC_CONFIG_PIO_A -#define QDEC_CONFIG_PIO_A 31 + #define QDEC_CONFIG_PIO_A 31 #endif -// QDEC_CONFIG_PIO_B - B pin <0-31> - +// QDEC_CONFIG_PIO_B - B pin <0-31> #ifndef QDEC_CONFIG_PIO_B -#define QDEC_CONFIG_PIO_B 31 + #define QDEC_CONFIG_PIO_B 31 #endif -// QDEC_CONFIG_PIO_LED - LED pin <0-31> - +// QDEC_CONFIG_PIO_LED - LED pin <0-31> #ifndef QDEC_CONFIG_PIO_LED -#define QDEC_CONFIG_PIO_LED 31 + #define QDEC_CONFIG_PIO_LED 31 #endif -// QDEC_CONFIG_LEDPRE - LED pre +// QDEC_CONFIG_LEDPRE - LED pre #ifndef QDEC_CONFIG_LEDPRE -#define QDEC_CONFIG_LEDPRE 511 + #define QDEC_CONFIG_LEDPRE 511 #endif // QDEC_CONFIG_LEDPOL - LED polarity -// <0=> Active low -// <1=> Active high +// <0=> Active low +// <1=> Active high #ifndef QDEC_CONFIG_LEDPOL -#define QDEC_CONFIG_LEDPOL 1 + #define QDEC_CONFIG_LEDPOL 1 #endif // QDEC_CONFIG_DBFEN - Debouncing enable - #ifndef QDEC_CONFIG_DBFEN -#define QDEC_CONFIG_DBFEN 0 + #define QDEC_CONFIG_DBFEN 0 #endif // QDEC_CONFIG_SAMPLE_INTEN - Sample ready interrupt enable - #ifndef QDEC_CONFIG_SAMPLE_INTEN -#define QDEC_CONFIG_SAMPLE_INTEN 0 + #define QDEC_CONFIG_SAMPLE_INTEN 0 #endif // QDEC_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef QDEC_CONFIG_IRQ_PRIORITY -#define QDEC_CONFIG_IRQ_PRIORITY 6 + #define QDEC_CONFIG_IRQ_PRIORITY 6 #endif // @@ -6087,129 +5872,127 @@ // QSPI_ENABLED - nrf_drv_qspi - QSPI peripheral driver - legacy layer //========================================================== #ifndef QSPI_ENABLED -#define QSPI_ENABLED 0 + #define QSPI_ENABLED 0 #endif -// QSPI_CONFIG_SCK_DELAY - tSHSL, tWHSL and tSHWL in number of 16 MHz periods (62.5 ns). <0-255> - +// QSPI_CONFIG_SCK_DELAY - tSHSL, tWHSL and tSHWL in number of 16 MHz periods (62.5 ns). <0-255> #ifndef QSPI_CONFIG_SCK_DELAY -#define QSPI_CONFIG_SCK_DELAY 1 + #define QSPI_CONFIG_SCK_DELAY 1 #endif -// QSPI_CONFIG_XIP_OFFSET - Address offset in the external memory for Execute in Place operation. +// QSPI_CONFIG_XIP_OFFSET - Address offset in the external memory for Execute in Place operation. #ifndef QSPI_CONFIG_XIP_OFFSET -#define QSPI_CONFIG_XIP_OFFSET 0 + #define QSPI_CONFIG_XIP_OFFSET 0 #endif // QSPI_CONFIG_READOC - Number of data lines and opcode used for reading. -// <0=> FastRead -// <1=> Read2O -// <2=> Read2IO -// <3=> Read4O -// <4=> Read4IO +// <0=> FastRead +// <1=> Read2O +// <2=> Read2IO +// <3=> Read4O +// <4=> Read4IO #ifndef QSPI_CONFIG_READOC -#define QSPI_CONFIG_READOC 0 + #define QSPI_CONFIG_READOC 0 #endif // QSPI_CONFIG_WRITEOC - Number of data lines and opcode used for writing. -// <0=> PP -// <1=> PP2O -// <2=> PP4O -// <3=> PP4IO +// <0=> PP +// <1=> PP2O +// <2=> PP4O +// <3=> PP4IO #ifndef QSPI_CONFIG_WRITEOC -#define QSPI_CONFIG_WRITEOC 0 + #define QSPI_CONFIG_WRITEOC 0 #endif // QSPI_CONFIG_ADDRMODE - Addressing mode. -// <0=> 24bit -// <1=> 32bit +// <0=> 24bit +// <1=> 32bit #ifndef QSPI_CONFIG_ADDRMODE -#define QSPI_CONFIG_ADDRMODE 0 + #define QSPI_CONFIG_ADDRMODE 0 #endif // QSPI_CONFIG_MODE - SPI mode. -// <0=> Mode 0 -// <1=> Mode 1 +// <0=> Mode 0 +// <1=> Mode 1 #ifndef QSPI_CONFIG_MODE -#define QSPI_CONFIG_MODE 0 + #define QSPI_CONFIG_MODE 0 #endif // QSPI_CONFIG_FREQUENCY - Frequency divider. -// <0=> 32MHz/1 -// <1=> 32MHz/2 -// <2=> 32MHz/3 -// <3=> 32MHz/4 -// <4=> 32MHz/5 -// <5=> 32MHz/6 -// <6=> 32MHz/7 -// <7=> 32MHz/8 -// <8=> 32MHz/9 -// <9=> 32MHz/10 -// <10=> 32MHz/11 -// <11=> 32MHz/12 -// <12=> 32MHz/13 -// <13=> 32MHz/14 -// <14=> 32MHz/15 -// <15=> 32MHz/16 +// <0=> 32MHz/1 +// <1=> 32MHz/2 +// <2=> 32MHz/3 +// <3=> 32MHz/4 +// <4=> 32MHz/5 +// <5=> 32MHz/6 +// <6=> 32MHz/7 +// <7=> 32MHz/8 +// <8=> 32MHz/9 +// <9=> 32MHz/10 +// <10=> 32MHz/11 +// <11=> 32MHz/12 +// <12=> 32MHz/13 +// <13=> 32MHz/14 +// <14=> 32MHz/15 +// <15=> 32MHz/16 #ifndef QSPI_CONFIG_FREQUENCY -#define QSPI_CONFIG_FREQUENCY 15 + #define QSPI_CONFIG_FREQUENCY 15 #endif // QSPI_PIN_SCK - SCK pin value. #ifndef QSPI_PIN_SCK -#define QSPI_PIN_SCK NRF_QSPI_PIN_NOT_CONNECTED + #define QSPI_PIN_SCK NRF_QSPI_PIN_NOT_CONNECTED #endif // QSPI_PIN_CSN - CSN pin value. #ifndef QSPI_PIN_CSN -#define QSPI_PIN_CSN NRF_QSPI_PIN_NOT_CONNECTED + #define QSPI_PIN_CSN NRF_QSPI_PIN_NOT_CONNECTED #endif // QSPI_PIN_IO0 - IO0 pin value. #ifndef QSPI_PIN_IO0 -#define QSPI_PIN_IO0 NRF_QSPI_PIN_NOT_CONNECTED + #define QSPI_PIN_IO0 NRF_QSPI_PIN_NOT_CONNECTED #endif // QSPI_PIN_IO1 - IO1 pin value. #ifndef QSPI_PIN_IO1 -#define QSPI_PIN_IO1 NRF_QSPI_PIN_NOT_CONNECTED + #define QSPI_PIN_IO1 NRF_QSPI_PIN_NOT_CONNECTED #endif // QSPI_PIN_IO2 - IO2 pin value. #ifndef QSPI_PIN_IO2 -#define QSPI_PIN_IO2 NRF_QSPI_PIN_NOT_CONNECTED + #define QSPI_PIN_IO2 NRF_QSPI_PIN_NOT_CONNECTED #endif // QSPI_PIN_IO3 - IO3 pin value. #ifndef QSPI_PIN_IO3 -#define QSPI_PIN_IO3 NRF_QSPI_PIN_NOT_CONNECTED + #define QSPI_PIN_IO3 NRF_QSPI_PIN_NOT_CONNECTED #endif // QSPI_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef QSPI_CONFIG_IRQ_PRIORITY -#define QSPI_CONFIG_IRQ_PRIORITY 6 + #define QSPI_CONFIG_IRQ_PRIORITY 6 #endif // @@ -6217,35 +6000,33 @@ // RNG_ENABLED - nrf_drv_rng - RNG peripheral driver - legacy layer //========================================================== #ifndef RNG_ENABLED -#define RNG_ENABLED 0 + #define RNG_ENABLED 0 #endif // RNG_CONFIG_ERROR_CORRECTION - Error correction - #ifndef RNG_CONFIG_ERROR_CORRECTION -#define RNG_CONFIG_ERROR_CORRECTION 1 + #define RNG_CONFIG_ERROR_CORRECTION 1 #endif -// RNG_CONFIG_POOL_SIZE - Pool size +// RNG_CONFIG_POOL_SIZE - Pool size #ifndef RNG_CONFIG_POOL_SIZE -#define RNG_CONFIG_POOL_SIZE 64 + #define RNG_CONFIG_POOL_SIZE 64 #endif // RNG_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef RNG_CONFIG_IRQ_PRIORITY -#define RNG_CONFIG_IRQ_PRIORITY 6 + #define RNG_CONFIG_IRQ_PRIORITY 6 #endif // @@ -6253,63 +6034,57 @@ // RTC_ENABLED - nrf_drv_rtc - RTC peripheral driver - legacy layer //========================================================== #ifndef RTC_ENABLED -#define RTC_ENABLED 0 + #define RTC_ENABLED 0 #endif -// RTC_DEFAULT_CONFIG_FREQUENCY - Frequency <16-32768> - +// RTC_DEFAULT_CONFIG_FREQUENCY - Frequency <16-32768> #ifndef RTC_DEFAULT_CONFIG_FREQUENCY -#define RTC_DEFAULT_CONFIG_FREQUENCY 32768 + #define RTC_DEFAULT_CONFIG_FREQUENCY 32768 #endif // RTC_DEFAULT_CONFIG_RELIABLE - Ensures safe compare event triggering - #ifndef RTC_DEFAULT_CONFIG_RELIABLE -#define RTC_DEFAULT_CONFIG_RELIABLE 0 + #define RTC_DEFAULT_CONFIG_RELIABLE 0 #endif // RTC_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef RTC_DEFAULT_CONFIG_IRQ_PRIORITY -#define RTC_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define RTC_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // RTC0_ENABLED - Enable RTC0 instance - #ifndef RTC0_ENABLED -#define RTC0_ENABLED 0 + #define RTC0_ENABLED 0 #endif // RTC1_ENABLED - Enable RTC1 instance - #ifndef RTC1_ENABLED -#define RTC1_ENABLED 0 + #define RTC1_ENABLED 0 #endif // RTC2_ENABLED - Enable RTC2 instance - #ifndef RTC2_ENABLED -#define RTC2_ENABLED 0 + #define RTC2_ENABLED 0 #endif -// NRF_MAXIMUM_LATENCY_US - Maximum possible time[us] in highest priority interrupt +// NRF_MAXIMUM_LATENCY_US - Maximum possible time[us] in highest priority interrupt #ifndef NRF_MAXIMUM_LATENCY_US -#define NRF_MAXIMUM_LATENCY_US 2000 + #define NRF_MAXIMUM_LATENCY_US 2000 #endif // @@ -6317,57 +6092,55 @@ // SAADC_ENABLED - nrf_drv_saadc - SAADC peripheral driver - legacy layer //========================================================== #ifndef SAADC_ENABLED -#define SAADC_ENABLED 1 + #define SAADC_ENABLED 1 #endif // SAADC_CONFIG_RESOLUTION - Resolution -// <0=> 8 bit -// <1=> 10 bit -// <2=> 12 bit -// <3=> 14 bit +// <0=> 8 bit +// <1=> 10 bit +// <2=> 12 bit +// <3=> 14 bit #ifndef SAADC_CONFIG_RESOLUTION -#define SAADC_CONFIG_RESOLUTION 1 + #define SAADC_CONFIG_RESOLUTION 1 #endif // SAADC_CONFIG_OVERSAMPLE - Sample period -// <0=> Disabled -// <1=> 2x -// <2=> 4x -// <3=> 8x -// <4=> 16x -// <5=> 32x -// <6=> 64x -// <7=> 128x -// <8=> 256x +// <0=> Disabled +// <1=> 2x +// <2=> 4x +// <3=> 8x +// <4=> 16x +// <5=> 32x +// <6=> 64x +// <7=> 128x +// <8=> 256x #ifndef SAADC_CONFIG_OVERSAMPLE -#define SAADC_CONFIG_OVERSAMPLE 0 + #define SAADC_CONFIG_OVERSAMPLE 0 #endif // SAADC_CONFIG_LP_MODE - Enabling low power mode - #ifndef SAADC_CONFIG_LP_MODE -#define SAADC_CONFIG_LP_MODE 0 + #define SAADC_CONFIG_LP_MODE 0 #endif // SAADC_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef SAADC_CONFIG_IRQ_PRIORITY -#define SAADC_CONFIG_IRQ_PRIORITY 6 + #define SAADC_CONFIG_IRQ_PRIORITY 6 #endif // @@ -6375,83 +6148,76 @@ // SPIS_ENABLED - nrf_drv_spis - SPIS peripheral driver - legacy layer //========================================================== #ifndef SPIS_ENABLED -#define SPIS_ENABLED 0 + #define SPIS_ENABLED 0 #endif // SPIS_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef SPIS_DEFAULT_CONFIG_IRQ_PRIORITY -#define SPIS_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define SPIS_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // SPIS_DEFAULT_MODE - Mode -// <0=> MODE_0 -// <1=> MODE_1 -// <2=> MODE_2 -// <3=> MODE_3 +// <0=> MODE_0 +// <1=> MODE_1 +// <2=> MODE_2 +// <3=> MODE_3 #ifndef SPIS_DEFAULT_MODE -#define SPIS_DEFAULT_MODE 0 + #define SPIS_DEFAULT_MODE 0 #endif // SPIS_DEFAULT_BIT_ORDER - SPIS default bit order -// <0=> MSB first -// <1=> LSB first +// <0=> MSB first +// <1=> LSB first #ifndef SPIS_DEFAULT_BIT_ORDER -#define SPIS_DEFAULT_BIT_ORDER 0 + #define SPIS_DEFAULT_BIT_ORDER 0 #endif -// SPIS_DEFAULT_DEF - SPIS default DEF character <0-255> - +// SPIS_DEFAULT_DEF - SPIS default DEF character <0-255> #ifndef SPIS_DEFAULT_DEF -#define SPIS_DEFAULT_DEF 255 + #define SPIS_DEFAULT_DEF 255 #endif -// SPIS_DEFAULT_ORC - SPIS default ORC character <0-255> - +// SPIS_DEFAULT_ORC - SPIS default ORC character <0-255> #ifndef SPIS_DEFAULT_ORC -#define SPIS_DEFAULT_ORC 255 + #define SPIS_DEFAULT_ORC 255 #endif // SPIS0_ENABLED - Enable SPIS0 instance - #ifndef SPIS0_ENABLED -#define SPIS0_ENABLED 0 + #define SPIS0_ENABLED 0 #endif // SPIS1_ENABLED - Enable SPIS1 instance - #ifndef SPIS1_ENABLED -#define SPIS1_ENABLED 0 + #define SPIS1_ENABLED 0 #endif // SPIS2_ENABLED - Enable SPIS2 instance - #ifndef SPIS2_ENABLED -#define SPIS2_ENABLED 0 + #define SPIS2_ENABLED 0 #endif // SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED - Enables nRF52 Anomaly 109 workaround for SPIS. - // The workaround uses a GPIOTE channel to generate interrupts // on falling edges detected on the CSN line. This will make // the CPU active for the moment when SPIS starts DMA transfers, @@ -6460,7 +6226,7 @@ // enabled as well. #ifndef SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED -#define SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 + #define SPIS_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 #endif // @@ -6468,45 +6234,43 @@ // SPI_ENABLED - nrf_drv_spi - SPI/SPIM peripheral driver - legacy layer //========================================================== #ifndef SPI_ENABLED -#define SPI_ENABLED 0 + #define SPI_ENABLED 0 #endif // SPI_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef SPI_DEFAULT_CONFIG_IRQ_PRIORITY -#define SPI_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define SPI_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // NRF_SPI_DRV_MISO_PULLUP_CFG - MISO PIN pull-up configuration. -// <0=> NRF_GPIO_PIN_NOPULL -// <1=> NRF_GPIO_PIN_PULLDOWN -// <3=> NRF_GPIO_PIN_PULLUP +// <0=> NRF_GPIO_PIN_NOPULL +// <1=> NRF_GPIO_PIN_PULLDOWN +// <3=> NRF_GPIO_PIN_PULLUP #ifndef NRF_SPI_DRV_MISO_PULLUP_CFG -#define NRF_SPI_DRV_MISO_PULLUP_CFG 1 + #define NRF_SPI_DRV_MISO_PULLUP_CFG 1 #endif // SPI0_ENABLED - Enable SPI0 instance //========================================================== #ifndef SPI0_ENABLED -#define SPI0_ENABLED 0 + #define SPI0_ENABLED 0 #endif // SPI0_USE_EASY_DMA - Use EasyDMA - #ifndef SPI0_USE_EASY_DMA -#define SPI0_USE_EASY_DMA 1 + #define SPI0_USE_EASY_DMA 1 #endif // @@ -6514,13 +6278,12 @@ // SPI1_ENABLED - Enable SPI1 instance //========================================================== #ifndef SPI1_ENABLED -#define SPI1_ENABLED 0 + #define SPI1_ENABLED 0 #endif // SPI1_USE_EASY_DMA - Use EasyDMA - #ifndef SPI1_USE_EASY_DMA -#define SPI1_USE_EASY_DMA 1 + #define SPI1_USE_EASY_DMA 1 #endif // @@ -6528,29 +6291,27 @@ // SPI2_ENABLED - Enable SPI2 instance //========================================================== #ifndef SPI2_ENABLED -#define SPI2_ENABLED 0 + #define SPI2_ENABLED 0 #endif // SPI2_USE_EASY_DMA - Use EasyDMA - #ifndef SPI2_USE_EASY_DMA -#define SPI2_USE_EASY_DMA 1 + #define SPI2_USE_EASY_DMA 1 #endif // // SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED - Enables nRF52 anomaly 109 workaround for SPIM. - // The workaround uses interrupts to wake up the CPU by catching -// a start event of zero-length transmission to start the clock. This +// a start event of zero-length transmission to start the clock. This // ensures that the DMA transfer will be executed without issues and -// that the proper transfer will be started. See more in the Errata -// document or Anomaly 109 Addendum located at +// that the proper transfer will be started. See more in the Errata +// document or Anomaly 109 Addendum located at // https://infocenter.nordicsemi.com/ #ifndef SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED -#define SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 + #define SPIM_NRF52_ANOMALY_109_WORKAROUND_ENABLED 0 #endif // @@ -6558,95 +6319,89 @@ // TIMER_ENABLED - nrf_drv_timer - TIMER periperal driver - legacy layer //========================================================== #ifndef TIMER_ENABLED -#define TIMER_ENABLED 0 + #define TIMER_ENABLED 0 #endif // TIMER_DEFAULT_CONFIG_FREQUENCY - Timer frequency if in Timer mode -// <0=> 16 MHz -// <1=> 8 MHz -// <2=> 4 MHz -// <3=> 2 MHz -// <4=> 1 MHz -// <5=> 500 kHz -// <6=> 250 kHz -// <7=> 125 kHz -// <8=> 62.5 kHz -// <9=> 31.25 kHz +// <0=> 16 MHz +// <1=> 8 MHz +// <2=> 4 MHz +// <3=> 2 MHz +// <4=> 1 MHz +// <5=> 500 kHz +// <6=> 250 kHz +// <7=> 125 kHz +// <8=> 62.5 kHz +// <9=> 31.25 kHz #ifndef TIMER_DEFAULT_CONFIG_FREQUENCY -#define TIMER_DEFAULT_CONFIG_FREQUENCY 0 + #define TIMER_DEFAULT_CONFIG_FREQUENCY 0 #endif // TIMER_DEFAULT_CONFIG_MODE - Timer mode or operation -// <0=> Timer -// <1=> Counter +// <0=> Timer +// <1=> Counter #ifndef TIMER_DEFAULT_CONFIG_MODE -#define TIMER_DEFAULT_CONFIG_MODE 0 + #define TIMER_DEFAULT_CONFIG_MODE 0 #endif // TIMER_DEFAULT_CONFIG_BIT_WIDTH - Timer counter bit width -// <0=> 16 bit -// <1=> 8 bit -// <2=> 24 bit -// <3=> 32 bit +// <0=> 16 bit +// <1=> 8 bit +// <2=> 24 bit +// <3=> 32 bit #ifndef TIMER_DEFAULT_CONFIG_BIT_WIDTH -#define TIMER_DEFAULT_CONFIG_BIT_WIDTH 0 + #define TIMER_DEFAULT_CONFIG_BIT_WIDTH 0 #endif // TIMER_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef TIMER_DEFAULT_CONFIG_IRQ_PRIORITY -#define TIMER_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define TIMER_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // TIMER0_ENABLED - Enable TIMER0 instance - #ifndef TIMER0_ENABLED -#define TIMER0_ENABLED 0 + #define TIMER0_ENABLED 0 #endif // TIMER1_ENABLED - Enable TIMER1 instance - #ifndef TIMER1_ENABLED -#define TIMER1_ENABLED 0 + #define TIMER1_ENABLED 0 #endif // TIMER2_ENABLED - Enable TIMER2 instance - #ifndef TIMER2_ENABLED -#define TIMER2_ENABLED 0 + #define TIMER2_ENABLED 0 #endif // TIMER3_ENABLED - Enable TIMER3 instance - #ifndef TIMER3_ENABLED -#define TIMER3_ENABLED 0 + #define TIMER3_ENABLED 0 #endif // TIMER4_ENABLED - Enable TIMER4 instance - #ifndef TIMER4_ENABLED -#define TIMER4_ENABLED 0 + #define TIMER4_ENABLED 0 #endif // @@ -6654,177 +6409,170 @@ // TWIS_ENABLED - nrf_drv_twis - TWIS peripheral driver - legacy layer //========================================================== #ifndef TWIS_ENABLED -#define TWIS_ENABLED 0 + #define TWIS_ENABLED 0 #endif // TWIS0_ENABLED - Enable TWIS0 instance - #ifndef TWIS0_ENABLED -#define TWIS0_ENABLED 0 + #define TWIS0_ENABLED 0 #endif // TWIS1_ENABLED - Enable TWIS1 instance - #ifndef TWIS1_ENABLED -#define TWIS1_ENABLED 0 + #define TWIS1_ENABLED 0 #endif // TWIS_ASSUME_INIT_AFTER_RESET_ONLY - Assume that any instance would be initialized only once - -// Optimization flag. Registers used by TWIS are shared by other peripherals. Normally, during initialization driver tries to clear all registers to known state before doing the initialization itself. This gives initialization safe procedure, no matter when it would be called. If you activate TWIS only once and do never uninitialize it - set this flag to 1 what gives more optimal code. +// Optimization flag. Registers used by TWIS are shared by other peripherals. Normally, during initialization driver tries to clear all +// registers to known state before doing the initialization itself. This gives initialization safe procedure, no matter when it would be +// called. If you activate TWIS only once and do never uninitialize it - set this flag to 1 what gives more optimal code. #ifndef TWIS_ASSUME_INIT_AFTER_RESET_ONLY -#define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 + #define TWIS_ASSUME_INIT_AFTER_RESET_ONLY 0 #endif // TWIS_NO_SYNC_MODE - Remove support for synchronous mode - -// Synchronous mode would be used in specific situations. And it uses some additional code and data memory to safely process state machine by polling it in status functions. If this functionality is not required it may be disabled to free some resources. +// Synchronous mode would be used in specific situations. And it uses some additional code and data memory to safely process state +// machine by polling it in status functions. If this functionality is not required it may be disabled to free some resources. #ifndef TWIS_NO_SYNC_MODE -#define TWIS_NO_SYNC_MODE 0 + #define TWIS_NO_SYNC_MODE 0 #endif -// TWIS_DEFAULT_CONFIG_ADDR0 - Address0 +// TWIS_DEFAULT_CONFIG_ADDR0 - Address0 #ifndef TWIS_DEFAULT_CONFIG_ADDR0 -#define TWIS_DEFAULT_CONFIG_ADDR0 0 + #define TWIS_DEFAULT_CONFIG_ADDR0 0 #endif -// TWIS_DEFAULT_CONFIG_ADDR1 - Address1 +// TWIS_DEFAULT_CONFIG_ADDR1 - Address1 #ifndef TWIS_DEFAULT_CONFIG_ADDR1 -#define TWIS_DEFAULT_CONFIG_ADDR1 0 + #define TWIS_DEFAULT_CONFIG_ADDR1 0 #endif // TWIS_DEFAULT_CONFIG_SCL_PULL - SCL pin pull configuration -// <0=> Disabled -// <1=> Pull down -// <3=> Pull up +// <0=> Disabled +// <1=> Pull down +// <3=> Pull up #ifndef TWIS_DEFAULT_CONFIG_SCL_PULL -#define TWIS_DEFAULT_CONFIG_SCL_PULL 0 + #define TWIS_DEFAULT_CONFIG_SCL_PULL 0 #endif // TWIS_DEFAULT_CONFIG_SDA_PULL - SDA pin pull configuration -// <0=> Disabled -// <1=> Pull down -// <3=> Pull up +// <0=> Disabled +// <1=> Pull down +// <3=> Pull up #ifndef TWIS_DEFAULT_CONFIG_SDA_PULL -#define TWIS_DEFAULT_CONFIG_SDA_PULL 0 + #define TWIS_DEFAULT_CONFIG_SDA_PULL 0 #endif // TWIS_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef TWIS_DEFAULT_CONFIG_IRQ_PRIORITY -#define TWIS_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define TWIS_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // - // UART_ENABLED - nrf_drv_uart - UART/UARTE peripheral driver - legacy layer //========================================================== #ifndef UART_ENABLED -#define UART_ENABLED 0 + #define UART_ENABLED 0 #endif // UART_DEFAULT_CONFIG_HWFC - Hardware Flow Control -// <0=> Disabled -// <1=> Enabled +// <0=> Disabled +// <1=> Enabled #ifndef UART_DEFAULT_CONFIG_HWFC -#define UART_DEFAULT_CONFIG_HWFC 0 + #define UART_DEFAULT_CONFIG_HWFC 0 #endif // UART_DEFAULT_CONFIG_PARITY - Parity -// <0=> Excluded -// <14=> Included +// <0=> Excluded +// <14=> Included #ifndef UART_DEFAULT_CONFIG_PARITY -#define UART_DEFAULT_CONFIG_PARITY 0 + #define UART_DEFAULT_CONFIG_PARITY 0 #endif // UART_DEFAULT_CONFIG_BAUDRATE - Default Baudrate -// <323584=> 1200 baud -// <643072=> 2400 baud -// <1290240=> 4800 baud -// <2576384=> 9600 baud -// <3862528=> 14400 baud -// <5152768=> 19200 baud -// <7716864=> 28800 baud -// <10289152=> 38400 baud -// <15400960=> 57600 baud -// <20615168=> 76800 baud -// <30801920=> 115200 baud -// <61865984=> 230400 baud -// <67108864=> 250000 baud -// <121634816=> 460800 baud -// <251658240=> 921600 baud -// <268435456=> 1000000 baud +// <323584=> 1200 baud +// <643072=> 2400 baud +// <1290240=> 4800 baud +// <2576384=> 9600 baud +// <3862528=> 14400 baud +// <5152768=> 19200 baud +// <7716864=> 28800 baud +// <10289152=> 38400 baud +// <15400960=> 57600 baud +// <20615168=> 76800 baud +// <30801920=> 115200 baud +// <61865984=> 230400 baud +// <67108864=> 250000 baud +// <121634816=> 460800 baud +// <251658240=> 921600 baud +// <268435456=> 1000000 baud #ifndef UART_DEFAULT_CONFIG_BAUDRATE -#define UART_DEFAULT_CONFIG_BAUDRATE 30801920 + #define UART_DEFAULT_CONFIG_BAUDRATE 30801920 #endif // UART_DEFAULT_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef UART_DEFAULT_CONFIG_IRQ_PRIORITY -#define UART_DEFAULT_CONFIG_IRQ_PRIORITY 6 + #define UART_DEFAULT_CONFIG_IRQ_PRIORITY 6 #endif // UART_EASY_DMA_SUPPORT - Driver supporting EasyDMA - #ifndef UART_EASY_DMA_SUPPORT -#define UART_EASY_DMA_SUPPORT 1 + #define UART_EASY_DMA_SUPPORT 1 #endif // UART_LEGACY_SUPPORT - Driver supporting Legacy mode - #ifndef UART_LEGACY_SUPPORT -#define UART_LEGACY_SUPPORT 1 + #define UART_LEGACY_SUPPORT 1 #endif // UART0_ENABLED - Enable UART0 instance //========================================================== #ifndef UART0_ENABLED -#define UART0_ENABLED 0 + #define UART0_ENABLED 0 #endif // UART0_CONFIG_USE_EASY_DMA - Default setting for using EasyDMA - #ifndef UART0_CONFIG_USE_EASY_DMA -#define UART0_CONFIG_USE_EASY_DMA 1 + #define UART0_CONFIG_USE_EASY_DMA 1 #endif // @@ -6834,37 +6582,35 @@ // USBD_ENABLED - nrf_drv_usbd - Software Component //========================================================== #ifndef USBD_ENABLED -#define USBD_ENABLED 0 + #define USBD_ENABLED 0 #endif // USBD_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef USBD_CONFIG_IRQ_PRIORITY -#define USBD_CONFIG_IRQ_PRIORITY 6 + #define USBD_CONFIG_IRQ_PRIORITY 6 #endif // USBD_CONFIG_DMASCHEDULER_MODE - USBD SMA scheduler working scheme -// <0=> Prioritized access -// <1=> Round Robin +// <0=> Prioritized access +// <1=> Round Robin #ifndef USBD_CONFIG_DMASCHEDULER_MODE -#define USBD_CONFIG_DMASCHEDULER_MODE 0 + #define USBD_CONFIG_DMASCHEDULER_MODE 0 #endif // USBD_CONFIG_DMASCHEDULER_ISO_BOOST - Give priority to isochronous transfers - // This option gives priority to isochronous transfers. // Enabling it assures that isochronous transfers are always processed, // even if multiple other transfers are pending. @@ -6872,17 +6618,16 @@ // function is called, so the option is independent of the algorithm chosen. #ifndef USBD_CONFIG_DMASCHEDULER_ISO_BOOST -#define USBD_CONFIG_DMASCHEDULER_ISO_BOOST 1 + #define USBD_CONFIG_DMASCHEDULER_ISO_BOOST 1 #endif // USBD_CONFIG_ISO_IN_ZLP - Respond to an IN token on ISO IN endpoint with ZLP when no data is ready - // If set, ISO IN endpoint will respond to an IN token with ZLP when no data is ready to be sent. // Else, there will be no response. #ifndef USBD_CONFIG_ISO_IN_ZLP -#define USBD_CONFIG_ISO_IN_ZLP 0 + #define USBD_CONFIG_ISO_IN_ZLP 0 #endif // @@ -6890,41 +6635,39 @@ // WDT_ENABLED - nrf_drv_wdt - WDT peripheral driver - legacy layer //========================================================== #ifndef WDT_ENABLED -#define WDT_ENABLED 0 + #define WDT_ENABLED 0 #endif // WDT_CONFIG_BEHAVIOUR - WDT behavior in CPU SLEEP or HALT mode -// <1=> Run in SLEEP, Pause in HALT -// <8=> Pause in SLEEP, Run in HALT -// <9=> Run in SLEEP and HALT -// <0=> Pause in SLEEP and HALT +// <1=> Run in SLEEP, Pause in HALT +// <8=> Pause in SLEEP, Run in HALT +// <9=> Run in SLEEP and HALT +// <0=> Pause in SLEEP and HALT #ifndef WDT_CONFIG_BEHAVIOUR -#define WDT_CONFIG_BEHAVIOUR 1 + #define WDT_CONFIG_BEHAVIOUR 1 #endif -// WDT_CONFIG_RELOAD_VALUE - Reload value <15-4294967295> - +// WDT_CONFIG_RELOAD_VALUE - Reload value <15-4294967295> #ifndef WDT_CONFIG_RELOAD_VALUE -#define WDT_CONFIG_RELOAD_VALUE 2000 + #define WDT_CONFIG_RELOAD_VALUE 2000 #endif // WDT_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef WDT_CONFIG_IRQ_PRIORITY -#define WDT_CONFIG_IRQ_PRIORITY 6 + #define WDT_CONFIG_IRQ_PRIORITY 6 #endif // @@ -6932,65 +6675,60 @@ // nrfx_qspi - QSPI peripheral driver //========================================================== -// +// //========================================================== // nrfx_usbd - USBD peripheral driver //========================================================== -// +// //========================================================== -// +// //========================================================== -// nRF_Drivers_External +// nRF_Drivers_External //========================================================== // NRF_TWI_SENSOR_ENABLED - nrf_twi_sensor - nRF TWI Sensor module - #ifndef NRF_TWI_SENSOR_ENABLED -#define NRF_TWI_SENSOR_ENABLED 0 + #define NRF_TWI_SENSOR_ENABLED 0 #endif -// +// //========================================================== -// nRF_Libraries +// nRF_Libraries //========================================================== // APP_GPIOTE_ENABLED - app_gpiote - GPIOTE events dispatcher - #ifndef APP_GPIOTE_ENABLED -#define APP_GPIOTE_ENABLED 1 + #define APP_GPIOTE_ENABLED 1 #endif // APP_PWM_ENABLED - app_pwm - PWM functionality - #ifndef APP_PWM_ENABLED -#define APP_PWM_ENABLED 0 + #define APP_PWM_ENABLED 0 #endif // APP_SCHEDULER_ENABLED - app_scheduler - Events scheduler //========================================================== #ifndef APP_SCHEDULER_ENABLED -#define APP_SCHEDULER_ENABLED 0 + #define APP_SCHEDULER_ENABLED 0 #endif // APP_SCHEDULER_WITH_PAUSE - Enabling pause feature - #ifndef APP_SCHEDULER_WITH_PAUSE -#define APP_SCHEDULER_WITH_PAUSE 0 + #define APP_SCHEDULER_WITH_PAUSE 0 #endif // APP_SCHEDULER_WITH_PROFILER - Enabling scheduler profiling - #ifndef APP_SCHEDULER_WITH_PROFILER -#define APP_SCHEDULER_WITH_PROFILER 0 + #define APP_SCHEDULER_WITH_PROFILER 0 #endif // @@ -6998,44 +6736,44 @@ // APP_SDCARD_ENABLED - app_sdcard - SD/MMC card support using SPI //========================================================== #ifndef APP_SDCARD_ENABLED -#define APP_SDCARD_ENABLED 0 + #define APP_SDCARD_ENABLED 0 #endif // APP_SDCARD_SPI_INSTANCE - SPI instance used -// <0=> 0 -// <1=> 1 -// <2=> 2 +// <0=> 0 +// <1=> 1 +// <2=> 2 #ifndef APP_SDCARD_SPI_INSTANCE -#define APP_SDCARD_SPI_INSTANCE 0 + #define APP_SDCARD_SPI_INSTANCE 0 #endif // APP_SDCARD_FREQ_INIT - SPI frequency -// <33554432=> 125 kHz -// <67108864=> 250 kHz -// <134217728=> 500 kHz -// <268435456=> 1 MHz -// <536870912=> 2 MHz -// <1073741824=> 4 MHz -// <2147483648=> 8 MHz +// <33554432=> 125 kHz +// <67108864=> 250 kHz +// <134217728=> 500 kHz +// <268435456=> 1 MHz +// <536870912=> 2 MHz +// <1073741824=> 4 MHz +// <2147483648=> 8 MHz #ifndef APP_SDCARD_FREQ_INIT -#define APP_SDCARD_FREQ_INIT 67108864 + #define APP_SDCARD_FREQ_INIT 67108864 #endif // APP_SDCARD_FREQ_DATA - SPI frequency -// <33554432=> 125 kHz -// <67108864=> 250 kHz -// <134217728=> 500 kHz -// <268435456=> 1 MHz -// <536870912=> 2 MHz -// <1073741824=> 4 MHz -// <2147483648=> 8 MHz +// <33554432=> 125 kHz +// <67108864=> 250 kHz +// <134217728=> 500 kHz +// <268435456=> 1 MHz +// <536870912=> 2 MHz +// <1073741824=> 4 MHz +// <2147483648=> 8 MHz #ifndef APP_SDCARD_FREQ_DATA -#define APP_SDCARD_FREQ_DATA 1073741824 + #define APP_SDCARD_FREQ_DATA 1073741824 #endif // @@ -7043,66 +6781,63 @@ // APP_TIMER_ENABLED - app_timer - Application timer functionality //========================================================== #ifndef APP_TIMER_ENABLED -#define APP_TIMER_ENABLED 1 + #define APP_TIMER_ENABLED 1 #endif // APP_TIMER_CONFIG_RTC_FREQUENCY - Configure RTC prescaler. -// <0=> 32768 Hz -// <1=> 16384 Hz -// <3=> 8192 Hz -// <7=> 4096 Hz -// <15=> 2048 Hz -// <31=> 1024 Hz +// <0=> 32768 Hz +// <1=> 16384 Hz +// <3=> 8192 Hz +// <7=> 4096 Hz +// <15=> 2048 Hz +// <31=> 1024 Hz #ifndef APP_TIMER_CONFIG_RTC_FREQUENCY -#define APP_TIMER_CONFIG_RTC_FREQUENCY 0 + #define APP_TIMER_CONFIG_RTC_FREQUENCY 0 #endif // APP_TIMER_CONFIG_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice -// <0=> 0 (highest) -// <1=> 1 -// <2=> 2 -// <3=> 3 -// <4=> 4 -// <5=> 5 -// <6=> 6 -// <7=> 7 +// <0=> 0 (highest) +// <1=> 1 +// <2=> 2 +// <3=> 3 +// <4=> 4 +// <5=> 5 +// <6=> 6 +// <7=> 7 #ifndef APP_TIMER_CONFIG_IRQ_PRIORITY -#define APP_TIMER_CONFIG_IRQ_PRIORITY 6 + #define APP_TIMER_CONFIG_IRQ_PRIORITY 6 #endif -// APP_TIMER_CONFIG_OP_QUEUE_SIZE - Capacity of timer requests queue. +// APP_TIMER_CONFIG_OP_QUEUE_SIZE - Capacity of timer requests queue. // Size of the queue depends on how many timers are used // in the system, how often timers are started and overall // system latency. If queue size is too small app_timer calls // will fail. #ifndef APP_TIMER_CONFIG_OP_QUEUE_SIZE -#define APP_TIMER_CONFIG_OP_QUEUE_SIZE 10 + #define APP_TIMER_CONFIG_OP_QUEUE_SIZE 10 #endif // APP_TIMER_CONFIG_USE_SCHEDULER - Enable scheduling app_timer events to app_scheduler - #ifndef APP_TIMER_CONFIG_USE_SCHEDULER -#define APP_TIMER_CONFIG_USE_SCHEDULER 0 + #define APP_TIMER_CONFIG_USE_SCHEDULER 0 #endif // APP_TIMER_KEEPS_RTC_ACTIVE - Enable RTC always on - // If option is enabled RTC is kept running even if there is no active timers. // This option can be used when app_timer is used for timestamping. #ifndef APP_TIMER_KEEPS_RTC_ACTIVE -#define APP_TIMER_KEEPS_RTC_ACTIVE 0 + #define APP_TIMER_KEEPS_RTC_ACTIVE 0 #endif -// APP_TIMER_SAFE_WINDOW_MS - Maximum possible latency (in milliseconds) of handling app_timer event. +// APP_TIMER_SAFE_WINDOW_MS - Maximum possible latency (in milliseconds) of handling app_timer event. // Maximum possible timeout that can be set is reduced by safe window. // Example: RTC frequency 16384 Hz, maximum possible timeout 1024 seconds - APP_TIMER_SAFE_WINDOW_MS. // Since RTC is not stopped when processor is halted in debugging session, this value @@ -7110,7 +6845,7 @@ // without corrupting app_timer behavior. #ifndef APP_TIMER_SAFE_WINDOW_MS -#define APP_TIMER_SAFE_WINDOW_MS 300000 + #define APP_TIMER_SAFE_WINDOW_MS 300000 #endif // App Timer Legacy configuration - Legacy configuration. @@ -7118,162 +6853,148 @@ //========================================================== // APP_TIMER_WITH_PROFILER - Enable app_timer profiling - #ifndef APP_TIMER_WITH_PROFILER -#define APP_TIMER_WITH_PROFILER 0 + #define APP_TIMER_WITH_PROFILER 0 #endif // APP_TIMER_CONFIG_SWI_NUMBER - Configure SWI instance used. - #ifndef APP_TIMER_CONFIG_SWI_NUMBER -#define APP_TIMER_CONFIG_SWI_NUMBER 0 + #define APP_TIMER_CONFIG_SWI_NUMBER 0 #endif -// +// //========================================================== // // APP_USBD_AUDIO_ENABLED - app_usbd_audio - USB AUDIO class - #ifndef APP_USBD_AUDIO_ENABLED -#define APP_USBD_AUDIO_ENABLED 0 + #define APP_USBD_AUDIO_ENABLED 0 #endif // APP_USBD_ENABLED - app_usbd - USB Device library //========================================================== #ifndef APP_USBD_ENABLED -#define APP_USBD_ENABLED 0 + #define APP_USBD_ENABLED 0 #endif -// APP_USBD_VID - Vendor ID. <0x0000-0xFFFF> - +// APP_USBD_VID - Vendor ID. <0x0000-0xFFFF> // Note: This value is not editable in Configuration Wizard. // Vendor ID ordered from USB IF: http://www.usb.org/developers/vendor/ #ifndef APP_USBD_VID -#define APP_USBD_VID 0 + #define APP_USBD_VID 0 #endif -// APP_USBD_PID - Product ID. <0x0000-0xFFFF> - +// APP_USBD_PID - Product ID. <0x0000-0xFFFF> // Note: This value is not editable in Configuration Wizard. // Selected Product ID #ifndef APP_USBD_PID -#define APP_USBD_PID 0 + #define APP_USBD_PID 0 #endif -// APP_USBD_DEVICE_VER_MAJOR - Device version, major part. <0-99> - +// APP_USBD_DEVICE_VER_MAJOR - Device version, major part. <0-99> // Device version, will be converted automatically to BCD notation. Use just decimal values. #ifndef APP_USBD_DEVICE_VER_MAJOR -#define APP_USBD_DEVICE_VER_MAJOR 1 + #define APP_USBD_DEVICE_VER_MAJOR 1 #endif -// APP_USBD_DEVICE_VER_MINOR - Device version, minor part. <0-99> - +// APP_USBD_DEVICE_VER_MINOR - Device version, minor part. <0-99> // Device version, will be converted automatically to BCD notation. Use just decimal values. #ifndef APP_USBD_DEVICE_VER_MINOR -#define APP_USBD_DEVICE_VER_MINOR 0 + #define APP_USBD_DEVICE_VER_MINOR 0 #endif // APP_USBD_CONFIG_SELF_POWERED - Self-powered device, as opposed to bus-powered. - #ifndef APP_USBD_CONFIG_SELF_POWERED -#define APP_USBD_CONFIG_SELF_POWERED 1 + #define APP_USBD_CONFIG_SELF_POWERED 1 #endif -// APP_USBD_CONFIG_MAX_POWER - MaxPower field in configuration descriptor in milliamps. <0-500> - +// APP_USBD_CONFIG_MAX_POWER - MaxPower field in configuration descriptor in milliamps. <0-500> #ifndef APP_USBD_CONFIG_MAX_POWER -#define APP_USBD_CONFIG_MAX_POWER 100 + #define APP_USBD_CONFIG_MAX_POWER 100 #endif // APP_USBD_CONFIG_POWER_EVENTS_PROCESS - Process power events. - // Enable processing power events in USB event handler. #ifndef APP_USBD_CONFIG_POWER_EVENTS_PROCESS -#define APP_USBD_CONFIG_POWER_EVENTS_PROCESS 1 + #define APP_USBD_CONFIG_POWER_EVENTS_PROCESS 1 #endif // APP_USBD_CONFIG_EVENT_QUEUE_ENABLE - Enable event queue. // This is the default configuration when all the events are placed into internal queue. // Disable it when an external queue is used like app_scheduler or if you wish to process all events inside interrupts. -// Processing all events from the interrupt level adds requirement not to call any functions that modifies the USBD library state from the context higher than USB interrupt context. -// Functions that modify USBD state are functions for sleep, wakeup, start, stop, enable, and disable. +// Processing all events from the interrupt level adds requirement not to call any functions that modifies the USBD library state from +// the context higher than USB interrupt context. Functions that modify USBD state are functions for sleep, wakeup, start, stop, enable, +// and disable. //========================================================== #ifndef APP_USBD_CONFIG_EVENT_QUEUE_ENABLE -#define APP_USBD_CONFIG_EVENT_QUEUE_ENABLE 1 + #define APP_USBD_CONFIG_EVENT_QUEUE_ENABLE 1 #endif -// APP_USBD_CONFIG_EVENT_QUEUE_SIZE - The size of the event queue. <16-64> - +// APP_USBD_CONFIG_EVENT_QUEUE_SIZE - The size of the event queue. <16-64> // The size of the queue for the events that would be processed in the main loop. #ifndef APP_USBD_CONFIG_EVENT_QUEUE_SIZE -#define APP_USBD_CONFIG_EVENT_QUEUE_SIZE 32 + #define APP_USBD_CONFIG_EVENT_QUEUE_SIZE 32 #endif // APP_USBD_CONFIG_SOF_HANDLING_MODE - Change SOF events handling mode. - // Normal queue - SOF events are pushed normally into the event queue. // Compress queue - SOF events are counted and binded with other events or executed when the queue is empty. // This prevents the queue from filling up with SOF events. // Interrupt - SOF events are processed in interrupt. -// <0=> Normal queue -// <1=> Compress queue -// <2=> Interrupt +// <0=> Normal queue +// <1=> Compress queue +// <2=> Interrupt #ifndef APP_USBD_CONFIG_SOF_HANDLING_MODE -#define APP_USBD_CONFIG_SOF_HANDLING_MODE 1 + #define APP_USBD_CONFIG_SOF_HANDLING_MODE 1 #endif // // APP_USBD_CONFIG_SOF_TIMESTAMP_PROVIDE - Provide a function that generates timestamps for logs based on the current SOF. - -// The function app_usbd_sof_timestamp_get is implemented if the logger is enabled. -// Use it when initializing the logger. -// SOF processing is always enabled when this configuration parameter is active. -// Note: This option is configured outside of APP_USBD_CONFIG_LOG_ENABLED. -// This means that it works even if the logging in this very module is disabled. +// The function app_usbd_sof_timestamp_get is implemented if the logger is enabled. +// Use it when initializing the logger. +// SOF processing is always enabled when this configuration parameter is active. +// Note: This option is configured outside of APP_USBD_CONFIG_LOG_ENABLED. +// This means that it works even if the logging in this very module is disabled. #ifndef APP_USBD_CONFIG_SOF_TIMESTAMP_PROVIDE -#define APP_USBD_CONFIG_SOF_TIMESTAMP_PROVIDE 0 + #define APP_USBD_CONFIG_SOF_TIMESTAMP_PROVIDE 0 #endif -// APP_USBD_CONFIG_DESC_STRING_SIZE - Maximum size of the NULL-terminated string of the string descriptor. <31-254> - +// APP_USBD_CONFIG_DESC_STRING_SIZE - Maximum size of the NULL-terminated string of the string descriptor. <31-254> // 31 characters can be stored in the internal USB buffer used for transfers. // Any value higher than 31 creates an additional buffer just for descriptor strings. #ifndef APP_USBD_CONFIG_DESC_STRING_SIZE -#define APP_USBD_CONFIG_DESC_STRING_SIZE 31 + #define APP_USBD_CONFIG_DESC_STRING_SIZE 31 #endif // APP_USBD_CONFIG_DESC_STRING_UTF_ENABLED - Enable UTF8 conversion. - // Enable UTF8-encoded characters. In normal processing, only ASCII characters are available. #ifndef APP_USBD_CONFIG_DESC_STRING_UTF_ENABLED -#define APP_USBD_CONFIG_DESC_STRING_UTF_ENABLED 0 + #define APP_USBD_CONFIG_DESC_STRING_UTF_ENABLED 0 #endif // APP_USBD_STRINGS_LANGIDS - Supported languages identifiers. @@ -7281,7 +7002,7 @@ // Note: This value is not editable in Configuration Wizard. // Comma-separated list of supported languages. #ifndef APP_USBD_STRINGS_LANGIDS -#define APP_USBD_STRINGS_LANGIDS APP_USBD_LANG_AND_SUBLANG(APP_USBD_LANG_ENGLISH, APP_USBD_SUBLANG_ENGLISH_US) + #define APP_USBD_STRINGS_LANGIDS APP_USBD_LANG_AND_SUBLANG(APP_USBD_LANG_ENGLISH, APP_USBD_SUBLANG_ENGLISH_US) #endif // APP_USBD_STRING_ID_MANUFACTURER - Define manufacturer string ID. @@ -7289,13 +7010,13 @@ // Setting ID to 0 disables the string. //========================================================== #ifndef APP_USBD_STRING_ID_MANUFACTURER -#define APP_USBD_STRING_ID_MANUFACTURER 1 + #define APP_USBD_STRING_ID_MANUFACTURER 1 #endif -// APP_USBD_STRINGS_MANUFACTURER_EXTERN - Define whether @ref APP_USBD_STRINGS_MANUFACTURER is created by macro or declared as a global variable. - +// APP_USBD_STRINGS_MANUFACTURER_EXTERN - Define whether @ref APP_USBD_STRINGS_MANUFACTURER is created by macro or declared as a global +// variable. #ifndef APP_USBD_STRINGS_MANUFACTURER_EXTERN -#define APP_USBD_STRINGS_MANUFACTURER_EXTERN 0 + #define APP_USBD_STRINGS_MANUFACTURER_EXTERN 0 #endif // APP_USBD_STRINGS_MANUFACTURER - String descriptor for the manufacturer name. @@ -7309,7 +7030,7 @@ // Setting string to NULL disables that string. // The order of manufacturer names must be the same like in @ref APP_USBD_STRINGS_LANGIDS. #ifndef APP_USBD_STRINGS_MANUFACTURER -#define APP_USBD_STRINGS_MANUFACTURER APP_USBD_STRING_DESC("Nordic Semiconductor") + #define APP_USBD_STRINGS_MANUFACTURER APP_USBD_STRING_DESC("Nordic Semiconductor") #endif // @@ -7319,13 +7040,12 @@ // Setting ID to 0 disables the string. //========================================================== #ifndef APP_USBD_STRING_ID_PRODUCT -#define APP_USBD_STRING_ID_PRODUCT 2 + #define APP_USBD_STRING_ID_PRODUCT 2 #endif // APP_USBD_STRINGS_PRODUCT_EXTERN - Define whether @ref APP_USBD_STRINGS_PRODUCT is created by macro or declared as a global variable. - #ifndef APP_USBD_STRINGS_PRODUCT_EXTERN -#define APP_USBD_STRINGS_PRODUCT_EXTERN 0 + #define APP_USBD_STRINGS_PRODUCT_EXTERN 0 #endif // APP_USBD_STRINGS_PRODUCT - String descriptor for the product name. @@ -7333,7 +7053,7 @@ // Note: This value is not editable in Configuration Wizard. // List of product names that is defined the same way like in @ref APP_USBD_STRINGS_MANUFACTURER. #ifndef APP_USBD_STRINGS_PRODUCT -#define APP_USBD_STRINGS_PRODUCT APP_USBD_STRING_DESC("nRF52 USB Product") + #define APP_USBD_STRINGS_PRODUCT APP_USBD_STRING_DESC("nRF52 USB Product") #endif // @@ -7343,13 +7063,12 @@ // Setting ID to 0 disables the string. //========================================================== #ifndef APP_USBD_STRING_ID_SERIAL -#define APP_USBD_STRING_ID_SERIAL 3 + #define APP_USBD_STRING_ID_SERIAL 3 #endif // APP_USBD_STRING_SERIAL_EXTERN - Define whether @ref APP_USBD_STRING_SERIAL is created by macro or declared as a global variable. - #ifndef APP_USBD_STRING_SERIAL_EXTERN -#define APP_USBD_STRING_SERIAL_EXTERN 0 + #define APP_USBD_STRING_SERIAL_EXTERN 0 #endif // APP_USBD_STRING_SERIAL - String descriptor for the serial number. @@ -7357,7 +7076,7 @@ // Note: This value is not editable in Configuration Wizard. // Serial number that is defined the same way like in @ref APP_USBD_STRINGS_MANUFACTURER. #ifndef APP_USBD_STRING_SERIAL -#define APP_USBD_STRING_SERIAL APP_USBD_STRING_DESC("000000000000") + #define APP_USBD_STRING_SERIAL APP_USBD_STRING_DESC("000000000000") #endif // @@ -7367,13 +7086,13 @@ // Setting ID to 0 disables the string. //========================================================== #ifndef APP_USBD_STRING_ID_CONFIGURATION -#define APP_USBD_STRING_ID_CONFIGURATION 4 + #define APP_USBD_STRING_ID_CONFIGURATION 4 #endif -// APP_USBD_STRING_CONFIGURATION_EXTERN - Define whether @ref APP_USBD_STRINGS_CONFIGURATION is created by macro or declared as global variable. - +// APP_USBD_STRING_CONFIGURATION_EXTERN - Define whether @ref APP_USBD_STRINGS_CONFIGURATION is created by macro or declared as global +// variable. #ifndef APP_USBD_STRING_CONFIGURATION_EXTERN -#define APP_USBD_STRING_CONFIGURATION_EXTERN 0 + #define APP_USBD_STRING_CONFIGURATION_EXTERN 0 #endif // APP_USBD_STRINGS_CONFIGURATION - String descriptor for the device configuration. @@ -7381,7 +7100,7 @@ // Note: This value is not editable in Configuration Wizard. // Configuration string that is defined the same way like in @ref APP_USBD_STRINGS_MANUFACTURER. #ifndef APP_USBD_STRINGS_CONFIGURATION -#define APP_USBD_STRINGS_CONFIGURATION APP_USBD_STRING_DESC("Default configuration") + #define APP_USBD_STRINGS_CONFIGURATION APP_USBD_STRING_DESC("Default configuration") #endif // @@ -7402,7 +7121,7 @@ // Then use X(USBD_STRING_WINUSB, =0xEE, (APP_USBD_STRING_DESC(...))) // - @c ... : List of string descriptors for each defined language. #ifndef APP_USBD_STRINGS_USER -#define APP_USBD_STRINGS_USER X(APP_USER_1, , APP_USBD_STRING_DESC("User 1")) + #define APP_USBD_STRINGS_USER X(APP_USER_1, , APP_USBD_STRING_DESC("User 1")) #endif // @@ -7410,118 +7129,108 @@ // APP_USBD_HID_ENABLED - app_usbd_hid - USB HID class //========================================================== #ifndef APP_USBD_HID_ENABLED -#define APP_USBD_HID_ENABLED 0 + #define APP_USBD_HID_ENABLED 0 #endif -// APP_USBD_HID_DEFAULT_IDLE_RATE - Default idle rate for HID class. <0-255> - +// APP_USBD_HID_DEFAULT_IDLE_RATE - Default idle rate for HID class. <0-255> // 0 means indefinite duration, any other value is multiplied by 4 milliseconds. Refer to Chapter 7.2.4 of HID 1.11 Specification. #ifndef APP_USBD_HID_DEFAULT_IDLE_RATE -#define APP_USBD_HID_DEFAULT_IDLE_RATE 0 + #define APP_USBD_HID_DEFAULT_IDLE_RATE 0 #endif -// APP_USBD_HID_REPORT_IDLE_TABLE_SIZE - Size of idle rate table. <1-255> - +// APP_USBD_HID_REPORT_IDLE_TABLE_SIZE - Size of idle rate table. <1-255> // Must be higher than the highest report ID used. #ifndef APP_USBD_HID_REPORT_IDLE_TABLE_SIZE -#define APP_USBD_HID_REPORT_IDLE_TABLE_SIZE 4 + #define APP_USBD_HID_REPORT_IDLE_TABLE_SIZE 4 #endif // // APP_USBD_HID_GENERIC_ENABLED - app_usbd_hid_generic - USB HID generic - #ifndef APP_USBD_HID_GENERIC_ENABLED -#define APP_USBD_HID_GENERIC_ENABLED 0 + #define APP_USBD_HID_GENERIC_ENABLED 0 #endif // APP_USBD_HID_KBD_ENABLED - app_usbd_hid_kbd - USB HID keyboard - #ifndef APP_USBD_HID_KBD_ENABLED -#define APP_USBD_HID_KBD_ENABLED 0 + #define APP_USBD_HID_KBD_ENABLED 0 #endif // APP_USBD_HID_MOUSE_ENABLED - app_usbd_hid_mouse - USB HID mouse - #ifndef APP_USBD_HID_MOUSE_ENABLED -#define APP_USBD_HID_MOUSE_ENABLED 0 + #define APP_USBD_HID_MOUSE_ENABLED 0 #endif // APP_USBD_MSC_ENABLED - app_usbd_msc - USB MSC class - #ifndef APP_USBD_MSC_ENABLED -#define APP_USBD_MSC_ENABLED 0 + #define APP_USBD_MSC_ENABLED 0 #endif // CRC16_ENABLED - crc16 - CRC16 calculation routines - #ifndef CRC16_ENABLED -#define CRC16_ENABLED 1 + #define CRC16_ENABLED 1 #endif // CRC32_ENABLED - crc32 - CRC32 calculation routines - #ifndef CRC32_ENABLED -#define CRC32_ENABLED 0 + #define CRC32_ENABLED 0 #endif // ECC_ENABLED - ecc - Elliptic Curve Cryptography Library - #ifndef ECC_ENABLED -#define ECC_ENABLED 0 + #define ECC_ENABLED 0 #endif // FDS_ENABLED - fds - Flash data storage module //========================================================== #ifndef FDS_ENABLED -#define FDS_ENABLED 1 + #define FDS_ENABLED 1 #endif // Pages - Virtual page settings // Configure the number of virtual pages to use and their size. //========================================================== -// FDS_VIRTUAL_PAGES - Number of virtual flash pages to use. +// FDS_VIRTUAL_PAGES - Number of virtual flash pages to use. // One of the virtual pages is reserved by the system for garbage collection. // Therefore, the minimum is two virtual pages: one page to store data and one page to be used by the system for garbage collection. // The total amount of flash memory that is used by FDS amounts to @ref FDS_VIRTUAL_PAGES * @ref FDS_VIRTUAL_PAGE_SIZE * 4 bytes. #ifndef FDS_VIRTUAL_PAGES -#define FDS_VIRTUAL_PAGES 3 + #define FDS_VIRTUAL_PAGES 3 #endif // FDS_VIRTUAL_PAGE_SIZE - The size of a virtual flash page. - // Expressed in number of 4-byte words. // By default, a virtual page is the same size as a physical page. // The size of a virtual page must be a multiple of the size of a physical page. -// <1024=> 1024 -// <2048=> 2048 +// <1024=> 1024 +// <2048=> 2048 #ifndef FDS_VIRTUAL_PAGE_SIZE -#define FDS_VIRTUAL_PAGE_SIZE 1024 + #define FDS_VIRTUAL_PAGE_SIZE 1024 #endif -// FDS_VIRTUAL_PAGES_RESERVED - The number of virtual flash pages that are used by other modules. +// FDS_VIRTUAL_PAGES_RESERVED - The number of virtual flash pages that are used by other modules. // FDS module stores its data in the last pages of the flash memory. // By setting this value, you can move flash end address used by the FDS. // As a result the reserved space can be used by other modules. #ifndef FDS_VIRTUAL_PAGES_RESERVED -#define FDS_VIRTUAL_PAGES_RESERVED 0 + #define FDS_VIRTUAL_PAGES_RESERVED 0 #endif -// +// //========================================================== // Backend - Backend configuration @@ -7530,30 +7239,29 @@ //========================================================== // FDS_BACKEND - FDS flash backend. - // NRF_FSTORAGE_SD uses the nrf_fstorage_sd backend implementation using the SoftDevice API. Use this if you have a SoftDevice present. // NRF_FSTORAGE_NVMC uses the nrf_fstorage_nvmc implementation. Use this setting if you don't use the SoftDevice. -// <1=> NRF_FSTORAGE_NVMC -// <2=> NRF_FSTORAGE_SD +// <1=> NRF_FSTORAGE_NVMC +// <2=> NRF_FSTORAGE_SD #ifndef FDS_BACKEND -#define FDS_BACKEND 2 + #define FDS_BACKEND 2 #endif -// +// //========================================================== // Queue - Queue settings //========================================================== -// FDS_OP_QUEUE_SIZE - Size of the internal queue. +// FDS_OP_QUEUE_SIZE - Size of the internal queue. // Increase this value if you frequently get synchronous FDS_ERR_NO_SPACE_IN_QUEUES errors. #ifndef FDS_OP_QUEUE_SIZE -#define FDS_OP_QUEUE_SIZE 4 + #define FDS_OP_QUEUE_SIZE 4 #endif -// +// //========================================================== // CRC - CRC functionality @@ -7566,63 +7274,61 @@ // Additionally, they will not be garbage collected until they are deleted. //========================================================== #ifndef FDS_CRC_CHECK_ON_READ -#define FDS_CRC_CHECK_ON_READ 0 + #define FDS_CRC_CHECK_ON_READ 0 #endif // FDS_CRC_CHECK_ON_WRITE - Perform a CRC check on newly written records. - // Perform a CRC check on newly written records. // This setting can be used to make sure that the record data was not altered while being written to flash. -// <1=> Enabled -// <0=> Disabled +// <1=> Enabled +// <0=> Disabled #ifndef FDS_CRC_CHECK_ON_WRITE -#define FDS_CRC_CHECK_ON_WRITE 0 + #define FDS_CRC_CHECK_ON_WRITE 0 #endif // -// +// //========================================================== // Users - Number of users //========================================================== -// FDS_MAX_USERS - Maximum number of callbacks that can be registered. +// FDS_MAX_USERS - Maximum number of callbacks that can be registered. #ifndef FDS_MAX_USERS -#define FDS_MAX_USERS 4 + #define FDS_MAX_USERS 4 #endif -// +// //========================================================== // // HARDFAULT_HANDLER_ENABLED - hardfault_default - HardFault default handler for debugging and release - #ifndef HARDFAULT_HANDLER_ENABLED -#define HARDFAULT_HANDLER_ENABLED 1 + #define HARDFAULT_HANDLER_ENABLED 1 #endif // HCI_MEM_POOL_ENABLED - hci_mem_pool - memory pool implementation used by HCI //========================================================== #ifndef HCI_MEM_POOL_ENABLED -#define HCI_MEM_POOL_ENABLED 0 + #define HCI_MEM_POOL_ENABLED 0 #endif -// HCI_TX_BUF_SIZE - TX buffer size in bytes. +// HCI_TX_BUF_SIZE - TX buffer size in bytes. #ifndef HCI_TX_BUF_SIZE -#define HCI_TX_BUF_SIZE 600 + #define HCI_TX_BUF_SIZE 600 #endif -// HCI_RX_BUF_SIZE - RX buffer size in bytes. +// HCI_RX_BUF_SIZE - RX buffer size in bytes. #ifndef HCI_RX_BUF_SIZE -#define HCI_RX_BUF_SIZE 600 + #define HCI_RX_BUF_SIZE 600 #endif -// HCI_RX_BUF_QUEUE_SIZE - RX buffer queue size. +// HCI_RX_BUF_QUEUE_SIZE - RX buffer queue size. #ifndef HCI_RX_BUF_QUEUE_SIZE -#define HCI_RX_BUF_QUEUE_SIZE 4 + #define HCI_RX_BUF_QUEUE_SIZE 4 #endif // @@ -7630,58 +7336,58 @@ // HCI_SLIP_ENABLED - hci_slip - SLIP protocol implementation used by HCI //========================================================== #ifndef HCI_SLIP_ENABLED -#define HCI_SLIP_ENABLED 0 + #define HCI_SLIP_ENABLED 0 #endif // HCI_UART_BAUDRATE - Default Baudrate -// <323584=> 1200 baud -// <643072=> 2400 baud -// <1290240=> 4800 baud -// <2576384=> 9600 baud -// <3862528=> 14400 baud -// <5152768=> 19200 baud -// <7716864=> 28800 baud -// <10289152=> 38400 baud -// <15400960=> 57600 baud -// <20615168=> 76800 baud -// <30801920=> 115200 baud -// <61865984=> 230400 baud -// <67108864=> 250000 baud -// <121634816=> 460800 baud -// <251658240=> 921600 baud -// <268435456=> 1000000 baud +// <323584=> 1200 baud +// <643072=> 2400 baud +// <1290240=> 4800 baud +// <2576384=> 9600 baud +// <3862528=> 14400 baud +// <5152768=> 19200 baud +// <7716864=> 28800 baud +// <10289152=> 38400 baud +// <15400960=> 57600 baud +// <20615168=> 76800 baud +// <30801920=> 115200 baud +// <61865984=> 230400 baud +// <67108864=> 250000 baud +// <121634816=> 460800 baud +// <251658240=> 921600 baud +// <268435456=> 1000000 baud #ifndef HCI_UART_BAUDRATE -#define HCI_UART_BAUDRATE 30801920 + #define HCI_UART_BAUDRATE 30801920 #endif // HCI_UART_FLOW_CONTROL - Hardware Flow Control -// <0=> Disabled -// <1=> Enabled +// <0=> Disabled +// <1=> Enabled #ifndef HCI_UART_FLOW_CONTROL -#define HCI_UART_FLOW_CONTROL 0 + #define HCI_UART_FLOW_CONTROL 0 #endif -// HCI_UART_RX_PIN - UART RX pin +// HCI_UART_RX_PIN - UART RX pin #ifndef HCI_UART_RX_PIN -#define HCI_UART_RX_PIN 31 + #define HCI_UART_RX_PIN 31 #endif -// HCI_UART_TX_PIN - UART TX pin +// HCI_UART_TX_PIN - UART TX pin #ifndef HCI_UART_TX_PIN -#define HCI_UART_TX_PIN 31 + #define HCI_UART_TX_PIN 31 #endif -// HCI_UART_RTS_PIN - UART RTS pin +// HCI_UART_RTS_PIN - UART RTS pin #ifndef HCI_UART_RTS_PIN -#define HCI_UART_RTS_PIN 31 + #define HCI_UART_RTS_PIN 31 #endif -// HCI_UART_CTS_PIN - UART CTS pin +// HCI_UART_CTS_PIN - UART CTS pin #ifndef HCI_UART_CTS_PIN -#define HCI_UART_CTS_PIN 31 + #define HCI_UART_CTS_PIN 31 #endif // @@ -7689,188 +7395,178 @@ // HCI_TRANSPORT_ENABLED - hci_transport - HCI transport //========================================================== #ifndef HCI_TRANSPORT_ENABLED -#define HCI_TRANSPORT_ENABLED 0 + #define HCI_TRANSPORT_ENABLED 0 #endif -// HCI_MAX_PACKET_SIZE_IN_BITS - Maximum size of a single application packet in bits. +// HCI_MAX_PACKET_SIZE_IN_BITS - Maximum size of a single application packet in bits. #ifndef HCI_MAX_PACKET_SIZE_IN_BITS -#define HCI_MAX_PACKET_SIZE_IN_BITS 8000 + #define HCI_MAX_PACKET_SIZE_IN_BITS 8000 #endif // // LED_SOFTBLINK_ENABLED - led_softblink - led_softblink module - #ifndef LED_SOFTBLINK_ENABLED -#define LED_SOFTBLINK_ENABLED 0 + #define LED_SOFTBLINK_ENABLED 0 #endif // LOW_POWER_PWM_ENABLED - low_power_pwm - low_power_pwm module - #ifndef LOW_POWER_PWM_ENABLED -#define LOW_POWER_PWM_ENABLED 0 + #define LOW_POWER_PWM_ENABLED 0 #endif // MEM_MANAGER_ENABLED - mem_manager - Dynamic memory allocator //========================================================== #ifndef MEM_MANAGER_ENABLED -#define MEM_MANAGER_ENABLED 0 + #define MEM_MANAGER_ENABLED 0 #endif -// MEMORY_MANAGER_SMALL_BLOCK_COUNT - Size of each memory blocks identified as 'small' block. <0-255> - +// MEMORY_MANAGER_SMALL_BLOCK_COUNT - Size of each memory blocks identified as 'small' block. <0-255> #ifndef MEMORY_MANAGER_SMALL_BLOCK_COUNT -#define MEMORY_MANAGER_SMALL_BLOCK_COUNT 1 + #define MEMORY_MANAGER_SMALL_BLOCK_COUNT 1 #endif -// MEMORY_MANAGER_SMALL_BLOCK_SIZE - Size of each memory blocks identified as 'small' block. +// MEMORY_MANAGER_SMALL_BLOCK_SIZE - Size of each memory blocks identified as 'small' block. // Size of each memory blocks identified as 'small' block. Memory block are recommended to be word-sized. #ifndef MEMORY_MANAGER_SMALL_BLOCK_SIZE -#define MEMORY_MANAGER_SMALL_BLOCK_SIZE 32 + #define MEMORY_MANAGER_SMALL_BLOCK_SIZE 32 #endif -// MEMORY_MANAGER_MEDIUM_BLOCK_COUNT - Size of each memory blocks identified as 'medium' block. <0-255> - +// MEMORY_MANAGER_MEDIUM_BLOCK_COUNT - Size of each memory blocks identified as 'medium' block. <0-255> #ifndef MEMORY_MANAGER_MEDIUM_BLOCK_COUNT -#define MEMORY_MANAGER_MEDIUM_BLOCK_COUNT 0 + #define MEMORY_MANAGER_MEDIUM_BLOCK_COUNT 0 #endif -// MEMORY_MANAGER_MEDIUM_BLOCK_SIZE - Size of each memory blocks identified as 'medium' block. +// MEMORY_MANAGER_MEDIUM_BLOCK_SIZE - Size of each memory blocks identified as 'medium' block. // Size of each memory blocks identified as 'medium' block. Memory block are recommended to be word-sized. #ifndef MEMORY_MANAGER_MEDIUM_BLOCK_SIZE -#define MEMORY_MANAGER_MEDIUM_BLOCK_SIZE 256 + #define MEMORY_MANAGER_MEDIUM_BLOCK_SIZE 256 #endif -// MEMORY_MANAGER_LARGE_BLOCK_COUNT - Size of each memory blocks identified as 'large' block. <0-255> - +// MEMORY_MANAGER_LARGE_BLOCK_COUNT - Size of each memory blocks identified as 'large' block. <0-255> #ifndef MEMORY_MANAGER_LARGE_BLOCK_COUNT -#define MEMORY_MANAGER_LARGE_BLOCK_COUNT 0 + #define MEMORY_MANAGER_LARGE_BLOCK_COUNT 0 #endif -// MEMORY_MANAGER_LARGE_BLOCK_SIZE - Size of each memory blocks identified as 'large' block. +// MEMORY_MANAGER_LARGE_BLOCK_SIZE - Size of each memory blocks identified as 'large' block. // Size of each memory blocks identified as 'large' block. Memory block are recommended to be word-sized. #ifndef MEMORY_MANAGER_LARGE_BLOCK_SIZE -#define MEMORY_MANAGER_LARGE_BLOCK_SIZE 256 + #define MEMORY_MANAGER_LARGE_BLOCK_SIZE 256 #endif -// MEMORY_MANAGER_XLARGE_BLOCK_COUNT - Size of each memory blocks identified as 'extra large' block. <0-255> - +// MEMORY_MANAGER_XLARGE_BLOCK_COUNT - Size of each memory blocks identified as 'extra large' block. <0-255> #ifndef MEMORY_MANAGER_XLARGE_BLOCK_COUNT -#define MEMORY_MANAGER_XLARGE_BLOCK_COUNT 0 + #define MEMORY_MANAGER_XLARGE_BLOCK_COUNT 0 #endif -// MEMORY_MANAGER_XLARGE_BLOCK_SIZE - Size of each memory blocks identified as 'extra large' block. +// MEMORY_MANAGER_XLARGE_BLOCK_SIZE - Size of each memory blocks identified as 'extra large' block. // Size of each memory blocks identified as 'extra large' block. Memory block are recommended to be word-sized. #ifndef MEMORY_MANAGER_XLARGE_BLOCK_SIZE -#define MEMORY_MANAGER_XLARGE_BLOCK_SIZE 1320 + #define MEMORY_MANAGER_XLARGE_BLOCK_SIZE 1320 #endif -// MEMORY_MANAGER_XXLARGE_BLOCK_COUNT - Size of each memory blocks identified as 'extra extra large' block. <0-255> - +// MEMORY_MANAGER_XXLARGE_BLOCK_COUNT - Size of each memory blocks identified as 'extra extra large' block. <0-255> #ifndef MEMORY_MANAGER_XXLARGE_BLOCK_COUNT -#define MEMORY_MANAGER_XXLARGE_BLOCK_COUNT 0 + #define MEMORY_MANAGER_XXLARGE_BLOCK_COUNT 0 #endif -// MEMORY_MANAGER_XXLARGE_BLOCK_SIZE - Size of each memory blocks identified as 'extra extra large' block. +// MEMORY_MANAGER_XXLARGE_BLOCK_SIZE - Size of each memory blocks identified as 'extra extra large' block. // Size of each memory blocks identified as 'extra extra large' block. Memory block are recommended to be word-sized. #ifndef MEMORY_MANAGER_XXLARGE_BLOCK_SIZE -#define MEMORY_MANAGER_XXLARGE_BLOCK_SIZE 3444 + #define MEMORY_MANAGER_XXLARGE_BLOCK_SIZE 3444 #endif -// MEMORY_MANAGER_XSMALL_BLOCK_COUNT - Size of each memory blocks identified as 'extra small' block. <0-255> - +// MEMORY_MANAGER_XSMALL_BLOCK_COUNT - Size of each memory blocks identified as 'extra small' block. <0-255> #ifndef MEMORY_MANAGER_XSMALL_BLOCK_COUNT -#define MEMORY_MANAGER_XSMALL_BLOCK_COUNT 0 + #define MEMORY_MANAGER_XSMALL_BLOCK_COUNT 0 #endif -// MEMORY_MANAGER_XSMALL_BLOCK_SIZE - Size of each memory blocks identified as 'extra small' block. +// MEMORY_MANAGER_XSMALL_BLOCK_SIZE - Size of each memory blocks identified as 'extra small' block. // Size of each memory blocks identified as 'extra large' block. Memory block are recommended to be word-sized. #ifndef MEMORY_MANAGER_XSMALL_BLOCK_SIZE -#define MEMORY_MANAGER_XSMALL_BLOCK_SIZE 64 + #define MEMORY_MANAGER_XSMALL_BLOCK_SIZE 64 #endif -// MEMORY_MANAGER_XXSMALL_BLOCK_COUNT - Size of each memory blocks identified as 'extra extra small' block. <0-255> - +// MEMORY_MANAGER_XXSMALL_BLOCK_COUNT - Size of each memory blocks identified as 'extra extra small' block. <0-255> #ifndef MEMORY_MANAGER_XXSMALL_BLOCK_COUNT -#define MEMORY_MANAGER_XXSMALL_BLOCK_COUNT 0 + #define MEMORY_MANAGER_XXSMALL_BLOCK_COUNT 0 #endif -// MEMORY_MANAGER_XXSMALL_BLOCK_SIZE - Size of each memory blocks identified as 'extra extra small' block. +// MEMORY_MANAGER_XXSMALL_BLOCK_SIZE - Size of each memory blocks identified as 'extra extra small' block. // Size of each memory blocks identified as 'extra extra small' block. Memory block are recommended to be word-sized. #ifndef MEMORY_MANAGER_XXSMALL_BLOCK_SIZE -#define MEMORY_MANAGER_XXSMALL_BLOCK_SIZE 32 + #define MEMORY_MANAGER_XXSMALL_BLOCK_SIZE 32 #endif // MEM_MANAGER_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef MEM_MANAGER_CONFIG_LOG_ENABLED -#define MEM_MANAGER_CONFIG_LOG_ENABLED 0 + #define MEM_MANAGER_CONFIG_LOG_ENABLED 0 #endif // MEM_MANAGER_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef MEM_MANAGER_CONFIG_LOG_LEVEL -#define MEM_MANAGER_CONFIG_LOG_LEVEL 3 + #define MEM_MANAGER_CONFIG_LOG_LEVEL 3 #endif // MEM_MANAGER_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef MEM_MANAGER_CONFIG_INFO_COLOR -#define MEM_MANAGER_CONFIG_INFO_COLOR 0 + #define MEM_MANAGER_CONFIG_INFO_COLOR 0 #endif // MEM_MANAGER_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef MEM_MANAGER_CONFIG_DEBUG_COLOR -#define MEM_MANAGER_CONFIG_DEBUG_COLOR 0 + #define MEM_MANAGER_CONFIG_DEBUG_COLOR 0 #endif // // MEM_MANAGER_DISABLE_API_PARAM_CHECK - Disable API parameter checks in the module. - #ifndef MEM_MANAGER_DISABLE_API_PARAM_CHECK -#define MEM_MANAGER_DISABLE_API_PARAM_CHECK 0 + #define MEM_MANAGER_DISABLE_API_PARAM_CHECK 0 #endif // @@ -7878,53 +7574,47 @@ // NRF_BALLOC_ENABLED - nrf_balloc - Block allocator module //========================================================== #ifndef NRF_BALLOC_ENABLED -#define NRF_BALLOC_ENABLED 1 + #define NRF_BALLOC_ENABLED 1 #endif // NRF_BALLOC_CONFIG_DEBUG_ENABLED - Enables debug mode in the module. //========================================================== #ifndef NRF_BALLOC_CONFIG_DEBUG_ENABLED -#define NRF_BALLOC_CONFIG_DEBUG_ENABLED 0 + #define NRF_BALLOC_CONFIG_DEBUG_ENABLED 0 #endif -// NRF_BALLOC_CONFIG_HEAD_GUARD_WORDS - Number of words used as head guard. <0-255> - +// NRF_BALLOC_CONFIG_HEAD_GUARD_WORDS - Number of words used as head guard. <0-255> #ifndef NRF_BALLOC_CONFIG_HEAD_GUARD_WORDS -#define NRF_BALLOC_CONFIG_HEAD_GUARD_WORDS 1 + #define NRF_BALLOC_CONFIG_HEAD_GUARD_WORDS 1 #endif -// NRF_BALLOC_CONFIG_TAIL_GUARD_WORDS - Number of words used as tail guard. <0-255> - +// NRF_BALLOC_CONFIG_TAIL_GUARD_WORDS - Number of words used as tail guard. <0-255> #ifndef NRF_BALLOC_CONFIG_TAIL_GUARD_WORDS -#define NRF_BALLOC_CONFIG_TAIL_GUARD_WORDS 1 + #define NRF_BALLOC_CONFIG_TAIL_GUARD_WORDS 1 #endif // NRF_BALLOC_CONFIG_BASIC_CHECKS_ENABLED - Enables basic checks in this module. - #ifndef NRF_BALLOC_CONFIG_BASIC_CHECKS_ENABLED -#define NRF_BALLOC_CONFIG_BASIC_CHECKS_ENABLED 0 + #define NRF_BALLOC_CONFIG_BASIC_CHECKS_ENABLED 0 #endif // NRF_BALLOC_CONFIG_DOUBLE_FREE_CHECK_ENABLED - Enables double memory free check in this module. - #ifndef NRF_BALLOC_CONFIG_DOUBLE_FREE_CHECK_ENABLED -#define NRF_BALLOC_CONFIG_DOUBLE_FREE_CHECK_ENABLED 0 + #define NRF_BALLOC_CONFIG_DOUBLE_FREE_CHECK_ENABLED 0 #endif // NRF_BALLOC_CONFIG_DATA_TRASHING_CHECK_ENABLED - Enables free memory corruption check in this module. - #ifndef NRF_BALLOC_CONFIG_DATA_TRASHING_CHECK_ENABLED -#define NRF_BALLOC_CONFIG_DATA_TRASHING_CHECK_ENABLED 0 + #define NRF_BALLOC_CONFIG_DATA_TRASHING_CHECK_ENABLED 0 #endif // NRF_BALLOC_CLI_CMDS - Enable CLI commands specific to the module - #ifndef NRF_BALLOC_CLI_CMDS -#define NRF_BALLOC_CLI_CMDS 0 + #define NRF_BALLOC_CLI_CMDS 0 #endif // @@ -7934,38 +7624,38 @@ // NRF_CSENSE_ENABLED - nrf_csense - Capacitive sensor module //========================================================== #ifndef NRF_CSENSE_ENABLED -#define NRF_CSENSE_ENABLED 0 + #define NRF_CSENSE_ENABLED 0 #endif -// NRF_CSENSE_PAD_HYSTERESIS - Minimum value of change required to determine that a pad was touched. +// NRF_CSENSE_PAD_HYSTERESIS - Minimum value of change required to determine that a pad was touched. #ifndef NRF_CSENSE_PAD_HYSTERESIS -#define NRF_CSENSE_PAD_HYSTERESIS 15 + #define NRF_CSENSE_PAD_HYSTERESIS 15 #endif -// NRF_CSENSE_PAD_DEVIATION - Minimum value measured on a pad required to take it into account while calculating the step. +// NRF_CSENSE_PAD_DEVIATION - Minimum value measured on a pad required to take it into account while calculating the step. #ifndef NRF_CSENSE_PAD_DEVIATION -#define NRF_CSENSE_PAD_DEVIATION 70 + #define NRF_CSENSE_PAD_DEVIATION 70 #endif -// NRF_CSENSE_MIN_PAD_VALUE - Minimum normalized value on a pad required to take its value into account. +// NRF_CSENSE_MIN_PAD_VALUE - Minimum normalized value on a pad required to take its value into account. #ifndef NRF_CSENSE_MIN_PAD_VALUE -#define NRF_CSENSE_MIN_PAD_VALUE 20 + #define NRF_CSENSE_MIN_PAD_VALUE 20 #endif -// NRF_CSENSE_MAX_PADS_NUMBER - Maximum number of pads used for one instance. +// NRF_CSENSE_MAX_PADS_NUMBER - Maximum number of pads used for one instance. #ifndef NRF_CSENSE_MAX_PADS_NUMBER -#define NRF_CSENSE_MAX_PADS_NUMBER 20 + #define NRF_CSENSE_MAX_PADS_NUMBER 20 #endif -// NRF_CSENSE_MAX_VALUE - Maximum normalized value obtained from measurement. +// NRF_CSENSE_MAX_VALUE - Maximum normalized value obtained from measurement. #ifndef NRF_CSENSE_MAX_VALUE -#define NRF_CSENSE_MAX_VALUE 1000 + #define NRF_CSENSE_MAX_VALUE 1000 #endif -// NRF_CSENSE_OUTPUT_PIN - Output pin used by the low-level module. +// NRF_CSENSE_OUTPUT_PIN - Output pin used by the low-level module. // This is used when capacitive sensor does not use COMP. #ifndef NRF_CSENSE_OUTPUT_PIN -#define NRF_CSENSE_OUTPUT_PIN 26 + #define NRF_CSENSE_OUTPUT_PIN 26 #endif // @@ -7973,32 +7663,32 @@ // NRF_DRV_CSENSE_ENABLED - nrf_drv_csense - Capacitive sensor low-level module //========================================================== #ifndef NRF_DRV_CSENSE_ENABLED -#define NRF_DRV_CSENSE_ENABLED 0 + #define NRF_DRV_CSENSE_ENABLED 0 #endif // USE_COMP - Use the comparator to implement the capacitive sensor driver. // Due to Anomaly 84, COMP I_SOURCE is not functional. It has too high a varation. //========================================================== #ifndef USE_COMP -#define USE_COMP 0 + #define USE_COMP 0 #endif -// TIMER0_FOR_CSENSE - First TIMER instance used by the driver (not used on nRF51). +// TIMER0_FOR_CSENSE - First TIMER instance used by the driver (not used on nRF51). #ifndef TIMER0_FOR_CSENSE -#define TIMER0_FOR_CSENSE 1 + #define TIMER0_FOR_CSENSE 1 #endif -// TIMER1_FOR_CSENSE - Second TIMER instance used by the driver (not used on nRF51). +// TIMER1_FOR_CSENSE - Second TIMER instance used by the driver (not used on nRF51). #ifndef TIMER1_FOR_CSENSE -#define TIMER1_FOR_CSENSE 2 + #define TIMER1_FOR_CSENSE 2 #endif -// MEASUREMENT_PERIOD - Single measurement period. +// MEASUREMENT_PERIOD - Single measurement period. // Time of a single measurement can be calculated as // T = (1/2)*MEASUREMENT_PERIOD*(1/f_OSC) where f_OSC = I_SOURCE / (2C*(VUP-VDOWN) ). // I_SOURCE, VUP, and VDOWN are values used to initialize COMP and C is the capacitance of the used pad. #ifndef MEASUREMENT_PERIOD -#define MEASUREMENT_PERIOD 20 + #define MEASUREMENT_PERIOD 20 #endif // @@ -8008,7 +7698,7 @@ // NRF_FSTORAGE_ENABLED - nrf_fstorage - Flash abstraction library //========================================================== #ifndef NRF_FSTORAGE_ENABLED -#define NRF_FSTORAGE_ENABLED 1 + #define NRF_FSTORAGE_ENABLED 1 #endif // nrf_fstorage - Common settings @@ -8016,173 +7706,166 @@ //========================================================== // NRF_FSTORAGE_PARAM_CHECK_DISABLED - Disable user input validation - // If selected, use ASSERT to validate user input. // This effectively removes user input validation in production code. // Recommended setting: OFF, only enable this setting if size is a major concern. #ifndef NRF_FSTORAGE_PARAM_CHECK_DISABLED -#define NRF_FSTORAGE_PARAM_CHECK_DISABLED 0 + #define NRF_FSTORAGE_PARAM_CHECK_DISABLED 0 #endif -// +// //========================================================== // nrf_fstorage_sd - Implementation using the SoftDevice // Configuration options for the fstorage implementation using the SoftDevice //========================================================== -// NRF_FSTORAGE_SD_QUEUE_SIZE - Size of the internal queue of operations +// NRF_FSTORAGE_SD_QUEUE_SIZE - Size of the internal queue of operations // Increase this value if API calls frequently return the error @ref NRF_ERROR_NO_MEM. #ifndef NRF_FSTORAGE_SD_QUEUE_SIZE -#define NRF_FSTORAGE_SD_QUEUE_SIZE 4 + #define NRF_FSTORAGE_SD_QUEUE_SIZE 4 #endif -// NRF_FSTORAGE_SD_MAX_RETRIES - Maximum number of attempts at executing an operation when the SoftDevice is busy +// NRF_FSTORAGE_SD_MAX_RETRIES - Maximum number of attempts at executing an operation when the SoftDevice is busy // Increase this value if events frequently return the @ref NRF_ERROR_TIMEOUT error. // The SoftDevice might fail to schedule flash access due to high BLE activity. #ifndef NRF_FSTORAGE_SD_MAX_RETRIES -#define NRF_FSTORAGE_SD_MAX_RETRIES 8 + #define NRF_FSTORAGE_SD_MAX_RETRIES 8 #endif -// NRF_FSTORAGE_SD_MAX_WRITE_SIZE - Maximum number of bytes to be written to flash in a single operation +// NRF_FSTORAGE_SD_MAX_WRITE_SIZE - Maximum number of bytes to be written to flash in a single operation // This value must be a multiple of four. // Lowering this value can increase the chances of the SoftDevice being able to execute flash operations in between radio activity. // This value is bound by the maximum number of bytes that can be written to flash in a single call to @ref sd_flash_write. // That is 1024 bytes for nRF51 ICs and 4096 bytes for nRF52 ICs. #ifndef NRF_FSTORAGE_SD_MAX_WRITE_SIZE -#define NRF_FSTORAGE_SD_MAX_WRITE_SIZE 4096 + #define NRF_FSTORAGE_SD_MAX_WRITE_SIZE 4096 #endif -// +// //========================================================== // // NRF_GFX_ENABLED - nrf_gfx - GFX module - #ifndef NRF_GFX_ENABLED -#define NRF_GFX_ENABLED 1 + #define NRF_GFX_ENABLED 1 #endif #ifndef ST7735_ENABLED -#define ST7735_ENABLED 0 + #define ST7735_ENABLED 0 #endif // NRF_MEMOBJ_ENABLED - nrf_memobj - Linked memory allocator module - #ifndef NRF_MEMOBJ_ENABLED -#define NRF_MEMOBJ_ENABLED 1 + #define NRF_MEMOBJ_ENABLED 1 #endif // NRF_PWR_MGMT_ENABLED - nrf_pwr_mgmt - Power management module //========================================================== #ifndef NRF_PWR_MGMT_ENABLED -#define NRF_PWR_MGMT_ENABLED 0 + #define NRF_PWR_MGMT_ENABLED 0 #endif // NRF_PWR_MGMT_CONFIG_DEBUG_PIN_ENABLED - Enables pin debug in the module. // Selected pin will be set when CPU is in sleep mode. //========================================================== #ifndef NRF_PWR_MGMT_CONFIG_DEBUG_PIN_ENABLED -#define NRF_PWR_MGMT_CONFIG_DEBUG_PIN_ENABLED 0 + #define NRF_PWR_MGMT_CONFIG_DEBUG_PIN_ENABLED 0 #endif // NRF_PWR_MGMT_SLEEP_DEBUG_PIN - Pin number -// <0=> 0 (P0.0) -// <1=> 1 (P0.1) -// <2=> 2 (P0.2) -// <3=> 3 (P0.3) -// <4=> 4 (P0.4) -// <5=> 5 (P0.5) -// <6=> 6 (P0.6) -// <7=> 7 (P0.7) -// <8=> 8 (P0.8) -// <9=> 9 (P0.9) -// <10=> 10 (P0.10) -// <11=> 11 (P0.11) -// <12=> 12 (P0.12) -// <13=> 13 (P0.13) -// <14=> 14 (P0.14) -// <15=> 15 (P0.15) -// <16=> 16 (P0.16) -// <17=> 17 (P0.17) -// <18=> 18 (P0.18) -// <19=> 19 (P0.19) -// <20=> 20 (P0.20) -// <21=> 21 (P0.21) -// <22=> 22 (P0.22) -// <23=> 23 (P0.23) -// <24=> 24 (P0.24) -// <25=> 25 (P0.25) -// <26=> 26 (P0.26) -// <27=> 27 (P0.27) -// <28=> 28 (P0.28) -// <29=> 29 (P0.29) -// <30=> 30 (P0.30) -// <31=> 31 (P0.31) -// <4294967295=> Not connected +// <0=> 0 (P0.0) +// <1=> 1 (P0.1) +// <2=> 2 (P0.2) +// <3=> 3 (P0.3) +// <4=> 4 (P0.4) +// <5=> 5 (P0.5) +// <6=> 6 (P0.6) +// <7=> 7 (P0.7) +// <8=> 8 (P0.8) +// <9=> 9 (P0.9) +// <10=> 10 (P0.10) +// <11=> 11 (P0.11) +// <12=> 12 (P0.12) +// <13=> 13 (P0.13) +// <14=> 14 (P0.14) +// <15=> 15 (P0.15) +// <16=> 16 (P0.16) +// <17=> 17 (P0.17) +// <18=> 18 (P0.18) +// <19=> 19 (P0.19) +// <20=> 20 (P0.20) +// <21=> 21 (P0.21) +// <22=> 22 (P0.22) +// <23=> 23 (P0.23) +// <24=> 24 (P0.24) +// <25=> 25 (P0.25) +// <26=> 26 (P0.26) +// <27=> 27 (P0.27) +// <28=> 28 (P0.28) +// <29=> 29 (P0.29) +// <30=> 30 (P0.30) +// <31=> 31 (P0.31) +// <4294967295=> Not connected #ifndef NRF_PWR_MGMT_SLEEP_DEBUG_PIN -#define NRF_PWR_MGMT_SLEEP_DEBUG_PIN 31 + #define NRF_PWR_MGMT_SLEEP_DEBUG_PIN 31 #endif // // NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_ENABLED - Enables CPU usage monitor. - // Module will trace percentage of CPU usage in one second intervals. #ifndef NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_ENABLED -#define NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_ENABLED 0 + #define NRF_PWR_MGMT_CONFIG_CPU_USAGE_MONITOR_ENABLED 0 #endif // NRF_PWR_MGMT_CONFIG_STANDBY_TIMEOUT_ENABLED - Enable standby timeout. //========================================================== #ifndef NRF_PWR_MGMT_CONFIG_STANDBY_TIMEOUT_ENABLED -#define NRF_PWR_MGMT_CONFIG_STANDBY_TIMEOUT_ENABLED 0 + #define NRF_PWR_MGMT_CONFIG_STANDBY_TIMEOUT_ENABLED 0 #endif -// NRF_PWR_MGMT_CONFIG_STANDBY_TIMEOUT_S - Standby timeout (in seconds). +// NRF_PWR_MGMT_CONFIG_STANDBY_TIMEOUT_S - Standby timeout (in seconds). // Shutdown procedure will begin no earlier than after this number of seconds. #ifndef NRF_PWR_MGMT_CONFIG_STANDBY_TIMEOUT_S -#define NRF_PWR_MGMT_CONFIG_STANDBY_TIMEOUT_S 3 + #define NRF_PWR_MGMT_CONFIG_STANDBY_TIMEOUT_S 3 #endif // // NRF_PWR_MGMT_CONFIG_FPU_SUPPORT_ENABLED - Enables FPU event cleaning. - #ifndef NRF_PWR_MGMT_CONFIG_FPU_SUPPORT_ENABLED -#define NRF_PWR_MGMT_CONFIG_FPU_SUPPORT_ENABLED 0 + #define NRF_PWR_MGMT_CONFIG_FPU_SUPPORT_ENABLED 0 #endif // NRF_PWR_MGMT_CONFIG_AUTO_SHUTDOWN_RETRY - Blocked shutdown procedure will be retried every second. - #ifndef NRF_PWR_MGMT_CONFIG_AUTO_SHUTDOWN_RETRY -#define NRF_PWR_MGMT_CONFIG_AUTO_SHUTDOWN_RETRY 0 + #define NRF_PWR_MGMT_CONFIG_AUTO_SHUTDOWN_RETRY 0 #endif // NRF_PWR_MGMT_CONFIG_USE_SCHEDULER - Module will use @ref app_scheduler. - #ifndef NRF_PWR_MGMT_CONFIG_USE_SCHEDULER -#define NRF_PWR_MGMT_CONFIG_USE_SCHEDULER 0 + #define NRF_PWR_MGMT_CONFIG_USE_SCHEDULER 0 #endif -// NRF_PWR_MGMT_CONFIG_HANDLER_PRIORITY_COUNT - The number of priorities for module handlers. +// NRF_PWR_MGMT_CONFIG_HANDLER_PRIORITY_COUNT - The number of priorities for module handlers. // The number of stages of the shutdown process. #ifndef NRF_PWR_MGMT_CONFIG_HANDLER_PRIORITY_COUNT -#define NRF_PWR_MGMT_CONFIG_HANDLER_PRIORITY_COUNT 3 + #define NRF_PWR_MGMT_CONFIG_HANDLER_PRIORITY_COUNT 3 #endif // @@ -8190,99 +7873,90 @@ // NRF_QUEUE_ENABLED - nrf_queue - Queue module //========================================================== #ifndef NRF_QUEUE_ENABLED -#define NRF_QUEUE_ENABLED 0 + #define NRF_QUEUE_ENABLED 0 #endif // NRF_QUEUE_CLI_CMDS - Enable CLI commands specific to the module - #ifndef NRF_QUEUE_CLI_CMDS -#define NRF_QUEUE_CLI_CMDS 0 + #define NRF_QUEUE_CLI_CMDS 0 #endif // // NRF_SECTION_ITER_ENABLED - nrf_section_iter - Section iterator - #ifndef NRF_SECTION_ITER_ENABLED -#define NRF_SECTION_ITER_ENABLED 1 + #define NRF_SECTION_ITER_ENABLED 1 #endif // NRF_SORTLIST_ENABLED - nrf_sortlist - Sorted list - #ifndef NRF_SORTLIST_ENABLED -#define NRF_SORTLIST_ENABLED 0 + #define NRF_SORTLIST_ENABLED 0 #endif // NRF_SPI_MNGR_ENABLED - nrf_spi_mngr - SPI transaction manager - #ifndef NRF_SPI_MNGR_ENABLED -#define NRF_SPI_MNGR_ENABLED 0 + #define NRF_SPI_MNGR_ENABLED 0 #endif // NRF_STRERROR_ENABLED - nrf_strerror - Library for converting error code to string. - #ifndef NRF_STRERROR_ENABLED -#define NRF_STRERROR_ENABLED 1 + #define NRF_STRERROR_ENABLED 1 #endif // NRF_TWI_MNGR_ENABLED - nrf_twi_mngr - TWI transaction manager - #ifndef NRF_TWI_MNGR_ENABLED -#define NRF_TWI_MNGR_ENABLED 0 + #define NRF_TWI_MNGR_ENABLED 0 #endif // SLIP_ENABLED - slip - SLIP encoding and decoding - #ifndef SLIP_ENABLED -#define SLIP_ENABLED 0 + #define SLIP_ENABLED 0 #endif // TASK_MANAGER_ENABLED - task_manager - Task manager. //========================================================== #ifndef TASK_MANAGER_ENABLED -#define TASK_MANAGER_ENABLED 0 + #define TASK_MANAGER_ENABLED 0 #endif // TASK_MANAGER_CLI_CMDS - Enable CLI commands specific to the module - #ifndef TASK_MANAGER_CLI_CMDS -#define TASK_MANAGER_CLI_CMDS 0 + #define TASK_MANAGER_CLI_CMDS 0 #endif -// TASK_MANAGER_CONFIG_MAX_TASKS - Maximum number of tasks which can be created +// TASK_MANAGER_CONFIG_MAX_TASKS - Maximum number of tasks which can be created #ifndef TASK_MANAGER_CONFIG_MAX_TASKS -#define TASK_MANAGER_CONFIG_MAX_TASKS 2 + #define TASK_MANAGER_CONFIG_MAX_TASKS 2 #endif -// TASK_MANAGER_CONFIG_STACK_SIZE - Stack size for every task (power of 2) +// TASK_MANAGER_CONFIG_STACK_SIZE - Stack size for every task (power of 2) #ifndef TASK_MANAGER_CONFIG_STACK_SIZE -#define TASK_MANAGER_CONFIG_STACK_SIZE 1024 + #define TASK_MANAGER_CONFIG_STACK_SIZE 1024 #endif // TASK_MANAGER_CONFIG_STACK_PROFILER_ENABLED - Enable stack profiling. - #ifndef TASK_MANAGER_CONFIG_STACK_PROFILER_ENABLED -#define TASK_MANAGER_CONFIG_STACK_PROFILER_ENABLED 1 + #define TASK_MANAGER_CONFIG_STACK_PROFILER_ENABLED 1 #endif // TASK_MANAGER_CONFIG_STACK_GUARD - Configures stack guard. -// <0=> Disabled -// <4=> 32 bytes -// <5=> 64 bytes -// <6=> 128 bytes -// <7=> 256 bytes -// <8=> 512 bytes +// <0=> Disabled +// <4=> 32 bytes +// <5=> 64 bytes +// <6=> 128 bytes +// <7=> 256 bytes +// <8=> 512 bytes #ifndef TASK_MANAGER_CONFIG_STACK_GUARD -#define TASK_MANAGER_CONFIG_STACK_GUARD 7 + #define TASK_MANAGER_CONFIG_STACK_GUARD 7 #endif // @@ -8292,19 +7966,17 @@ //========================================================== // BUTTON_ENABLED - Enables Button module - #ifndef BUTTON_ENABLED -#define BUTTON_ENABLED 1 + #define BUTTON_ENABLED 1 #endif // BUTTON_HIGH_ACCURACY_ENABLED - Enables GPIOTE high accuracy for buttons - #ifndef BUTTON_HIGH_ACCURACY_ENABLED -#define BUTTON_HIGH_ACCURACY_ENABLED 0 + #define BUTTON_HIGH_ACCURACY_ENABLED 0 #endif -// +// //========================================================== // app_usbd_cdc_acm - USB CDC ACM class @@ -8312,22 +7984,21 @@ //========================================================== // APP_USBD_CDC_ACM_ENABLED - Enabling USBD CDC ACM Class library - #ifndef APP_USBD_CDC_ACM_ENABLED -#define APP_USBD_CDC_ACM_ENABLED 0 + #define APP_USBD_CDC_ACM_ENABLED 0 #endif // APP_USBD_CDC_ACM_ZLP_ON_EPSIZE_WRITE - Send ZLP on write with same size as endpoint - // If enabled, CDC ACM class will automatically send a zero length packet after transfer which has the same size as endpoint. -// This may limit throughput if a lot of binary data is sent, but in terminal mode operation it makes sure that the data is always displayed right after it is sent. +// This may limit throughput if a lot of binary data is sent, but in terminal mode operation it makes sure that the data is always +// displayed right after it is sent. #ifndef APP_USBD_CDC_ACM_ZLP_ON_EPSIZE_WRITE -#define APP_USBD_CDC_ACM_ZLP_ON_EPSIZE_WRITE 1 + #define APP_USBD_CDC_ACM_ZLP_ON_EPSIZE_WRITE 1 #endif -// +// //========================================================== // nrf_cli - Command line interface @@ -8335,100 +8006,91 @@ //========================================================== // NRF_CLI_ENABLED - Enable/disable the CLI module. - #ifndef NRF_CLI_ENABLED -#define NRF_CLI_ENABLED 0 + #define NRF_CLI_ENABLED 0 #endif -// NRF_CLI_ARGC_MAX - Maximum number of parameters passed to the command handler. +// NRF_CLI_ARGC_MAX - Maximum number of parameters passed to the command handler. #ifndef NRF_CLI_ARGC_MAX -#define NRF_CLI_ARGC_MAX 12 + #define NRF_CLI_ARGC_MAX 12 #endif // NRF_CLI_BUILD_IN_CMDS_ENABLED - CLI built-in commands. - #ifndef NRF_CLI_BUILD_IN_CMDS_ENABLED -#define NRF_CLI_BUILD_IN_CMDS_ENABLED 1 + #define NRF_CLI_BUILD_IN_CMDS_ENABLED 1 #endif -// NRF_CLI_CMD_BUFF_SIZE - Maximum buffer size for a single command. +// NRF_CLI_CMD_BUFF_SIZE - Maximum buffer size for a single command. #ifndef NRF_CLI_CMD_BUFF_SIZE -#define NRF_CLI_CMD_BUFF_SIZE 128 + #define NRF_CLI_CMD_BUFF_SIZE 128 #endif // NRF_CLI_ECHO_STATUS - CLI echo status. If set, echo is ON. - #ifndef NRF_CLI_ECHO_STATUS -#define NRF_CLI_ECHO_STATUS 1 + #define NRF_CLI_ECHO_STATUS 1 #endif // NRF_CLI_WILDCARD_ENABLED - Enable wildcard functionality for CLI commands. - #ifndef NRF_CLI_WILDCARD_ENABLED -#define NRF_CLI_WILDCARD_ENABLED 0 + #define NRF_CLI_WILDCARD_ENABLED 0 #endif // NRF_CLI_METAKEYS_ENABLED - Enable additional control keys for CLI commands like ctrl+a, ctrl+e, ctrl+w, ctrl+u - #ifndef NRF_CLI_METAKEYS_ENABLED -#define NRF_CLI_METAKEYS_ENABLED 0 + #define NRF_CLI_METAKEYS_ENABLED 0 #endif -// NRF_CLI_PRINTF_BUFF_SIZE - Maximum print buffer size. +// NRF_CLI_PRINTF_BUFF_SIZE - Maximum print buffer size. #ifndef NRF_CLI_PRINTF_BUFF_SIZE -#define NRF_CLI_PRINTF_BUFF_SIZE 23 + #define NRF_CLI_PRINTF_BUFF_SIZE 23 #endif // NRF_CLI_HISTORY_ENABLED - Enable CLI history mode. //========================================================== #ifndef NRF_CLI_HISTORY_ENABLED -#define NRF_CLI_HISTORY_ENABLED 1 + #define NRF_CLI_HISTORY_ENABLED 1 #endif -// NRF_CLI_HISTORY_ELEMENT_SIZE - Size of one memory object reserved for CLI history. +// NRF_CLI_HISTORY_ELEMENT_SIZE - Size of one memory object reserved for CLI history. #ifndef NRF_CLI_HISTORY_ELEMENT_SIZE -#define NRF_CLI_HISTORY_ELEMENT_SIZE 32 + #define NRF_CLI_HISTORY_ELEMENT_SIZE 32 #endif -// NRF_CLI_HISTORY_ELEMENT_COUNT - Number of history memory objects. +// NRF_CLI_HISTORY_ELEMENT_COUNT - Number of history memory objects. #ifndef NRF_CLI_HISTORY_ELEMENT_COUNT -#define NRF_CLI_HISTORY_ELEMENT_COUNT 8 + #define NRF_CLI_HISTORY_ELEMENT_COUNT 8 #endif // // NRF_CLI_VT100_COLORS_ENABLED - CLI VT100 colors. - #ifndef NRF_CLI_VT100_COLORS_ENABLED -#define NRF_CLI_VT100_COLORS_ENABLED 1 + #define NRF_CLI_VT100_COLORS_ENABLED 1 #endif // NRF_CLI_STATISTICS_ENABLED - Enable CLI statistics. - #ifndef NRF_CLI_STATISTICS_ENABLED -#define NRF_CLI_STATISTICS_ENABLED 1 + #define NRF_CLI_STATISTICS_ENABLED 1 #endif // NRF_CLI_LOG_BACKEND - Enable logger backend interface. - #ifndef NRF_CLI_LOG_BACKEND -#define NRF_CLI_LOG_BACKEND 1 + #define NRF_CLI_LOG_BACKEND 1 #endif // NRF_CLI_USES_TASK_MANAGER_ENABLED - Enable CLI to use task_manager - #ifndef NRF_CLI_USES_TASK_MANAGER_ENABLED -#define NRF_CLI_USES_TASK_MANAGER_ENABLED 0 + #define NRF_CLI_USES_TASK_MANAGER_ENABLED 0 #endif -// +// //========================================================== // nrf_fprintf - fprintf function. @@ -8436,208 +8098,201 @@ //========================================================== // NRF_FPRINTF_ENABLED - Enable/disable fprintf module. - #ifndef NRF_FPRINTF_ENABLED -#define NRF_FPRINTF_ENABLED 1 + #define NRF_FPRINTF_ENABLED 1 #endif // NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED - For each printed LF, function will add CR. - #ifndef NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED -#define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 1 + #define NRF_FPRINTF_FLAG_AUTOMATIC_CR_ON_LF_ENABLED 1 #endif -// +// //========================================================== -// +// //========================================================== -// nRF_Log +// nRF_Log //========================================================== // NRF_LOG_ENABLED - nrf_log - Logger //========================================================== #ifndef NRF_LOG_ENABLED -#define NRF_LOG_ENABLED 0 + #define NRF_LOG_ENABLED 0 #endif #ifndef NRF_LOG_BACKEND_RTT_ENABLED -#define NRF_LOG_BACKEND_RTT_ENABLED 0 + #define NRF_LOG_BACKEND_RTT_ENABLED 0 #endif #ifndef NRF_LOG_BACKEND_SERIAL_USES_RTT -#define NRF_LOG_BACKEND_SERIAL_USES_RTT 0 + #define NRF_LOG_BACKEND_SERIAL_USES_RTT 0 #endif // Log message pool - Configuration of log message pool //========================================================== -// NRF_LOG_MSGPOOL_ELEMENT_SIZE - Size of a single element in the pool of memory objects. +// NRF_LOG_MSGPOOL_ELEMENT_SIZE - Size of a single element in the pool of memory objects. // If a small value is set, then performance of logs processing // is degraded because data is fragmented. Bigger value impacts // RAM memory utilization. The size is set to fit a message with // a timestamp and up to 2 arguments in a single memory object. #ifndef NRF_LOG_MSGPOOL_ELEMENT_SIZE -#define NRF_LOG_MSGPOOL_ELEMENT_SIZE 20 + #define NRF_LOG_MSGPOOL_ELEMENT_SIZE 20 #endif -// NRF_LOG_MSGPOOL_ELEMENT_COUNT - Number of elements in the pool of memory objects +// NRF_LOG_MSGPOOL_ELEMENT_COUNT - Number of elements in the pool of memory objects // If a small value is set, then it may lead to a deadlock // in certain cases if backend has high latency and holds // multiple messages for long time. Bigger value impacts // RAM memory usage. #ifndef NRF_LOG_MSGPOOL_ELEMENT_COUNT -#define NRF_LOG_MSGPOOL_ELEMENT_COUNT 8 + #define NRF_LOG_MSGPOOL_ELEMENT_COUNT 8 #endif -// +// //========================================================== // NRF_LOG_ALLOW_OVERFLOW - Configures behavior when circular buffer is full. - -// If set then oldest logs are overwritten. Otherwise a +// If set then oldest logs are overwritten. Otherwise a // marker is injected informing about overflow. #ifndef NRF_LOG_ALLOW_OVERFLOW -#define NRF_LOG_ALLOW_OVERFLOW 1 + #define NRF_LOG_ALLOW_OVERFLOW 1 #endif // NRF_LOG_BUFSIZE - Size of the buffer for storing logs (in bytes). - // Must be power of 2 and multiple of 4. // If NRF_LOG_DEFERRED = 0 then buffer size can be reduced to minimum. -// <128=> 128 -// <256=> 256 -// <512=> 512 -// <1024=> 1024 -// <2048=> 2048 -// <4096=> 4096 -// <8192=> 8192 -// <16384=> 16384 +// <128=> 128 +// <256=> 256 +// <512=> 512 +// <1024=> 1024 +// <2048=> 2048 +// <4096=> 4096 +// <8192=> 8192 +// <16384=> 16384 #ifndef NRF_LOG_BUFSIZE -#define NRF_LOG_BUFSIZE 1024 + #define NRF_LOG_BUFSIZE 1024 #endif // NRF_LOG_CLI_CMDS - Enable CLI commands for the module. - #ifndef NRF_LOG_CLI_CMDS -#define NRF_LOG_CLI_CMDS 0 + #define NRF_LOG_CLI_CMDS 0 #endif // NRF_LOG_DEFAULT_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_LOG_DEFAULT_LEVEL -#define NRF_LOG_DEFAULT_LEVEL 3 + #define NRF_LOG_DEFAULT_LEVEL 3 #endif // NRF_LOG_DEFERRED - Enable deffered logger. - // Log data is buffered and can be processed in idle. #ifndef NRF_LOG_DEFERRED -#define NRF_LOG_DEFERRED 1 + #define NRF_LOG_DEFERRED 1 #endif // NRF_LOG_FILTERS_ENABLED - Enable dynamic filtering of logs. - #ifndef NRF_LOG_FILTERS_ENABLED -#define NRF_LOG_FILTERS_ENABLED 0 + #define NRF_LOG_FILTERS_ENABLED 0 #endif // NRF_LOG_STR_PUSH_BUFFER_SIZE - Size of the buffer dedicated for strings stored using @ref NRF_LOG_PUSH. -// <16=> 16 -// <32=> 32 -// <64=> 64 -// <128=> 128 -// <256=> 256 -// <512=> 512 -// <1024=> 1024 +// <16=> 16 +// <32=> 32 +// <64=> 64 +// <128=> 128 +// <256=> 256 +// <512=> 512 +// <1024=> 1024 #ifndef NRF_LOG_STR_PUSH_BUFFER_SIZE -#define NRF_LOG_STR_PUSH_BUFFER_SIZE 128 + #define NRF_LOG_STR_PUSH_BUFFER_SIZE 128 #endif // NRF_LOG_STR_PUSH_BUFFER_SIZE - Size of the buffer dedicated for strings stored using @ref NRF_LOG_PUSH. -// <16=> 16 -// <32=> 32 -// <64=> 64 -// <128=> 128 -// <256=> 256 -// <512=> 512 -// <1024=> 1024 +// <16=> 16 +// <32=> 32 +// <64=> 64 +// <128=> 128 +// <256=> 256 +// <512=> 512 +// <1024=> 1024 #ifndef NRF_LOG_STR_PUSH_BUFFER_SIZE -#define NRF_LOG_STR_PUSH_BUFFER_SIZE 128 + #define NRF_LOG_STR_PUSH_BUFFER_SIZE 128 #endif // NRF_LOG_USES_COLORS - If enabled then ANSI escape code for colors is prefixed to every string //========================================================== #ifndef NRF_LOG_USES_COLORS -#define NRF_LOG_USES_COLORS 0 + #define NRF_LOG_USES_COLORS 0 #endif // NRF_LOG_COLOR_DEFAULT - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_LOG_COLOR_DEFAULT -#define NRF_LOG_COLOR_DEFAULT 0 + #define NRF_LOG_COLOR_DEFAULT 0 #endif // NRF_LOG_ERROR_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_LOG_ERROR_COLOR -#define NRF_LOG_ERROR_COLOR 2 + #define NRF_LOG_ERROR_COLOR 2 #endif // NRF_LOG_WARNING_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_LOG_WARNING_COLOR -#define NRF_LOG_WARNING_COLOR 4 + #define NRF_LOG_WARNING_COLOR 4 #endif // @@ -8647,68 +8302,68 @@ // Function for getting the timestamp is provided by the user //========================================================== #ifndef NRF_LOG_USES_TIMESTAMP -#define NRF_LOG_USES_TIMESTAMP 0 + #define NRF_LOG_USES_TIMESTAMP 0 #endif -// NRF_LOG_TIMESTAMP_DEFAULT_FREQUENCY - Default frequency of the timestamp (in Hz) or 0 to use app_timer frequency. +// NRF_LOG_TIMESTAMP_DEFAULT_FREQUENCY - Default frequency of the timestamp (in Hz) or 0 to use app_timer frequency. #ifndef NRF_LOG_TIMESTAMP_DEFAULT_FREQUENCY -#define NRF_LOG_TIMESTAMP_DEFAULT_FREQUENCY 0 + #define NRF_LOG_TIMESTAMP_DEFAULT_FREQUENCY 0 #endif // -// nrf_log module configuration +// nrf_log module configuration //========================================================== -// nrf_log in nRF_Core +// nrf_log in nRF_Core //========================================================== // NRF_MPU_LIB_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_MPU_LIB_CONFIG_LOG_ENABLED -#define NRF_MPU_LIB_CONFIG_LOG_ENABLED 0 + #define NRF_MPU_LIB_CONFIG_LOG_ENABLED 0 #endif // NRF_MPU_LIB_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_MPU_LIB_CONFIG_LOG_LEVEL -#define NRF_MPU_LIB_CONFIG_LOG_LEVEL 3 + #define NRF_MPU_LIB_CONFIG_LOG_LEVEL 3 #endif // NRF_MPU_LIB_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_MPU_LIB_CONFIG_INFO_COLOR -#define NRF_MPU_LIB_CONFIG_INFO_COLOR 0 + #define NRF_MPU_LIB_CONFIG_INFO_COLOR 0 #endif // NRF_MPU_LIB_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_MPU_LIB_CONFIG_DEBUG_COLOR -#define NRF_MPU_LIB_CONFIG_DEBUG_COLOR 0 + #define NRF_MPU_LIB_CONFIG_DEBUG_COLOR 0 #endif // @@ -8716,50 +8371,50 @@ // NRF_STACK_GUARD_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_STACK_GUARD_CONFIG_LOG_ENABLED -#define NRF_STACK_GUARD_CONFIG_LOG_ENABLED 0 + #define NRF_STACK_GUARD_CONFIG_LOG_ENABLED 0 #endif // NRF_STACK_GUARD_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_STACK_GUARD_CONFIG_LOG_LEVEL -#define NRF_STACK_GUARD_CONFIG_LOG_LEVEL 3 + #define NRF_STACK_GUARD_CONFIG_LOG_LEVEL 3 #endif // NRF_STACK_GUARD_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_STACK_GUARD_CONFIG_INFO_COLOR -#define NRF_STACK_GUARD_CONFIG_INFO_COLOR 0 + #define NRF_STACK_GUARD_CONFIG_INFO_COLOR 0 #endif // NRF_STACK_GUARD_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_STACK_GUARD_CONFIG_DEBUG_COLOR -#define NRF_STACK_GUARD_CONFIG_DEBUG_COLOR 0 + #define NRF_STACK_GUARD_CONFIG_DEBUG_COLOR 0 #endif // @@ -8767,107 +8422,107 @@ // TASK_MANAGER_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef TASK_MANAGER_CONFIG_LOG_ENABLED -#define TASK_MANAGER_CONFIG_LOG_ENABLED 0 + #define TASK_MANAGER_CONFIG_LOG_ENABLED 0 #endif // TASK_MANAGER_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef TASK_MANAGER_CONFIG_LOG_LEVEL -#define TASK_MANAGER_CONFIG_LOG_LEVEL 3 + #define TASK_MANAGER_CONFIG_LOG_LEVEL 3 #endif // TASK_MANAGER_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef TASK_MANAGER_CONFIG_INFO_COLOR -#define TASK_MANAGER_CONFIG_INFO_COLOR 0 + #define TASK_MANAGER_CONFIG_INFO_COLOR 0 #endif // TASK_MANAGER_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef TASK_MANAGER_CONFIG_DEBUG_COLOR -#define TASK_MANAGER_CONFIG_DEBUG_COLOR 0 + #define TASK_MANAGER_CONFIG_DEBUG_COLOR 0 #endif // -// +// //========================================================== -// nrf_log in nRF_Drivers +// nrf_log in nRF_Drivers //========================================================== // CLOCK_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef CLOCK_CONFIG_LOG_ENABLED -#define CLOCK_CONFIG_LOG_ENABLED 0 + #define CLOCK_CONFIG_LOG_ENABLED 0 #endif // CLOCK_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef CLOCK_CONFIG_LOG_LEVEL -#define CLOCK_CONFIG_LOG_LEVEL 3 + #define CLOCK_CONFIG_LOG_LEVEL 3 #endif // CLOCK_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef CLOCK_CONFIG_INFO_COLOR -#define CLOCK_CONFIG_INFO_COLOR 0 + #define CLOCK_CONFIG_INFO_COLOR 0 #endif // CLOCK_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef CLOCK_CONFIG_DEBUG_COLOR -#define CLOCK_CONFIG_DEBUG_COLOR 0 + #define CLOCK_CONFIG_DEBUG_COLOR 0 #endif // @@ -8875,50 +8530,50 @@ // COMP_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef COMP_CONFIG_LOG_ENABLED -#define COMP_CONFIG_LOG_ENABLED 0 + #define COMP_CONFIG_LOG_ENABLED 0 #endif // COMP_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef COMP_CONFIG_LOG_LEVEL -#define COMP_CONFIG_LOG_LEVEL 3 + #define COMP_CONFIG_LOG_LEVEL 3 #endif // COMP_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef COMP_CONFIG_INFO_COLOR -#define COMP_CONFIG_INFO_COLOR 0 + #define COMP_CONFIG_INFO_COLOR 0 #endif // COMP_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef COMP_CONFIG_DEBUG_COLOR -#define COMP_CONFIG_DEBUG_COLOR 0 + #define COMP_CONFIG_DEBUG_COLOR 0 #endif // @@ -8926,50 +8581,50 @@ // GPIOTE_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef GPIOTE_CONFIG_LOG_ENABLED -#define GPIOTE_CONFIG_LOG_ENABLED 0 + #define GPIOTE_CONFIG_LOG_ENABLED 0 #endif // GPIOTE_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef GPIOTE_CONFIG_LOG_LEVEL -#define GPIOTE_CONFIG_LOG_LEVEL 3 + #define GPIOTE_CONFIG_LOG_LEVEL 3 #endif // GPIOTE_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef GPIOTE_CONFIG_INFO_COLOR -#define GPIOTE_CONFIG_INFO_COLOR 0 + #define GPIOTE_CONFIG_INFO_COLOR 0 #endif // GPIOTE_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef GPIOTE_CONFIG_DEBUG_COLOR -#define GPIOTE_CONFIG_DEBUG_COLOR 0 + #define GPIOTE_CONFIG_DEBUG_COLOR 0 #endif // @@ -8977,50 +8632,50 @@ // LPCOMP_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef LPCOMP_CONFIG_LOG_ENABLED -#define LPCOMP_CONFIG_LOG_ENABLED 0 + #define LPCOMP_CONFIG_LOG_ENABLED 0 #endif // LPCOMP_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef LPCOMP_CONFIG_LOG_LEVEL -#define LPCOMP_CONFIG_LOG_LEVEL 3 + #define LPCOMP_CONFIG_LOG_LEVEL 3 #endif // LPCOMP_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef LPCOMP_CONFIG_INFO_COLOR -#define LPCOMP_CONFIG_INFO_COLOR 0 + #define LPCOMP_CONFIG_INFO_COLOR 0 #endif // LPCOMP_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef LPCOMP_CONFIG_DEBUG_COLOR -#define LPCOMP_CONFIG_DEBUG_COLOR 0 + #define LPCOMP_CONFIG_DEBUG_COLOR 0 #endif // @@ -9028,50 +8683,50 @@ // MAX3421E_HOST_CONFIG_LOG_ENABLED - Enable logging in the module //========================================================== #ifndef MAX3421E_HOST_CONFIG_LOG_ENABLED -#define MAX3421E_HOST_CONFIG_LOG_ENABLED 0 + #define MAX3421E_HOST_CONFIG_LOG_ENABLED 0 #endif // MAX3421E_HOST_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef MAX3421E_HOST_CONFIG_LOG_LEVEL -#define MAX3421E_HOST_CONFIG_LOG_LEVEL 3 + #define MAX3421E_HOST_CONFIG_LOG_LEVEL 3 #endif // MAX3421E_HOST_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef MAX3421E_HOST_CONFIG_INFO_COLOR -#define MAX3421E_HOST_CONFIG_INFO_COLOR 0 + #define MAX3421E_HOST_CONFIG_INFO_COLOR 0 #endif // MAX3421E_HOST_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef MAX3421E_HOST_CONFIG_DEBUG_COLOR -#define MAX3421E_HOST_CONFIG_DEBUG_COLOR 0 + #define MAX3421E_HOST_CONFIG_DEBUG_COLOR 0 #endif // @@ -9079,50 +8734,50 @@ // NRFX_USBD_CONFIG_LOG_ENABLED - Enable logging in the module //========================================================== #ifndef NRFX_USBD_CONFIG_LOG_ENABLED -#define NRFX_USBD_CONFIG_LOG_ENABLED 0 + #define NRFX_USBD_CONFIG_LOG_ENABLED 0 #endif // NRFX_USBD_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRFX_USBD_CONFIG_LOG_LEVEL -#define NRFX_USBD_CONFIG_LOG_LEVEL 3 + #define NRFX_USBD_CONFIG_LOG_LEVEL 3 #endif // NRFX_USBD_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_USBD_CONFIG_INFO_COLOR -#define NRFX_USBD_CONFIG_INFO_COLOR 0 + #define NRFX_USBD_CONFIG_INFO_COLOR 0 #endif // NRFX_USBD_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRFX_USBD_CONFIG_DEBUG_COLOR -#define NRFX_USBD_CONFIG_DEBUG_COLOR 0 + #define NRFX_USBD_CONFIG_DEBUG_COLOR 0 #endif // @@ -9130,50 +8785,50 @@ // PDM_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef PDM_CONFIG_LOG_ENABLED -#define PDM_CONFIG_LOG_ENABLED 0 + #define PDM_CONFIG_LOG_ENABLED 0 #endif // PDM_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef PDM_CONFIG_LOG_LEVEL -#define PDM_CONFIG_LOG_LEVEL 3 + #define PDM_CONFIG_LOG_LEVEL 3 #endif // PDM_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef PDM_CONFIG_INFO_COLOR -#define PDM_CONFIG_INFO_COLOR 0 + #define PDM_CONFIG_INFO_COLOR 0 #endif // PDM_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef PDM_CONFIG_DEBUG_COLOR -#define PDM_CONFIG_DEBUG_COLOR 0 + #define PDM_CONFIG_DEBUG_COLOR 0 #endif // @@ -9181,50 +8836,50 @@ // PPI_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef PPI_CONFIG_LOG_ENABLED -#define PPI_CONFIG_LOG_ENABLED 0 + #define PPI_CONFIG_LOG_ENABLED 0 #endif // PPI_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef PPI_CONFIG_LOG_LEVEL -#define PPI_CONFIG_LOG_LEVEL 3 + #define PPI_CONFIG_LOG_LEVEL 3 #endif // PPI_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef PPI_CONFIG_INFO_COLOR -#define PPI_CONFIG_INFO_COLOR 0 + #define PPI_CONFIG_INFO_COLOR 0 #endif // PPI_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef PPI_CONFIG_DEBUG_COLOR -#define PPI_CONFIG_DEBUG_COLOR 0 + #define PPI_CONFIG_DEBUG_COLOR 0 #endif // @@ -9232,50 +8887,50 @@ // PWM_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef PWM_CONFIG_LOG_ENABLED -#define PWM_CONFIG_LOG_ENABLED 0 + #define PWM_CONFIG_LOG_ENABLED 0 #endif // PWM_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef PWM_CONFIG_LOG_LEVEL -#define PWM_CONFIG_LOG_LEVEL 3 + #define PWM_CONFIG_LOG_LEVEL 3 #endif // PWM_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef PWM_CONFIG_INFO_COLOR -#define PWM_CONFIG_INFO_COLOR 0 + #define PWM_CONFIG_INFO_COLOR 0 #endif // PWM_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef PWM_CONFIG_DEBUG_COLOR -#define PWM_CONFIG_DEBUG_COLOR 0 + #define PWM_CONFIG_DEBUG_COLOR 0 #endif // @@ -9283,50 +8938,50 @@ // QDEC_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef QDEC_CONFIG_LOG_ENABLED -#define QDEC_CONFIG_LOG_ENABLED 0 + #define QDEC_CONFIG_LOG_ENABLED 0 #endif // QDEC_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef QDEC_CONFIG_LOG_LEVEL -#define QDEC_CONFIG_LOG_LEVEL 3 + #define QDEC_CONFIG_LOG_LEVEL 3 #endif // QDEC_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef QDEC_CONFIG_INFO_COLOR -#define QDEC_CONFIG_INFO_COLOR 0 + #define QDEC_CONFIG_INFO_COLOR 0 #endif // QDEC_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef QDEC_CONFIG_DEBUG_COLOR -#define QDEC_CONFIG_DEBUG_COLOR 0 + #define QDEC_CONFIG_DEBUG_COLOR 0 #endif // @@ -9334,57 +8989,56 @@ // RNG_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef RNG_CONFIG_LOG_ENABLED -#define RNG_CONFIG_LOG_ENABLED 0 + #define RNG_CONFIG_LOG_ENABLED 0 #endif // RNG_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef RNG_CONFIG_LOG_LEVEL -#define RNG_CONFIG_LOG_LEVEL 3 + #define RNG_CONFIG_LOG_LEVEL 3 #endif // RNG_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef RNG_CONFIG_INFO_COLOR -#define RNG_CONFIG_INFO_COLOR 0 + #define RNG_CONFIG_INFO_COLOR 0 #endif // RNG_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef RNG_CONFIG_DEBUG_COLOR -#define RNG_CONFIG_DEBUG_COLOR 0 + #define RNG_CONFIG_DEBUG_COLOR 0 #endif // RNG_CONFIG_RANDOM_NUMBER_LOG_ENABLED - Enables logging of random numbers. - #ifndef RNG_CONFIG_RANDOM_NUMBER_LOG_ENABLED -#define RNG_CONFIG_RANDOM_NUMBER_LOG_ENABLED 0 + #define RNG_CONFIG_RANDOM_NUMBER_LOG_ENABLED 0 #endif // @@ -9392,50 +9046,50 @@ // RTC_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef RTC_CONFIG_LOG_ENABLED -#define RTC_CONFIG_LOG_ENABLED 0 + #define RTC_CONFIG_LOG_ENABLED 0 #endif // RTC_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef RTC_CONFIG_LOG_LEVEL -#define RTC_CONFIG_LOG_LEVEL 3 + #define RTC_CONFIG_LOG_LEVEL 3 #endif // RTC_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef RTC_CONFIG_INFO_COLOR -#define RTC_CONFIG_INFO_COLOR 0 + #define RTC_CONFIG_INFO_COLOR 0 #endif // RTC_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef RTC_CONFIG_DEBUG_COLOR -#define RTC_CONFIG_DEBUG_COLOR 0 + #define RTC_CONFIG_DEBUG_COLOR 0 #endif // @@ -9443,50 +9097,50 @@ // SAADC_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef SAADC_CONFIG_LOG_ENABLED -#define SAADC_CONFIG_LOG_ENABLED 0 + #define SAADC_CONFIG_LOG_ENABLED 0 #endif // SAADC_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef SAADC_CONFIG_LOG_LEVEL -#define SAADC_CONFIG_LOG_LEVEL 3 + #define SAADC_CONFIG_LOG_LEVEL 3 #endif // SAADC_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef SAADC_CONFIG_INFO_COLOR -#define SAADC_CONFIG_INFO_COLOR 0 + #define SAADC_CONFIG_INFO_COLOR 0 #endif // SAADC_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef SAADC_CONFIG_DEBUG_COLOR -#define SAADC_CONFIG_DEBUG_COLOR 0 + #define SAADC_CONFIG_DEBUG_COLOR 0 #endif // @@ -9494,50 +9148,50 @@ // SPIS_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef SPIS_CONFIG_LOG_ENABLED -#define SPIS_CONFIG_LOG_ENABLED 0 + #define SPIS_CONFIG_LOG_ENABLED 0 #endif // SPIS_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef SPIS_CONFIG_LOG_LEVEL -#define SPIS_CONFIG_LOG_LEVEL 3 + #define SPIS_CONFIG_LOG_LEVEL 3 #endif // SPIS_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef SPIS_CONFIG_INFO_COLOR -#define SPIS_CONFIG_INFO_COLOR 0 + #define SPIS_CONFIG_INFO_COLOR 0 #endif // SPIS_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef SPIS_CONFIG_DEBUG_COLOR -#define SPIS_CONFIG_DEBUG_COLOR 0 + #define SPIS_CONFIG_DEBUG_COLOR 0 #endif // @@ -9545,50 +9199,50 @@ // SPI_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef SPI_CONFIG_LOG_ENABLED -#define SPI_CONFIG_LOG_ENABLED 0 + #define SPI_CONFIG_LOG_ENABLED 0 #endif // SPI_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef SPI_CONFIG_LOG_LEVEL -#define SPI_CONFIG_LOG_LEVEL 3 + #define SPI_CONFIG_LOG_LEVEL 3 #endif // SPI_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef SPI_CONFIG_INFO_COLOR -#define SPI_CONFIG_INFO_COLOR 0 + #define SPI_CONFIG_INFO_COLOR 0 #endif // SPI_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef SPI_CONFIG_DEBUG_COLOR -#define SPI_CONFIG_DEBUG_COLOR 0 + #define SPI_CONFIG_DEBUG_COLOR 0 #endif // @@ -9596,50 +9250,50 @@ // TIMER_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef TIMER_CONFIG_LOG_ENABLED -#define TIMER_CONFIG_LOG_ENABLED 0 + #define TIMER_CONFIG_LOG_ENABLED 0 #endif // TIMER_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef TIMER_CONFIG_LOG_LEVEL -#define TIMER_CONFIG_LOG_LEVEL 3 + #define TIMER_CONFIG_LOG_LEVEL 3 #endif // TIMER_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef TIMER_CONFIG_INFO_COLOR -#define TIMER_CONFIG_INFO_COLOR 0 + #define TIMER_CONFIG_INFO_COLOR 0 #endif // TIMER_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef TIMER_CONFIG_DEBUG_COLOR -#define TIMER_CONFIG_DEBUG_COLOR 0 + #define TIMER_CONFIG_DEBUG_COLOR 0 #endif // @@ -9647,50 +9301,50 @@ // TWIS_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef TWIS_CONFIG_LOG_ENABLED -#define TWIS_CONFIG_LOG_ENABLED 0 + #define TWIS_CONFIG_LOG_ENABLED 0 #endif // TWIS_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef TWIS_CONFIG_LOG_LEVEL -#define TWIS_CONFIG_LOG_LEVEL 3 + #define TWIS_CONFIG_LOG_LEVEL 3 #endif // TWIS_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef TWIS_CONFIG_INFO_COLOR -#define TWIS_CONFIG_INFO_COLOR 0 + #define TWIS_CONFIG_INFO_COLOR 0 #endif // TWIS_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef TWIS_CONFIG_DEBUG_COLOR -#define TWIS_CONFIG_DEBUG_COLOR 0 + #define TWIS_CONFIG_DEBUG_COLOR 0 #endif // @@ -9698,50 +9352,50 @@ // TWI_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef TWI_CONFIG_LOG_ENABLED -#define TWI_CONFIG_LOG_ENABLED 0 + #define TWI_CONFIG_LOG_ENABLED 0 #endif // TWI_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef TWI_CONFIG_LOG_LEVEL -#define TWI_CONFIG_LOG_LEVEL 3 + #define TWI_CONFIG_LOG_LEVEL 3 #endif // TWI_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef TWI_CONFIG_INFO_COLOR -#define TWI_CONFIG_INFO_COLOR 0 + #define TWI_CONFIG_INFO_COLOR 0 #endif // TWI_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef TWI_CONFIG_DEBUG_COLOR -#define TWI_CONFIG_DEBUG_COLOR 0 + #define TWI_CONFIG_DEBUG_COLOR 0 #endif // @@ -9749,50 +9403,50 @@ // UART_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef UART_CONFIG_LOG_ENABLED -#define UART_CONFIG_LOG_ENABLED 0 + #define UART_CONFIG_LOG_ENABLED 0 #endif // UART_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef UART_CONFIG_LOG_LEVEL -#define UART_CONFIG_LOG_LEVEL 3 + #define UART_CONFIG_LOG_LEVEL 3 #endif // UART_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef UART_CONFIG_INFO_COLOR -#define UART_CONFIG_INFO_COLOR 0 + #define UART_CONFIG_INFO_COLOR 0 #endif // UART_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef UART_CONFIG_DEBUG_COLOR -#define UART_CONFIG_DEBUG_COLOR 0 + #define UART_CONFIG_DEBUG_COLOR 0 #endif // @@ -9800,50 +9454,50 @@ // USBD_CONFIG_LOG_ENABLED - Enable logging in the module //========================================================== #ifndef USBD_CONFIG_LOG_ENABLED -#define USBD_CONFIG_LOG_ENABLED 0 + #define USBD_CONFIG_LOG_ENABLED 0 #endif // USBD_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef USBD_CONFIG_LOG_LEVEL -#define USBD_CONFIG_LOG_LEVEL 3 + #define USBD_CONFIG_LOG_LEVEL 3 #endif // USBD_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef USBD_CONFIG_INFO_COLOR -#define USBD_CONFIG_INFO_COLOR 0 + #define USBD_CONFIG_INFO_COLOR 0 #endif // USBD_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef USBD_CONFIG_DEBUG_COLOR -#define USBD_CONFIG_DEBUG_COLOR 0 + #define USBD_CONFIG_DEBUG_COLOR 0 #endif // @@ -9851,123 +9505,122 @@ // WDT_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef WDT_CONFIG_LOG_ENABLED -#define WDT_CONFIG_LOG_ENABLED 0 + #define WDT_CONFIG_LOG_ENABLED 0 #endif // WDT_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef WDT_CONFIG_LOG_LEVEL -#define WDT_CONFIG_LOG_LEVEL 3 + #define WDT_CONFIG_LOG_LEVEL 3 #endif // WDT_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef WDT_CONFIG_INFO_COLOR -#define WDT_CONFIG_INFO_COLOR 0 + #define WDT_CONFIG_INFO_COLOR 0 #endif // WDT_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef WDT_CONFIG_DEBUG_COLOR -#define WDT_CONFIG_DEBUG_COLOR 0 + #define WDT_CONFIG_DEBUG_COLOR 0 #endif // -// +// //========================================================== -// nrf_log in nRF_Libraries +// nrf_log in nRF_Libraries //========================================================== // APP_TIMER_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef APP_TIMER_CONFIG_LOG_ENABLED -#define APP_TIMER_CONFIG_LOG_ENABLED 0 + #define APP_TIMER_CONFIG_LOG_ENABLED 0 #endif // APP_TIMER_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef APP_TIMER_CONFIG_LOG_LEVEL -#define APP_TIMER_CONFIG_LOG_LEVEL 3 + #define APP_TIMER_CONFIG_LOG_LEVEL 3 #endif // APP_TIMER_CONFIG_INITIAL_LOG_LEVEL - Initial severity level if dynamic filtering is enabled. - // If module generates a lot of logs, initial log level can // be decreased to prevent flooding. Severity level can be // increased on instance basis. -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef APP_TIMER_CONFIG_INITIAL_LOG_LEVEL -#define APP_TIMER_CONFIG_INITIAL_LOG_LEVEL 3 + #define APP_TIMER_CONFIG_INITIAL_LOG_LEVEL 3 #endif // APP_TIMER_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef APP_TIMER_CONFIG_INFO_COLOR -#define APP_TIMER_CONFIG_INFO_COLOR 0 + #define APP_TIMER_CONFIG_INFO_COLOR 0 #endif // APP_TIMER_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef APP_TIMER_CONFIG_DEBUG_COLOR -#define APP_TIMER_CONFIG_DEBUG_COLOR 0 + #define APP_TIMER_CONFIG_DEBUG_COLOR 0 #endif // @@ -9975,50 +9628,50 @@ // APP_USBD_CDC_ACM_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef APP_USBD_CDC_ACM_CONFIG_LOG_ENABLED -#define APP_USBD_CDC_ACM_CONFIG_LOG_ENABLED 0 + #define APP_USBD_CDC_ACM_CONFIG_LOG_ENABLED 0 #endif // APP_USBD_CDC_ACM_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef APP_USBD_CDC_ACM_CONFIG_LOG_LEVEL -#define APP_USBD_CDC_ACM_CONFIG_LOG_LEVEL 3 + #define APP_USBD_CDC_ACM_CONFIG_LOG_LEVEL 3 #endif // APP_USBD_CDC_ACM_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef APP_USBD_CDC_ACM_CONFIG_INFO_COLOR -#define APP_USBD_CDC_ACM_CONFIG_INFO_COLOR 0 + #define APP_USBD_CDC_ACM_CONFIG_INFO_COLOR 0 #endif // APP_USBD_CDC_ACM_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef APP_USBD_CDC_ACM_CONFIG_DEBUG_COLOR -#define APP_USBD_CDC_ACM_CONFIG_DEBUG_COLOR 0 + #define APP_USBD_CDC_ACM_CONFIG_DEBUG_COLOR 0 #endif // @@ -10026,50 +9679,50 @@ // APP_USBD_CONFIG_LOG_ENABLED - Enable logging in the module. //========================================================== #ifndef APP_USBD_CONFIG_LOG_ENABLED -#define APP_USBD_CONFIG_LOG_ENABLED 0 + #define APP_USBD_CONFIG_LOG_ENABLED 0 #endif // APP_USBD_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef APP_USBD_CONFIG_LOG_LEVEL -#define APP_USBD_CONFIG_LOG_LEVEL 3 + #define APP_USBD_CONFIG_LOG_LEVEL 3 #endif // APP_USBD_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef APP_USBD_CONFIG_INFO_COLOR -#define APP_USBD_CONFIG_INFO_COLOR 0 + #define APP_USBD_CONFIG_INFO_COLOR 0 #endif // APP_USBD_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef APP_USBD_CONFIG_DEBUG_COLOR -#define APP_USBD_CONFIG_DEBUG_COLOR 0 + #define APP_USBD_CONFIG_DEBUG_COLOR 0 #endif // @@ -10077,50 +9730,50 @@ // APP_USBD_DUMMY_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef APP_USBD_DUMMY_CONFIG_LOG_ENABLED -#define APP_USBD_DUMMY_CONFIG_LOG_ENABLED 0 + #define APP_USBD_DUMMY_CONFIG_LOG_ENABLED 0 #endif // APP_USBD_DUMMY_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef APP_USBD_DUMMY_CONFIG_LOG_LEVEL -#define APP_USBD_DUMMY_CONFIG_LOG_LEVEL 3 + #define APP_USBD_DUMMY_CONFIG_LOG_LEVEL 3 #endif // APP_USBD_DUMMY_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef APP_USBD_DUMMY_CONFIG_INFO_COLOR -#define APP_USBD_DUMMY_CONFIG_INFO_COLOR 0 + #define APP_USBD_DUMMY_CONFIG_INFO_COLOR 0 #endif // APP_USBD_DUMMY_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef APP_USBD_DUMMY_CONFIG_DEBUG_COLOR -#define APP_USBD_DUMMY_CONFIG_DEBUG_COLOR 0 + #define APP_USBD_DUMMY_CONFIG_DEBUG_COLOR 0 #endif // @@ -10128,50 +9781,50 @@ // APP_USBD_MSC_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef APP_USBD_MSC_CONFIG_LOG_ENABLED -#define APP_USBD_MSC_CONFIG_LOG_ENABLED 0 + #define APP_USBD_MSC_CONFIG_LOG_ENABLED 0 #endif // APP_USBD_MSC_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef APP_USBD_MSC_CONFIG_LOG_LEVEL -#define APP_USBD_MSC_CONFIG_LOG_LEVEL 3 + #define APP_USBD_MSC_CONFIG_LOG_LEVEL 3 #endif // APP_USBD_MSC_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef APP_USBD_MSC_CONFIG_INFO_COLOR -#define APP_USBD_MSC_CONFIG_INFO_COLOR 0 + #define APP_USBD_MSC_CONFIG_INFO_COLOR 0 #endif // APP_USBD_MSC_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef APP_USBD_MSC_CONFIG_DEBUG_COLOR -#define APP_USBD_MSC_CONFIG_DEBUG_COLOR 0 + #define APP_USBD_MSC_CONFIG_DEBUG_COLOR 0 #endif // @@ -10179,50 +9832,50 @@ // APP_USBD_NRF_DFU_TRIGGER_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef APP_USBD_NRF_DFU_TRIGGER_CONFIG_LOG_ENABLED -#define APP_USBD_NRF_DFU_TRIGGER_CONFIG_LOG_ENABLED 0 + #define APP_USBD_NRF_DFU_TRIGGER_CONFIG_LOG_ENABLED 0 #endif // APP_USBD_NRF_DFU_TRIGGER_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef APP_USBD_NRF_DFU_TRIGGER_CONFIG_LOG_LEVEL -#define APP_USBD_NRF_DFU_TRIGGER_CONFIG_LOG_LEVEL 3 + #define APP_USBD_NRF_DFU_TRIGGER_CONFIG_LOG_LEVEL 3 #endif // APP_USBD_NRF_DFU_TRIGGER_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef APP_USBD_NRF_DFU_TRIGGER_CONFIG_INFO_COLOR -#define APP_USBD_NRF_DFU_TRIGGER_CONFIG_INFO_COLOR 0 + #define APP_USBD_NRF_DFU_TRIGGER_CONFIG_INFO_COLOR 0 #endif // APP_USBD_NRF_DFU_TRIGGER_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef APP_USBD_NRF_DFU_TRIGGER_CONFIG_DEBUG_COLOR -#define APP_USBD_NRF_DFU_TRIGGER_CONFIG_DEBUG_COLOR 0 + #define APP_USBD_NRF_DFU_TRIGGER_CONFIG_DEBUG_COLOR 0 #endif // @@ -10230,62 +9883,62 @@ // NRF_ATFIFO_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_ATFIFO_CONFIG_LOG_ENABLED -#define NRF_ATFIFO_CONFIG_LOG_ENABLED 0 + #define NRF_ATFIFO_CONFIG_LOG_ENABLED 0 #endif // NRF_ATFIFO_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_ATFIFO_CONFIG_LOG_LEVEL -#define NRF_ATFIFO_CONFIG_LOG_LEVEL 3 + #define NRF_ATFIFO_CONFIG_LOG_LEVEL 3 #endif // NRF_ATFIFO_CONFIG_LOG_INIT_FILTER_LEVEL - Initial severity level if dynamic filtering is enabled -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_ATFIFO_CONFIG_LOG_INIT_FILTER_LEVEL -#define NRF_ATFIFO_CONFIG_LOG_INIT_FILTER_LEVEL 3 + #define NRF_ATFIFO_CONFIG_LOG_INIT_FILTER_LEVEL 3 #endif // NRF_ATFIFO_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_ATFIFO_CONFIG_INFO_COLOR -#define NRF_ATFIFO_CONFIG_INFO_COLOR 0 + #define NRF_ATFIFO_CONFIG_INFO_COLOR 0 #endif // NRF_ATFIFO_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_ATFIFO_CONFIG_DEBUG_COLOR -#define NRF_ATFIFO_CONFIG_DEBUG_COLOR 0 + #define NRF_ATFIFO_CONFIG_DEBUG_COLOR 0 #endif // @@ -10293,66 +9946,65 @@ // NRF_BALLOC_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_BALLOC_CONFIG_LOG_ENABLED -#define NRF_BALLOC_CONFIG_LOG_ENABLED 0 + #define NRF_BALLOC_CONFIG_LOG_ENABLED 0 #endif // NRF_BALLOC_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_BALLOC_CONFIG_LOG_LEVEL -#define NRF_BALLOC_CONFIG_LOG_LEVEL 3 + #define NRF_BALLOC_CONFIG_LOG_LEVEL 3 #endif // NRF_BALLOC_CONFIG_INITIAL_LOG_LEVEL - Initial severity level if dynamic filtering is enabled. - // If module generates a lot of logs, initial log level can // be decreased to prevent flooding. Severity level can be // increased on instance basis. -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_BALLOC_CONFIG_INITIAL_LOG_LEVEL -#define NRF_BALLOC_CONFIG_INITIAL_LOG_LEVEL 3 + #define NRF_BALLOC_CONFIG_INITIAL_LOG_LEVEL 3 #endif // NRF_BALLOC_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_BALLOC_CONFIG_INFO_COLOR -#define NRF_BALLOC_CONFIG_INFO_COLOR 0 + #define NRF_BALLOC_CONFIG_INFO_COLOR 0 #endif // NRF_BALLOC_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_BALLOC_CONFIG_DEBUG_COLOR -#define NRF_BALLOC_CONFIG_DEBUG_COLOR 0 + #define NRF_BALLOC_CONFIG_DEBUG_COLOR 0 #endif // @@ -10360,62 +10012,62 @@ // NRF_BLOCK_DEV_EMPTY_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_BLOCK_DEV_EMPTY_CONFIG_LOG_ENABLED -#define NRF_BLOCK_DEV_EMPTY_CONFIG_LOG_ENABLED 0 + #define NRF_BLOCK_DEV_EMPTY_CONFIG_LOG_ENABLED 0 #endif // NRF_BLOCK_DEV_EMPTY_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_BLOCK_DEV_EMPTY_CONFIG_LOG_LEVEL -#define NRF_BLOCK_DEV_EMPTY_CONFIG_LOG_LEVEL 3 + #define NRF_BLOCK_DEV_EMPTY_CONFIG_LOG_LEVEL 3 #endif // NRF_BLOCK_DEV_EMPTY_CONFIG_LOG_INIT_FILTER_LEVEL - Initial severity level if dynamic filtering is enabled -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_BLOCK_DEV_EMPTY_CONFIG_LOG_INIT_FILTER_LEVEL -#define NRF_BLOCK_DEV_EMPTY_CONFIG_LOG_INIT_FILTER_LEVEL 3 + #define NRF_BLOCK_DEV_EMPTY_CONFIG_LOG_INIT_FILTER_LEVEL 3 #endif // NRF_BLOCK_DEV_EMPTY_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_BLOCK_DEV_EMPTY_CONFIG_INFO_COLOR -#define NRF_BLOCK_DEV_EMPTY_CONFIG_INFO_COLOR 0 + #define NRF_BLOCK_DEV_EMPTY_CONFIG_INFO_COLOR 0 #endif // NRF_BLOCK_DEV_EMPTY_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_BLOCK_DEV_EMPTY_CONFIG_DEBUG_COLOR -#define NRF_BLOCK_DEV_EMPTY_CONFIG_DEBUG_COLOR 0 + #define NRF_BLOCK_DEV_EMPTY_CONFIG_DEBUG_COLOR 0 #endif // @@ -10423,62 +10075,62 @@ // NRF_BLOCK_DEV_QSPI_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_BLOCK_DEV_QSPI_CONFIG_LOG_ENABLED -#define NRF_BLOCK_DEV_QSPI_CONFIG_LOG_ENABLED 0 + #define NRF_BLOCK_DEV_QSPI_CONFIG_LOG_ENABLED 0 #endif // NRF_BLOCK_DEV_QSPI_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_BLOCK_DEV_QSPI_CONFIG_LOG_LEVEL -#define NRF_BLOCK_DEV_QSPI_CONFIG_LOG_LEVEL 3 + #define NRF_BLOCK_DEV_QSPI_CONFIG_LOG_LEVEL 3 #endif // NRF_BLOCK_DEV_QSPI_CONFIG_LOG_INIT_FILTER_LEVEL - Initial severity level if dynamic filtering is enabled -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_BLOCK_DEV_QSPI_CONFIG_LOG_INIT_FILTER_LEVEL -#define NRF_BLOCK_DEV_QSPI_CONFIG_LOG_INIT_FILTER_LEVEL 3 + #define NRF_BLOCK_DEV_QSPI_CONFIG_LOG_INIT_FILTER_LEVEL 3 #endif // NRF_BLOCK_DEV_QSPI_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_BLOCK_DEV_QSPI_CONFIG_INFO_COLOR -#define NRF_BLOCK_DEV_QSPI_CONFIG_INFO_COLOR 0 + #define NRF_BLOCK_DEV_QSPI_CONFIG_INFO_COLOR 0 #endif // NRF_BLOCK_DEV_QSPI_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_BLOCK_DEV_QSPI_CONFIG_DEBUG_COLOR -#define NRF_BLOCK_DEV_QSPI_CONFIG_DEBUG_COLOR 0 + #define NRF_BLOCK_DEV_QSPI_CONFIG_DEBUG_COLOR 0 #endif // @@ -10486,62 +10138,62 @@ // NRF_BLOCK_DEV_RAM_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_BLOCK_DEV_RAM_CONFIG_LOG_ENABLED -#define NRF_BLOCK_DEV_RAM_CONFIG_LOG_ENABLED 0 + #define NRF_BLOCK_DEV_RAM_CONFIG_LOG_ENABLED 0 #endif // NRF_BLOCK_DEV_RAM_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_BLOCK_DEV_RAM_CONFIG_LOG_LEVEL -#define NRF_BLOCK_DEV_RAM_CONFIG_LOG_LEVEL 3 + #define NRF_BLOCK_DEV_RAM_CONFIG_LOG_LEVEL 3 #endif // NRF_BLOCK_DEV_RAM_CONFIG_LOG_INIT_FILTER_LEVEL - Initial severity level if dynamic filtering is enabled -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_BLOCK_DEV_RAM_CONFIG_LOG_INIT_FILTER_LEVEL -#define NRF_BLOCK_DEV_RAM_CONFIG_LOG_INIT_FILTER_LEVEL 3 + #define NRF_BLOCK_DEV_RAM_CONFIG_LOG_INIT_FILTER_LEVEL 3 #endif // NRF_BLOCK_DEV_RAM_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_BLOCK_DEV_RAM_CONFIG_INFO_COLOR -#define NRF_BLOCK_DEV_RAM_CONFIG_INFO_COLOR 0 + #define NRF_BLOCK_DEV_RAM_CONFIG_INFO_COLOR 0 #endif // NRF_BLOCK_DEV_RAM_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_BLOCK_DEV_RAM_CONFIG_DEBUG_COLOR -#define NRF_BLOCK_DEV_RAM_CONFIG_DEBUG_COLOR 0 + #define NRF_BLOCK_DEV_RAM_CONFIG_DEBUG_COLOR 0 #endif // @@ -10549,50 +10201,50 @@ // NRF_CLI_BLE_UART_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_CLI_BLE_UART_CONFIG_LOG_ENABLED -#define NRF_CLI_BLE_UART_CONFIG_LOG_ENABLED 0 + #define NRF_CLI_BLE_UART_CONFIG_LOG_ENABLED 0 #endif // NRF_CLI_BLE_UART_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_CLI_BLE_UART_CONFIG_LOG_LEVEL -#define NRF_CLI_BLE_UART_CONFIG_LOG_LEVEL 3 + #define NRF_CLI_BLE_UART_CONFIG_LOG_LEVEL 3 #endif // NRF_CLI_BLE_UART_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_CLI_BLE_UART_CONFIG_INFO_COLOR -#define NRF_CLI_BLE_UART_CONFIG_INFO_COLOR 0 + #define NRF_CLI_BLE_UART_CONFIG_INFO_COLOR 0 #endif // NRF_CLI_BLE_UART_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_CLI_BLE_UART_CONFIG_DEBUG_COLOR -#define NRF_CLI_BLE_UART_CONFIG_DEBUG_COLOR 0 + #define NRF_CLI_BLE_UART_CONFIG_DEBUG_COLOR 0 #endif // @@ -10600,50 +10252,50 @@ // NRF_CLI_LIBUARTE_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_CLI_LIBUARTE_CONFIG_LOG_ENABLED -#define NRF_CLI_LIBUARTE_CONFIG_LOG_ENABLED 0 + #define NRF_CLI_LIBUARTE_CONFIG_LOG_ENABLED 0 #endif // NRF_CLI_LIBUARTE_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_CLI_LIBUARTE_CONFIG_LOG_LEVEL -#define NRF_CLI_LIBUARTE_CONFIG_LOG_LEVEL 3 + #define NRF_CLI_LIBUARTE_CONFIG_LOG_LEVEL 3 #endif // NRF_CLI_LIBUARTE_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_CLI_LIBUARTE_CONFIG_INFO_COLOR -#define NRF_CLI_LIBUARTE_CONFIG_INFO_COLOR 0 + #define NRF_CLI_LIBUARTE_CONFIG_INFO_COLOR 0 #endif // NRF_CLI_LIBUARTE_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_CLI_LIBUARTE_CONFIG_DEBUG_COLOR -#define NRF_CLI_LIBUARTE_CONFIG_DEBUG_COLOR 0 + #define NRF_CLI_LIBUARTE_CONFIG_DEBUG_COLOR 0 #endif // @@ -10651,50 +10303,50 @@ // NRF_CLI_UART_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_CLI_UART_CONFIG_LOG_ENABLED -#define NRF_CLI_UART_CONFIG_LOG_ENABLED 0 + #define NRF_CLI_UART_CONFIG_LOG_ENABLED 0 #endif // NRF_CLI_UART_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_CLI_UART_CONFIG_LOG_LEVEL -#define NRF_CLI_UART_CONFIG_LOG_LEVEL 3 + #define NRF_CLI_UART_CONFIG_LOG_LEVEL 3 #endif // NRF_CLI_UART_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_CLI_UART_CONFIG_INFO_COLOR -#define NRF_CLI_UART_CONFIG_INFO_COLOR 0 + #define NRF_CLI_UART_CONFIG_INFO_COLOR 0 #endif // NRF_CLI_UART_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_CLI_UART_CONFIG_DEBUG_COLOR -#define NRF_CLI_UART_CONFIG_DEBUG_COLOR 0 + #define NRF_CLI_UART_CONFIG_DEBUG_COLOR 0 #endif // @@ -10702,50 +10354,50 @@ // NRF_LIBUARTE_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_LIBUARTE_CONFIG_LOG_ENABLED -#define NRF_LIBUARTE_CONFIG_LOG_ENABLED 0 + #define NRF_LIBUARTE_CONFIG_LOG_ENABLED 0 #endif // NRF_LIBUARTE_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_LIBUARTE_CONFIG_LOG_LEVEL -#define NRF_LIBUARTE_CONFIG_LOG_LEVEL 3 + #define NRF_LIBUARTE_CONFIG_LOG_LEVEL 3 #endif // NRF_LIBUARTE_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_LIBUARTE_CONFIG_INFO_COLOR -#define NRF_LIBUARTE_CONFIG_INFO_COLOR 0 + #define NRF_LIBUARTE_CONFIG_INFO_COLOR 0 #endif // NRF_LIBUARTE_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_LIBUARTE_CONFIG_DEBUG_COLOR -#define NRF_LIBUARTE_CONFIG_DEBUG_COLOR 0 + #define NRF_LIBUARTE_CONFIG_DEBUG_COLOR 0 #endif // @@ -10753,50 +10405,50 @@ // NRF_MEMOBJ_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_MEMOBJ_CONFIG_LOG_ENABLED -#define NRF_MEMOBJ_CONFIG_LOG_ENABLED 0 + #define NRF_MEMOBJ_CONFIG_LOG_ENABLED 0 #endif // NRF_MEMOBJ_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_MEMOBJ_CONFIG_LOG_LEVEL -#define NRF_MEMOBJ_CONFIG_LOG_LEVEL 3 + #define NRF_MEMOBJ_CONFIG_LOG_LEVEL 3 #endif // NRF_MEMOBJ_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_MEMOBJ_CONFIG_INFO_COLOR -#define NRF_MEMOBJ_CONFIG_INFO_COLOR 0 + #define NRF_MEMOBJ_CONFIG_INFO_COLOR 0 #endif // NRF_MEMOBJ_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_MEMOBJ_CONFIG_DEBUG_COLOR -#define NRF_MEMOBJ_CONFIG_DEBUG_COLOR 0 + #define NRF_MEMOBJ_CONFIG_DEBUG_COLOR 0 #endif // @@ -10804,50 +10456,50 @@ // NRF_PWR_MGMT_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_PWR_MGMT_CONFIG_LOG_ENABLED -#define NRF_PWR_MGMT_CONFIG_LOG_ENABLED 0 + #define NRF_PWR_MGMT_CONFIG_LOG_ENABLED 0 #endif // NRF_PWR_MGMT_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_PWR_MGMT_CONFIG_LOG_LEVEL -#define NRF_PWR_MGMT_CONFIG_LOG_LEVEL 3 + #define NRF_PWR_MGMT_CONFIG_LOG_LEVEL 3 #endif // NRF_PWR_MGMT_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_PWR_MGMT_CONFIG_INFO_COLOR -#define NRF_PWR_MGMT_CONFIG_INFO_COLOR 0 + #define NRF_PWR_MGMT_CONFIG_INFO_COLOR 0 #endif // NRF_PWR_MGMT_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_PWR_MGMT_CONFIG_DEBUG_COLOR -#define NRF_PWR_MGMT_CONFIG_DEBUG_COLOR 0 + #define NRF_PWR_MGMT_CONFIG_DEBUG_COLOR 0 #endif // @@ -10855,62 +10507,62 @@ // NRF_QUEUE_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_QUEUE_CONFIG_LOG_ENABLED -#define NRF_QUEUE_CONFIG_LOG_ENABLED 0 + #define NRF_QUEUE_CONFIG_LOG_ENABLED 0 #endif // NRF_QUEUE_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_QUEUE_CONFIG_LOG_LEVEL -#define NRF_QUEUE_CONFIG_LOG_LEVEL 3 + #define NRF_QUEUE_CONFIG_LOG_LEVEL 3 #endif // NRF_QUEUE_CONFIG_LOG_INIT_FILTER_LEVEL - Initial severity level if dynamic filtering is enabled -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_QUEUE_CONFIG_LOG_INIT_FILTER_LEVEL -#define NRF_QUEUE_CONFIG_LOG_INIT_FILTER_LEVEL 3 + #define NRF_QUEUE_CONFIG_LOG_INIT_FILTER_LEVEL 3 #endif // NRF_QUEUE_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_QUEUE_CONFIG_INFO_COLOR -#define NRF_QUEUE_CONFIG_INFO_COLOR 0 + #define NRF_QUEUE_CONFIG_INFO_COLOR 0 #endif // NRF_QUEUE_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_QUEUE_CONFIG_DEBUG_COLOR -#define NRF_QUEUE_CONFIG_DEBUG_COLOR 0 + #define NRF_QUEUE_CONFIG_DEBUG_COLOR 0 #endif // @@ -10918,50 +10570,50 @@ // NRF_SDH_ANT_LOG_ENABLED - Enable logging in SoftDevice handler (ANT) module. //========================================================== #ifndef NRF_SDH_ANT_LOG_ENABLED -#define NRF_SDH_ANT_LOG_ENABLED 0 + #define NRF_SDH_ANT_LOG_ENABLED 0 #endif // NRF_SDH_ANT_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_SDH_ANT_LOG_LEVEL -#define NRF_SDH_ANT_LOG_LEVEL 3 + #define NRF_SDH_ANT_LOG_LEVEL 3 #endif // NRF_SDH_ANT_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_SDH_ANT_INFO_COLOR -#define NRF_SDH_ANT_INFO_COLOR 0 + #define NRF_SDH_ANT_INFO_COLOR 0 #endif // NRF_SDH_ANT_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_SDH_ANT_DEBUG_COLOR -#define NRF_SDH_ANT_DEBUG_COLOR 0 + #define NRF_SDH_ANT_DEBUG_COLOR 0 #endif // @@ -10969,50 +10621,50 @@ // NRF_SDH_BLE_LOG_ENABLED - Enable logging in SoftDevice handler (BLE) module. //========================================================== #ifndef NRF_SDH_BLE_LOG_ENABLED -#define NRF_SDH_BLE_LOG_ENABLED 0 + #define NRF_SDH_BLE_LOG_ENABLED 0 #endif // NRF_SDH_BLE_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_SDH_BLE_LOG_LEVEL -#define NRF_SDH_BLE_LOG_LEVEL 3 + #define NRF_SDH_BLE_LOG_LEVEL 3 #endif // NRF_SDH_BLE_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_SDH_BLE_INFO_COLOR -#define NRF_SDH_BLE_INFO_COLOR 0 + #define NRF_SDH_BLE_INFO_COLOR 0 #endif // NRF_SDH_BLE_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_SDH_BLE_DEBUG_COLOR -#define NRF_SDH_BLE_DEBUG_COLOR 0 + #define NRF_SDH_BLE_DEBUG_COLOR 0 #endif // @@ -11020,58 +10672,58 @@ // NRF_SDH_LOG_ENABLED - Enable logging in SoftDevice handler module. //========================================================== #ifndef NRF_SDH_LOG_ENABLED -#define NRF_SDH_LOG_ENABLED 0 + #define NRF_SDH_LOG_ENABLED 0 #endif #ifndef NRF_SDH_FREERTOS_LOG_ENABLED -#define NRF_SDH_FREERTOS_LOG_ENABLED 0 + #define NRF_SDH_FREERTOS_LOG_ENABLED 0 #endif #ifndef NRF_SDH_FREERTOS_LOG_LEVEL -#define NRF_SDH_FREERTOS_LOG_LEVEL 4 + #define NRF_SDH_FREERTOS_LOG_LEVEL 4 #endif // NRF_SDH_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_SDH_LOG_LEVEL -#define NRF_SDH_LOG_LEVEL 3 + #define NRF_SDH_LOG_LEVEL 3 #endif // NRF_SDH_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_SDH_INFO_COLOR -#define NRF_SDH_INFO_COLOR 0 + #define NRF_SDH_INFO_COLOR 0 #endif // NRF_SDH_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_SDH_DEBUG_COLOR -#define NRF_SDH_DEBUG_COLOR 0 + #define NRF_SDH_DEBUG_COLOR 0 #endif // @@ -11079,50 +10731,50 @@ // NRF_SDH_SOC_LOG_ENABLED - Enable logging in SoftDevice handler (SoC) module. //========================================================== #ifndef NRF_SDH_SOC_LOG_ENABLED -#define NRF_SDH_SOC_LOG_ENABLED 0 + #define NRF_SDH_SOC_LOG_ENABLED 0 #endif // NRF_SDH_SOC_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_SDH_SOC_LOG_LEVEL -#define NRF_SDH_SOC_LOG_LEVEL 3 + #define NRF_SDH_SOC_LOG_LEVEL 3 #endif // NRF_SDH_SOC_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_SDH_SOC_INFO_COLOR -#define NRF_SDH_SOC_INFO_COLOR 0 + #define NRF_SDH_SOC_INFO_COLOR 0 #endif // NRF_SDH_SOC_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_SDH_SOC_DEBUG_COLOR -#define NRF_SDH_SOC_DEBUG_COLOR 0 + #define NRF_SDH_SOC_DEBUG_COLOR 0 #endif // @@ -11130,50 +10782,50 @@ // NRF_SORTLIST_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_SORTLIST_CONFIG_LOG_ENABLED -#define NRF_SORTLIST_CONFIG_LOG_ENABLED 0 + #define NRF_SORTLIST_CONFIG_LOG_ENABLED 0 #endif // NRF_SORTLIST_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_SORTLIST_CONFIG_LOG_LEVEL -#define NRF_SORTLIST_CONFIG_LOG_LEVEL 3 + #define NRF_SORTLIST_CONFIG_LOG_LEVEL 3 #endif // NRF_SORTLIST_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_SORTLIST_CONFIG_INFO_COLOR -#define NRF_SORTLIST_CONFIG_INFO_COLOR 0 + #define NRF_SORTLIST_CONFIG_INFO_COLOR 0 #endif // NRF_SORTLIST_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_SORTLIST_CONFIG_DEBUG_COLOR -#define NRF_SORTLIST_CONFIG_DEBUG_COLOR 0 + #define NRF_SORTLIST_CONFIG_DEBUG_COLOR 0 #endif // @@ -11181,50 +10833,50 @@ // NRF_TWI_SENSOR_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NRF_TWI_SENSOR_CONFIG_LOG_ENABLED -#define NRF_TWI_SENSOR_CONFIG_LOG_ENABLED 0 + #define NRF_TWI_SENSOR_CONFIG_LOG_ENABLED 0 #endif // NRF_TWI_SENSOR_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NRF_TWI_SENSOR_CONFIG_LOG_LEVEL -#define NRF_TWI_SENSOR_CONFIG_LOG_LEVEL 3 + #define NRF_TWI_SENSOR_CONFIG_LOG_LEVEL 3 #endif // NRF_TWI_SENSOR_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_TWI_SENSOR_CONFIG_INFO_COLOR -#define NRF_TWI_SENSOR_CONFIG_INFO_COLOR 0 + #define NRF_TWI_SENSOR_CONFIG_INFO_COLOR 0 #endif // NRF_TWI_SENSOR_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NRF_TWI_SENSOR_CONFIG_DEBUG_COLOR -#define NRF_TWI_SENSOR_CONFIG_DEBUG_COLOR 0 + #define NRF_TWI_SENSOR_CONFIG_DEBUG_COLOR 0 #endif // @@ -11232,221 +10884,217 @@ // PM_LOG_ENABLED - Enable logging in Peer Manager and its submodules. //========================================================== #ifndef PM_LOG_ENABLED -#define PM_LOG_ENABLED 0 + #define PM_LOG_ENABLED 0 #endif // PM_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef PM_LOG_LEVEL -#define PM_LOG_LEVEL 3 + #define PM_LOG_LEVEL 3 #endif // PM_LOG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef PM_LOG_INFO_COLOR -#define PM_LOG_INFO_COLOR 0 + #define PM_LOG_INFO_COLOR 0 #endif // PM_LOG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef PM_LOG_DEBUG_COLOR -#define PM_LOG_DEBUG_COLOR 0 + #define PM_LOG_DEBUG_COLOR 0 #endif // -// +// //========================================================== -// nrf_log in nRF_Serialization +// nrf_log in nRF_Serialization //========================================================== // SER_HAL_TRANSPORT_CONFIG_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef SER_HAL_TRANSPORT_CONFIG_LOG_ENABLED -#define SER_HAL_TRANSPORT_CONFIG_LOG_ENABLED 0 + #define SER_HAL_TRANSPORT_CONFIG_LOG_ENABLED 0 #endif // SER_HAL_TRANSPORT_CONFIG_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef SER_HAL_TRANSPORT_CONFIG_LOG_LEVEL -#define SER_HAL_TRANSPORT_CONFIG_LOG_LEVEL 3 + #define SER_HAL_TRANSPORT_CONFIG_LOG_LEVEL 3 #endif // SER_HAL_TRANSPORT_CONFIG_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef SER_HAL_TRANSPORT_CONFIG_INFO_COLOR -#define SER_HAL_TRANSPORT_CONFIG_INFO_COLOR 0 + #define SER_HAL_TRANSPORT_CONFIG_INFO_COLOR 0 #endif // SER_HAL_TRANSPORT_CONFIG_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef SER_HAL_TRANSPORT_CONFIG_DEBUG_COLOR -#define SER_HAL_TRANSPORT_CONFIG_DEBUG_COLOR 0 + #define SER_HAL_TRANSPORT_CONFIG_DEBUG_COLOR 0 #endif // -// +// //========================================================== -// +// //========================================================== // // NRF_LOG_STR_FORMATTER_TIMESTAMP_FORMAT_ENABLED - nrf_log_str_formatter - Log string formatter - #ifndef NRF_LOG_STR_FORMATTER_TIMESTAMP_FORMAT_ENABLED -#define NRF_LOG_STR_FORMATTER_TIMESTAMP_FORMAT_ENABLED 1 + #define NRF_LOG_STR_FORMATTER_TIMESTAMP_FORMAT_ENABLED 1 #endif -// +// //========================================================== -// nRF_NFC +// nRF_NFC //========================================================== // NFC_AC_REC_ENABLED - nfc_ac_rec - NFC NDEF Alternative Carrier record encoder - #ifndef NFC_AC_REC_ENABLED -#define NFC_AC_REC_ENABLED 0 + #define NFC_AC_REC_ENABLED 0 #endif // NFC_AC_REC_PARSER_ENABLED - nfc_ac_rec_parser - Alternative Carrier record parser - #ifndef NFC_AC_REC_PARSER_ENABLED -#define NFC_AC_REC_PARSER_ENABLED 0 + #define NFC_AC_REC_PARSER_ENABLED 0 #endif // NFC_BLE_OOB_ADVDATA_ENABLED - nfc_ble_oob_advdata - AD data for OOB pairing encoder //========================================================== #ifndef NFC_BLE_OOB_ADVDATA_ENABLED -#define NFC_BLE_OOB_ADVDATA_ENABLED 0 + #define NFC_BLE_OOB_ADVDATA_ENABLED 0 #endif // ADVANCED_ADVDATA_SUPPORT - Non-mandatory AD types for BLE OOB pairing are encoded inside the NDEF message (e.g. service UUIDs) -// <1=> Enabled -// <0=> Disabled +// <1=> Enabled +// <0=> Disabled #ifndef ADVANCED_ADVDATA_SUPPORT -#define ADVANCED_ADVDATA_SUPPORT 0 + #define ADVANCED_ADVDATA_SUPPORT 0 #endif // // NFC_BLE_OOB_ADVDATA_PARSER_ENABLED - nfc_ble_oob_advdata_parser - BLE OOB pairing AD data parser - #ifndef NFC_BLE_OOB_ADVDATA_PARSER_ENABLED -#define NFC_BLE_OOB_ADVDATA_PARSER_ENABLED 0 + #define NFC_BLE_OOB_ADVDATA_PARSER_ENABLED 0 #endif // NFC_BLE_PAIR_LIB_ENABLED - nfc_ble_pair_lib - Library parameters //========================================================== #ifndef NFC_BLE_PAIR_LIB_ENABLED -#define NFC_BLE_PAIR_LIB_ENABLED 0 + #define NFC_BLE_PAIR_LIB_ENABLED 0 #endif // NFC_BLE_PAIR_LIB_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NFC_BLE_PAIR_LIB_LOG_ENABLED -#define NFC_BLE_PAIR_LIB_LOG_ENABLED 0 + #define NFC_BLE_PAIR_LIB_LOG_ENABLED 0 #endif // NFC_BLE_PAIR_LIB_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NFC_BLE_PAIR_LIB_LOG_LEVEL -#define NFC_BLE_PAIR_LIB_LOG_LEVEL 3 + #define NFC_BLE_PAIR_LIB_LOG_LEVEL 3 #endif // NFC_BLE_PAIR_LIB_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NFC_BLE_PAIR_LIB_INFO_COLOR -#define NFC_BLE_PAIR_LIB_INFO_COLOR 0 + #define NFC_BLE_PAIR_LIB_INFO_COLOR 0 #endif // NFC_BLE_PAIR_LIB_DEBUG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NFC_BLE_PAIR_LIB_DEBUG_COLOR -#define NFC_BLE_PAIR_LIB_DEBUG_COLOR 0 + #define NFC_BLE_PAIR_LIB_DEBUG_COLOR 0 #endif // @@ -11459,145 +11107,133 @@ // If bonding is enabled at least one of the BLE_NFC_SEC_PARAM_KDIST options must be enabled. //========================================================== #ifndef BLE_NFC_SEC_PARAM_BOND -#define BLE_NFC_SEC_PARAM_BOND 1 + #define BLE_NFC_SEC_PARAM_BOND 1 #endif // BLE_NFC_SEC_PARAM_KDIST_OWN_ENC - Enables Long Term Key and Master Identification distribution by device. - #ifndef BLE_NFC_SEC_PARAM_KDIST_OWN_ENC -#define BLE_NFC_SEC_PARAM_KDIST_OWN_ENC 1 + #define BLE_NFC_SEC_PARAM_KDIST_OWN_ENC 1 #endif // BLE_NFC_SEC_PARAM_KDIST_OWN_ID - Enables Identity Resolving Key and Identity Address Information distribution by device. - #ifndef BLE_NFC_SEC_PARAM_KDIST_OWN_ID -#define BLE_NFC_SEC_PARAM_KDIST_OWN_ID 1 + #define BLE_NFC_SEC_PARAM_KDIST_OWN_ID 1 #endif // BLE_NFC_SEC_PARAM_KDIST_PEER_ENC - Enables Long Term Key and Master Identification distribution by peer. - #ifndef BLE_NFC_SEC_PARAM_KDIST_PEER_ENC -#define BLE_NFC_SEC_PARAM_KDIST_PEER_ENC 1 + #define BLE_NFC_SEC_PARAM_KDIST_PEER_ENC 1 #endif // BLE_NFC_SEC_PARAM_KDIST_PEER_ID - Enables Identity Resolving Key and Identity Address Information distribution by peer. - #ifndef BLE_NFC_SEC_PARAM_KDIST_PEER_ID -#define BLE_NFC_SEC_PARAM_KDIST_PEER_ID 1 + #define BLE_NFC_SEC_PARAM_KDIST_PEER_ID 1 #endif // // BLE_NFC_SEC_PARAM_MIN_KEY_SIZE - Minimal size of a security key. -// <7=> 7 -// <8=> 8 -// <9=> 9 -// <10=> 10 -// <11=> 11 -// <12=> 12 -// <13=> 13 -// <14=> 14 -// <15=> 15 -// <16=> 16 +// <7=> 7 +// <8=> 8 +// <9=> 9 +// <10=> 10 +// <11=> 11 +// <12=> 12 +// <13=> 13 +// <14=> 14 +// <15=> 15 +// <16=> 16 #ifndef BLE_NFC_SEC_PARAM_MIN_KEY_SIZE -#define BLE_NFC_SEC_PARAM_MIN_KEY_SIZE 7 + #define BLE_NFC_SEC_PARAM_MIN_KEY_SIZE 7 #endif // BLE_NFC_SEC_PARAM_MAX_KEY_SIZE - Maximal size of a security key. -// <7=> 7 -// <8=> 8 -// <9=> 9 -// <10=> 10 -// <11=> 11 -// <12=> 12 -// <13=> 13 -// <14=> 14 -// <15=> 15 -// <16=> 16 +// <7=> 7 +// <8=> 8 +// <9=> 9 +// <10=> 10 +// <11=> 11 +// <12=> 12 +// <13=> 13 +// <14=> 14 +// <15=> 15 +// <16=> 16 #ifndef BLE_NFC_SEC_PARAM_MAX_KEY_SIZE -#define BLE_NFC_SEC_PARAM_MAX_KEY_SIZE 16 + #define BLE_NFC_SEC_PARAM_MAX_KEY_SIZE 16 #endif -// +// //========================================================== // // NFC_BLE_PAIR_MSG_ENABLED - nfc_ble_pair_msg - NDEF message for OOB pairing encoder - #ifndef NFC_BLE_PAIR_MSG_ENABLED -#define NFC_BLE_PAIR_MSG_ENABLED 0 + #define NFC_BLE_PAIR_MSG_ENABLED 0 #endif // NFC_CH_COMMON_ENABLED - nfc_ble_pair_common - OOB pairing common data - #ifndef NFC_CH_COMMON_ENABLED -#define NFC_CH_COMMON_ENABLED 0 + #define NFC_CH_COMMON_ENABLED 0 #endif // NFC_EP_OOB_REC_ENABLED - nfc_ep_oob_rec - EP record for BLE pairing encoder - #ifndef NFC_EP_OOB_REC_ENABLED -#define NFC_EP_OOB_REC_ENABLED 0 + #define NFC_EP_OOB_REC_ENABLED 0 #endif // NFC_HS_REC_ENABLED - nfc_hs_rec - Handover Select NDEF record encoder - #ifndef NFC_HS_REC_ENABLED -#define NFC_HS_REC_ENABLED 0 + #define NFC_HS_REC_ENABLED 0 #endif // NFC_LE_OOB_REC_ENABLED - nfc_le_oob_rec - LE record for BLE pairing encoder - #ifndef NFC_LE_OOB_REC_ENABLED -#define NFC_LE_OOB_REC_ENABLED 0 + #define NFC_LE_OOB_REC_ENABLED 0 #endif // NFC_LE_OOB_REC_PARSER_ENABLED - nfc_le_oob_rec_parser - LE record parser - #ifndef NFC_LE_OOB_REC_PARSER_ENABLED -#define NFC_LE_OOB_REC_PARSER_ENABLED 0 + #define NFC_LE_OOB_REC_PARSER_ENABLED 0 #endif // NFC_NDEF_LAUNCHAPP_MSG_ENABLED - nfc_launchapp_msg - Encoding data for NDEF Application Launching message for NFC Tag - #ifndef NFC_NDEF_LAUNCHAPP_MSG_ENABLED -#define NFC_NDEF_LAUNCHAPP_MSG_ENABLED 0 + #define NFC_NDEF_LAUNCHAPP_MSG_ENABLED 0 #endif // NFC_NDEF_LAUNCHAPP_REC_ENABLED - nfc_launchapp_rec - Encoding data for NDEF Application Launching record for NFC Tag - #ifndef NFC_NDEF_LAUNCHAPP_REC_ENABLED -#define NFC_NDEF_LAUNCHAPP_REC_ENABLED 0 + #define NFC_NDEF_LAUNCHAPP_REC_ENABLED 0 #endif // NFC_NDEF_MSG_ENABLED - nfc_ndef_msg - NFC NDEF Message generator module //========================================================== #ifndef NFC_NDEF_MSG_ENABLED -#define NFC_NDEF_MSG_ENABLED 0 + #define NFC_NDEF_MSG_ENABLED 0 #endif // NFC_NDEF_MSG_TAG_TYPE - NFC Tag Type -// <2=> Type 2 Tag -// <4=> Type 4 Tag +// <2=> Type 2 Tag +// <4=> Type 4 Tag #ifndef NFC_NDEF_MSG_TAG_TYPE -#define NFC_NDEF_MSG_TAG_TYPE 2 + #define NFC_NDEF_MSG_TAG_TYPE 2 #endif // @@ -11605,39 +11241,39 @@ // NFC_NDEF_MSG_PARSER_ENABLED - nfc_ndef_msg_parser - NFC NDEF message parser module //========================================================== #ifndef NFC_NDEF_MSG_PARSER_ENABLED -#define NFC_NDEF_MSG_PARSER_ENABLED 0 + #define NFC_NDEF_MSG_PARSER_ENABLED 0 #endif // NFC_NDEF_MSG_PARSER_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NFC_NDEF_MSG_PARSER_LOG_ENABLED -#define NFC_NDEF_MSG_PARSER_LOG_ENABLED 0 + #define NFC_NDEF_MSG_PARSER_LOG_ENABLED 0 #endif // NFC_NDEF_MSG_PARSER_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NFC_NDEF_MSG_PARSER_LOG_LEVEL -#define NFC_NDEF_MSG_PARSER_LOG_LEVEL 3 + #define NFC_NDEF_MSG_PARSER_LOG_LEVEL 3 #endif // NFC_NDEF_MSG_PARSER_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NFC_NDEF_MSG_PARSER_INFO_COLOR -#define NFC_NDEF_MSG_PARSER_INFO_COLOR 0 + #define NFC_NDEF_MSG_PARSER_INFO_COLOR 0 #endif // @@ -11646,47 +11282,46 @@ // NFC_NDEF_RECORD_ENABLED - nfc_ndef_record - NFC NDEF Record generator module - #ifndef NFC_NDEF_RECORD_ENABLED -#define NFC_NDEF_RECORD_ENABLED 0 + #define NFC_NDEF_RECORD_ENABLED 0 #endif // NFC_NDEF_RECORD_PARSER_ENABLED - nfc_ndef_record_parser - NFC NDEF Record parser module //========================================================== #ifndef NFC_NDEF_RECORD_PARSER_ENABLED -#define NFC_NDEF_RECORD_PARSER_ENABLED 0 + #define NFC_NDEF_RECORD_PARSER_ENABLED 0 #endif // NFC_NDEF_RECORD_PARSER_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NFC_NDEF_RECORD_PARSER_LOG_ENABLED -#define NFC_NDEF_RECORD_PARSER_LOG_ENABLED 0 + #define NFC_NDEF_RECORD_PARSER_LOG_ENABLED 0 #endif // NFC_NDEF_RECORD_PARSER_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NFC_NDEF_RECORD_PARSER_LOG_LEVEL -#define NFC_NDEF_RECORD_PARSER_LOG_LEVEL 3 + #define NFC_NDEF_RECORD_PARSER_LOG_LEVEL 3 #endif // NFC_NDEF_RECORD_PARSER_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NFC_NDEF_RECORD_PARSER_INFO_COLOR -#define NFC_NDEF_RECORD_PARSER_INFO_COLOR 0 + #define NFC_NDEF_RECORD_PARSER_INFO_COLOR 0 #endif // @@ -11695,61 +11330,58 @@ // NFC_NDEF_TEXT_RECORD_ENABLED - nfc_text_rec - Encoding data for a text record for NFC Tag - #ifndef NFC_NDEF_TEXT_RECORD_ENABLED -#define NFC_NDEF_TEXT_RECORD_ENABLED 0 + #define NFC_NDEF_TEXT_RECORD_ENABLED 0 #endif // NFC_NDEF_URI_MSG_ENABLED - nfc_uri_msg - Encoding data for NDEF message with URI record for NFC Tag - #ifndef NFC_NDEF_URI_MSG_ENABLED -#define NFC_NDEF_URI_MSG_ENABLED 0 + #define NFC_NDEF_URI_MSG_ENABLED 0 #endif // NFC_NDEF_URI_REC_ENABLED - nfc_uri_rec - Encoding data for a URI record for NFC Tag - #ifndef NFC_NDEF_URI_REC_ENABLED -#define NFC_NDEF_URI_REC_ENABLED 0 + #define NFC_NDEF_URI_REC_ENABLED 0 #endif // NFC_T2T_PARSER_ENABLED - nfc_type_2_tag_parser - Parser for decoding Type 2 Tag data //========================================================== #ifndef NFC_T2T_PARSER_ENABLED -#define NFC_T2T_PARSER_ENABLED 0 + #define NFC_T2T_PARSER_ENABLED 0 #endif // NFC_T2T_PARSER_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NFC_T2T_PARSER_LOG_ENABLED -#define NFC_T2T_PARSER_LOG_ENABLED 0 + #define NFC_T2T_PARSER_LOG_ENABLED 0 #endif // NFC_T2T_PARSER_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NFC_T2T_PARSER_LOG_LEVEL -#define NFC_T2T_PARSER_LOG_LEVEL 3 + #define NFC_T2T_PARSER_LOG_LEVEL 3 #endif // NFC_T2T_PARSER_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NFC_T2T_PARSER_INFO_COLOR -#define NFC_T2T_PARSER_INFO_COLOR 0 + #define NFC_T2T_PARSER_INFO_COLOR 0 #endif // @@ -11759,39 +11391,39 @@ // NFC_T4T_APDU_ENABLED - nfc_t4t_apdu - APDU encoder/decoder for Type 4 Tag //========================================================== #ifndef NFC_T4T_APDU_ENABLED -#define NFC_T4T_APDU_ENABLED 0 + #define NFC_T4T_APDU_ENABLED 0 #endif // NFC_T4T_APDU_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NFC_T4T_APDU_LOG_ENABLED -#define NFC_T4T_APDU_LOG_ENABLED 0 + #define NFC_T4T_APDU_LOG_ENABLED 0 #endif // NFC_T4T_APDU_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NFC_T4T_APDU_LOG_LEVEL -#define NFC_T4T_APDU_LOG_LEVEL 3 + #define NFC_T4T_APDU_LOG_LEVEL 3 #endif // NFC_T4T_APDU_LOG_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NFC_T4T_APDU_LOG_COLOR -#define NFC_T4T_APDU_LOG_COLOR 0 + #define NFC_T4T_APDU_LOG_COLOR 0 #endif // @@ -11801,39 +11433,39 @@ // NFC_T4T_CC_FILE_PARSER_ENABLED - nfc_t4t_cc_file - Capability Container file for Type 4 Tag //========================================================== #ifndef NFC_T4T_CC_FILE_PARSER_ENABLED -#define NFC_T4T_CC_FILE_PARSER_ENABLED 0 + #define NFC_T4T_CC_FILE_PARSER_ENABLED 0 #endif // NFC_T4T_CC_FILE_PARSER_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NFC_T4T_CC_FILE_PARSER_LOG_ENABLED -#define NFC_T4T_CC_FILE_PARSER_LOG_ENABLED 0 + #define NFC_T4T_CC_FILE_PARSER_LOG_ENABLED 0 #endif // NFC_T4T_CC_FILE_PARSER_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NFC_T4T_CC_FILE_PARSER_LOG_LEVEL -#define NFC_T4T_CC_FILE_PARSER_LOG_LEVEL 3 + #define NFC_T4T_CC_FILE_PARSER_LOG_LEVEL 3 #endif // NFC_T4T_CC_FILE_PARSER_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NFC_T4T_CC_FILE_PARSER_INFO_COLOR -#define NFC_T4T_CC_FILE_PARSER_INFO_COLOR 0 + #define NFC_T4T_CC_FILE_PARSER_INFO_COLOR 0 #endif // @@ -11843,51 +11475,51 @@ // NFC_T4T_HL_DETECTION_PROCEDURES_ENABLED - nfc_t4t_hl_detection_procedures - NDEF Detection Procedure for Type 4 Tag //========================================================== #ifndef NFC_T4T_HL_DETECTION_PROCEDURES_ENABLED -#define NFC_T4T_HL_DETECTION_PROCEDURES_ENABLED 0 + #define NFC_T4T_HL_DETECTION_PROCEDURES_ENABLED 0 #endif // NFC_T4T_HL_DETECTION_PROCEDURES_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NFC_T4T_HL_DETECTION_PROCEDURES_LOG_ENABLED -#define NFC_T4T_HL_DETECTION_PROCEDURES_LOG_ENABLED 0 + #define NFC_T4T_HL_DETECTION_PROCEDURES_LOG_ENABLED 0 #endif // NFC_T4T_HL_DETECTION_PROCEDURES_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NFC_T4T_HL_DETECTION_PROCEDURES_LOG_LEVEL -#define NFC_T4T_HL_DETECTION_PROCEDURES_LOG_LEVEL 3 + #define NFC_T4T_HL_DETECTION_PROCEDURES_LOG_LEVEL 3 #endif // NFC_T4T_HL_DETECTION_PROCEDURES_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NFC_T4T_HL_DETECTION_PROCEDURES_INFO_COLOR -#define NFC_T4T_HL_DETECTION_PROCEDURES_INFO_COLOR 0 + #define NFC_T4T_HL_DETECTION_PROCEDURES_INFO_COLOR 0 #endif // -// APDU_BUFF_SIZE - Size (in bytes) of the buffer for APDU storage +// APDU_BUFF_SIZE - Size (in bytes) of the buffer for APDU storage #ifndef APDU_BUFF_SIZE -#define APDU_BUFF_SIZE 250 + #define APDU_BUFF_SIZE 250 #endif -// CC_STORAGE_BUFF_SIZE - Size (in bytes) of the buffer for CC file storage +// CC_STORAGE_BUFF_SIZE - Size (in bytes) of the buffer for CC file storage #ifndef CC_STORAGE_BUFF_SIZE -#define CC_STORAGE_BUFF_SIZE 64 + #define CC_STORAGE_BUFF_SIZE 64 #endif // @@ -11895,707 +11527,704 @@ // NFC_T4T_TLV_BLOCK_PARSER_ENABLED - nfc_t4t_tlv_block - TLV block for Type 4 Tag //========================================================== #ifndef NFC_T4T_TLV_BLOCK_PARSER_ENABLED -#define NFC_T4T_TLV_BLOCK_PARSER_ENABLED 0 + #define NFC_T4T_TLV_BLOCK_PARSER_ENABLED 0 #endif // NFC_T4T_TLV_BLOCK_PARSER_LOG_ENABLED - Enables logging in the module. //========================================================== #ifndef NFC_T4T_TLV_BLOCK_PARSER_LOG_ENABLED -#define NFC_T4T_TLV_BLOCK_PARSER_LOG_ENABLED 0 + #define NFC_T4T_TLV_BLOCK_PARSER_LOG_ENABLED 0 #endif // NFC_T4T_TLV_BLOCK_PARSER_LOG_LEVEL - Default Severity level -// <0=> Off -// <1=> Error -// <2=> Warning -// <3=> Info -// <4=> Debug +// <0=> Off +// <1=> Error +// <2=> Warning +// <3=> Info +// <4=> Debug #ifndef NFC_T4T_TLV_BLOCK_PARSER_LOG_LEVEL -#define NFC_T4T_TLV_BLOCK_PARSER_LOG_LEVEL 3 + #define NFC_T4T_TLV_BLOCK_PARSER_LOG_LEVEL 3 #endif // NFC_T4T_TLV_BLOCK_PARSER_INFO_COLOR - ANSI escape code prefix. -// <0=> Default -// <1=> Black -// <2=> Red -// <3=> Green -// <4=> Yellow -// <5=> Blue -// <6=> Magenta -// <7=> Cyan -// <8=> White +// <0=> Default +// <1=> Black +// <2=> Red +// <3=> Green +// <4=> Yellow +// <5=> Blue +// <6=> Magenta +// <7=> Cyan +// <8=> White #ifndef NFC_T4T_TLV_BLOCK_PARSER_INFO_COLOR -#define NFC_T4T_TLV_BLOCK_PARSER_INFO_COLOR 0 + #define NFC_T4T_TLV_BLOCK_PARSER_INFO_COLOR 0 #endif // // -// +// //========================================================== -// nRF_SoftDevice +// nRF_SoftDevice //========================================================== // NRF_SDH_ANT_ENABLED - nrf_sdh_ant - SoftDevice ANT event handler //========================================================== #ifndef NRF_SDH_ANT_ENABLED -#define NRF_SDH_ANT_ENABLED 0 + #define NRF_SDH_ANT_ENABLED 0 #endif -// ANT Channels +// ANT Channels //========================================================== -// NRF_SDH_ANT_TOTAL_CHANNELS_ALLOCATED - Allocated ANT channels. +// NRF_SDH_ANT_TOTAL_CHANNELS_ALLOCATED - Allocated ANT channels. #ifndef NRF_SDH_ANT_TOTAL_CHANNELS_ALLOCATED -#define NRF_SDH_ANT_TOTAL_CHANNELS_ALLOCATED 0 + #define NRF_SDH_ANT_TOTAL_CHANNELS_ALLOCATED 0 #endif -// NRF_SDH_ANT_ENCRYPTED_CHANNELS - Encrypted ANT channels. +// NRF_SDH_ANT_ENCRYPTED_CHANNELS - Encrypted ANT channels. #ifndef NRF_SDH_ANT_ENCRYPTED_CHANNELS -#define NRF_SDH_ANT_ENCRYPTED_CHANNELS 0 + #define NRF_SDH_ANT_ENCRYPTED_CHANNELS 0 #endif -// +// //========================================================== -// ANT Queues +// ANT Queues //========================================================== -// NRF_SDH_ANT_EVENT_QUEUE_SIZE - Event queue size. +// NRF_SDH_ANT_EVENT_QUEUE_SIZE - Event queue size. #ifndef NRF_SDH_ANT_EVENT_QUEUE_SIZE -#define NRF_SDH_ANT_EVENT_QUEUE_SIZE 32 + #define NRF_SDH_ANT_EVENT_QUEUE_SIZE 32 #endif -// NRF_SDH_ANT_BURST_QUEUE_SIZE - ANT burst queue size. +// NRF_SDH_ANT_BURST_QUEUE_SIZE - ANT burst queue size. #ifndef NRF_SDH_ANT_BURST_QUEUE_SIZE -#define NRF_SDH_ANT_BURST_QUEUE_SIZE 128 + #define NRF_SDH_ANT_BURST_QUEUE_SIZE 128 #endif -// +// //========================================================== // ANT Observers - Observers and priority levels //========================================================== -// NRF_SDH_ANT_OBSERVER_PRIO_LEVELS - Total number of priority levels for ANT observers. +// NRF_SDH_ANT_OBSERVER_PRIO_LEVELS - Total number of priority levels for ANT observers. // This setting configures the number of priority levels available for the ANT event handlers. // The priority level of a handler determines the order in which it receives events, with respect to other handlers. #ifndef NRF_SDH_ANT_OBSERVER_PRIO_LEVELS -#define NRF_SDH_ANT_OBSERVER_PRIO_LEVELS 2 + #define NRF_SDH_ANT_OBSERVER_PRIO_LEVELS 2 #endif // ANT Observers priorities - Invididual priorities //========================================================== -// ANT_BPWR_ANT_OBSERVER_PRIO +// ANT_BPWR_ANT_OBSERVER_PRIO // Priority with which ANT events are dispatched to the Bicycle Power Profile. #ifndef ANT_BPWR_ANT_OBSERVER_PRIO -#define ANT_BPWR_ANT_OBSERVER_PRIO 1 + #define ANT_BPWR_ANT_OBSERVER_PRIO 1 #endif -// ANT_BSC_ANT_OBSERVER_PRIO +// ANT_BSC_ANT_OBSERVER_PRIO // Priority with which ANT events are dispatched to the Bicycle Speed and Cadence Profile. #ifndef ANT_BSC_ANT_OBSERVER_PRIO -#define ANT_BSC_ANT_OBSERVER_PRIO 1 + #define ANT_BSC_ANT_OBSERVER_PRIO 1 #endif -// ANT_ENCRYPT_ANT_OBSERVER_PRIO +// ANT_ENCRYPT_ANT_OBSERVER_PRIO // Priority with which ANT events are dispatched to the Cryptographic ANT stack configuration module. #ifndef ANT_ENCRYPT_ANT_OBSERVER_PRIO -#define ANT_ENCRYPT_ANT_OBSERVER_PRIO 1 + #define ANT_ENCRYPT_ANT_OBSERVER_PRIO 1 #endif -// ANT_HRM_ANT_OBSERVER_PRIO +// ANT_HRM_ANT_OBSERVER_PRIO // Priority with which ANT events are dispatched to the Heart Rate Monitor. #ifndef ANT_HRM_ANT_OBSERVER_PRIO -#define ANT_HRM_ANT_OBSERVER_PRIO 1 + #define ANT_HRM_ANT_OBSERVER_PRIO 1 #endif -// ANT_SDM_ANT_OBSERVER_PRIO +// ANT_SDM_ANT_OBSERVER_PRIO // Priority with which ANT events are dispatched to the Stride Based Speed and Distance Monitor Profile. #ifndef ANT_SDM_ANT_OBSERVER_PRIO -#define ANT_SDM_ANT_OBSERVER_PRIO 1 + #define ANT_SDM_ANT_OBSERVER_PRIO 1 #endif -// ANT_STATE_INDICATOR_ANT_OBSERVER_PRIO +// ANT_STATE_INDICATOR_ANT_OBSERVER_PRIO // Priority with which ANT events are dispatched to the ANT state indicator module. #ifndef ANT_STATE_INDICATOR_ANT_OBSERVER_PRIO -#define ANT_STATE_INDICATOR_ANT_OBSERVER_PRIO 1 + #define ANT_STATE_INDICATOR_ANT_OBSERVER_PRIO 1 #endif -// BSP_BTN_ANT_OBSERVER_PRIO +// BSP_BTN_ANT_OBSERVER_PRIO // Priority with which ANT events are dispatched to the Button Control module. #ifndef BSP_BTN_ANT_OBSERVER_PRIO -#define BSP_BTN_ANT_OBSERVER_PRIO 1 + #define BSP_BTN_ANT_OBSERVER_PRIO 1 #endif -// NRF_DFU_ANT_EVT_HANDLER_PRIO - DFU ANT event handling priority. -// Priority used to register the ANT event handler for DFU purposes. Change this if there is other ANT event handlers that should be higher priority. +// NRF_DFU_ANT_EVT_HANDLER_PRIO - DFU ANT event handling priority. +// Priority used to register the ANT event handler for DFU purposes. Change this if there is other ANT event handlers that should be +// higher priority. #ifndef NRF_DFU_ANT_EVT_HANDLER_PRIO -#define NRF_DFU_ANT_EVT_HANDLER_PRIO 1 + #define NRF_DFU_ANT_EVT_HANDLER_PRIO 1 #endif -// +// //========================================================== -// +// //========================================================== - // // NRF_SDH_BLE_ENABLED - nrf_sdh_ble - SoftDevice BLE event handler //========================================================== #ifndef NRF_SDH_BLE_ENABLED -#define NRF_SDH_BLE_ENABLED 1 + #define NRF_SDH_BLE_ENABLED 1 #endif // BLE Stack configuration - Stack configuration parameters // The SoftDevice handler will configure the stack with these parameters when calling @ref nrf_sdh_ble_default_cfg_set. -// Other libraries might depend on these values; keep them up-to-date even if you are not explicitely calling @ref nrf_sdh_ble_default_cfg_set. +// Other libraries might depend on these values; keep them up-to-date even if you are not explicitely calling @ref +// nrf_sdh_ble_default_cfg_set. //========================================================== -// NRF_SDH_BLE_GAP_DATA_LENGTH <27-251> - +// NRF_SDH_BLE_GAP_DATA_LENGTH <27-251> // Requested BLE GAP data length to be negotiated. #ifndef NRF_SDH_BLE_GAP_DATA_LENGTH -#define NRF_SDH_BLE_GAP_DATA_LENGTH 27 + #define NRF_SDH_BLE_GAP_DATA_LENGTH 27 #endif -// NRF_SDH_BLE_PERIPHERAL_LINK_COUNT - Maximum number of peripheral links. +// NRF_SDH_BLE_PERIPHERAL_LINK_COUNT - Maximum number of peripheral links. #ifndef NRF_SDH_BLE_PERIPHERAL_LINK_COUNT -#define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 1 + #define NRF_SDH_BLE_PERIPHERAL_LINK_COUNT 1 #endif -// NRF_SDH_BLE_CENTRAL_LINK_COUNT - Maximum number of central links. +// NRF_SDH_BLE_CENTRAL_LINK_COUNT - Maximum number of central links. #ifndef NRF_SDH_BLE_CENTRAL_LINK_COUNT -#define NRF_SDH_BLE_CENTRAL_LINK_COUNT 0 + #define NRF_SDH_BLE_CENTRAL_LINK_COUNT 0 #endif -// NRF_SDH_BLE_TOTAL_LINK_COUNT - Total link count. +// NRF_SDH_BLE_TOTAL_LINK_COUNT - Total link count. // Maximum number of total concurrent connections using the default configuration. #ifndef NRF_SDH_BLE_TOTAL_LINK_COUNT -#define NRF_SDH_BLE_TOTAL_LINK_COUNT 1 + #define NRF_SDH_BLE_TOTAL_LINK_COUNT 1 #endif -// NRF_SDH_BLE_GAP_EVENT_LENGTH - GAP event length. +// NRF_SDH_BLE_GAP_EVENT_LENGTH - GAP event length. // The time set aside for this connection on every connection interval in 1.25 ms units. #ifndef NRF_SDH_BLE_GAP_EVENT_LENGTH -#define NRF_SDH_BLE_GAP_EVENT_LENGTH 6 + #define NRF_SDH_BLE_GAP_EVENT_LENGTH 6 #endif -// NRF_SDH_BLE_GATT_MAX_MTU_SIZE - Static maximum MTU size. +// NRF_SDH_BLE_GATT_MAX_MTU_SIZE - Static maximum MTU size. #ifndef NRF_SDH_BLE_GATT_MAX_MTU_SIZE -#define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 23 + #define NRF_SDH_BLE_GATT_MAX_MTU_SIZE 23 #endif -// NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE - Attribute Table size in bytes. The size must be a multiple of 4. +// NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE - Attribute Table size in bytes. The size must be a multiple of 4. #ifndef NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE -#define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE 1408 + #define NRF_SDH_BLE_GATTS_ATTR_TAB_SIZE 1408 #endif -// NRF_SDH_BLE_VS_UUID_COUNT - The number of vendor-specific UUIDs. +// NRF_SDH_BLE_VS_UUID_COUNT - The number of vendor-specific UUIDs. #ifndef NRF_SDH_BLE_VS_UUID_COUNT -#define NRF_SDH_BLE_VS_UUID_COUNT 0 + #define NRF_SDH_BLE_VS_UUID_COUNT 0 #endif // NRF_SDH_BLE_SERVICE_CHANGED - Include the Service Changed characteristic in the Attribute Table. - #ifndef NRF_SDH_BLE_SERVICE_CHANGED -#define NRF_SDH_BLE_SERVICE_CHANGED 1 + #define NRF_SDH_BLE_SERVICE_CHANGED 1 #endif -// +// //========================================================== // BLE Observers - Observers and priority levels //========================================================== -// NRF_SDH_BLE_OBSERVER_PRIO_LEVELS - Total number of priority levels for BLE observers. +// NRF_SDH_BLE_OBSERVER_PRIO_LEVELS - Total number of priority levels for BLE observers. // This setting configures the number of priority levels available for BLE event handlers. // The priority level of a handler determines the order in which it receives events, with respect to other handlers. #ifndef NRF_SDH_BLE_OBSERVER_PRIO_LEVELS -#define NRF_SDH_BLE_OBSERVER_PRIO_LEVELS 4 + #define NRF_SDH_BLE_OBSERVER_PRIO_LEVELS 4 #endif // BLE Observers priorities - Invididual priorities //========================================================== -// BLE_ADV_BLE_OBSERVER_PRIO +// BLE_ADV_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Advertising module. #ifndef BLE_ADV_BLE_OBSERVER_PRIO -#define BLE_ADV_BLE_OBSERVER_PRIO 1 + #define BLE_ADV_BLE_OBSERVER_PRIO 1 #endif -// BLE_ANCS_C_BLE_OBSERVER_PRIO +// BLE_ANCS_C_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Apple Notification Service Client. #ifndef BLE_ANCS_C_BLE_OBSERVER_PRIO -#define BLE_ANCS_C_BLE_OBSERVER_PRIO 2 + #define BLE_ANCS_C_BLE_OBSERVER_PRIO 2 #endif -// BLE_ANS_C_BLE_OBSERVER_PRIO +// BLE_ANS_C_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Alert Notification Service Client. #ifndef BLE_ANS_C_BLE_OBSERVER_PRIO -#define BLE_ANS_C_BLE_OBSERVER_PRIO 2 + #define BLE_ANS_C_BLE_OBSERVER_PRIO 2 #endif -// BLE_BAS_BLE_OBSERVER_PRIO +// BLE_BAS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Battery Service. #ifndef BLE_BAS_BLE_OBSERVER_PRIO -#define BLE_BAS_BLE_OBSERVER_PRIO 2 + #define BLE_BAS_BLE_OBSERVER_PRIO 2 #endif -// BLE_BAS_C_BLE_OBSERVER_PRIO +// BLE_BAS_C_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Battery Service Client. #ifndef BLE_BAS_C_BLE_OBSERVER_PRIO -#define BLE_BAS_C_BLE_OBSERVER_PRIO 2 + #define BLE_BAS_C_BLE_OBSERVER_PRIO 2 #endif -// BLE_BPS_BLE_OBSERVER_PRIO +// BLE_BPS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Blood Pressure Service. #ifndef BLE_BPS_BLE_OBSERVER_PRIO -#define BLE_BPS_BLE_OBSERVER_PRIO 2 + #define BLE_BPS_BLE_OBSERVER_PRIO 2 #endif -// BLE_CONN_PARAMS_BLE_OBSERVER_PRIO +// BLE_CONN_PARAMS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Connection parameters module. #ifndef BLE_CONN_PARAMS_BLE_OBSERVER_PRIO -#define BLE_CONN_PARAMS_BLE_OBSERVER_PRIO 1 + #define BLE_CONN_PARAMS_BLE_OBSERVER_PRIO 1 #endif -// BLE_CONN_STATE_BLE_OBSERVER_PRIO +// BLE_CONN_STATE_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Connection State module. #ifndef BLE_CONN_STATE_BLE_OBSERVER_PRIO -#define BLE_CONN_STATE_BLE_OBSERVER_PRIO 0 + #define BLE_CONN_STATE_BLE_OBSERVER_PRIO 0 #endif -// BLE_CSCS_BLE_OBSERVER_PRIO +// BLE_CSCS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Cycling Speed and Cadence Service. #ifndef BLE_CSCS_BLE_OBSERVER_PRIO -#define BLE_CSCS_BLE_OBSERVER_PRIO 2 + #define BLE_CSCS_BLE_OBSERVER_PRIO 2 #endif -// BLE_CTS_C_BLE_OBSERVER_PRIO +// BLE_CTS_C_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Current Time Service Client. #ifndef BLE_CTS_C_BLE_OBSERVER_PRIO -#define BLE_CTS_C_BLE_OBSERVER_PRIO 2 + #define BLE_CTS_C_BLE_OBSERVER_PRIO 2 #endif -// BLE_DB_DISC_BLE_OBSERVER_PRIO +// BLE_DB_DISC_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Database Discovery module. #ifndef BLE_DB_DISC_BLE_OBSERVER_PRIO -#define BLE_DB_DISC_BLE_OBSERVER_PRIO 1 + #define BLE_DB_DISC_BLE_OBSERVER_PRIO 1 #endif -// BLE_DFU_BLE_OBSERVER_PRIO +// BLE_DFU_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the DFU Service. #ifndef BLE_DFU_BLE_OBSERVER_PRIO -#define BLE_DFU_BLE_OBSERVER_PRIO 2 + #define BLE_DFU_BLE_OBSERVER_PRIO 2 #endif -// BLE_DIS_C_BLE_OBSERVER_PRIO +// BLE_DIS_C_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Device Information Client. #ifndef BLE_DIS_C_BLE_OBSERVER_PRIO -#define BLE_DIS_C_BLE_OBSERVER_PRIO 2 + #define BLE_DIS_C_BLE_OBSERVER_PRIO 2 #endif -// BLE_GLS_BLE_OBSERVER_PRIO +// BLE_GLS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Glucose Service. #ifndef BLE_GLS_BLE_OBSERVER_PRIO -#define BLE_GLS_BLE_OBSERVER_PRIO 2 + #define BLE_GLS_BLE_OBSERVER_PRIO 2 #endif -// BLE_HIDS_BLE_OBSERVER_PRIO +// BLE_HIDS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Human Interface Device Service. #ifndef BLE_HIDS_BLE_OBSERVER_PRIO -#define BLE_HIDS_BLE_OBSERVER_PRIO 2 + #define BLE_HIDS_BLE_OBSERVER_PRIO 2 #endif -// BLE_HRS_BLE_OBSERVER_PRIO +// BLE_HRS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Heart Rate Service. #ifndef BLE_HRS_BLE_OBSERVER_PRIO -#define BLE_HRS_BLE_OBSERVER_PRIO 2 + #define BLE_HRS_BLE_OBSERVER_PRIO 2 #endif -// BLE_HRS_C_BLE_OBSERVER_PRIO +// BLE_HRS_C_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Heart Rate Service Client. #ifndef BLE_HRS_C_BLE_OBSERVER_PRIO -#define BLE_HRS_C_BLE_OBSERVER_PRIO 2 + #define BLE_HRS_C_BLE_OBSERVER_PRIO 2 #endif -// BLE_HTS_BLE_OBSERVER_PRIO +// BLE_HTS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Health Thermometer Service. #ifndef BLE_HTS_BLE_OBSERVER_PRIO -#define BLE_HTS_BLE_OBSERVER_PRIO 2 + #define BLE_HTS_BLE_OBSERVER_PRIO 2 #endif -// BLE_IAS_BLE_OBSERVER_PRIO +// BLE_IAS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Immediate Alert Service. #ifndef BLE_IAS_BLE_OBSERVER_PRIO -#define BLE_IAS_BLE_OBSERVER_PRIO 2 + #define BLE_IAS_BLE_OBSERVER_PRIO 2 #endif -// BLE_IAS_C_BLE_OBSERVER_PRIO +// BLE_IAS_C_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Immediate Alert Service Client. #ifndef BLE_IAS_C_BLE_OBSERVER_PRIO -#define BLE_IAS_C_BLE_OBSERVER_PRIO 2 + #define BLE_IAS_C_BLE_OBSERVER_PRIO 2 #endif -// BLE_LBS_BLE_OBSERVER_PRIO +// BLE_LBS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the LED Button Service. #ifndef BLE_LBS_BLE_OBSERVER_PRIO -#define BLE_LBS_BLE_OBSERVER_PRIO 2 + #define BLE_LBS_BLE_OBSERVER_PRIO 2 #endif -// BLE_LBS_C_BLE_OBSERVER_PRIO +// BLE_LBS_C_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the LED Button Service Client. #ifndef BLE_LBS_C_BLE_OBSERVER_PRIO -#define BLE_LBS_C_BLE_OBSERVER_PRIO 2 + #define BLE_LBS_C_BLE_OBSERVER_PRIO 2 #endif -// BLE_LLS_BLE_OBSERVER_PRIO +// BLE_LLS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Link Loss Service. #ifndef BLE_LLS_BLE_OBSERVER_PRIO -#define BLE_LLS_BLE_OBSERVER_PRIO 2 + #define BLE_LLS_BLE_OBSERVER_PRIO 2 #endif -// BLE_LNS_BLE_OBSERVER_PRIO +// BLE_LNS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Location Navigation Service. #ifndef BLE_LNS_BLE_OBSERVER_PRIO -#define BLE_LNS_BLE_OBSERVER_PRIO 2 + #define BLE_LNS_BLE_OBSERVER_PRIO 2 #endif -// BLE_NUS_BLE_OBSERVER_PRIO +// BLE_NUS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the UART Service. #ifndef BLE_NUS_BLE_OBSERVER_PRIO -#define BLE_NUS_BLE_OBSERVER_PRIO 2 + #define BLE_NUS_BLE_OBSERVER_PRIO 2 #endif -// BLE_NUS_C_BLE_OBSERVER_PRIO +// BLE_NUS_C_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the UART Central Service. #ifndef BLE_NUS_C_BLE_OBSERVER_PRIO -#define BLE_NUS_C_BLE_OBSERVER_PRIO 2 + #define BLE_NUS_C_BLE_OBSERVER_PRIO 2 #endif -// BLE_OTS_BLE_OBSERVER_PRIO +// BLE_OTS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Object transfer service. #ifndef BLE_OTS_BLE_OBSERVER_PRIO -#define BLE_OTS_BLE_OBSERVER_PRIO 2 + #define BLE_OTS_BLE_OBSERVER_PRIO 2 #endif -// BLE_OTS_C_BLE_OBSERVER_PRIO +// BLE_OTS_C_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Object transfer service client. #ifndef BLE_OTS_C_BLE_OBSERVER_PRIO -#define BLE_OTS_C_BLE_OBSERVER_PRIO 2 + #define BLE_OTS_C_BLE_OBSERVER_PRIO 2 #endif -// BLE_RSCS_BLE_OBSERVER_PRIO +// BLE_RSCS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Running Speed and Cadence Service. #ifndef BLE_RSCS_BLE_OBSERVER_PRIO -#define BLE_RSCS_BLE_OBSERVER_PRIO 2 + #define BLE_RSCS_BLE_OBSERVER_PRIO 2 #endif -// BLE_RSCS_C_BLE_OBSERVER_PRIO +// BLE_RSCS_C_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Running Speed and Cadence Client. #ifndef BLE_RSCS_C_BLE_OBSERVER_PRIO -#define BLE_RSCS_C_BLE_OBSERVER_PRIO 2 + #define BLE_RSCS_C_BLE_OBSERVER_PRIO 2 #endif -// BLE_TPS_BLE_OBSERVER_PRIO +// BLE_TPS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the TX Power Service. #ifndef BLE_TPS_BLE_OBSERVER_PRIO -#define BLE_TPS_BLE_OBSERVER_PRIO 2 + #define BLE_TPS_BLE_OBSERVER_PRIO 2 #endif -// BSP_BTN_BLE_OBSERVER_PRIO +// BSP_BTN_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Button Control module. #ifndef BSP_BTN_BLE_OBSERVER_PRIO -#define BSP_BTN_BLE_OBSERVER_PRIO 1 + #define BSP_BTN_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif // NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif -// NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO +// NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif -// NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO +// NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif -// NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO +// NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the NFC pairing library. #ifndef NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO -#define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 + #define NFC_BLE_PAIR_LIB_BLE_OBSERVER_PRIO 1 #endif -// NRF_BLE_BMS_BLE_OBSERVER_PRIO +// NRF_BLE_BMS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Bond Management Service. #ifndef NRF_BLE_BMS_BLE_OBSERVER_PRIO -#define NRF_BLE_BMS_BLE_OBSERVER_PRIO 2 + #define NRF_BLE_BMS_BLE_OBSERVER_PRIO 2 #endif -// NRF_BLE_CGMS_BLE_OBSERVER_PRIO +// NRF_BLE_CGMS_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Contiuon Glucose Monitoring Service. #ifndef NRF_BLE_CGMS_BLE_OBSERVER_PRIO -#define NRF_BLE_CGMS_BLE_OBSERVER_PRIO 2 + #define NRF_BLE_CGMS_BLE_OBSERVER_PRIO 2 #endif -// NRF_BLE_ES_BLE_OBSERVER_PRIO +// NRF_BLE_ES_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Eddystone module. #ifndef NRF_BLE_ES_BLE_OBSERVER_PRIO -#define NRF_BLE_ES_BLE_OBSERVER_PRIO 2 + #define NRF_BLE_ES_BLE_OBSERVER_PRIO 2 #endif -// NRF_BLE_GATTS_C_BLE_OBSERVER_PRIO +// NRF_BLE_GATTS_C_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the GATT Service Client. #ifndef NRF_BLE_GATTS_C_BLE_OBSERVER_PRIO -#define NRF_BLE_GATTS_C_BLE_OBSERVER_PRIO 2 + #define NRF_BLE_GATTS_C_BLE_OBSERVER_PRIO 2 #endif -// NRF_BLE_GATT_BLE_OBSERVER_PRIO +// NRF_BLE_GATT_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the GATT module. #ifndef NRF_BLE_GATT_BLE_OBSERVER_PRIO -#define NRF_BLE_GATT_BLE_OBSERVER_PRIO 1 + #define NRF_BLE_GATT_BLE_OBSERVER_PRIO 1 #endif -// NRF_BLE_QWR_BLE_OBSERVER_PRIO +// NRF_BLE_QWR_BLE_OBSERVER_PRIO // Priority with which BLE events are dispatched to the Queued writes module. #ifndef NRF_BLE_QWR_BLE_OBSERVER_PRIO -#define NRF_BLE_QWR_BLE_OBSERVER_PRIO 2 + #define NRF_BLE_QWR_BLE_OBSERVER_PRIO 2 #endif -// NRF_BLE_SCAN_OBSERVER_PRIO +// NRF_BLE_SCAN_OBSERVER_PRIO // Priority for dispatching the BLE events to the Scanning Module. #ifndef NRF_BLE_SCAN_OBSERVER_PRIO -#define NRF_BLE_SCAN_OBSERVER_PRIO 1 + #define NRF_BLE_SCAN_OBSERVER_PRIO 1 #endif -// PM_BLE_OBSERVER_PRIO - Priority with which BLE events are dispatched to the Peer Manager module. +// PM_BLE_OBSERVER_PRIO - Priority with which BLE events are dispatched to the Peer Manager module. #ifndef PM_BLE_OBSERVER_PRIO -#define PM_BLE_OBSERVER_PRIO 1 + #define PM_BLE_OBSERVER_PRIO 1 #endif -// +// //========================================================== -// +// //========================================================== - // // NRF_SDH_ENABLED - nrf_sdh - SoftDevice handler //========================================================== #ifndef NRF_SDH_ENABLED -#define NRF_SDH_ENABLED 1 + #define NRF_SDH_ENABLED 1 #endif -// Dispatch model +// Dispatch model // This setting configures how Stack events are dispatched to the application. //========================================================== // NRF_SDH_DISPATCH_MODEL - // NRF_SDH_DISPATCH_MODEL_INTERRUPT: SoftDevice events are passed to the application from the interrupt context. // NRF_SDH_DISPATCH_MODEL_APPSH: SoftDevice events are scheduled using @ref app_scheduler. // NRF_SDH_DISPATCH_MODEL_POLLING: SoftDevice events are to be fetched manually. -// <0=> NRF_SDH_DISPATCH_MODEL_INTERRUPT -// <1=> NRF_SDH_DISPATCH_MODEL_APPSH -// <2=> NRF_SDH_DISPATCH_MODEL_POLLING +// <0=> NRF_SDH_DISPATCH_MODEL_INTERRUPT +// <1=> NRF_SDH_DISPATCH_MODEL_APPSH +// <2=> NRF_SDH_DISPATCH_MODEL_POLLING #ifndef NRF_SDH_DISPATCH_MODEL -#define NRF_SDH_DISPATCH_MODEL 2 + #define NRF_SDH_DISPATCH_MODEL 2 #endif -// +// //========================================================== // Clock - SoftDevice clock configuration @@ -12603,17 +12232,17 @@ //========================================================== // NRF_SDH_CLOCK_LF_SRC - SoftDevice clock source. -// <0=> NRF_CLOCK_LF_SRC_RC -// <1=> NRF_CLOCK_LF_SRC_XTAL -// <2=> NRF_CLOCK_LF_SRC_SYNTH +// <0=> NRF_CLOCK_LF_SRC_RC +// <1=> NRF_CLOCK_LF_SRC_XTAL +// <2=> NRF_CLOCK_LF_SRC_SYNTH #ifndef NRF_SDH_CLOCK_LF_SRC -#define NRF_SDH_CLOCK_LF_SRC 1 + #define NRF_SDH_CLOCK_LF_SRC 1 #endif -// NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval. +// NRF_SDH_CLOCK_LF_RC_CTIV - SoftDevice calibration timer interval. #ifndef NRF_SDH_CLOCK_LF_RC_CTIV -#define NRF_SDH_CLOCK_LF_RC_CTIV 0 + #define NRF_SDH_CLOCK_LF_RC_CTIV 0 #endif // NRF_SDH_CLOCK_LF_RC_TEMP_CTIV - SoftDevice calibration timer interval under constant temperature. @@ -12621,7 +12250,7 @@ // if the temperature has not changed. #ifndef NRF_SDH_CLOCK_LF_RC_TEMP_CTIV -#define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 0 + #define NRF_SDH_CLOCK_LF_RC_TEMP_CTIV 0 #endif // NRF_SDH_CLOCK_LF_ACCURACY - External clock accuracy used in the LL to compute timing. @@ -12640,163 +12269,160 @@ // <11=> NRF_CLOCK_LF_ACCURACY_1_PPM #ifndef NRF_SDH_CLOCK_LF_ACCURACY -#define NRF_SDH_CLOCK_LF_ACCURACY 7 + #define NRF_SDH_CLOCK_LF_ACCURACY 7 #endif -// +// //========================================================== // SDH Observers - Observers and priority levels //========================================================== -// NRF_SDH_REQ_OBSERVER_PRIO_LEVELS - Total number of priority levels for request observers. +// NRF_SDH_REQ_OBSERVER_PRIO_LEVELS - Total number of priority levels for request observers. // This setting configures the number of priority levels available for the SoftDevice request event handlers. // The priority level of a handler determines the order in which it receives events, with respect to other handlers. #ifndef NRF_SDH_REQ_OBSERVER_PRIO_LEVELS -#define NRF_SDH_REQ_OBSERVER_PRIO_LEVELS 2 + #define NRF_SDH_REQ_OBSERVER_PRIO_LEVELS 2 #endif -// NRF_SDH_STATE_OBSERVER_PRIO_LEVELS - Total number of priority levels for state observers. +// NRF_SDH_STATE_OBSERVER_PRIO_LEVELS - Total number of priority levels for state observers. // This setting configures the number of priority levels available for the SoftDevice state event handlers. // The priority level of a handler determines the order in which it receives events, with respect to other handlers. #ifndef NRF_SDH_STATE_OBSERVER_PRIO_LEVELS -#define NRF_SDH_STATE_OBSERVER_PRIO_LEVELS 2 + #define NRF_SDH_STATE_OBSERVER_PRIO_LEVELS 2 #endif -// NRF_SDH_STACK_OBSERVER_PRIO_LEVELS - Total number of priority levels for stack event observers. +// NRF_SDH_STACK_OBSERVER_PRIO_LEVELS - Total number of priority levels for stack event observers. // This setting configures the number of priority levels available for the SoftDevice stack event handlers (ANT, BLE, SoC). // The priority level of a handler determines the order in which it receives events, with respect to other handlers. #ifndef NRF_SDH_STACK_OBSERVER_PRIO_LEVELS -#define NRF_SDH_STACK_OBSERVER_PRIO_LEVELS 2 + #define NRF_SDH_STACK_OBSERVER_PRIO_LEVELS 2 #endif - // State Observers priorities - Invididual priorities //========================================================== -// CLOCK_CONFIG_STATE_OBSERVER_PRIO +// CLOCK_CONFIG_STATE_OBSERVER_PRIO // Priority with which state events are dispatched to the Clock driver. #ifndef CLOCK_CONFIG_STATE_OBSERVER_PRIO -#define CLOCK_CONFIG_STATE_OBSERVER_PRIO 0 + #define CLOCK_CONFIG_STATE_OBSERVER_PRIO 0 #endif -// POWER_CONFIG_STATE_OBSERVER_PRIO +// POWER_CONFIG_STATE_OBSERVER_PRIO // Priority with which state events are dispatched to the Power driver. #ifndef POWER_CONFIG_STATE_OBSERVER_PRIO -#define POWER_CONFIG_STATE_OBSERVER_PRIO 0 + #define POWER_CONFIG_STATE_OBSERVER_PRIO 0 #endif -// RNG_CONFIG_STATE_OBSERVER_PRIO +// RNG_CONFIG_STATE_OBSERVER_PRIO // Priority with which state events are dispatched to this module. #ifndef RNG_CONFIG_STATE_OBSERVER_PRIO -#define RNG_CONFIG_STATE_OBSERVER_PRIO 0 + #define RNG_CONFIG_STATE_OBSERVER_PRIO 0 #endif -// +// //========================================================== // Stack Event Observers priorities - Invididual priorities //========================================================== -// NRF_SDH_ANT_STACK_OBSERVER_PRIO +// NRF_SDH_ANT_STACK_OBSERVER_PRIO // This setting configures the priority with which ANT events are processed with respect to other events coming from the stack. // Modify this setting if you need to have ANT events dispatched before or after other stack events, such as BLE or SoC. // Zero is the highest priority. #ifndef NRF_SDH_ANT_STACK_OBSERVER_PRIO -#define NRF_SDH_ANT_STACK_OBSERVER_PRIO 0 + #define NRF_SDH_ANT_STACK_OBSERVER_PRIO 0 #endif -// NRF_SDH_BLE_STACK_OBSERVER_PRIO +// NRF_SDH_BLE_STACK_OBSERVER_PRIO // This setting configures the priority with which BLE events are processed with respect to other events coming from the stack. // Modify this setting if you need to have BLE events dispatched before or after other stack events, such as ANT or SoC. // Zero is the highest priority. #ifndef NRF_SDH_BLE_STACK_OBSERVER_PRIO -#define NRF_SDH_BLE_STACK_OBSERVER_PRIO 0 + #define NRF_SDH_BLE_STACK_OBSERVER_PRIO 0 #endif -// NRF_SDH_SOC_STACK_OBSERVER_PRIO +// NRF_SDH_SOC_STACK_OBSERVER_PRIO // This setting configures the priority with which SoC events are processed with respect to other events coming from the stack. // Modify this setting if you need to have SoC events dispatched before or after other stack events, such as ANT or BLE. // Zero is the highest priority. #ifndef NRF_SDH_SOC_STACK_OBSERVER_PRIO -#define NRF_SDH_SOC_STACK_OBSERVER_PRIO 0 + #define NRF_SDH_SOC_STACK_OBSERVER_PRIO 0 #endif -// +// //========================================================== -// +// //========================================================== - // // NRF_SDH_SOC_ENABLED - nrf_sdh_soc - SoftDevice SoC event handler //========================================================== #ifndef NRF_SDH_SOC_ENABLED -#define NRF_SDH_SOC_ENABLED 1 + #define NRF_SDH_SOC_ENABLED 1 #endif // SoC Observers - Observers and priority levels //========================================================== -// NRF_SDH_SOC_OBSERVER_PRIO_LEVELS - Total number of priority levels for SoC observers. +// NRF_SDH_SOC_OBSERVER_PRIO_LEVELS - Total number of priority levels for SoC observers. // This setting configures the number of priority levels available for the SoC event handlers. // The priority level of a handler determines the order in which it receives events, with respect to other handlers. #ifndef NRF_SDH_SOC_OBSERVER_PRIO_LEVELS -#define NRF_SDH_SOC_OBSERVER_PRIO_LEVELS 2 + #define NRF_SDH_SOC_OBSERVER_PRIO_LEVELS 2 #endif // SoC Observers priorities - Invididual priorities //========================================================== -// BLE_ADV_SOC_OBSERVER_PRIO +// BLE_ADV_SOC_OBSERVER_PRIO // Priority with which SoC events are dispatched to the Advertising module. #ifndef BLE_ADV_SOC_OBSERVER_PRIO -#define BLE_ADV_SOC_OBSERVER_PRIO 1 + #define BLE_ADV_SOC_OBSERVER_PRIO 1 #endif -// BLE_DFU_SOC_OBSERVER_PRIO +// BLE_DFU_SOC_OBSERVER_PRIO // Priority with which BLE events are dispatched to the DFU Service. #ifndef BLE_DFU_SOC_OBSERVER_PRIO -#define BLE_DFU_SOC_OBSERVER_PRIO 1 + #define BLE_DFU_SOC_OBSERVER_PRIO 1 #endif -// CLOCK_CONFIG_SOC_OBSERVER_PRIO +// CLOCK_CONFIG_SOC_OBSERVER_PRIO // Priority with which SoC events are dispatched to the Clock driver. #ifndef CLOCK_CONFIG_SOC_OBSERVER_PRIO -#define CLOCK_CONFIG_SOC_OBSERVER_PRIO 0 + #define CLOCK_CONFIG_SOC_OBSERVER_PRIO 0 #endif -// POWER_CONFIG_SOC_OBSERVER_PRIO +// POWER_CONFIG_SOC_OBSERVER_PRIO // Priority with which SoC events are dispatched to the Power driver. #ifndef POWER_CONFIG_SOC_OBSERVER_PRIO -#define POWER_CONFIG_SOC_OBSERVER_PRIO 0 + #define POWER_CONFIG_SOC_OBSERVER_PRIO 0 #endif -// +// //========================================================== -// +// //========================================================== - // -// +// //========================================================== //========================================================== @@ -12812,27 +12438,26 @@ // or this value is actually used. It depends on which one is bigger. #ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_UP -#define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 512 + #define SEGGER_RTT_CONFIG_BUFFER_SIZE_UP 512 #endif // SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS - Maximum number of upstream buffers. #ifndef SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS -#define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 4 + #define SEGGER_RTT_CONFIG_MAX_NUM_UP_BUFFERS 4 #endif // SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN - Size of downstream buffer. #ifndef SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN -#define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16 + #define SEGGER_RTT_CONFIG_BUFFER_SIZE_DOWN 16 #endif // SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS - Maximum number of downstream buffers. #ifndef SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS -#define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2 + #define SEGGER_RTT_CONFIG_MAX_NUM_DOWN_BUFFERS 2 #endif // SEGGER_RTT_CONFIG_DEFAULT_MODE - RTT behavior if the buffer is full. - // The following modes are supported: // - SKIP - Do not block, output nothing. // - TRIM - Do not block, output as much as fits. @@ -12842,62 +12467,54 @@ // <2=> BLOCK_IF_FIFO_FULL #ifndef SEGGER_RTT_CONFIG_DEFAULT_MODE -#define SEGGER_RTT_CONFIG_DEFAULT_MODE 0 + #define SEGGER_RTT_CONFIG_DEFAULT_MODE 0 #endif // //========================================================== #ifndef NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE -#define NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE 512 + #define NRF_LOG_BACKEND_RTT_TEMP_BUFFER_SIZE 512 #endif #ifndef NRF_LOG_BACKEND_RTT_TX_RETRY_CNT -#define NRF_LOG_BACKEND_RTT_TX_RETRY_CNT 1 + #define NRF_LOG_BACKEND_RTT_TX_RETRY_CNT 1 #endif #ifndef NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS -#define NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS 10 + #define NRF_LOG_BACKEND_RTT_TX_RETRY_DELAY_MS 10 #endif - - - // ST7735_SCK_PIN - Pin number <0-47> - #ifndef ST7735_SCK_PIN -#define ST7735_SCK_PIN 2 + #define ST7735_SCK_PIN 2 #endif // ST7735_MISO_PIN - Pin number <0-47> - #ifndef ST7735_MISO_PIN -#define ST7735_MISO_PIN 4 + #define ST7735_MISO_PIN 4 #endif // ST7735_MOSI_PIN - Pin number <0-47> - #ifndef ST7735_MOSI_PIN -#define ST7735_MOSI_PIN 3 + #define ST7735_MOSI_PIN 3 #endif // ST7735_SS_PIN - Pin number <0-47> - #ifndef ST7735_SS_PIN -#define ST7735_SS_PIN 25 + #define ST7735_SS_PIN 25 #endif #ifndef ST7789_ROW_OFFSET -#define ST7789_ROW_OFFSET 0 + #define ST7789_ROW_OFFSET 0 #endif // ST7735_IRQ_PRIORITY - Interrupt priority - // Priorities 0,2 (nRF51) and 0,1,4,5 (nRF52) are reserved for SoftDevice // <0=> 0 (highest) // <1=> 1 @@ -12909,13 +12526,12 @@ // <7=> 7 #ifndef ST7735_IRQ_PRIORITY -#define ST7735_IRQ_PRIORITY 3 + #define ST7735_IRQ_PRIORITY 3 #endif // //========================================================== - // ST7735_SPI_INSTANCE // <0=> 0 @@ -12923,15 +12539,15 @@ // <2=> 2 #ifndef ST7735_SPI_INSTANCE -#define ST7735_SPI_INSTANCE 0 + #define ST7735_SPI_INSTANCE 0 #endif #ifndef ST7735_SPI_MODE -#define ST7735_SPI_MODE 3 + #define ST7735_SPI_MODE 3 #endif #ifndef ST7735_SPI_FREQUENCY -#define ST7735_SPI_FREQUENCY 8000000 + #define ST7735_SPI_FREQUENCY 8000000 #endif // ST7735_TAB_COLOR - Color of the tab attached to the screen. @@ -12942,29 +12558,26 @@ // <3=> INITR_144GREENTAB #ifndef ST7735_TAB_COLOR -#define ST7735_TAB_COLOR 2 + #define ST7735_TAB_COLOR 2 #endif // ST7735_DC_PIN - Pin number <0-47> - #ifndef ST7735_DC_PIN -#define ST7735_DC_PIN 18 + #define ST7735_DC_PIN 18 #endif // ST7735_HEIGHT - ST7735 height <0-162> - #ifndef ST7735_HEIGHT -#define ST7735_HEIGHT 160 + #define ST7735_HEIGHT 160 #endif // ST7735_WIDTH - ST7735 width <0-132> - #ifndef ST7735_WIDTH -#define ST7735_WIDTH 128 + #define ST7735_WIDTH 128 #endif // <<< end of configuration section >>> -#endif //SDK_CONFIG_H \ No newline at end of file +#endif // SDK_CONFIG_H \ No newline at end of file diff --git a/src/systemtask/SystemMonitor.h b/src/systemtask/SystemMonitor.h index 029a1364..45c02c2c 100644 --- a/src/systemtask/SystemMonitor.h +++ b/src/systemtask/SystemMonitor.h @@ -3,44 +3,42 @@ #include #include - namespace Pinetime { namespace System { struct DummyMonitor {}; struct FreeRtosMonitor {}; - template - class SystemMonitor { - public: - SystemMonitor() = delete; + template class SystemMonitor { + public: + SystemMonitor() = delete; }; - template<> - class SystemMonitor { - public: - void Process() const {} + template <> class SystemMonitor { + public: + void Process() const { + } }; - template<> - class SystemMonitor { - public: - void Process() const { - if(xTaskGetTickCount() - lastTick > 10000) { - NRF_LOG_INFO("---------------------------------------\nFree heap : %d", xPortGetFreeHeapSize()); - auto nb = uxTaskGetSystemState(tasksStatus, 10, nullptr); - for (uint32_t i = 0; i < nb; i++) { - NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark); - if (tasksStatus[i].usStackHighWaterMark < 20) - NRF_LOG_INFO("WARNING!!! Task %s task is nearly full, only %dB available", tasksStatus[i].pcTaskName, - tasksStatus[i].usStackHighWaterMark * 4); - } - lastTick = xTaskGetTickCount(); + template <> class SystemMonitor { + public: + void Process() const { + if (xTaskGetTickCount() - lastTick > 10000) { + NRF_LOG_INFO("---------------------------------------\nFree heap : %d", xPortGetFreeHeapSize()); + auto nb = uxTaskGetSystemState(tasksStatus, 10, nullptr); + for (uint32_t i = 0; i < nb; i++) { + NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark); + if (tasksStatus[i].usStackHighWaterMark < 20) + NRF_LOG_INFO("WARNING!!! Task %s task is nearly full, only %dB available", + tasksStatus[i].pcTaskName, + tasksStatus[i].usStackHighWaterMark * 4); } + lastTick = xTaskGetTickCount(); } + } - private: - mutable TickType_t lastTick = 0; - mutable TaskStatus_t tasksStatus[10]; + private: + mutable TickType_t lastTick = 0; + mutable TaskStatus_t tasksStatus[10]; }; } } \ No newline at end of file diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 3e315eec..5b03fbbb 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -30,28 +30,39 @@ using namespace Pinetime::System; void IdleTimerCallback(TimerHandle_t xTimer) { NRF_LOG_INFO("IdleTimerCallback"); - auto sysTask = static_cast(pvTimerGetTimerID(xTimer)); + auto sysTask = static_cast(pvTimerGetTimerID(xTimer)); sysTask->OnIdle(); } - -SystemTask::SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd, +SystemTask::SystemTask(Drivers::SpiMaster& spi, + Drivers::St7789& lcd, Pinetime::Drivers::SpiNorFlash& spiNorFlash, - Drivers::TwiMaster& twiMaster, Drivers::Cst816S &touchPanel, - Components::LittleVgl &lvgl, - Controllers::Battery &batteryController, Controllers::Ble &bleController, + Drivers::TwiMaster& twiMaster, + Drivers::Cst816S& touchPanel, + Components::LittleVgl& lvgl, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, Pinetime::Controllers::MotorController& motorController, Pinetime::Drivers::Hrs3300& heartRateSensor, Pinetime::Drivers::Bma421& motionSensor, - Controllers::Settings &settingsController) : - spi{spi}, lcd{lcd}, spiNorFlash{spiNorFlash}, - twiMaster{twiMaster}, touchPanel{touchPanel}, lvgl{lvgl}, batteryController{batteryController}, - heartRateController{*this}, - bleController{bleController}, dateTimeController{*this}, - watchdog{}, watchdogView{watchdog}, - motorController{motorController}, heartRateSensor{heartRateSensor}, motionSensor{motionSensor}, - settingsController{settingsController}, - nimbleController(*this, bleController,dateTimeController, notificationManager, batteryController, spiNorFlash, heartRateController) { + Controllers::Settings& settingsController) + : spi {spi}, + lcd {lcd}, + spiNorFlash {spiNorFlash}, + twiMaster {twiMaster}, + touchPanel {touchPanel}, + lvgl {lvgl}, + batteryController {batteryController}, + heartRateController {*this}, + bleController {bleController}, + dateTimeController {*this}, + watchdog {}, + watchdogView {watchdog}, + motorController {motorController}, + heartRateSensor {heartRateSensor}, + motionSensor {motionSensor}, + settingsController {settingsController}, + nimbleController(*this, bleController, dateTimeController, notificationManager, batteryController, spiNorFlash, heartRateController) { systemTasksMsgQueue = xQueueCreate(10, 1); } @@ -60,8 +71,8 @@ void SystemTask::Start() { APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); } -void SystemTask::Process(void *instance) { - auto *app = static_cast(instance); +void SystemTask::Process(void* instance) { + auto* app = static_cast(instance); NRF_LOG_INFO("systemtask task started!"); app->Work(); } @@ -93,9 +104,18 @@ void SystemTask::Work() { motionSensor.Init(); settingsController.Init(); - displayApp = std::make_unique(lcd, lvgl, touchPanel, batteryController, bleController, - dateTimeController, watchdogView, *this, notificationManager, - heartRateController, settingsController, motionController); + displayApp = std::make_unique(lcd, + lvgl, + touchPanel, + batteryController, + bleController, + dateTimeController, + watchdogView, + *this, + notificationManager, + heartRateController, + settingsController, + motionController); displayApp->Start(); displayApp->PushMessage(Pinetime::Applications::Display::Messages::UpdateBatteryLevel); @@ -105,7 +125,7 @@ void SystemTask::Work() { heartRateApp = std::make_unique(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_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); @@ -113,63 +133,63 @@ void SystemTask::Work() { pinConfig.skip_gpio_setup = true; pinConfig.hi_accuracy = false; pinConfig.is_watcher = false; - pinConfig.sense = (nrf_gpiote_polarity_t)NRF_GPIOTE_POLARITY_HITOLO; - pinConfig.pull = (nrf_gpio_pin_pull_t)GPIO_PIN_CNF_PULL_Pulldown; + pinConfig.sense = (nrf_gpiote_polarity_t) NRF_GPIOTE_POLARITY_HITOLO; + pinConfig.pull = (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pulldown; nrfx_gpiote_in_init(pinButton, &pinConfig, nrfx_gpiote_evt_handler); - nrf_gpio_cfg_sense_input(pinTouchIrq, (nrf_gpio_pin_pull_t)GPIO_PIN_CNF_PULL_Pullup, (nrf_gpio_pin_sense_t)GPIO_PIN_CNF_SENSE_Low); + nrf_gpio_cfg_sense_input(pinTouchIrq, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pullup, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_Low); pinConfig.skip_gpio_setup = true; pinConfig.hi_accuracy = false; pinConfig.is_watcher = false; - pinConfig.sense = (nrf_gpiote_polarity_t)NRF_GPIOTE_POLARITY_HITOLO; - pinConfig.pull = (nrf_gpio_pin_pull_t)GPIO_PIN_CNF_PULL_Pullup; + pinConfig.sense = (nrf_gpiote_polarity_t) NRF_GPIOTE_POLARITY_HITOLO; + pinConfig.pull = (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pullup; nrfx_gpiote_in_init(pinTouchIrq, &pinConfig, nrfx_gpiote_evt_handler); - idleTimer = xTimerCreate ("idleTimer", pdMS_TO_TICKS(settingsController.GetScreenTimeOut()), pdFALSE, this, IdleTimerCallback); + idleTimer = xTimerCreate("idleTimer", pdMS_TO_TICKS(settingsController.GetScreenTimeOut()), pdFALSE, this, IdleTimerCallback); xTimerStart(idleTimer, 0); - // Suppress endless loop diagnostic - #pragma clang diagnostic push - #pragma ide diagnostic ignored "EndlessLoop" - while(true) { +// Suppress endless loop diagnostic +#pragma clang diagnostic push +#pragma ide diagnostic ignored "EndlessLoop" + while (true) { UpdateMotion(); uint8_t msg; if (xQueueReceive(systemTasksMsgQueue, &msg, 100)) { - + // call the battery controller or use the MSG in DisplayApp to get the battery status ??? // it is necessary to validate which is the most efficient batteryController.Update(); - //displayApp->PushMessage(Pinetime::Applications::Display::Messages::UpdateBatteryLevel); - // analyze a more efficient way to do this refreshment - // this and the UpdateMotion(); can be called on a timer to be independent of the main process ??? + // displayApp->PushMessage(Pinetime::Applications::Display::Messages::UpdateBatteryLevel); + // analyze a more efficient way to do this refreshment + // this and the UpdateMotion(); can be called on a timer to be independent of the main process ??? - Messages message = static_cast(msg); - switch(message) { + Messages message = static_cast(msg); + switch (message) { case Messages::EnableSleeping: doNotGoToSleep = false; - break; + break; case Messages::DisableSleeping: doNotGoToSleep = true; - break; + break; case Messages::UpdateTimeOut: xTimerChangePeriod(idleTimer, pdMS_TO_TICKS(settingsController.GetScreenTimeOut()), 0); - break; + break; case Messages::GoToRunning: spi.Wakeup(); twiMaster.Wakeup(); // Double Tap needs the touch screen to be in normal mode - if ( settingsController.getWakeUpMode() != Pinetime::Controllers::Settings::WakeUpMode::DoubleTap ) { + if (settingsController.getWakeUpMode() != Pinetime::Controllers::Settings::WakeUpMode::DoubleTap) { touchPanel.Wakeup(); } nimbleController.StartAdvertising(); xTimerStart(idleTimer, 0); - spiNorFlash.Wakeup(); + spiNorFlash.Wakeup(); lcd.Wakeup(); displayApp->PushMessage(Pinetime::Applications::Display::Messages::GoToRunning); @@ -183,16 +203,10 @@ void SystemTask::Work() { twiMaster.Wakeup(); auto touchInfo = touchPanel.GetTouchInfo(); twiMaster.Sleep(); - if( touchInfo.isTouch and - ( - ( touchInfo.gesture == Pinetime::Drivers::Cst816S::Gestures::DoubleTap and - settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::DoubleTap - ) or - ( touchInfo.gesture == Pinetime::Drivers::Cst816S::Gestures::SingleTap and - settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::SingleTap - ) - ) - ) { + if (touchInfo.isTouch and ((touchInfo.gesture == Pinetime::Drivers::Cst816S::Gestures::DoubleTap and + settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::DoubleTap) or + (touchInfo.gesture == Pinetime::Drivers::Cst816S::Gestures::SingleTap and + settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::SingleTap))) { GoToRunning(); } } break; @@ -208,7 +222,8 @@ void SystemTask::Work() { displayApp->PushMessage(Pinetime::Applications::Display::Messages::UpdateDateTime); break; case Messages::OnNewNotification: - if(isSleeping && !isWakingUp) GoToRunning(); + if (isSleeping && !isWakingUp) + GoToRunning(); motorController.SetDuration(35); displayApp->PushMessage(Pinetime::Applications::Display::Messages::NewNotification); break; @@ -219,13 +234,14 @@ void SystemTask::Work() { break; case Messages::BleFirmwareUpdateStarted: doNotGoToSleep = true; - if(isSleeping && !isWakingUp) GoToRunning(); + if (isSleeping && !isWakingUp) + GoToRunning(); displayApp->PushMessage(Pinetime::Applications::Display::Messages::BleFirmwareUpdateStarted); break; case Messages::BleFirmwareUpdateFinished: doNotGoToSleep = false; xTimerStart(idleTimer, 0); - if(bleController.State() == Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated) + if (bleController.State() == Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated) NVIC_SystemReset(); break; case Messages::OnTouchEvent: @@ -235,7 +251,7 @@ void SystemTask::Work() { ReloadIdleTimer(); break; case Messages::OnDisplayTaskSleeping: - if(BootloaderVersion::IsValid()) { + if (BootloaderVersion::IsValid()) { // First versions of the bootloader do not expose their version and cannot initialize the SPI NOR FLASH // if it's in sleep mode. Avoid bricked device by disabling sleep mode on these versions. spiNorFlash.Sleep(); @@ -244,11 +260,11 @@ void SystemTask::Work() { spi.Sleep(); // Double Tap needs the touch screen to be in normal mode - if ( settingsController.getWakeUpMode() != Pinetime::Controllers::Settings::WakeUpMode::DoubleTap ) { + if (settingsController.getWakeUpMode() != Pinetime::Controllers::Settings::WakeUpMode::DoubleTap) { touchPanel.Sleep(); } twiMaster.Sleep(); - + isSleeping = true; isGoingToSleep = false; break; @@ -257,12 +273,13 @@ void SystemTask::Work() { // Remember we'll have to reset the counter next time we're awake stepCounterMustBeReset = true; break; - default: break; + default: + break; } } - if(isBleDiscoveryTimerRunning) { - if(bleDiscoveryTimer == 0) { + if (isBleDiscoveryTimerRunning) { + if (bleDiscoveryTimer == 0) { isBleDiscoveryTimerRunning = false; // Services discovery is deffered from 3 seconds to avoid the conflicts between the host communicating with the // tharget and vice-versa. I'm not sure if this is the right way to handle this... @@ -275,49 +292,47 @@ void SystemTask::Work() { monitor.Process(); uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG); dateTimeController.UpdateTime(systick_counter); - if(!nrf_gpio_pin_read(pinButton)) + if (!nrf_gpio_pin_read(pinButton)) watchdog.Kick(); } - // Clear diagnostic suppression - #pragma clang diagnostic pop +// Clear diagnostic suppression +#pragma clang diagnostic pop } void SystemTask::UpdateMotion() { - if(isGoingToSleep or isWakingUp) return; - - if(isSleeping && settingsController.getWakeUpMode() != Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) + if (isGoingToSleep or isWakingUp) return; - if(isSleeping) + if (isSleeping && settingsController.getWakeUpMode() != Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) + return; + + if (isSleeping) twiMaster.Wakeup(); - if(stepCounterMustBeReset) { + if (stepCounterMustBeReset) { motionSensor.ResetStepCounter(); stepCounterMustBeReset = false; } auto motionValues = motionSensor.Process(); - if(isSleeping) + if (isSleeping) twiMaster.Sleep(); motionController.IsSensorOk(motionSensor.IsOk()); - motionController.Update(motionValues.x, - motionValues.y, - motionValues.z, - motionValues.steps); + motionController.Update(motionValues.x, motionValues.y, motionValues.z, motionValues.steps); if (motionController.ShouldWakeUp(isSleeping)) { GoToRunning(); } } void SystemTask::OnButtonPushed() { - if(isGoingToSleep) return; - if(!isSleeping) { + if (isGoingToSleep) + return; + if (!isSleeping) { NRF_LOG_INFO("[systemtask] Button pushed"); PushMessage(Messages::OnButtonEvent); displayApp->PushMessage(Pinetime::Applications::Display::Messages::ButtonPushed); - } - else { - if(!isWakingUp) { + } else { + if (!isWakingUp) { NRF_LOG_INFO("[systemtask] Button pushed, waking up"); GoToRunning(); } @@ -325,25 +340,28 @@ void SystemTask::OnButtonPushed() { } void SystemTask::GoToRunning() { - if(isGoingToSleep or (not isSleeping) or isWakingUp) return; + if (isGoingToSleep or (not isSleeping) or isWakingUp) + return; isWakingUp = true; PushMessage(Messages::GoToRunning); } void SystemTask::OnTouchEvent() { - if(isGoingToSleep) return ; - if(!isSleeping) { + if (isGoingToSleep) + return; + if (!isSleeping) { PushMessage(Messages::OnTouchEvent); displayApp->PushMessage(Pinetime::Applications::Display::Messages::TouchEvent); - } else if(!isWakingUp) { - if( settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::None or - settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist ) return; + } else if (!isWakingUp) { + if (settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::None or + settingsController.getWakeUpMode() == Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) + return; PushMessage(Messages::TouchWakeUp); } } void SystemTask::PushMessage(SystemTask::Messages msg) { - if(msg == Messages::GoToSleep) { + if (msg == Messages::GoToSleep) { isGoingToSleep = true; } BaseType_t xHigherPriorityTaskWoken; @@ -356,12 +374,14 @@ void SystemTask::PushMessage(SystemTask::Messages msg) { } void SystemTask::OnIdle() { - if(doNotGoToSleep) return; + if (doNotGoToSleep) + return; NRF_LOG_INFO("Idle timeout -> Going to sleep") PushMessage(Messages::GoToSleep); } void SystemTask::ReloadIdleTimer() const { - if(isSleeping || isGoingToSleep) return; + if (isSleeping || isGoingToSleep) + return; xTimerReset(idleTimer, 0); } diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index a3868375..e65fbea0 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -17,12 +17,12 @@ #include "components/ble/NotificationManager.h" #include "components/motor/MotorController.h" #ifdef PINETIME_IS_RECOVERY -#include "displayapp/DisplayAppRecovery.h" -#include "displayapp/DummyLittleVgl.h" + #include "displayapp/DisplayAppRecovery.h" + #include "displayapp/DummyLittleVgl.h" #else -#include "components/settings/Settings.h" -#include "displayapp/DisplayApp.h" -#include "displayapp/LittleVgl.h" + #include "components/settings/Settings.h" + #include "displayapp/DisplayApp.h" + #include "displayapp/LittleVgl.h" #endif #include "drivers/Watchdog.h" @@ -38,88 +38,106 @@ namespace Pinetime { } namespace System { class SystemTask { - public: - enum class Messages {GoToSleep, GoToRunning, TouchWakeUp, OnNewTime, OnNewNotification, OnNewCall, BleConnected, UpdateTimeOut, - BleFirmwareUpdateStarted, BleFirmwareUpdateFinished, OnTouchEvent, OnButtonEvent, OnDisplayTaskSleeping, EnableSleeping, DisableSleeping, - OnNewDay - }; + public: + enum class Messages { + GoToSleep, + GoToRunning, + TouchWakeUp, + OnNewTime, + OnNewNotification, + OnNewCall, + BleConnected, + UpdateTimeOut, + BleFirmwareUpdateStarted, + BleFirmwareUpdateFinished, + OnTouchEvent, + OnButtonEvent, + OnDisplayTaskSleeping, + EnableSleeping, + DisableSleeping, + OnNewDay + }; - SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd, - Pinetime::Drivers::SpiNorFlash& spiNorFlash, - Drivers::TwiMaster& twiMaster, Drivers::Cst816S &touchPanel, - Components::LittleVgl &lvgl, - Controllers::Battery &batteryController, Controllers::Ble &bleController, - Pinetime::Controllers::MotorController& motorController, - Pinetime::Drivers::Hrs3300& heartRateSensor, - Pinetime::Drivers::Bma421& motionSensor, - Controllers::Settings &settingsController); + SystemTask(Drivers::SpiMaster& spi, + Drivers::St7789& lcd, + Pinetime::Drivers::SpiNorFlash& spiNorFlash, + Drivers::TwiMaster& twiMaster, + Drivers::Cst816S& touchPanel, + Components::LittleVgl& lvgl, + Controllers::Battery& batteryController, + Controllers::Ble& bleController, + Pinetime::Controllers::MotorController& motorController, + Pinetime::Drivers::Hrs3300& heartRateSensor, + Pinetime::Drivers::Bma421& motionSensor, + Controllers::Settings& settingsController); + void Start(); + void PushMessage(Messages msg); - void Start(); - void PushMessage(Messages msg); + void OnButtonPushed(); + void OnTouchEvent(); - void OnButtonPushed(); - void OnTouchEvent(); + void OnIdle(); - void OnIdle(); + Pinetime::Controllers::NimbleController& nimble() { + return nimbleController; + }; - Pinetime::Controllers::NimbleController& nimble() {return nimbleController;}; + private: + TaskHandle_t taskHandle; - private: - TaskHandle_t taskHandle; + Pinetime::Drivers::SpiMaster& spi; + Pinetime::Drivers::St7789& lcd; + Pinetime::Drivers::SpiNorFlash& spiNorFlash; + Pinetime::Drivers::TwiMaster& twiMaster; + Pinetime::Drivers::Cst816S& touchPanel; + Pinetime::Components::LittleVgl& lvgl; + Pinetime::Controllers::Battery& batteryController; + std::unique_ptr displayApp; + Pinetime::Controllers::HeartRateController heartRateController; + std::unique_ptr heartRateApp; - Pinetime::Drivers::SpiMaster& spi; - Pinetime::Drivers::St7789& lcd; - Pinetime::Drivers::SpiNorFlash& spiNorFlash; - Pinetime::Drivers::TwiMaster& twiMaster; - Pinetime::Drivers::Cst816S& touchPanel; - Pinetime::Components::LittleVgl& lvgl; - Pinetime::Controllers::Battery& batteryController; - std::unique_ptr displayApp; - Pinetime::Controllers::HeartRateController heartRateController; - std::unique_ptr heartRateApp; + Pinetime::Controllers::Ble& bleController; + Pinetime::Controllers::DateTime dateTimeController; + QueueHandle_t systemTasksMsgQueue; + std::atomic isSleeping {false}; + std::atomic isGoingToSleep {false}; + std::atomic isWakingUp {false}; + Pinetime::Drivers::Watchdog watchdog; + Pinetime::Drivers::WatchdogView watchdogView; + Pinetime::Controllers::NotificationManager notificationManager; + Pinetime::Controllers::MotorController& motorController; + Pinetime::Drivers::Hrs3300& heartRateSensor; + Pinetime::Drivers::Bma421& motionSensor; + Pinetime::Controllers::Settings& settingsController; + Pinetime::Controllers::NimbleController nimbleController; + Controllers::BrightnessController brightnessController; + Pinetime::Controllers::MotionController motionController; - Pinetime::Controllers::Ble& bleController; - Pinetime::Controllers::DateTime dateTimeController; - QueueHandle_t systemTasksMsgQueue; - std::atomic isSleeping{false}; - std::atomic isGoingToSleep{false}; - std::atomic isWakingUp{false}; - Pinetime::Drivers::Watchdog watchdog; - Pinetime::Drivers::WatchdogView watchdogView; - Pinetime::Controllers::NotificationManager notificationManager; - Pinetime::Controllers::MotorController& motorController; - Pinetime::Drivers::Hrs3300& heartRateSensor; - Pinetime::Drivers::Bma421& motionSensor; - Pinetime::Controllers::Settings& settingsController; - Pinetime::Controllers::NimbleController nimbleController; - Controllers::BrightnessController brightnessController; - Pinetime::Controllers::MotionController motionController; + static constexpr uint8_t pinSpiSck = 2; + static constexpr uint8_t pinSpiMosi = 3; + static constexpr uint8_t pinSpiMiso = 4; + static constexpr uint8_t pinSpiCsn = 25; + static constexpr uint8_t pinLcdDataCommand = 18; + static constexpr uint8_t pinButton = 13; + static constexpr uint8_t pinTouchIrq = 28; - static constexpr uint8_t pinSpiSck = 2; - static constexpr uint8_t pinSpiMosi = 3; - static constexpr uint8_t pinSpiMiso = 4; - static constexpr uint8_t pinSpiCsn = 25; - static constexpr uint8_t pinLcdDataCommand = 18; - static constexpr uint8_t pinButton = 13; - static constexpr uint8_t pinTouchIrq = 28; + static void Process(void* instance); + void Work(); + void ReloadIdleTimer() const; + bool isBleDiscoveryTimerRunning = false; + uint8_t bleDiscoveryTimer = 0; + TimerHandle_t idleTimer; + bool doNotGoToSleep = false; - static void Process(void* instance); - void Work(); - void ReloadIdleTimer() const; - bool isBleDiscoveryTimerRunning = false; - uint8_t bleDiscoveryTimer = 0; - TimerHandle_t idleTimer; - bool doNotGoToSleep = false; - - void GoToRunning(); - void UpdateMotion(); - bool stepCounterMustBeReset = false; + void GoToRunning(); + void UpdateMotion(); + bool stepCounterMustBeReset = false; #if configUSE_TRACE_FACILITY == 1 - SystemMonitor monitor; + SystemMonitor monitor; #else - SystemMonitor monitor; + SystemMonitor monitor; #endif }; }