From f1719b3b928072cffbef117c8c6ff0c9c8a72eb8 Mon Sep 17 00:00:00 2001 From: Avamander Date: Sun, 27 Sep 2020 14:15:00 +0300 Subject: Added a few more folders to gitignore before they end up in the repository diff --git a/.gitignore b/.gitignore index 83554b6..3de0818 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,27 @@ .idea/ +# CMake cmake-build-*/ -**/CMakeCache.txt CMakeFiles/ +**/CMakeCache.txt +cmake_install.cmake +Makefile + +# Resulting binary files +*.a +*.so +*.s +*.hex +*.bin +*.map +*.out +pinetime*.cbp +# InfiniTime's files core sdk src/Version.h docker/post_build.sh +Testing/Temporary/ # Linux **/.directory -- cgit v0.10.2 From 5d3a9744938b38c064379c3f78ace5a7dd87926f Mon Sep 17 00:00:00 2001 From: JF Date: Sun, 27 Sep 2020 20:02:47 +0200 Subject: Add BatteryInformationService to expose the battery level to BLE host. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4032d7e..57dbe8b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -362,6 +362,7 @@ list(APPEND SOURCE_FILES Components/Ble/CurrentTimeService.cpp Components/Ble/AlertNotificationService.cpp Components/Ble/MusicService.cpp + Components/Ble/BatteryInformationService.cpp Components/FirmwareValidator/FirmwareValidator.cpp drivers/Cst816s.cpp FreeRTOS/port.c @@ -435,6 +436,7 @@ set(INCLUDE_FILES Components/Ble/AlertNotificationClient.h Components/Ble/DfuService.h Components/FirmwareValidator/FirmwareValidator.h + Components/Ble/BatteryInformationService.h drivers/Cst816s.h FreeRTOS/portmacro.h FreeRTOS/portmacro_cmsis.h diff --git a/src/Components/Battery/BatteryController.cpp b/src/Components/Battery/BatteryController.cpp index 198ce5a..571efae 100644 --- a/src/Components/Battery/BatteryController.cpp +++ b/src/Components/Battery/BatteryController.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "BatteryController.h" using namespace Pinetime::Controllers; @@ -34,7 +35,9 @@ void Battery::Update() { // see https://forum.pine64.org/showthread.php?tid=8147 voltage = (value * 2.0f) / (1024/3.0f); - percentRemaining = ((voltage - 3.55)*100)*3.9; + percentRemaining = ((voltage - 3.55f)*100.0f)*3.9f; + percentRemaining = std::max(percentRemaining, 0.0f); + percentRemaining = std::min(percentRemaining, 100.0f); // NRF_LOG_INFO("BATTERY " NRF_LOG_FLOAT_MARKER " %% - " NRF_LOG_FLOAT_MARKER " v", NRF_LOG_FLOAT(percentRemaining), NRF_LOG_FLOAT(voltage)); // NRF_LOG_INFO("POWER Charging : %d - Power : %d", isCharging, isPowerPresent); diff --git a/src/Components/Ble/BatteryInformationService.cpp b/src/Components/Ble/BatteryInformationService.cpp new file mode 100644 index 0000000..c86830b --- /dev/null +++ b/src/Components/Ble/BatteryInformationService.cpp @@ -0,0 +1,62 @@ +#include "BatteryInformationService.h" +#include "../Battery/BatteryController.h" + +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) { + 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 + }, + }{ + +} + +void BatteryInformationService::Init() { + int res = 0; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); +} + +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); + return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; + } + return 0; +} \ No newline at end of file diff --git a/src/Components/Ble/BatteryInformationService.h b/src/Components/Ble/BatteryInformationService.h new file mode 100644 index 0000000..74b2222 --- /dev/null +++ b/src/Components/Ble/BatteryInformationService.h @@ -0,0 +1,40 @@ +#pragma once +#include + +namespace Pinetime { + namespace System { + class SystemTask; + } + namespace Controllers { + class Battery; + class BatteryInformationService { + public: + BatteryInformationService(Controllers::Battery& batteryController); + void Init(); + + 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}; + + 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 + }; + + struct ble_gatt_chr_def characteristicDefinition[3]; + struct ble_gatt_svc_def serviceDefinition[2]; + + uint16_t batteryLevelHandle; + + }; + } +} diff --git a/src/Components/Ble/NimbleController.cpp b/src/Components/Ble/NimbleController.cpp index 7dde9d0..a8add0d 100644 --- a/src/Components/Ble/NimbleController.cpp +++ b/src/Components/Ble/NimbleController.cpp @@ -26,6 +26,7 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::Ble& bleController, DateTime& dateTimeController, Pinetime::Controllers::NotificationManager& notificationManager, + Controllers::Battery& batteryController, Pinetime::Drivers::SpiNorFlash& spiNorFlash) : systemTask{systemTask}, bleController{bleController}, @@ -37,7 +38,8 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask, anService{systemTask, notificationManager}, alertNotificationClient{systemTask, notificationManager}, currentTimeService{dateTimeController}, - musicService{systemTask} { + musicService{systemTask}, + batteryInformationService{batteryController} { } @@ -83,10 +85,9 @@ void NimbleController::Init() { currentTimeClient.Init(); currentTimeService.Init(); musicService.Init(); - anService.Init(); - dfuService.Init(); + batteryInformationService.Init(); int res; res = ble_hs_util_ensure_addr(0); ASSERT(res == 0); diff --git a/src/Components/Ble/NimbleController.h b/src/Components/Ble/NimbleController.h index 50b8b0b..2dee898 100644 --- a/src/Components/Ble/NimbleController.h +++ b/src/Components/Ble/NimbleController.h @@ -8,6 +8,7 @@ #include "DfuService.h" #include "CurrentTimeService.h" #include "MusicService.h" +#include "BatteryInformationService.h" #include namespace Pinetime { @@ -22,7 +23,7 @@ namespace Pinetime { public: NimbleController(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::Ble& bleController, DateTime& dateTimeController, Pinetime::Controllers::NotificationManager& notificationManager, - Pinetime::Drivers::SpiNorFlash& spiNorFlash); + Controllers::Battery& batteryController, Pinetime::Drivers::SpiNorFlash& spiNorFlash); void Init(); void StartAdvertising(); int OnGAPEvent(ble_gap_event *event); @@ -57,6 +58,7 @@ namespace Pinetime { AlertNotificationClient alertNotificationClient; CurrentTimeService currentTimeService; MusicService musicService; + BatteryInformationService batteryInformationService; uint8_t addrType; // 1 = Random, 0 = PUBLIC uint16_t connectionHandle = 0; diff --git a/src/SystemTask/SystemTask.cpp b/src/SystemTask/SystemTask.cpp index a4e6356..2070282 100644 --- a/src/SystemTask/SystemTask.cpp +++ b/src/SystemTask/SystemTask.cpp @@ -35,7 +35,7 @@ SystemTask::SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd, twiMaster{twiMaster}, touchPanel{touchPanel}, lvgl{lvgl}, batteryController{batteryController}, bleController{bleController}, dateTimeController{dateTimeController}, watchdog{}, watchdogView{watchdog}, notificationManager{notificationManager}, - nimbleController(*this, bleController,dateTimeController, notificationManager, spiNorFlash) { + nimbleController(*this, bleController,dateTimeController, notificationManager, batteryController, spiNorFlash) { systemTaksMsgQueue = xQueueCreate(10, 1); } -- cgit v0.10.2 From f3728c41bb311f3838dc9c10a2157a16196b4420 Mon Sep 17 00:00:00 2001 From: JF Date: Sun, 27 Sep 2020 20:59:06 +0200 Subject: Add Immediate Alert Service, needed by the "Find Me" profile from BLE spec. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 57dbe8b..eee1d61 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -363,6 +363,7 @@ list(APPEND SOURCE_FILES Components/Ble/AlertNotificationService.cpp Components/Ble/MusicService.cpp Components/Ble/BatteryInformationService.cpp + Components/Ble/ImmediateAlertService.cpp Components/FirmwareValidator/FirmwareValidator.cpp drivers/Cst816s.cpp FreeRTOS/port.c @@ -437,6 +438,7 @@ set(INCLUDE_FILES Components/Ble/DfuService.h Components/FirmwareValidator/FirmwareValidator.h Components/Ble/BatteryInformationService.h + Components/Ble/ImmediateAlertService.h drivers/Cst816s.h FreeRTOS/portmacro.h FreeRTOS/portmacro_cmsis.h diff --git a/src/Components/Ble/ImmediateAlertService.cpp b/src/Components/Ble/ImmediateAlertService.cpp new file mode 100644 index 0000000..d2c4cff --- /dev/null +++ b/src/Components/Ble/ImmediateAlertService.cpp @@ -0,0 +1,76 @@ +#include "ImmediateAlertService.h" +#include +#include "AlertNotificationService.h" + +using namespace Pinetime::Controllers; + +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); + 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 ""; + } + } +} + +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 + }, + }{ + +} + +void ImmediateAlertService::Init() { + int res = 0; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + 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) { + auto alertLevel = static_cast(context->om->om_data[0]); + auto* alertString = ToString(alertLevel); + notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, alertString, strlen(alertString)); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); + } + } + + return 0; +} \ No newline at end of file diff --git a/src/Components/Ble/ImmediateAlertService.h b/src/Components/Ble/ImmediateAlertService.h new file mode 100644 index 0000000..c42846c --- /dev/null +++ b/src/Components/Ble/ImmediateAlertService.h @@ -0,0 +1,46 @@ +#pragma once +#include + +namespace Pinetime { + namespace System { + class SystemTask; + } + namespace Controllers { + class NotificationManager; + class ImmediateAlertService { + 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); + + private: + Pinetime::System::SystemTask& systemTask; + NotificationManager& notificationManager; + + 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 alertLevelUuid { + .u {.type = BLE_UUID_TYPE_16}, + .value = alertLevelId + }; + + struct ble_gatt_chr_def characteristicDefinition[3]; + struct ble_gatt_svc_def serviceDefinition[2]; + + uint16_t alertLevelHandle; + }; + } +} diff --git a/src/Components/Ble/NimbleController.cpp b/src/Components/Ble/NimbleController.cpp index a8add0d..b13f9ce 100644 --- a/src/Components/Ble/NimbleController.cpp +++ b/src/Components/Ble/NimbleController.cpp @@ -39,7 +39,8 @@ NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask, alertNotificationClient{systemTask, notificationManager}, currentTimeService{dateTimeController}, musicService{systemTask}, - batteryInformationService{batteryController} { + batteryInformationService{batteryController}, + immediateAlertService{systemTask, notificationManager} { } @@ -88,6 +89,7 @@ void NimbleController::Init() { anService.Init(); dfuService.Init(); batteryInformationService.Init(); + immediateAlertService.Init(); int res; res = ble_hs_util_ensure_addr(0); ASSERT(res == 0); diff --git a/src/Components/Ble/NimbleController.h b/src/Components/Ble/NimbleController.h index 2dee898..89fa425 100644 --- a/src/Components/Ble/NimbleController.h +++ b/src/Components/Ble/NimbleController.h @@ -9,6 +9,7 @@ #include "CurrentTimeService.h" #include "MusicService.h" #include "BatteryInformationService.h" +#include "ImmediateAlertService.h" #include namespace Pinetime { @@ -59,6 +60,7 @@ namespace Pinetime { CurrentTimeService currentTimeService; MusicService musicService; BatteryInformationService batteryInformationService; + ImmediateAlertService immediateAlertService; uint8_t addrType; // 1 = Random, 0 = PUBLIC uint16_t connectionHandle = 0; -- cgit v0.10.2 From db2b2481306ee755a9789c00ca0b058b7976f467 Mon Sep 17 00:00:00 2001 From: JF Date: Mon, 28 Sep 2020 21:22:02 +0200 Subject: Add missing bootloader binary file. diff --git a/.gitignore b/.gitignore index 3de0818..e1d954b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ Makefile *.s *.hex *.bin +!bootloader/bootloader-5.0.4.bin *.map *.out pinetime*.cbp diff --git a/bootloader/bootloader-5.0.4.bin b/bootloader/bootloader-5.0.4.bin new file mode 100644 index 0000000..e175930 Binary files /dev/null and b/bootloader/bootloader-5.0.4.bin differ -- cgit v0.10.2 From e26a5afcac84734cf415d701586c612fdd56e628 Mon Sep 17 00:00:00 2001 From: JF002 Date: Mon, 28 Sep 2020 22:07:54 +0200 Subject: Add doc : using OpenOCD and STLinkV2 to flash the firmware diff --git a/README.md b/README.md index c377a51..3a1b7b5 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,7 @@ As of now, here is the list of achievements of this project: - [Versioning](doc/versioning.md) - [Files included in the release notes](doc/filesInReleaseNotes.md) - [Build the project](doc/buildAndProgram.md) + - [Flash the firmware using OpenOCD and STLinkV2](doc/openOCD.md) - [Build the project with Docker](doc/buildWithDocker.md) - [Bootloader, OTA and DFU](./bootloader/README.md) - [Stub using NRF52-DK](./doc/PinetimeStubWithNrf52DK.md) diff --git a/doc/openOCD.md b/doc/openOCD.md new file mode 100644 index 0000000..f70060b --- /dev/null +++ b/doc/openOCD.md @@ -0,0 +1,105 @@ +# OpenOCD and STLink +OpenOCD (**Open O**n **C**hip **D**ebugger) is an open source tool that interfaces with many SWD/JTAG debugger to provide debugging and *in-system* programming for embedded target devices. + +It supports the **NRF52** (the CPU of the PineTime) and the **STLinkV2**, a cheap SWD debugger. + +It works on X86 computers, as well as ARM/ARM64 computers and SBC (like the RaspberryPi and Pine64 Pinebook Pro) ! + +## Installation +We will build OpenOCD from sources, as packages from Linux distributions are most of the time outdated and do not support the NRF52 correctly. + + - Fetch the sources from GIT, and build and install it: + +``` +git clone https://^Ct.code.sf.net/p/openocd/code openocd-code + +cd openocd-code + +./bootstrap +./configure --enable-stlink +make -j 4 +sudo make install +``` + + - Configure UDEV to allow OpenOCD to open the interface to your STLinkV2: +``` +sudo cp contrib/60-openocd.rules /etc/udev/rules.d/ +sudo udevadm control --reload-rules +``` + + - You can now plug your STLinkV2 in a USB port and run OpenOCD to see if it's working correctly: + +``` +$ openocd -f interface/stlink.cfg -f target/nrf52.cfg +Open On-Chip Debugger 0.10.0+dev-01411-g051e80812-dirty (2020-09-28-20:16) +Licensed under GNU GPL v2 +For bug reports, read + http://openocd.org/doc/doxygen/bugs.html +Info : auto-selecting first available session transport "hla_swd". To override use 'transport select '. +Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD + +nRF52 device has a CTRL-AP dedicated to recover the device from AP lock. +A high level adapter (like a ST-Link) you are currently using cannot access +the CTRL-AP so 'nrf52_recover' command will not work. +Do not enable UICR APPROTECT. + +Info : Listening on port 6666 for tcl connections +Info : Listening on port 4444 for telnet connections +Info : clock speed 1000 kHz +Info : STLINK V2J34S7 (API v2) VID:PID 0483:3748 +Info : Target voltage: 3.294340 +Error: init mode failed (unable to connect to the target) +``` +Ok, OpenOCD is running and it detects my STLinkV2. The last error shows that I've not connected the STLinkV2 to the PineTime. + +## Configuration files +OpenOCD is configured using configuration files. +First, we need a common configuration file for the project : **openocd-stlink.ocd**: +``` +source [find interface/stlink.cfg] + +gdb_flash_program enable +gdb_breakpoint_override hard + +source [find target/nrf52.cfg] +``` +This file specifies to OpenOCD which debugger and target it will be connected to.. + +Then, we use various *user files* to use OpenOCD to flash InfiniTime binary files. + +This files flashes the bootloader and the application firmware : **flash_bootloader_app.ocd**: +``` +init + +program /bootloader.bin verify 0x00000000 +program /image-0.8.2.bin verify 0x00008000 + +reset +``` + +And this one flashes the graphics flasher (it writes the bootloader graphics into the SPI NOR flash memory) : **flash_graphics.ocd**: +``` +init + +program /pinetime-graphics-0.8.2.bin verify 0x00000000 + +reset +``` + +## Examples +### Flash bootloader and application +``` +openocd -f ./openocd-stlink.cfg -f ./flash_bootloader_app.ocd +``` + +### Flash graphics flasher +``` +openocd -f ./openocd-stlink.cfg -f ./flash_graphics.ocd +``` + +## Connect the STLinkV2 to the PineTime +Here is an example using the pogo pins: +![SWD pinout](../images/swd_pinout.jpg) +![Pogo pins](../images/pogopins.jpg) + +You can find more information about the SWD wiring [on the wiki](https://wiki.pine64.org/index.php?title=PineTime_devkit_wiring). \ No newline at end of file diff --git a/images/pogopins.jpg b/images/pogopins.jpg new file mode 100644 index 0000000..28a1c7f Binary files /dev/null and b/images/pogopins.jpg differ diff --git a/images/swd_pinout.jpg b/images/swd_pinout.jpg new file mode 100644 index 0000000..1545916 Binary files /dev/null and b/images/swd_pinout.jpg differ -- cgit v0.10.2 From 0e2a3d4394f832e83b816c958756562f75668512 Mon Sep 17 00:00:00 2001 From: JF Date: Mon, 28 Sep 2020 22:10:33 +0200 Subject: Fix typo diff --git a/doc/openOCD.md b/doc/openOCD.md index f70060b..a199bd7 100644 --- a/doc/openOCD.md +++ b/doc/openOCD.md @@ -11,7 +11,7 @@ We will build OpenOCD from sources, as packages from Linux distributions are mos - Fetch the sources from GIT, and build and install it: ``` -git clone https://^Ct.code.sf.net/p/openocd/code openocd-code +git clone https://git.code.sf.net/p/openocd/code openocd-code cd openocd-code -- cgit v0.10.2 From 9348f9936dc059bd77a70a34dd800635909ca792 Mon Sep 17 00:00:00 2001 From: Avamander Date: Fri, 2 Oct 2020 21:40:25 +0300 Subject: Renamed documentation folder for consistency diff --git a/doc/CompanionApps/Amazfish.md b/doc/CompanionApps/Amazfish.md deleted file mode 100644 index eb9daa0..0000000 --- a/doc/CompanionApps/Amazfish.md +++ /dev/null @@ -1,15 +0,0 @@ -# Amazfish -[Amazfish](https://openrepos.net/content/piggz/amazfish) is a companion app that supports many smartwatches and activity trackers running on [SailfishOS](https://sailfishos.org/). - -## Features -The following features are implemented: - - Scanning & detection of Pinetime-JF / InfiniTime - - Connection / disconnection - - Time synchronization - - Notifications - - Music control - -## Demo -[This video](https://seafile.codingfield.com/f/21c5d023452740279e36/) shows how to connect to the Pinetime and control the playback of the music on the phone. -Amazfish and Sailfish OS are running on the [Pinephone](https://www.pine64.org/pinephone/), another awesome device from Pine64. - \ No newline at end of file diff --git a/doc/CompanionApps/Gadgetbridge.md b/doc/CompanionApps/Gadgetbridge.md deleted file mode 100644 index 1a25069..0000000 --- a/doc/CompanionApps/Gadgetbridge.md +++ /dev/null @@ -1,13 +0,0 @@ -# Integration with Gadgetbridge -[Gadgetbridge](https://gadgetbridge.org/) is an Android application that supports many smartwatches and fitness trackers. - -The integration of InfiniTime (previously Pinetime-JF) is now merged into the master branch (https://codeberg.org/Freeyourgadget/Gadgetbridge/). - -## Features -The following features are implemented: - - Scanning & detection of Pinetime-JF / InfiniTime - - Connection / disconnection - - Notifications - -## Demo -[This video](https://seafile.codingfield.com/f/0a2920b9d765462385e4/) shows how to scan, connect, send notification (using the debug screen) and disconnect from the Pinetime. diff --git a/doc/CompanionApps/NrfconnectOTA.md b/doc/CompanionApps/NrfconnectOTA.md deleted file mode 100644 index 0fa3cd0..0000000 --- a/doc/CompanionApps/NrfconnectOTA.md +++ /dev/null @@ -1,12 +0,0 @@ -# OTA using NRFConnect -[NRFConnect](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Connect-for-mobile) is a powerful application (running on Android and iOS) which allows to scan and connect to BLE devices. - -## Features - - Scanning, connect, disconnect - - Time synchronization - - OTA - -InfiniTime implements the Nordic DFU protocol for the OTA functionality. NRFConnect also supports this protocol. - -# Demo -[This video](https://seafile.codingfield.com/f/a52b69683a05472a90c7/) shows how to use NRFConnect to update the firmware running on the Pinetime. \ No newline at end of file diff --git a/doc/CompanionApps/firmwareNoValidated.jpg b/doc/CompanionApps/firmwareNoValidated.jpg deleted file mode 100644 index 28df7ea..0000000 Binary files a/doc/CompanionApps/firmwareNoValidated.jpg and /dev/null differ diff --git a/doc/CompanionApps/firmwareValidated.jpg b/doc/CompanionApps/firmwareValidated.jpg deleted file mode 100644 index 0d6f99b..0000000 Binary files a/doc/CompanionApps/firmwareValidated.jpg and /dev/null differ diff --git a/doc/CompanionApps/firmwareValidationApp.jpg b/doc/CompanionApps/firmwareValidationApp.jpg deleted file mode 100644 index d78ad0c..0000000 Binary files a/doc/CompanionApps/firmwareValidationApp.jpg and /dev/null differ diff --git a/doc/companionapps/Amazfish.md b/doc/companionapps/Amazfish.md new file mode 100644 index 0000000..eb9daa0 --- /dev/null +++ b/doc/companionapps/Amazfish.md @@ -0,0 +1,15 @@ +# Amazfish +[Amazfish](https://openrepos.net/content/piggz/amazfish) is a companion app that supports many smartwatches and activity trackers running on [SailfishOS](https://sailfishos.org/). + +## Features +The following features are implemented: + - Scanning & detection of Pinetime-JF / InfiniTime + - Connection / disconnection + - Time synchronization + - Notifications + - Music control + +## Demo +[This video](https://seafile.codingfield.com/f/21c5d023452740279e36/) shows how to connect to the Pinetime and control the playback of the music on the phone. +Amazfish and Sailfish OS are running on the [Pinephone](https://www.pine64.org/pinephone/), another awesome device from Pine64. + \ No newline at end of file diff --git a/doc/companionapps/Gadgetbridge.md b/doc/companionapps/Gadgetbridge.md new file mode 100644 index 0000000..1a25069 --- /dev/null +++ b/doc/companionapps/Gadgetbridge.md @@ -0,0 +1,13 @@ +# Integration with Gadgetbridge +[Gadgetbridge](https://gadgetbridge.org/) is an Android application that supports many smartwatches and fitness trackers. + +The integration of InfiniTime (previously Pinetime-JF) is now merged into the master branch (https://codeberg.org/Freeyourgadget/Gadgetbridge/). + +## Features +The following features are implemented: + - Scanning & detection of Pinetime-JF / InfiniTime + - Connection / disconnection + - Notifications + +## Demo +[This video](https://seafile.codingfield.com/f/0a2920b9d765462385e4/) shows how to scan, connect, send notification (using the debug screen) and disconnect from the Pinetime. diff --git a/doc/companionapps/NrfconnectOTA.md b/doc/companionapps/NrfconnectOTA.md new file mode 100644 index 0000000..0fa3cd0 --- /dev/null +++ b/doc/companionapps/NrfconnectOTA.md @@ -0,0 +1,12 @@ +# OTA using NRFConnect +[NRFConnect](https://www.nordicsemi.com/Software-and-tools/Development-Tools/nRF-Connect-for-mobile) is a powerful application (running on Android and iOS) which allows to scan and connect to BLE devices. + +## Features + - Scanning, connect, disconnect + - Time synchronization + - OTA + +InfiniTime implements the Nordic DFU protocol for the OTA functionality. NRFConnect also supports this protocol. + +# Demo +[This video](https://seafile.codingfield.com/f/a52b69683a05472a90c7/) shows how to use NRFConnect to update the firmware running on the Pinetime. \ No newline at end of file diff --git a/doc/companionapps/firmwareNoValidated.jpg b/doc/companionapps/firmwareNoValidated.jpg new file mode 100644 index 0000000..28df7ea Binary files /dev/null and b/doc/companionapps/firmwareNoValidated.jpg differ diff --git a/doc/companionapps/firmwareValidated.jpg b/doc/companionapps/firmwareValidated.jpg new file mode 100644 index 0000000..0d6f99b Binary files /dev/null and b/doc/companionapps/firmwareValidated.jpg differ diff --git a/doc/companionapps/firmwareValidationApp.jpg b/doc/companionapps/firmwareValidationApp.jpg new file mode 100644 index 0000000..d78ad0c Binary files /dev/null and b/doc/companionapps/firmwareValidationApp.jpg differ -- cgit v0.10.2 From 455d8319e4af521de4e24cfa423a4c06c4378a8d Mon Sep 17 00:00:00 2001 From: Avamander Date: Fri, 2 Oct 2020 21:43:30 +0300 Subject: Reformatted the CMakeLists for consistency diff --git a/CMakeLists.txt b/CMakeLists.txt index f65a439..5346ccf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(pinetime VERSION 0.8.2 LANGUAGES C CXX ASM) set(NRF_TARGET "nrf52") if (NOT ARM_NONE_EABI_TOOLCHAIN_PATH) - message(FATAL_ERROR "The path to the toolchain (arm-non-eabi) must be specified on the command line (add -DARM_NONE_EABI_TOOLCHAIN_PATH=") + message(FATAL_ERROR "The path to the toolchain (arm-none-eabi) must be specified on the command line (add -DARM_NONE_EABI_TOOLCHAIN_PATH=") endif () if (NOT NRF5_SDK_PATH) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eee1d61..1b5cdcb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,20 +10,20 @@ set(NRF_BOARD pca10040) if (NOT NRF5_SDK_PATH) message(FATAL_ERROR "The path to the nRF5 SDK (NRF5_SDK_PATH) must be set.") endif () -if(DEFINED ARM_NONE_EABI_TOOLCHAIN_PATH) +if (DEFINED ARM_NONE_EABI_TOOLCHAIN_PATH) set(ARM_NONE_EABI_TOOLCHAIN_BIN_PATH ${ARM_NONE_EABI_TOOLCHAIN_PATH}/bin) -endif() +endif () if (NOT NRF_TARGET MATCHES "nrf52") message(FATAL_ERROR "Only rRF52 boards are supported right now") -endif() +endif () # Setup toolchain include(${CMAKE_SOURCE_DIR}/cmake-nRF5x/arm-gcc-toolchain.cmake) -if(NOT DEFINED ARM_GCC_TOOLCHAIN) +if (NOT DEFINED ARM_GCC_TOOLCHAIN) message(FATAL_ERROR "The toolchain must be set up before calling this macro") -endif() +endif () set(CMAKE_OSX_SYSROOT "/") set(CMAKE_OSX_DEPLOYMENT_TARGET "") @@ -84,399 +84,399 @@ set(SDK_SOURCE_FILES # GPIOTE "${NRF5_SDK_PATH}/components/libraries/gpiote/app_gpiote.c" -) + ) set(TINYCRYPT_SRC - libs/mynewt-nimble/ext/tinycrypt/src/aes_encrypt.c - libs/mynewt-nimble/ext/tinycrypt/src/utils.c - ) + libs/mynewt-nimble/ext/tinycrypt/src/aes_encrypt.c + libs/mynewt-nimble/ext/tinycrypt/src/utils.c + ) set(NIMBLE_SRC - libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c - libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c - libs/mynewt-nimble/nimble/host/src/ble_hs.c - libs/mynewt-nimble/nimble/host/src/ble_hs_hci_evt.c - libs/mynewt-nimble/nimble/host/src/ble_l2cap_sig_cmd.c - libs/mynewt-nimble/nimble/host/src/ble_l2cap_sig.c - libs/mynewt-nimble/nimble/host/src/ble_l2cap.c - libs/mynewt-nimble/nimble/host/src/ble_hs_mbuf.c - libs/mynewt-nimble/nimble/host/src/ble_sm.c - libs/mynewt-nimble/nimble/host/src/ble_gap.c - libs/mynewt-nimble/nimble/host/src/ble_gatts.c - libs/mynewt-nimble/nimble/host/src/ble_gattc.c - libs/mynewt-nimble/nimble/host/src/ble_hs_conn.c - libs/mynewt-nimble/nimble/host/src/ble_att_svr.c - libs/mynewt-nimble/nimble/host/src/ble_store.c - libs/mynewt-nimble/nimble/host/src/ble_store_util.c - libs/mynewt-nimble/nimble/host/src/ble_hs_pvcy.c - libs/mynewt-nimble/nimble/host/src/ble_hs_hci.c - libs/mynewt-nimble/nimble/host/src/ble_hs_log.c - libs/mynewt-nimble/nimble/host/src/ble_hs_hci_util.c - libs/mynewt-nimble/nimble/host/src/ble_hs_hci_cmd.c - libs/mynewt-nimble/nimble/host/src/ble_hs_cfg.c - libs/mynewt-nimble/nimble/host/src/ble_uuid.c - libs/mynewt-nimble/nimble/host/src/ble_hs_id.c - libs/mynewt-nimble/nimble/host/src/ble_hs_misc.c - libs/mynewt-nimble/nimble/host/src/ble_att.c - libs/mynewt-nimble/nimble/host/src/ble_att_clt.c - libs/mynewt-nimble/nimble/host/src/ble_att_svr.c - libs/mynewt-nimble/nimble/host/src/ble_att_cmd.c - libs/mynewt-nimble/nimble/host/src/ble_hs_atomic.c - libs/mynewt-nimble/nimble/host/src/ble_hs_adv.c - libs/mynewt-nimble/nimble/host/src/ble_hs_flow.c - libs/mynewt-nimble/nimble/host/src/ble_sm.c - libs/mynewt-nimble/nimble/host/src/ble_sm_cmd.c - libs/mynewt-nimble/nimble/host/src/ble_sm_lgcy.c - libs/mynewt-nimble/nimble/host/src/ble_sm_alg.c - libs/mynewt-nimble/nimble/host/src/ble_hs_mqueue.c - libs/mynewt-nimble/nimble/host/src/ble_hs_stop.c - libs/mynewt-nimble/nimble/host/src/ble_hs_startup.c - libs/mynewt-nimble/nimble/host/store/ram/src/ble_store_ram.c - libs/mynewt-nimble/nimble/host/src/ble_monitor.c - libs/mynewt-nimble/nimble/transport/ram/src/ble_hci_ram.c - libs/mynewt-nimble/nimble/controller/src/ble_ll.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_rand.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_conn.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_ctrl.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_hci.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_conn_hci.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_utils.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_scan.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_whitelist.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_adv.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_sched.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_supp_cmd.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_hci_ev.c - libs/mynewt-nimble/nimble/controller/src/ble_ll_rfmgmt.c - libs/mynewt-nimble/porting/nimble/src/os_cputime.c - libs/mynewt-nimble/porting/nimble/src/os_cputime_pwr2.c - libs/mynewt-nimble/porting/nimble/src/os_mbuf.c - libs/mynewt-nimble/porting/nimble/src/os_mempool.c - libs/mynewt-nimble/porting/nimble/src/hal_timer.c - libs/mynewt-nimble/porting/nimble/src/mem.c - libs/mynewt-nimble/porting/nimble/src/endian.c - libs/mynewt-nimble/porting/nimble/src/os_msys_init.c - libs/mynewt-nimble/nimble/drivers/nrf52/src/ble_hw.c - libs/mynewt-nimble/nimble/drivers/nrf52/src/ble_phy.c - libs/mynewt-nimble/nimble/host/services/gap/src/ble_svc_gap.c - libs/mynewt-nimble/nimble/host/services/gatt/src/ble_svc_gatt.c - libs/mynewt-nimble/nimble/host/util/src/addr.c - ) + libs/mynewt-nimble/porting/npl/freertos/src/nimble_port_freertos.c + libs/mynewt-nimble/porting/npl/freertos/src/npl_os_freertos.c + libs/mynewt-nimble/nimble/host/src/ble_hs.c + libs/mynewt-nimble/nimble/host/src/ble_hs_hci_evt.c + libs/mynewt-nimble/nimble/host/src/ble_l2cap_sig_cmd.c + libs/mynewt-nimble/nimble/host/src/ble_l2cap_sig.c + libs/mynewt-nimble/nimble/host/src/ble_l2cap.c + libs/mynewt-nimble/nimble/host/src/ble_hs_mbuf.c + libs/mynewt-nimble/nimble/host/src/ble_sm.c + libs/mynewt-nimble/nimble/host/src/ble_gap.c + libs/mynewt-nimble/nimble/host/src/ble_gatts.c + libs/mynewt-nimble/nimble/host/src/ble_gattc.c + libs/mynewt-nimble/nimble/host/src/ble_hs_conn.c + libs/mynewt-nimble/nimble/host/src/ble_att_svr.c + libs/mynewt-nimble/nimble/host/src/ble_store.c + libs/mynewt-nimble/nimble/host/src/ble_store_util.c + libs/mynewt-nimble/nimble/host/src/ble_hs_pvcy.c + libs/mynewt-nimble/nimble/host/src/ble_hs_hci.c + libs/mynewt-nimble/nimble/host/src/ble_hs_log.c + libs/mynewt-nimble/nimble/host/src/ble_hs_hci_util.c + libs/mynewt-nimble/nimble/host/src/ble_hs_hci_cmd.c + libs/mynewt-nimble/nimble/host/src/ble_hs_cfg.c + libs/mynewt-nimble/nimble/host/src/ble_uuid.c + libs/mynewt-nimble/nimble/host/src/ble_hs_id.c + libs/mynewt-nimble/nimble/host/src/ble_hs_misc.c + libs/mynewt-nimble/nimble/host/src/ble_att.c + libs/mynewt-nimble/nimble/host/src/ble_att_clt.c + libs/mynewt-nimble/nimble/host/src/ble_att_svr.c + libs/mynewt-nimble/nimble/host/src/ble_att_cmd.c + libs/mynewt-nimble/nimble/host/src/ble_hs_atomic.c + libs/mynewt-nimble/nimble/host/src/ble_hs_adv.c + libs/mynewt-nimble/nimble/host/src/ble_hs_flow.c + libs/mynewt-nimble/nimble/host/src/ble_sm.c + libs/mynewt-nimble/nimble/host/src/ble_sm_cmd.c + libs/mynewt-nimble/nimble/host/src/ble_sm_lgcy.c + libs/mynewt-nimble/nimble/host/src/ble_sm_alg.c + libs/mynewt-nimble/nimble/host/src/ble_hs_mqueue.c + libs/mynewt-nimble/nimble/host/src/ble_hs_stop.c + libs/mynewt-nimble/nimble/host/src/ble_hs_startup.c + libs/mynewt-nimble/nimble/host/store/ram/src/ble_store_ram.c + libs/mynewt-nimble/nimble/host/src/ble_monitor.c + libs/mynewt-nimble/nimble/transport/ram/src/ble_hci_ram.c + libs/mynewt-nimble/nimble/controller/src/ble_ll.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_rand.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_conn.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_ctrl.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_hci.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_conn_hci.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_utils.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_scan.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_whitelist.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_adv.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_sched.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_supp_cmd.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_hci_ev.c + libs/mynewt-nimble/nimble/controller/src/ble_ll_rfmgmt.c + libs/mynewt-nimble/porting/nimble/src/os_cputime.c + libs/mynewt-nimble/porting/nimble/src/os_cputime_pwr2.c + libs/mynewt-nimble/porting/nimble/src/os_mbuf.c + libs/mynewt-nimble/porting/nimble/src/os_mempool.c + libs/mynewt-nimble/porting/nimble/src/hal_timer.c + libs/mynewt-nimble/porting/nimble/src/mem.c + libs/mynewt-nimble/porting/nimble/src/endian.c + libs/mynewt-nimble/porting/nimble/src/os_msys_init.c + libs/mynewt-nimble/nimble/drivers/nrf52/src/ble_hw.c + libs/mynewt-nimble/nimble/drivers/nrf52/src/ble_phy.c + libs/mynewt-nimble/nimble/host/services/gap/src/ble_svc_gap.c + libs/mynewt-nimble/nimble/host/services/gatt/src/ble_svc_gatt.c + libs/mynewt-nimble/nimble/host/util/src/addr.c + ) set(LVGL_SRC - libs/lv_conf.h - libs/lvgl/lvgl.h - libs/lvgl/src/lv_core/lv_obj.c - libs/lvgl/src/lv_core/lv_obj.h - libs/lvgl/src/lv_core/lv_group.c - libs/lvgl/src/lv_core/lv_group.h - libs/lvgl/src/lv_core/lv_disp.c - libs/lvgl/src/lv_core/lv_disp.h - libs/lvgl/src/lv_core/lv_debug.h - libs/lvgl/src/lv_core/lv_debug.c - libs/lvgl/src/lv_core/lv_indev.c - libs/lvgl/src/lv_core/lv_indev.h - libs/lvgl/src/lv_core/lv_refr.c - libs/lvgl/src/lv_core/lv_refr.h - libs/lvgl/src/lv_core/lv_style.c - libs/lvgl/src/lv_core/lv_style.h - libs/lvgl/src/lv_misc/lv_anim.c - libs/lvgl/src/lv_misc/lv_anim.h - libs/lvgl/src/lv_misc/lv_async.h - libs/lvgl/src/lv_misc/lv_async.c - libs/lvgl/src/lv_misc/lv_fs.c - libs/lvgl/src/lv_misc/lv_fs.h - libs/lvgl/src/lv_misc/lv_task.c - libs/lvgl/src/lv_misc/lv_task.h - libs/lvgl/src/lv_misc/lv_area.c - libs/lvgl/src/lv_misc/lv_area.h - libs/lvgl/src/lv_misc/lv_bidi.c - libs/lvgl/src/lv_misc/lv_bidi.h - libs/lvgl/src/lv_misc/lv_circ.c - libs/lvgl/src/lv_misc/lv_circ.h - libs/lvgl/src/lv_misc/lv_color.c - libs/lvgl/src/lv_misc/lv_color.h - libs/lvgl/src/lv_misc/lv_fs.c - libs/lvgl/src/lv_misc/lv_fs.h - libs/lvgl/src/lv_misc/lv_gc.c - libs/lvgl/src/lv_misc/lv_gc.h - libs/lvgl/src/lv_misc/lv_ll.c - libs/lvgl/src/lv_misc/lv_ll.h - libs/lvgl/src/lv_misc/lv_log.c - libs/lvgl/src/lv_misc/lv_log.h - libs/lvgl/src/lv_misc/lv_math.c - libs/lvgl/src/lv_misc/lv_math.h - libs/lvgl/src/lv_misc/lv_mem.c - libs/lvgl/src/lv_misc/lv_mem.h - libs/lvgl/src/lv_misc/lv_printf.c - libs/lvgl/src/lv_misc/lv_printf.h - libs/lvgl/src/lv_misc/lv_task.c - libs/lvgl/src/lv_misc/lv_task.h - libs/lvgl/src/lv_misc/lv_templ.c - libs/lvgl/src/lv_misc/lv_templ.h - libs/lvgl/src/lv_misc/lv_txt.c - libs/lvgl/src/lv_misc/lv_txt.h - libs/lvgl/src/lv_misc/lv_types.h - libs/lvgl/src/lv_misc/lv_utils.c - libs/lvgl/src/lv_misc/lv_utils.h - libs/lvgl/src/lv_draw/lv_draw.c - libs/lvgl/src/lv_draw/lv_draw.h - libs/lvgl/src/lv_draw/lv_draw_arc.c - libs/lvgl/src/lv_draw/lv_draw_arc.h - libs/lvgl/src/lv_draw/lv_draw_basic.c - libs/lvgl/src/lv_draw/lv_draw_basic.h - libs/lvgl/src/lv_draw/lv_draw_img.c - libs/lvgl/src/lv_draw/lv_draw_img.h - libs/lvgl/src/lv_draw/lv_draw_label.c - libs/lvgl/src/lv_draw/lv_draw_label.h - libs/lvgl/src/lv_draw/lv_draw_line.c - libs/lvgl/src/lv_draw/lv_draw_line.h - libs/lvgl/src/lv_draw/lv_draw_rect.c - libs/lvgl/src/lv_draw/lv_draw_rect.h - libs/lvgl/src/lv_draw/lv_draw_triangle.c - libs/lvgl/src/lv_draw/lv_draw_triangle.h - libs/lvgl/src/lv_draw/lv_img_cache.c - libs/lvgl/src/lv_draw/lv_img_cache.h - libs/lvgl/src/lv_draw/lv_img_decoder.c - libs/lvgl/src/lv_draw/lv_img_decoder.h - libs/lvgl/src/lv_hal/lv_hal.h - libs/lvgl/src/lv_hal/lv_hal_disp.c - libs/lvgl/src/lv_hal/lv_hal_disp.h - libs/lvgl/src/lv_hal/lv_hal_indev.c - libs/lvgl/src/lv_hal/lv_hal_indev.h - libs/lvgl/src/lv_hal/lv_hal_tick.c - libs/lvgl/src/lv_hal/lv_hal_tick.h - libs/lvgl/src/lv_font/lv_font.c - libs/lvgl/src/lv_font/lv_font.h - libs/lvgl/src/lv_font/lv_font_fmt_txt.c - libs/lvgl/src/lv_font/lv_font_fmt_txt.h - libs/lvgl/src/lv_font/lv_symbol_def.h - libs/lvgl/src/lv_themes/lv_theme.c - libs/lvgl/src/lv_themes/lv_theme.h - libs/lvgl/src/lv_objx/lv_btn.h - libs/lvgl/src/lv_objx/lv_btn.c - libs/lvgl/src/lv_objx/lv_cont.h - libs/lvgl/src/lv_objx/lv_cont.c - libs/lvgl/src/lv_objx/lv_label.h - libs/lvgl/src/lv_objx/lv_label.c - libs/lvgl/src/lv_themes/lv_theme.c - libs/lvgl/src/lv_themes/lv_theme.h - libs/lvgl/src/lv_themes/lv_theme_night.h - libs/lvgl/src/lv_themes/lv_theme_night.c - libs/lvgl/src/lv_objx/lv_list.c - libs/lvgl/src/lv_objx/lv_list.h - libs/lvgl/src/lv_objx/lv_tileview.c - libs/lvgl/src/lv_objx/lv_tileview.h - libs/lvgl/src/lv_objx/lv_tabview.c - libs/lvgl/src/lv_objx/lv_tabview.h - libs/lvgl/src/lv_objx/lv_btnm.c - libs/lvgl/src/lv_objx/lv_btnm.h - libs/lvgl/src/lv_objx/lv_page.c - libs/lvgl/src/lv_objx/lv_page.h - libs/lvgl/src/lv_objx/lv_img.c - libs/lvgl/src/lv_objx/lv_img.h - libs/lvgl/src/lv_objx/lv_lmeter.c - libs/lvgl/src/lv_objx/lv_lmeter.h - libs/lvgl/src/lv_objx/lv_arc.c - libs/lvgl/src/lv_objx/lv_arc.h - libs/lvgl/src/lv_objx/lv_gauge.c - libs/lvgl/src/lv_objx/lv_gauge.h - libs/lvgl/src/lv_objx/lv_mbox.c - libs/lvgl/src/lv_objx/lv_mbox.h - libs/lvgl/src/lv_objx/lv_bar.c - libs/lvgl/src/lv_objx/lv_bar.h - libs/lvgl/src/lv_objx/lv_slider.h - libs/lvgl/src/lv_objx/lv_slider.c - libs/lvgl/src/lv_objx/lv_ddlist.c - libs/lvgl/src/lv_objx/lv_ddlist.h - ) + libs/lv_conf.h + libs/lvgl/lvgl.h + libs/lvgl/src/lv_core/lv_obj.c + libs/lvgl/src/lv_core/lv_obj.h + libs/lvgl/src/lv_core/lv_group.c + libs/lvgl/src/lv_core/lv_group.h + libs/lvgl/src/lv_core/lv_disp.c + libs/lvgl/src/lv_core/lv_disp.h + libs/lvgl/src/lv_core/lv_debug.h + libs/lvgl/src/lv_core/lv_debug.c + libs/lvgl/src/lv_core/lv_indev.c + libs/lvgl/src/lv_core/lv_indev.h + libs/lvgl/src/lv_core/lv_refr.c + libs/lvgl/src/lv_core/lv_refr.h + libs/lvgl/src/lv_core/lv_style.c + libs/lvgl/src/lv_core/lv_style.h + libs/lvgl/src/lv_misc/lv_anim.c + libs/lvgl/src/lv_misc/lv_anim.h + libs/lvgl/src/lv_misc/lv_async.h + libs/lvgl/src/lv_misc/lv_async.c + libs/lvgl/src/lv_misc/lv_fs.c + libs/lvgl/src/lv_misc/lv_fs.h + libs/lvgl/src/lv_misc/lv_task.c + libs/lvgl/src/lv_misc/lv_task.h + libs/lvgl/src/lv_misc/lv_area.c + libs/lvgl/src/lv_misc/lv_area.h + libs/lvgl/src/lv_misc/lv_bidi.c + libs/lvgl/src/lv_misc/lv_bidi.h + libs/lvgl/src/lv_misc/lv_circ.c + libs/lvgl/src/lv_misc/lv_circ.h + libs/lvgl/src/lv_misc/lv_color.c + libs/lvgl/src/lv_misc/lv_color.h + libs/lvgl/src/lv_misc/lv_fs.c + libs/lvgl/src/lv_misc/lv_fs.h + libs/lvgl/src/lv_misc/lv_gc.c + libs/lvgl/src/lv_misc/lv_gc.h + libs/lvgl/src/lv_misc/lv_ll.c + libs/lvgl/src/lv_misc/lv_ll.h + libs/lvgl/src/lv_misc/lv_log.c + libs/lvgl/src/lv_misc/lv_log.h + libs/lvgl/src/lv_misc/lv_math.c + libs/lvgl/src/lv_misc/lv_math.h + libs/lvgl/src/lv_misc/lv_mem.c + libs/lvgl/src/lv_misc/lv_mem.h + libs/lvgl/src/lv_misc/lv_printf.c + libs/lvgl/src/lv_misc/lv_printf.h + libs/lvgl/src/lv_misc/lv_task.c + libs/lvgl/src/lv_misc/lv_task.h + libs/lvgl/src/lv_misc/lv_templ.c + libs/lvgl/src/lv_misc/lv_templ.h + libs/lvgl/src/lv_misc/lv_txt.c + libs/lvgl/src/lv_misc/lv_txt.h + libs/lvgl/src/lv_misc/lv_types.h + libs/lvgl/src/lv_misc/lv_utils.c + libs/lvgl/src/lv_misc/lv_utils.h + libs/lvgl/src/lv_draw/lv_draw.c + libs/lvgl/src/lv_draw/lv_draw.h + libs/lvgl/src/lv_draw/lv_draw_arc.c + libs/lvgl/src/lv_draw/lv_draw_arc.h + libs/lvgl/src/lv_draw/lv_draw_basic.c + libs/lvgl/src/lv_draw/lv_draw_basic.h + libs/lvgl/src/lv_draw/lv_draw_img.c + libs/lvgl/src/lv_draw/lv_draw_img.h + libs/lvgl/src/lv_draw/lv_draw_label.c + libs/lvgl/src/lv_draw/lv_draw_label.h + libs/lvgl/src/lv_draw/lv_draw_line.c + libs/lvgl/src/lv_draw/lv_draw_line.h + libs/lvgl/src/lv_draw/lv_draw_rect.c + libs/lvgl/src/lv_draw/lv_draw_rect.h + libs/lvgl/src/lv_draw/lv_draw_triangle.c + libs/lvgl/src/lv_draw/lv_draw_triangle.h + libs/lvgl/src/lv_draw/lv_img_cache.c + libs/lvgl/src/lv_draw/lv_img_cache.h + libs/lvgl/src/lv_draw/lv_img_decoder.c + libs/lvgl/src/lv_draw/lv_img_decoder.h + libs/lvgl/src/lv_hal/lv_hal.h + libs/lvgl/src/lv_hal/lv_hal_disp.c + libs/lvgl/src/lv_hal/lv_hal_disp.h + libs/lvgl/src/lv_hal/lv_hal_indev.c + libs/lvgl/src/lv_hal/lv_hal_indev.h + libs/lvgl/src/lv_hal/lv_hal_tick.c + libs/lvgl/src/lv_hal/lv_hal_tick.h + libs/lvgl/src/lv_font/lv_font.c + libs/lvgl/src/lv_font/lv_font.h + libs/lvgl/src/lv_font/lv_font_fmt_txt.c + libs/lvgl/src/lv_font/lv_font_fmt_txt.h + libs/lvgl/src/lv_font/lv_symbol_def.h + libs/lvgl/src/lv_themes/lv_theme.c + libs/lvgl/src/lv_themes/lv_theme.h + libs/lvgl/src/lv_objx/lv_btn.h + libs/lvgl/src/lv_objx/lv_btn.c + libs/lvgl/src/lv_objx/lv_cont.h + libs/lvgl/src/lv_objx/lv_cont.c + libs/lvgl/src/lv_objx/lv_label.h + libs/lvgl/src/lv_objx/lv_label.c + libs/lvgl/src/lv_themes/lv_theme.c + libs/lvgl/src/lv_themes/lv_theme.h + libs/lvgl/src/lv_themes/lv_theme_night.h + libs/lvgl/src/lv_themes/lv_theme_night.c + libs/lvgl/src/lv_objx/lv_list.c + libs/lvgl/src/lv_objx/lv_list.h + libs/lvgl/src/lv_objx/lv_tileview.c + libs/lvgl/src/lv_objx/lv_tileview.h + libs/lvgl/src/lv_objx/lv_tabview.c + libs/lvgl/src/lv_objx/lv_tabview.h + libs/lvgl/src/lv_objx/lv_btnm.c + libs/lvgl/src/lv_objx/lv_btnm.h + libs/lvgl/src/lv_objx/lv_page.c + libs/lvgl/src/lv_objx/lv_page.h + libs/lvgl/src/lv_objx/lv_img.c + libs/lvgl/src/lv_objx/lv_img.h + libs/lvgl/src/lv_objx/lv_lmeter.c + libs/lvgl/src/lv_objx/lv_lmeter.h + libs/lvgl/src/lv_objx/lv_arc.c + libs/lvgl/src/lv_objx/lv_arc.h + libs/lvgl/src/lv_objx/lv_gauge.c + libs/lvgl/src/lv_objx/lv_gauge.h + libs/lvgl/src/lv_objx/lv_mbox.c + libs/lvgl/src/lv_objx/lv_mbox.h + libs/lvgl/src/lv_objx/lv_bar.c + libs/lvgl/src/lv_objx/lv_bar.h + libs/lvgl/src/lv_objx/lv_slider.h + libs/lvgl/src/lv_objx/lv_slider.c + libs/lvgl/src/lv_objx/lv_ddlist.c + libs/lvgl/src/lv_objx/lv_ddlist.h + ) list(APPEND IMAGE_FILES - DisplayApp/Icons/battery/os_battery_error.c - DisplayApp/Icons/battery/os_battery_100.c - DisplayApp/Icons/battery/os_battery_090.c - DisplayApp/Icons/battery/os_battery_080.c - DisplayApp/Icons/battery/os_battery_070.c - DisplayApp/Icons/battery/os_battery_060.c - DisplayApp/Icons/battery/os_battery_050.c - DisplayApp/Icons/battery/os_battery_040.c - DisplayApp/Icons/battery/os_battery_030.c - DisplayApp/Icons/battery/os_battery_020.c - DisplayApp/Icons/battery/os_battery_010.c - DisplayApp/Icons/battery/os_battery_005.c - - DisplayApp/Icons/battery/os_batterycharging_100.c - DisplayApp/Icons/battery/os_batterycharging_090.c - DisplayApp/Icons/battery/os_batterycharging_080.c - DisplayApp/Icons/battery/os_batterycharging_070.c - DisplayApp/Icons/battery/os_batterycharging_060.c - DisplayApp/Icons/battery/os_batterycharging_050.c - DisplayApp/Icons/battery/os_batterycharging_040.c - DisplayApp/Icons/battery/os_batterycharging_030.c - DisplayApp/Icons/battery/os_batterycharging_020.c - DisplayApp/Icons/battery/os_batterycharging_010.c - DisplayApp/Icons/battery/os_batterycharging_005.c - - DisplayApp/Icons/bluetooth/os_bt_connected.c - DisplayApp/Icons/bluetooth/os_bt_disconnected.c - ) + DisplayApp/Icons/battery/os_battery_error.c + DisplayApp/Icons/battery/os_battery_100.c + DisplayApp/Icons/battery/os_battery_090.c + DisplayApp/Icons/battery/os_battery_080.c + DisplayApp/Icons/battery/os_battery_070.c + DisplayApp/Icons/battery/os_battery_060.c + DisplayApp/Icons/battery/os_battery_050.c + DisplayApp/Icons/battery/os_battery_040.c + DisplayApp/Icons/battery/os_battery_030.c + DisplayApp/Icons/battery/os_battery_020.c + DisplayApp/Icons/battery/os_battery_010.c + DisplayApp/Icons/battery/os_battery_005.c + + DisplayApp/Icons/battery/os_batterycharging_100.c + DisplayApp/Icons/battery/os_batterycharging_090.c + DisplayApp/Icons/battery/os_batterycharging_080.c + DisplayApp/Icons/battery/os_batterycharging_070.c + DisplayApp/Icons/battery/os_batterycharging_060.c + DisplayApp/Icons/battery/os_batterycharging_050.c + DisplayApp/Icons/battery/os_batterycharging_040.c + DisplayApp/Icons/battery/os_batterycharging_030.c + DisplayApp/Icons/battery/os_batterycharging_020.c + DisplayApp/Icons/battery/os_batterycharging_010.c + DisplayApp/Icons/battery/os_batterycharging_005.c + + DisplayApp/Icons/bluetooth/os_bt_connected.c + DisplayApp/Icons/bluetooth/os_bt_disconnected.c + ) list(APPEND SOURCE_FILES - Logging/NrfLogger.cpp - DisplayApp/DisplayApp.cpp - DisplayApp/Screens/Screen.cpp - DisplayApp/Screens/Clock.cpp - DisplayApp/Screens/Tile.cpp - DisplayApp/Screens/Meter.cpp - DisplayApp/Screens/Gauge.cpp - DisplayApp/Screens/InfiniPaint.cpp - DisplayApp/Screens/DropDownDemo.cpp - DisplayApp/Screens/Modal.cpp - DisplayApp/Screens/BatteryIcon.cpp - DisplayApp/Screens/BleIcon.cpp - DisplayApp/Screens/Brightness.cpp - DisplayApp/Screens/SystemInfo.cpp - DisplayApp/Screens/Label.cpp - DisplayApp/Screens/FirmwareUpdate.cpp - DisplayApp/Screens/Music.cpp - DisplayApp/Screens/FirmwareValidation.cpp - DisplayApp/Screens/ApplicationList.cpp - main.cpp - drivers/St7789.cpp - drivers/SpiNorFlash.cpp - drivers/SpiMaster.cpp - drivers/Spi.cpp - drivers/Watchdog.cpp - drivers/DebugPins.cpp - drivers/InternalFlash.cpp - Components/Battery/BatteryController.cpp - Components/Ble/BleController.cpp - Components/Ble/NotificationManager.cpp - Components/DateTime/DateTimeController.cpp - Components/Brightness/BrightnessController.cpp - Components/Ble/NimbleController.cpp - Components/Ble/DeviceInformationService.cpp - Components/Ble/CurrentTimeClient.cpp - Components/Ble/AlertNotificationClient.cpp - Components/Ble/DfuService.cpp - Components/Ble/CurrentTimeService.cpp - Components/Ble/AlertNotificationService.cpp - Components/Ble/MusicService.cpp - Components/Ble/BatteryInformationService.cpp - Components/Ble/ImmediateAlertService.cpp - Components/FirmwareValidator/FirmwareValidator.cpp - drivers/Cst816s.cpp - FreeRTOS/port.c - FreeRTOS/port_cmsis_systick.c - FreeRTOS/port_cmsis.c - - DisplayApp/LittleVgl.cpp - DisplayApp/Fonts/jetbrains_mono_extrabold_compressed.c - DisplayApp/Fonts/jetbrains_mono_bold_20.c - - SystemTask/SystemTask.cpp - drivers/TwiMaster.cpp -) + Logging/NrfLogger.cpp + DisplayApp/DisplayApp.cpp + DisplayApp/Screens/Screen.cpp + DisplayApp/Screens/Clock.cpp + DisplayApp/Screens/Tile.cpp + DisplayApp/Screens/Meter.cpp + DisplayApp/Screens/Gauge.cpp + DisplayApp/Screens/InfiniPaint.cpp + DisplayApp/Screens/DropDownDemo.cpp + DisplayApp/Screens/Modal.cpp + DisplayApp/Screens/BatteryIcon.cpp + DisplayApp/Screens/BleIcon.cpp + DisplayApp/Screens/Brightness.cpp + DisplayApp/Screens/SystemInfo.cpp + DisplayApp/Screens/Label.cpp + DisplayApp/Screens/FirmwareUpdate.cpp + DisplayApp/Screens/Music.cpp + DisplayApp/Screens/FirmwareValidation.cpp + DisplayApp/Screens/ApplicationList.cpp + main.cpp + drivers/St7789.cpp + drivers/SpiNorFlash.cpp + drivers/SpiMaster.cpp + drivers/Spi.cpp + drivers/Watchdog.cpp + drivers/DebugPins.cpp + drivers/InternalFlash.cpp + Components/Battery/BatteryController.cpp + Components/Ble/BleController.cpp + Components/Ble/NotificationManager.cpp + Components/DateTime/DateTimeController.cpp + Components/Brightness/BrightnessController.cpp + Components/Ble/NimbleController.cpp + Components/Ble/DeviceInformationService.cpp + Components/Ble/CurrentTimeClient.cpp + Components/Ble/AlertNotificationClient.cpp + Components/Ble/DfuService.cpp + Components/Ble/CurrentTimeService.cpp + Components/Ble/AlertNotificationService.cpp + Components/Ble/MusicService.cpp + Components/Ble/BatteryInformationService.cpp + Components/Ble/ImmediateAlertService.cpp + Components/FirmwareValidator/FirmwareValidator.cpp + drivers/Cst816s.cpp + FreeRTOS/port.c + FreeRTOS/port_cmsis_systick.c + FreeRTOS/port_cmsis.c + + DisplayApp/LittleVgl.cpp + DisplayApp/Fonts/jetbrains_mono_extrabold_compressed.c + DisplayApp/Fonts/jetbrains_mono_bold_20.c + + SystemTask/SystemTask.cpp + drivers/TwiMaster.cpp + ) list(APPEND GRAPHICS_SOURCE_FILES - # FreeRTOS - FreeRTOS/port.c - FreeRTOS/port_cmsis_systick.c - FreeRTOS/port_cmsis.c + # FreeRTOS + FreeRTOS/port.c + FreeRTOS/port_cmsis_systick.c + FreeRTOS/port_cmsis.c - drivers/SpiNorFlash.cpp - drivers/SpiMaster.cpp - drivers/Spi.cpp - Logging/NrfLogger.cpp + drivers/SpiNorFlash.cpp + drivers/SpiMaster.cpp + drivers/Spi.cpp + Logging/NrfLogger.cpp - Components/Gfx/Gfx.cpp - drivers/St7789.cpp - Components/Brightness/BrightnessController.cpp + Components/Gfx/Gfx.cpp + drivers/St7789.cpp + Components/Brightness/BrightnessController.cpp - graphics.cpp -) + graphics.cpp + ) set(INCLUDE_FILES - Logging/Logger.h - Logging/NrfLogger.h - DisplayApp/DisplayApp.h - DisplayApp/TouchEvents.h - DisplayApp/Screens/Screen.h - DisplayApp/Screens/Clock.h - DisplayApp/Screens/Tile.h - DisplayApp/Screens/Meter.h - DisplayApp/Screens/Gauge.h - DisplayApp/Screens/InfiniPaint.h - DisplayApp/Screens/DropDownDemo.h - DisplayApp/Screens/Modal.h - DisplayApp/Screens/BatteryIcon.h - DisplayApp/Screens/BleIcon.cpp - DisplayApp/Screens/Brightness.h - DisplayApp/Screens/SystemInfo.h - DisplayApp/Screens/ScreenList.h - DisplayApp/Screens/Label.h - DisplayApp/Screens/FirmwareUpdate.h - DisplayApp/Screens/FirmwareValidation.h - DisplayApp/Screens/ApplicationList.h - DisplayApp/Apps.h - drivers/St7789.h - drivers/SpiNorFlash.h - drivers/SpiMaster.h - drivers/Spi.h - drivers/Watchdog.h - drivers/DebugPins.h - drivers/InternalFlash.h - Components/Battery/BatteryController.h - Components/Ble/BleController.h - Components/Ble/NotificationManager.h - Components/DateTime/DateTimeController.h - Components/Brightness/BrightnessController.h - Components/Ble/NimbleController.h - Components/Ble/DeviceInformationService.h - Components/Ble/CurrentTimeClient.h - Components/Ble/AlertNotificationClient.h - Components/Ble/DfuService.h - Components/FirmwareValidator/FirmwareValidator.h - Components/Ble/BatteryInformationService.h - Components/Ble/ImmediateAlertService.h - drivers/Cst816s.h - FreeRTOS/portmacro.h - FreeRTOS/portmacro_cmsis.h - libs/date/includes/date/tz.h - libs/date/includes/date/chrono_io.h - libs/date/includes/date/date.h - libs/date/includes/date/islamic.h - libs/date/includes/date/iso_week.h - libs/date/includes/date/julian.h - libs/date/includes/date/ptz.h - libs/date/includes/date/tz_private.h - DisplayApp/LittleVgl.h - SystemTask/SystemTask.h - SystemTask/SystemMonitor.h - DisplayApp/Screens/Symbols.h - drivers/TwiMaster.h -) + Logging/Logger.h + Logging/NrfLogger.h + DisplayApp/DisplayApp.h + DisplayApp/TouchEvents.h + DisplayApp/Screens/Screen.h + DisplayApp/Screens/Clock.h + DisplayApp/Screens/Tile.h + DisplayApp/Screens/Meter.h + DisplayApp/Screens/Gauge.h + DisplayApp/Screens/InfiniPaint.h + DisplayApp/Screens/DropDownDemo.h + DisplayApp/Screens/Modal.h + DisplayApp/Screens/BatteryIcon.h + DisplayApp/Screens/BleIcon.cpp + DisplayApp/Screens/Brightness.h + DisplayApp/Screens/SystemInfo.h + DisplayApp/Screens/ScreenList.h + DisplayApp/Screens/Label.h + DisplayApp/Screens/FirmwareUpdate.h + DisplayApp/Screens/FirmwareValidation.h + DisplayApp/Screens/ApplicationList.h + DisplayApp/Apps.h + drivers/St7789.h + drivers/SpiNorFlash.h + drivers/SpiMaster.h + drivers/Spi.h + drivers/Watchdog.h + drivers/DebugPins.h + drivers/InternalFlash.h + Components/Battery/BatteryController.h + Components/Ble/BleController.h + Components/Ble/NotificationManager.h + Components/DateTime/DateTimeController.h + Components/Brightness/BrightnessController.h + Components/Ble/NimbleController.h + Components/Ble/DeviceInformationService.h + Components/Ble/CurrentTimeClient.h + Components/Ble/AlertNotificationClient.h + Components/Ble/DfuService.h + Components/FirmwareValidator/FirmwareValidator.h + Components/Ble/BatteryInformationService.h + Components/Ble/ImmediateAlertService.h + drivers/Cst816s.h + FreeRTOS/portmacro.h + FreeRTOS/portmacro_cmsis.h + libs/date/includes/date/tz.h + libs/date/includes/date/chrono_io.h + libs/date/includes/date/date.h + libs/date/includes/date/islamic.h + libs/date/includes/date/iso_week.h + libs/date/includes/date/julian.h + libs/date/includes/date/ptz.h + libs/date/includes/date/tz_private.h + DisplayApp/LittleVgl.h + SystemTask/SystemTask.h + SystemTask/SystemMonitor.h + DisplayApp/Screens/Symbols.h + drivers/TwiMaster.h + ) include_directories( - . - ../ - libs/ - FreeRTOS/ - libs/date/includes - libs/mynewt-nimble/porting/npl/freertos/include - libs/mynewt-nimble/nimble/include - libs/mynewt-nimble/porting/nimble/include - libs/mynewt-nimble/nimble/host/include - libs/mynewt-nimble/nimble/controller/include - libs/mynewt-nimble/nimble/transport/ram/include - libs/mynewt-nimble/nimble/drivers/nrf52/include - libs/mynewt-nimble/ext/tinycrypt/include - libs/mynewt-nimble/nimble/host/services/gap/include - libs/mynewt-nimble/nimble/host/services/gatt/include - libs/mynewt-nimble/nimble/host/util/include - libs/mynewt-nimble/nimble/host/store/ram/include - - "${NRF5_SDK_PATH}/components/drivers_nrf/nrf_soc_nosd" + . + ../ + libs/ + FreeRTOS/ + libs/date/includes + libs/mynewt-nimble/porting/npl/freertos/include + libs/mynewt-nimble/nimble/include + libs/mynewt-nimble/porting/nimble/include + libs/mynewt-nimble/nimble/host/include + libs/mynewt-nimble/nimble/controller/include + libs/mynewt-nimble/nimble/transport/ram/include + libs/mynewt-nimble/nimble/drivers/nrf52/include + libs/mynewt-nimble/ext/tinycrypt/include + libs/mynewt-nimble/nimble/host/services/gap/include + libs/mynewt-nimble/nimble/host/services/gatt/include + libs/mynewt-nimble/nimble/host/util/include + libs/mynewt-nimble/nimble/host/store/ram/include + + "${NRF5_SDK_PATH}/components/drivers_nrf/nrf_soc_nosd" "${NRF5_SDK_PATH}/components" "${NRF5_SDK_PATH}/components/boards" "${NRF5_SDK_PATH}/components/softdevice/common" @@ -548,7 +548,7 @@ include_directories( ) link_directories( - ../ + ../ ) @@ -563,52 +563,52 @@ add_definitions(-DDEBUG_NRF_USER) add_definitions(-D__STACK_SIZE=8192) add_definitions(-D__HEAP_SIZE=8192) -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE "Release") -endif() +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif () # NRF SDK add_library(nrf-sdk STATIC ${SDK_SOURCE_FILES}) target_include_directories(nrf-sdk SYSTEM PUBLIC . ../) target_include_directories(nrf-sdk SYSTEM PUBLIC ${INCLUDES_FROM_LIBS}) target_compile_options(nrf-sdk PRIVATE - $<$,$>: ${COMMON_FLAGS} -O0 -g3> - $<$,$>: ${COMMON_FLAGS} -O3> - $<$,$>: ${COMMON_FLAGS} -O0> - $<$,$>: ${COMMON_FLAGS} -O3> - $<$: -MP -MD -std=c99 -x assembler-with-cpp> - ) + $<$,$>: ${COMMON_FLAGS} -O0 -g3> + $<$,$>: ${COMMON_FLAGS} -O3> + $<$,$>: ${COMMON_FLAGS} -O0> + $<$,$>: ${COMMON_FLAGS} -O3> + $<$: -MP -MD -std=c99 -x assembler-with-cpp> + ) # NimBLE add_library(nimble STATIC ${NIMBLE_SRC} ${TINYCRYPT_SRC}) target_include_directories(nimble SYSTEM PUBLIC . ../) target_include_directories(nimble SYSTEM PUBLIC ${INCLUDES_FROM_LIBS}) target_compile_options(nimble PRIVATE - $<$,$>: ${COMMON_FLAGS} -O0 -g3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized> - $<$,$>: ${COMMON_FLAGS} -O3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized> - $<$,$>: ${COMMON_FLAGS} -O0 -g3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized> - $<$,$>: ${COMMON_FLAGS} -O3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized> - $<$: -MP -MD -std=c99 -x assembler-with-cpp> - ) + $<$,$>: ${COMMON_FLAGS} -O0 -g3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized> + $<$,$>: ${COMMON_FLAGS} -O3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized> + $<$,$>: ${COMMON_FLAGS} -O0 -g3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized> + $<$,$>: ${COMMON_FLAGS} -O3 -Wno-unused-but-set-variable -Wno-maybe-uninitialized> + $<$: -MP -MD -std=c99 -x assembler-with-cpp> + ) # lvgl add_library(lvgl STATIC ${LVGL_SRC}) target_include_directories(lvgl SYSTEM PUBLIC . ../) target_include_directories(lvgl SYSTEM PUBLIC ${INCLUDES_FROM_LIBS}) target_compile_options(lvgl PRIVATE - $<$,$>: ${COMMON_FLAGS} -O0 -g3> - $<$,$>: ${COMMON_FLAGS} -O3> - $<$,$>: ${COMMON_FLAGS} -O0 -g3> - $<$,$>: ${COMMON_FLAGS} -O3> - $<$: -MP -MD -std=c99 -x assembler-with-cpp> - ) + $<$,$>: ${COMMON_FLAGS} -O0 -g3> + $<$,$>: ${COMMON_FLAGS} -O3> + $<$,$>: ${COMMON_FLAGS} -O0 -g3> + $<$,$>: ${COMMON_FLAGS} -O3> + $<$: -MP -MD -std=c99 -x assembler-with-cpp> + ) # Build autonomous binary (without support for bootloader) set(EXECUTABLE_NAME "pinetime-app") set(EXECUTABLE_FILE_NAME ${EXECUTABLE_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}) set(NRF5_LINKER_SCRIPT "${CMAKE_SOURCE_DIR}/gcc_nrf52.ld") add_executable(${EXECUTABLE_NAME} ${SOURCE_FILES}) -set_target_properties(${EXECUTABLE_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_FILE_NAME}) +set_target_properties(${EXECUTABLE_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_FILE_NAME}) target_link_libraries(${EXECUTABLE_NAME} nimble nrf-sdk lvgl) target_compile_options(${EXECUTABLE_NAME} PUBLIC $<$,$>: ${COMMON_FLAGS} -O0 -g3> @@ -616,7 +616,7 @@ target_compile_options(${EXECUTABLE_NAME} PUBLIC $<$,$>: ${COMMON_FLAGS} -O0 -g3> $<$,$>: ${COMMON_FLAGS} -O3> $<$: -MP -MD -std=c99 -x assembler-with-cpp> -) + ) set_target_properties(${EXECUTABLE_NAME} PROPERTIES SUFFIX ".out" @@ -641,7 +641,7 @@ set(DFU_FILE_NAME dfu-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pine set(NRF5_LINKER_SCRIPT_MCUBOOT "${CMAKE_SOURCE_DIR}/gcc_nrf52-mcuboot.ld") add_executable(${EXECUTABLE_MCUBOOT_NAME} ${SOURCE_FILES}) target_link_libraries(${EXECUTABLE_MCUBOOT_NAME} nimble nrf-sdk lvgl) -set_target_properties(${EXECUTABLE_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_FILE_NAME}) +set_target_properties(${EXECUTABLE_MCUBOOT_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_MCUBOOT_FILE_NAME}) target_compile_options(${EXECUTABLE_MCUBOOT_NAME} PUBLIC $<$,$>: ${COMMON_FLAGS} -O0 -g3> $<$,$>: ${COMMON_FLAGS} -O3> @@ -663,39 +663,39 @@ add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_NAME} COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE_MCUBOOT_FILE_NAME}.out "${EXECUTABLE_MCUBOOT_FILE_NAME}.bin" COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_MCUBOOT_FILE_NAME}.out "${EXECUTABLE_MCUBOOT_FILE_NAME}.hex" COMMENT "post build steps for ${EXECUTABLE_MCUBOOT_FILE_NAME}" -) + ) # Build binary that writes the graphic assets for the bootloader set(EXECUTABLE_GRAPHICS_NAME "pinetime-graphics") set(EXECUTABLE_GRAPHICS_FILE_NAME ${EXECUTABLE_GRAPHICS_NAME}-${pinetime_VERSION_MAJOR}.${pinetime_VERSION_MINOR}.${pinetime_VERSION_PATCH}) add_executable(${EXECUTABLE_GRAPHICS_NAME} ${GRAPHICS_SOURCE_FILES}) target_link_libraries(${EXECUTABLE_GRAPHICS_NAME} nrf-sdk) -set_target_properties(${EXECUTABLE_GRAPHICS_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_GRAPHICS_FILE_NAME}) +set_target_properties(${EXECUTABLE_GRAPHICS_NAME} PROPERTIES OUTPUT_NAME ${EXECUTABLE_GRAPHICS_FILE_NAME}) target_compile_options(${EXECUTABLE_GRAPHICS_NAME} PUBLIC - $<$,$>: ${COMMON_FLAGS} -O0 -g3> - $<$,$>: ${COMMON_FLAGS} -O3> - $<$,$>: ${COMMON_FLAGS} -O0 -g3> - $<$,$>: ${COMMON_FLAGS} -O3> - $<$: -MP -MD -std=c99 -x assembler-with-cpp> - ) + $<$,$>: ${COMMON_FLAGS} -O0 -g3> + $<$,$>: ${COMMON_FLAGS} -O3> + $<$,$>: ${COMMON_FLAGS} -O0 -g3> + $<$,$>: ${COMMON_FLAGS} -O3> + $<$: -MP -MD -std=c99 -x assembler-with-cpp> + ) set_target_properties(${EXECUTABLE_GRAPHICS_NAME} PROPERTIES - SUFFIX ".out" - LINK_FLAGS "-mthumb -mabi=aapcs -std=gnu++98 -std=c99 -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_GRAPHICS_FILE_NAME}.map" - CXX_STANDARD 11 - C_STANDARD 99 - ) + SUFFIX ".out" + LINK_FLAGS "-mthumb -mabi=aapcs -std=gnu++98 -std=c99 -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_GRAPHICS_FILE_NAME}.map" + CXX_STANDARD 11 + C_STANDARD 99 + ) add_custom_command(TARGET ${EXECUTABLE_GRAPHICS_NAME} - POST_BUILD - COMMAND ${CMAKE_SIZE_UTIL} ${EXECUTABLE_GRAPHICS_FILE_NAME}.out - COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE_GRAPHICS_FILE_NAME}.out "${EXECUTABLE_GRAPHICS_FILE_NAME}.bin" - COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_GRAPHICS_FILE_NAME}.out "${EXECUTABLE_GRAPHICS_FILE_NAME}.hex" - COMMENT "post build steps for ${EXECUTABLE_GRAPHICS_FILE_NAME}" - ) + POST_BUILD + COMMAND ${CMAKE_SIZE_UTIL} ${EXECUTABLE_GRAPHICS_FILE_NAME}.out + COMMAND ${CMAKE_OBJCOPY} -O binary ${EXECUTABLE_GRAPHICS_FILE_NAME}.out "${EXECUTABLE_GRAPHICS_FILE_NAME}.bin" + COMMAND ${CMAKE_OBJCOPY} -O ihex ${EXECUTABLE_GRAPHICS_FILE_NAME}.out "${EXECUTABLE_GRAPHICS_FILE_NAME}.hex" + COMMENT "post build steps for ${EXECUTABLE_GRAPHICS_FILE_NAME}" + ) # FLASH -if(USE_JLINK) +if (USE_JLINK) add_custom_target(FLASH_ERASE COMMAND ${NRFJPROG} --eraseall -f ${NRF_TARGET} COMMENT "erasing flashing" @@ -708,26 +708,54 @@ if(USE_JLINK) COMMENT "flashing ${EXECUTABLE_NAME}.hex" ) -elseif(USE_GDB_CLIENT) +elseif (USE_GDB_CLIENT) add_custom_target(FLASH_ERASE COMMAND ${GDB_CLIENT_BIN_PATH} -nx --batch -ex 'target extended-remote ${GDB_CLIENT_TARGET_REMOTE}' -ex 'monitor swdp_scan' -ex 'attach 1' -ex 'mon erase_mass' COMMENT "erasing flashing" ) add_custom_target("FLASH_${EXECUTABLE_NAME}" DEPENDS ${EXECUTABLE_NAME} - COMMAND ${GDB_CLIENT_BIN_PATH} -nx --batch -ex 'target extended-remote ${GDB_CLIENT_TARGET_REMOTE}' -ex 'monitor swdp_scan' -ex 'attach 1' -ex 'load' -ex 'kill' ${EXECUTABLE_NAME}.hex - COMMENT "flashing ${EXECUTABLE_NAME}.hex" - ) -elseif(USE_OPENOCD) - add_custom_target(FLASH_ERASE - COMMAND ${OPENOCD_BIN_PATH} -f interface/stlink.cfg -c 'transport select hla_swd' -f target/nrf52.cfg -c init -c halt -c 'nrf5 mass_erase' -c reset -c shutdown - COMMENT "erasing flashing" - ) - add_custom_target("FLASH_${EXECUTABLE_NAME}" - DEPENDS ${EXECUTABLE_NAME} - COMMAND ${OPENOCD_BIN_PATH} -c "tcl_port disabled" -c "gdb_port 3333" -c "telnet_port 4444" -f interface/stlink.cfg -c 'transport select hla_swd' -f target/nrf52.cfg -c "program \"${EXECUTABLE_NAME}.hex\"" -c reset -c shutdown + COMMAND ${GDB_CLIENT_BIN_PATH} -nx --batch -ex 'target extended-remote ${GDB_CLIENT_TARGET_REMOTE}' -ex 'monitor swdp_scan' -ex 'attach 1' -ex 'load' -ex 'kill' ${EXECUTABLE_NAME}.hex COMMENT "flashing ${EXECUTABLE_NAME}.hex" ) - -endif() - +elseif (USE_OPENOCD) + if (USE_CMSIS_DAP) + add_custom_target(FLASH_ERASE + COMMAND ${OPENOCD_BIN_PATH} -c 'source [find interface/cmsis-dap.cfg]' -c 'transport select swd' + -c 'source [find target/nrf52.cfg]' + -c 'init' + -c 'halt' + -c 'nrf5 mass_erase' + -c 'halt' + -c 'reset' + -c 'exit' + COMMENT "erasing flashing" + ) + add_custom_target("FLASH_${EXECUTABLE_NAME}" + DEPENDS ${EXECUTABLE_NAME} + COMMAND ${OPENOCD_BIN_PATH} + -c 'tcl_port disabled' + -c 'gdb_port 3333' + -c 'telnet_port 4444' + -c 'source [find interface/cmsis-dap.cfg]' + -c 'transport select swd' + -c 'source [find target/nrf52.cfg]' + -c 'halt' + -c "program \"${EXECUTABLE_NAME}.hex\"" + -c 'reset' + -c 'shutdown' + COMMENT "flashing ${EXECUTABLE_NAME}.hex" + ) + else () + message() + add_custom_target(FLASH_ERASE + COMMAND ${OPENOCD_BIN_PATH} -f interface/stlink.cfg -c 'transport select hla_swd' -f target/nrf52.cfg -c init -c halt -c 'nrf5 mass_erase' -c reset -c shutdown + COMMENT "erasing flashing" + ) + add_custom_target("FLASH_${EXECUTABLE_NAME}" + DEPENDS ${EXECUTABLE_NAME} + COMMAND ${OPENOCD_BIN_PATH} -c "tcl_port disabled" -c "gdb_port 3333" -c "telnet_port 4444" -f interface/stlink.cfg -c 'transport select hla_swd' -f target/nrf52.cfg -c "program \"${EXECUTABLE_NAME}.hex\"" -c reset -c shutdown + COMMENT "flashing ${EXECUTABLE_NAME}.hex" + ) + endif () +endif () -- cgit v0.10.2 From 40a643d203d2d21834dd2b35d83419a56a3939b6 Mon Sep 17 00:00:00 2001 From: Avamander Date: Fri, 2 Oct 2020 21:44:27 +0300 Subject: Renamed Components/ to components/ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1b5cdcb..f536631 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -349,22 +349,22 @@ list(APPEND SOURCE_FILES drivers/Watchdog.cpp drivers/DebugPins.cpp drivers/InternalFlash.cpp - Components/Battery/BatteryController.cpp - Components/Ble/BleController.cpp - Components/Ble/NotificationManager.cpp - Components/DateTime/DateTimeController.cpp - Components/Brightness/BrightnessController.cpp - Components/Ble/NimbleController.cpp - Components/Ble/DeviceInformationService.cpp - Components/Ble/CurrentTimeClient.cpp - Components/Ble/AlertNotificationClient.cpp - Components/Ble/DfuService.cpp - Components/Ble/CurrentTimeService.cpp - Components/Ble/AlertNotificationService.cpp - Components/Ble/MusicService.cpp - Components/Ble/BatteryInformationService.cpp - Components/Ble/ImmediateAlertService.cpp - Components/FirmwareValidator/FirmwareValidator.cpp + components/Battery/BatteryController.cpp + components/Ble/BleController.cpp + components/Ble/NotificationManager.cpp + components/DateTime/DateTimeController.cpp + components/Brightness/BrightnessController.cpp + components/Ble/NimbleController.cpp + components/Ble/DeviceInformationService.cpp + components/Ble/CurrentTimeClient.cpp + components/Ble/AlertNotificationClient.cpp + components/Ble/DfuService.cpp + components/Ble/CurrentTimeService.cpp + components/Ble/AlertNotificationService.cpp + components/Ble/MusicService.cpp + components/Ble/BatteryInformationService.cpp + components/Ble/ImmediateAlertService.cpp + components/FirmwareValidator/FirmwareValidator.cpp drivers/Cst816s.cpp FreeRTOS/port.c FreeRTOS/port_cmsis_systick.c @@ -389,9 +389,9 @@ list(APPEND GRAPHICS_SOURCE_FILES drivers/Spi.cpp Logging/NrfLogger.cpp - Components/Gfx/Gfx.cpp + components/Gfx/Gfx.cpp drivers/St7789.cpp - Components/Brightness/BrightnessController.cpp + components/Brightness/BrightnessController.cpp graphics.cpp ) @@ -426,19 +426,19 @@ set(INCLUDE_FILES drivers/Watchdog.h drivers/DebugPins.h drivers/InternalFlash.h - Components/Battery/BatteryController.h - Components/Ble/BleController.h - Components/Ble/NotificationManager.h - Components/DateTime/DateTimeController.h - Components/Brightness/BrightnessController.h - Components/Ble/NimbleController.h - Components/Ble/DeviceInformationService.h - Components/Ble/CurrentTimeClient.h - Components/Ble/AlertNotificationClient.h - Components/Ble/DfuService.h - Components/FirmwareValidator/FirmwareValidator.h - Components/Ble/BatteryInformationService.h - Components/Ble/ImmediateAlertService.h + components/Battery/BatteryController.h + components/Ble/BleController.h + components/Ble/NotificationManager.h + components/DateTime/DateTimeController.h + components/Brightness/BrightnessController.h + components/Ble/NimbleController.h + components/Ble/DeviceInformationService.h + components/Ble/CurrentTimeClient.h + components/Ble/AlertNotificationClient.h + components/Ble/DfuService.h + components/FirmwareValidator/FirmwareValidator.h + components/Ble/BatteryInformationService.h + components/Ble/ImmediateAlertService.h drivers/Cst816s.h FreeRTOS/portmacro.h FreeRTOS/portmacro_cmsis.h diff --git a/src/Components/Battery/BatteryController.cpp b/src/Components/Battery/BatteryController.cpp deleted file mode 100644 index 571efae..0000000 --- a/src/Components/Battery/BatteryController.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include -#include -#include "BatteryController.h" - -using namespace Pinetime::Controllers; - -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); - - nrfx_saadc_config_t adcConfig = NRFX_SAADC_DEFAULT_CONFIG; - nrfx_saadc_init(&adcConfig, SaadcEventHandler); - 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_DISABLED, - .pin_p = batteryVoltageAdcInput, - .pin_n = NRF_SAADC_INPUT_DISABLED - }; - nrfx_saadc_channel_init(0, &adcChannelConfig); -} - -void Battery::Update() { - isCharging = !nrf_gpio_pin_read(chargingPin); - isPowerPresent = !nrf_gpio_pin_read(powerPresentPin); - - nrf_saadc_value_t value = 0; - nrfx_saadc_sample_convert(0, &value); - - // see https://forum.pine64.org/showthread.php?tid=8147 - voltage = (value * 2.0f) / (1024/3.0f); - percentRemaining = ((voltage - 3.55f)*100.0f)*3.9f; - percentRemaining = std::max(percentRemaining, 0.0f); - percentRemaining = std::min(percentRemaining, 100.0f); - -// NRF_LOG_INFO("BATTERY " NRF_LOG_FLOAT_MARKER " %% - " NRF_LOG_FLOAT_MARKER " v", NRF_LOG_FLOAT(percentRemaining), NRF_LOG_FLOAT(voltage)); -// NRF_LOG_INFO("POWER Charging : %d - Power : %d", isCharging, isPowerPresent); -} - -void Battery::SaadcEventHandler(nrfx_saadc_evt_t const * event) { - -} \ No newline at end of file diff --git a/src/Components/Battery/BatteryController.h b/src/Components/Battery/BatteryController.h deleted file mode 100644 index f07648a..0000000 --- a/src/Components/Battery/BatteryController.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -#include - - -namespace Pinetime { - namespace Controllers { - class Battery { - public: - void Init(); - void Update(); - float PercentRemaining() const { return percentRemaining; } - float Voltage() const { return voltage; } - bool IsCharging() const { return isCharging; } - bool IsPowerPresent() const { return isPowerPresent; } - - private: - static constexpr uint32_t chargingPin = 12; - static constexpr uint32_t powerPresentPin = 19; - static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7; - static void SaadcEventHandler(nrfx_saadc_evt_t const * p_event); - float percentRemaining = 0.0f; - float voltage = 0.0f; - bool isCharging = false; - bool isPowerPresent = false; - }; - } -} \ No newline at end of file diff --git a/src/Components/Ble/AlertNotificationClient.cpp b/src/Components/Ble/AlertNotificationClient.cpp deleted file mode 100644 index 3e4b495..0000000 --- a/src/Components/Ble/AlertNotificationClient.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include -#include "NotificationManager.h" - -#include "AlertNotificationClient.h" - - -using namespace Pinetime::Controllers; -constexpr ble_uuid16_t AlertNotificationClient::ansServiceUuid; - -constexpr ble_uuid16_t AlertNotificationClient::supportedNewAlertCategoryUuid; -constexpr ble_uuid16_t AlertNotificationClient::supportedUnreadAlertCategoryUuid ; -constexpr ble_uuid16_t AlertNotificationClient::newAlertUuid; -constexpr ble_uuid16_t AlertNotificationClient::unreadAlertStatusUuid; -constexpr ble_uuid16_t AlertNotificationClient::controlPointUuid; - -int Pinetime::Controllers::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& notificationManager) : - systemTask{systemTask}, notificationManager{notificationManager}{ - -} - -bool AlertNotificationClient::OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, const ble_gatt_svc *service) { - if(service == nullptr && error->status == BLE_HS_EDONE) { - NRF_LOG_INFO("ANS Discovery complete"); - return true; - } - - if(service != nullptr && ble_uuid_cmp(((ble_uuid_t*)&ansServiceUuid), &service->uuid.u) == 0) { - NRF_LOG_INFO("ANS discovered : 0x%x", service->start_handle); - ansStartHandle = service->start_handle; - ansEndHandle = service->end_handle; - isDiscovered = true; - } - return false; -} - -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"); - return 0; - } - - if(characteristic == nullptr && error->status == BLE_HS_EDONE) { - NRF_LOG_INFO("ANS Characteristic discovery complete"); - } else { - 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) { - 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) { - NRF_LOG_INFO("ANS Characteristic discovered : newAlertUuid"); - newAlertHandle = characteristic->val_handle; - newAlertDefHandle = characteristic->def_handle; - } 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) { - NRF_LOG_INFO("ANS Characteristic discovered : controlPointUuid"); - controlPointHandle = 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) { - if(error->status == 0) { - NRF_LOG_INFO("ANS New alert subscribe OK"); - } else { - NRF_LOG_INFO("ANS New alert subscribe ERROR"); - } - - return 0; -} - -int AlertNotificationClient::OnDescriptorDiscoveryEventCallback(uint16_t connectionHandle, const ble_gatt_error *error, - uint16_t characteristicValueHandle, - const ble_gatt_dsc *descriptor) { - if(error->status == 0) { - 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; - uint8_t value[2]; - value[0] = 1; - value[1] = 0; - ble_gattc_write_flat(connectionHandle, newAlertDescriptorHandle, value, sizeof(value), NewAlertSubcribeCallback, this); - } - } - } - return 0; -} - -void AlertNotificationClient::OnNotification(ble_gap_event *event) { - if(event->notify_rx.attr_handle == newAlertHandle) { - // TODO implement this with more memory safety (and constexpr) - static const size_t maxBufferSize{21}; - static const size_t maxMessageSize{18}; - size_t bufferSize = min(OS_MBUF_PKTLEN(event->notify_rx.om), maxBufferSize); - - uint8_t data[bufferSize]; - os_mbuf_copydata(event->notify_rx.om, 0, bufferSize, data); - - char *s = (char *) &data[3]; - auto messageSize = min(maxMessageSize, (bufferSize-3)); - - for (uint i = 0; i < messageSize-1; i++) { - if (s[i] == 0x00) { - s[i] = 0x0A; - } - } - s[messageSize-1] = '\0'; - - notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, s, messageSize); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); - } -} - -bool AlertNotificationClient::IsDiscovered() const { - return isDiscovered; -} - -uint16_t AlertNotificationClient::StartHandle() const { - return ansStartHandle; -} - -uint16_t AlertNotificationClient::EndHandle() const { - return ansEndHandle; -} - -uint16_t AlertNotificationClient::NewAlerthandle() const { - return newAlertHandle; -} diff --git a/src/Components/Ble/AlertNotificationClient.h b/src/Components/Ble/AlertNotificationClient.h deleted file mode 100644 index ca4f4e9..0000000 --- a/src/Components/Ble/AlertNotificationClient.h +++ /dev/null @@ -1,81 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace Pinetime { - namespace Controllers { - int NewAlertSubcribeCallback(uint16_t conn_handle, - const struct ble_gatt_error *error, - struct ble_gatt_attr *attr, - void *arg); - - class AlertNotificationClient { - public: - explicit AlertNotificationClient(Pinetime::System::SystemTask &systemTask, - Pinetime::Controllers::NotificationManager ¬ificationManager); - - 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); - bool IsDiscovered() const; - uint16_t StartHandle() const; - uint16_t EndHandle() const; - - static constexpr const ble_uuid16_t &Uuid() { return ansServiceUuid; } - - uint16_t NewAlerthandle() const; - 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 - }; - - uint16_t ansStartHandle; - uint16_t ansEndHandle; - uint16_t supportedNewAlertCategoryHandle; - uint16_t supportedUnreadAlertCategoryHandle; - uint16_t newAlertHandle; - uint16_t newAlertDescriptorHandle = 0; - uint16_t newAlertDefHandle; - uint16_t unreadAlertStatusHandle; - uint16_t controlPointHandle; - bool isDiscovered = false; - Pinetime::System::SystemTask &systemTask; - Pinetime::Controllers::NotificationManager ¬ificationManager; - }; - } -} \ No newline at end of file diff --git a/src/Components/Ble/AlertNotificationService.cpp b/src/Components/Ble/AlertNotificationService.cpp deleted file mode 100644 index ce2f7dd..0000000 --- a/src/Components/Ble/AlertNotificationService.cpp +++ /dev/null @@ -1,80 +0,0 @@ - -#include -#include "NotificationManager.h" -#include - -#include "AlertNotificationService.h" -#include - -using namespace Pinetime::Controllers; - -constexpr ble_uuid16_t AlertNotificationService::ansUuid; -constexpr ble_uuid16_t AlertNotificationService::ansCharUuid; - - -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); -} - -void AlertNotificationService::Init() { - int res; - res = ble_gatts_count_cfg(serviceDefinition); - ASSERT(res == 0); - - res = ble_gatts_add_svcs(serviceDefinition); - 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 - }, - { - 0 - } - }, - serviceDefinition{ - { - /* Device Information Service */ - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &ansUuid, - .characteristics = characteristicDefinition - }, - { - 0 - }, - }, m_systemTask{systemTask}, m_notificationManager{notificationManager} { -} - -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) { - // TODO implement this with more memory safety (and constexpr) - static const size_t maxBufferSize{21}; - static const size_t maxMessageSize{18}; - size_t bufferSize = min(OS_MBUF_PKTLEN(ctxt->om), maxBufferSize); - - uint8_t data[bufferSize]; - os_mbuf_copydata(ctxt->om, 0, bufferSize, data); - - char *s = (char *) &data[3]; - auto messageSize = min(maxMessageSize, (bufferSize-3)); - - for (uint i = 0; i < messageSize-1; i++) { - if (s[i] == 0x00) { - s[i] = 0x0A; - } - } - s[messageSize-1] = '\0'; - - m_notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, s, messageSize); - m_systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); - } - return 0; -} diff --git a/src/Components/Ble/AlertNotificationService.h b/src/Components/Ble/AlertNotificationService.h deleted file mode 100644 index 53cb44c..0000000 --- a/src/Components/Ble/AlertNotificationService.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once -#include -#include -#include - -namespace Pinetime { - namespace Controllers { - class AlertNotificationService { - public: - AlertNotificationService(Pinetime::System::SystemTask &systemTask, - Pinetime::Controllers::NotificationManager ¬ificationManager); - void Init(); - - int OnAlert(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt); - - - private: - 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 ansCharUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = ansCharId - }; - - struct ble_gatt_chr_def characteristicDefinition[2]; - struct ble_gatt_svc_def serviceDefinition[2]; - - Pinetime::System::SystemTask &m_systemTask; - NotificationManager &m_notificationManager; - }; - } -} diff --git a/src/Components/Ble/BatteryInformationService.cpp b/src/Components/Ble/BatteryInformationService.cpp deleted file mode 100644 index c86830b..0000000 --- a/src/Components/Ble/BatteryInformationService.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "BatteryInformationService.h" -#include "../Battery/BatteryController.h" - -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) { - 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 - }, - }{ - -} - -void BatteryInformationService::Init() { - int res = 0; - res = ble_gatts_count_cfg(serviceDefinition); - ASSERT(res == 0); - - res = ble_gatts_add_svcs(serviceDefinition); - ASSERT(res == 0); -} - -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); - return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; - } - return 0; -} \ No newline at end of file diff --git a/src/Components/Ble/BatteryInformationService.h b/src/Components/Ble/BatteryInformationService.h deleted file mode 100644 index 74b2222..0000000 --- a/src/Components/Ble/BatteryInformationService.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once -#include - -namespace Pinetime { - namespace System { - class SystemTask; - } - namespace Controllers { - class Battery; - class BatteryInformationService { - public: - BatteryInformationService(Controllers::Battery& batteryController); - void Init(); - - 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}; - - 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 - }; - - struct ble_gatt_chr_def characteristicDefinition[3]; - struct ble_gatt_svc_def serviceDefinition[2]; - - uint16_t batteryLevelHandle; - - }; - } -} diff --git a/src/Components/Ble/BleController.cpp b/src/Components/Ble/BleController.cpp deleted file mode 100644 index 2b396e1..0000000 --- a/src/Components/Ble/BleController.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -#include "BleController.h" - -using namespace Pinetime::Controllers; - -void Ble::Connect() { - isConnected = true; -} - -void Ble::Disconnect() { - isConnected = false; -} - -void Ble::StartFirmwareUpdate() { - isFirmwareUpdating = true; -} - -void Ble::StopFirmwareUpdate() { - isFirmwareUpdating = false; -} - -void Ble::FirmwareUpdateTotalBytes(uint32_t totalBytes) { - firmwareUpdateTotalBytes = totalBytes; -} - -void Ble::FirmwareUpdateCurrentBytes(uint32_t currentBytes) { - firmwareUpdateCurrentBytes = currentBytes; -} - - diff --git a/src/Components/Ble/BleController.h b/src/Components/Ble/BleController.h deleted file mode 100644 index 3f52ea2..0000000 --- a/src/Components/Ble/BleController.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace Pinetime { - namespace Controllers { - class Ble { - 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(); - - 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; } - - 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 deleted file mode 100644 index 7a225f4..0000000 --- a/src/Components/Ble/CurrentTimeClient.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include -#include "CurrentTimeClient.h" - -using namespace Pinetime::Controllers; - -constexpr ble_uuid16_t CurrentTimeClient::ctsServiceUuid; -constexpr ble_uuid16_t CurrentTimeClient::currentTimeCharacteristicUuid; - -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) { - if(service == nullptr && error->status == BLE_HS_EDONE) { - NRF_LOG_INFO("CTS Discovery complete"); - return true; - } - - if(service != nullptr && ble_uuid_cmp(((ble_uuid_t*)&ctsServiceUuid), &service->uuid.u) == 0) { - NRF_LOG_INFO("CTS discovered : 0x%x", service->start_handle); - isDiscovered = true; - ctsStartHandle = service->start_handle; - ctsEndHandle = service->end_handle; - return false; - } - return false; -} - -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) { - NRF_LOG_INFO("CTS Characteristic discovery complete"); - return 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); - currentTimeHandle = characteristic->val_handle; - } - return 0; -} - -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)); - } else { - NRF_LOG_INFO("Error retrieving current time: %d", error->status); - } - return 0; -} - -bool CurrentTimeClient::IsDiscovered() const { - return isDiscovered; -} - -uint16_t CurrentTimeClient::StartHandle() const { - return ctsStartHandle; -} - -uint16_t CurrentTimeClient::EndHandle() const { - return ctsEndHandle; -} - -uint16_t CurrentTimeClient::CurrentTimeHandle() const { - return currentTimeHandle; -} \ No newline at end of file diff --git a/src/Components/Ble/CurrentTimeClient.h b/src/Components/Ble/CurrentTimeClient.h deleted file mode 100644 index fabcdac..0000000 --- a/src/Components/Ble/CurrentTimeClient.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once -#include -#include -#include -#include - -namespace Pinetime { - namespace Controllers { - - class CurrentTimeClient { - public: - explicit CurrentTimeClient(DateTime& dateTimeController); - void Init(); - 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); - bool IsDiscovered() const; - uint16_t StartHandle() const; - uint16_t EndHandle() const; - uint16_t CurrentTimeHandle() const; - static constexpr const ble_uuid16_t* Uuid() { return &CurrentTimeClient::ctsServiceUuid; } - static constexpr const ble_uuid16_t* CurrentTimeCharacteristicUuid() { return &CurrentTimeClient::currentTimeCharacteristicUuid; } - 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 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 - }; - - uint16_t currentTimeHandle; - DateTime& dateTimeController; - bool isDiscovered = false; - uint16_t ctsStartHandle; - uint16_t ctsEndHandle; - }; - } -} \ No newline at end of file diff --git a/src/Components/Ble/CurrentTimeService.cpp b/src/Components/Ble/CurrentTimeService.cpp deleted file mode 100644 index 3a6264e..0000000 --- a/src/Components/Ble/CurrentTimeService.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "CurrentTimeService.h" -#include - -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) { - auto cts = static_cast(arg); - return cts->OnTimeAccessed(conn_handle, attr_handle, ctxt); -} - -void CurrentTimeService::Init() { - int res; - res = ble_gatts_count_cfg(serviceDefinition); - ASSERT(res == 0); - - res = ble_gatts_add_svcs(serviceDefinition); - ASSERT(res == 0); -} - - -int CurrentTimeService::OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt) { - - 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); - - 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; - currentDateTime.year = m_dateTimeController.Year(); - currentDateTime.month = static_cast(m_dateTimeController.Month()); - currentDateTime.dayofmonth = m_dateTimeController.Day(); - currentDateTime.hour = m_dateTimeController.Hours(); - currentDateTime.minute = m_dateTimeController.Minutes(); - 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} { - -} - diff --git a/src/Components/Ble/CurrentTimeService.h b/src/Components/Ble/CurrentTimeService.h deleted file mode 100644 index 58bc5ba..0000000 --- a/src/Components/Ble/CurrentTimeService.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once -#include -#include -#include -#include - -namespace Pinetime { - namespace Controllers { - class CurrentTimeService { - public: - CurrentTimeService(DateTime &dateTimeController); - void Init(); - - 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}; - - 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 - }; - - 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; - - DateTime &m_dateTimeController; - }; - } -} diff --git a/src/Components/Ble/DeviceInformationService.cpp b/src/Components/Ble/DeviceInformationService.cpp deleted file mode 100644 index 406db1c..0000000 --- a/src/Components/Ble/DeviceInformationService.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "DeviceInformationService.h" - -using namespace Pinetime::Controllers; - -constexpr ble_uuid16_t DeviceInformationService::manufacturerNameUuid; -constexpr ble_uuid16_t DeviceInformationService::modelNumberUuid; -constexpr ble_uuid16_t DeviceInformationService::serialNumberUuid; -constexpr ble_uuid16_t DeviceInformationService::fwRevisionUuid; -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) { - auto deviceInformationService = static_cast(arg); - return deviceInformationService->OnDeviceInfoRequested(conn_handle, attr_handle, ctxt); -} - -void DeviceInformationService::Init() { - int res = 0; - res = ble_gatts_count_cfg(serviceDefinition); - ASSERT(res == 0); - - res = ble_gatts_add_svcs(serviceDefinition); - ASSERT(res == 0); -} - - -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: - str = manufacturerName; - break; - case modelNumberId: - str = modelNumber; - break; - case serialNumberId: - str = serialNumber; - break; - case fwRevisionId: - str = fwRevision; - break; - case hwRevisionId: - str = hwRevision; - break; - case swRevisionId: - str = swRevision; - break; - default: - return BLE_ATT_ERR_UNLIKELY; - } - - int res = os_mbuf_append(ctxt->om, str, strlen(str)); - 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 - }, - } - { - -} - diff --git a/src/Components/Ble/DeviceInformationService.h b/src/Components/Ble/DeviceInformationService.h deleted file mode 100644 index 25ab840..0000000 --- a/src/Components/Ble/DeviceInformationService.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once -#include -#include - -#include -#include - -namespace Pinetime { - namespace Controllers { - class DeviceInformationService { - public: - DeviceInformationService(); - void Init(); - - 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}; - - 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 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 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 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 deleted file mode 100644 index fcbefdd..0000000 --- a/src/Components/Ble/DfuService.cpp +++ /dev/null @@ -1,440 +0,0 @@ -#include -#include -#include -#include "DfuService.h" - -using namespace Pinetime::Controllers; - -constexpr ble_uuid128_t DfuService::serviceUuid; -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); - return dfuService->OnServiceData(conn_handle, attr_handle, ctxt); -} - -void NotificationTimerCallback(TimerHandle_t xTimer) { - auto notificationManager = static_cast(pvTimerGetTimerID(xTimer)); - notificationManager->OnNotificationTimer(); -} - -void TimeoutTimerCallback(TimerHandle_t 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, - - }, - { - 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); -} - -void DfuService::Init() { - int res; - res = ble_gatts_count_cfg(serviceDefinition); - ASSERT(res == 0); - - res = ble_gatts_add_svcs(serviceDefinition); - ASSERT(res == 0); -} - -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); - - if (attributeHandle == packetCharacteristicHandle) { - if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) - return WritePacketHandler(connectionHandle, context->om); - 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 if (attributeHandle == revisionCharacteristicHandle) { - if (context->op == BLE_GATT_ACCESS_OP_READ_CHR) - return SendDfuRevision(context->om); - else return 0; - } else { - NRF_LOG_INFO("[DFU] Unknown Characteristic : %d", attributeHandle); - return 0; - } -} - -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) { - 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); - - dfuImage.Erase(); - - uint8_t data[]{16, 1, 1}; - notificationManager.Send(connectionHandle, controlPointCharacteristicHandle, data, 3); - state = States::Init; - } - return 0; - 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); - 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); - - 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); - - return 0; - } - - case States::Data: { - nbPacketReceived++; - dfuImage.Append(om->om_data, om->om_len); - bytesReceived += om->om_len; - 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)}; - 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)}; - NRF_LOG_INFO("[DFU] -> Send packet notification : all bytes received!"); - notificationManager.Send(connectionHandle, controlPointCharacteristicHandle, data, 3); - state = States::Validate; - } - } - return 0; - default: - // Invalid state - return 0; - } - return 0; -} - -int DfuService::ControlPointHandler(uint16_t connectionHandle, os_mbuf *om) { - auto opcode = static_cast(om->om_data[0]); - NRF_LOG_INFO("[DFU] -> ControlPointHandler"); - - switch (opcode) { - case Opcodes::StartDFU: { - if (state != States::Idle && state != States::Start) { - NRF_LOG_INFO("[DFU] -> Start DFU requested, but we are not in Idle state"); - return 0; - } - if (state == States::Start) { - NRF_LOG_INFO("[DFU] -> Start DFU requested, but we are already in Start state"); - return 0; - } - auto imageType = static_cast(om->om_data[1]); - if (imageType == ImageTypes::Application) { - NRF_LOG_INFO("[DFU] -> Start DFU, mode = Application"); - state = States::Start; - bleController.StartFirmwareUpdate(); - bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Running); - bleController.FirmwareUpdateTotalBytes(0xffffffffu); - bleController.FirmwareUpdateCurrentBytes(0); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleFirmwareUpdateStarted); - return 0; - } else { - NRF_LOG_INFO("[DFU] -> Start DFU, mode %d not supported!", imageType); - return 0; - } - } - break; - case Opcodes::InitDFUParameters: { - if (state != States::Init) { - NRF_LOG_INFO("[DFU] -> Init DFU requested, but we are not in Init state"); - return 0; - } - bool isInitComplete = (om->om_data[1] != 0); - 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}) - }; - notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3); - return 0; - } - } - return 0; - case Opcodes::PacketReceiptNotificationRequest: - nbPacketsToNotify = om->om_data[1]; - NRF_LOG_INFO("[DFU] -> Receive Packet Notification Request, nb packet = %d", nbPacketsToNotify); - return 0; - case Opcodes::ReceiveFirmwareImage: - if (state != States::Init) { - NRF_LOG_INFO("[DFU] -> Receive firmware image requested, but we are not in Start Init"); - return 0; - } - // TODO the chunk size is dependant of the implementation of the host application... - dfuImage.Init(20, applicationSize, expectedCrc); - NRF_LOG_INFO("[DFU] -> Starting receive firmware"); - state = States::Data; - return 0; - case Opcodes::ValidateFirmware: { - if (state != States::Validate) { - NRF_LOG_INFO("[DFU] -> Validate firmware image requested, but we are not in Data state %d", state); - return 0; - } - - NRF_LOG_INFO("[DFU] -> Validate firmware image requested -- %d", connectionHandle); - - 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) - }; - 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) - }; - notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3); - } - - return 0; - } - case Opcodes::ActivateImageAndReset: - if (state != States::Validated) { - NRF_LOG_INFO("[DFU] -> Activate image and reset requested, but we are not in Validated state"); - return 0; - } - NRF_LOG_INFO("[DFU] -> Activate image and reset!"); - bleController.StopFirmwareUpdate(); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleFirmwareUpdateFinished); - Reset(); - bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated); - return 0; - default: - return 0; - } -} - -void DfuService::OnTimeout() { - Reset(); -} - -void DfuService::Reset() { - state = States::Idle; - nbPacketsToNotify = 0; - nbPacketReceived = 0; - bytesReceived = 0; - softdeviceSize = 0; - bootloaderSize = 0; - applicationSize = 0; - expectedCrc = 0; - notificationManager.Reset(); - bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Error); - bleController.StopFirmwareUpdate(); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleFirmwareUpdateFinished); -} - -DfuService::NotificationManager::NotificationManager() { - 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) - return false; - - connectionHandle = connection; - characteristicHandle = charactHandle; - size = s; - std::memcpy(buffer, data, size); - xTimerStart(timer, 0); - return true; -} - -void DfuService::NotificationManager::OnNotificationTimer() { - 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); - auto ret = ble_gattc_notify_custom(connection, charactHandle, om); - ASSERT(ret == 0); -} - -void DfuService::NotificationManager::Reset() { - connectionHandle = 0; - characteristicHandle = 0; - size = 0; - xTimerStop(timer, 0); -} - -void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc) { - 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; - ASSERT(size <= 20); - - std::memcpy(tempBuffer + bufferWriteIndex, data, size); - bufferWriteIndex += size; - - if(bufferWriteIndex == bufferSize) { - spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); - totalWriteIndex += bufferWriteIndex; - bufferWriteIndex = 0; - } - - if(bufferWriteIndex > 0 && totalWriteIndex + bufferWriteIndex == totalSize) { - spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); - totalWriteIndex += bufferWriteIndex; - if (totalSize < maxSize) - WriteMagicNumber(); - } -} - -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 offset = writeOffset + (maxSize - (4 * sizeof(uint32_t))); - spiNorFlash.Write(offset, reinterpret_cast(magic), 4 * sizeof(uint32_t)); -} - -void DfuService::DfuImage::Erase() { - for (size_t erased = 0; erased < maxSize; erased += 0x1000) { - spiNorFlash.SectorErase(writeOffset + erased); - } -} - -bool DfuService::DfuImage::Validate() { - uint32_t chunkSize = 200; - size_t currentOffset = 0; - uint16_t crc = 0; - - bool first = true; - while (currentOffset < totalSize) { - uint32_t readSize = (totalSize - currentOffset) > chunkSize ? chunkSize : (totalSize - currentOffset); - - spiNorFlash.Read(writeOffset + currentOffset, tempBuffer, readSize); - if (first) { - crc = ComputeCrc(tempBuffer, readSize, NULL); - first = false; - } else - crc = ComputeCrc(tempBuffer, readSize, &crc); - currentOffset += readSize; - } - - return (crc == expectedCrc); -} - -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++) { - crc = (uint8_t) (crc >> 8) | (crc << 8); - crc ^= p_data[i]; - crc ^= (uint8_t) (crc & 0xFF) >> 4; - crc ^= (crc << 8) << 4; - crc ^= ((crc & 0xFF) << 4) << 1; - } - - return crc; -} - -bool DfuService::DfuImage::IsComplete() { - if(!ready) return false; - return totalWriteIndex == totalSize; -} diff --git a/src/Components/Ble/DfuService.h b/src/Components/Ble/DfuService.h deleted file mode 100644 index d7ba460..0000000 --- a/src/Components/Ble/DfuService.h +++ /dev/null @@ -1,161 +0,0 @@ -#pragma once - -#include -#include - -#include - -namespace Pinetime { - namespace System { - class SystemTask; - } - namespace Drivers { - class SpiNorFlash; - } - namespace Controllers { - 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: - 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); - - }; - - 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/ImmediateAlertService.cpp b/src/Components/Ble/ImmediateAlertService.cpp deleted file mode 100644 index d2c4cff..0000000 --- a/src/Components/Ble/ImmediateAlertService.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "ImmediateAlertService.h" -#include -#include "AlertNotificationService.h" - -using namespace Pinetime::Controllers; - -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); - 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 ""; - } - } -} - -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 - }, - }{ - -} - -void ImmediateAlertService::Init() { - int res = 0; - res = ble_gatts_count_cfg(serviceDefinition); - ASSERT(res == 0); - - res = ble_gatts_add_svcs(serviceDefinition); - 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) { - auto alertLevel = static_cast(context->om->om_data[0]); - auto* alertString = ToString(alertLevel); - notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, alertString, strlen(alertString)); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); - } - } - - return 0; -} \ No newline at end of file diff --git a/src/Components/Ble/ImmediateAlertService.h b/src/Components/Ble/ImmediateAlertService.h deleted file mode 100644 index c42846c..0000000 --- a/src/Components/Ble/ImmediateAlertService.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once -#include - -namespace Pinetime { - namespace System { - class SystemTask; - } - namespace Controllers { - class NotificationManager; - class ImmediateAlertService { - 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); - - private: - Pinetime::System::SystemTask& systemTask; - NotificationManager& notificationManager; - - 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 alertLevelUuid { - .u {.type = BLE_UUID_TYPE_16}, - .value = alertLevelId - }; - - struct ble_gatt_chr_def characteristicDefinition[3]; - struct ble_gatt_svc_def serviceDefinition[2]; - - uint16_t alertLevelHandle; - }; - } -} diff --git a/src/Components/Ble/MusicService.cpp b/src/Components/Ble/MusicService.cpp deleted file mode 100644 index b5fa535..0000000 --- a/src/Components/Ble/MusicService.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include -#include "MusicService.h" - -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) -{ - msUuid.value[11] = msId[0]; - msUuid.value[12] = msId[1]; - msEventCharUuid.value[11] = msEventCharId[0]; - msEventCharUuid.value[12] = msEventCharId[1]; - msStatusCharUuid.value[11] = msStatusCharId[0]; - msStatusCharUuid.value[12] = msStatusCharId[1]; - msTrackCharUuid.value[11] = msTrackCharId[0]; - msTrackCharUuid.value[12] = msTrackCharId[1]; - msArtistCharUuid.value[11] = msArtistCharId[0]; - msArtistCharUuid.value[12] = msArtistCharId[1]; - msAlbumCharUuid.value[11] = msAlbumCharId[0]; - msAlbumCharUuid.value[12] = msAlbumCharId[1]; - - characteristicDefinition[0] = { .uuid = (ble_uuid_t*)(&msEventCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_NOTIFY, - .val_handle = &m_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] = {0}; - - serviceDefinition[0] = { - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &msUuid, - .characteristics = characteristicDefinition - }; - serviceDefinition[1] = {0}; - - m_artist = "Waiting for"; - m_album = ""; - m_track = "track information..."; -} - -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) { - - 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]; - NRF_LOG_INFO("DATA : %s", s); - if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msArtistCharUuid) == 0) { - m_artist = s; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msTrackCharUuid) == 0) { - m_track = s; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msAlbumCharUuid) == 0) { - m_album = s; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msStatusCharUuid) == 0) { - m_status = s[0]; - } - } - return 0; -} - -std::string Pinetime::Controllers::MusicService::album() -{ - return m_album; -} - -std::string Pinetime::Controllers::MusicService::artist() -{ - return m_artist; -} - -std::string Pinetime::Controllers::MusicService::track() -{ - return m_track; -} - -unsigned char Pinetime::Controllers::MusicService::status() -{ - return m_status; -} - -void Pinetime::Controllers::MusicService::event(char event) -{ - 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, m_eventHandle, om); -} - diff --git a/src/Components/Ble/MusicService.h b/src/Components/Ble/MusicService.h deleted file mode 100644 index ab6db57..0000000 --- a/src/Components/Ble/MusicService.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -//c7e50000-78fc-48fe-8e23-43b37a1942d0 -#define MUSIC_SERVICE_UUID_BASE {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0xe5, 0xc7} - -namespace Pinetime { - namespace System { - class SystemTask; - } - namespace Controllers { - - class MusicService { - public: - MusicService(Pinetime::System::SystemTask &system); - void Init(); - int OnCommand(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt); - - std::string artist(); - std::string track(); - std::string album(); - unsigned char status(); - - void event(char event); - - static const char EVENT_MUSIC_OPEN = 0xe0; - static const char EVENT_MUSIC_PLAY = 0x00; - static const char EVENT_MUSIC_PAUSE = 0x01; - static const char EVENT_MUSIC_NEXT = 0x03; - static const char EVENT_MUSIC_PREV = 0x04; - static const char EVENT_MUSIC_VOLUP = 0x05; - static const char EVENT_MUSIC_VOLDOWN = 0x06; - static const char STATUS_MUSIC_PAUSED = 0x00; - static const char STATUS_MUSIC_PLAYING = 0x01; - - private: - static constexpr uint8_t msId[2] = {0x00, 0x01}; - static constexpr uint8_t msEventCharId[2] = {0x00, 0x02}; - static constexpr uint8_t msStatusCharId[2] = {0x00, 0x03}; - static constexpr uint8_t msArtistCharId[2] = {0x00, 0x04}; - static constexpr uint8_t msTrackCharId[2] = {0x00, 0x05}; - static constexpr uint8_t msAlbumCharId[2] = {0x00, 0x06}; - - 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 - }; - - struct ble_gatt_chr_def characteristicDefinition[6]; - struct ble_gatt_svc_def serviceDefinition[2]; - - uint16_t m_eventHandle; - - std::string m_artist; - std::string m_album; - std::string m_track; - - unsigned char m_status; - - Pinetime::System::SystemTask& m_system; - - }; - } -} - diff --git a/src/Components/Ble/NimbleController.cpp b/src/Components/Ble/NimbleController.cpp deleted file mode 100644 index b13f9ce..0000000 --- a/src/Components/Ble/NimbleController.cpp +++ /dev/null @@ -1,337 +0,0 @@ - -#include - -#include -#include -#include - -#include "NimbleController.h" -#include "MusicService.h" -#include -#include -#include -#include -#include -#include - - - -using namespace Pinetime::Controllers; - -// TODO I'm not satisfied by how this code looks like (AlertNotificationClient and CurrentTimeClient must -// expose too much data, too many callbacks -> NimbleController -> CTS/ANS client. -// Let's try to improve this code (and keep it working!) - -NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask, - Pinetime::Controllers::Ble& bleController, - DateTime& dateTimeController, - Pinetime::Controllers::NotificationManager& notificationManager, - Controllers::Battery& batteryController, - Pinetime::Drivers::SpiNorFlash& spiNorFlash) : - 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}, - batteryInformationService{batteryController}, - immediateAlertService{systemTask, notificationManager} { - -} - -int GAPEventCallback(struct ble_gap_event *event, void *arg) { - auto nimbleController = static_cast(arg); - return nimbleController->OnGAPEvent(event); -} - -int CurrentTimeCharacteristicDiscoveredCallback(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->OnCTSCharacteristicDiscoveryEvent(conn_handle, error, chr); -} - -int AlertNotificationCharacteristicDiscoveredCallback(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->OnANSCharacteristicDiscoveryEvent(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); - return client->OnCurrentTimeReadResult(conn_handle, error, attr); -} - -int AlertNotificationDescriptorDiscoveryEventCallback(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->OnANSDescriptorDiscoveryEventCallback(conn_handle, error, chr_val_handle, dsc); -} - -void NimbleController::Init() { - while (!ble_hs_synced()) {} - - ble_svc_gap_init(); - ble_svc_gatt_init(); - - deviceInformationService.Init(); - currentTimeClient.Init(); - currentTimeService.Init(); - musicService.Init(); - anService.Init(); - dfuService.Init(); - batteryInformationService.Init(); - immediateAlertService.Init(); - int res; - res = ble_hs_util_ensure_addr(0); - ASSERT(res == 0); - res = ble_hs_id_infer_auto(0, &addrType); - ASSERT(res == 0); - res = ble_svc_gap_device_name_set(deviceName); - ASSERT(res == 0); - Pinetime::Controllers::Ble::BleAddress address; - res = ble_hs_id_copy_addr(addrType, address.data(), nullptr); - ASSERT(res == 0); - bleController.AddressType((addrType == 0) ? Ble::AddressTypes::Public : Ble::AddressTypes::Random); - bleController.Address(std::move(address)); - - res = ble_gatts_start(); - ASSERT(res == 0); -} - -void NimbleController::StartAdvertising() { - if(ble_gap_adv_active()) return; - - ble_svc_gap_device_name_set(deviceName); - - /* set adv parameters */ - struct ble_gap_adv_params adv_params; - struct ble_hs_adv_fields fields; - /* advertising payload is split into advertising data and advertising - response, because all data cannot fit into single packet; name of device - is sent as response to scan request */ - struct ble_hs_adv_fields rsp_fields; - - /* fill all fields and parameters with zeros */ - memset(&adv_params, 0, sizeof(adv_params)); - memset(&fields, 0, sizeof(fields)); - memset(&rsp_fields, 0, sizeof(rsp_fields)); - - 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.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_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) - - ble_gap_adv_rsp_set_fields(&rsp_fields); -// 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. - // 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 - // the advertising should be improve (better error handling, and advertise for 3 minutes after - // the application has been woken up, for example. -} - -int OnAllSvrDisco(uint16_t conn_handle, - const struct ble_gatt_error *error, - const struct ble_gatt_svc *service, - void *arg) { - auto nimbleController = static_cast(arg); - return nimbleController->OnDiscoveryEvent(conn_handle, error, service); - return 0; -} - -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"); - NRF_LOG_INFO("advertise complete; reason=%dn status=%d", event->adv_complete.reason, event->connect.status); - break; - case BLE_GAP_EVENT_CONNECT: { - 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); - - if (event->connect.status != 0) { - /* Connection failed; resume advertising. */ - StartAdvertising(); - bleController.Disconnect(); - } else { - bleController.Connect(); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleConnected); - connectionHandle = event->connect.conn_handle; - // Service discovery is deffered via systemtask - } - } - break; - case BLE_GAP_EVENT_DISCONNECT: - NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_DISCONNECT"); - NRF_LOG_INFO("disconnect; reason=%d", event->disconnect.reason); - - /* Connection terminated; resume advertising. */ - connectionHandle = BLE_HS_CONN_HANDLE_NONE; - bleController.Disconnect(); - StartAdvertising(); - break; - case BLE_GAP_EVENT_CONN_UPDATE: - NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_CONN_UPDATE"); - /* The central has updated the connection parameters. */ - NRF_LOG_INFO("connection updated; status=%d ", event->conn_update.status); - break; - case BLE_GAP_EVENT_ENC_CHANGE: - /* Encryption has been enabled or disabled for this connection. */ - NRF_LOG_INFO("encryption change event; status=%d ", event->enc_change.status); - 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); - 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); - return 0; - - case BLE_GAP_EVENT_REPEAT_PAIRING: { - /* We already have a bond with the peer, but it is attempting to - * establish a new secure link. This app sacrifices security for - * convenience: just throw away the old bond and accept the new link. - */ - - /* Delete the old bond. */ - struct ble_gap_conn_desc desc; - ble_gap_conn_find(event->repeat_pairing.conn_handle, &desc); - ble_store_util_delete_peer(&desc.peer_id_addr); - - /* Return BLE_GAP_REPEAT_PAIRING_RETRY to indicate that the host should - * continue with the pairing operation. - */ - } - return BLE_GAP_REPEAT_PAIRING_RETRY; - - case BLE_GAP_EVENT_NOTIFY_RX: { - /* Peer sent us a notification or indication. */ - size_t notifSize = OS_MBUF_PKTLEN(event->notify_rx.om); - - NRF_LOG_INFO("received %s; conn_handle=%d attr_handle=%d " - "attr_len=%d", - event->notify_rx.indication ? - "indication" : - "notification", - event->notify_rx.conn_handle, - event->notify_rx.attr_handle, - notifSize); - - alertNotificationClient.OnNotification(event); - return 0; - } - /* Attribute data is contained in event->notify_rx.attr_data. */ - - default: -// NRF_LOG_INFO("Advertising event : %d", event->type); - break; - } - return 0; -} - -int NimbleController::OnDiscoveryEvent(uint16_t i, const ble_gatt_error *error, const ble_gatt_svc *service) { - if(service == nullptr && error->status == BLE_HS_EDONE) { - NRF_LOG_INFO("Service Discovery complete"); - if(currentTimeClient.IsDiscovered()) { - ble_gattc_disc_all_chrs(connectionHandle, currentTimeClient.StartHandle(), currentTimeClient.EndHandle(), - CurrentTimeCharacteristicDiscoveredCallback, this); - - } else if(alertNotificationClient.IsDiscovered()) { - ble_gattc_disc_all_chrs(connectionHandle, alertNotificationClient.StartHandle(), alertNotificationClient.EndHandle(), - AlertNotificationCharacteristicDiscoveredCallback, this); - } - } - - alertNotificationClient.OnDiscoveryEvent(i, error, service); - currentTimeClient.OnDiscoveryEvent(i, error, service); - return 0; -} - -int NimbleController::OnCTSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, - const ble_gatt_chr *characteristic) { - if(characteristic == nullptr && error->status == BLE_HS_EDONE) { - NRF_LOG_INFO("CTS characteristic Discovery complete"); - ble_gattc_read(connectionHandle, currentTimeClient.CurrentTimeHandle(), CurrentTimeReadCallback, this); - return 0; - } - return currentTimeClient.OnCharacteristicDiscoveryEvent(connectionHandle, error, characteristic); -} - -int NimbleController::OnANSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, - const ble_gatt_chr *characteristic) { - if(characteristic == nullptr && error->status == BLE_HS_EDONE) { - NRF_LOG_INFO("ANS characteristic Discovery complete"); - ble_gattc_disc_all_dscs(connectionHandle, - alertNotificationClient.NewAlerthandle(), alertNotificationClient.EndHandle(), - AlertNotificationDescriptorDiscoveryEventCallback, this); - return 0; - } - return alertNotificationClient.OnCharacteristicsDiscoveryEvent(connectionHandle, error, characteristic); -} - -int NimbleController::OnCurrentTimeReadResult(uint16_t connectionHandle, const ble_gatt_error *error, ble_gatt_attr *attribute) { - currentTimeClient.OnCurrentTimeReadResult(connectionHandle, error, attribute); - - if (alertNotificationClient.IsDiscovered()) { - ble_gattc_disc_all_chrs(connectionHandle, alertNotificationClient.StartHandle(), - alertNotificationClient.EndHandle(), - AlertNotificationCharacteristicDiscoveredCallback, this); - } - return 0; -} - -int NimbleController::OnANSDescriptorDiscoveryEventCallback(uint16_t connectionHandle, const ble_gatt_error *error, - uint16_t characteristicValueHandle, - const ble_gatt_dsc *descriptor) { - return alertNotificationClient.OnDescriptorDiscoveryEventCallback(connectionHandle, error, characteristicValueHandle, descriptor); -} - -void NimbleController::StartDiscovery() { - ble_gattc_disc_all_svcs(connectionHandle, OnAllSvrDisco, this); -} - - -uint16_t NimbleController::connHandle() { - return connectionHandle; -} - diff --git a/src/Components/Ble/NimbleController.h b/src/Components/Ble/NimbleController.h deleted file mode 100644 index 89fa425..0000000 --- a/src/Components/Ble/NimbleController.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include -#include "AlertNotificationService.h" -#include "AlertNotificationClient.h" -#include "DeviceInformationService.h" -#include "CurrentTimeClient.h" -#include "DfuService.h" -#include "CurrentTimeService.h" -#include "MusicService.h" -#include "BatteryInformationService.h" -#include "ImmediateAlertService.h" -#include - -namespace Pinetime { - namespace Drivers { - class SpiNorFlash; - } - namespace Controllers { - class DateTime; - - 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); - 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); - - void StartDiscovery(); - - Pinetime::Controllers::MusicService& music() {return musicService;}; - - 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; - - DeviceInformationService deviceInformationService; - CurrentTimeClient currentTimeClient; - AlertNotificationService anService; - AlertNotificationClient alertNotificationClient; - CurrentTimeService currentTimeService; - MusicService musicService; - BatteryInformationService batteryInformationService; - ImmediateAlertService immediateAlertService; - - 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} - }; - }; - } -} diff --git a/src/Components/Ble/NotificationManager.cpp b/src/Components/Ble/NotificationManager.cpp deleted file mode 100644 index 0aea069..0000000 --- a/src/Components/Ble/NotificationManager.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include "NotificationManager.h" - -using namespace Pinetime::Controllers; - -void NotificationManager::Push(Pinetime::Controllers::NotificationManager::Categories category, - const char *message, uint8_t currentMessageSize) { - // TODO handle edge cases on read/write index - auto checkedSize = std::min(currentMessageSize, uint8_t{18}); - auto& notif = notifications[writeIndex]; - std::memcpy(notif.message.data(), message, checkedSize); - notif.message[checkedSize] = '\0'; - notif.category = category; - - writeIndex = (writeIndex + 1 < TotalNbNotifications) ? writeIndex + 1 : 0; - if(!empty && writeIndex == readIndex) - readIndex = writeIndex + 1; -} - -NotificationManager::Notification Pinetime::Controllers::NotificationManager::Pop() { -// TODO handle edge cases on read/write index - NotificationManager::Notification notification = notifications[readIndex]; - - if(readIndex != writeIndex) { - readIndex = (readIndex + 1 < TotalNbNotifications) ? readIndex + 1 : 0; - } - - // TODO Check move optimization on return - return notification; -} diff --git a/src/Components/Ble/NotificationManager.h b/src/Components/Ble/NotificationManager.h deleted file mode 100644 index daa1571..0000000 --- a/src/Components/Ble/NotificationManager.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include - -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{18}; - - struct Notification { - std::array message; - Categories category = Categories::Unknown; - }; - - void Push(Categories category, const char* message, uint8_t messageSize); - Notification Pop(); - - - private: - static constexpr uint8_t TotalNbNotifications = 5; - std::array notifications; - uint8_t readIndex = 0; - uint8_t writeIndex = 0; - bool empty = true; - }; - } -} \ No newline at end of file diff --git a/src/Components/Brightness/BrightnessController.cpp b/src/Components/Brightness/BrightnessController.cpp deleted file mode 100644 index c8825d6..0000000 --- a/src/Components/Brightness/BrightnessController.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include "BrightnessController.h" - -using namespace Pinetime::Controllers; - - -void BrightnessController::Init() { - nrf_gpio_cfg_output(pinLcdBacklight1); - nrf_gpio_cfg_output(pinLcdBacklight2); - nrf_gpio_cfg_output(pinLcdBacklight3); - Set(level); -} - -void BrightnessController::Set(BrightnessController::Levels level) { - this->level = level; - switch(level) { - default: - case Levels::High: - nrf_gpio_pin_clear(pinLcdBacklight1); - nrf_gpio_pin_clear(pinLcdBacklight2); - nrf_gpio_pin_clear(pinLcdBacklight3); - break; - case Levels::Medium: - nrf_gpio_pin_clear(pinLcdBacklight1); - nrf_gpio_pin_clear(pinLcdBacklight2); - nrf_gpio_pin_set(pinLcdBacklight3); - break; - case Levels::Low: - nrf_gpio_pin_clear(pinLcdBacklight1); - nrf_gpio_pin_set(pinLcdBacklight2); - nrf_gpio_pin_set(pinLcdBacklight3); - break; - case Levels::Off: - nrf_gpio_pin_set(pinLcdBacklight1); - nrf_gpio_pin_set(pinLcdBacklight2); - nrf_gpio_pin_set(pinLcdBacklight3); - break; - } -} - -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; - } -} - -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; - } -} - -BrightnessController::Levels BrightnessController::Level() const { - return level; -} - -void BrightnessController::Backup() { - backupLevel = level; -} - -void BrightnessController::Restore() { - Set(backupLevel); -} - diff --git a/src/Components/Brightness/BrightnessController.h b/src/Components/Brightness/BrightnessController.h deleted file mode 100644 index b8354ec..0000000 --- a/src/Components/Brightness/BrightnessController.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include - -namespace Pinetime { - namespace Controllers { - class BrightnessController { - public: - enum class Levels {Off, Low, Medium, High}; - void Init(); - - void Set(Levels level); - Levels Level() const; - void Lower(); - void Higher(); - - void Backup(); - void Restore(); - - private: - static constexpr uint8_t pinLcdBacklight1 = 14; - static constexpr uint8_t pinLcdBacklight2 = 22; - static constexpr uint8_t pinLcdBacklight3 = 23; - Levels level = Levels::High; - Levels backupLevel = Levels::High; - }; - } -} diff --git a/src/Components/DateTime/DateTimeController.cpp b/src/Components/DateTime/DateTimeController.cpp deleted file mode 100644 index 30d9c13..0000000 --- a/src/Components/DateTime/DateTimeController.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "DateTimeController.h" -#include -#include - -using namespace Pinetime::Controllers; - - -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)); - - NRF_LOG_INFO("%d %d %d ", day, month, year); - NRF_LOG_INFO("%d %d %d ", hour, minute, second); - previousSystickCounter = systickCounter; - - UpdateTime(systickCounter); - NRF_LOG_INFO("* %d %d %d ", this->hour, this->minute, this->second); - NRF_LOG_INFO("* %d %d %d ", this->day, this->month, this->year); -} - -void DateTime::UpdateTime(uint32_t systickCounter) { - // Handle systick counter overflow - uint32_t systickDelta = 0; - if(systickCounter < previousSystickCounter) { - systickDelta = 0xffffff - previousSystickCounter; - systickDelta += systickCounter + 1; - } else { - systickDelta = systickCounter - previousSystickCounter; - } - - /* - * 1000 ms = 1024 ticks - */ - auto correctedDelta = systickDelta / 1024; - auto rest = (systickDelta - (correctedDelta*1024)); - if(systickCounter >= rest) { - previousSystickCounter = systickCounter - rest; - } else { - previousSystickCounter = 0xffffff - (rest - systickCounter); - } - - currentDateTime += std::chrono::seconds(correctedDelta); - uptime += std::chrono::seconds(correctedDelta); - - auto dp = date::floor(currentDateTime); - 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(); - dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); - - hour = time.hours().count(); - minute = time.minutes().count(); - second = time.seconds().count(); -} - diff --git a/src/Components/DateTime/DateTimeController.h b/src/Components/DateTime/DateTimeController.h deleted file mode 100644 index d602074..0000000 --- a/src/Components/DateTime/DateTimeController.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#include - -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}; - - 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; } - - std::chrono::time_point CurrentDateTime() const { return currentDateTime; } - std::chrono::seconds Uptime() const { return uptime; } - private: - 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; - - uint32_t previousSystickCounter = 0; - std::chrono::time_point currentDateTime; - std::chrono::seconds uptime {0}; - }; - } -} \ No newline at end of file diff --git a/src/Components/FirmwareValidator/FirmwareValidator.cpp b/src/Components/FirmwareValidator/FirmwareValidator.cpp deleted file mode 100644 index 244d5c0..0000000 --- a/src/Components/FirmwareValidator/FirmwareValidator.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -#include "FirmwareValidator.h" - -using namespace Pinetime::Controllers; - -bool FirmwareValidator::IsValidated() const { - auto* imageOkPtr = reinterpret_cast(validBitAdress); - return (*imageOkPtr) == validBitValue; -} - -void FirmwareValidator::Validate() { - if(!IsValidated()) - Pinetime::Drivers::InternalFlash::WriteWord(validBitAdress, validBitValue); -} - -void FirmwareValidator::Reset() { - NVIC_SystemReset(); -} diff --git a/src/Components/FirmwareValidator/FirmwareValidator.h b/src/Components/FirmwareValidator/FirmwareValidator.h deleted file mode 100644 index aa576d8..0000000 --- a/src/Components/FirmwareValidator/FirmwareValidator.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include - -namespace Pinetime { - namespace Controllers { - class FirmwareValidator { - public: - void Validate(); - bool IsValidated() const; - - 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 deleted file mode 100644 index 3c5dbfb..0000000 --- a/src/Components/Gfx/Gfx.cpp +++ /dev/null @@ -1,207 +0,0 @@ -#include -#include -#include -#include "Gfx.h" -#include "../../drivers/St7789.h" -using namespace Pinetime::Components; - -Gfx::Gfx(Pinetime::Drivers::St7789 &lcd) : lcd{lcd} { -} - -void Gfx::Init() { - -} - -void Gfx::ClearScreen() { - SetBackgroundColor(0x0000); - - state.remainingIterations = 240 + 1; - state.currentIteration = 0; - state.busy = true; - state.action = Action::FillRectangle; - state.taskToNotify = xTaskGetCurrentTaskHandle(); - - lcd.BeginDrawBuffer(0, 0, width, height); - lcd.NextDrawBuffer(reinterpret_cast(buffer), width * 2); - WaitTransfertFinished(); - -} - -void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t color) { - SetBackgroundColor(color); - - state.remainingIterations = h; - state.currentIteration = 0; - state.busy = true; - state.action = Action::FillRectangle; - state.color = color; - state.taskToNotify = xTaskGetCurrentTaskHandle(); - - lcd.BeginDrawBuffer(x, y, w, h); - lcd.NextDrawBuffer(reinterpret_cast(buffer), width * 2); - - WaitTransfertFinished(); -} - -void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t* b) { - state.remainingIterations = h; - state.currentIteration = 0; - state.busy = true; - state.action = Action::FillRectangle; - state.color = 0x00; - state.taskToNotify = xTaskGetCurrentTaskHandle(); - - lcd.BeginDrawBuffer(x, y, w, h); - lcd.NextDrawBuffer(reinterpret_cast(b), width * 2); - - WaitTransfertFinished(); -} - -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; - } - - uint8_t current_x = x; - uint8_t current_y = y; - - for (size_t i = 0; text[i] != '\0'; i++) { - if (text[i] == '\n') { - current_x = x; - current_y += p_font->height + p_font->height / 10; - } else { - DrawChar(p_font, (uint8_t) text[i], ¤t_x, current_y, color); - } - - uint8_t char_idx = text[i] - p_font->startChar; - uint16_t char_width = text[i] == ' ' ? (p_font->height / 2) : p_font->charInfo[char_idx].widthBits; - - if (current_x > (width - char_width)) { - if (wrap) { - current_x = x; - current_y += p_font->height + p_font->height / 10; - } else { - break; - } - - if (y > (height - p_font->height)) { - break; - } - } - } -} - -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; - - if (c == ' ') { - *x += font->height / 2; - return; - } - - // Build first line - 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; - } - } - } - - state.remainingIterations = font->height + 0; - state.currentIteration = 0; - state.busy = true; - state.action = Action::DrawChar; - state.font = const_cast(font); - state.character = c; - state.color = color; - state.taskToNotify = xTaskGetCurrentTaskHandle(); - - lcd.BeginDrawBuffer(*x, y, bytes_in_line*8, font->height); - lcd.NextDrawBuffer(reinterpret_cast(&buffer), bytes_in_line*8*2); - WaitTransfertFinished(); - - *x += font->charInfo[char_idx].widthBits + font->spacePixels; -} - -void Gfx::pixel_draw(uint8_t x, uint8_t y, uint16_t color) { - lcd.DrawPixel(x, y, color); -} - -void Gfx::Sleep() { - lcd.Sleep(); -} - -void Gfx::Wakeup() { - lcd.Wakeup(); -} - -void Gfx::SetBackgroundColor(uint16_t color) { - for(int i = 0; i < width; i++) { - buffer[i] = color; - } -} - -bool Gfx::GetNextBuffer(uint8_t **data, size_t &size) { - if(!state.busy) return false; - state.remainingIterations--; - if (state.remainingIterations == 0) { - state.busy = false; - NotifyEndOfTransfert(state.taskToNotify); - return false; - } - - if(state.action == Action::FillRectangle) { - *data = reinterpret_cast(buffer); - size = width * 2; - } 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; - } - } - } - - *data = reinterpret_cast(buffer); - size = bytes_in_line*8*2; - } - - state.currentIteration++; - - return true; -} - -void Gfx::NotifyEndOfTransfert(TaskHandle_t task) { - if(task != nullptr) { - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - vTaskNotifyGiveFromISR(task, &xHigherPriorityTaskWoken); - portYIELD_FROM_ISR(xHigherPriorityTaskWoken); - } -} - -void Gfx::WaitTransfertFinished() const { - ulTaskNotifyTake(pdTRUE, 500); -} - -void Gfx::SetScrollArea(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines) { - lcd.VerticalScrollDefinition(topFixedLines, scrollLines, bottomFixedLines); -} - -void Gfx::SetScrollStartLine(uint16_t line) { - lcd.VerticalScrollStartAddress(line); -} - diff --git a/src/Components/Gfx/Gfx.h b/src/Components/Gfx/Gfx.h deleted file mode 100644 index 091f06f..0000000 --- a/src/Components/Gfx/Gfx.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include - - -namespace Pinetime { - namespace Drivers { - class St7789; - } - 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); - - - 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; - }; - - volatile State state; - - uint16_t buffer[width]; // 1 line buffer - Drivers::St7789& lcd; - - void SetBackgroundColor(uint16_t color); - void WaitTransfertFinished() const; - void NotifyEndOfTransfert(TaskHandle_t task); - }; - } -} diff --git a/src/components/Battery/BatteryController.cpp b/src/components/Battery/BatteryController.cpp new file mode 100644 index 0000000..571efae --- /dev/null +++ b/src/components/Battery/BatteryController.cpp @@ -0,0 +1,48 @@ +#include +#include +#include +#include +#include "BatteryController.h" + +using namespace Pinetime::Controllers; + +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); + + nrfx_saadc_config_t adcConfig = NRFX_SAADC_DEFAULT_CONFIG; + nrfx_saadc_init(&adcConfig, SaadcEventHandler); + 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_DISABLED, + .pin_p = batteryVoltageAdcInput, + .pin_n = NRF_SAADC_INPUT_DISABLED + }; + nrfx_saadc_channel_init(0, &adcChannelConfig); +} + +void Battery::Update() { + isCharging = !nrf_gpio_pin_read(chargingPin); + isPowerPresent = !nrf_gpio_pin_read(powerPresentPin); + + nrf_saadc_value_t value = 0; + nrfx_saadc_sample_convert(0, &value); + + // see https://forum.pine64.org/showthread.php?tid=8147 + voltage = (value * 2.0f) / (1024/3.0f); + percentRemaining = ((voltage - 3.55f)*100.0f)*3.9f; + percentRemaining = std::max(percentRemaining, 0.0f); + percentRemaining = std::min(percentRemaining, 100.0f); + +// NRF_LOG_INFO("BATTERY " NRF_LOG_FLOAT_MARKER " %% - " NRF_LOG_FLOAT_MARKER " v", NRF_LOG_FLOAT(percentRemaining), NRF_LOG_FLOAT(voltage)); +// NRF_LOG_INFO("POWER Charging : %d - Power : %d", isCharging, isPowerPresent); +} + +void Battery::SaadcEventHandler(nrfx_saadc_evt_t const * event) { + +} \ No newline at end of file diff --git a/src/components/Battery/BatteryController.h b/src/components/Battery/BatteryController.h new file mode 100644 index 0000000..f07648a --- /dev/null +++ b/src/components/Battery/BatteryController.h @@ -0,0 +1,27 @@ +#pragma once +#include + + +namespace Pinetime { + namespace Controllers { + class Battery { + public: + void Init(); + void Update(); + float PercentRemaining() const { return percentRemaining; } + float Voltage() const { return voltage; } + bool IsCharging() const { return isCharging; } + bool IsPowerPresent() const { return isPowerPresent; } + + private: + static constexpr uint32_t chargingPin = 12; + static constexpr uint32_t powerPresentPin = 19; + static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7; + static void SaadcEventHandler(nrfx_saadc_evt_t const * p_event); + float percentRemaining = 0.0f; + float voltage = 0.0f; + bool isCharging = false; + bool isPowerPresent = false; + }; + } +} \ No newline at end of file diff --git a/src/components/Ble/AlertNotificationClient.cpp b/src/components/Ble/AlertNotificationClient.cpp new file mode 100644 index 0000000..3e4b495 --- /dev/null +++ b/src/components/Ble/AlertNotificationClient.cpp @@ -0,0 +1,145 @@ +#include +#include "NotificationManager.h" + +#include "AlertNotificationClient.h" + + +using namespace Pinetime::Controllers; +constexpr ble_uuid16_t AlertNotificationClient::ansServiceUuid; + +constexpr ble_uuid16_t AlertNotificationClient::supportedNewAlertCategoryUuid; +constexpr ble_uuid16_t AlertNotificationClient::supportedUnreadAlertCategoryUuid ; +constexpr ble_uuid16_t AlertNotificationClient::newAlertUuid; +constexpr ble_uuid16_t AlertNotificationClient::unreadAlertStatusUuid; +constexpr ble_uuid16_t AlertNotificationClient::controlPointUuid; + +int Pinetime::Controllers::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& notificationManager) : + systemTask{systemTask}, notificationManager{notificationManager}{ + +} + +bool AlertNotificationClient::OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, const ble_gatt_svc *service) { + if(service == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("ANS Discovery complete"); + return true; + } + + if(service != nullptr && ble_uuid_cmp(((ble_uuid_t*)&ansServiceUuid), &service->uuid.u) == 0) { + NRF_LOG_INFO("ANS discovered : 0x%x", service->start_handle); + ansStartHandle = service->start_handle; + ansEndHandle = service->end_handle; + isDiscovered = true; + } + return false; +} + +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"); + return 0; + } + + if(characteristic == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("ANS Characteristic discovery complete"); + } else { + 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) { + 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) { + NRF_LOG_INFO("ANS Characteristic discovered : newAlertUuid"); + newAlertHandle = characteristic->val_handle; + newAlertDefHandle = characteristic->def_handle; + } 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) { + NRF_LOG_INFO("ANS Characteristic discovered : controlPointUuid"); + controlPointHandle = 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) { + if(error->status == 0) { + NRF_LOG_INFO("ANS New alert subscribe OK"); + } else { + NRF_LOG_INFO("ANS New alert subscribe ERROR"); + } + + return 0; +} + +int AlertNotificationClient::OnDescriptorDiscoveryEventCallback(uint16_t connectionHandle, const ble_gatt_error *error, + uint16_t characteristicValueHandle, + const ble_gatt_dsc *descriptor) { + if(error->status == 0) { + 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; + uint8_t value[2]; + value[0] = 1; + value[1] = 0; + ble_gattc_write_flat(connectionHandle, newAlertDescriptorHandle, value, sizeof(value), NewAlertSubcribeCallback, this); + } + } + } + return 0; +} + +void AlertNotificationClient::OnNotification(ble_gap_event *event) { + if(event->notify_rx.attr_handle == newAlertHandle) { + // TODO implement this with more memory safety (and constexpr) + static const size_t maxBufferSize{21}; + static const size_t maxMessageSize{18}; + size_t bufferSize = min(OS_MBUF_PKTLEN(event->notify_rx.om), maxBufferSize); + + uint8_t data[bufferSize]; + os_mbuf_copydata(event->notify_rx.om, 0, bufferSize, data); + + char *s = (char *) &data[3]; + auto messageSize = min(maxMessageSize, (bufferSize-3)); + + for (uint i = 0; i < messageSize-1; i++) { + if (s[i] == 0x00) { + s[i] = 0x0A; + } + } + s[messageSize-1] = '\0'; + + notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, s, messageSize); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); + } +} + +bool AlertNotificationClient::IsDiscovered() const { + return isDiscovered; +} + +uint16_t AlertNotificationClient::StartHandle() const { + return ansStartHandle; +} + +uint16_t AlertNotificationClient::EndHandle() const { + return ansEndHandle; +} + +uint16_t AlertNotificationClient::NewAlerthandle() const { + return newAlertHandle; +} diff --git a/src/components/Ble/AlertNotificationClient.h b/src/components/Ble/AlertNotificationClient.h new file mode 100644 index 0000000..ca4f4e9 --- /dev/null +++ b/src/components/Ble/AlertNotificationClient.h @@ -0,0 +1,81 @@ +#pragma once + +#include +#include +#include + + +namespace Pinetime { + namespace Controllers { + int NewAlertSubcribeCallback(uint16_t conn_handle, + const struct ble_gatt_error *error, + struct ble_gatt_attr *attr, + void *arg); + + class AlertNotificationClient { + public: + explicit AlertNotificationClient(Pinetime::System::SystemTask &systemTask, + Pinetime::Controllers::NotificationManager ¬ificationManager); + + 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); + bool IsDiscovered() const; + uint16_t StartHandle() const; + uint16_t EndHandle() const; + + static constexpr const ble_uuid16_t &Uuid() { return ansServiceUuid; } + + uint16_t NewAlerthandle() const; + 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 + }; + + uint16_t ansStartHandle; + uint16_t ansEndHandle; + uint16_t supportedNewAlertCategoryHandle; + uint16_t supportedUnreadAlertCategoryHandle; + uint16_t newAlertHandle; + uint16_t newAlertDescriptorHandle = 0; + uint16_t newAlertDefHandle; + uint16_t unreadAlertStatusHandle; + uint16_t controlPointHandle; + bool isDiscovered = false; + Pinetime::System::SystemTask &systemTask; + Pinetime::Controllers::NotificationManager ¬ificationManager; + }; + } +} \ No newline at end of file diff --git a/src/components/Ble/AlertNotificationService.cpp b/src/components/Ble/AlertNotificationService.cpp new file mode 100644 index 0000000..ce2f7dd --- /dev/null +++ b/src/components/Ble/AlertNotificationService.cpp @@ -0,0 +1,80 @@ + +#include +#include "NotificationManager.h" +#include + +#include "AlertNotificationService.h" +#include + +using namespace Pinetime::Controllers; + +constexpr ble_uuid16_t AlertNotificationService::ansUuid; +constexpr ble_uuid16_t AlertNotificationService::ansCharUuid; + + +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); +} + +void AlertNotificationService::Init() { + int res; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + 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 + }, + { + 0 + } + }, + serviceDefinition{ + { + /* Device Information Service */ + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = (ble_uuid_t *) &ansUuid, + .characteristics = characteristicDefinition + }, + { + 0 + }, + }, m_systemTask{systemTask}, m_notificationManager{notificationManager} { +} + +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) { + // TODO implement this with more memory safety (and constexpr) + static const size_t maxBufferSize{21}; + static const size_t maxMessageSize{18}; + size_t bufferSize = min(OS_MBUF_PKTLEN(ctxt->om), maxBufferSize); + + uint8_t data[bufferSize]; + os_mbuf_copydata(ctxt->om, 0, bufferSize, data); + + char *s = (char *) &data[3]; + auto messageSize = min(maxMessageSize, (bufferSize-3)); + + for (uint i = 0; i < messageSize-1; i++) { + if (s[i] == 0x00) { + s[i] = 0x0A; + } + } + s[messageSize-1] = '\0'; + + m_notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, s, messageSize); + m_systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); + } + return 0; +} diff --git a/src/components/Ble/AlertNotificationService.h b/src/components/Ble/AlertNotificationService.h new file mode 100644 index 0000000..53cb44c --- /dev/null +++ b/src/components/Ble/AlertNotificationService.h @@ -0,0 +1,39 @@ +#pragma once +#include +#include +#include + +namespace Pinetime { + namespace Controllers { + class AlertNotificationService { + public: + AlertNotificationService(Pinetime::System::SystemTask &systemTask, + Pinetime::Controllers::NotificationManager ¬ificationManager); + void Init(); + + int OnAlert(uint16_t conn_handle, uint16_t attr_handle, + struct ble_gatt_access_ctxt *ctxt); + + + private: + 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 ansCharUuid { + .u { .type = BLE_UUID_TYPE_16 }, + .value = ansCharId + }; + + struct ble_gatt_chr_def characteristicDefinition[2]; + struct ble_gatt_svc_def serviceDefinition[2]; + + Pinetime::System::SystemTask &m_systemTask; + NotificationManager &m_notificationManager; + }; + } +} diff --git a/src/components/Ble/BatteryInformationService.cpp b/src/components/Ble/BatteryInformationService.cpp new file mode 100644 index 0000000..c86830b --- /dev/null +++ b/src/components/Ble/BatteryInformationService.cpp @@ -0,0 +1,62 @@ +#include "BatteryInformationService.h" +#include "../Battery/BatteryController.h" + +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) { + 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 + }, + }{ + +} + +void BatteryInformationService::Init() { + int res = 0; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); +} + +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); + return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; + } + return 0; +} \ No newline at end of file diff --git a/src/components/Ble/BatteryInformationService.h b/src/components/Ble/BatteryInformationService.h new file mode 100644 index 0000000..74b2222 --- /dev/null +++ b/src/components/Ble/BatteryInformationService.h @@ -0,0 +1,40 @@ +#pragma once +#include + +namespace Pinetime { + namespace System { + class SystemTask; + } + namespace Controllers { + class Battery; + class BatteryInformationService { + public: + BatteryInformationService(Controllers::Battery& batteryController); + void Init(); + + 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}; + + 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 + }; + + struct ble_gatt_chr_def characteristicDefinition[3]; + struct ble_gatt_svc_def serviceDefinition[2]; + + uint16_t batteryLevelHandle; + + }; + } +} diff --git a/src/components/Ble/BleController.cpp b/src/components/Ble/BleController.cpp new file mode 100644 index 0000000..2b396e1 --- /dev/null +++ b/src/components/Ble/BleController.cpp @@ -0,0 +1,31 @@ +#include +#include +#include "BleController.h" + +using namespace Pinetime::Controllers; + +void Ble::Connect() { + isConnected = true; +} + +void Ble::Disconnect() { + isConnected = false; +} + +void Ble::StartFirmwareUpdate() { + isFirmwareUpdating = true; +} + +void Ble::StopFirmwareUpdate() { + isFirmwareUpdating = false; +} + +void Ble::FirmwareUpdateTotalBytes(uint32_t totalBytes) { + firmwareUpdateTotalBytes = totalBytes; +} + +void Ble::FirmwareUpdateCurrentBytes(uint32_t currentBytes) { + firmwareUpdateCurrentBytes = currentBytes; +} + + diff --git a/src/components/Ble/BleController.h b/src/components/Ble/BleController.h new file mode 100644 index 0000000..3f52ea2 --- /dev/null +++ b/src/components/Ble/BleController.h @@ -0,0 +1,45 @@ +#pragma once + +#include +#include +#include + +namespace Pinetime { + namespace Controllers { + class Ble { + 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(); + + 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; } + + 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 new file mode 100644 index 0000000..7a225f4 --- /dev/null +++ b/src/components/Ble/CurrentTimeClient.cpp @@ -0,0 +1,77 @@ +#include +#include "CurrentTimeClient.h" + +using namespace Pinetime::Controllers; + +constexpr ble_uuid16_t CurrentTimeClient::ctsServiceUuid; +constexpr ble_uuid16_t CurrentTimeClient::currentTimeCharacteristicUuid; + +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) { + if(service == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("CTS Discovery complete"); + return true; + } + + if(service != nullptr && ble_uuid_cmp(((ble_uuid_t*)&ctsServiceUuid), &service->uuid.u) == 0) { + NRF_LOG_INFO("CTS discovered : 0x%x", service->start_handle); + isDiscovered = true; + ctsStartHandle = service->start_handle; + ctsEndHandle = service->end_handle; + return false; + } + return false; +} + +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) { + NRF_LOG_INFO("CTS Characteristic discovery complete"); + return 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); + currentTimeHandle = characteristic->val_handle; + } + return 0; +} + +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)); + } else { + NRF_LOG_INFO("Error retrieving current time: %d", error->status); + } + return 0; +} + +bool CurrentTimeClient::IsDiscovered() const { + return isDiscovered; +} + +uint16_t CurrentTimeClient::StartHandle() const { + return ctsStartHandle; +} + +uint16_t CurrentTimeClient::EndHandle() const { + return ctsEndHandle; +} + +uint16_t CurrentTimeClient::CurrentTimeHandle() const { + return currentTimeHandle; +} \ No newline at end of file diff --git a/src/components/Ble/CurrentTimeClient.h b/src/components/Ble/CurrentTimeClient.h new file mode 100644 index 0000000..fabcdac --- /dev/null +++ b/src/components/Ble/CurrentTimeClient.h @@ -0,0 +1,55 @@ +#pragma once +#include +#include +#include +#include + +namespace Pinetime { + namespace Controllers { + + class CurrentTimeClient { + public: + explicit CurrentTimeClient(DateTime& dateTimeController); + void Init(); + 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); + bool IsDiscovered() const; + uint16_t StartHandle() const; + uint16_t EndHandle() const; + uint16_t CurrentTimeHandle() const; + static constexpr const ble_uuid16_t* Uuid() { return &CurrentTimeClient::ctsServiceUuid; } + static constexpr const ble_uuid16_t* CurrentTimeCharacteristicUuid() { return &CurrentTimeClient::currentTimeCharacteristicUuid; } + 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 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 + }; + + uint16_t currentTimeHandle; + DateTime& dateTimeController; + bool isDiscovered = false; + uint16_t ctsStartHandle; + uint16_t ctsEndHandle; + }; + } +} \ No newline at end of file diff --git a/src/components/Ble/CurrentTimeService.cpp b/src/components/Ble/CurrentTimeService.cpp new file mode 100644 index 0000000..3a6264e --- /dev/null +++ b/src/components/Ble/CurrentTimeService.cpp @@ -0,0 +1,86 @@ +#include "CurrentTimeService.h" +#include + +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) { + auto cts = static_cast(arg); + return cts->OnTimeAccessed(conn_handle, attr_handle, ctxt); +} + +void CurrentTimeService::Init() { + int res; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); +} + + +int CurrentTimeService::OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, + struct ble_gatt_access_ctxt *ctxt) { + + 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); + + 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; + currentDateTime.year = m_dateTimeController.Year(); + currentDateTime.month = static_cast(m_dateTimeController.Month()); + currentDateTime.dayofmonth = m_dateTimeController.Day(); + currentDateTime.hour = m_dateTimeController.Hours(); + currentDateTime.minute = m_dateTimeController.Minutes(); + 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} { + +} + diff --git a/src/components/Ble/CurrentTimeService.h b/src/components/Ble/CurrentTimeService.h new file mode 100644 index 0000000..58bc5ba --- /dev/null +++ b/src/components/Ble/CurrentTimeService.h @@ -0,0 +1,48 @@ +#pragma once +#include +#include +#include +#include + +namespace Pinetime { + namespace Controllers { + class CurrentTimeService { + public: + CurrentTimeService(DateTime &dateTimeController); + void Init(); + + 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}; + + 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 + }; + + 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; + + DateTime &m_dateTimeController; + }; + } +} diff --git a/src/components/Ble/DeviceInformationService.cpp b/src/components/Ble/DeviceInformationService.cpp new file mode 100644 index 0000000..406db1c --- /dev/null +++ b/src/components/Ble/DeviceInformationService.cpp @@ -0,0 +1,116 @@ +#include "DeviceInformationService.h" + +using namespace Pinetime::Controllers; + +constexpr ble_uuid16_t DeviceInformationService::manufacturerNameUuid; +constexpr ble_uuid16_t DeviceInformationService::modelNumberUuid; +constexpr ble_uuid16_t DeviceInformationService::serialNumberUuid; +constexpr ble_uuid16_t DeviceInformationService::fwRevisionUuid; +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) { + auto deviceInformationService = static_cast(arg); + return deviceInformationService->OnDeviceInfoRequested(conn_handle, attr_handle, ctxt); +} + +void DeviceInformationService::Init() { + int res = 0; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); +} + + +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: + str = manufacturerName; + break; + case modelNumberId: + str = modelNumber; + break; + case serialNumberId: + str = serialNumber; + break; + case fwRevisionId: + str = fwRevision; + break; + case hwRevisionId: + str = hwRevision; + break; + case swRevisionId: + str = swRevision; + break; + default: + return BLE_ATT_ERR_UNLIKELY; + } + + int res = os_mbuf_append(ctxt->om, str, strlen(str)); + 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 + }, + } + { + +} + diff --git a/src/components/Ble/DeviceInformationService.h b/src/components/Ble/DeviceInformationService.h new file mode 100644 index 0000000..25ab840 --- /dev/null +++ b/src/components/Ble/DeviceInformationService.h @@ -0,0 +1,76 @@ +#pragma once +#include +#include + +#include +#include + +namespace Pinetime { + namespace Controllers { + class DeviceInformationService { + public: + DeviceInformationService(); + void Init(); + + 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}; + + 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 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 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 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 new file mode 100644 index 0000000..fcbefdd --- /dev/null +++ b/src/components/Ble/DfuService.cpp @@ -0,0 +1,440 @@ +#include +#include +#include +#include "DfuService.h" + +using namespace Pinetime::Controllers; + +constexpr ble_uuid128_t DfuService::serviceUuid; +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); + return dfuService->OnServiceData(conn_handle, attr_handle, ctxt); +} + +void NotificationTimerCallback(TimerHandle_t xTimer) { + auto notificationManager = static_cast(pvTimerGetTimerID(xTimer)); + notificationManager->OnNotificationTimer(); +} + +void TimeoutTimerCallback(TimerHandle_t 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, + + }, + { + 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); +} + +void DfuService::Init() { + int res; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); +} + +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); + + if (attributeHandle == packetCharacteristicHandle) { + if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) + return WritePacketHandler(connectionHandle, context->om); + 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 if (attributeHandle == revisionCharacteristicHandle) { + if (context->op == BLE_GATT_ACCESS_OP_READ_CHR) + return SendDfuRevision(context->om); + else return 0; + } else { + NRF_LOG_INFO("[DFU] Unknown Characteristic : %d", attributeHandle); + return 0; + } +} + +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) { + 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); + + dfuImage.Erase(); + + uint8_t data[]{16, 1, 1}; + notificationManager.Send(connectionHandle, controlPointCharacteristicHandle, data, 3); + state = States::Init; + } + return 0; + 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); + 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); + + 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); + + return 0; + } + + case States::Data: { + nbPacketReceived++; + dfuImage.Append(om->om_data, om->om_len); + bytesReceived += om->om_len; + 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)}; + 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)}; + NRF_LOG_INFO("[DFU] -> Send packet notification : all bytes received!"); + notificationManager.Send(connectionHandle, controlPointCharacteristicHandle, data, 3); + state = States::Validate; + } + } + return 0; + default: + // Invalid state + return 0; + } + return 0; +} + +int DfuService::ControlPointHandler(uint16_t connectionHandle, os_mbuf *om) { + auto opcode = static_cast(om->om_data[0]); + NRF_LOG_INFO("[DFU] -> ControlPointHandler"); + + switch (opcode) { + case Opcodes::StartDFU: { + if (state != States::Idle && state != States::Start) { + NRF_LOG_INFO("[DFU] -> Start DFU requested, but we are not in Idle state"); + return 0; + } + if (state == States::Start) { + NRF_LOG_INFO("[DFU] -> Start DFU requested, but we are already in Start state"); + return 0; + } + auto imageType = static_cast(om->om_data[1]); + if (imageType == ImageTypes::Application) { + NRF_LOG_INFO("[DFU] -> Start DFU, mode = Application"); + state = States::Start; + bleController.StartFirmwareUpdate(); + bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Running); + bleController.FirmwareUpdateTotalBytes(0xffffffffu); + bleController.FirmwareUpdateCurrentBytes(0); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleFirmwareUpdateStarted); + return 0; + } else { + NRF_LOG_INFO("[DFU] -> Start DFU, mode %d not supported!", imageType); + return 0; + } + } + break; + case Opcodes::InitDFUParameters: { + if (state != States::Init) { + NRF_LOG_INFO("[DFU] -> Init DFU requested, but we are not in Init state"); + return 0; + } + bool isInitComplete = (om->om_data[1] != 0); + 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}) + }; + notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3); + return 0; + } + } + return 0; + case Opcodes::PacketReceiptNotificationRequest: + nbPacketsToNotify = om->om_data[1]; + NRF_LOG_INFO("[DFU] -> Receive Packet Notification Request, nb packet = %d", nbPacketsToNotify); + return 0; + case Opcodes::ReceiveFirmwareImage: + if (state != States::Init) { + NRF_LOG_INFO("[DFU] -> Receive firmware image requested, but we are not in Start Init"); + return 0; + } + // TODO the chunk size is dependant of the implementation of the host application... + dfuImage.Init(20, applicationSize, expectedCrc); + NRF_LOG_INFO("[DFU] -> Starting receive firmware"); + state = States::Data; + return 0; + case Opcodes::ValidateFirmware: { + if (state != States::Validate) { + NRF_LOG_INFO("[DFU] -> Validate firmware image requested, but we are not in Data state %d", state); + return 0; + } + + NRF_LOG_INFO("[DFU] -> Validate firmware image requested -- %d", connectionHandle); + + 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) + }; + 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) + }; + notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3); + } + + return 0; + } + case Opcodes::ActivateImageAndReset: + if (state != States::Validated) { + NRF_LOG_INFO("[DFU] -> Activate image and reset requested, but we are not in Validated state"); + return 0; + } + NRF_LOG_INFO("[DFU] -> Activate image and reset!"); + bleController.StopFirmwareUpdate(); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleFirmwareUpdateFinished); + Reset(); + bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated); + return 0; + default: + return 0; + } +} + +void DfuService::OnTimeout() { + Reset(); +} + +void DfuService::Reset() { + state = States::Idle; + nbPacketsToNotify = 0; + nbPacketReceived = 0; + bytesReceived = 0; + softdeviceSize = 0; + bootloaderSize = 0; + applicationSize = 0; + expectedCrc = 0; + notificationManager.Reset(); + bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Error); + bleController.StopFirmwareUpdate(); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleFirmwareUpdateFinished); +} + +DfuService::NotificationManager::NotificationManager() { + 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) + return false; + + connectionHandle = connection; + characteristicHandle = charactHandle; + size = s; + std::memcpy(buffer, data, size); + xTimerStart(timer, 0); + return true; +} + +void DfuService::NotificationManager::OnNotificationTimer() { + 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); + auto ret = ble_gattc_notify_custom(connection, charactHandle, om); + ASSERT(ret == 0); +} + +void DfuService::NotificationManager::Reset() { + connectionHandle = 0; + characteristicHandle = 0; + size = 0; + xTimerStop(timer, 0); +} + +void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc) { + 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; + ASSERT(size <= 20); + + std::memcpy(tempBuffer + bufferWriteIndex, data, size); + bufferWriteIndex += size; + + if(bufferWriteIndex == bufferSize) { + spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); + totalWriteIndex += bufferWriteIndex; + bufferWriteIndex = 0; + } + + if(bufferWriteIndex > 0 && totalWriteIndex + bufferWriteIndex == totalSize) { + spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); + totalWriteIndex += bufferWriteIndex; + if (totalSize < maxSize) + WriteMagicNumber(); + } +} + +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 offset = writeOffset + (maxSize - (4 * sizeof(uint32_t))); + spiNorFlash.Write(offset, reinterpret_cast(magic), 4 * sizeof(uint32_t)); +} + +void DfuService::DfuImage::Erase() { + for (size_t erased = 0; erased < maxSize; erased += 0x1000) { + spiNorFlash.SectorErase(writeOffset + erased); + } +} + +bool DfuService::DfuImage::Validate() { + uint32_t chunkSize = 200; + size_t currentOffset = 0; + uint16_t crc = 0; + + bool first = true; + while (currentOffset < totalSize) { + uint32_t readSize = (totalSize - currentOffset) > chunkSize ? chunkSize : (totalSize - currentOffset); + + spiNorFlash.Read(writeOffset + currentOffset, tempBuffer, readSize); + if (first) { + crc = ComputeCrc(tempBuffer, readSize, NULL); + first = false; + } else + crc = ComputeCrc(tempBuffer, readSize, &crc); + currentOffset += readSize; + } + + return (crc == expectedCrc); +} + +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++) { + crc = (uint8_t) (crc >> 8) | (crc << 8); + crc ^= p_data[i]; + crc ^= (uint8_t) (crc & 0xFF) >> 4; + crc ^= (crc << 8) << 4; + crc ^= ((crc & 0xFF) << 4) << 1; + } + + return crc; +} + +bool DfuService::DfuImage::IsComplete() { + if(!ready) return false; + return totalWriteIndex == totalSize; +} diff --git a/src/components/Ble/DfuService.h b/src/components/Ble/DfuService.h new file mode 100644 index 0000000..d7ba460 --- /dev/null +++ b/src/components/Ble/DfuService.h @@ -0,0 +1,161 @@ +#pragma once + +#include +#include + +#include + +namespace Pinetime { + namespace System { + class SystemTask; + } + namespace Drivers { + class SpiNorFlash; + } + namespace Controllers { + 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: + 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); + + }; + + 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/ImmediateAlertService.cpp b/src/components/Ble/ImmediateAlertService.cpp new file mode 100644 index 0000000..d2c4cff --- /dev/null +++ b/src/components/Ble/ImmediateAlertService.cpp @@ -0,0 +1,76 @@ +#include "ImmediateAlertService.h" +#include +#include "AlertNotificationService.h" + +using namespace Pinetime::Controllers; + +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); + 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 ""; + } + } +} + +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 + }, + }{ + +} + +void ImmediateAlertService::Init() { + int res = 0; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + 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) { + auto alertLevel = static_cast(context->om->om_data[0]); + auto* alertString = ToString(alertLevel); + notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, alertString, strlen(alertString)); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); + } + } + + return 0; +} \ No newline at end of file diff --git a/src/components/Ble/ImmediateAlertService.h b/src/components/Ble/ImmediateAlertService.h new file mode 100644 index 0000000..c42846c --- /dev/null +++ b/src/components/Ble/ImmediateAlertService.h @@ -0,0 +1,46 @@ +#pragma once +#include + +namespace Pinetime { + namespace System { + class SystemTask; + } + namespace Controllers { + class NotificationManager; + class ImmediateAlertService { + 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); + + private: + Pinetime::System::SystemTask& systemTask; + NotificationManager& notificationManager; + + 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 alertLevelUuid { + .u {.type = BLE_UUID_TYPE_16}, + .value = alertLevelId + }; + + struct ble_gatt_chr_def characteristicDefinition[3]; + struct ble_gatt_svc_def serviceDefinition[2]; + + uint16_t alertLevelHandle; + }; + } +} diff --git a/src/components/Ble/MusicService.cpp b/src/components/Ble/MusicService.cpp new file mode 100644 index 0000000..b5fa535 --- /dev/null +++ b/src/components/Ble/MusicService.cpp @@ -0,0 +1,129 @@ +#include +#include "MusicService.h" + +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) +{ + msUuid.value[11] = msId[0]; + msUuid.value[12] = msId[1]; + msEventCharUuid.value[11] = msEventCharId[0]; + msEventCharUuid.value[12] = msEventCharId[1]; + msStatusCharUuid.value[11] = msStatusCharId[0]; + msStatusCharUuid.value[12] = msStatusCharId[1]; + msTrackCharUuid.value[11] = msTrackCharId[0]; + msTrackCharUuid.value[12] = msTrackCharId[1]; + msArtistCharUuid.value[11] = msArtistCharId[0]; + msArtistCharUuid.value[12] = msArtistCharId[1]; + msAlbumCharUuid.value[11] = msAlbumCharId[0]; + msAlbumCharUuid.value[12] = msAlbumCharId[1]; + + characteristicDefinition[0] = { .uuid = (ble_uuid_t*)(&msEventCharUuid), + .access_cb = MSCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_NOTIFY, + .val_handle = &m_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] = {0}; + + serviceDefinition[0] = { + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = (ble_uuid_t *) &msUuid, + .characteristics = characteristicDefinition + }; + serviceDefinition[1] = {0}; + + m_artist = "Waiting for"; + m_album = ""; + m_track = "track information..."; +} + +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) { + + 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]; + NRF_LOG_INFO("DATA : %s", s); + if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msArtistCharUuid) == 0) { + m_artist = s; + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msTrackCharUuid) == 0) { + m_track = s; + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msAlbumCharUuid) == 0) { + m_album = s; + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msStatusCharUuid) == 0) { + m_status = s[0]; + } + } + return 0; +} + +std::string Pinetime::Controllers::MusicService::album() +{ + return m_album; +} + +std::string Pinetime::Controllers::MusicService::artist() +{ + return m_artist; +} + +std::string Pinetime::Controllers::MusicService::track() +{ + return m_track; +} + +unsigned char Pinetime::Controllers::MusicService::status() +{ + return m_status; +} + +void Pinetime::Controllers::MusicService::event(char event) +{ + 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, m_eventHandle, om); +} + diff --git a/src/components/Ble/MusicService.h b/src/components/Ble/MusicService.h new file mode 100644 index 0000000..ab6db57 --- /dev/null +++ b/src/components/Ble/MusicService.h @@ -0,0 +1,92 @@ +#pragma once + +#include +#include +#include +#include +#include + +//c7e50000-78fc-48fe-8e23-43b37a1942d0 +#define MUSIC_SERVICE_UUID_BASE {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0xe5, 0xc7} + +namespace Pinetime { + namespace System { + class SystemTask; + } + namespace Controllers { + + class MusicService { + public: + MusicService(Pinetime::System::SystemTask &system); + void Init(); + int OnCommand(uint16_t conn_handle, uint16_t attr_handle, + struct ble_gatt_access_ctxt *ctxt); + + std::string artist(); + std::string track(); + std::string album(); + unsigned char status(); + + void event(char event); + + static const char EVENT_MUSIC_OPEN = 0xe0; + static const char EVENT_MUSIC_PLAY = 0x00; + static const char EVENT_MUSIC_PAUSE = 0x01; + static const char EVENT_MUSIC_NEXT = 0x03; + static const char EVENT_MUSIC_PREV = 0x04; + static const char EVENT_MUSIC_VOLUP = 0x05; + static const char EVENT_MUSIC_VOLDOWN = 0x06; + static const char STATUS_MUSIC_PAUSED = 0x00; + static const char STATUS_MUSIC_PLAYING = 0x01; + + private: + static constexpr uint8_t msId[2] = {0x00, 0x01}; + static constexpr uint8_t msEventCharId[2] = {0x00, 0x02}; + static constexpr uint8_t msStatusCharId[2] = {0x00, 0x03}; + static constexpr uint8_t msArtistCharId[2] = {0x00, 0x04}; + static constexpr uint8_t msTrackCharId[2] = {0x00, 0x05}; + static constexpr uint8_t msAlbumCharId[2] = {0x00, 0x06}; + + 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 + }; + + struct ble_gatt_chr_def characteristicDefinition[6]; + struct ble_gatt_svc_def serviceDefinition[2]; + + uint16_t m_eventHandle; + + std::string m_artist; + std::string m_album; + std::string m_track; + + unsigned char m_status; + + Pinetime::System::SystemTask& m_system; + + }; + } +} + diff --git a/src/components/Ble/NimbleController.cpp b/src/components/Ble/NimbleController.cpp new file mode 100644 index 0000000..b13f9ce --- /dev/null +++ b/src/components/Ble/NimbleController.cpp @@ -0,0 +1,337 @@ + +#include + +#include +#include +#include + +#include "NimbleController.h" +#include "MusicService.h" +#include +#include +#include +#include +#include +#include + + + +using namespace Pinetime::Controllers; + +// TODO I'm not satisfied by how this code looks like (AlertNotificationClient and CurrentTimeClient must +// expose too much data, too many callbacks -> NimbleController -> CTS/ANS client. +// Let's try to improve this code (and keep it working!) + +NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask, + Pinetime::Controllers::Ble& bleController, + DateTime& dateTimeController, + Pinetime::Controllers::NotificationManager& notificationManager, + Controllers::Battery& batteryController, + Pinetime::Drivers::SpiNorFlash& spiNorFlash) : + 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}, + batteryInformationService{batteryController}, + immediateAlertService{systemTask, notificationManager} { + +} + +int GAPEventCallback(struct ble_gap_event *event, void *arg) { + auto nimbleController = static_cast(arg); + return nimbleController->OnGAPEvent(event); +} + +int CurrentTimeCharacteristicDiscoveredCallback(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->OnCTSCharacteristicDiscoveryEvent(conn_handle, error, chr); +} + +int AlertNotificationCharacteristicDiscoveredCallback(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->OnANSCharacteristicDiscoveryEvent(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); + return client->OnCurrentTimeReadResult(conn_handle, error, attr); +} + +int AlertNotificationDescriptorDiscoveryEventCallback(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->OnANSDescriptorDiscoveryEventCallback(conn_handle, error, chr_val_handle, dsc); +} + +void NimbleController::Init() { + while (!ble_hs_synced()) {} + + ble_svc_gap_init(); + ble_svc_gatt_init(); + + deviceInformationService.Init(); + currentTimeClient.Init(); + currentTimeService.Init(); + musicService.Init(); + anService.Init(); + dfuService.Init(); + batteryInformationService.Init(); + immediateAlertService.Init(); + int res; + res = ble_hs_util_ensure_addr(0); + ASSERT(res == 0); + res = ble_hs_id_infer_auto(0, &addrType); + ASSERT(res == 0); + res = ble_svc_gap_device_name_set(deviceName); + ASSERT(res == 0); + Pinetime::Controllers::Ble::BleAddress address; + res = ble_hs_id_copy_addr(addrType, address.data(), nullptr); + ASSERT(res == 0); + bleController.AddressType((addrType == 0) ? Ble::AddressTypes::Public : Ble::AddressTypes::Random); + bleController.Address(std::move(address)); + + res = ble_gatts_start(); + ASSERT(res == 0); +} + +void NimbleController::StartAdvertising() { + if(ble_gap_adv_active()) return; + + ble_svc_gap_device_name_set(deviceName); + + /* set adv parameters */ + struct ble_gap_adv_params adv_params; + struct ble_hs_adv_fields fields; + /* advertising payload is split into advertising data and advertising + response, because all data cannot fit into single packet; name of device + is sent as response to scan request */ + struct ble_hs_adv_fields rsp_fields; + + /* fill all fields and parameters with zeros */ + memset(&adv_params, 0, sizeof(adv_params)); + memset(&fields, 0, sizeof(fields)); + memset(&rsp_fields, 0, sizeof(rsp_fields)); + + 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.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_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) + + ble_gap_adv_rsp_set_fields(&rsp_fields); +// 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. + // 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 + // the advertising should be improve (better error handling, and advertise for 3 minutes after + // the application has been woken up, for example. +} + +int OnAllSvrDisco(uint16_t conn_handle, + const struct ble_gatt_error *error, + const struct ble_gatt_svc *service, + void *arg) { + auto nimbleController = static_cast(arg); + return nimbleController->OnDiscoveryEvent(conn_handle, error, service); + return 0; +} + +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"); + NRF_LOG_INFO("advertise complete; reason=%dn status=%d", event->adv_complete.reason, event->connect.status); + break; + case BLE_GAP_EVENT_CONNECT: { + 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); + + if (event->connect.status != 0) { + /* Connection failed; resume advertising. */ + StartAdvertising(); + bleController.Disconnect(); + } else { + bleController.Connect(); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleConnected); + connectionHandle = event->connect.conn_handle; + // Service discovery is deffered via systemtask + } + } + break; + case BLE_GAP_EVENT_DISCONNECT: + NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_DISCONNECT"); + NRF_LOG_INFO("disconnect; reason=%d", event->disconnect.reason); + + /* Connection terminated; resume advertising. */ + connectionHandle = BLE_HS_CONN_HANDLE_NONE; + bleController.Disconnect(); + StartAdvertising(); + break; + case BLE_GAP_EVENT_CONN_UPDATE: + NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_CONN_UPDATE"); + /* The central has updated the connection parameters. */ + NRF_LOG_INFO("connection updated; status=%d ", event->conn_update.status); + break; + case BLE_GAP_EVENT_ENC_CHANGE: + /* Encryption has been enabled or disabled for this connection. */ + NRF_LOG_INFO("encryption change event; status=%d ", event->enc_change.status); + 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); + 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); + return 0; + + case BLE_GAP_EVENT_REPEAT_PAIRING: { + /* We already have a bond with the peer, but it is attempting to + * establish a new secure link. This app sacrifices security for + * convenience: just throw away the old bond and accept the new link. + */ + + /* Delete the old bond. */ + struct ble_gap_conn_desc desc; + ble_gap_conn_find(event->repeat_pairing.conn_handle, &desc); + ble_store_util_delete_peer(&desc.peer_id_addr); + + /* Return BLE_GAP_REPEAT_PAIRING_RETRY to indicate that the host should + * continue with the pairing operation. + */ + } + return BLE_GAP_REPEAT_PAIRING_RETRY; + + case BLE_GAP_EVENT_NOTIFY_RX: { + /* Peer sent us a notification or indication. */ + size_t notifSize = OS_MBUF_PKTLEN(event->notify_rx.om); + + NRF_LOG_INFO("received %s; conn_handle=%d attr_handle=%d " + "attr_len=%d", + event->notify_rx.indication ? + "indication" : + "notification", + event->notify_rx.conn_handle, + event->notify_rx.attr_handle, + notifSize); + + alertNotificationClient.OnNotification(event); + return 0; + } + /* Attribute data is contained in event->notify_rx.attr_data. */ + + default: +// NRF_LOG_INFO("Advertising event : %d", event->type); + break; + } + return 0; +} + +int NimbleController::OnDiscoveryEvent(uint16_t i, const ble_gatt_error *error, const ble_gatt_svc *service) { + if(service == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("Service Discovery complete"); + if(currentTimeClient.IsDiscovered()) { + ble_gattc_disc_all_chrs(connectionHandle, currentTimeClient.StartHandle(), currentTimeClient.EndHandle(), + CurrentTimeCharacteristicDiscoveredCallback, this); + + } else if(alertNotificationClient.IsDiscovered()) { + ble_gattc_disc_all_chrs(connectionHandle, alertNotificationClient.StartHandle(), alertNotificationClient.EndHandle(), + AlertNotificationCharacteristicDiscoveredCallback, this); + } + } + + alertNotificationClient.OnDiscoveryEvent(i, error, service); + currentTimeClient.OnDiscoveryEvent(i, error, service); + return 0; +} + +int NimbleController::OnCTSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, + const ble_gatt_chr *characteristic) { + if(characteristic == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("CTS characteristic Discovery complete"); + ble_gattc_read(connectionHandle, currentTimeClient.CurrentTimeHandle(), CurrentTimeReadCallback, this); + return 0; + } + return currentTimeClient.OnCharacteristicDiscoveryEvent(connectionHandle, error, characteristic); +} + +int NimbleController::OnANSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, + const ble_gatt_chr *characteristic) { + if(characteristic == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("ANS characteristic Discovery complete"); + ble_gattc_disc_all_dscs(connectionHandle, + alertNotificationClient.NewAlerthandle(), alertNotificationClient.EndHandle(), + AlertNotificationDescriptorDiscoveryEventCallback, this); + return 0; + } + return alertNotificationClient.OnCharacteristicsDiscoveryEvent(connectionHandle, error, characteristic); +} + +int NimbleController::OnCurrentTimeReadResult(uint16_t connectionHandle, const ble_gatt_error *error, ble_gatt_attr *attribute) { + currentTimeClient.OnCurrentTimeReadResult(connectionHandle, error, attribute); + + if (alertNotificationClient.IsDiscovered()) { + ble_gattc_disc_all_chrs(connectionHandle, alertNotificationClient.StartHandle(), + alertNotificationClient.EndHandle(), + AlertNotificationCharacteristicDiscoveredCallback, this); + } + return 0; +} + +int NimbleController::OnANSDescriptorDiscoveryEventCallback(uint16_t connectionHandle, const ble_gatt_error *error, + uint16_t characteristicValueHandle, + const ble_gatt_dsc *descriptor) { + return alertNotificationClient.OnDescriptorDiscoveryEventCallback(connectionHandle, error, characteristicValueHandle, descriptor); +} + +void NimbleController::StartDiscovery() { + ble_gattc_disc_all_svcs(connectionHandle, OnAllSvrDisco, this); +} + + +uint16_t NimbleController::connHandle() { + return connectionHandle; +} + diff --git a/src/components/Ble/NimbleController.h b/src/components/Ble/NimbleController.h new file mode 100644 index 0000000..89fa425 --- /dev/null +++ b/src/components/Ble/NimbleController.h @@ -0,0 +1,75 @@ +#pragma once + +#include +#include "AlertNotificationService.h" +#include "AlertNotificationClient.h" +#include "DeviceInformationService.h" +#include "CurrentTimeClient.h" +#include "DfuService.h" +#include "CurrentTimeService.h" +#include "MusicService.h" +#include "BatteryInformationService.h" +#include "ImmediateAlertService.h" +#include + +namespace Pinetime { + namespace Drivers { + class SpiNorFlash; + } + namespace Controllers { + class DateTime; + + 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); + 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); + + void StartDiscovery(); + + Pinetime::Controllers::MusicService& music() {return musicService;}; + + 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; + + DeviceInformationService deviceInformationService; + CurrentTimeClient currentTimeClient; + AlertNotificationService anService; + AlertNotificationClient alertNotificationClient; + CurrentTimeService currentTimeService; + MusicService musicService; + BatteryInformationService batteryInformationService; + ImmediateAlertService immediateAlertService; + + 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} + }; + }; + } +} diff --git a/src/components/Ble/NotificationManager.cpp b/src/components/Ble/NotificationManager.cpp new file mode 100644 index 0000000..0aea069 --- /dev/null +++ b/src/components/Ble/NotificationManager.cpp @@ -0,0 +1,30 @@ +#include +#include "NotificationManager.h" + +using namespace Pinetime::Controllers; + +void NotificationManager::Push(Pinetime::Controllers::NotificationManager::Categories category, + const char *message, uint8_t currentMessageSize) { + // TODO handle edge cases on read/write index + auto checkedSize = std::min(currentMessageSize, uint8_t{18}); + auto& notif = notifications[writeIndex]; + std::memcpy(notif.message.data(), message, checkedSize); + notif.message[checkedSize] = '\0'; + notif.category = category; + + writeIndex = (writeIndex + 1 < TotalNbNotifications) ? writeIndex + 1 : 0; + if(!empty && writeIndex == readIndex) + readIndex = writeIndex + 1; +} + +NotificationManager::Notification Pinetime::Controllers::NotificationManager::Pop() { +// TODO handle edge cases on read/write index + NotificationManager::Notification notification = notifications[readIndex]; + + if(readIndex != writeIndex) { + readIndex = (readIndex + 1 < TotalNbNotifications) ? readIndex + 1 : 0; + } + + // TODO Check move optimization on return + return notification; +} diff --git a/src/components/Ble/NotificationManager.h b/src/components/Ble/NotificationManager.h new file mode 100644 index 0000000..daa1571 --- /dev/null +++ b/src/components/Ble/NotificationManager.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +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{18}; + + struct Notification { + std::array message; + Categories category = Categories::Unknown; + }; + + void Push(Categories category, const char* message, uint8_t messageSize); + Notification Pop(); + + + private: + static constexpr uint8_t TotalNbNotifications = 5; + std::array notifications; + uint8_t readIndex = 0; + uint8_t writeIndex = 0; + bool empty = true; + }; + } +} \ No newline at end of file diff --git a/src/components/Brightness/BrightnessController.cpp b/src/components/Brightness/BrightnessController.cpp new file mode 100644 index 0000000..c8825d6 --- /dev/null +++ b/src/components/Brightness/BrightnessController.cpp @@ -0,0 +1,70 @@ +#include +#include "BrightnessController.h" + +using namespace Pinetime::Controllers; + + +void BrightnessController::Init() { + nrf_gpio_cfg_output(pinLcdBacklight1); + nrf_gpio_cfg_output(pinLcdBacklight2); + nrf_gpio_cfg_output(pinLcdBacklight3); + Set(level); +} + +void BrightnessController::Set(BrightnessController::Levels level) { + this->level = level; + switch(level) { + default: + case Levels::High: + nrf_gpio_pin_clear(pinLcdBacklight1); + nrf_gpio_pin_clear(pinLcdBacklight2); + nrf_gpio_pin_clear(pinLcdBacklight3); + break; + case Levels::Medium: + nrf_gpio_pin_clear(pinLcdBacklight1); + nrf_gpio_pin_clear(pinLcdBacklight2); + nrf_gpio_pin_set(pinLcdBacklight3); + break; + case Levels::Low: + nrf_gpio_pin_clear(pinLcdBacklight1); + nrf_gpio_pin_set(pinLcdBacklight2); + nrf_gpio_pin_set(pinLcdBacklight3); + break; + case Levels::Off: + nrf_gpio_pin_set(pinLcdBacklight1); + nrf_gpio_pin_set(pinLcdBacklight2); + nrf_gpio_pin_set(pinLcdBacklight3); + break; + } +} + +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; + } +} + +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; + } +} + +BrightnessController::Levels BrightnessController::Level() const { + return level; +} + +void BrightnessController::Backup() { + backupLevel = level; +} + +void BrightnessController::Restore() { + Set(backupLevel); +} + diff --git a/src/components/Brightness/BrightnessController.h b/src/components/Brightness/BrightnessController.h new file mode 100644 index 0000000..b8354ec --- /dev/null +++ b/src/components/Brightness/BrightnessController.h @@ -0,0 +1,28 @@ +#pragma once + +#include + +namespace Pinetime { + namespace Controllers { + class BrightnessController { + public: + enum class Levels {Off, Low, Medium, High}; + void Init(); + + void Set(Levels level); + Levels Level() const; + void Lower(); + void Higher(); + + void Backup(); + void Restore(); + + private: + static constexpr uint8_t pinLcdBacklight1 = 14; + static constexpr uint8_t pinLcdBacklight2 = 22; + static constexpr uint8_t pinLcdBacklight3 = 23; + Levels level = Levels::High; + Levels backupLevel = Levels::High; + }; + } +} diff --git a/src/components/DateTime/DateTimeController.cpp b/src/components/DateTime/DateTimeController.cpp new file mode 100644 index 0000000..30d9c13 --- /dev/null +++ b/src/components/DateTime/DateTimeController.cpp @@ -0,0 +1,66 @@ +#include "DateTimeController.h" +#include +#include + +using namespace Pinetime::Controllers; + + +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)); + + NRF_LOG_INFO("%d %d %d ", day, month, year); + NRF_LOG_INFO("%d %d %d ", hour, minute, second); + previousSystickCounter = systickCounter; + + UpdateTime(systickCounter); + NRF_LOG_INFO("* %d %d %d ", this->hour, this->minute, this->second); + NRF_LOG_INFO("* %d %d %d ", this->day, this->month, this->year); +} + +void DateTime::UpdateTime(uint32_t systickCounter) { + // Handle systick counter overflow + uint32_t systickDelta = 0; + if(systickCounter < previousSystickCounter) { + systickDelta = 0xffffff - previousSystickCounter; + systickDelta += systickCounter + 1; + } else { + systickDelta = systickCounter - previousSystickCounter; + } + + /* + * 1000 ms = 1024 ticks + */ + auto correctedDelta = systickDelta / 1024; + auto rest = (systickDelta - (correctedDelta*1024)); + if(systickCounter >= rest) { + previousSystickCounter = systickCounter - rest; + } else { + previousSystickCounter = 0xffffff - (rest - systickCounter); + } + + currentDateTime += std::chrono::seconds(correctedDelta); + uptime += std::chrono::seconds(correctedDelta); + + auto dp = date::floor(currentDateTime); + 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(); + dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); + + hour = time.hours().count(); + minute = time.minutes().count(); + second = time.seconds().count(); +} + diff --git a/src/components/DateTime/DateTimeController.h b/src/components/DateTime/DateTimeController.h new file mode 100644 index 0000000..d602074 --- /dev/null +++ b/src/components/DateTime/DateTimeController.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include + +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}; + + 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; } + + std::chrono::time_point CurrentDateTime() const { return currentDateTime; } + std::chrono::seconds Uptime() const { return uptime; } + private: + 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; + + uint32_t previousSystickCounter = 0; + std::chrono::time_point currentDateTime; + std::chrono::seconds uptime {0}; + }; + } +} \ No newline at end of file diff --git a/src/components/FirmwareValidator/FirmwareValidator.cpp b/src/components/FirmwareValidator/FirmwareValidator.cpp new file mode 100644 index 0000000..244d5c0 --- /dev/null +++ b/src/components/FirmwareValidator/FirmwareValidator.cpp @@ -0,0 +1,20 @@ +#include +#include + +#include "FirmwareValidator.h" + +using namespace Pinetime::Controllers; + +bool FirmwareValidator::IsValidated() const { + auto* imageOkPtr = reinterpret_cast(validBitAdress); + return (*imageOkPtr) == validBitValue; +} + +void FirmwareValidator::Validate() { + if(!IsValidated()) + Pinetime::Drivers::InternalFlash::WriteWord(validBitAdress, validBitValue); +} + +void FirmwareValidator::Reset() { + NVIC_SystemReset(); +} diff --git a/src/components/FirmwareValidator/FirmwareValidator.h b/src/components/FirmwareValidator/FirmwareValidator.h new file mode 100644 index 0000000..aa576d8 --- /dev/null +++ b/src/components/FirmwareValidator/FirmwareValidator.h @@ -0,0 +1,18 @@ +#pragma once + +#include + +namespace Pinetime { + namespace Controllers { + class FirmwareValidator { + public: + void Validate(); + bool IsValidated() const; + + 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 new file mode 100644 index 0000000..3c5dbfb --- /dev/null +++ b/src/components/Gfx/Gfx.cpp @@ -0,0 +1,207 @@ +#include +#include +#include +#include "Gfx.h" +#include "../../drivers/St7789.h" +using namespace Pinetime::Components; + +Gfx::Gfx(Pinetime::Drivers::St7789 &lcd) : lcd{lcd} { +} + +void Gfx::Init() { + +} + +void Gfx::ClearScreen() { + SetBackgroundColor(0x0000); + + state.remainingIterations = 240 + 1; + state.currentIteration = 0; + state.busy = true; + state.action = Action::FillRectangle; + state.taskToNotify = xTaskGetCurrentTaskHandle(); + + lcd.BeginDrawBuffer(0, 0, width, height); + lcd.NextDrawBuffer(reinterpret_cast(buffer), width * 2); + WaitTransfertFinished(); + +} + +void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t color) { + SetBackgroundColor(color); + + state.remainingIterations = h; + state.currentIteration = 0; + state.busy = true; + state.action = Action::FillRectangle; + state.color = color; + state.taskToNotify = xTaskGetCurrentTaskHandle(); + + lcd.BeginDrawBuffer(x, y, w, h); + lcd.NextDrawBuffer(reinterpret_cast(buffer), width * 2); + + WaitTransfertFinished(); +} + +void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t* b) { + state.remainingIterations = h; + state.currentIteration = 0; + state.busy = true; + state.action = Action::FillRectangle; + state.color = 0x00; + state.taskToNotify = xTaskGetCurrentTaskHandle(); + + lcd.BeginDrawBuffer(x, y, w, h); + lcd.NextDrawBuffer(reinterpret_cast(b), width * 2); + + WaitTransfertFinished(); +} + +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; + } + + uint8_t current_x = x; + uint8_t current_y = y; + + for (size_t i = 0; text[i] != '\0'; i++) { + if (text[i] == '\n') { + current_x = x; + current_y += p_font->height + p_font->height / 10; + } else { + DrawChar(p_font, (uint8_t) text[i], ¤t_x, current_y, color); + } + + uint8_t char_idx = text[i] - p_font->startChar; + uint16_t char_width = text[i] == ' ' ? (p_font->height / 2) : p_font->charInfo[char_idx].widthBits; + + if (current_x > (width - char_width)) { + if (wrap) { + current_x = x; + current_y += p_font->height + p_font->height / 10; + } else { + break; + } + + if (y > (height - p_font->height)) { + break; + } + } + } +} + +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; + + if (c == ' ') { + *x += font->height / 2; + return; + } + + // Build first line + 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; + } + } + } + + state.remainingIterations = font->height + 0; + state.currentIteration = 0; + state.busy = true; + state.action = Action::DrawChar; + state.font = const_cast(font); + state.character = c; + state.color = color; + state.taskToNotify = xTaskGetCurrentTaskHandle(); + + lcd.BeginDrawBuffer(*x, y, bytes_in_line*8, font->height); + lcd.NextDrawBuffer(reinterpret_cast(&buffer), bytes_in_line*8*2); + WaitTransfertFinished(); + + *x += font->charInfo[char_idx].widthBits + font->spacePixels; +} + +void Gfx::pixel_draw(uint8_t x, uint8_t y, uint16_t color) { + lcd.DrawPixel(x, y, color); +} + +void Gfx::Sleep() { + lcd.Sleep(); +} + +void Gfx::Wakeup() { + lcd.Wakeup(); +} + +void Gfx::SetBackgroundColor(uint16_t color) { + for(int i = 0; i < width; i++) { + buffer[i] = color; + } +} + +bool Gfx::GetNextBuffer(uint8_t **data, size_t &size) { + if(!state.busy) return false; + state.remainingIterations--; + if (state.remainingIterations == 0) { + state.busy = false; + NotifyEndOfTransfert(state.taskToNotify); + return false; + } + + if(state.action == Action::FillRectangle) { + *data = reinterpret_cast(buffer); + size = width * 2; + } 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; + } + } + } + + *data = reinterpret_cast(buffer); + size = bytes_in_line*8*2; + } + + state.currentIteration++; + + return true; +} + +void Gfx::NotifyEndOfTransfert(TaskHandle_t task) { + if(task != nullptr) { + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + vTaskNotifyGiveFromISR(task, &xHigherPriorityTaskWoken); + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); + } +} + +void Gfx::WaitTransfertFinished() const { + ulTaskNotifyTake(pdTRUE, 500); +} + +void Gfx::SetScrollArea(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines) { + lcd.VerticalScrollDefinition(topFixedLines, scrollLines, bottomFixedLines); +} + +void Gfx::SetScrollStartLine(uint16_t line) { + lcd.VerticalScrollStartAddress(line); +} + diff --git a/src/components/Gfx/Gfx.h b/src/components/Gfx/Gfx.h new file mode 100644 index 0000000..091f06f --- /dev/null +++ b/src/components/Gfx/Gfx.h @@ -0,0 +1,60 @@ +#pragma once +#include +#include +#include +#include +#include + + +namespace Pinetime { + namespace Drivers { + class St7789; + } + 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); + + + 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; + }; + + volatile State state; + + uint16_t buffer[width]; // 1 line buffer + Drivers::St7789& lcd; + + void SetBackgroundColor(uint16_t color); + void WaitTransfertFinished() const; + void NotifyEndOfTransfert(TaskHandle_t task); + }; + } +} -- cgit v0.10.2 From e25c4edbcf64a62b6a0555722b289a94aea506d1 Mon Sep 17 00:00:00 2001 From: Avamander Date: Fri, 2 Oct 2020 21:45:21 +0300 Subject: Renamed SystemTask/ to systemtask/ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f536631..2026471 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -374,7 +374,7 @@ list(APPEND SOURCE_FILES DisplayApp/Fonts/jetbrains_mono_extrabold_compressed.c DisplayApp/Fonts/jetbrains_mono_bold_20.c - SystemTask/SystemTask.cpp + systemtask/SystemTask.cpp drivers/TwiMaster.cpp ) @@ -451,8 +451,8 @@ set(INCLUDE_FILES libs/date/includes/date/ptz.h libs/date/includes/date/tz_private.h DisplayApp/LittleVgl.h - SystemTask/SystemTask.h - SystemTask/SystemMonitor.h + systemtask/SystemTask.h + systemtask/SystemMonitor.h DisplayApp/Screens/Symbols.h drivers/TwiMaster.h ) diff --git a/src/SystemTask/SystemMonitor.h b/src/SystemTask/SystemMonitor.h deleted file mode 100644 index ec1fd81..0000000 --- a/src/SystemTask/SystemMonitor.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once -#include -#include -#include - - -namespace Pinetime { - namespace System { - struct DummyMonitor {}; - struct FreeRtosMonitor {}; - - template - class SystemMonitor { - public: - SystemMonitor() = delete; - }; - - 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, NULL); - 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]; - }; - } -} \ No newline at end of file diff --git a/src/SystemTask/SystemTask.cpp b/src/SystemTask/SystemTask.cpp deleted file mode 100644 index 2070282..0000000 --- a/src/SystemTask/SystemTask.cpp +++ /dev/null @@ -1,247 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "SystemTask.h" -#include -#include -#include -#include -#include "../main.h" -#include "Components/Ble/NimbleController.h" - -using namespace Pinetime::System; - -void IdleTimerCallback(TimerHandle_t xTimer) { - - NRF_LOG_INFO("IdleTimerCallback"); - auto sysTask = static_cast(pvTimerGetTimerID(xTimer)); - sysTask->OnIdle(); -} - - -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, - Controllers::DateTime &dateTimeController, - Pinetime::Controllers::NotificationManager& notificationManager) : - spi{spi}, lcd{lcd}, spiNorFlash{spiNorFlash}, - twiMaster{twiMaster}, touchPanel{touchPanel}, lvgl{lvgl}, batteryController{batteryController}, - bleController{bleController}, dateTimeController{dateTimeController}, - watchdog{}, watchdogView{watchdog}, notificationManager{notificationManager}, - nimbleController(*this, bleController,dateTimeController, notificationManager, batteryController, spiNorFlash) { - systemTaksMsgQueue = xQueueCreate(10, 1); -} - -void SystemTask::Start() { - if (pdPASS != xTaskCreate(SystemTask::Process, "MAIN", 350, this, 0, &taskHandle)) - APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); -} - -void SystemTask::Process(void *instance) { - auto *app = static_cast(instance); - NRF_LOG_INFO("SystemTask task started!"); - app->Work(); -} - -void SystemTask::Work() { - watchdog.Setup(7); - watchdog.Start(); - NRF_LOG_INFO("Last reset reason : %s", Pinetime::Drivers::Watchdog::ResetReasonToString(watchdog.ResetReason())); - APP_GPIOTE_INIT(2); - - spi.Init(); - spiNorFlash.Init(); - spiNorFlash.Wakeup(); - nimbleController.Init(); - nimbleController.StartAdvertising(); - lcd.Init(); - - twiMaster.Init(); - touchPanel.Init(); - batteryController.Init(); - - displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController, - dateTimeController, watchdogView, *this, notificationManager)); - displayApp->Start(); - - batteryController.Update(); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateBatteryLevel); - - 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); - - nrfx_gpiote_in_config_t pinConfig; - 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; - - 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); - - 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; - - nrfx_gpiote_in_init(pinTouchIrq, &pinConfig, nrfx_gpiote_evt_handler); - - idleTimer = xTimerCreate ("idleTimer", idleTime, pdFALSE, this, IdleTimerCallback); - xTimerStart(idleTimer, 0); - - while(true) { - uint8_t msg; - if (xQueueReceive(systemTaksMsgQueue, &msg, isSleeping?2500 : 1000)) { - Messages message = static_cast(msg); - switch(message) { - case Messages::GoToRunning: - spi.Wakeup(); - twiMaster.Wakeup(); - - spiNorFlash.Wakeup(); - lcd.Wakeup(); - touchPanel.Wakeup(); - - displayApp->PushMessage(Applications::DisplayApp::Messages::GoToRunning); - displayApp->PushMessage(Applications::DisplayApp::Messages::UpdateBatteryLevel); - - xTimerStart(idleTimer, 0); - nimbleController.StartAdvertising(); - isSleeping = false; - isWakingUp = false; - break; - case Messages::GoToSleep: - isGoingToSleep = true; - NRF_LOG_INFO("[SystemTask] Going to sleep"); - xTimerStop(idleTimer, 0); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::GoToSleep); - break; - case Messages::OnNewTime: - ReloadIdleTimer(); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateDateTime); - break; - case Messages::OnNewNotification: - if(isSleeping && !isWakingUp) GoToRunning(); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification); - break; - case Messages::BleConnected: - ReloadIdleTimer(); - isBleDiscoveryTimerRunning = true; - bleDiscoveryTimer = 5; - break; - case Messages::BleFirmwareUpdateStarted: - doNotGoToSleep = true; - if(isSleeping && !isWakingUp) GoToRunning(); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::BleFirmwareUpdateStarted); - break; - case Messages::BleFirmwareUpdateFinished: - doNotGoToSleep = false; - xTimerStart(idleTimer, 0); - if(bleController.State() == Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated) - NVIC_SystemReset(); - break; - case Messages::OnTouchEvent: - ReloadIdleTimer(); - break; - case Messages::OnButtonEvent: - ReloadIdleTimer(); - break; - case Messages::OnDisplayTaskSleeping: - spiNorFlash.Sleep(); - lcd.Sleep(); - touchPanel.Sleep(); - - spi.Sleep(); - twiMaster.Sleep(); - isSleeping = true; - isGoingToSleep = false; - break; - default: break; - } - } - - 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... - nimbleController.StartDiscovery(); - } else { - bleDiscoveryTimer--; - } - } - - uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG); - dateTimeController.UpdateTime(systick_counter); - batteryController.Update(); - - monitor.Process(); - - if(!nrf_gpio_pin_read(pinButton)) - watchdog.Kick(); - } -} - -void SystemTask::OnButtonPushed() { - if(isGoingToSleep) return; - if(!isSleeping) { - NRF_LOG_INFO("[SystemTask] Button pushed"); - PushMessage(Messages::OnButtonEvent); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::ButtonPushed); - } - else { - if(!isWakingUp) { - NRF_LOG_INFO("[SystemTask] Button pushed, waking up"); - GoToRunning(); - } - } -} - -void SystemTask::GoToRunning() { - isWakingUp = true; - PushMessage(Messages::GoToRunning); -} - -void SystemTask::OnTouchEvent() { - if(isGoingToSleep) return ; - NRF_LOG_INFO("[SystemTask] Touch event"); - if(!isSleeping) { - PushMessage(Messages::OnTouchEvent); - displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::TouchEvent); - } -} - -void SystemTask::PushMessage(SystemTask::Messages msg) { - if(msg == Messages::GoToSleep) { - isGoingToSleep = true; - } - BaseType_t xHigherPriorityTaskWoken; - xHigherPriorityTaskWoken = pdFALSE; - xQueueSendFromISR(systemTaksMsgQueue, &msg, &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken) { - /* Actual macro used here is port specific. */ - // TODO : should I do something here? - } -} - -void SystemTask::OnIdle() { - if(doNotGoToSleep) return; - NRF_LOG_INFO("Idle timeout -> Going to sleep") - PushMessage(Messages::GoToSleep); -} - -void SystemTask::ReloadIdleTimer() const { - if(isSleeping || isGoingToSleep) return; - xTimerReset(idleTimer, 0); -} diff --git a/src/SystemTask/SystemTask.h b/src/SystemTask/SystemTask.h deleted file mode 100644 index 40277cf..0000000 --- a/src/SystemTask/SystemTask.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "SystemMonitor.h" -#include "Components/Ble/NimbleController.h" -#include "timers.h" - -namespace Pinetime { - namespace System { - class SystemTask { - public: - enum class Messages {GoToSleep, GoToRunning, OnNewTime, OnNewNotification, BleConnected, - BleFirmwareUpdateStarted, BleFirmwareUpdateFinished, OnTouchEvent, OnButtonEvent, OnDisplayTaskSleeping - }; - - 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, - Controllers::DateTime &dateTimeController, - Pinetime::Controllers::NotificationManager& manager); - - - void Start(); - void PushMessage(Messages msg); - - void OnButtonPushed(); - void OnTouchEvent(); - - void OnIdle(); - - Pinetime::Controllers::NimbleController& nimble() {return nimbleController;}; - - 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::Ble& bleController; - Pinetime::Controllers::DateTime& dateTimeController; - QueueHandle_t systemTaksMsgQueue; - 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::NimbleController nimbleController; - - - 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; - static constexpr uint32_t idleTime = 15000; - TimerHandle_t idleTimer; - bool doNotGoToSleep = false; - - void GoToRunning(); - -#if configUSE_TRACE_FACILITY == 1 - SystemMonitor monitor; -#else - SystemMonitor monitor; -#endif - }; - } -} diff --git a/src/systemtask/SystemMonitor.h b/src/systemtask/SystemMonitor.h new file mode 100644 index 0000000..ec1fd81 --- /dev/null +++ b/src/systemtask/SystemMonitor.h @@ -0,0 +1,46 @@ +#pragma once +#include +#include +#include + + +namespace Pinetime { + namespace System { + struct DummyMonitor {}; + struct FreeRtosMonitor {}; + + template + class SystemMonitor { + public: + SystemMonitor() = delete; + }; + + 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, NULL); + 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]; + }; + } +} \ No newline at end of file diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp new file mode 100644 index 0000000..24f688e --- /dev/null +++ b/src/systemtask/SystemTask.cpp @@ -0,0 +1,247 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "SystemTask.h" +#include +#include +#include +#include +#include "../main.h" +#include "Components/Ble/NimbleController.h" + +using namespace Pinetime::System; + +void IdleTimerCallback(TimerHandle_t xTimer) { + + NRF_LOG_INFO("IdleTimerCallback"); + auto sysTask = static_cast(pvTimerGetTimerID(xTimer)); + sysTask->OnIdle(); +} + + +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, + Controllers::DateTime &dateTimeController, + Pinetime::Controllers::NotificationManager& notificationManager) : + spi{spi}, lcd{lcd}, spiNorFlash{spiNorFlash}, + twiMaster{twiMaster}, touchPanel{touchPanel}, lvgl{lvgl}, batteryController{batteryController}, + bleController{bleController}, dateTimeController{dateTimeController}, + watchdog{}, watchdogView{watchdog}, notificationManager{notificationManager}, + nimbleController(*this, bleController,dateTimeController, notificationManager, batteryController, spiNorFlash) { + systemTaksMsgQueue = xQueueCreate(10, 1); +} + +void SystemTask::Start() { + if (pdPASS != xTaskCreate(SystemTask::Process, "MAIN", 350, this, 0, &taskHandle)) + APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); +} + +void SystemTask::Process(void *instance) { + auto *app = static_cast(instance); + NRF_LOG_INFO("systemtask task started!"); + app->Work(); +} + +void SystemTask::Work() { + watchdog.Setup(7); + watchdog.Start(); + NRF_LOG_INFO("Last reset reason : %s", Pinetime::Drivers::Watchdog::ResetReasonToString(watchdog.ResetReason())); + APP_GPIOTE_INIT(2); + + spi.Init(); + spiNorFlash.Init(); + spiNorFlash.Wakeup(); + nimbleController.Init(); + nimbleController.StartAdvertising(); + lcd.Init(); + + twiMaster.Init(); + touchPanel.Init(); + batteryController.Init(); + + displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController, + dateTimeController, watchdogView, *this, notificationManager)); + displayApp->Start(); + + batteryController.Update(); + displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateBatteryLevel); + + 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); + + nrfx_gpiote_in_config_t pinConfig; + 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; + + 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); + + 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; + + nrfx_gpiote_in_init(pinTouchIrq, &pinConfig, nrfx_gpiote_evt_handler); + + idleTimer = xTimerCreate ("idleTimer", idleTime, pdFALSE, this, IdleTimerCallback); + xTimerStart(idleTimer, 0); + + while(true) { + uint8_t msg; + if (xQueueReceive(systemTaksMsgQueue, &msg, isSleeping?2500 : 1000)) { + Messages message = static_cast(msg); + switch(message) { + case Messages::GoToRunning: + spi.Wakeup(); + twiMaster.Wakeup(); + + spiNorFlash.Wakeup(); + lcd.Wakeup(); + touchPanel.Wakeup(); + + displayApp->PushMessage(Applications::DisplayApp::Messages::GoToRunning); + displayApp->PushMessage(Applications::DisplayApp::Messages::UpdateBatteryLevel); + + xTimerStart(idleTimer, 0); + nimbleController.StartAdvertising(); + isSleeping = false; + isWakingUp = false; + break; + case Messages::GoToSleep: + isGoingToSleep = true; + NRF_LOG_INFO("[systemtask] Going to sleep"); + xTimerStop(idleTimer, 0); + displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::GoToSleep); + break; + case Messages::OnNewTime: + ReloadIdleTimer(); + displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::UpdateDateTime); + break; + case Messages::OnNewNotification: + if(isSleeping && !isWakingUp) GoToRunning(); + displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::NewNotification); + break; + case Messages::BleConnected: + ReloadIdleTimer(); + isBleDiscoveryTimerRunning = true; + bleDiscoveryTimer = 5; + break; + case Messages::BleFirmwareUpdateStarted: + doNotGoToSleep = true; + if(isSleeping && !isWakingUp) GoToRunning(); + displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::BleFirmwareUpdateStarted); + break; + case Messages::BleFirmwareUpdateFinished: + doNotGoToSleep = false; + xTimerStart(idleTimer, 0); + if(bleController.State() == Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated) + NVIC_SystemReset(); + break; + case Messages::OnTouchEvent: + ReloadIdleTimer(); + break; + case Messages::OnButtonEvent: + ReloadIdleTimer(); + break; + case Messages::OnDisplayTaskSleeping: + spiNorFlash.Sleep(); + lcd.Sleep(); + touchPanel.Sleep(); + + spi.Sleep(); + twiMaster.Sleep(); + isSleeping = true; + isGoingToSleep = false; + break; + default: break; + } + } + + 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... + nimbleController.StartDiscovery(); + } else { + bleDiscoveryTimer--; + } + } + + uint32_t systick_counter = nrf_rtc_counter_get(portNRF_RTC_REG); + dateTimeController.UpdateTime(systick_counter); + batteryController.Update(); + + monitor.Process(); + + if(!nrf_gpio_pin_read(pinButton)) + watchdog.Kick(); + } +} + +void SystemTask::OnButtonPushed() { + if(isGoingToSleep) return; + if(!isSleeping) { + NRF_LOG_INFO("[systemtask] Button pushed"); + PushMessage(Messages::OnButtonEvent); + displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::ButtonPushed); + } + else { + if(!isWakingUp) { + NRF_LOG_INFO("[systemtask] Button pushed, waking up"); + GoToRunning(); + } + } +} + +void SystemTask::GoToRunning() { + isWakingUp = true; + PushMessage(Messages::GoToRunning); +} + +void SystemTask::OnTouchEvent() { + if(isGoingToSleep) return ; + NRF_LOG_INFO("[systemtask] Touch event"); + if(!isSleeping) { + PushMessage(Messages::OnTouchEvent); + displayApp->PushMessage(Pinetime::Applications::DisplayApp::Messages::TouchEvent); + } +} + +void SystemTask::PushMessage(SystemTask::Messages msg) { + if(msg == Messages::GoToSleep) { + isGoingToSleep = true; + } + BaseType_t xHigherPriorityTaskWoken; + xHigherPriorityTaskWoken = pdFALSE; + xQueueSendFromISR(systemTaksMsgQueue, &msg, &xHigherPriorityTaskWoken); + if (xHigherPriorityTaskWoken) { + /* Actual macro used here is port specific. */ + // TODO : should I do something here? + } +} + +void SystemTask::OnIdle() { + if(doNotGoToSleep) return; + NRF_LOG_INFO("Idle timeout -> Going to sleep") + PushMessage(Messages::GoToSleep); +} + +void SystemTask::ReloadIdleTimer() const { + if(isSleeping || isGoingToSleep) return; + xTimerReset(idleTimer, 0); +} diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h new file mode 100644 index 0000000..40277cf --- /dev/null +++ b/src/systemtask/SystemTask.h @@ -0,0 +1,92 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "SystemMonitor.h" +#include "Components/Ble/NimbleController.h" +#include "timers.h" + +namespace Pinetime { + namespace System { + class SystemTask { + public: + enum class Messages {GoToSleep, GoToRunning, OnNewTime, OnNewNotification, BleConnected, + BleFirmwareUpdateStarted, BleFirmwareUpdateFinished, OnTouchEvent, OnButtonEvent, OnDisplayTaskSleeping + }; + + 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, + Controllers::DateTime &dateTimeController, + Pinetime::Controllers::NotificationManager& manager); + + + void Start(); + void PushMessage(Messages msg); + + void OnButtonPushed(); + void OnTouchEvent(); + + void OnIdle(); + + Pinetime::Controllers::NimbleController& nimble() {return nimbleController;}; + + 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::Ble& bleController; + Pinetime::Controllers::DateTime& dateTimeController; + QueueHandle_t systemTaksMsgQueue; + 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::NimbleController nimbleController; + + + 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; + static constexpr uint32_t idleTime = 15000; + TimerHandle_t idleTimer; + bool doNotGoToSleep = false; + + void GoToRunning(); + +#if configUSE_TRACE_FACILITY == 1 + SystemMonitor monitor; +#else + SystemMonitor monitor; +#endif + }; + } +} -- cgit v0.10.2 From 30c261028e27dab0e30aec19b9c21c37cc74e92b Mon Sep 17 00:00:00 2001 From: Avamander Date: Fri, 2 Oct 2020 21:45:51 +0300 Subject: Renamed Logging/ to logging/ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2026471..f7ff617 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -322,7 +322,7 @@ list(APPEND IMAGE_FILES ) list(APPEND SOURCE_FILES - Logging/NrfLogger.cpp + logging/NrfLogger.cpp DisplayApp/DisplayApp.cpp DisplayApp/Screens/Screen.cpp DisplayApp/Screens/Clock.cpp @@ -387,7 +387,7 @@ list(APPEND GRAPHICS_SOURCE_FILES drivers/SpiNorFlash.cpp drivers/SpiMaster.cpp drivers/Spi.cpp - Logging/NrfLogger.cpp + logging/NrfLogger.cpp components/Gfx/Gfx.cpp drivers/St7789.cpp @@ -397,8 +397,8 @@ list(APPEND GRAPHICS_SOURCE_FILES ) set(INCLUDE_FILES - Logging/Logger.h - Logging/NrfLogger.h + logging/Logger.h + logging/NrfLogger.h DisplayApp/DisplayApp.h DisplayApp/TouchEvents.h DisplayApp/Screens/Screen.h diff --git a/src/Logging/DummyLogger.h b/src/Logging/DummyLogger.h deleted file mode 100644 index 0aa7288..0000000 --- a/src/Logging/DummyLogger.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once -#include "Logger.h" - -namespace Pinetime { - namespace Logging{ - class DummyLogger : public Logger { - public: - void Init() override {} - void Resume() override {} - }; - } -} - diff --git a/src/Logging/Logger.h b/src/Logging/Logger.h deleted file mode 100644 index 95d21dc..0000000 --- a/src/Logging/Logger.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -namespace Pinetime { - namespace Logging { - class Logger { - 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 deleted file mode 100644 index 7ccacc8..0000000 --- a/src/Logging/NrfLogger.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include -#include -#include -#include -#include "NrfLogger.h" - -using namespace Pinetime::Logging; - -void NrfLogger::Init() { - auto result = NRF_LOG_INIT(nullptr); - APP_ERROR_CHECK(result); - - NRF_LOG_DEFAULT_BACKENDS_INIT(); - - if (pdPASS != xTaskCreate(NrfLogger::Process, "LOGGER", 200, this, 0, &m_logger_thread)) - APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); -} - -void NrfLogger::Process(void*) { - NRF_LOG_INFO("Logger task started!"); - while (1) { - NRF_LOG_FLUSH(); - vTaskDelay(100); // Not good for power consumption, it will wake up every 100ms... - } -} - -void NrfLogger::Resume() { - vTaskResume(m_logger_thread); -} - - diff --git a/src/Logging/NrfLogger.h b/src/Logging/NrfLogger.h deleted file mode 100644 index cb7089f..0000000 --- a/src/Logging/NrfLogger.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once -#include "Logger.h" - -namespace Pinetime { - namespace Logging{ - class NrfLogger : public Logger { - public: - void Init() override; - void Resume() override; - - private: - static void Process(void*); - TaskHandle_t m_logger_thread; - }; - } -} - diff --git a/src/logging/DummyLogger.h b/src/logging/DummyLogger.h new file mode 100644 index 0000000..0aa7288 --- /dev/null +++ b/src/logging/DummyLogger.h @@ -0,0 +1,13 @@ +#pragma once +#include "Logger.h" + +namespace Pinetime { + namespace Logging{ + class DummyLogger : public Logger { + public: + void Init() override {} + void Resume() override {} + }; + } +} + diff --git a/src/logging/Logger.h b/src/logging/Logger.h new file mode 100644 index 0000000..95d21dc --- /dev/null +++ b/src/logging/Logger.h @@ -0,0 +1,11 @@ +#pragma once + +namespace Pinetime { + namespace Logging { + class Logger { + 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 new file mode 100644 index 0000000..7ccacc8 --- /dev/null +++ b/src/logging/NrfLogger.cpp @@ -0,0 +1,32 @@ +#include +#include +#include +#include +#include +#include "NrfLogger.h" + +using namespace Pinetime::Logging; + +void NrfLogger::Init() { + auto result = NRF_LOG_INIT(nullptr); + APP_ERROR_CHECK(result); + + NRF_LOG_DEFAULT_BACKENDS_INIT(); + + if (pdPASS != xTaskCreate(NrfLogger::Process, "LOGGER", 200, this, 0, &m_logger_thread)) + APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); +} + +void NrfLogger::Process(void*) { + NRF_LOG_INFO("Logger task started!"); + while (1) { + NRF_LOG_FLUSH(); + vTaskDelay(100); // Not good for power consumption, it will wake up every 100ms... + } +} + +void NrfLogger::Resume() { + vTaskResume(m_logger_thread); +} + + diff --git a/src/logging/NrfLogger.h b/src/logging/NrfLogger.h new file mode 100644 index 0000000..cb7089f --- /dev/null +++ b/src/logging/NrfLogger.h @@ -0,0 +1,17 @@ +#pragma once +#include "Logger.h" + +namespace Pinetime { + namespace Logging{ + class NrfLogger : public Logger { + public: + void Init() override; + void Resume() override; + + private: + static void Process(void*); + TaskHandle_t m_logger_thread; + }; + } +} + -- cgit v0.10.2 From e3fb2f0b8974f3e9a124d27f4b568e754ccfb782 Mon Sep 17 00:00:00 2001 From: Avamander Date: Fri, 2 Oct 2020 21:46:41 +0300 Subject: Renamed DisplayApp/ to displayapp/ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f7ff617..546ce81 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -292,55 +292,55 @@ set(LVGL_SRC ) list(APPEND IMAGE_FILES - DisplayApp/Icons/battery/os_battery_error.c - DisplayApp/Icons/battery/os_battery_100.c - DisplayApp/Icons/battery/os_battery_090.c - DisplayApp/Icons/battery/os_battery_080.c - DisplayApp/Icons/battery/os_battery_070.c - DisplayApp/Icons/battery/os_battery_060.c - DisplayApp/Icons/battery/os_battery_050.c - DisplayApp/Icons/battery/os_battery_040.c - DisplayApp/Icons/battery/os_battery_030.c - DisplayApp/Icons/battery/os_battery_020.c - DisplayApp/Icons/battery/os_battery_010.c - DisplayApp/Icons/battery/os_battery_005.c - - DisplayApp/Icons/battery/os_batterycharging_100.c - DisplayApp/Icons/battery/os_batterycharging_090.c - DisplayApp/Icons/battery/os_batterycharging_080.c - DisplayApp/Icons/battery/os_batterycharging_070.c - DisplayApp/Icons/battery/os_batterycharging_060.c - DisplayApp/Icons/battery/os_batterycharging_050.c - DisplayApp/Icons/battery/os_batterycharging_040.c - DisplayApp/Icons/battery/os_batterycharging_030.c - DisplayApp/Icons/battery/os_batterycharging_020.c - DisplayApp/Icons/battery/os_batterycharging_010.c - DisplayApp/Icons/battery/os_batterycharging_005.c - - DisplayApp/Icons/bluetooth/os_bt_connected.c - DisplayApp/Icons/bluetooth/os_bt_disconnected.c + displayapp/Icons/battery/os_battery_error.c + displayapp/Icons/battery/os_battery_100.c + displayapp/Icons/battery/os_battery_090.c + displayapp/Icons/battery/os_battery_080.c + displayapp/Icons/battery/os_battery_070.c + displayapp/Icons/battery/os_battery_060.c + displayapp/Icons/battery/os_battery_050.c + displayapp/Icons/battery/os_battery_040.c + displayapp/Icons/battery/os_battery_030.c + displayapp/Icons/battery/os_battery_020.c + displayapp/Icons/battery/os_battery_010.c + displayapp/Icons/battery/os_battery_005.c + + displayapp/Icons/battery/os_batterycharging_100.c + displayapp/Icons/battery/os_batterycharging_090.c + displayapp/Icons/battery/os_batterycharging_080.c + displayapp/Icons/battery/os_batterycharging_070.c + displayapp/Icons/battery/os_batterycharging_060.c + displayapp/Icons/battery/os_batterycharging_050.c + displayapp/Icons/battery/os_batterycharging_040.c + displayapp/Icons/battery/os_batterycharging_030.c + displayapp/Icons/battery/os_batterycharging_020.c + displayapp/Icons/battery/os_batterycharging_010.c + displayapp/Icons/battery/os_batterycharging_005.c + + displayapp/Icons/bluetooth/os_bt_connected.c + displayapp/Icons/bluetooth/os_bt_disconnected.c ) list(APPEND SOURCE_FILES logging/NrfLogger.cpp - DisplayApp/DisplayApp.cpp - DisplayApp/Screens/Screen.cpp - DisplayApp/Screens/Clock.cpp - DisplayApp/Screens/Tile.cpp - DisplayApp/Screens/Meter.cpp - DisplayApp/Screens/Gauge.cpp - DisplayApp/Screens/InfiniPaint.cpp - DisplayApp/Screens/DropDownDemo.cpp - DisplayApp/Screens/Modal.cpp - DisplayApp/Screens/BatteryIcon.cpp - DisplayApp/Screens/BleIcon.cpp - DisplayApp/Screens/Brightness.cpp - DisplayApp/Screens/SystemInfo.cpp - DisplayApp/Screens/Label.cpp - DisplayApp/Screens/FirmwareUpdate.cpp - DisplayApp/Screens/Music.cpp - DisplayApp/Screens/FirmwareValidation.cpp - DisplayApp/Screens/ApplicationList.cpp + displayapp/DisplayApp.cpp + displayapp/Screens/Screen.cpp + displayapp/Screens/Clock.cpp + displayapp/Screens/Tile.cpp + displayapp/Screens/Meter.cpp + displayapp/Screens/Gauge.cpp + displayapp/Screens/InfiniPaint.cpp + displayapp/Screens/DropDownDemo.cpp + displayapp/Screens/Modal.cpp + displayapp/Screens/BatteryIcon.cpp + displayapp/Screens/BleIcon.cpp + displayapp/Screens/Brightness.cpp + displayapp/Screens/SystemInfo.cpp + displayapp/Screens/Label.cpp + displayapp/Screens/FirmwareUpdate.cpp + displayapp/Screens/Music.cpp + displayapp/Screens/FirmwareValidation.cpp + displayapp/Screens/ApplicationList.cpp main.cpp drivers/St7789.cpp drivers/SpiNorFlash.cpp @@ -370,9 +370,9 @@ list(APPEND SOURCE_FILES FreeRTOS/port_cmsis_systick.c FreeRTOS/port_cmsis.c - DisplayApp/LittleVgl.cpp - DisplayApp/Fonts/jetbrains_mono_extrabold_compressed.c - DisplayApp/Fonts/jetbrains_mono_bold_20.c + displayapp/LittleVgl.cpp + displayapp/Fonts/jetbrains_mono_extrabold_compressed.c + displayapp/Fonts/jetbrains_mono_bold_20.c systemtask/SystemTask.cpp drivers/TwiMaster.cpp @@ -399,26 +399,26 @@ list(APPEND GRAPHICS_SOURCE_FILES set(INCLUDE_FILES logging/Logger.h logging/NrfLogger.h - DisplayApp/DisplayApp.h - DisplayApp/TouchEvents.h - DisplayApp/Screens/Screen.h - DisplayApp/Screens/Clock.h - DisplayApp/Screens/Tile.h - DisplayApp/Screens/Meter.h - DisplayApp/Screens/Gauge.h - DisplayApp/Screens/InfiniPaint.h - DisplayApp/Screens/DropDownDemo.h - DisplayApp/Screens/Modal.h - DisplayApp/Screens/BatteryIcon.h - DisplayApp/Screens/BleIcon.cpp - DisplayApp/Screens/Brightness.h - DisplayApp/Screens/SystemInfo.h - DisplayApp/Screens/ScreenList.h - DisplayApp/Screens/Label.h - DisplayApp/Screens/FirmwareUpdate.h - DisplayApp/Screens/FirmwareValidation.h - DisplayApp/Screens/ApplicationList.h - DisplayApp/Apps.h + displayapp/DisplayApp.h + displayapp/TouchEvents.h + displayapp/Screens/Screen.h + displayapp/Screens/Clock.h + displayapp/Screens/Tile.h + displayapp/Screens/Meter.h + displayapp/Screens/Gauge.h + displayapp/Screens/InfiniPaint.h + displayapp/Screens/DropDownDemo.h + displayapp/Screens/Modal.h + displayapp/Screens/BatteryIcon.h + displayapp/Screens/BleIcon.cpp + displayapp/Screens/Brightness.h + displayapp/Screens/SystemInfo.h + displayapp/Screens/ScreenList.h + displayapp/Screens/Label.h + displayapp/Screens/FirmwareUpdate.h + displayapp/Screens/FirmwareValidation.h + displayapp/Screens/ApplicationList.h + displayapp/Apps.h drivers/St7789.h drivers/SpiNorFlash.h drivers/SpiMaster.h @@ -450,10 +450,10 @@ set(INCLUDE_FILES libs/date/includes/date/julian.h libs/date/includes/date/ptz.h libs/date/includes/date/tz_private.h - DisplayApp/LittleVgl.h + displayapp/LittleVgl.h systemtask/SystemTask.h systemtask/SystemMonitor.h - DisplayApp/Screens/Symbols.h + displayapp/Screens/Symbols.h drivers/TwiMaster.h ) diff --git a/src/DisplayApp/Apps.h b/src/DisplayApp/Apps.h deleted file mode 100644 index 3842e4e..0000000 --- a/src/DisplayApp/Apps.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -namespace Pinetime { - namespace Applications { - enum class Apps {None, Launcher, Clock, SysInfo, Meter, Gauge, Brightness, Music, FirmwareValidation, Paint}; - } -} \ No newline at end of file diff --git a/src/DisplayApp/DisplayApp.cpp b/src/DisplayApp/DisplayApp.cpp deleted file mode 100644 index f6138ec..0000000 --- a/src/DisplayApp/DisplayApp.cpp +++ /dev/null @@ -1,271 +0,0 @@ -#include "DisplayApp.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../SystemTask/SystemTask.h" - -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, - Pinetime::Controllers::NotificationManager& notificationManager) : - lcd{lcd}, - lvgl{lvgl}, - batteryController{batteryController}, - bleController{bleController}, - dateTimeController{dateTimeController}, - watchdog{watchdog}, - touchPanel{touchPanel}, - currentScreen{new Screens::Clock(this, dateTimeController, batteryController, bleController) }, - systemTask{systemTask}, - notificationManager{notificationManager} { - msgQueue = xQueueCreate(queueSize, itemSize); - onClockApp = true; - modal.reset(new Screens::Modal(this)); -} - -void DisplayApp::Start() { - if (pdPASS != xTaskCreate(DisplayApp::Process, "DisplayApp", 512, this, 0, &taskHandle)) - APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); -} - -void DisplayApp::Process(void *instance) { - auto *app = static_cast(instance); - NRF_LOG_INFO("DisplayApp task started!"); - app->InitHw(); - - // Send a dummy notification to unlock the lvgl display driver for the first iteration - xTaskNotifyGive(xTaskGetCurrentTaskHandle()); - - while (1) { - - app->Refresh(); - - } -} - -void DisplayApp::InitHw() { - brightnessController.Init(); -} - -uint32_t acc = 0; -uint32_t count = 0; -bool toggle = true; -void DisplayApp::Refresh() { - TickType_t queueTimeout; - switch (state) { - case States::Idle: - IdleState(); - queueTimeout = portMAX_DELAY; - break; - case States::Running: - RunningState(); - queueTimeout = 20; - break; - default: - queueTimeout = portMAX_DELAY; - break; - } - - Messages msg; - if (xQueueReceive(msgQueue, &msg, queueTimeout)) { - switch (msg) { - case Messages::GoToSleep: - brightnessController.Backup(); - while(brightnessController.Level() != Controllers::BrightnessController::Levels::Off) { - brightnessController.Lower(); - vTaskDelay(100); - } - lcd.DisplayOff(); - systemTask.PushMessage(System::SystemTask::Messages::OnDisplayTaskSleeping); - state = States::Idle; - break; - case Messages::GoToRunning: - lcd.DisplayOn(); - brightnessController.Restore(); - state = States::Running; - break; - case Messages::UpdateDateTime: -// modal->Show(); - break; - case Messages::UpdateBleConnection: -// clockScreen.SetBleConnectionState(bleController.IsConnected() ? Screens::Clock::BleConnectionStates::Connected : Screens::Clock::BleConnectionStates::NotConnected); - break; - case Messages::UpdateBatteryLevel: -// clockScreen.SetBatteryPercentRemaining(batteryController.PercentRemaining()); - break; - case Messages::NewNotification: { - auto notification = notificationManager.Pop(); - modal->Show(notification.message.data()); - } - break; - case Messages::TouchEvent: { - if (state != States::Running) break; - auto gesture = OnTouchEvent(); - if(!currentScreen->OnTouchEvent(gesture)) { - switch (gesture) { - case TouchEvents::SwipeUp: - currentScreen->OnButtonPushed(); - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up); - break; - case TouchEvents::SwipeDown: - currentScreen->OnButtonPushed(); - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down); - break; - default: - break; - } - } - } - break; - case Messages::ButtonPushed: - if(onClockApp) - systemTask.PushMessage(System::SystemTask::Messages::GoToSleep); - else { - auto buttonUsedByApp = currentScreen->OnButtonPushed(); - if (!buttonUsedByApp) { - systemTask.PushMessage(System::SystemTask::Messages::GoToSleep); - } else { - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up); - } - } - -// lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down); -// currentScreen.reset(nullptr); -// if(toggle) { -// currentScreen.reset(new Screens::Tile(this)); -// toggle = false; -// } else { -// currentScreen.reset(new Screens::Clock(this, dateTimeController, batteryController, bleController)); -// toggle = true; -// } - - break; - case Messages::BleFirmwareUpdateStarted: - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down); - currentScreen.reset(nullptr); - currentScreen.reset(new Screens::FirmwareUpdate(this, bleController)); - onClockApp = false; - - break; - } - } - - if(state != States::Idle && touchMode == TouchModes::Polling) { - auto info = touchPanel.GetTouchInfo(); - if(info.action == 2) {// 2 = contact - if(!currentScreen->OnTouchEvent(info.x, info.y)) { - lvgl.SetNewTapEvent(info.x, info.y); - } - } - } -} - -void DisplayApp::RunningState() { -// clockScreen.SetCurrentDateTime(dateTimeController.CurrentDateTime()); - - if(!currentScreen->Refresh()) { - currentScreen.reset(nullptr); - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up); - onClockApp = false; - switch(nextApp) { - case Apps::None: - case Apps::Launcher: currentScreen.reset(new Screens::ApplicationList(this)); break; - case Apps::Clock: - currentScreen.reset(new Screens::Clock(this, dateTimeController, batteryController, bleController)); - onClockApp = true; - break; -// case Apps::Test: currentScreen.reset(new Screens::Message(this)); break; - case Apps::SysInfo: currentScreen.reset(new Screens::SystemInfo(this, dateTimeController, batteryController, brightnessController, bleController, watchdog)); break; - case Apps::Meter: currentScreen.reset(new Screens::Meter(this)); break; - case Apps::Gauge: currentScreen.reset(new Screens::Gauge(this)); break; - case Apps::Paint: currentScreen.reset(new Screens::InfiniPaint(this, lvgl)); break; - case Apps::Brightness : currentScreen.reset(new Screens::Brightness(this, brightnessController)); break; - case Apps::Music : currentScreen.reset(new Screens::Music(this, systemTask.nimble().music())); break; - case Apps::FirmwareValidation: currentScreen.reset(new Screens::FirmwareValidation(this, validator)); break; - } - nextApp = Apps::None; - } - lv_task_handler(); -} - -void DisplayApp::IdleState() { - -} - -void DisplayApp::PushMessage(DisplayApp::Messages msg) { - BaseType_t xHigherPriorityTaskWoken; - xHigherPriorityTaskWoken = pdFALSE; - xQueueSendFromISR(msgQueue, &msg, &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken) { - /* Actual macro used here is port specific. */ - // TODO : should I do something here? - } -} - -TouchEvents DisplayApp::OnTouchEvent() { - auto info = touchPanel.GetTouchInfo(); - if(info.isTouch) { - switch(info.gesture) { - case Pinetime::Drivers::Cst816S::Gestures::SingleTap: - if(touchMode == TouchModes::Gestures) - lvgl.SetNewTapEvent(info.x, info.y); - return TouchEvents::Tap; - case Pinetime::Drivers::Cst816S::Gestures::LongPress: - return TouchEvents::LongTap; - case Pinetime::Drivers::Cst816S::Gestures::DoubleTap: - return TouchEvents::DoubleTap; - case Pinetime::Drivers::Cst816S::Gestures::SlideRight: - return TouchEvents::SwipeRight; - case Pinetime::Drivers::Cst816S::Gestures::SlideLeft: - return TouchEvents::SwipeLeft; - case Pinetime::Drivers::Cst816S::Gestures::SlideDown: - return TouchEvents::SwipeDown; - case Pinetime::Drivers::Cst816S::Gestures::SlideUp: - return TouchEvents::SwipeUp; - case Pinetime::Drivers::Cst816S::Gestures::None: - default: - return TouchEvents::None; - } - } - return TouchEvents::None; -} - -void DisplayApp::StartApp(Apps app) { - nextApp = app; -} - -void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) { - switch(direction){ - case DisplayApp::FullRefreshDirections::Down: - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down); - break; - case DisplayApp::FullRefreshDirections::Up: - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up); - break; - default: break; - } - -} - -void DisplayApp::SetTouchMode(DisplayApp::TouchModes mode) { - touchMode = mode; -} diff --git a/src/DisplayApp/DisplayApp.h b/src/DisplayApp/DisplayApp.h deleted file mode 100644 index 345e06d..0000000 --- a/src/DisplayApp/DisplayApp.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../drivers/Cst816s.h" -#include "LittleVgl.h" -#include -#include -#include -#include -#include -#include -#include "TouchEvents.h" -#include "Apps.h" - - -namespace Pinetime { - namespace System { - class SystemTask; - }; - namespace Applications { - class DisplayApp { - public: - enum class States {Idle, Running}; - enum class Messages : uint8_t {GoToSleep, GoToRunning, UpdateDateTime, UpdateBleConnection, UpdateBatteryLevel, TouchEvent, ButtonPushed, - NewNotification, BleFirmwareUpdateStarted }; - - enum class FullRefreshDirections { None, Up, Down }; - 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); - void Start(); - void PushMessage(Messages msg); - - void StartApp(Apps app); - - void SetFullRefresh(FullRefreshDirections direction); - void SetTouchMode(TouchModes mode); - - private: - TaskHandle_t taskHandle; - static void Process(void* instance); - void InitHw(); - Pinetime::Drivers::St7789& lcd; - Pinetime::Components::LittleVgl& lvgl; - void Refresh(); - - States state = States::Running; - void RunningState(); - void IdleState(); - QueueHandle_t msgQueue; - - static constexpr uint8_t queueSize = 10; - static constexpr uint8_t itemSize = 1; - - Pinetime::Controllers::Battery &batteryController; - Pinetime::Controllers::Ble &bleController; - Pinetime::Controllers::DateTime& dateTimeController; - Pinetime::Drivers::WatchdogView& watchdog; - - Pinetime::Drivers::Cst816S& touchPanel; - TouchEvents OnTouchEvent(); - - std::unique_ptr currentScreen; - - bool isClock = true; - - Pinetime::System::SystemTask& systemTask; - Apps nextApp = Apps::None; - bool onClockApp = false; // TODO find a better way to know that we should handle gestures and button differently for the Clock app. - Controllers::BrightnessController brightnessController; - std::unique_ptr modal; - Pinetime::Controllers::NotificationManager& notificationManager; - Pinetime::Controllers::FirmwareValidator validator; - TouchModes touchMode = TouchModes::Gestures; - }; - } -} - - diff --git a/src/DisplayApp/Fonts/Readme.md b/src/DisplayApp/Fonts/Readme.md deleted file mode 100644 index 7ebf2e2..0000000 --- a/src/DisplayApp/Fonts/Readme.md +++ /dev/null @@ -1,23 +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.woff` and specify the following range : `0x20-0x7f` - * 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` - * 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 - * 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"; -``` diff --git a/src/DisplayApp/Fonts/jetbrains_mono_bold_20.c b/src/DisplayApp/Fonts/jetbrains_mono_bold_20.c deleted file mode 100644 index 27ad005..0000000 --- a/src/DisplayApp/Fonts/jetbrains_mono_bold_20.c +++ /dev/null @@ -1,766 +0,0 @@ -#include "lvgl/lvgl.h" - -/******************************************************************************* - * Size: 20 px - * Bpp: 1 - * Opts: - ******************************************************************************/ - -#ifndef JETBRAINS_MONO_BOLD_20 -#define JETBRAINS_MONO_BOLD_20 1 -#endif - -#if JETBRAINS_MONO_BOLD_20 - -/*----------------- - * BITMAPS - *----------------*/ - -/*Store the image of the glyphs*/ -static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { - /* U+20 " " */ - 0x0, - - /* U+21 "!" */ - 0xff, 0xff, 0xff, 0xe0, 0xf, 0xc0, - - /* U+22 "\"" */ - 0xef, 0xdf, 0xbf, 0x7e, 0xfd, 0xc0, - - /* U+23 "#" */ - 0x8, 0xc3, 0x10, 0x62, 0x3f, 0xf7, 0xfe, 0x23, - 0x4, 0x61, 0x88, 0x31, 0x1f, 0xfb, 0xff, 0x19, - 0x82, 0x30, 0xc4, 0x0, - - /* U+24 "$" */ - 0x8, 0x2, 0x1, 0xc1, 0xfe, 0xeb, 0xf2, 0x7c, - 0x83, 0xa0, 0x7c, 0xf, 0xc0, 0xf8, 0x27, 0x9, - 0xf2, 0x7f, 0xf9, 0xfc, 0x8, 0x2, 0x0, 0x80, - - /* U+25 "%" */ - 0x78, 0x1f, 0x83, 0x30, 0x66, 0x1f, 0xcc, 0xf2, - 0x1, 0x80, 0xde, 0x67, 0xf8, 0xcc, 0x19, 0x83, - 0x30, 0x7e, 0x7, 0x80, - - /* U+26 "&" */ - 0x1e, 0x7, 0xe1, 0xce, 0x38, 0x7, 0x0, 0x70, - 0x1e, 0x7, 0x66, 0xed, 0xdc, 0xf3, 0x9c, 0x73, - 0xcf, 0xfc, 0xf9, 0x80, - - /* U+27 "'" */ - 0xff, 0xff, 0xc0, - - /* U+28 "(" */ - 0x2, 0x1c, 0xfb, 0xc7, 0x1e, 0x38, 0x70, 0xe1, - 0xc3, 0x87, 0xe, 0x1c, 0x3c, 0x38, 0x38, 0x7c, - 0x38, - - /* U+29 ")" */ - 0x1, 0xc3, 0xc1, 0xc1, 0xc3, 0xc3, 0x87, 0xe, - 0x1c, 0x38, 0x70, 0xe1, 0xc7, 0x8e, 0x79, 0xe3, - 0x80, - - /* U+2A "*" */ - 0xc, 0x3, 0x8, 0xc7, 0xb7, 0x7f, 0x83, 0x1, - 0xe0, 0xcc, 0x73, 0x80, 0x0, - - /* U+2B "+" */ - 0x1c, 0x7, 0x1, 0xc3, 0xff, 0xff, 0xc7, 0x1, - 0xc0, 0x70, 0x1c, 0x0, - - /* U+2C "," */ - 0x7b, 0x9c, 0xce, 0x60, - - /* U+2D "-" */ - 0xff, 0xff, - - /* U+2E "." */ - 0x6f, 0xf6, - - /* U+2F "/" */ - 0x1, 0xc0, 0x60, 0x38, 0xe, 0x3, 0x1, 0xc0, - 0x70, 0x18, 0xe, 0x3, 0x1, 0xc0, 0x70, 0x18, - 0xe, 0x3, 0x80, 0xc0, 0x70, 0x18, 0xe, 0x0, - - /* U+30 "0" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xed, 0xfb, 0x7e, - 0xdf, 0xb7, 0xed, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, - 0x8f, 0x80, - - /* U+31 "1" */ - 0x3c, 0x3e, 0x3f, 0x13, 0x81, 0xc0, 0xe0, 0x70, - 0x38, 0x1c, 0xe, 0x7, 0x3, 0x8f, 0xff, 0xfc, - - /* U+32 "2" */ - 0x1f, 0x1f, 0xef, 0x3f, 0x87, 0x1, 0xc0, 0x70, - 0x38, 0x1e, 0xf, 0x7, 0x87, 0x83, 0xc0, 0xff, - 0xff, 0xf0, - - /* U+33 "3" */ - 0x7f, 0xdf, 0xf0, 0x3c, 0x1c, 0x1c, 0x7, 0xc1, - 0xf8, 0xf, 0x1, 0xc0, 0x7e, 0x1d, 0x8f, 0x7f, - 0x87, 0xc0, - - /* U+34 "4" */ - 0x7, 0x7, 0x3, 0x83, 0x83, 0x81, 0xc1, 0xcf, - 0xe7, 0xe3, 0xff, 0xff, 0xe0, 0x70, 0x38, 0x1c, - - /* U+35 "5" */ - 0xff, 0x7f, 0xb8, 0x1c, 0xe, 0x7, 0x73, 0xfd, - 0xcf, 0x3, 0x81, 0xc0, 0xfc, 0xff, 0xf1, 0xf0, - - /* U+36 "6" */ - 0x6, 0x3, 0x1, 0xc0, 0x60, 0x30, 0x1b, 0xc7, - 0xfb, 0xcf, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, - 0x87, 0x80, - - /* U+37 "7" */ - 0xff, 0xff, 0xfe, 0xb, 0x86, 0x1, 0x80, 0xc0, - 0x30, 0x18, 0x6, 0x3, 0x80, 0xc0, 0x70, 0x18, - 0xe, 0x0, - - /* U+38 "8" */ - 0x3e, 0x1f, 0xce, 0x3b, 0x6, 0xe3, 0x9f, 0xc7, - 0xf1, 0x8e, 0xc1, 0xf0, 0x7c, 0x1f, 0x8f, 0x7f, - 0x8f, 0x80, - - /* U+39 "9" */ - 0x1e, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, - 0x3d, 0xfe, 0x3d, 0x80, 0xc0, 0x60, 0x38, 0xc, - 0x6, 0x0, - - /* U+3A ":" */ - 0xff, 0x80, 0x0, 0xff, 0x80, - - /* U+3B ";" */ - 0x7b, 0xde, 0x0, 0x0, 0x0, 0x7b, 0x9c, 0xce, - 0x60, - - /* U+3C "<" */ - 0x0, 0x81, 0xc3, 0xe7, 0xcf, 0x6, 0x3, 0xc0, - 0x7c, 0xf, 0x81, 0xc0, 0x20, - - /* U+3D "=" */ - 0xff, 0xff, 0xc0, 0x0, 0x0, 0x7, 0xff, 0xfe, - - /* U+3E ">" */ - 0x0, 0x70, 0x3e, 0x7, 0xc0, 0xf8, 0xc, 0x1e, - 0x7c, 0xf8, 0x70, 0x20, 0x0, - - /* U+3F "?" */ - 0xfc, 0xfe, 0xf, 0x7, 0x7, 0xf, 0x3e, 0x3c, - 0x30, 0x30, 0x0, 0x0, 0x70, 0x70, - - /* U+40 "@" */ - 0x1f, 0x87, 0xf9, 0xc3, 0xf0, 0x3c, 0x77, 0x9f, - 0xf3, 0x1e, 0x63, 0xcc, 0x79, 0x8f, 0x31, 0xe7, - 0xfc, 0x77, 0xc0, 0x1c, 0x1, 0xf0, 0x1e, 0x0, - - /* U+41 "A" */ - 0xf, 0x0, 0xf0, 0xf, 0x1, 0xf8, 0x19, 0x81, - 0x98, 0x19, 0x83, 0x9c, 0x3f, 0xc3, 0xfc, 0x70, - 0xe7, 0xe, 0x60, 0x66, 0x6, - - /* U+42 "B" */ - 0xfe, 0x3f, 0xce, 0x3b, 0x8e, 0xe3, 0xb8, 0xcf, - 0xe3, 0xfc, 0xe3, 0xb8, 0x7e, 0x1f, 0x8f, 0xff, - 0xbf, 0xc0, - - /* U+43 "C" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe0, 0x38, 0xe, - 0x3, 0x80, 0xe0, 0x38, 0xe, 0x1f, 0xcf, 0x7f, - 0x8f, 0xc0, - - /* U+44 "D" */ - 0xfe, 0x3f, 0xee, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0x8f, 0xff, - 0xbf, 0x80, - - /* U+45 "E" */ - 0xff, 0xff, 0xf8, 0x1c, 0xe, 0x7, 0x3, 0xfd, - 0xfe, 0xe0, 0x70, 0x38, 0x1c, 0xf, 0xff, 0xfc, - - /* U+46 "F" */ - 0xff, 0xff, 0xf8, 0x1c, 0xe, 0x7, 0x3, 0xff, - 0xff, 0xe0, 0x70, 0x38, 0x1c, 0xe, 0x7, 0x0, - - /* U+47 "G" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe0, 0x38, 0xe, - 0x7f, 0x9f, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, - 0x87, 0x80, - - /* U+48 "H" */ - 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0xff, - 0xff, 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1c, - - /* U+49 "I" */ - 0xff, 0xff, 0xc7, 0x3, 0x81, 0xc0, 0xe0, 0x70, - 0x38, 0x1c, 0xe, 0x7, 0x3, 0x8f, 0xff, 0xfc, - - /* U+4A "J" */ - 0x3f, 0xcf, 0xf0, 0x1c, 0x7, 0x1, 0xc0, 0x70, - 0x1c, 0x7, 0x1, 0xc0, 0x7e, 0x1f, 0x8f, 0x7f, - 0x8f, 0xc0, - - /* U+4B "K" */ - 0xe1, 0xdc, 0x3b, 0x8e, 0x71, 0xce, 0x31, 0xce, - 0x3f, 0x87, 0xf0, 0xe7, 0x1c, 0x63, 0x8e, 0x70, - 0xce, 0x1d, 0xc3, 0x80, - - /* U+4C "L" */ - 0xe0, 0x70, 0x38, 0x1c, 0xe, 0x7, 0x3, 0x81, - 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0xf, 0xff, 0xfc, - - /* U+4D "M" */ - 0xe1, 0xf8, 0x7f, 0x3f, 0xcf, 0xda, 0xf7, 0xbd, - 0xef, 0x33, 0xc0, 0xf0, 0x3c, 0xf, 0x3, 0xc0, - 0xf0, 0x30, - - /* U+4E "N" */ - 0xe1, 0xf0, 0xfc, 0x7e, 0x3d, 0x9e, 0xcf, 0x67, - 0x9b, 0xcd, 0xe6, 0xf1, 0xf8, 0xfc, 0x3e, 0x1c, - - /* U+4F "O" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, - 0x8f, 0x80, - - /* U+50 "P" */ - 0xff, 0x3f, 0xee, 0x3f, 0x87, 0xe1, 0xf8, 0xff, - 0xfb, 0xfc, 0xe0, 0x38, 0xe, 0x3, 0x80, 0xe0, - 0x38, 0x0, - - /* U+51 "Q" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, - 0x8f, 0x80, 0x70, 0xe, 0x1, 0xc0, - - /* U+52 "R" */ - 0xff, 0x3f, 0xee, 0x3f, 0x87, 0xe1, 0xf8, 0xff, - 0xfb, 0xf8, 0xe6, 0x39, 0xce, 0x33, 0x8e, 0xe3, - 0xb8, 0x70, - - /* U+53 "S" */ - 0x3f, 0x1f, 0xee, 0x1f, 0x87, 0xe0, 0x3e, 0x7, - 0xf0, 0x7e, 0x3, 0xc0, 0x7e, 0x1f, 0xcf, 0x7f, - 0x8f, 0xc0, - - /* U+54 "T" */ - 0xff, 0xff, 0xf0, 0xe0, 0x38, 0xe, 0x3, 0x80, - 0xe0, 0x38, 0xe, 0x3, 0x80, 0xe0, 0x38, 0xe, - 0x3, 0x80, - - /* U+55 "U" */ - 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, - 0xc7, 0xe3, 0xf1, 0xf8, 0xfc, 0x77, 0xf1, 0xf0, - - /* U+56 "V" */ - 0x60, 0x66, 0x6, 0x70, 0xe7, 0xe, 0x30, 0xc3, - 0xc, 0x39, 0xc1, 0x98, 0x19, 0x81, 0x98, 0x1f, - 0x80, 0xf0, 0xf, 0x0, 0xf0, - - /* U+57 "W" */ - 0xc6, 0x78, 0xcf, 0x39, 0xe7, 0x3e, 0xa6, 0xd6, - 0xda, 0xdb, 0x5b, 0x6b, 0x6d, 0x2d, 0xe7, 0x3c, - 0xe7, 0x9c, 0xe3, 0x80, - - /* U+58 "X" */ - 0xe1, 0xd8, 0x67, 0x38, 0xcc, 0x3f, 0x7, 0x81, - 0xe0, 0x78, 0x1e, 0xf, 0xc3, 0x31, 0xce, 0xe1, - 0xf8, 0x70, - - /* U+59 "Y" */ - 0xe0, 0xfc, 0x1d, 0xc7, 0x38, 0xe3, 0x98, 0x77, - 0x6, 0xc0, 0xf8, 0xe, 0x1, 0xc0, 0x38, 0x7, - 0x0, 0xe0, 0x1c, 0x0, - - /* U+5A "Z" */ - 0xff, 0xff, 0xc0, 0xe0, 0xe0, 0x60, 0x70, 0x70, - 0x38, 0x38, 0x38, 0x1c, 0x1c, 0xf, 0xff, 0xfc, - - /* U+5B "[" */ - 0xff, 0xfe, 0x38, 0xe3, 0x8e, 0x38, 0xe3, 0x8e, - 0x38, 0xe3, 0x8e, 0x38, 0xff, 0xf0, - - /* U+5C "\\" */ - 0xe0, 0x18, 0x7, 0x1, 0xc0, 0x30, 0xe, 0x3, - 0x80, 0x60, 0x1c, 0x3, 0x0, 0xe0, 0x38, 0x6, - 0x1, 0xc0, 0x70, 0xc, 0x3, 0x80, 0x60, 0x1c, - - /* U+5D "]" */ - 0xff, 0xf1, 0xc7, 0x1c, 0x71, 0xc7, 0x1c, 0x71, - 0xc7, 0x1c, 0x71, 0xc7, 0xff, 0xf0, - - /* U+5E "^" */ - 0xc, 0x7, 0x81, 0xe0, 0xfc, 0x33, 0x1c, 0xe6, - 0x19, 0x86, - - /* U+5F "_" */ - 0xff, 0xff, 0xf0, - - /* U+60 "`" */ - 0x63, 0x8e, - - /* U+61 "a" */ - 0x3f, 0x1f, 0xee, 0x1c, 0x7, 0x3f, 0xdf, 0xfe, - 0x1f, 0x87, 0xe3, 0xff, 0xf7, 0xdc, - - /* U+62 "b" */ - 0xe0, 0x38, 0xe, 0x3, 0xbc, 0xff, 0xbc, 0xfe, - 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0xff, - 0xbb, 0xc0, - - /* U+63 "c" */ - 0x3f, 0x1f, 0xef, 0x1f, 0x83, 0xe0, 0x38, 0xe, - 0x3, 0x87, 0xf1, 0xdf, 0xe3, 0xe0, - - /* U+64 "d" */ - 0x1, 0xc0, 0x70, 0x1c, 0xf7, 0x7f, 0xfc, 0xfe, - 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, - 0xcf, 0x70, - - /* U+65 "e" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xff, 0xff, 0xfe, - 0x3, 0x80, 0xf1, 0xdf, 0xe3, 0xf0, - - /* U+66 "f" */ - 0xf, 0xc7, 0xf1, 0xc0, 0x70, 0xff, 0xff, 0xf1, - 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0x1c, - 0x7, 0x0, - - /* U+67 "g" */ - 0x3d, 0xdf, 0xff, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0xcf, 0x7f, 0xcf, 0x70, 0x1c, 0xf, 0x3f, - 0x8f, 0xc0, - - /* U+68 "h" */ - 0xe0, 0x70, 0x38, 0x1d, 0xcf, 0xf7, 0x9f, 0x8f, - 0xc7, 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1c, - - /* U+69 "i" */ - 0x1c, 0x7, 0x0, 0x0, 0x0, 0xfc, 0x3f, 0x1, - 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0x1c, - 0x3f, 0xff, 0xfc, - - /* U+6A "j" */ - 0x7, 0x7, 0x0, 0x0, 0x7f, 0x7f, 0x7, 0x7, - 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0xf, - 0xfe, 0xfc, - - /* U+6B "k" */ - 0xe0, 0x38, 0xe, 0x3, 0x87, 0xe1, 0xb8, 0xee, - 0x33, 0x9c, 0xfe, 0x3f, 0x8e, 0x73, 0x8e, 0xe3, - 0xb8, 0x70, - - /* U+6C "l" */ - 0xfe, 0x1f, 0xc0, 0x38, 0x7, 0x0, 0xe0, 0x1c, - 0x3, 0x80, 0x70, 0xe, 0x1, 0xc0, 0x38, 0x7, - 0x0, 0xfe, 0xf, 0xc0, - - /* U+6D "m" */ - 0xd9, 0xbf, 0xfc, 0xcf, 0x33, 0xcc, 0xf3, 0x3c, - 0xcf, 0x33, 0xcc, 0xf3, 0x3c, 0xcc, - - /* U+6E "n" */ - 0xee, 0x7f, 0xbc, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, - 0xc7, 0xe3, 0xf1, 0xf8, 0xe0, - - /* U+6F "o" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0x87, 0xf3, 0xdf, 0xe3, 0xf0, - - /* U+70 "p" */ - 0xef, 0x3f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0x87, 0xf3, 0xff, 0xee, 0xf3, 0x80, 0xe0, - 0x38, 0x0, - - /* U+71 "q" */ - 0x3d, 0xdf, 0xff, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0x87, 0xf3, 0xdf, 0xf3, 0xdc, 0x7, 0x1, - 0xc0, 0x70, - - /* U+72 "r" */ - 0xef, 0x3f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0xe, - 0x3, 0x80, 0xe0, 0x38, 0xe, 0x0, - - /* U+73 "s" */ - 0x3f, 0x3f, 0xee, 0x1f, 0x80, 0xfc, 0x1f, 0xe0, - 0x3c, 0x7, 0xe1, 0xff, 0xe3, 0xf0, - - /* U+74 "t" */ - 0x1c, 0x7, 0x1, 0xc3, 0xff, 0xff, 0xc7, 0x1, - 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0xf, - 0xc1, 0xf0, - - /* U+75 "u" */ - 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, - 0xc7, 0xe3, 0xbf, 0x8f, 0x80, - - /* U+76 "v" */ - 0xc0, 0xf8, 0x76, 0x19, 0x86, 0x73, 0x8c, 0xc3, - 0x30, 0xfc, 0x1e, 0x7, 0x81, 0xe0, - - /* U+77 "w" */ - 0xc6, 0x79, 0xcf, 0x39, 0xb5, 0x36, 0xa6, 0xd6, - 0xda, 0xdb, 0x4e, 0x79, 0xcf, 0x38, 0xc7, 0x0, - - /* U+78 "x" */ - 0xe1, 0xdc, 0xe3, 0x30, 0xfc, 0x1e, 0x7, 0x81, - 0xe0, 0xfc, 0x73, 0x9c, 0x6e, 0x1c, - - /* U+79 "y" */ - 0xe1, 0xf8, 0x76, 0x19, 0xce, 0x33, 0x8e, 0xc3, - 0xf0, 0x7c, 0x1e, 0x3, 0x80, 0xc0, 0x70, 0x1c, - 0x6, 0x0, - - /* U+7A "z" */ - 0xff, 0xff, 0xc1, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, - 0xe0, 0xe0, 0x7f, 0xff, 0xe0, - - /* U+7B "{" */ - 0x7, 0x87, 0xc3, 0x81, 0xc0, 0xe0, 0x70, 0x38, - 0x1c, 0xfc, 0x7e, 0x3, 0x81, 0xc0, 0xe0, 0x70, - 0x38, 0x1c, 0xf, 0x83, 0xc0, - - /* U+7C "|" */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, - - /* U+7D "}" */ - 0xf0, 0x3f, 0x1, 0xc0, 0x70, 0x1c, 0x7, 0x1, - 0xc0, 0x70, 0xf, 0xc3, 0xf1, 0xc0, 0x70, 0x1c, - 0x7, 0x1, 0xc0, 0x70, 0xf8, 0x3c, 0x0, - - /* U+7E "~" */ - 0x78, 0xff, 0x3c, 0xff, 0x1e, - - /* U+F001 "" */ - 0x0, 0x0, 0x70, 0x0, 0x7f, 0x0, 0x3f, 0xf0, - 0x1f, 0xff, 0x7, 0xff, 0xf0, 0x7f, 0xff, 0x7, - 0xfc, 0x70, 0x7e, 0x7, 0x7, 0x0, 0x70, 0x70, - 0x7, 0x7, 0x0, 0x70, 0x70, 0x7, 0x7, 0x0, - 0x70, 0x70, 0x7f, 0x7, 0xf, 0xf7, 0xf0, 0xff, - 0xff, 0x7, 0xef, 0xf0, 0x0, 0xff, 0x0, 0x3, - 0xc0, 0x0, - - /* U+F017 "" */ - 0x3, 0xf8, 0x1, 0xff, 0xc0, 0x7f, 0xfc, 0x1f, - 0xff, 0xc7, 0xf1, 0xfc, 0xfe, 0x3f, 0x9f, 0xc7, - 0xf7, 0xf8, 0xff, 0xff, 0x1f, 0xff, 0xe3, 0xff, - 0xfc, 0x3f, 0xff, 0x83, 0xff, 0xfc, 0x7e, 0xff, - 0xcf, 0x9f, 0xff, 0xf1, 0xff, 0xfc, 0x1f, 0xff, - 0x1, 0xff, 0xc0, 0x1f, 0xf0, 0x0, 0x70, 0x0, - - /* U+F03A "" */ - 0xf0, 0x0, 0xf, 0x3f, 0xff, 0xf3, 0xff, 0xff, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0xf, 0x0, 0x0, 0xf3, 0xff, 0xff, 0x3f, - 0xff, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0xf, 0x0, 0x0, 0xf3, 0xff, 0xff, 0x3f, 0xff, - 0xf0, 0x0, 0x0, - - /* U+F069 "" */ - 0x0, 0xe0, 0x0, 0x1c, 0x0, 0x3, 0x80, 0x0, - 0x70, 0x6, 0xe, 0xc, 0xf1, 0xc7, 0x9f, 0xbb, - 0xf1, 0xff, 0xfc, 0xf, 0xfe, 0x0, 0x7f, 0x0, - 0xf, 0xe0, 0x7, 0xff, 0x3, 0xff, 0xf8, 0xfd, - 0xdf, 0x9e, 0x38, 0xf3, 0x7, 0x6, 0x0, 0xe0, - 0x0, 0x1c, 0x0, 0x3, 0x80, 0x0, 0x70, 0x0, - - /* U+F129 "" */ - 0x3c, 0x7e, 0x7e, 0x7e, 0x3c, 0x0, 0x0, 0xfc, - 0xfc, 0xfc, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, - 0xff, 0xff, 0xff, - - /* U+F185 "" */ - 0x0, 0x60, 0x0, 0x6, 0x0, 0x0, 0xf0, 0x1, - 0xcf, 0x38, 0x1f, 0xff, 0x81, 0xf0, 0xf8, 0xc, - 0xf3, 0x1, 0xdf, 0xb8, 0x7b, 0xfd, 0xef, 0xbf, - 0xdf, 0x7b, 0xfd, 0xe1, 0x9f, 0x98, 0xc, 0xf3, - 0x0, 0xc0, 0x30, 0x1f, 0xf, 0x81, 0xff, 0xf8, - 0x1c, 0xf3, 0x80, 0xf, 0x0, 0x0, 0x60, 0x0, - 0x6, 0x0, - - /* U+F1E6 "" */ - 0x18, 0x30, 0x70, 0x70, 0xe0, 0xe1, 0xc1, 0xc3, - 0x83, 0x80, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x7f, - 0xfc, 0xff, 0xf9, 0xff, 0xf1, 0xff, 0xc3, 0xff, - 0x83, 0xfe, 0x3, 0xf8, 0x1, 0xc0, 0x3, 0x80, - 0x7, 0x0, 0xe, 0x0, - - /* U+F1FC "" */ - 0x0, 0x0, 0xf0, 0x0, 0x1f, 0x0, 0x3, 0xf0, - 0x0, 0x7e, 0x0, 0xf, 0xe0, 0x3, 0xfc, 0x0, - 0x7f, 0xc0, 0xf, 0xf8, 0x0, 0xff, 0x80, 0x1f, - 0xf0, 0x0, 0xfe, 0x0, 0xf, 0xe0, 0xe, 0x7c, - 0x1, 0xf8, 0x0, 0x9f, 0xc0, 0xf, 0xfc, 0x0, - 0x7f, 0xc0, 0x7, 0xf8, 0x0, 0x1f, 0x0, 0x0, - - /* U+F21E "" */ - 0x1e, 0x7, 0x83, 0xf9, 0xfe, 0x7f, 0xff, 0xef, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xfc, - 0xf7, 0xf7, 0xd6, 0x3e, 0x79, 0x6b, 0xe0, 0x34, - 0x80, 0x1f, 0x9f, 0x80, 0xf9, 0xf0, 0x7, 0xfe, - 0x0, 0x3f, 0xc0, 0x1, 0xf8, 0x0, 0xf, 0x0, - 0x0, 0x60, 0x0, - - /* U+F240 "" */ - 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, - 0x1, 0xfd, 0xff, 0xfe, 0xfe, 0xff, 0xff, 0x7f, - 0x7f, 0xff, 0x9f, 0xbf, 0xff, 0xcf, 0xdf, 0xff, - 0xe7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, - 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, - - /* U+F241 "" */ - 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, - 0x1, 0xfd, 0xff, 0xe0, 0xfe, 0xff, 0xf0, 0x7f, - 0x7f, 0xf8, 0x1f, 0xbf, 0xfc, 0xf, 0xdf, 0xfe, - 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, - 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, - - /* U+F242 "" */ - 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, - 0x1, 0xfd, 0xfe, 0x0, 0xfe, 0xff, 0x0, 0x7f, - 0x7f, 0x80, 0x1f, 0xbf, 0xc0, 0xf, 0xdf, 0xe0, - 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, - 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, - - /* U+F243 "" */ - 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, - 0x1, 0xfd, 0xf0, 0x0, 0xfe, 0xf8, 0x0, 0x7f, - 0x7c, 0x0, 0x1f, 0xbe, 0x0, 0xf, 0xdf, 0x0, - 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, - 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, - - /* U+F244 "" */ - 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, - 0x1, 0xfc, 0x0, 0x0, 0xfe, 0x0, 0x0, 0x7f, - 0x0, 0x0, 0x1f, 0x80, 0x0, 0xf, 0xc0, 0x0, - 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, - 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, - - /* U+F293 "" */ - 0x7, 0xe0, 0x3f, 0xe0, 0xfb, 0xe3, 0xf3, 0xe7, - 0xe3, 0xdf, 0xd3, 0xf9, 0xb3, 0xf9, 0x4f, 0xf8, - 0x3f, 0xf8, 0xff, 0xf1, 0xff, 0xc1, 0xff, 0x29, - 0xfc, 0xd9, 0xff, 0xa7, 0xbf, 0x1e, 0x7e, 0x7c, - 0x7d, 0xf0, 0x7f, 0xe0, 0x7f, 0x0, - - /* U+F294 "" */ - 0x0, 0x0, 0x80, 0x18, 0x3, 0x80, 0x78, 0x8d, - 0xb9, 0x9b, 0xb6, 0x3f, 0x83, 0xe0, 0x38, 0x7, - 0x81, 0xf8, 0x6d, 0x99, 0x9a, 0x36, 0x7, 0x80, - 0xe0, 0x18, 0x2, 0x0, 0x0, - - /* U+F3FD "" */ - 0x0, 0xfe, 0x0, 0x7, 0xff, 0x0, 0x3f, 0xbf, - 0x80, 0xfe, 0x2f, 0x83, 0xfe, 0xcf, 0x8f, 0x3f, - 0x27, 0x9e, 0x7e, 0x4f, 0x3f, 0xfc, 0xfe, 0xff, - 0xf3, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xcf, 0xff, - 0xfe, 0x3f, 0xfe, 0x78, 0x3c, 0xff, 0xf0, 0x7f, - 0xdf, 0xe0, 0xff, 0x3f, 0xff, 0xfe, 0x3f, 0xff, - 0xf8, - - /* U+F54B "" */ - 0x0, 0xf, 0xf8, 0x1, 0xdf, 0xff, 0x1, 0xef, - 0xff, 0xc0, 0xf7, 0xff, 0xf0, 0x7b, 0xff, 0xf8, - 0x1d, 0xff, 0xfc, 0x0, 0x1f, 0xfc, 0x0, 0x3, - 0xfc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x7, 0xf8, 0x0, 0xf, 0xfe, - 0x3, 0xbf, 0xff, 0x83, 0xdf, 0xff, 0xc1, 0xef, - 0xff, 0xe0, 0xf7, 0xff, 0xe0, 0x3b, 0xff, 0xe0, - 0x0, 0x7f, 0xc0, 0x0, - - /* U+F560 "" */ - 0x0, 0x0, 0x0, 0x0, 0x60, 0x0, 0xf, 0x0, - 0x1, 0xf0, 0x8, 0x3e, 0x1, 0xc7, 0xc4, 0x1e, - 0xf8, 0xe1, 0xff, 0x1f, 0xf, 0xe3, 0xf0, 0x7c, - 0x7e, 0x23, 0x8f, 0xc7, 0x11, 0xf8, 0xf8, 0x3f, - 0xf, 0xc7, 0xe0, 0x7e, 0xfc, 0x3, 0xff, 0x80, - 0x1f, 0xf0, 0x0, 0xfe, 0x0, 0x7, 0xc0, 0x0, - 0x38, 0x0, 0x1, 0x0, 0x0 -}; - - -/*--------------------- - * GLYPH DESCRIPTION - *--------------------*/ - -static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { - {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, - {.bitmap_index = 0, .adv_w = 192, .box_w = 1, .box_h = 1, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 1, .adv_w = 192, .box_w = 3, .box_h = 14, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 7, .adv_w = 192, .box_w = 7, .box_h = 6, .ofs_x = 3, .ofs_y = 8}, - {.bitmap_index = 13, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 33, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 57, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 77, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 97, .adv_w = 192, .box_w = 3, .box_h = 6, .ofs_x = 5, .ofs_y = 8}, - {.bitmap_index = 100, .adv_w = 192, .box_w = 7, .box_h = 19, .ofs_x = 3, .ofs_y = -2}, - {.bitmap_index = 117, .adv_w = 192, .box_w = 7, .box_h = 19, .ofs_x = 2, .ofs_y = -2}, - {.bitmap_index = 134, .adv_w = 192, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 1}, - {.bitmap_index = 147, .adv_w = 192, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = 2}, - {.bitmap_index = 159, .adv_w = 192, .box_w = 5, .box_h = 6, .ofs_x = 3, .ofs_y = -3}, - {.bitmap_index = 163, .adv_w = 192, .box_w = 8, .box_h = 2, .ofs_x = 2, .ofs_y = 5}, - {.bitmap_index = 165, .adv_w = 192, .box_w = 4, .box_h = 4, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 167, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 191, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 209, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 225, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 243, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 261, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 277, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 293, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 311, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 329, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 347, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 365, .adv_w = 192, .box_w = 3, .box_h = 11, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 370, .adv_w = 192, .box_w = 5, .box_h = 14, .ofs_x = 3, .ofs_y = -3}, - {.bitmap_index = 379, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 1}, - {.bitmap_index = 392, .adv_w = 192, .box_w = 9, .box_h = 7, .ofs_x = 2, .ofs_y = 3}, - {.bitmap_index = 400, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 1}, - {.bitmap_index = 413, .adv_w = 192, .box_w = 8, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 427, .adv_w = 192, .box_w = 11, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 451, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 472, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 490, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 508, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 526, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 542, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 558, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 576, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 592, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 608, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 626, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 646, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 662, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 680, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 696, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 714, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 732, .adv_w = 192, .box_w = 10, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 754, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 772, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 790, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 808, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 824, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 845, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 865, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 883, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 903, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 919, .adv_w = 192, .box_w = 6, .box_h = 18, .ofs_x = 4, .ofs_y = -2}, - {.bitmap_index = 933, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 957, .adv_w = 192, .box_w = 6, .box_h = 18, .ofs_x = 3, .ofs_y = -2}, - {.bitmap_index = 971, .adv_w = 192, .box_w = 10, .box_h = 8, .ofs_x = 1, .ofs_y = 6}, - {.bitmap_index = 981, .adv_w = 192, .box_w = 10, .box_h = 2, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 984, .adv_w = 192, .box_w = 5, .box_h = 3, .ofs_x = 3, .ofs_y = 13}, - {.bitmap_index = 986, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1000, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1018, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1032, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1050, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1064, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1082, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 1100, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1116, .adv_w = 192, .box_w = 10, .box_h = 15, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1135, .adv_w = 192, .box_w = 8, .box_h = 18, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 1153, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1171, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 1191, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1205, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1218, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1232, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 1250, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 1268, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1282, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1296, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1314, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1327, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1341, .adv_w = 192, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 1357, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1371, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 1389, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1402, .adv_w = 192, .box_w = 9, .box_h = 18, .ofs_x = 2, .ofs_y = -2}, - {.bitmap_index = 1423, .adv_w = 192, .box_w = 3, .box_h = 18, .ofs_x = 5, .ofs_y = -2}, - {.bitmap_index = 1430, .adv_w = 192, .box_w = 10, .box_h = 18, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 1453, .adv_w = 192, .box_w = 10, .box_h = 4, .ofs_x = 1, .ofs_y = 5}, - {.bitmap_index = 1458, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 1508, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 1556, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 1599, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 1647, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 1666, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 1716, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 1752, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 1800, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 1843, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 1881, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 1919, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 1957, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 1995, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 2033, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 2071, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 2100, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2149, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 2209, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3} -}; - -/*--------------------- - * CHARACTER MAPPING - *--------------------*/ - -static const uint16_t unicode_list_1[] = { - 0x0, 0x16, 0x39, 0x68, 0x128, 0x184, 0x1e5, 0x1fb, - 0x21d, 0x23f, 0x240, 0x241, 0x242, 0x243, 0x292, 0x293, - 0x3fc, 0x54a, 0x55f -}; - -/*Collect the unicode lists and glyph_id offsets*/ -static const lv_font_fmt_txt_cmap_t cmaps[] = -{ - { - .range_start = 32, .range_length = 95, .glyph_id_start = 1, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - }, - { - .range_start = 61441, .range_length = 1376, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 19, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY - } -}; - - - -/*-------------------- - * ALL CUSTOM DATA - *--------------------*/ - -/*Store all the custom data of the font*/ -static lv_font_fmt_txt_dsc_t font_dsc = { - .glyph_bitmap = gylph_bitmap, - .glyph_dsc = glyph_dsc, - .cmaps = cmaps, - .kern_dsc = NULL, - .kern_scale = 0, - .cmap_num = 2, - .bpp = 1, - .kern_classes = 0, - .bitmap_format = 0 -}; - - -/*----------------- - * PUBLIC FONT - *----------------*/ - -/*Initialize a public general font descriptor*/ -lv_font_t jetbrains_mono_bold_20 = { - .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ - .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ - .line_height = 21, /*The maximum line height required by the font*/ - .base_line = 3, /*Baseline measured from the bottom of the line*/ -#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) - .subpx = LV_FONT_SUBPX_NONE, -#endif - .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ -}; - -#endif /*#if JETBRAINS_MONO_BOLD_20*/ - diff --git a/src/DisplayApp/Fonts/jetbrains_mono_extrabold_compressed.c b/src/DisplayApp/Fonts/jetbrains_mono_extrabold_compressed.c deleted file mode 100644 index c9917e4..0000000 --- a/src/DisplayApp/Fonts/jetbrains_mono_extrabold_compressed.c +++ /dev/null @@ -1,507 +0,0 @@ -#include "lvgl/lvgl.h" - -/******************************************************************************* - * Size: 80 px - * Bpp: 1 - * Opts: - ******************************************************************************/ - -#ifndef JETBRAINS_MONO_EXTRABOLD_COMPRESSED -#define JETBRAINS_MONO_EXTRABOLD_COMPRESSED 1 -#endif - -#if JETBRAINS_MONO_EXTRABOLD_COMPRESSED - -/*----------------- - * BITMAPS - *----------------*/ - -/*Store the image of the glyphs*/ -static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { - /* U+30 "0" */ - 0x0, 0x1, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, - 0xfe, 0x0, 0x0, 0x1f, 0xff, 0xff, 0xc0, 0x0, - 0x3f, 0xff, 0xff, 0xf8, 0x0, 0x3f, 0xff, 0xff, - 0xfe, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x80, 0x3f, - 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, - 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, - 0xff, 0xff, 0xff, 0x1f, 0xff, 0xe0, 0x3f, 0xff, - 0xcf, 0xff, 0xc0, 0x7, 0xff, 0xe7, 0xff, 0xc0, - 0x1, 0xff, 0xf7, 0xff, 0xc0, 0x0, 0x7f, 0xff, - 0xff, 0xe0, 0x0, 0x3f, 0xff, 0xff, 0xe0, 0x0, - 0xf, 0xff, 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, - 0xf8, 0x0, 0x3, 0xff, 0xff, 0xfc, 0x0, 0x1, - 0xff, 0xff, 0xfe, 0x0, 0x0, 0xff, 0xff, 0xff, - 0x0, 0x0, 0x7f, 0xff, 0xff, 0x80, 0x0, 0x3f, - 0xff, 0xff, 0xc0, 0x70, 0x1f, 0xff, 0xff, 0xe0, - 0x7c, 0xf, 0xff, 0xff, 0xf0, 0x7f, 0x7, 0xff, - 0xff, 0xf8, 0x3f, 0x83, 0xff, 0xff, 0xfc, 0x1f, - 0xc1, 0xff, 0xff, 0xfe, 0xf, 0xe0, 0xff, 0xff, - 0xff, 0x7, 0xf0, 0x7f, 0xff, 0xff, 0x83, 0xf8, - 0x3f, 0xff, 0xff, 0xc1, 0xfc, 0x1f, 0xff, 0xff, - 0xe0, 0xfe, 0xf, 0xff, 0xff, 0xf0, 0x7f, 0x7, - 0xff, 0xff, 0xf8, 0x3f, 0x83, 0xff, 0xff, 0xfc, - 0x1f, 0xc1, 0xff, 0xff, 0xfe, 0xf, 0xe0, 0xff, - 0xff, 0xff, 0x3, 0xe0, 0x7f, 0xff, 0xff, 0x80, - 0xe0, 0x3f, 0xff, 0xff, 0xc0, 0x0, 0x1f, 0xff, - 0xff, 0xe0, 0x0, 0xf, 0xff, 0xff, 0xf0, 0x0, - 0x7, 0xff, 0xff, 0xf8, 0x0, 0x3, 0xff, 0xff, - 0xfc, 0x0, 0x1, 0xff, 0xff, 0xfe, 0x0, 0x0, - 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, - 0xc0, 0x0, 0x7f, 0xf9, 0xff, 0xf0, 0x0, 0x7f, - 0xfc, 0xff, 0xfc, 0x0, 0x7f, 0xfe, 0x7f, 0xff, - 0x80, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, - 0x7, 0xff, 0xff, 0xff, 0xff, 0x3, 0xff, 0xff, - 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0x80, - 0x3f, 0xff, 0xff, 0xff, 0x80, 0xf, 0xff, 0xff, - 0xff, 0x80, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, - 0x7f, 0xff, 0xff, 0x0, 0x0, 0xf, 0xff, 0xfc, - 0x0, 0x0, 0x0, 0x7f, 0xf0, 0x0, 0x0, - - /* U+31 "1" */ - 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0xf, 0xff, - 0xe0, 0x0, 0x0, 0x3f, 0xff, 0xe0, 0x0, 0x0, - 0x7f, 0xff, 0xe0, 0x0, 0x1, 0xff, 0xff, 0xe0, - 0x0, 0x3, 0xff, 0xff, 0xe0, 0x0, 0x7, 0xff, - 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xe0, 0x0, - 0x3f, 0xff, 0xff, 0xe0, 0x0, 0x7f, 0xff, 0xff, - 0xe0, 0x0, 0x7f, 0xff, 0xff, 0xe0, 0x0, 0x7f, - 0xfd, 0xff, 0xe0, 0x0, 0x7f, 0xf9, 0xff, 0xe0, - 0x0, 0x7f, 0xf1, 0xff, 0xe0, 0x0, 0x7f, 0xe1, - 0xff, 0xe0, 0x0, 0x7f, 0x81, 0xff, 0xe0, 0x0, - 0x7f, 0x1, 0xff, 0xe0, 0x0, 0x7c, 0x1, 0xff, - 0xe0, 0x0, 0x78, 0x1, 0xff, 0xe0, 0x0, 0x60, - 0x1, 0xff, 0xe0, 0x0, 0x40, 0x1, 0xff, 0xe0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, - 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, - 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, - 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, - 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, - 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, - 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, - 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, - 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, - 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, - 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, - - /* U+32 "2" */ - 0x0, 0x1, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, - 0xfc, 0x0, 0x0, 0x1f, 0xff, 0xff, 0x80, 0x0, - 0x3f, 0xff, 0xff, 0xf0, 0x0, 0x3f, 0xff, 0xff, - 0xfc, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x0, 0x3f, - 0xff, 0xff, 0xff, 0xc0, 0x3f, 0xff, 0xff, 0xff, - 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, - 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xe0, 0x7f, 0xff, - 0x8f, 0xff, 0xc0, 0xf, 0xff, 0xc7, 0xff, 0xc0, - 0x3, 0xff, 0xe7, 0xff, 0xc0, 0x0, 0xff, 0xfb, - 0xff, 0xc0, 0x0, 0x7f, 0xfd, 0xff, 0xe0, 0x0, - 0x1f, 0xfe, 0xff, 0xf0, 0x0, 0xf, 0xff, 0x0, - 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, - 0xff, 0xc0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, - 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, - 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x0, 0x3f, 0xfe, - 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, - 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, - 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, - 0xff, 0x80, 0x0, 0x0, 0x7f, 0xff, 0x80, 0x0, - 0x0, 0x7f, 0xff, 0x80, 0x0, 0x0, 0x7f, 0xff, - 0x80, 0x0, 0x0, 0x7f, 0xff, 0x80, 0x0, 0x0, - 0xff, 0xff, 0x80, 0x0, 0x0, 0xff, 0xff, 0x80, - 0x0, 0x0, 0xff, 0xff, 0x80, 0x0, 0x0, 0xff, - 0xff, 0x80, 0x0, 0x1, 0xff, 0xff, 0x0, 0x0, - 0x1, 0xff, 0xff, 0x0, 0x0, 0x1, 0xff, 0xff, - 0x0, 0x0, 0x1, 0xff, 0xfe, 0x0, 0x0, 0x3, - 0xff, 0xfe, 0x0, 0x0, 0x3, 0xff, 0xfe, 0x0, - 0x0, 0x3, 0xff, 0xfc, 0x0, 0x0, 0x3, 0xff, - 0xfc, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, - 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, - 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0xdf, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, - 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xfb, - 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, - 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, - 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, - 0xff, 0xc0, - - /* U+33 "3" */ - 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, 0xff, 0xff, - 0xff, 0xff, 0x7, 0xff, 0xff, 0xff, 0xff, 0x83, - 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, - 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x7f, - 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, - 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, 0xff, - 0xff, 0x8f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, - 0x80, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, - 0x1f, 0xff, 0x80, 0x0, 0x0, 0x3f, 0xff, 0x80, - 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, - 0xff, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, - 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfe, - 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, - 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, - 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, 0xf, - 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, 0xff, 0x0, - 0x0, 0x3, 0xff, 0xff, 0xe0, 0x0, 0x1, 0xff, - 0xff, 0xf8, 0x0, 0x0, 0xff, 0xff, 0xfe, 0x0, - 0x0, 0x7f, 0xff, 0xff, 0x80, 0x0, 0x3f, 0xff, - 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf0, 0x0, - 0xf, 0xff, 0xff, 0xfc, 0x0, 0x0, 0x0, 0xff, - 0xfe, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, - 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x1, 0xff, - 0xe0, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, - 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, 0xfe, - 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, - 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, - 0x0, 0x0, 0x1, 0xff, 0xff, 0xfe, 0x0, 0x0, - 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, - 0xc0, 0x0, 0x7f, 0xf9, 0xff, 0xf0, 0x0, 0x7f, - 0xfc, 0xff, 0xfc, 0x0, 0x7f, 0xfe, 0x7f, 0xff, - 0x80, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, - 0xf, 0xff, 0xff, 0xff, 0xff, 0x3, 0xff, 0xff, - 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0x80, - 0x3f, 0xff, 0xff, 0xff, 0x80, 0xf, 0xff, 0xff, - 0xff, 0x80, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, - 0x7f, 0xff, 0xff, 0x0, 0x0, 0xf, 0xff, 0xfc, - 0x0, 0x0, 0x0, 0x7f, 0xf0, 0x0, 0x0, - - /* U+34 "4" */ - 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, 0x1f, - 0xff, 0x80, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, - 0x3, 0xff, 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x80, - 0x0, 0x0, 0xff, 0xfc, 0x0, 0x0, 0x3, 0xff, - 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, - 0xff, 0xfc, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, - 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xff, 0xfc, - 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3f, - 0xff, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, - 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3f, 0xff, 0x0, - 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, - 0xc0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x1, - 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, - 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x1, 0xff, 0xf8, - 0x0, 0x0, 0xf, 0xff, 0xc0, 0x0, 0x0, 0x3f, - 0xfe, 0x0, 0xff, 0xf1, 0xff, 0xf0, 0x3, 0xff, - 0xcf, 0xff, 0xc0, 0xf, 0xff, 0x7f, 0xfe, 0x0, - 0x3f, 0xfd, 0xff, 0xf0, 0x0, 0xff, 0xff, 0xff, - 0xc0, 0x3, 0xff, 0xff, 0xfe, 0x0, 0xf, 0xff, - 0xff, 0xf0, 0x0, 0x3f, 0xff, 0xff, 0x80, 0x0, - 0xff, 0xff, 0xfe, 0x0, 0x3, 0xff, 0xff, 0xf8, - 0x0, 0xf, 0xff, 0xff, 0xe0, 0x0, 0x3f, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, - 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, - 0xfc, 0x0, 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, - 0x3, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, 0x0, - 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0xff, - 0xf0, 0x0, 0x0, 0x3, 0xff, 0xc0, 0x0, 0x0, - 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, - 0x0, 0x0, 0xff, 0xf0, - - /* U+35 "5" */ - 0x3f, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, - 0xff, 0xff, 0xf, 0xff, 0xff, 0xff, 0xff, 0x87, - 0xff, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, - 0xff, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, - 0xff, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff, 0xff, - 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, - 0xff, 0xff, 0xff, 0xf, 0xff, 0x0, 0x0, 0x0, - 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x0, - 0xff, 0xf0, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, - 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, - 0xfe, 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, - 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, - 0xc0, 0x7f, 0x80, 0x1, 0xff, 0xe1, 0xff, 0xf8, - 0x0, 0xff, 0xf1, 0xff, 0xff, 0x0, 0x7f, 0xf9, - 0xff, 0xff, 0xc0, 0x3f, 0xfd, 0xff, 0xff, 0xf0, - 0x1f, 0xff, 0xff, 0xff, 0xfc, 0xf, 0xff, 0xff, - 0xff, 0xff, 0x7, 0xff, 0xff, 0xff, 0xff, 0xc3, - 0xff, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xfc, 0x7, - 0xff, 0xf8, 0xff, 0xf8, 0x0, 0xff, 0xfc, 0x0, - 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0xf, - 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x0, 0xff, - 0xf0, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, - 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, 0xfe, - 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, - 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, - 0x0, 0x0, 0x1, 0xff, 0xff, 0xff, 0x0, 0x1, - 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xfb, 0xff, - 0xe0, 0x0, 0xff, 0xf9, 0xff, 0xf8, 0x0, 0xff, - 0xfc, 0xff, 0xff, 0x81, 0xff, 0xfe, 0x3f, 0xff, - 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, - 0x7, 0xff, 0xff, 0xff, 0xff, 0x1, 0xff, 0xff, - 0xff, 0xff, 0x0, 0x7f, 0xff, 0xff, 0xff, 0x0, - 0x1f, 0xff, 0xff, 0xff, 0x0, 0x7, 0xff, 0xff, - 0xff, 0x0, 0x0, 0xff, 0xff, 0xfe, 0x0, 0x0, - 0x1f, 0xff, 0xfc, 0x0, 0x0, 0x0, 0xff, 0xe0, - 0x0, 0x0, - - /* U+36 "6" */ - 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, - 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, - 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, - 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, - 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, - 0xc0, 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, - 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, - 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, - 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, - 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, 0x1, - 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, - 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0xf, - 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, - 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x0, 0xff, - 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x3f, 0xc0, - 0x0, 0x1f, 0xfe, 0x3f, 0xfe, 0x0, 0xf, 0xff, - 0xbf, 0xff, 0xe0, 0x3, 0xff, 0xdf, 0xff, 0xfc, - 0x1, 0xff, 0xef, 0xff, 0xff, 0x80, 0x7f, 0xff, - 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xfe, - 0xf, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, - 0xff, 0xff, 0xf1, 0xff, 0xff, 0x3, 0xff, 0xfc, - 0x7f, 0xff, 0x0, 0x3f, 0xff, 0x9f, 0xff, 0x0, - 0x3, 0xff, 0xef, 0xff, 0xc0, 0x0, 0xff, 0xfb, - 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf8, 0x0, - 0x7, 0xff, 0xff, 0xfc, 0x0, 0x0, 0xff, 0xff, - 0xff, 0x0, 0x0, 0x3f, 0xff, 0xff, 0xc0, 0x0, - 0xf, 0xff, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, - 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, - 0x3f, 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0x7f, - 0xf8, 0x0, 0x7, 0xff, 0xdf, 0xfe, 0x0, 0x3, - 0xff, 0xe7, 0xff, 0xc0, 0x0, 0xff, 0xf9, 0xff, - 0xfc, 0x0, 0xff, 0xfe, 0x3f, 0xff, 0xc0, 0xff, - 0xff, 0xf, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, - 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, - 0xf0, 0x7, 0xff, 0xff, 0xff, 0xf8, 0x0, 0xff, - 0xff, 0xff, 0xfe, 0x0, 0x1f, 0xff, 0xff, 0xfe, - 0x0, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, 0x3f, - 0xff, 0xff, 0x0, 0x0, 0x3, 0xff, 0xff, 0x0, - 0x0, 0x0, 0xf, 0xfc, 0x0, 0x0, - - /* U+37 "7" */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xe0, 0x0, 0xf, 0xff, 0xff, 0xe0, 0x0, 0x1f, - 0xfe, 0xff, 0xe0, 0x0, 0x1f, 0xfe, 0xff, 0xe0, - 0x0, 0x3f, 0xfc, 0xff, 0xe0, 0x0, 0x3f, 0xfc, - 0xff, 0xe0, 0x0, 0x7f, 0xf8, 0xff, 0xe0, 0x0, - 0x7f, 0xf8, 0xff, 0xe0, 0x0, 0xff, 0xf8, 0xff, - 0xe0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x1, 0xff, - 0xf0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, - 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, 0xc0, - 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x7, - 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, - 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, - 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, - 0x1f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, - 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x7f, - 0xfc, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, - 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, 0xf8, - 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, 0x1, - 0xff, 0xf0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, - 0xc0, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, - 0x7, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, 0x80, - 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x1f, - 0xff, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, - 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfe, - 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x0, - 0x7f, 0xfc, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, - 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, - 0xf8, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, - 0x1, 0xff, 0xf0, 0x0, 0x0, 0x3, 0xff, 0xe0, - 0x0, 0x0, - - /* U+38 "8" */ - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x7, 0xff, - 0xff, 0x80, 0x0, 0x7, 0xff, 0xff, 0xf8, 0x0, - 0x7, 0xff, 0xff, 0xff, 0x80, 0x3, 0xff, 0xff, - 0xff, 0xf0, 0x1, 0xff, 0xff, 0xff, 0xfe, 0x0, - 0xff, 0xff, 0xff, 0xff, 0xc0, 0x7f, 0xff, 0xff, - 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, - 0xff, 0xe0, 0x3f, 0xff, 0xc3, 0xff, 0xe0, 0x3, - 0xff, 0xf0, 0xff, 0xf0, 0x0, 0x7f, 0xfc, 0x7f, - 0xf8, 0x0, 0xf, 0xff, 0x9f, 0xfe, 0x0, 0x3, - 0xff, 0xe7, 0xff, 0x0, 0x0, 0x7f, 0xf9, 0xff, - 0xc0, 0x0, 0x1f, 0xfe, 0x7f, 0xf0, 0x0, 0x7, - 0xff, 0x9f, 0xfc, 0x0, 0x1, 0xff, 0xe7, 0xff, - 0x0, 0x0, 0x7f, 0xf9, 0xff, 0xc0, 0x0, 0x1f, - 0xfe, 0x3f, 0xf8, 0x0, 0xf, 0xff, 0xf, 0xfe, - 0x0, 0x3, 0xff, 0xc3, 0xff, 0xc0, 0x1, 0xff, - 0xe0, 0x7f, 0xf8, 0x0, 0xff, 0xf8, 0xf, 0xff, - 0x80, 0xff, 0xfc, 0x1, 0xff, 0xff, 0xff, 0xfe, - 0x0, 0x3f, 0xff, 0xff, 0xff, 0x0, 0x7, 0xff, - 0xff, 0xff, 0x0, 0x0, 0x7f, 0xff, 0xff, 0x0, - 0x0, 0x3, 0xff, 0xfe, 0x0, 0x0, 0x7, 0xff, - 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, 0xff, 0x80, - 0x7, 0xff, 0xff, 0xff, 0xf0, 0x3, 0xff, 0xff, - 0xff, 0xff, 0x1, 0xff, 0xf8, 0xf, 0xff, 0xe0, - 0xff, 0xf8, 0x0, 0x7f, 0xf8, 0x3f, 0xfc, 0x0, - 0xf, 0xff, 0x1f, 0xfe, 0x0, 0x1, 0xff, 0xe7, - 0xff, 0x80, 0x0, 0x7f, 0xfb, 0xff, 0xc0, 0x0, - 0xf, 0xfe, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, - 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, - 0x3f, 0xff, 0xff, 0xc0, 0x0, 0xf, 0xff, 0xff, - 0xf0, 0x0, 0x3, 0xff, 0xff, 0xfe, 0x0, 0x1, - 0xff, 0xff, 0xff, 0x80, 0x0, 0x7f, 0xff, 0xff, - 0xf0, 0x0, 0x3f, 0xff, 0x7f, 0xfe, 0x0, 0x1f, - 0xff, 0x9f, 0xff, 0xe0, 0x3f, 0xff, 0xe3, 0xff, - 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0x3, 0xff, - 0xff, 0xff, 0xff, 0x0, 0x7f, 0xff, 0xff, 0xff, - 0x80, 0xf, 0xff, 0xff, 0xff, 0xc0, 0x1, 0xff, - 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xe0, - 0x0, 0x1, 0xff, 0xff, 0xe0, 0x0, 0x0, 0x7, - 0xff, 0x80, 0x0, - - /* U+39 "9" */ - 0x0, 0x0, 0xff, 0xc0, 0x0, 0x0, 0x3, 0xff, - 0xff, 0x0, 0x0, 0x3, 0xff, 0xff, 0xf0, 0x0, - 0x3, 0xff, 0xff, 0xff, 0x0, 0x1, 0xff, 0xff, - 0xff, 0xe0, 0x1, 0xff, 0xff, 0xff, 0xfc, 0x0, - 0x7f, 0xff, 0xff, 0xff, 0x80, 0x3f, 0xff, 0xff, - 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, - 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xfc, 0xf, - 0xff, 0xf1, 0xff, 0xf8, 0x0, 0xff, 0xfc, 0x7f, - 0xfc, 0x0, 0xf, 0xff, 0x9f, 0xff, 0x0, 0x3, - 0xff, 0xef, 0xff, 0x80, 0x0, 0x7f, 0xfb, 0xff, - 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf0, 0x0, 0x3, - 0xff, 0xff, 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, - 0x0, 0x0, 0x3f, 0xff, 0xff, 0xc0, 0x0, 0xf, - 0xff, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, 0xfc, - 0x0, 0x0, 0xff, 0xff, 0xff, 0x80, 0x0, 0x7f, - 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0x7f, 0xf8, - 0x0, 0xf, 0xff, 0xdf, 0xff, 0x0, 0x3, 0xff, - 0xe7, 0xff, 0xf0, 0x3, 0xff, 0xf8, 0xff, 0xff, - 0x3, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, - 0x87, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, - 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xf8, - 0x7, 0xff, 0xff, 0xdf, 0xfe, 0x0, 0xff, 0xff, - 0xef, 0xff, 0x80, 0x1f, 0xff, 0xf7, 0xff, 0xc0, - 0x1, 0xff, 0xf1, 0xff, 0xf0, 0x0, 0xf, 0xf0, - 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, - 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, - 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, - 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, - 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, - 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, - 0x80, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, - 0x1, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, - 0x0, 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, 0x0, - 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, 0x80, - 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3, - 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, - 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, 0x0, 0x3f, - 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, - 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, - - /* U+3A ":" */ - 0x7, 0xe0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, - 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, - 0x7f, 0xfe, 0x3f, 0xfc, 0x1f, 0xf8, 0x7, 0xe0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x7, 0xe0, 0x1f, 0xf8, - 0x3f, 0xfc, 0x7f, 0xfe, 0x7f, 0xfe, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x7f, 0xfe, 0x7f, 0xfe, 0x3f, 0xfc, - 0x1f, 0xf8, 0x7, 0xe0 -}; - - -/*--------------------- - * GLYPH DESCRIPTION - *--------------------*/ - -static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { - {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, - {.bitmap_index = 0, .adv_w = 768, .box_w = 41, .box_h = 59, .ofs_x = 4, .ofs_y = -1}, - {.bitmap_index = 303, .adv_w = 768, .box_w = 40, .box_h = 58, .ofs_x = 6, .ofs_y = 0}, - {.bitmap_index = 593, .adv_w = 768, .box_w = 41, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 891, .adv_w = 768, .box_w = 41, .box_h = 59, .ofs_x = 3, .ofs_y = -1}, - {.bitmap_index = 1194, .adv_w = 768, .box_w = 38, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 1470, .adv_w = 768, .box_w = 41, .box_h = 58, .ofs_x = 4, .ofs_y = -1}, - {.bitmap_index = 1768, .adv_w = 768, .box_w = 42, .box_h = 59, .ofs_x = 3, .ofs_y = -1}, - {.bitmap_index = 2078, .adv_w = 768, .box_w = 40, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 2368, .adv_w = 768, .box_w = 42, .box_h = 60, .ofs_x = 3, .ofs_y = -1}, - {.bitmap_index = 2683, .adv_w = 768, .box_w = 42, .box_h = 59, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 2993, .adv_w = 768, .box_w = 16, .box_h = 46, .ofs_x = 16, .ofs_y = -1} -}; - -/*--------------------- - * CHARACTER MAPPING - *--------------------*/ - - - -/*Collect the unicode lists and glyph_id offsets*/ -static const lv_font_fmt_txt_cmap_t cmaps[] = -{ - { - .range_start = 48, .range_length = 11, .glyph_id_start = 1, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - } -}; - - - -/*-------------------- - * ALL CUSTOM DATA - *--------------------*/ - -/*Store all the custom data of the font*/ -static lv_font_fmt_txt_dsc_t font_dsc = { - .glyph_bitmap = gylph_bitmap, - .glyph_dsc = glyph_dsc, - .cmaps = cmaps, - .kern_dsc = NULL, - .kern_scale = 0, - .cmap_num = 1, - .bpp = 1, - .kern_classes = 0, - .bitmap_format = 0 -}; - - -/*----------------- - * PUBLIC FONT - *----------------*/ - -/*Initialize a public general font descriptor*/ -lv_font_t jetbrains_mono_extrabold_compressed = { - .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ - .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ - .line_height = 60, /*The maximum line height required by the font*/ - .base_line = 1, /*Baseline measured from the bottom of the line*/ -#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) - .subpx = LV_FONT_SUBPX_NONE, -#endif - .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ -}; - -#endif /*#if JETBRAINS_MONO_EXTRABOLD_COMPRESSED*/ - diff --git a/src/DisplayApp/Icons/battery/os_battery_005.c b/src/DisplayApp/Icons/battery/os_battery_005.c deleted file mode 100644 index 64832b5..0000000 --- a/src/DisplayApp/Icons/battery/os_battery_005.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_005 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_005 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_005 uint8_t ck_os_battery_005_map[] = { - 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - - 0xfc, 0x00, 0x3f, - 0xf8, 0x00, 0x1f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, -}; - -const lv_img_dsc_t ck_os_battery_005 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_005_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_battery_005.png b/src/DisplayApp/Icons/battery/os_battery_005.png deleted file mode 100644 index 963767b..0000000 Binary files a/src/DisplayApp/Icons/battery/os_battery_005.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_battery_010.c b/src/DisplayApp/Icons/battery/os_battery_010.c deleted file mode 100644 index f36b684..0000000 --- a/src/DisplayApp/Icons/battery/os_battery_010.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_010 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_010 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_010 uint8_t ck_os_battery_010_map[] = { - 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - 0x04, 0x7a, 0xf4, 0xff, /*Color of index 2*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 3*/ - - 0x55, 0x5f, 0xff, 0xff, 0xf5, 0x55, 0x55, - 0x55, 0x7f, 0xff, 0xff, 0xfd, 0x55, 0x55, - 0x55, 0xff, 0xff, 0xff, 0xff, 0x55, 0x55, - 0x55, 0xff, 0xff, 0xff, 0xff, 0x55, 0x55, - 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, - 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, - 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, - 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xff, 0x55, 0x55, 0x6a, 0xaa, 0xaa, 0xa9, - 0xff, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x50, 0x05, 0xaa, 0xaa, 0xaa, 0xaa, - 0xff, 0x50, 0x05, 0xaa, 0xaa, 0xaa, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0xff, 0xf5, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0xff, 0xf5, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0xff, 0xf5, 0xaa, 0xaa, 0xaa, 0xaa, - 0xff, 0xff, 0xf5, 0x6a, 0xaa, 0xaa, 0xa9, -}; - -const lv_img_dsc_t ck_os_battery_010 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 240, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_battery_010_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_battery_010.png b/src/DisplayApp/Icons/battery/os_battery_010.png deleted file mode 100644 index 68a9f40..0000000 Binary files a/src/DisplayApp/Icons/battery/os_battery_010.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_battery_020.c b/src/DisplayApp/Icons/battery/os_battery_020.c deleted file mode 100644 index 3f648fb..0000000 --- a/src/DisplayApp/Icons/battery/os_battery_020.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_020 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_020 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_020 uint8_t ck_os_battery_020_map[] = { - 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, - 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, - 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, -}; - -const lv_img_dsc_t ck_os_battery_020 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 208, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_battery_020_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_battery_020.png b/src/DisplayApp/Icons/battery/os_battery_020.png deleted file mode 100644 index 32eca65..0000000 Binary files a/src/DisplayApp/Icons/battery/os_battery_020.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_battery_030.c b/src/DisplayApp/Icons/battery/os_battery_030.c deleted file mode 100644 index 4d5719b..0000000 --- a/src/DisplayApp/Icons/battery/os_battery_030.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_030 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_030 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_030 uint8_t ck_os_battery_030_map[] = { - 0x04, 0x7a, 0xf4, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, - 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, - 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, - 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, - 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, -}; - -const lv_img_dsc_t ck_os_battery_030 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 208, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_battery_030_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_battery_030.png b/src/DisplayApp/Icons/battery/os_battery_030.png deleted file mode 100644 index aeb5eb1..0000000 Binary files a/src/DisplayApp/Icons/battery/os_battery_030.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_battery_040.c b/src/DisplayApp/Icons/battery/os_battery_040.c deleted file mode 100644 index 0606fc3..0000000 --- a/src/DisplayApp/Icons/battery/os_battery_040.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_040 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_040 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_040 uint8_t ck_os_battery_040_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_battery_040 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_040_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_battery_040.png b/src/DisplayApp/Icons/battery/os_battery_040.png deleted file mode 100644 index d84fda4..0000000 Binary files a/src/DisplayApp/Icons/battery/os_battery_040.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_battery_050.c b/src/DisplayApp/Icons/battery/os_battery_050.c deleted file mode 100644 index 8732dc7..0000000 --- a/src/DisplayApp/Icons/battery/os_battery_050.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_050 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_050 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_050 uint8_t ck_os_battery_050_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_battery_050 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_050_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_battery_050.png b/src/DisplayApp/Icons/battery/os_battery_050.png deleted file mode 100644 index 224d38d..0000000 Binary files a/src/DisplayApp/Icons/battery/os_battery_050.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_battery_060.c b/src/DisplayApp/Icons/battery/os_battery_060.c deleted file mode 100644 index a65936b..0000000 --- a/src/DisplayApp/Icons/battery/os_battery_060.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_060 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_060 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_060 uint8_t ck_os_battery_060_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_battery_060 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_060_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_battery_060.png b/src/DisplayApp/Icons/battery/os_battery_060.png deleted file mode 100644 index e5e00ed..0000000 Binary files a/src/DisplayApp/Icons/battery/os_battery_060.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_battery_070.c b/src/DisplayApp/Icons/battery/os_battery_070.c deleted file mode 100644 index 949c0b8..0000000 --- a/src/DisplayApp/Icons/battery/os_battery_070.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_070 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_070 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_070 uint8_t ck_os_battery_070_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_battery_070 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_070_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_battery_070.png b/src/DisplayApp/Icons/battery/os_battery_070.png deleted file mode 100644 index dee969b..0000000 Binary files a/src/DisplayApp/Icons/battery/os_battery_070.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_battery_080.c b/src/DisplayApp/Icons/battery/os_battery_080.c deleted file mode 100644 index f447370..0000000 --- a/src/DisplayApp/Icons/battery/os_battery_080.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_080 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_080 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_080 uint8_t ck_os_battery_080_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_battery_080 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_080_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_battery_080.png b/src/DisplayApp/Icons/battery/os_battery_080.png deleted file mode 100644 index 3b13fbb..0000000 Binary files a/src/DisplayApp/Icons/battery/os_battery_080.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_battery_090.c b/src/DisplayApp/Icons/battery/os_battery_090.c deleted file mode 100644 index 6fa41b2..0000000 --- a/src/DisplayApp/Icons/battery/os_battery_090.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_090 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_090 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_090 uint8_t ck_os_battery_090_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_battery_090 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_090_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_battery_090.png b/src/DisplayApp/Icons/battery/os_battery_090.png deleted file mode 100644 index d79f396..0000000 Binary files a/src/DisplayApp/Icons/battery/os_battery_090.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_battery_100.c b/src/DisplayApp/Icons/battery/os_battery_100.c deleted file mode 100644 index 92cf9a4..0000000 --- a/src/DisplayApp/Icons/battery/os_battery_100.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_100 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_100 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_100 uint8_t ck_os_battery_100_map[] = { - 0x7c, 0xd2, 0x34, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0xaa, 0xa5, 0x55, 0x55, 0x5a, 0xaa, - 0xaa, 0x95, 0x55, 0x55, 0x56, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, -}; - -const lv_img_dsc_t ck_os_battery_100 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 208, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_battery_100_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_battery_100.png b/src/DisplayApp/Icons/battery/os_battery_100.png deleted file mode 100644 index dd0d306..0000000 Binary files a/src/DisplayApp/Icons/battery/os_battery_100.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_battery_error.c b/src/DisplayApp/Icons/battery/os_battery_error.c deleted file mode 100644 index af6aba5..0000000 --- a/src/DisplayApp/Icons/battery/os_battery_error.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_ERROR -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_ERROR -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_ERROR uint8_t ck_os_battery_error_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xc4, 0xc2, 0xc4, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x00, 0x05, 0x55, 0x55, 0x50, 0x00, - 0x00, 0x15, 0x55, 0x55, 0x54, 0x00, - 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, - 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, - 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, - 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, - 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, - 0x55, 0x54, 0x00, 0x00, 0x15, 0x55, - 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, - 0x55, 0x00, 0xaa, 0xaa, 0x00, 0x55, - 0x55, 0x02, 0xaa, 0xaa, 0x80, 0x55, - 0x55, 0x02, 0xaa, 0xaa, 0x80, 0x55, - 0x55, 0x0a, 0xa8, 0x2a, 0xa0, 0x55, - 0x55, 0x0a, 0xa0, 0x0a, 0xa0, 0x55, - 0x55, 0x00, 0x00, 0x0a, 0xa0, 0x55, - 0x55, 0x00, 0x00, 0x2a, 0xa0, 0x55, - 0x55, 0x00, 0x02, 0xaa, 0x80, 0x55, - 0x55, 0x00, 0x0a, 0xaa, 0x80, 0x55, - 0x55, 0x00, 0x0a, 0xaa, 0x00, 0x55, - 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, - 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, - 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, - 0x55, 0x00, 0x00, 0x00, 0x00, 0x55, - 0x55, 0x00, 0x00, 0x00, 0x00, 0x55, - 0x55, 0x00, 0x02, 0x80, 0x00, 0x55, - 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, - 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, - 0x55, 0x00, 0x02, 0x80, 0x00, 0x55, - 0x55, 0x55, 0x40, 0x01, 0x55, 0x55, - 0x55, 0x55, 0x50, 0x05, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, -}; - -const lv_img_dsc_t ck_os_battery_error = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 208, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_battery_error_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_battery_error.png b/src/DisplayApp/Icons/battery/os_battery_error.png deleted file mode 100644 index 4c7632f..0000000 Binary files a/src/DisplayApp/Icons/battery/os_battery_error.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_005.c b/src/DisplayApp/Icons/battery/os_batterycharging_005.c deleted file mode 100644 index 1b0c71d..0000000 --- a/src/DisplayApp/Icons/battery/os_batterycharging_005.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_005 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_005 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_005 uint8_t ck_os_batterycharging_005_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, 0x00, - 0x07, 0xff, 0xe0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x07, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x1f, 0x00, - 0xf0, 0x00, 0x3e, 0x00, - 0xf0, 0x00, 0x7e, 0x00, - 0xf0, 0x00, 0xfc, 0x00, - 0xf0, 0x01, 0xff, 0xf0, - 0xf0, 0x03, 0xff, 0xf0, - 0xf0, 0x03, 0xff, 0xf0, - 0xf0, 0x03, 0xff, 0xe0, - 0xf0, 0x00, 0x0f, 0xc0, - 0xf0, 0x00, 0x1f, 0x80, - 0xff, 0xff, 0x3f, 0x00, - 0xff, 0xff, 0x3e, 0x00, - 0xff, 0xff, 0x3c, 0x00, - 0xff, 0xff, 0x38, 0x00, -}; - -const lv_img_dsc_t ck_os_batterycharging_005 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 136, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_batterycharging_005_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_005.png b/src/DisplayApp/Icons/battery/os_batterycharging_005.png deleted file mode 100644 index f9545bc..0000000 Binary files a/src/DisplayApp/Icons/battery/os_batterycharging_005.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_010.c b/src/DisplayApp/Icons/battery/os_batterycharging_010.c deleted file mode 100644 index 304c018..0000000 --- a/src/DisplayApp/Icons/battery/os_batterycharging_010.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_010 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_010 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_010 uint8_t ck_os_batterycharging_010_map[] = { - 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, 0x55, - 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x6a, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x5a, 0xa9, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x6a, 0xa9, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0xaa, 0xa5, 0x55, - 0xaa, 0x55, 0x55, 0x56, 0xaa, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x5a, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xa9, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xa5, - 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x95, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xaa, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa9, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa5, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0x95, 0x55, -}; - -const lv_img_dsc_t ck_os_batterycharging_010 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 240, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_batterycharging_010_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_010.png b/src/DisplayApp/Icons/battery/os_batterycharging_010.png deleted file mode 100644 index 04d5f82..0000000 Binary files a/src/DisplayApp/Icons/battery/os_batterycharging_010.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_020.c b/src/DisplayApp/Icons/battery/os_batterycharging_020.c deleted file mode 100644 index 1721be1..0000000 --- a/src/DisplayApp/Icons/battery/os_batterycharging_020.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_020 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_020 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_020 uint8_t ck_os_batterycharging_020_map[] = { - 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, 0x55, - 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x6a, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x5a, 0xa9, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x6a, 0xa9, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0xaa, 0xa5, 0x55, - 0xaa, 0x55, 0x55, 0x56, 0xaa, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x5a, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xa9, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xa5, - 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x95, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xaa, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa9, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa5, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0x95, 0x55, -}; - -const lv_img_dsc_t ck_os_batterycharging_020 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 240, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_batterycharging_020_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_020.png b/src/DisplayApp/Icons/battery/os_batterycharging_020.png deleted file mode 100644 index 6416e1e..0000000 Binary files a/src/DisplayApp/Icons/battery/os_batterycharging_020.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_030.c b/src/DisplayApp/Icons/battery/os_batterycharging_030.c deleted file mode 100644 index 83101fd..0000000 --- a/src/DisplayApp/Icons/battery/os_batterycharging_030.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_030 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_030 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_030 uint8_t ck_os_batterycharging_030_map[] = { - 0x04, 0x7a, 0xf4, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, 0x55, - 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x6a, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x5a, 0xa9, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x6a, 0xa9, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0xaa, 0xa5, 0x55, - 0xaa, 0x50, 0x00, 0x56, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xa9, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xa5, - 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x95, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xaa, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa9, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa5, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0x95, 0x55, -}; - -const lv_img_dsc_t ck_os_batterycharging_030 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 240, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_batterycharging_030_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_030.png b/src/DisplayApp/Icons/battery/os_batterycharging_030.png deleted file mode 100644 index 96b44d2..0000000 Binary files a/src/DisplayApp/Icons/battery/os_batterycharging_030.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_040.c b/src/DisplayApp/Icons/battery/os_batterycharging_040.c deleted file mode 100644 index 02af00e..0000000 --- a/src/DisplayApp/Icons/battery/os_batterycharging_040.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_040 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_040 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_040 uint8_t ck_os_batterycharging_040_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, 0x00, - 0x07, 0xff, 0xe0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x07, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x1f, 0x00, - 0xf0, 0x00, 0x3e, 0x00, - 0xf3, 0xf8, 0x7e, 0x00, - 0xf3, 0xf0, 0xfc, 0x00, - 0xf3, 0xf1, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xe0, - 0xf0, 0x00, 0x0f, 0xc0, - 0xf0, 0x00, 0x1f, 0x80, - 0xff, 0xff, 0x3f, 0x00, - 0xff, 0xff, 0x3e, 0x00, - 0xff, 0xff, 0x3c, 0x00, - 0xff, 0xff, 0x38, 0x00, -}; - -const lv_img_dsc_t ck_os_batterycharging_040 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 136, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_batterycharging_040_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_040.png b/src/DisplayApp/Icons/battery/os_batterycharging_040.png deleted file mode 100644 index 5a42caf..0000000 Binary files a/src/DisplayApp/Icons/battery/os_batterycharging_040.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_050.c b/src/DisplayApp/Icons/battery/os_batterycharging_050.c deleted file mode 100644 index d2eea82..0000000 --- a/src/DisplayApp/Icons/battery/os_batterycharging_050.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_050 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_050 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_050 uint8_t ck_os_batterycharging_050_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, 0x00, - 0x07, 0xff, 0xe0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x07, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf3, 0xfe, 0x1f, 0x00, - 0xf3, 0xfc, 0x3e, 0x00, - 0xf3, 0xf8, 0x7e, 0x00, - 0xf3, 0xf0, 0xfc, 0x00, - 0xf3, 0xf1, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xe0, - 0xf0, 0x00, 0x0f, 0xc0, - 0xf0, 0x00, 0x1f, 0x80, - 0xff, 0xff, 0x3f, 0x00, - 0xff, 0xff, 0x3e, 0x00, - 0xff, 0xff, 0x3c, 0x00, - 0xff, 0xff, 0x38, 0x00, -}; - -const lv_img_dsc_t ck_os_batterycharging_050 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 136, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_batterycharging_050_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_050.png b/src/DisplayApp/Icons/battery/os_batterycharging_050.png deleted file mode 100644 index ca0e04d..0000000 Binary files a/src/DisplayApp/Icons/battery/os_batterycharging_050.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_060.c b/src/DisplayApp/Icons/battery/os_batterycharging_060.c deleted file mode 100644 index 05f8b97..0000000 --- a/src/DisplayApp/Icons/battery/os_batterycharging_060.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_060 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_060 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_060 uint8_t ck_os_batterycharging_060_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, 0x00, - 0x07, 0xff, 0xe0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf3, 0xff, 0x87, 0x00, - 0xf3, 0xff, 0x0f, 0x00, - 0xf3, 0xfe, 0x1f, 0x00, - 0xf3, 0xfc, 0x3e, 0x00, - 0xf3, 0xf8, 0x7e, 0x00, - 0xf3, 0xf0, 0xfc, 0x00, - 0xf3, 0xf1, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xe0, - 0xf0, 0x00, 0x0f, 0xc0, - 0xf0, 0x00, 0x1f, 0x80, - 0xff, 0xff, 0x3f, 0x00, - 0xff, 0xff, 0x3e, 0x00, - 0xff, 0xff, 0x3c, 0x00, - 0xff, 0xff, 0x38, 0x00, -}; - -const lv_img_dsc_t ck_os_batterycharging_060 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 136, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_batterycharging_060_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_060.png b/src/DisplayApp/Icons/battery/os_batterycharging_060.png deleted file mode 100644 index 2930068..0000000 Binary files a/src/DisplayApp/Icons/battery/os_batterycharging_060.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_070.c b/src/DisplayApp/Icons/battery/os_batterycharging_070.c deleted file mode 100644 index ac3e319..0000000 --- a/src/DisplayApp/Icons/battery/os_batterycharging_070.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_070 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_070 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_070 uint8_t ck_os_batterycharging_070_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, 0x00, - 0x07, 0xff, 0xe0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf3, 0xff, 0xc0, 0x00, - 0xf3, 0xff, 0xc0, 0x00, - 0xf3, 0xff, 0x87, 0x00, - 0xf3, 0xff, 0x0f, 0x00, - 0xf3, 0xfe, 0x1f, 0x00, - 0xf3, 0xfc, 0x3e, 0x00, - 0xf3, 0xf8, 0x7e, 0x00, - 0xf3, 0xf0, 0xfc, 0x00, - 0xf3, 0xf1, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xe0, - 0xf0, 0x00, 0x0f, 0xc0, - 0xf0, 0x00, 0x1f, 0x80, - 0xff, 0xff, 0x3f, 0x00, - 0xff, 0xff, 0x3e, 0x00, - 0xff, 0xff, 0x3c, 0x00, - 0xff, 0xff, 0x38, 0x00, -}; - -const lv_img_dsc_t ck_os_batterycharging_070 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 136, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_batterycharging_070_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_070.png b/src/DisplayApp/Icons/battery/os_batterycharging_070.png deleted file mode 100644 index 7d5f55d..0000000 Binary files a/src/DisplayApp/Icons/battery/os_batterycharging_070.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_080.c b/src/DisplayApp/Icons/battery/os_batterycharging_080.c deleted file mode 100644 index cc1c1d2..0000000 --- a/src/DisplayApp/Icons/battery/os_batterycharging_080.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_080 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_080 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_080 uint8_t ck_os_batterycharging_080_map[] = { - 0x7c, 0xd2, 0x34, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0xaa, 0xa5, 0x55, 0x55, 0x5a, 0xaa, 0xaa, - 0xaa, 0x95, 0x55, 0x55, 0x56, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x2a, 0x95, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0xaa, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x02, 0xa9, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x0a, 0xa5, 0x56, 0xaa, - 0x55, 0xa0, 0x00, 0x2a, 0x95, 0x56, 0xaa, - 0x55, 0xa0, 0x00, 0xaa, 0x55, 0x5a, 0xaa, - 0x55, 0xa0, 0x00, 0xa9, 0x55, 0x55, 0x55, - 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, - 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, - 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x56, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x5a, - 0x55, 0xaa, 0xaa, 0xaa, 0xa9, 0x55, 0x6a, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x55, 0xaa, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x56, 0xaa, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x5a, 0xaa, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x6a, 0xaa, -}; - -const lv_img_dsc_t ck_os_batterycharging_080 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 240, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_batterycharging_080_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_080.png b/src/DisplayApp/Icons/battery/os_batterycharging_080.png deleted file mode 100644 index cce5052..0000000 Binary files a/src/DisplayApp/Icons/battery/os_batterycharging_080.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_090.c b/src/DisplayApp/Icons/battery/os_batterycharging_090.c deleted file mode 100644 index 85e1c26..0000000 --- a/src/DisplayApp/Icons/battery/os_batterycharging_090.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_090 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_090 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_090 uint8_t ck_os_batterycharging_090_map[] = { - 0x7c, 0xd2, 0x34, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0xaa, 0xa5, 0x55, 0x55, 0x5a, 0xaa, 0xaa, - 0xaa, 0x95, 0x55, 0x55, 0x56, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x2a, 0x95, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0xaa, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x02, 0xa9, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x0a, 0xa5, 0x56, 0xaa, - 0x55, 0xa0, 0x00, 0x2a, 0x95, 0x56, 0xaa, - 0x55, 0xa0, 0x00, 0xaa, 0x55, 0x5a, 0xaa, - 0x55, 0xa0, 0x00, 0xa9, 0x55, 0x55, 0x55, - 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, - 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, - 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x56, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x5a, - 0x55, 0xaa, 0xaa, 0xaa, 0xa9, 0x55, 0x6a, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x55, 0xaa, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x56, 0xaa, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x5a, 0xaa, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x6a, 0xaa, -}; - -const lv_img_dsc_t ck_os_batterycharging_090 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 240, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_batterycharging_090_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_090.png b/src/DisplayApp/Icons/battery/os_batterycharging_090.png deleted file mode 100644 index fc7b443..0000000 Binary files a/src/DisplayApp/Icons/battery/os_batterycharging_090.png and /dev/null differ diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_100.c b/src/DisplayApp/Icons/battery/os_batterycharging_100.c deleted file mode 100644 index 8dec0cb..0000000 --- a/src/DisplayApp/Icons/battery/os_batterycharging_100.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_100 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_100 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_100 uint8_t ck_os_batterycharging_100_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x07, 0x0f, - 0xf0, 0x0f, 0x0f, - 0xf0, 0x1f, 0x0f, - 0xf0, 0x3e, 0x0f, - 0xf0, 0x7e, 0x0f, - 0xf0, 0xfc, 0x0f, - 0xf1, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0x8f, - 0xf0, 0x3f, 0x0f, - 0xf0, 0x7e, 0x0f, - 0xf0, 0x7c, 0x0f, - 0xf0, 0xf8, 0x0f, - 0xf0, 0xf0, 0x0f, - 0xf0, 0xe0, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_batterycharging_100 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_batterycharging_100_map, -}; diff --git a/src/DisplayApp/Icons/battery/os_batterycharging_100.png b/src/DisplayApp/Icons/battery/os_batterycharging_100.png deleted file mode 100644 index 7c8ce0c..0000000 Binary files a/src/DisplayApp/Icons/battery/os_batterycharging_100.png and /dev/null differ diff --git a/src/DisplayApp/Icons/bluetooth/ck_os_bt_connected.png b/src/DisplayApp/Icons/bluetooth/ck_os_bt_connected.png deleted file mode 100644 index 5371611..0000000 Binary files a/src/DisplayApp/Icons/bluetooth/ck_os_bt_connected.png and /dev/null differ diff --git a/src/DisplayApp/Icons/bluetooth/ck_os_bt_disconnected.png b/src/DisplayApp/Icons/bluetooth/ck_os_bt_disconnected.png deleted file mode 100644 index 3275895..0000000 Binary files a/src/DisplayApp/Icons/bluetooth/ck_os_bt_disconnected.png and /dev/null differ diff --git a/src/DisplayApp/Icons/bluetooth/os_bt_connected.c b/src/DisplayApp/Icons/bluetooth/os_bt_connected.c deleted file mode 100644 index d30dc9d..0000000 --- a/src/DisplayApp/Icons/bluetooth/os_bt_connected.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BT_CONNECTED -#define LV_ATTRIBUTE_IMG_CK_OS_BT_CONNECTED -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BT_CONNECTED uint8_t ck_os_bt_connected_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x00, 0x0e, 0x00, 0x00, - 0x00, 0x0f, 0x00, 0x00, - 0x00, 0x0f, 0x80, 0x00, - 0x00, 0x0f, 0xc0, 0x00, - 0x00, 0x0f, 0xe0, 0x00, - 0x00, 0x0f, 0xf0, 0x00, - 0x03, 0x8f, 0xf8, 0x00, - 0x03, 0xcf, 0x7c, 0x00, - 0x03, 0xef, 0x3e, 0x00, - 0x01, 0xff, 0x1f, 0x00, - 0x00, 0xff, 0x1f, 0x00, - 0x00, 0x7f, 0x3e, 0x00, - 0x00, 0x3f, 0x7c, 0x00, - 0x00, 0x1f, 0xf8, 0x00, - 0x00, 0x0f, 0xf0, 0x00, - 0x00, 0x0f, 0xe0, 0x00, - 0x00, 0x0f, 0xe0, 0x00, - 0x00, 0x0f, 0xf0, 0x00, - 0x00, 0x1f, 0xf8, 0x00, - 0x00, 0x3f, 0x7c, 0x00, - 0x00, 0x7f, 0x3e, 0x00, - 0x00, 0xff, 0x1f, 0x00, - 0x01, 0xff, 0x1f, 0x00, - 0x03, 0xef, 0x3e, 0x00, - 0x03, 0xcf, 0x7c, 0x00, - 0x03, 0x8f, 0xf8, 0x00, - 0x00, 0x0f, 0xf0, 0x00, - 0x00, 0x0f, 0xe0, 0x00, - 0x00, 0x0f, 0xc0, 0x00, - 0x00, 0x0f, 0x80, 0x00, - 0x00, 0x0f, 0x00, 0x00, - 0x00, 0x0e, 0x00, 0x00, -}; - -const lv_img_dsc_t ck_os_bt_connected = { - .header.always_zero = 0, - .header.w = 32, - .header.h = 32, - .data_size = 136, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_bt_connected_map, -}; diff --git a/src/DisplayApp/Icons/bluetooth/os_bt_connected.png b/src/DisplayApp/Icons/bluetooth/os_bt_connected.png deleted file mode 100644 index 5371611..0000000 Binary files a/src/DisplayApp/Icons/bluetooth/os_bt_connected.png and /dev/null differ diff --git a/src/DisplayApp/Icons/bluetooth/os_bt_disconnected.c b/src/DisplayApp/Icons/bluetooth/os_bt_disconnected.c deleted file mode 100644 index 930179b..0000000 --- a/src/DisplayApp/Icons/bluetooth/os_bt_disconnected.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BT_DISCONNECTED -#define LV_ATTRIBUTE_IMG_CK_OS_BT_DISCONNECTED -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BT_DISCONNECTED uint8_t ck_os_bt_disconnected_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xc4, 0xc2, 0xc4, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, - 0x2a, 0x80, 0x00, 0x55, 0x40, 0x00, 0x00, 0x00, - 0x2a, 0xa0, 0x00, 0x55, 0x50, 0x00, 0x00, 0x00, - 0x0a, 0xa8, 0x00, 0x55, 0x54, 0x00, 0x00, 0x00, - 0x02, 0xaa, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, - 0x00, 0xaa, 0x80, 0x55, 0x55, 0x40, 0x00, 0x00, - 0x00, 0x2a, 0xa0, 0x55, 0x15, 0x50, 0x00, 0x00, - 0x00, 0x0a, 0xa8, 0x15, 0x05, 0x54, 0x00, 0x00, - 0x00, 0x02, 0xaa, 0x05, 0x01, 0x55, 0x00, 0x00, - 0x00, 0x00, 0xaa, 0x81, 0x01, 0x55, 0x00, 0x00, - 0x00, 0x00, 0x2a, 0xa0, 0x05, 0x54, 0x00, 0x00, - 0x00, 0x00, 0x0a, 0xa8, 0x15, 0x50, 0x00, 0x00, - 0x00, 0x00, 0x02, 0xaa, 0x05, 0x40, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xaa, 0x81, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x2a, 0xa0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0a, 0xa8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x42, 0xaa, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x50, 0xaa, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x05, 0x54, 0x2a, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x15, 0x55, 0x0a, 0xa8, 0x00, 0x00, - 0x00, 0x00, 0x55, 0x55, 0x02, 0xaa, 0x00, 0x00, - 0x00, 0x01, 0x55, 0x55, 0x00, 0xaa, 0x80, 0x00, - 0x00, 0x05, 0x54, 0x55, 0x04, 0x2a, 0xa0, 0x00, - 0x00, 0x05, 0x50, 0x55, 0x15, 0x0a, 0xa8, 0x00, - 0x00, 0x05, 0x40, 0x55, 0x55, 0x42, 0xaa, 0x00, - 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0xaa, 0x80, - 0x00, 0x00, 0x00, 0x55, 0x54, 0x00, 0x2a, 0xa0, - 0x00, 0x00, 0x00, 0x55, 0x50, 0x00, 0x0a, 0xa8, - 0x00, 0x00, 0x00, 0x55, 0x40, 0x00, 0x02, 0xa8, - 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0xa0, - 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, -}; - -const lv_img_dsc_t ck_os_bt_disconnected = { - .header.always_zero = 0, - .header.w = 32, - .header.h = 32, - .data_size = 272, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_bt_disconnected_map, -}; diff --git a/src/DisplayApp/Icons/bluetooth/os_bt_disconnected.png b/src/DisplayApp/Icons/bluetooth/os_bt_disconnected.png deleted file mode 100644 index 3275895..0000000 Binary files a/src/DisplayApp/Icons/bluetooth/os_bt_disconnected.png and /dev/null differ diff --git a/src/DisplayApp/LittleVgl.cpp b/src/DisplayApp/LittleVgl.cpp deleted file mode 100644 index 3483f8e..0000000 --- a/src/DisplayApp/LittleVgl.cpp +++ /dev/null @@ -1,836 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "LittleVgl.h" - -using namespace Pinetime::Components; - -extern "C" { -LV_FONT_DECLARE(jetbrains_mono_extrabold_compressed) -LV_FONT_DECLARE(jetbrains_mono_bold_20) -} - -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) { - 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) { - 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} { - lv_init(); - InitTheme(); - InitDisplay(); - InitTouchpad(); -} - -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*/ - - /*Set up the functions to access to your display*/ - - /*Set the resolution of the display*/ - disp_drv.hor_res = 240; - disp_drv.ver_res = 240; - - /*Used to copy the buffer's content to the display*/ - disp_drv.flush_cb = disp_flush; - /*Set a display buffer*/ - disp_drv.buffer = &disp_buf_2; - disp_drv.user_data = this; - - /*Finally register the driver*/ - lv_disp_drv_register(&disp_drv); -} - -void LittleVgl::InitTouchpad() { - lv_indev_drv_t indev_drv; - - lv_indev_drv_init(&indev_drv); - indev_drv.type = LV_INDEV_TYPE_POINTER; - indev_drv.read_cb = touchpad_read; - indev_drv.user_data = this; - lv_indev_drv_register(&indev_drv); -} - -void LittleVgl::SetFullRefresh(FullRefreshDirections direction) { - if(scrollDirection == FullRefreshDirections::None) { - scrollDirection = direction; - if (scrollDirection == FullRefreshDirections::Down) - lv_disp_set_direction(lv_disp_get_default(), 1); - } -} - -void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) { - ulTaskNotifyTake(pdTRUE, 500); - // 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. - - - // TODO refactore and remove duplicated code - - uint16_t x, y, y1, y2, width, height = 0; - if(scrollDirection == LittleVgl::FullRefreshDirections::Down) { - if(area->y2 == visibleNbLines-1) { - writeOffset = ((writeOffset + totalNbLines) - visibleNbLines) % totalNbLines; - } - x = area->x1; - width = (area->x2 - area->x1) + 1; - - y1 = (area->y1 + writeOffset) % totalNbLines; - y2 = (area->y2 + writeOffset) % totalNbLines; - y = y1; - height = (y2 - y1) + 1; - - if(area->y2 < visibleNbLines - 1) { - uint16_t toScroll = 0; - if(area->y1 == 0) { - toScroll = height*2; - scrollDirection = FullRefreshDirections::None; - lv_disp_set_direction(lv_disp_get_default(), 0); - } else { - toScroll = height; - } - - if(scrollOffset >= toScroll) - scrollOffset -= toScroll; - else { - toScroll -= scrollOffset; - scrollOffset = (totalNbLines) - toScroll; - } - - lcd.VerticalScrollDefinition(0, 320, 0); - lcd.VerticalScrollStartAddress(scrollOffset); - } - - lcd.BeginDrawBuffer(x, y, width, height); - lcd.NextDrawBuffer(reinterpret_cast(color_p), width * height*2) ; - - } else if(scrollDirection == FullRefreshDirections::Up) { - if(area->y1 == 0) { - writeOffset = (writeOffset + visibleNbLines) % totalNbLines; - } - - x = area->x1; - width = (area->x2 - area->x1) + 1; - - y1 = (area->y1 + writeOffset) % totalNbLines; - y2 = (area->y2 + writeOffset) % totalNbLines; - y = y1; - height = (y2 - y1) + 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); - } else { - scrollOffset += height; - } - scrollOffset = scrollOffset % totalNbLines; - lcd.VerticalScrollDefinition(0, 320, 0); - lcd.VerticalScrollStartAddress(scrollOffset); - } - - lcd.BeginDrawBuffer(x, y, width, height); - lcd.NextDrawBuffer(reinterpret_cast(color_p), width * height*2); - } else { - x = area->x1; - width = (area->x2 - area->x1) + 1; - y1 = (area->y1 + writeOffset) % totalNbLines; - y2 = (area->y2 + writeOffset) % totalNbLines; - y = y1; - height = (y2 - y1) + 1; - - if (y2 < y1) { - height = (totalNbLines - 1) - y1; - lcd.BeginDrawBuffer(x, y1, width, height); - lcd.NextDrawBuffer(reinterpret_cast(color_p), width * height * 2); - ulTaskNotifyTake(pdTRUE, 500); - height = y2; - lcd.BeginDrawBuffer(x, 0, width, height); - lcd.NextDrawBuffer(reinterpret_cast(color_p), width * height * 2); - } else { - lcd.BeginDrawBuffer(x, y, width, height); - lcd.NextDrawBuffer(reinterpret_cast(color_p), width * height * 2); - } - } - - /* IMPORTANT!!! - * Inform the graphics library that you are ready with the flushing*/ - lv_disp_flush_ready(&disp_drv); -} - -void LittleVgl::SetNewTapEvent(uint16_t x, uint16_t y) { - tap_x = x; - tap_y = y; - tapped = true; -} - -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; - tapped = false; - } else { - ptr->state = LV_INDEV_STATE_REL; - } - return false; - /* - auto info = touchPanel.GetTouchInfo(); - - if((previousClick.x != info.x || previousClick.y != info.y) && - (info.gesture == Drivers::Cst816S::Gestures::SingleTap)) { - // TODO For an unknown reason, the first touch is taken twice into account. - // 'firstTouch' is a quite'n'dirty workaound until I find a better solution - if(firstTouch) ptr->state = LV_INDEV_STATE_REL; - else ptr->state = LV_INDEV_STATE_PR; - firstTouch = false; - previousClick.x = info.x; - previousClick.y = info.y; - } - else { - ptr->state = LV_INDEV_STATE_REL; - } - - ptr->point.x = info.x; - ptr->point.y = info.y; - return false; - */ -} - -void LittleVgl::InitTheme() { - uint16_t i; - lv_style_t ** style_p = (lv_style_t **)&theme.style; - for(i = 0; i < LV_THEME_STYLE_COUNT; i++) { - *style_p = &def; - style_p++; - } - - InitBaseTheme(); - InitThemeContainer(); - InitThemeButton(); - InitThemeLabel(); - InitThemeLine(); - InitThemeLed(); - InitThemeImage(); - InitThemeBar(); - InitThemeSlider(); - InitThemeSwitch(); - InitThemeMeter(); - InitThemeGauge(); - InitThemeArc(); - InitThemePreload(); - InitThemeChart(); - InitThemeCalendar(); - InitThemeCheckBox(); - InitThemeButtonMatrix(); - InitThemeKnob(); - InitThemeMessageBox(); - InitThemePage(); - InitThemeTextArea(); - InitThemeSpinBox(); - InitThemeList(); - InitThemeDropDownList(); - InitThemeRoller(); - InitThemeTabView(); - InitThemeTileView(); - InitThemeTable(); - InitThemeWindow(); - - lv_theme_set_current(&theme); -} - -void LittleVgl::InitBaseTheme() { - if(font == nullptr) font = &jetbrains_mono_bold_20; - lv_style_copy(&def, &lv_style_plain); /*Initialize the default style*/ - def.text.font = font; - - lv_style_copy(&bg, &lv_style_plain); - bg.body.main_color = LV_COLOR_BLACK; - bg.body.grad_color = LV_COLOR_BLACK; - bg.text.color = LV_COLOR_WHITE; - bg.text.font = font; - bg.image.color = LV_COLOR_WHITE; - - lv_style_copy(&scr, &bg); - scr.body.padding.bottom = 0; - scr.body.padding.top = 0; - scr.body.padding.left = 0; - scr.body.padding.right = 0; - - lv_style_copy(&sb, &def); - sb.body.main_color = lv_color_hsv_to_rgb(hue, 30, 60); - sb.body.grad_color = lv_color_hsv_to_rgb(hue, 30, 60); - sb.body.border.width = 0; - sb.body.padding.inner = LV_DPI / 20; - sb.body.padding.left = 0; - sb.body.padding.right = 0; - sb.body.padding.top = 0; - sb.body.padding.bottom = 0; - sb.body.radius = LV_DPI / 30; - sb.body.opa = LV_OPA_COVER; - - lv_style_copy(&panel, &bg); - panel.body.main_color = lv_color_hsv_to_rgb(hue, 11, 18); - panel.body.grad_color = lv_color_hsv_to_rgb(hue, 11, 18); - panel.body.radius = LV_DPI / 20; - panel.body.border.color = lv_color_hsv_to_rgb(hue, 10, 25); - panel.body.border.width = 1; - panel.body.border.opa = LV_OPA_COVER; - panel.body.padding.left = LV_DPI / 10; - panel.body.padding.right = LV_DPI / 10; - panel.body.padding.top = LV_DPI / 10; - panel.body.padding.bottom = LV_DPI / 10; - panel.line.color = lv_color_hsv_to_rgb(hue, 20, 40); - panel.line.width = 1; - - theme.style.scr = &scr; - theme.style.bg = &bg; - theme.style.panel = &def; -} - -void LittleVgl::InitThemeContainer() { - theme.style.cont = &panel; -} - -void LittleVgl::InitThemeButton() { - - - lv_style_copy(&btn_rel, &def); - btn_rel.body.main_color = lv_color_hsv_to_rgb(hue, 10, 40); - btn_rel.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 20); - btn_rel.body.border.color = lv_color_hex3(0x111); - btn_rel.body.border.width = 1; - btn_rel.body.border.opa = LV_OPA_70; - btn_rel.body.padding.left = LV_DPI / 4; - btn_rel.body.padding.right = LV_DPI / 4; - btn_rel.body.padding.top = LV_DPI / 8; - btn_rel.body.padding.bottom = LV_DPI / 8; - btn_rel.body.shadow.type = LV_SHADOW_BOTTOM; - btn_rel.body.shadow.color = lv_color_hex3(0x111); - btn_rel.body.shadow.width = LV_DPI / 30; - btn_rel.text.color = lv_color_hex3(0xeee); - btn_rel.image.color = lv_color_hex3(0xeee); - - lv_style_copy(&btn_pr, &btn_rel); - btn_pr.body.main_color = lv_color_hsv_to_rgb(hue, 10, 30); - btn_pr.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 10); - - lv_style_copy(&btn_tgl_rel, &btn_rel); - btn_tgl_rel.body.main_color = lv_color_hsv_to_rgb(hue, 10, 20); - btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 40); - btn_tgl_rel.body.shadow.width = LV_DPI / 40; - btn_tgl_rel.text.color = lv_color_hex3(0xddd); - btn_tgl_rel.image.color = lv_color_hex3(0xddd); - - lv_style_copy(&btn_tgl_pr, &btn_rel); - btn_tgl_pr.body.main_color = lv_color_hsv_to_rgb(hue, 10, 10); - btn_tgl_pr.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 30); - btn_tgl_pr.body.shadow.width = LV_DPI / 30; - btn_tgl_pr.text.color = lv_color_hex3(0xddd); - btn_tgl_pr.image.color = lv_color_hex3(0xddd); - - lv_style_copy(&btn_ina, &btn_rel); - btn_ina.body.main_color = lv_color_hsv_to_rgb(hue, 10, 20); - btn_ina.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 20); - btn_ina.body.shadow.width = 0; - btn_ina.text.color = lv_color_hex3(0xaaa); - btn_ina.image.color = lv_color_hex3(0xaaa); - - theme.style.btn.rel = &btn_rel; - theme.style.btn.pr = &btn_pr; - theme.style.btn.tgl_rel = &btn_tgl_rel; - theme.style.btn.tgl_pr = &btn_tgl_pr; - theme.style.btn.ina = &btn_ina; -} - -void LittleVgl::InitThemeLabel() { - lv_style_copy(&prim, &bg); - prim.text.color = lv_color_hsv_to_rgb(hue, 5, 95); - - lv_style_copy(&labelBigStyle, &prim); - labelBigStyle.text.font = &jetbrains_mono_extrabold_compressed; - LabelBigStyle = &(this->labelBigStyle); - - lv_style_copy(&sec, &bg); - sec.text.color = lv_color_hsv_to_rgb(hue, 15, 65); - - lv_style_copy(&hint, &bg); - hint.text.color = lv_color_hsv_to_rgb(hue, 20, 55); - - theme.style.label.prim = &prim; - theme.style.label.sec = &sec; - theme.style.label.hint = &hint; -} - -void LittleVgl::InitThemeLine() { - theme.style.line.decor = &def; -} - -void LittleVgl::InitThemeLed() { - lv_style_copy(&led, &def); - led.body.shadow.width = LV_DPI / 10; - led.body.radius = LV_RADIUS_CIRCLE; - led.body.border.width = LV_DPI / 30; - led.body.border.opa = LV_OPA_30; - led.body.main_color = lv_color_hsv_to_rgb(hue, 100, 100); - led.body.grad_color = lv_color_hsv_to_rgb(hue, 100, 40); - led.body.border.color = lv_color_hsv_to_rgb(hue, 60, 60); - led.body.shadow.color = lv_color_hsv_to_rgb(hue, 100, 100); - - theme.style.led = &led; -} - -void LittleVgl::InitThemeImage() { - theme.style.img.light = &def; - theme.style.img.dark = &def; -} - -void LittleVgl::InitThemeBar() { - lv_style_copy(&bar_bg, &panel); - bar_bg.body.padding.left = LV_DPI / 16; - bar_bg.body.padding.right = LV_DPI / 16; - bar_bg.body.padding.top = LV_DPI / 16; - bar_bg.body.padding.bottom = LV_DPI / 16; - bar_bg.body.radius = LV_RADIUS_CIRCLE; - - lv_style_copy(&bar_indic, &def); - bar_indic.body.main_color = lv_color_hsv_to_rgb(hue, 80, 70); - bar_indic.body.grad_color = lv_color_hsv_to_rgb(hue, 80, 70); - bar_indic.body.border.color = lv_color_hsv_to_rgb(hue, 20, 15); - bar_indic.body.border.width = 1; - bar_indic.body.border.opa = LV_OPA_COVER; - bar_indic.body.radius = LV_RADIUS_CIRCLE; - bar_indic.body.padding.left = 0; - bar_indic.body.padding.right = 0; - bar_indic.body.padding.top = 0; - bar_indic.body.padding.bottom = 0; - - theme.style.bar.bg = &bar_bg; - theme.style.bar.indic = &bar_indic; -} - -void LittleVgl::InitThemeSlider() { - lv_style_copy(&slider_knob, theme.style.btn.rel); - slider_knob.body.radius = LV_RADIUS_CIRCLE; - - theme.style.slider.bg = theme.style.bar.bg; - theme.style.slider.indic = theme.style.bar.indic; - theme.style.slider.knob = &slider_knob; -} - -void LittleVgl::InitThemeSwitch() { - theme.style.sw.bg = theme.style.bar.bg; - theme.style.sw.indic = theme.style.bar.indic; - theme.style.sw.knob_off = theme.style.slider.knob; - theme.style.sw.knob_on = theme.style.slider.knob; -} - -void LittleVgl::InitThemeMeter() { - static lv_style_t lmeter_bg; - lv_style_copy(&lmeter_bg, &def); - lmeter_bg.body.main_color = lv_color_hsv_to_rgb(hue, 10, 70); - lmeter_bg.body.grad_color = lv_color_hsv_to_rgb(hue, 95, 90); - lmeter_bg.body.padding.left = LV_DPI / 10; /*Scale line length*/ - lmeter_bg.body.padding.inner = LV_DPI / 10; /*Text padding*/ - lmeter_bg.body.border.color = lv_color_hex3(0x333); - lmeter_bg.line.color = lv_color_hex3(0x555); - lmeter_bg.line.width = 1; - lmeter_bg.text.color = lv_color_hex3(0xddd); - - theme.style.lmeter = &lmeter_bg; -} - -void LittleVgl::InitThemeGauge() { - static lv_style_t gauge_bg; - lv_style_copy(&gauge_bg, &def); - gauge_bg.body.main_color = lv_color_hsv_to_rgb(hue, 10, 70); - gauge_bg.body.grad_color = gauge_bg.body.main_color; - gauge_bg.line.color = lv_color_hsv_to_rgb(hue, 80, 75); - gauge_bg.line.width = 1; - gauge_bg.text.color = lv_color_hex3(0xddd); - - theme.style.gauge = &gauge_bg; -} - -void LittleVgl::InitThemeArc() { - lv_style_copy(&arc, &def); - arc.line.width = 8; - arc.line.color = lv_color_hsv_to_rgb(hue, 80, 70); - arc.line.rounded = 1; - - /*For preloader*/ - arc.body.border.width = 7; - arc.body.border.color = lv_color_hsv_to_rgb(hue, 11, 48); - arc.body.padding.left = 1; - arc.body.padding.right = 1; - arc.body.padding.top = 1; - arc.body.padding.bottom = 1; - - theme.style.arc = &arc; -} - -void LittleVgl::InitThemePreload() { -// theme.style.preload = theme.style.arc; -} - -void LittleVgl::InitThemeChart() { - theme.style.chart = &panel; -} - -void LittleVgl::InitThemeCalendar() { - - lv_style_copy(&cal_bg, &bg); - cal_bg.body.main_color = lv_color_hsv_to_rgb(hue, 10, 40); - cal_bg.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 40); - cal_bg.body.border.color = lv_color_hex3(0x333); - cal_bg.body.border.width = 1; - cal_bg.body.radius = LV_DPI / 20; - cal_bg.body.padding.left = LV_DPI / 10; - cal_bg.body.padding.right = LV_DPI / 10; - cal_bg.body.padding.top = LV_DPI / 10; - cal_bg.body.padding.bottom = LV_DPI / 10; - - - lv_style_copy(&cal_header, &bg); - cal_header.body.main_color = lv_color_hsv_to_rgb(hue, 10, 20); - cal_header.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 20); - cal_header.body.radius = 0; - cal_header.body.border.width = 1; - cal_header.body.border.color = lv_color_hex3(0x333); - cal_header.body.padding.left = LV_DPI / 10; - cal_header.body.padding.right = LV_DPI / 10; - cal_header.body.padding.top = LV_DPI / 10; - cal_header.body.padding.bottom = LV_DPI / 10; - - - lv_style_copy(&week_box, &panel); - week_box.body.main_color = lv_color_hsv_to_rgb(hue, 30, 45); - week_box.body.grad_color = lv_color_hsv_to_rgb(hue, 30, 45); - week_box.body.radius = LV_DPI / 20; - week_box.body.border.width = 1; - week_box.body.padding.left = LV_DPI / 20; - week_box.body.padding.right = LV_DPI / 20; - week_box.body.padding.top = LV_DPI / 25; - week_box.body.padding.bottom = LV_DPI / 25; - - lv_style_copy(&today_box, &week_box); - today_box.body.main_color = lv_color_hsv_to_rgb(hue, 80, 70); - today_box.body.grad_color = lv_color_hsv_to_rgb(hue, 80, 70); - today_box.body.radius = LV_DPI / 20; - today_box.body.padding.left = LV_DPI / 14; - today_box.body.padding.right = LV_DPI / 14; - today_box.body.padding.top = LV_DPI / 14; - today_box.body.padding.bottom = LV_DPI / 14; - - lv_style_copy(&highlighted_days, &bg); - highlighted_days.text.color = lv_color_hsv_to_rgb(hue, 40, 80); - - lv_style_copy(&ina_days, &bg); - ina_days.text.color = lv_color_hsv_to_rgb(hue, 0, 60); - - theme.style.calendar.bg = &cal_bg; - theme.style.calendar.header = &cal_header; - theme.style.calendar.week_box = &week_box; - theme.style.calendar.today_box = &today_box; - theme.style.calendar.highlighted_days = &highlighted_days; - theme.style.calendar.day_names = &cal_bg; - theme.style.calendar.inactive_days = &ina_days; -} - -void LittleVgl::InitThemeCheckBox() { - - lv_style_copy(&rel, &def); - rel.body.radius = LV_DPI / 20; - rel.body.main_color = lv_color_hsv_to_rgb(hue, 10, 95); - rel.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 95); - rel.body.border.color = lv_color_hsv_to_rgb(hue, 10, 50); - rel.body.border.width = 2; - ; - - lv_style_copy(&pr, &rel); - pr.body.main_color = lv_color_hsv_to_rgb(hue, 10, 80); - pr.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 80); - pr.body.border.color = lv_color_hsv_to_rgb(hue, 10, 20); - pr.body.border.width = 1; - ; - - lv_style_copy(&tgl_rel, &rel); - tgl_rel.body.main_color = lv_color_hsv_to_rgb(hue, 80, 90); - tgl_rel.body.grad_color = lv_color_hsv_to_rgb(hue, 80, 90); - tgl_rel.body.border.color = lv_color_hsv_to_rgb(hue, 80, 50); - - lv_style_copy(&tgl_pr, &tgl_rel); - tgl_pr.body.main_color = lv_color_hsv_to_rgb(hue, 80, 70); - tgl_pr.body.grad_color = lv_color_hsv_to_rgb(hue, 80, 70); - tgl_pr.body.border.color = lv_color_hsv_to_rgb(hue, 80, 30); - tgl_pr.body.border.width = 1; - ; - - lv_style_copy(&ina, &rel); - ina.body.main_color = lv_color_hex3(0x777); - ina.body.grad_color = lv_color_hex3(0x777); - ina.body.border.width = 0; - - theme.style.cb.bg = &lv_style_transp; - theme.style.cb.box.rel = &rel; - theme.style.cb.box.pr = ≺ - theme.style.cb.box.tgl_rel = &tgl_rel; - theme.style.cb.box.tgl_pr = &tgl_pr; - theme.style.cb.box.ina = &def; -} - -void LittleVgl::InitThemeButtonMatrix() { - - lv_style_copy(&btnm_bg, theme.style.btn.rel); - btnm_bg.body.padding.left = 2; - btnm_bg.body.padding.right = 2; - btnm_bg.body.padding.top = 2; - btnm_bg.body.padding.bottom = 2; - btnm_bg.body.padding.inner = 0; - btnm_bg.body.border.width = 1; - - lv_style_copy(&btnm_rel, theme.style.btn.rel); - btnm_rel.body.border.part = LV_BORDER_FULL | LV_BORDER_INTERNAL; - btnm_rel.body.border.width = 1; - btnm_rel.body.radius = 2; - - lv_style_copy(&btnm_pr, theme.style.btn.pr); - btnm_pr.body.border.part = btnm_rel.body.border.part; - btnm_pr.body.border.width = btnm_rel.body.border.width; - btnm_pr.body.radius = btnm_rel.body.radius; - - lv_style_copy(&btnm_tgl_rel, theme.style.btn.tgl_rel); - btnm_tgl_rel.body.border.part = btnm_rel.body.border.part; - btnm_tgl_rel.body.border.width = btnm_rel.body.border.width; - btnm_tgl_rel.body.radius = btnm_rel.body.radius; - - lv_style_copy(&btnm_tgl_pr, theme.style.btn.pr); - btnm_tgl_pr.body.border.part = btnm_rel.body.border.part; - btnm_tgl_pr.body.border.width = btnm_rel.body.border.width; - btnm_tgl_pr.body.radius = btnm_rel.body.radius; - - lv_style_copy(&btnm_ina, theme.style.btn.ina); - btnm_ina.body.border.part = btnm_rel.body.border.part; - btnm_ina.body.border.width = btnm_rel.body.border.width; - btnm_ina.body.radius = btnm_rel.body.radius; - - theme.style.btnm.bg = &btnm_bg; - theme.style.btnm.btn.rel = &btnm_rel; - theme.style.btnm.btn.pr = &btnm_pr; - theme.style.btnm.btn.tgl_rel = &btnm_tgl_rel; - theme.style.btnm.btn.tgl_pr = &btnm_tgl_pr; - theme.style.btnm.btn.ina = &btnm_ina; -} - -void LittleVgl::InitThemeKnob() { - theme.style.kb.bg = &bg; - theme.style.kb.btn.rel = theme.style.btn.rel; - theme.style.kb.btn.pr = theme.style.btn.pr; - theme.style.kb.btn.tgl_rel = theme.style.btn.tgl_rel; - theme.style.kb.btn.tgl_pr = theme.style.btn.tgl_pr; - theme.style.kb.btn.ina = theme.style.btn.ina; -} - -void LittleVgl::InitThemeMessageBox() { - lv_style_copy(&mbox_bg, &bg); - mbox_bg.body.main_color = lv_color_hsv_to_rgb(hue, 30, 30); - mbox_bg.body.grad_color = lv_color_hsv_to_rgb(hue, 30, 30); - mbox_bg.body.border.color = lv_color_hsv_to_rgb(hue, 11, 20); - mbox_bg.body.border.width = 1; - mbox_bg.body.shadow.width = LV_DPI / 10; - mbox_bg.body.shadow.color = lv_color_hex3(0x222); - mbox_bg.body.radius = LV_DPI / 20; - theme.style.mbox.bg = &mbox_bg; - theme.style.mbox.btn.bg = &lv_style_transp; - theme.style.mbox.btn.rel = theme.style.btn.rel; - theme.style.mbox.btn.pr = theme.style.btn.pr; -} - -void LittleVgl::InitThemePage() { - lv_style_copy(&page_scrl, &bg); - page_scrl.body.main_color = lv_color_hsv_to_rgb(hue, 10, 40); - page_scrl.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 40); - page_scrl.body.border.color = lv_color_hex3(0x333); - page_scrl.body.border.width = 1; - page_scrl.body.radius = LV_DPI / 20; - - theme.style.page.bg = &panel; - theme.style.page.scrl = &page_scrl; - theme.style.page.sb = &sb; -} - -void LittleVgl::InitThemeTextArea() { - theme.style.ta.area = &panel; - theme.style.ta.oneline = &panel; - theme.style.ta.cursor = NULL; - theme.style.ta.sb = &def; -} - -void LittleVgl::InitThemeSpinBox() { - theme.style.spinbox.bg = &panel; - theme.style.spinbox.cursor = theme.style.ta.cursor; - theme.style.spinbox.sb = theme.style.ta.sb; -} - -void LittleVgl::InitThemeList() { - - lv_style_copy(&list_bg, &panel); - list_bg.body.padding.top = 0; - list_bg.body.padding.bottom = 0; - list_bg.body.padding.left = 0; - list_bg.body.padding.right = 0; - list_bg.body.padding.inner = 0; - - lv_style_copy(&list_btn_rel, &bg); - list_btn_rel.body.opa = LV_OPA_TRANSP; - list_btn_rel.body.border.part = LV_BORDER_BOTTOM; - list_btn_rel.body.border.color = lv_color_hsv_to_rgb(hue, 10, 5); - list_btn_rel.body.border.width = 1; - list_btn_rel.body.radius = LV_DPI / 10; - list_btn_rel.text.color = lv_color_hsv_to_rgb(hue, 5, 80); - list_btn_rel.image.color = lv_color_hsv_to_rgb(hue, 5, 80); - list_btn_rel.body.padding.top = LV_DPI / 6; - list_btn_rel.body.padding.bottom = LV_DPI / 6; - list_btn_rel.body.padding.left = LV_DPI / 8; - list_btn_rel.body.padding.right = LV_DPI / 8; - - lv_style_copy(&list_btn_pr, theme.style.btn.pr); - list_btn_pr.body.main_color = lv_color_hsv_to_rgb(hue, 10, 5); - list_btn_pr.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 5); - list_btn_pr.body.border.color = lv_color_hsv_to_rgb(hue, 10, 5); - list_btn_pr.body.border.width = 0; - list_btn_pr.body.padding.top = LV_DPI / 6; - list_btn_pr.body.padding.bottom = LV_DPI / 6; - list_btn_pr.body.padding.left = LV_DPI / 8; - list_btn_pr.body.padding.right = LV_DPI / 8; - list_btn_pr.text.color = lv_color_hsv_to_rgb(hue, 5, 80); - list_btn_pr.image.color = lv_color_hsv_to_rgb(hue, 5, 80); - - lv_style_copy(&list_btn_tgl_rel, &list_btn_rel); - list_btn_tgl_rel.body.opa = LV_OPA_COVER; - list_btn_tgl_rel.body.main_color = lv_color_hsv_to_rgb(hue, 80, 70); - list_btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(hue, 80, 70); - list_btn_tgl_rel.body.border.color = lv_color_hsv_to_rgb(hue, 60, 40); - list_btn_tgl_rel.body.radius = list_bg.body.radius; - - lv_style_copy(&list_btn_tgl_pr, &list_btn_tgl_rel); - list_btn_tgl_pr.body.main_color = lv_color_hsv_to_rgb(hue, 80, 60); - list_btn_tgl_pr.body.grad_color = lv_color_hsv_to_rgb(hue, 80, 60); - - theme.style.list.sb = &sb; - theme.style.list.bg = &list_bg; - theme.style.list.scrl = &lv_style_transp_tight; - theme.style.list.btn.rel = &list_btn_rel; - theme.style.list.btn.pr = &list_btn_pr; - theme.style.list.btn.tgl_rel = &list_btn_tgl_rel; - theme.style.list.btn.tgl_pr = &list_btn_tgl_pr; - theme.style.list.btn.ina = &def; -} - -void LittleVgl::InitThemeDropDownList() { - lv_style_copy(&ddlist_bg, theme.style.btn.rel); - ddlist_bg.text.line_space = LV_DPI / 8; - ddlist_bg.body.padding.top = LV_DPI / 8; - ddlist_bg.body.padding.bottom = LV_DPI / 8; - ddlist_bg.body.padding.left = LV_DPI / 8; - ddlist_bg.body.padding.right = LV_DPI / 8; - ddlist_bg.body.radius = LV_DPI / 30; - - lv_style_copy(&ddlist_sel, theme.style.btn.rel); - ddlist_sel.body.main_color = lv_color_hsv_to_rgb(hue, 20, 50); - ddlist_sel.body.grad_color = lv_color_hsv_to_rgb(hue, 20, 50); - ddlist_sel.body.radius = 0; - - theme.style.ddlist.bg = &ddlist_bg; - theme.style.ddlist.sel = &ddlist_sel; - theme.style.ddlist.sb = &def; -} - -void LittleVgl::InitThemeRoller() { - lv_style_t roller_bg; - - lv_style_copy(&roller_bg, theme.style.ddlist.bg); - roller_bg.body.main_color = lv_color_hsv_to_rgb(hue, 10, 20); - roller_bg.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 40); - roller_bg.text.color = lv_color_hsv_to_rgb(hue, 5, 70); - roller_bg.text.opa = LV_OPA_60; - - theme.style.roller.bg = &roller_bg; - theme.style.roller.sel = theme.style.ddlist.sel; -} - -void LittleVgl::InitThemeTabView() { - theme.style.tabview.bg = &bg; - theme.style.tabview.indic = &lv_style_transp; - theme.style.tabview.btn.bg = &lv_style_transp; - theme.style.tabview.btn.rel = theme.style.btn.rel; - theme.style.tabview.btn.pr = theme.style.btn.pr; - theme.style.tabview.btn.tgl_rel = theme.style.btn.tgl_rel; - theme.style.tabview.btn.tgl_pr = theme.style.btn.tgl_pr; -} - -void LittleVgl::InitThemeTileView() { - theme.style.tileview.bg = &lv_style_transp_tight; - theme.style.tileview.scrl = &lv_style_transp_tight; - theme.style.tileview.sb = theme.style.page.sb; -} - -void LittleVgl::InitThemeTable() { - lv_style_copy(&cell, &panel); - cell.body.radius = 0; - cell.body.border.width = 1; - cell.body.padding.left = LV_DPI / 12; - cell.body.padding.right = LV_DPI / 12; - cell.body.padding.top = LV_DPI / 12; - cell.body.padding.bottom = LV_DPI / 12; - - theme.style.table.bg = &lv_style_transp_tight; - theme.style.table.cell = &cell; -} - -void LittleVgl::InitThemeWindow() { -// lv_style_copy(&win_bg, &bg); -// win_bg.body.border.color = lv_color_hex3(0x333); -// win_bg.body.border.width = 1; -// -// lv_style_copy(&win_header, &win_bg); -// win_header.body.main_color = lv_color_hsv_to_rgb(hue, 10, 20); -// win_header.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 20); -// win_header.body.radius = 0; -// win_header.body.padding.left = 0; -// win_header.body.padding.right = 0; -// win_header.body.padding.top = 0; -// win_header.body.padding.bottom = 0; -// -// lv_style_copy(&win_btn_pr, &def); -// win_btn_pr.body.main_color = lv_color_hsv_to_rgb(hue, 10, 10); -// win_btn_pr.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 10); -// win_btn_pr.text.color = lv_color_hex3(0xaaa); -// win_btn_pr.image.color = lv_color_hex3(0xaaa); -// -// theme.style.win.bg = &win_bg; -// theme.style.win.sb = &sb; -// theme.style.win.header = &win_header; -// theme.style.win.content = &lv_style_transp; -// theme.style.win.btn.rel = &lv_style_transp; -// theme.style.win.btn.pr = &win_btn_pr; -} - - - diff --git a/src/DisplayApp/LittleVgl.h b/src/DisplayApp/LittleVgl.h deleted file mode 100644 index 5c1c443..0000000 --- a/src/DisplayApp/LittleVgl.h +++ /dev/null @@ -1,116 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -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); - void SetFullRefresh(FullRefreshDirections direction); - void SetNewTapEvent(uint16_t x, uint16_t y); - - private: - void InitDisplay(); - void InitTouchpad(); - void InitTheme(); - void InitBaseTheme(); - void InitThemeContainer(); - void InitThemeButton(); - void InitThemeLabel(); - void InitThemeLine(); - void InitThemeLed(); - void InitThemeImage(); - void InitThemeBar(); - void InitThemeSlider(); - void InitThemeSwitch(); - void InitThemeMeter(); - void InitThemeGauge(); - void InitThemeArc(); - void InitThemePreload(); - void InitThemeChart(); - void InitThemeCalendar(); - void InitThemeCheckBox(); - void InitThemeButtonMatrix(); - void InitThemeKnob(); - void InitThemeMessageBox(); - void InitThemePage(); - void InitThemeTextArea(); - void InitThemeSpinBox(); - void InitThemeList(); - void InitThemeDropDownList(); - void InitThemeRoller(); - void InitThemeTabView(); - void InitThemeTileView(); - void InitThemeTable(); - void InitThemeWindow(); - - 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_style_t def; - lv_style_t scr, bg, sb, panel; - lv_font_t * font = nullptr; - uint16_t hue = 10; - lv_theme_t theme; - lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina; - lv_style_t labelBigStyle; - lv_style_t prim, sec, hint; - lv_style_t led; - lv_style_t bar_bg, bar_indic; - lv_style_t slider_knob; - lv_style_t arc; - lv_style_t cal_bg; - lv_style_t cal_header; - lv_style_t week_box; - lv_style_t today_box; - lv_style_t highlighted_days; - lv_style_t ina_days; - lv_style_t rel, pr, tgl_rel, tgl_pr, ina; - lv_style_t btnm_bg, btnm_rel, btnm_pr, btnm_tgl_rel, btnm_tgl_pr, btnm_ina; - lv_style_t mbox_bg; - lv_style_t page_scrl; - lv_style_t list_bg, list_btn_rel, list_btn_pr, list_btn_tgl_rel, list_btn_tgl_pr; - lv_style_t ddlist_bg, ddlist_sel; - lv_style_t cell; - lv_style_t win_bg; - lv_style_t win_header; - lv_style_t win_btn_pr; - - 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; - }; - } -} - diff --git a/src/DisplayApp/Screens/ApplicationList.cpp b/src/DisplayApp/Screens/ApplicationList.cpp deleted file mode 100644 index eb85be4..0000000 --- a/src/DisplayApp/Screens/ApplicationList.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include -#include -#include "ApplicationList.h" -#include "Tile.h" -#include "Symbols.h" - -using namespace Pinetime::Applications::Screens; - -ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp *app) : - Screen(app), - screens{app, { - [this]() -> std::unique_ptr { return CreateScreen1(); }, - [this]() -> std::unique_ptr { return CreateScreen2(); }, - //[this]() -> std::unique_ptr { return CreateScreen3(); } - } - } {} - - -ApplicationList::~ApplicationList() { - lv_obj_clean(lv_scr_act()); -} - -bool ApplicationList::Refresh() { - if(running) - running = screens.Refresh(); - return running; -} - -bool ApplicationList::OnButtonPushed() { - running = false; - app->StartApp(Apps::Clock); - return true; -} - -bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - return screens.OnTouchEvent(event); -} - -std::unique_ptr ApplicationList::CreateScreen1() { - std::array applications { - {{Symbols::clock, Apps::Clock}, - {Symbols::music, Apps::Music}, - {Symbols::sun, Apps::Brightness}, - {Symbols::list, Apps::SysInfo}, - {Symbols::check, Apps::FirmwareValidation}, - {Symbols::none, Apps::None} - } - - - }; - - return std::unique_ptr(new Screens::Tile(app, applications)); -} - -std::unique_ptr ApplicationList::CreateScreen2() { - std::array applications { - {{Symbols::tachometer, Apps::Gauge}, - {Symbols::asterisk, Apps::Meter}, - {Symbols::paintbrush, Apps::Paint}, - {Symbols::none, Apps::None}, - {Symbols::none, Apps::None}, - {Symbols::none, Apps::None} - } - }; - - return std::unique_ptr(new Screens::Tile(app, applications)); -} - -std::unique_ptr ApplicationList::CreateScreen3() { - std::array applications { - {{"A", Apps::Meter}, - {"B", Apps::Gauge}, - {"C", Apps::Clock}, - {"D", Apps::Music}, - {"E", Apps::SysInfo}, - {"F", Apps::Brightness} - } - }; - - return std::unique_ptr(new Screens::Tile(app, applications)); -} diff --git a/src/DisplayApp/Screens/ApplicationList.h b/src/DisplayApp/Screens/ApplicationList.h deleted file mode 100644 index a1e6811..0000000 --- a/src/DisplayApp/Screens/ApplicationList.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include "Label.h" -#include "ScreenList.h" -#include "Gauge.h" -#include "Meter.h" -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - class ApplicationList : public Screen { - public: - explicit ApplicationList(DisplayApp* app); - ~ApplicationList() override; - bool Refresh() override; - bool OnButtonPushed() override; - bool OnTouchEvent(TouchEvents event) override; - private: - bool running = true; - - ScreenList<2> screens; - std::unique_ptr CreateScreen1(); - std::unique_ptr CreateScreen2(); - std::unique_ptr CreateScreen3(); - }; - } - } -} \ No newline at end of file diff --git a/src/DisplayApp/Screens/BatteryIcon.cpp b/src/DisplayApp/Screens/BatteryIcon.cpp deleted file mode 100644 index 26939d1..0000000 --- a/src/DisplayApp/Screens/BatteryIcon.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "BatteryIcon.h" -#include "Symbols.h" -using namespace Pinetime::Applications::Screens; - -const char* BatteryIcon::GetBatteryIcon(float batteryPercent) { - if(batteryPercent > 90.0f) return Symbols::batteryFull; - if(batteryPercent > 75.0f) return Symbols::batteryThreeQuarter; - if(batteryPercent > 50.0f) return Symbols::batteryHalf; - if(batteryPercent > 25.0f) return Symbols::batteryOneQuarter; - return Symbols::batteryEmpty; -} - -const char* BatteryIcon::GetUnknownIcon() { - return Symbols::batteryEmpty; -} - -const char *BatteryIcon::GetPlugIcon(bool isCharging) { - if(isCharging) - return Symbols::plug; - else return ""; -} diff --git a/src/DisplayApp/Screens/BatteryIcon.h b/src/DisplayApp/Screens/BatteryIcon.h deleted file mode 100644 index 58f04a8..0000000 --- a/src/DisplayApp/Screens/BatteryIcon.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - class BatteryIcon { - public: - static const char* GetUnknownIcon(); - static const char* GetBatteryIcon(float batteryPercent); - static const char* GetPlugIcon(bool isCharging); - }; - } - } -} \ No newline at end of file diff --git a/src/DisplayApp/Screens/BleIcon.cpp b/src/DisplayApp/Screens/BleIcon.cpp deleted file mode 100644 index 1bbbd05..0000000 --- a/src/DisplayApp/Screens/BleIcon.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "BleIcon.h" -#include "Symbols.h" -using namespace Pinetime::Applications::Screens; - -const char* BleIcon::GetIcon(bool isConnected) { - if(isConnected) return Symbols::bluetooth; - else return ""; -} \ No newline at end of file diff --git a/src/DisplayApp/Screens/BleIcon.h b/src/DisplayApp/Screens/BleIcon.h deleted file mode 100644 index c1398d2..0000000 --- a/src/DisplayApp/Screens/BleIcon.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -namespace Pinetime { - namespace Applications { - namespace Screens { - class BleIcon { - public: - static const char* GetIcon(bool isConnected); - }; - } - } -} \ No newline at end of file diff --git a/src/DisplayApp/Screens/Brightness.cpp b/src/DisplayApp/Screens/Brightness.cpp deleted file mode 100644 index 9e3416c..0000000 --- a/src/DisplayApp/Screens/Brightness.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include -#include "Brightness.h" - -using namespace Pinetime::Applications::Screens; - -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} { - slider = lv_slider_create(lv_scr_act(), NULL); - lv_obj_set_user_data(slider, this); - lv_obj_set_width(slider, LV_DPI * 2); - lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_set_event_cb(slider, slider_event_cb); - lv_slider_set_range(slider, 0, 2); - lv_slider_set_value(slider, LevelToInt(brightness.Level()), LV_ANIM_OFF); - - slider_label = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(slider_label, LevelToString(brightness.Level())); - lv_obj_set_auto_realign(slider_label, true); - lv_obj_align(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); -} - -Brightness::~Brightness() { - lv_obj_clean(lv_scr_act()); -} - -bool Brightness::Refresh() { - return running; -} - -bool Brightness::OnButtonPushed() { - running = false; - return true; -} - -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 "???"; - } -} - -void Brightness::OnValueChanged() { - SetValue(lv_slider_get_value(slider)); -} - -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; - } - 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; - } -} - -bool Brightness::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - switch(event) { - case TouchEvents::SwipeLeft: - brightness.Lower(); - SetValue(); - return true; - case TouchEvents::SwipeRight: - brightness.Higher(); - SetValue(); - return true; - default: - return false; - } -} - -void Brightness::SetValue() { - lv_slider_set_value(slider, LevelToInt(brightness.Level()), LV_ANIM_OFF); - lv_label_set_text(slider_label, LevelToString(brightness.Level())); -} diff --git a/src/DisplayApp/Screens/Brightness.h b/src/DisplayApp/Screens/Brightness.h deleted file mode 100644 index 37cbcd7..0000000 --- a/src/DisplayApp/Screens/Brightness.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" - -namespace Pinetime { - namespace Applications { - namespace Screens { - class Brightness : public Screen { - public: - Brightness(DisplayApp* app, Controllers::BrightnessController& brightness); - ~Brightness() override; - bool Refresh() override; - bool OnButtonPushed() override; - bool OnTouchEvent(TouchEvents event) override; - - void OnValueChanged(); - private: - bool running = true; - 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(); - }; - } - } -} \ No newline at end of file diff --git a/src/DisplayApp/Screens/Clock.cpp b/src/DisplayApp/Screens/Clock.cpp deleted file mode 100644 index 06fab9a..0000000 --- a/src/DisplayApp/Screens/Clock.cpp +++ /dev/null @@ -1,227 +0,0 @@ -#include -#include -#include -#include -#include "Clock.h" -#include "../DisplayApp.h" -#include "BatteryIcon.h" -#include "BleIcon.h" -#include "Symbols.h" -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; -extern lv_style_t* LabelBigStyle; - -static void event_handler(lv_obj_t * obj, lv_event_t event) { - Clock* screen = static_cast(obj->user_data); - screen->OnObjectEvent(obj, event); -} - -Clock::Clock(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController) : Screen(app), currentDateTime{{}}, - dateTimeController{dateTimeController}, batteryController{batteryController}, bleController{bleController} { - displayedChar[0] = 0; - displayedChar[1] = 0; - displayedChar[2] = 0; - displayedChar[3] = 0; - displayedChar[4] = 0; - - batteryIcon = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(batteryIcon, Symbols::batteryFull); - lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 2); - - batteryPlug = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(batteryPlug, Symbols::plug); - lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); - - bleIcon = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(bleIcon, Symbols::bluetooth); - lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); - - - label_date = lv_label_create(lv_scr_act(), NULL); - - lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); - - label_time = lv_label_create(lv_scr_act(), NULL); - lv_label_set_style(label_time, LV_LABEL_STYLE_MAIN, LabelBigStyle); - lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0); - - backgroundLabel = lv_label_create(lv_scr_act(), NULL); - backgroundLabel->user_data = this; - lv_obj_set_click(backgroundLabel, true); - lv_obj_set_event_cb(backgroundLabel, event_handler); - 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(backgroundLabel, ""); - - - heartbeatIcon = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(heartbeatIcon, Symbols::heartBeat); - lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2); - - heartbeatValue = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(heartbeatValue, "0"); - lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0); - - heartbeatBpm = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(heartbeatBpm, "BPM"); - lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0); - - stepValue = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(stepValue, "0"); - lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2); - - stepIcon = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(stepIcon, Symbols::shoe); - lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); -} - -Clock::~Clock() { - lv_obj_clean(lv_scr_act()); -} - -bool Clock::Refresh() { - batteryPercentRemaining = batteryController.PercentRemaining(); - if (batteryPercentRemaining.IsUpdated()) { - auto batteryPercent = batteryPercentRemaining.Get(); - lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); - auto isCharging = batteryController.IsCharging() || batteryController.IsPowerPresent(); - lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging)); - } - - bleState = bleController.IsConnected(); - if (bleState.IsUpdated()) { - if(bleState.Get() == true) { - lv_label_set_text(bleIcon, BleIcon::GetIcon(true)); - } else { - lv_label_set_text(bleIcon, BleIcon::GetIcon(false)); - } - } - lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 5); - lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); - lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); - - currentDateTime = dateTimeController.CurrentDateTime(); - - if(currentDateTime.IsUpdated()) { - auto newDateTime = currentDateTime.Get(); - - auto dp = date::floor(newDateTime); - 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 dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); - - auto hour = time.hours().count(); - auto minute = time.minutes().count(); - - char minutesChar[3]; - sprintf(minutesChar, "%02d", static_cast(minute)); - - char hoursChar[3]; - sprintf(hoursChar, "%02d", static_cast(hour)); - - char timeStr[6]; - sprintf(timeStr, "%c%c:%c%c", hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]); - - 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]; - displayedChar[3] = minutesChar[1]; - - lv_label_set_text(label_time, timeStr); - } - - if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { - char dateStr[22]; - sprintf(dateStr, "%s %d %s %d", DayOfWeekToString(dayOfWeek), day, MonthToString(month), year); - lv_label_set_text(label_date, dateStr); - - - currentYear = year; - currentMonth = month; - currentDayOfWeek = dayOfWeek; - currentDay = day; - } - } - - // TODO heartbeat = heartBeatController.GetValue(); - if(heartbeat.IsUpdated()) { - char heartbeatBuffer[4]; - sprintf(heartbeatBuffer, "%d", heartbeat.Get()); - lv_label_set_text(heartbeatValue, heartbeatBuffer); - 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); - } - - // TODO stepCount = stepController.GetValue(); - if(stepCount.IsUpdated()) { - char stepBuffer[5]; - sprintf(stepBuffer, "%lu", stepCount.Get()); - lv_label_set_text(stepValue, stepBuffer); - 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); - } - - return running; -} - -const char *Clock::MonthToString(Pinetime::Controllers::DateTime::Months month) { - return Clock::MonthsString[static_cast(month)]; -} - -const char *Clock::DayOfWeekToString(Pinetime::Controllers::DateTime::Days dayOfWeek) { - return Clock::DaysString[static_cast(dayOfWeek)]; -} - -char const *Clock::DaysString[] = { - "", - "MONDAY", - "TUESDAY", - "WEDNESDAY", - "THURSDAY", - "FRIDAY", - "SATURDAY", - "SUNDAY" -}; - -char const *Clock::MonthsString[] = { - "", - "JAN", - "FEB", - "MAR", - "APR", - "MAY", - "JUN", - "JUL", - "AUG", - "SEP", - "OCT", - "NOV", - "DEC" -}; - -void Clock::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { - if(obj == backgroundLabel) { - if (event == LV_EVENT_CLICKED) { - - running = false; - } - } -} - -bool Clock::OnButtonPushed() { - running = false; - return false; -} - - diff --git a/src/DisplayApp/Screens/Clock.h b/src/DisplayApp/Screens/Clock.h deleted file mode 100644 index 7363fda..0000000 --- a/src/DisplayApp/Screens/Clock.h +++ /dev/null @@ -1,88 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include -#include -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - template - class DirtyValue { - public: - explicit DirtyValue(T v) { value = v; } - explicit DirtyValue(T& v) { value = v; } - bool IsUpdated() const { return isUpdated; } - T& Get() { this->isUpdated = false; return value; } - - DirtyValue& operator=(const T& other) { - if (this->value != other) { - this->value = other; - this->isUpdated = true; - } - return *this; - } - private: - T value; - bool isUpdated = true; - }; - class Clock : public Screen{ - public: - Clock(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController); - ~Clock() override; - - bool Refresh() override; - bool OnButtonPushed() override; - - void OnObjectEvent(lv_obj_t *pObj, lv_event_t i); - private: - static const char* MonthToString(Pinetime::Controllers::DateTime::Months month); - static const char* DayOfWeekToString(Pinetime::Controllers::DateTime::Days dayOfWeek); - static char const *DaysString[]; - static char const *MonthsString[]; - - 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; - - DirtyValue batteryPercentRemaining {0}; - DirtyValue bleState {false}; - DirtyValue> currentDateTime; - DirtyValue stepCount {0}; - DirtyValue heartbeat {0}; - - - lv_obj_t* label_time; - 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; - - Controllers::DateTime& dateTimeController; - Controllers::Battery& batteryController; - Controllers::Ble& bleController; - - bool running = true; - - }; - } - } -} diff --git a/src/DisplayApp/Screens/DropDownDemo.cpp b/src/DisplayApp/Screens/DropDownDemo.cpp deleted file mode 100644 index 735a0cc..0000000 --- a/src/DisplayApp/Screens/DropDownDemo.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include -#include "DropDownDemo.h" -#include "../DisplayApp.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - -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(), NULL); - 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); - lv_obj_align(ddlist, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); -} - -DropDownDemo::~DropDownDemo() { - // Reset the touchmode - app->SetTouchMode(DisplayApp::TouchModes::Gestures); - lv_obj_clean(lv_scr_act()); -} - -bool DropDownDemo::Refresh() { - 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) - app->SetTouchMode(DisplayApp::TouchModes::Polling); - else - app->SetTouchMode(DisplayApp::TouchModes::Gestures); - return running; -} - -bool DropDownDemo::OnButtonPushed() { - running = false; - return true; -} - -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) { - return true; - } else { - return false; - } -} - diff --git a/src/DisplayApp/Screens/DropDownDemo.h b/src/DisplayApp/Screens/DropDownDemo.h deleted file mode 100644 index 7c75efc..0000000 --- a/src/DisplayApp/Screens/DropDownDemo.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class DropDownDemo : public Screen{ - public: - DropDownDemo(DisplayApp* app); - ~DropDownDemo() override; - - bool Refresh() override; - bool OnButtonPushed() override; - bool OnTouchEvent(TouchEvents event) override; - - private: - lv_obj_t * ddlist; - bool running = true; - bool isDropDownOpened = false; - }; - } - } -} diff --git a/src/DisplayApp/Screens/FirmwareUpdate.cpp b/src/DisplayApp/Screens/FirmwareUpdate.cpp deleted file mode 100644 index e831114..0000000 --- a/src/DisplayApp/Screens/FirmwareUpdate.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include "FirmwareUpdate.h" -#include "../DisplayApp.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - - -FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Ble& bleController) : - Screen(app), bleController{bleController} { - - titleLabel = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(titleLabel, "Firmware update"); - lv_obj_set_auto_realign(titleLabel, true); - lv_obj_align(titleLabel, NULL, LV_ALIGN_IN_TOP_MID, 0, 50); - - bar1 = lv_bar_create(lv_scr_act(), NULL); - lv_obj_set_size(bar1, 200, 30); - lv_obj_align(bar1, NULL, LV_ALIGN_CENTER, 0, 0); - lv_bar_set_anim_time(bar1, 10); - lv_bar_set_range(bar1, 0, 100); - lv_bar_set_value(bar1, 0, LV_ANIM_OFF); - - percentLabel = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(percentLabel, ""); - lv_obj_set_auto_realign(percentLabel, true); - lv_obj_align(percentLabel, bar1, LV_ALIGN_OUT_TOP_MID, 0, 60); -} - -FirmwareUpdate::~FirmwareUpdate() { - lv_obj_clean(lv_scr_act()); -} - -bool FirmwareUpdate::Refresh() { - switch(bleController.State()) { - default: - case Pinetime::Controllers::Ble::FirmwareUpdateStates::Idle: - case Pinetime::Controllers::Ble::FirmwareUpdateStates::Running: - if(state != States::Running) - state = States::Running; - return DisplayProgression(); - case Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated: - if(state != States::Validated) { - UpdateValidated(); - state = States::Validated; - } - return running; - case Pinetime::Controllers::Ble::FirmwareUpdateStates::Error: - if(state != States::Error) { - UpdateError(); - state = States::Error; - } - return running; - } -} - -bool FirmwareUpdate::DisplayProgression() const { - float current = bleController.FirmwareUpdateCurrentBytes() / 1024.0f; - float total = bleController.FirmwareUpdateTotalBytes() / 1024.0f; - int16_t pc = (current / total) * 100.0f; - sprintf(percentStr, "%d %%", pc); - lv_label_set_text(percentLabel, percentStr); - - lv_bar_set_value(bar1, pc, LV_ANIM_OFF); - return running; -} - -bool FirmwareUpdate::OnButtonPushed() { - running = false; - return true; -} - -void FirmwareUpdate::UpdateValidated() { - lv_label_set_recolor(percentLabel, true); - lv_label_set_text(percentLabel, "#00ff00 Image Ok!#"); -} - -void FirmwareUpdate::UpdateError() { - lv_label_set_recolor(percentLabel, true); - lv_label_set_text(percentLabel, "#ff0000 Error!#"); -} diff --git a/src/DisplayApp/Screens/FirmwareUpdate.h b/src/DisplayApp/Screens/FirmwareUpdate.h deleted file mode 100644 index faaf395..0000000 --- a/src/DisplayApp/Screens/FirmwareUpdate.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class FirmwareUpdate : public Screen{ - public: - FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController); - ~FirmwareUpdate() override; - - bool Refresh() override; - bool OnButtonPushed() 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]; - bool running = true; - States state; - - bool DisplayProgression() const; - - void UpdateValidated(); - - void UpdateError(); - }; - } - } -} diff --git a/src/DisplayApp/Screens/FirmwareValidation.cpp b/src/DisplayApp/Screens/FirmwareValidation.cpp deleted file mode 100644 index fb2dd95..0000000 --- a/src/DisplayApp/Screens/FirmwareValidation.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include "FirmwareValidation.h" -#include "../DisplayApp.h" -#include "../../Version.h" -#include "../../Components/FirmwareValidator/FirmwareValidator.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - -namespace { - 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} { - labelVersionInfo = lv_label_create(lv_scr_act(), NULL); - lv_obj_align(labelVersionInfo, NULL, 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(), NULL); - lv_obj_align(labelVersionValue, labelVersionInfo, LV_ALIGN_OUT_RIGHT_MID, 0, 0); - lv_label_set_recolor(labelVersionValue, true); - sprintf(version, "%ld.%ld.%ld", Version::Major(), Version::Minor(), Version::Patch()); - lv_label_set_text(labelVersionValue, version); - - labelIsValidated = lv_label_create(lv_scr_act(), NULL); - lv_obj_align(labelIsValidated, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 50); - lv_label_set_recolor(labelIsValidated, true); - lv_label_set_long_mode(labelIsValidated, LV_LABEL_LONG_BREAK); - lv_obj_set_width(labelIsValidated, 240); - - 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."); - - buttonValidate = lv_btn_create(lv_scr_act(), NULL); - lv_obj_align(buttonValidate, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); - buttonValidate->user_data = this; - lv_obj_set_event_cb(buttonValidate, ButtonEventHandler); - - labelButtonValidate = lv_label_create(buttonValidate, NULL); - lv_label_set_recolor(labelButtonValidate, true); - lv_label_set_text(labelButtonValidate, "#00ff00 Validate#"); - - buttonReset = lv_btn_create(lv_scr_act(), NULL); - buttonReset->user_data = this; - lv_obj_align(buttonReset, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); - lv_obj_set_event_cb(buttonReset, ButtonEventHandler); - - labelButtonReset = lv_label_create(buttonReset, NULL); - lv_label_set_recolor(labelButtonReset, true); - lv_label_set_text(labelButtonReset, "#ff0000 Reset#"); - } -} - - -FirmwareValidation::~FirmwareValidation() { - lv_obj_clean(lv_scr_act()); -} - -bool FirmwareValidation::Refresh() { - return running; -} - -bool FirmwareValidation::OnButtonPushed() { - running = false; - return true; -} - -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) { - validator.Reset(); - } - -} - - diff --git a/src/DisplayApp/Screens/FirmwareValidation.h b/src/DisplayApp/Screens/FirmwareValidation.h deleted file mode 100644 index 947f557..0000000 --- a/src/DisplayApp/Screens/FirmwareValidation.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include -#include -#include - -namespace Pinetime { - namespace Controllers { - class FirmwareValidator; - } - - namespace Applications { - namespace Screens { - - class FirmwareValidation : public Screen{ - public: - FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator); - ~FirmwareValidation() override; - - bool Refresh() override; - bool OnButtonPushed() override; - - void OnButtonEvent(lv_obj_t *object, lv_event_t event); - - 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; - bool running = true; - }; - } - } -} diff --git a/src/DisplayApp/Screens/Gauge.cpp b/src/DisplayApp/Screens/Gauge.cpp deleted file mode 100644 index fd90523..0000000 --- a/src/DisplayApp/Screens/Gauge.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include "Gauge.h" -#include "../DisplayApp.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - - -Gauge::Gauge(Pinetime::Applications::DisplayApp *app) : Screen(app) { - /*Create a style*/ - lv_style_copy(&style, &lv_style_pretty_color); - style.body.main_color = LV_COLOR_CYAN; /*Line color at the beginning*/ - style.body.grad_color = LV_COLOR_RED; /*Line color at the end*/ - style.body.padding.left = 10; /*Scale line length*/ - style.body.padding.inner = 8 ; /*Scale label padding*/ - style.body.border.color = lv_color_hex3(0x333); /*Needle middle circle color*/ - style.line.width = 3; - style.text.color = LV_COLOR_WHITE; - style.line.color = LV_COLOR_RED; /*Line color after the critical value*/ - - - /*Describe the color for the needles*/ - - needle_colors[0] = LV_COLOR_ORANGE; - - /*Create a gauge*/ - gauge1 = lv_gauge_create(lv_scr_act(), NULL); - lv_gauge_set_style(gauge1, LV_GAUGE_STYLE_MAIN, &style); - lv_gauge_set_needle_count(gauge1, 1, needle_colors); - lv_obj_set_size(gauge1, 180, 180); - lv_obj_align(gauge1, NULL, LV_ALIGN_CENTER, 0, 0); - lv_gauge_set_scale(gauge1, 360, 60, 0); - lv_gauge_set_range(gauge1, 0, 59); - - /*Set the values*/ - lv_gauge_set_value(gauge1, 0, value); -} - -Gauge::~Gauge() { - - - lv_obj_clean(lv_scr_act()); -} - -bool Gauge::Refresh() { -// lv_lmeter_set_value(lmeter, value++); /*Set the current value*/ -// if(value>=60) value = 0; - - lv_gauge_set_value(gauge1, 0, value++); - if(value == 59) value = 0; - return running; -} - -bool Gauge::OnButtonPushed() { - running = false; - return true; -} diff --git a/src/DisplayApp/Screens/Gauge.h b/src/DisplayApp/Screens/Gauge.h deleted file mode 100644 index 03c06be..0000000 --- a/src/DisplayApp/Screens/Gauge.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class Gauge : public Screen{ - public: - Gauge(DisplayApp* app); - ~Gauge() override; - - bool Refresh() override; - bool OnButtonPushed() override; - - private: - lv_style_t style; - lv_color_t needle_colors[3]; - lv_obj_t * gauge1; - - uint32_t value=30; - bool running = true; - - }; - } - } -} diff --git a/src/DisplayApp/Screens/InfiniPaint.cpp b/src/DisplayApp/Screens/InfiniPaint.cpp deleted file mode 100644 index b340f5d..0000000 --- a/src/DisplayApp/Screens/InfiniPaint.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include "InfiniPaint.h" -#include "../DisplayApp.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - -InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp *app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl{lvgl} { - app->SetTouchMode(DisplayApp::TouchModes::Polling); - std::fill(b, b+bufferSize, LV_COLOR_WHITE); -} - -InfiniPaint::~InfiniPaint() { - // Reset the touchmode - app->SetTouchMode(DisplayApp::TouchModes::Gestures); - lv_obj_clean(lv_scr_act()); -} - -bool InfiniPaint::Refresh() { - return running; -} - -bool InfiniPaint::OnButtonPushed() { - running = false; - return true; -} - -bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - return true; -} - -bool InfiniPaint::OnTouchEvent(uint16_t x, uint16_t y) { - lv_area_t area; - area.x1 = x-(width/2); - area.y1 = y-(height/2); - area.x2 = x+(width/2)-1; - area.y2 = y+(height/2)-1; - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::None); - lvgl.FlushDisplay(&area, b); - return true; -} - diff --git a/src/DisplayApp/Screens/InfiniPaint.h b/src/DisplayApp/Screens/InfiniPaint.h deleted file mode 100644 index a1592f9..0000000 --- a/src/DisplayApp/Screens/InfiniPaint.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include -#include -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class InfiniPaint : public Screen{ - public: - InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl); - ~InfiniPaint() override; - - bool Refresh() override; - bool OnButtonPushed() override; - bool OnTouchEvent(TouchEvents event) override; - bool OnTouchEvent(uint16_t x, uint16_t y) override; - - private: - Pinetime::Components::LittleVgl& lvgl; - static constexpr uint16_t width = 10; - static constexpr uint16_t height = 10; - static constexpr uint16_t bufferSize = width*height; - lv_color_t b[bufferSize]; - bool running = true; - }; - } - } -} diff --git a/src/DisplayApp/Screens/Label.cpp b/src/DisplayApp/Screens/Label.cpp deleted file mode 100644 index 780ee88..0000000 --- a/src/DisplayApp/Screens/Label.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include "Label.h" - -using namespace Pinetime::Applications::Screens; - -Label::Label(Pinetime::Applications::DisplayApp *app, const char *text) : Screen(app), text{text} { - label = lv_label_create(lv_scr_act(), NULL); - lv_label_set_align(label, LV_LABEL_ALIGN_LEFT); - lv_obj_set_size(label, 240, 240); - lv_label_set_text(label, text); -} - -Label::~Label() { - lv_obj_clean(lv_scr_act()); -} diff --git a/src/DisplayApp/Screens/Label.h b/src/DisplayApp/Screens/Label.h deleted file mode 100644 index 3e7b379..0000000 --- a/src/DisplayApp/Screens/Label.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class Label : public Screen { - public: - Label(DisplayApp* app, const char* text); - ~Label() override; - bool Refresh() override {return false;} - - private: - lv_obj_t * label = nullptr; - const char* text = nullptr; - }; - } - } -} \ No newline at end of file diff --git a/src/DisplayApp/Screens/Meter.cpp b/src/DisplayApp/Screens/Meter.cpp deleted file mode 100644 index c74b8bd..0000000 --- a/src/DisplayApp/Screens/Meter.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include "Meter.h" -#include "../DisplayApp.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - - -Meter::Meter(Pinetime::Applications::DisplayApp *app) : Screen(app) { - - lv_style_copy(&style_lmeter, &lv_style_pretty_color); - style_lmeter.line.width = 2; - style_lmeter.line.color = LV_COLOR_SILVER; - style_lmeter.body.main_color = lv_color_make(255,0,0); - style_lmeter.body.grad_color = lv_color_make(160,0,0); - style_lmeter.body.padding.left = 16; /*Line length*/ - - /*Create a line meter */ - lmeter = lv_lmeter_create(lv_scr_act(), NULL); - lv_lmeter_set_range(lmeter, 0, 60); /*Set the range*/ - lv_lmeter_set_value(lmeter, value); /*Set the current value*/ - lv_lmeter_set_angle_offset(lmeter, 180); - lv_lmeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/ - lv_lmeter_set_style(lmeter, LV_LMETER_STYLE_MAIN, &style_lmeter); /*Apply the new style*/ - lv_obj_set_size(lmeter, 150, 150); - lv_obj_align(lmeter, NULL, LV_ALIGN_CENTER, 0, 0); - -} - -Meter::~Meter() { - - - lv_obj_clean(lv_scr_act()); -} - -bool Meter::Refresh() { - lv_lmeter_set_value(lmeter, value++); /*Set the current value*/ - if(value>=60) value = 0; - - return running; -} - -bool Meter::OnButtonPushed() { - running = false; - return true; -} diff --git a/src/DisplayApp/Screens/Meter.h b/src/DisplayApp/Screens/Meter.h deleted file mode 100644 index ddf8be8..0000000 --- a/src/DisplayApp/Screens/Meter.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class Meter : public Screen{ - public: - Meter(DisplayApp* app); - ~Meter() override; - - bool Refresh() override; - bool OnButtonPushed() override; - - private: - lv_style_t style_lmeter; - lv_obj_t * lmeter; - - uint32_t value=0; - bool running = true; - - }; - } - } -} diff --git a/src/DisplayApp/Screens/Modal.cpp b/src/DisplayApp/Screens/Modal.cpp deleted file mode 100644 index 63ae70c..0000000 --- a/src/DisplayApp/Screens/Modal.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include -#include "Modal.h" -#include "../DisplayApp.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - -Modal::Modal(Pinetime::Applications::DisplayApp *app) : Screen(app) { - - -} - -Modal::~Modal() { - lv_obj_clean(lv_scr_act()); -} - -bool Modal::Refresh() { - - return running; -} - -bool Modal::OnButtonPushed() { - running = false; - return true; -} - -void Modal::Hide() { - /* Delete the parent modal background */ - lv_obj_del_async(lv_obj_get_parent(mbox)); - mbox = NULL; /* happens before object is actually deleted! */ - isVisible = false; -} - -void Modal::mbox_event_cb(lv_obj_t *obj, lv_event_t evt) { - auto* m = static_cast(obj->user_data); - m->OnEvent(obj, evt); -} - -void Modal::OnEvent(lv_obj_t *event_obj, lv_event_t evt) { - if(evt == LV_EVENT_DELETE && event_obj == mbox) { - Hide(); - } else if(evt == LV_EVENT_VALUE_CHANGED) { - /* A button was clicked */ - lv_mbox_start_auto_close(mbox, 0); -// Hide(); - } -} - -void Modal::Show(const char* msg) { - if(isVisible) return; - isVisible = true; - lv_style_copy(&modal_style, &lv_style_plain_color); - modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK; - modal_style.body.opa = LV_OPA_50; - - obj = lv_obj_create(lv_scr_act(), NULL); - lv_obj_set_style(obj, &modal_style); - lv_obj_set_pos(obj, 0, 0); - lv_obj_set_size(obj, LV_HOR_RES, LV_VER_RES); - lv_obj_set_opa_scale_enable(obj, true); /* Enable opacity scaling for the animation */ - - static const char * btns2[] = {"Ok", ""}; - - /* Create the message box as a child of the modal background */ - mbox = lv_mbox_create(obj, NULL); - lv_mbox_add_btns(mbox, btns2); - lv_mbox_set_text(mbox, msg); - lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_set_event_cb(mbox, Modal::mbox_event_cb); - - mbox->user_data = this; - - /* Fade the message box in with an animation */ - lv_anim_t a; - lv_anim_init(&a); - lv_anim_set_time(&a, 500, 0); - lv_anim_set_values(&a, LV_OPA_TRANSP, LV_OPA_COVER); - lv_anim_set_exec_cb(&a, obj, (lv_anim_exec_xcb_t)lv_obj_set_opa_scale); - lv_anim_create(&a); -} diff --git a/src/DisplayApp/Screens/Modal.h b/src/DisplayApp/Screens/Modal.h deleted file mode 100644 index c616c29..0000000 --- a/src/DisplayApp/Screens/Modal.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class Modal : public Screen{ - public: - Modal(DisplayApp* app); - ~Modal() override; - - void Show(const char* msg); - void Hide(); - - bool Refresh() override; - bool OnButtonPushed() override; - - static void mbox_event_cb(lv_obj_t *obj, lv_event_t evt); - private: - void OnEvent(lv_obj_t *event_obj, lv_event_t evt); - - lv_style_t modal_style; - lv_obj_t *obj; - lv_obj_t *mbox; - lv_obj_t *info; - bool running = true; - bool isVisible = false; - - }; - } - } -} diff --git a/src/DisplayApp/Screens/Music.cpp b/src/DisplayApp/Screens/Music.cpp deleted file mode 100644 index 9b7d198..0000000 --- a/src/DisplayApp/Screens/Music.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#include -#include "Music.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - -static void event_handler(lv_obj_t * obj, lv_event_t event) -{ - Music* screen = static_cast(obj->user_data); - screen->OnObjectEvent(obj, event); -} - -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(), NULL); - btnVolDown->user_data = this; - lv_obj_set_event_cb(btnVolDown, event_handler); - lv_obj_align(btnVolDown, NULL, LV_ALIGN_IN_TOP_LEFT, 10, 10); - label = lv_label_create(btnVolDown, NULL); - lv_label_set_text(label, "v-"); - - btnVolUp = lv_btn_create(lv_scr_act(), NULL); - btnVolUp->user_data = this; - lv_obj_set_event_cb(btnVolUp, event_handler); - lv_obj_align(btnVolUp, NULL, LV_ALIGN_IN_TOP_RIGHT, -10, 10); - label = lv_label_create(btnVolUp, NULL); - lv_label_set_text(label, "v+"); - - btnPrev = lv_btn_create(lv_scr_act(), NULL); - btnPrev->user_data = this; - lv_obj_set_event_cb(btnPrev, event_handler); - lv_obj_set_size(btnPrev, LV_HOR_RES / 4, LV_VER_RES / 4); - lv_obj_align(btnPrev, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 10,-10); - label = lv_label_create(btnPrev, NULL); - lv_label_set_text(label, "<<"); - - btnPlayPause = lv_btn_create(lv_scr_act(), NULL); - btnPlayPause->user_data = this; - lv_obj_set_event_cb(btnPlayPause, event_handler); - lv_obj_set_size(btnPlayPause, LV_HOR_RES / 4, LV_VER_RES / 4); - lv_obj_align(btnPlayPause, NULL, LV_ALIGN_IN_BOTTOM_MID, 0,-10); - txtPlayPause = lv_label_create(btnPlayPause, NULL); - lv_label_set_text(txtPlayPause, ">"); - - btnNext = lv_btn_create(lv_scr_act(), NULL); - btnNext->user_data = this; - lv_obj_set_event_cb(btnNext, event_handler); - lv_obj_set_size(btnNext, LV_HOR_RES / 4, LV_VER_RES / 4); - lv_obj_align(btnNext, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -10,-10); - label = lv_label_create(btnNext, NULL); - lv_label_set_text(label, ">>"); - - txtArtist = lv_label_create(lv_scr_act(), NULL); - lv_label_set_long_mode(txtArtist, LV_LABEL_LONG_SROLL); - lv_obj_align(txtArtist, NULL, LV_ALIGN_IN_LEFT_MID, 0,-20); - lv_label_set_text(txtArtist, "Artist Name"); - lv_label_set_align(txtArtist, LV_LABEL_ALIGN_CENTER); - lv_obj_set_width(txtArtist, LV_HOR_RES); - - txtTrack = lv_label_create(lv_scr_act(), NULL); - lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_DOT); - lv_obj_align(txtTrack, NULL, LV_ALIGN_IN_LEFT_MID, 0,20); - lv_label_set_text(txtTrack, "This is a very long track name"); - lv_label_set_align(txtTrack, LV_LABEL_ALIGN_CENTER); - lv_obj_set_width(txtTrack, LV_HOR_RES); - - musicService.event(Controllers::MusicService::EVENT_MUSIC_OPEN); -} - -Music::~Music() { - lv_obj_clean(lv_scr_act()); -} - -bool Music::OnButtonPushed() { - running = false; - return true; -} - -bool Music::Refresh() { - - if (m_artist != musicService.artist()) { - m_artist = musicService.artist(); - lv_label_set_text(txtArtist, m_artist.data()); - } - if (m_track != musicService.track()) { - m_track = musicService.track(); - lv_label_set_text(txtTrack, m_track.data()); - } - if (m_album != musicService.album()) { - m_album = musicService.album(); - } - if (m_status != musicService.status()) { - m_status = musicService.status(); - } - if (m_status == Pinetime::Controllers::MusicService::STATUS_MUSIC_PLAYING) { - lv_label_set_text(txtPlayPause, "||"); - } else { - lv_label_set_text(txtPlayPause, ">"); - } - - return running; -} - -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); - } else if (obj == btnVolUp) { - musicService.event(Controllers::MusicService::EVENT_MUSIC_VOLUP); - } else if (obj == btnPrev) { - musicService.event(Controllers::MusicService::EVENT_MUSIC_PREV); - } else if (obj == btnPlayPause) { - if (m_status == Pinetime::Controllers::MusicService::STATUS_MUSIC_PLAYING) { - musicService.event(Controllers::MusicService::EVENT_MUSIC_PAUSE); - } else { - musicService.event(Controllers::MusicService::EVENT_MUSIC_PLAY); - } - } else if (obj == btnNext) { - musicService.event(Controllers::MusicService::EVENT_MUSIC_NEXT); - } - } -} diff --git a/src/DisplayApp/Screens/Music.h b/src/DisplayApp/Screens/Music.h deleted file mode 100644 index 95cac0f..0000000 --- a/src/DisplayApp/Screens/Music.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include -#include -#include -#include "Screen.h" -#include -#include -#include -#include -#include -#include "../../Version.h" -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class Music : public Screen{ - public: - Music(DisplayApp* app, Pinetime::Controllers::MusicService &music); - ~Music() override; - - bool Refresh() override; - bool OnButtonPushed() override; - - void OnObjectEvent(lv_obj_t* obj, lv_event_t event); - - private: - 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; - - bool running = true; - Pinetime::Controllers::MusicService &musicService; - std::string m_artist; - std::string m_album; - std::string m_track; - unsigned char m_status; - }; - } - } -} diff --git a/src/DisplayApp/Screens/Screen.cpp b/src/DisplayApp/Screens/Screen.cpp deleted file mode 100644 index 1467df3..0000000 --- a/src/DisplayApp/Screens/Screen.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "Screen.h" -using namespace Pinetime::Applications::Screens; \ No newline at end of file diff --git a/src/DisplayApp/Screens/Screen.h b/src/DisplayApp/Screens/Screen.h deleted file mode 100644 index dbf81a4..0000000 --- a/src/DisplayApp/Screens/Screen.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include -#include "../TouchEvents.h" - -namespace Pinetime { - namespace Applications { - class DisplayApp; - namespace Screens { - class Screen { - public: - Screen(DisplayApp* app) : app{app} {} - virtual ~Screen() = default; - - // 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 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; - }; - } - } -} diff --git a/src/DisplayApp/Screens/ScreenList.h b/src/DisplayApp/Screens/ScreenList.h deleted file mode 100644 index d873336..0000000 --- a/src/DisplayApp/Screens/ScreenList.h +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#include -#include -#include -#include "Screen.h" -#include "Label.h" - -namespace Pinetime { - namespace Applications { - namespace Screens { - template - class ScreenList : public Screen { - public: - ScreenList(DisplayApp* app, std::array()>, N>&& screens) - : Screen(app), screens{std::move(screens)}, current{this->screens[0]()} { - - } - - ~ScreenList() override { - - } - - bool Refresh() override { - running = current->Refresh(); - return running; - } - - bool OnButtonPushed() override { - running = false; - return true; - } - - bool OnTouchEvent(TouchEvents event) override { - switch (event) { - case TouchEvents::SwipeDown: - if (screenIndex > 0) { - current.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); - screenIndex--; - 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; - } - return false; - } - - private: - bool running = true; - uint8_t screenIndex = 0; - std::array()>, N> screens; - std::unique_ptr current; - }; - } - } -} \ No newline at end of file diff --git a/src/DisplayApp/Screens/Symbols.h b/src/DisplayApp/Screens/Symbols.h deleted file mode 100644 index aeea324..0000000 --- a/src/DisplayApp/Screens/Symbols.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -namespace Pinetime { - namespace Applications { - namespace Screens { - namespace Symbols { - static constexpr const char* none = ""; - static constexpr const char* batteryFull = "\xEF\x89\x80"; - static constexpr const char* batteryEmpty = "\xEF\x89\x84"; - static constexpr const char* batteryThreeQuarter = "\xEF\x89\x81"; - static constexpr const char* batteryHalf = "\xEF\x89\x82"; - static constexpr const char* batteryOneQuarter = "\xEF\x89\x83"; - static constexpr const char* heartBeat = "\xEF\x88\x9E"; - static constexpr const char* bluetoothFull = "\xEF\x8A\x93"; - static constexpr const char* bluetooth = "\xEF\x8A\x94"; - static constexpr const char* plug = "\xEF\x87\xA6"; - static constexpr const char* shoe = "\xEF\x95\x8B"; - static constexpr const char* clock = "\xEF\x80\x97"; - static constexpr const char* info = "\xEF\x84\xA9"; - static constexpr const char* list = "\xEF\x80\xBA"; - static constexpr const char* sun = "\xEF\x86\x85"; - static constexpr const char* check = "\xEF\x95\xA0"; - static constexpr const char* music = "\xEF\x80\x81"; - static constexpr const char* tachometer = "\xEF\x8F\xBD"; - static constexpr const char* asterisk = "\xEF\x81\xA9"; - static constexpr const char* paintbrush = "\xEF\x87\xBC"; - } - } - } -} \ No newline at end of file diff --git a/src/DisplayApp/Screens/SystemInfo.cpp b/src/DisplayApp/Screens/SystemInfo.cpp deleted file mode 100644 index fcafcf7..0000000 --- a/src/DisplayApp/Screens/SystemInfo.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include -#include -#include -#include "SystemInfo.h" -#include "../../Version.h" -#include "Tile.h" - -using namespace Pinetime::Applications::Screens; - -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, { - [this]() -> std::unique_ptr { return CreateScreen1(); }, - [this]() -> std::unique_ptr { return CreateScreen2(); }, - [this]() -> std::unique_ptr { return CreateScreen3(); } - } - } {} - - -SystemInfo::~SystemInfo() { - lv_obj_clean(lv_scr_act()); -} - -bool SystemInfo::Refresh() { - screens.Refresh(); - return running; -} - -bool SystemInfo::OnButtonPushed() { - running = false; - return true; -} - -bool SystemInfo::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - return screens.OnTouchEvent(event); -} - -std::unique_ptr SystemInfo::CreateScreen1() { - auto batteryPercentF = batteryController.PercentRemaining(); - uint16_t batteryPercent = 0; - if(batteryPercentF > 100.0f) batteryPercent = 100; - else if(batteryPercentF < 0.0f) batteryPercent = 0; - - uint8_t brightness = 0; - switch(brightnessController.Level()) { - case Controllers::BrightnessController::Levels::Off: brightness = 0; break; - case Controllers::BrightnessController::Levels::Low: brightness = 1; break; - case Controllers::BrightnessController::Levels::Medium: brightness = 2; break; - case Controllers::BrightnessController::Levels::High: brightness = 3; break; - } - 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 "?"; - } - }(); - - // uptime - 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); - uptimeSeconds = uptimeSeconds % secondsInADay; - uint32_t uptimeHours = uptimeSeconds / secondsInAnHour; - uptimeSeconds = uptimeSeconds % secondsInAnHour; - uint32_t uptimeMinutes = uptimeSeconds / secondsInAMinute; - uptimeSeconds = uptimeSeconds % secondsInAMinute; - // TODO handle more than 100 days of uptime - - sprintf(t1, "Pinetime\n" - "Version:%ld.%ld.%ld\n" - "Build: %s\n" - " %s\n" - "Date: %02d/%02d/%04d\n" - "Time: %02d:%02d:%02d\n" - "Uptime: %02lud %02lu:%02lu:%02lu\n" - "Battery: %d%%\n" - "Backlight: %d/3\n" - "Last reset: %s\n", - Version::Major(), Version::Minor(), Version::Patch(), - __DATE__, __TIME__, - dateTimeController.Day(), static_cast(dateTimeController.Month()), dateTimeController.Year(), - dateTimeController.Hours(), dateTimeController.Minutes(), dateTimeController.Seconds(), - uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds, - batteryPercent, brightness, resetReason); - - return std::unique_ptr(new Screens::Label(app, t1)); -} - -std::unique_ptr SystemInfo::CreateScreen2() { - auto& bleAddr = bleController.Address(); - sprintf(t2, "BLE MAC: \n %2x:%2x:%2x:%2x:%2x:%2x", - bleAddr[5], bleAddr[4], bleAddr[3], bleAddr[2], bleAddr[1], bleAddr[0]); - return std::unique_ptr(new Screens::Label(app, t2)); -} - -std::unique_ptr SystemInfo::CreateScreen3() { - strncpy(t3, "Hello from\nthe developper!", 27); - return std::unique_ptr(new Screens::Label(app, t3)); -} diff --git a/src/DisplayApp/Screens/SystemInfo.h b/src/DisplayApp/Screens/SystemInfo.h deleted file mode 100644 index ac8abae..0000000 --- a/src/DisplayApp/Screens/SystemInfo.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include "Label.h" -#include "ScreenList.h" -#include "Gauge.h" -#include "Meter.h" -#include - -namespace Pinetime { - namespace Applications { - 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; - - Pinetime::Controllers::DateTime& dateTimeController; - Pinetime::Controllers::Battery& batteryController; - Pinetime::Controllers::BrightnessController& brightnessController; - Pinetime::Controllers::Ble& bleController; - Pinetime::Drivers::WatchdogView& watchdog; - - char t1[200]; - char t2[200]; - char t3[30]; - - ScreenList<3> screens; - std::unique_ptr CreateScreen1(); - std::unique_ptr CreateScreen2(); - std::unique_ptr CreateScreen3(); - }; - } - } -} \ No newline at end of file diff --git a/src/DisplayApp/Screens/Tab.cpp b/src/DisplayApp/Screens/Tab.cpp deleted file mode 100644 index adc3257..0000000 --- a/src/DisplayApp/Screens/Tab.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "Tab.h" -#include - - -using namespace Pinetime::Applications::Screens; - -extern lv_font_t jetbrains_mono_bold_20; - -//static void event_handler(lv_obj_t * obj, lv_event_t event) { -// Tile* screen = static_cast(obj->user_data); -// screen->OnObjectEvent(obj, event); -//} - -Tab::Tab(DisplayApp* app, Pinetime::Components::Gfx &gfx) : Screen(app, gfx) { -/*Create a Tab view object*/ - lv_obj_t *tabview; - tabview = lv_tabview_create(lv_scr_act(), NULL); - - /*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/ - lv_obj_t *tab1 = lv_tabview_add_tab(tabview, "Tab 1"); - lv_obj_t *tab2 = lv_tabview_add_tab(tabview, "Tab 2"); - lv_obj_t *tab3 = lv_tabview_add_tab(tabview, "Tab 3"); - - - /*Add content to the tabs*/ - lv_obj_t * label = lv_label_create(tab1, NULL); - lv_label_set_text(label, "This the first tab\n\n" - "If the content\n" - "of a tab\n" - "become too long\n" - "the it \n" - "automatically\n" - "become\n" - "scrollable."); - - label = lv_label_create(tab2, NULL); - lv_label_set_text(label, "Second tab"); - - label = lv_label_create(tab3, NULL); - lv_label_set_text(label, "Third tab"); - -} - -Tab::~Tab() { - lv_obj_clean(lv_scr_act()); -} - -void Tab::Refresh(bool fullRefresh) { - -} - -void Tab::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { - if(event == LV_EVENT_CLICKED) { - NRF_LOG_INFO("Clicked"); - } - else if(event == LV_EVENT_VALUE_CHANGED) { - NRF_LOG_INFO("Toggled"); - } -} diff --git a/src/DisplayApp/Screens/Tab.h b/src/DisplayApp/Screens/Tab.h deleted file mode 100644 index e16dbb9..0000000 --- a/src/DisplayApp/Screens/Tab.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - class Tab : public Screen { - public: - explicit Tab(DisplayApp* app, Components::Gfx& gfx); - ~Tab() override; - void Refresh(bool fullRefresh) override; - void OnObjectEvent(lv_obj_t* obj, lv_event_t event); - - private: - - }; - } - } -} diff --git a/src/DisplayApp/Screens/Tile.cpp b/src/DisplayApp/Screens/Tile.cpp deleted file mode 100644 index 1447d78..0000000 --- a/src/DisplayApp/Screens/Tile.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include -#include -#include "Tile.h" -#include -#include "Symbols.h" -#include "../../Version.h" - -using namespace Pinetime::Applications::Screens; - -extern lv_font_t jetbrains_mono_bold_20; - -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(DisplayApp* app, std::array& applications) : Screen(app) { - for(int i = 0, appIndex = 0; i < 8; i++) { - if(i == 3) btnm_map1[i] = "\n"; - else if(i == 7) btnm_map1[i] = ""; - else { - btnm_map1[i] = applications[appIndex].icon; - apps[appIndex] = applications[appIndex].application; - appIndex++; - } - } - modal.reset(new Modal(app)); - - btnm1 = lv_btnm_create(lv_scr_act(), NULL); - lv_btnm_set_map(btnm1, btnm_map1); - lv_obj_set_size(btnm1, LV_HOR_RES, LV_VER_RES); - - btnm1->user_data = this; - lv_obj_set_event_cb(btnm1, event_handler); -} - -Tile::~Tile() { - lv_obj_clean(lv_scr_act()); -} - -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) { - app->StartApp(apps[buttonId]); - running = false; - } -} - -bool Tile::OnButtonPushed() { - app->StartApp(Apps::Clock); - running = false; - return true; -} - - diff --git a/src/DisplayApp/Screens/Tile.h b/src/DisplayApp/Screens/Tile.h deleted file mode 100644 index 3136d89..0000000 --- a/src/DisplayApp/Screens/Tile.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include -#include "Modal.h" -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - class Tile : public Screen { - public: - struct Applications { - const char* icon; - Pinetime::Applications::Apps application; - }; - - explicit Tile(DisplayApp* app, std::array& applications); - ~Tile() override; - - bool Refresh() override; - bool OnButtonPushed() override; - - void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId); - - private: - lv_obj_t * btnm1; - bool running = true; - - std::unique_ptr modal; - - const char* btnm_map1[8]; - Pinetime::Applications::Apps apps[6]; - }; - } - } -} diff --git a/src/DisplayApp/TouchEvents.h b/src/DisplayApp/TouchEvents.h deleted file mode 100644 index cf2f88d..0000000 --- a/src/DisplayApp/TouchEvents.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -namespace Pinetime { - namespace Applications { - - enum class TouchEvents { None, Tap, SwipeLeft, SwipeRight, SwipeUp, SwipeDown, LongTap, DoubleTap}; - } -} \ No newline at end of file diff --git a/src/displayapp/Apps.h b/src/displayapp/Apps.h new file mode 100644 index 0000000..3842e4e --- /dev/null +++ b/src/displayapp/Apps.h @@ -0,0 +1,7 @@ +#pragma once + +namespace Pinetime { + namespace Applications { + enum class Apps {None, Launcher, Clock, SysInfo, Meter, Gauge, Brightness, Music, FirmwareValidation, Paint}; + } +} \ No newline at end of file diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp new file mode 100644 index 0000000..46e81f1 --- /dev/null +++ b/src/displayapp/DisplayApp.cpp @@ -0,0 +1,271 @@ +#include "DisplayApp.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../SystemTask/SystemTask.h" + +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, + Pinetime::Controllers::NotificationManager& notificationManager) : + lcd{lcd}, + lvgl{lvgl}, + batteryController{batteryController}, + bleController{bleController}, + dateTimeController{dateTimeController}, + watchdog{watchdog}, + touchPanel{touchPanel}, + currentScreen{new Screens::Clock(this, dateTimeController, batteryController, bleController) }, + systemTask{systemTask}, + notificationManager{notificationManager} { + msgQueue = xQueueCreate(queueSize, itemSize); + onClockApp = true; + modal.reset(new Screens::Modal(this)); +} + +void DisplayApp::Start() { + if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 512, this, 0, &taskHandle)) + APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); +} + +void DisplayApp::Process(void *instance) { + auto *app = static_cast(instance); + NRF_LOG_INFO("displayapp task started!"); + app->InitHw(); + + // Send a dummy notification to unlock the lvgl display driver for the first iteration + xTaskNotifyGive(xTaskGetCurrentTaskHandle()); + + while (1) { + + app->Refresh(); + + } +} + +void DisplayApp::InitHw() { + brightnessController.Init(); +} + +uint32_t acc = 0; +uint32_t count = 0; +bool toggle = true; +void DisplayApp::Refresh() { + TickType_t queueTimeout; + switch (state) { + case States::Idle: + IdleState(); + queueTimeout = portMAX_DELAY; + break; + case States::Running: + RunningState(); + queueTimeout = 20; + break; + default: + queueTimeout = portMAX_DELAY; + break; + } + + Messages msg; + if (xQueueReceive(msgQueue, &msg, queueTimeout)) { + switch (msg) { + case Messages::GoToSleep: + brightnessController.Backup(); + while(brightnessController.Level() != Controllers::BrightnessController::Levels::Off) { + brightnessController.Lower(); + vTaskDelay(100); + } + lcd.DisplayOff(); + systemTask.PushMessage(System::SystemTask::Messages::OnDisplayTaskSleeping); + state = States::Idle; + break; + case Messages::GoToRunning: + lcd.DisplayOn(); + brightnessController.Restore(); + state = States::Running; + break; + case Messages::UpdateDateTime: +// modal->Show(); + break; + case Messages::UpdateBleConnection: +// clockScreen.SetBleConnectionState(bleController.IsConnected() ? Screens::Clock::BleConnectionStates::Connected : Screens::Clock::BleConnectionStates::NotConnected); + break; + case Messages::UpdateBatteryLevel: +// clockScreen.SetBatteryPercentRemaining(batteryController.PercentRemaining()); + break; + case Messages::NewNotification: { + auto notification = notificationManager.Pop(); + modal->Show(notification.message.data()); + } + break; + case Messages::TouchEvent: { + if (state != States::Running) break; + auto gesture = OnTouchEvent(); + if(!currentScreen->OnTouchEvent(gesture)) { + switch (gesture) { + case TouchEvents::SwipeUp: + currentScreen->OnButtonPushed(); + lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up); + break; + case TouchEvents::SwipeDown: + currentScreen->OnButtonPushed(); + lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down); + break; + default: + break; + } + } + } + break; + case Messages::ButtonPushed: + if(onClockApp) + systemTask.PushMessage(System::SystemTask::Messages::GoToSleep); + else { + auto buttonUsedByApp = currentScreen->OnButtonPushed(); + if (!buttonUsedByApp) { + systemTask.PushMessage(System::SystemTask::Messages::GoToSleep); + } else { + lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up); + } + } + +// lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down); +// currentScreen.reset(nullptr); +// if(toggle) { +// currentScreen.reset(new Screens::Tile(this)); +// toggle = false; +// } else { +// currentScreen.reset(new Screens::Clock(this, dateTimeController, batteryController, bleController)); +// toggle = true; +// } + + break; + case Messages::BleFirmwareUpdateStarted: + lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down); + currentScreen.reset(nullptr); + currentScreen.reset(new Screens::FirmwareUpdate(this, bleController)); + onClockApp = false; + + break; + } + } + + if(state != States::Idle && touchMode == TouchModes::Polling) { + auto info = touchPanel.GetTouchInfo(); + if(info.action == 2) {// 2 = contact + if(!currentScreen->OnTouchEvent(info.x, info.y)) { + lvgl.SetNewTapEvent(info.x, info.y); + } + } + } +} + +void DisplayApp::RunningState() { +// clockScreen.SetCurrentDateTime(dateTimeController.CurrentDateTime()); + + if(!currentScreen->Refresh()) { + currentScreen.reset(nullptr); + lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up); + onClockApp = false; + switch(nextApp) { + case Apps::None: + case Apps::Launcher: currentScreen.reset(new Screens::ApplicationList(this)); break; + case Apps::Clock: + currentScreen.reset(new Screens::Clock(this, dateTimeController, batteryController, bleController)); + onClockApp = true; + break; +// case Apps::Test: currentScreen.reset(new Screens::Message(this)); break; + case Apps::SysInfo: currentScreen.reset(new Screens::SystemInfo(this, dateTimeController, batteryController, brightnessController, bleController, watchdog)); break; + case Apps::Meter: currentScreen.reset(new Screens::Meter(this)); break; + case Apps::Gauge: currentScreen.reset(new Screens::Gauge(this)); break; + case Apps::Paint: currentScreen.reset(new Screens::InfiniPaint(this, lvgl)); break; + case Apps::Brightness : currentScreen.reset(new Screens::Brightness(this, brightnessController)); break; + case Apps::Music : currentScreen.reset(new Screens::Music(this, systemTask.nimble().music())); break; + case Apps::FirmwareValidation: currentScreen.reset(new Screens::FirmwareValidation(this, validator)); break; + } + nextApp = Apps::None; + } + lv_task_handler(); +} + +void DisplayApp::IdleState() { + +} + +void DisplayApp::PushMessage(DisplayApp::Messages msg) { + BaseType_t xHigherPriorityTaskWoken; + xHigherPriorityTaskWoken = pdFALSE; + xQueueSendFromISR(msgQueue, &msg, &xHigherPriorityTaskWoken); + if (xHigherPriorityTaskWoken) { + /* Actual macro used here is port specific. */ + // TODO : should I do something here? + } +} + +TouchEvents DisplayApp::OnTouchEvent() { + auto info = touchPanel.GetTouchInfo(); + if(info.isTouch) { + switch(info.gesture) { + case Pinetime::Drivers::Cst816S::Gestures::SingleTap: + if(touchMode == TouchModes::Gestures) + lvgl.SetNewTapEvent(info.x, info.y); + return TouchEvents::Tap; + case Pinetime::Drivers::Cst816S::Gestures::LongPress: + return TouchEvents::LongTap; + case Pinetime::Drivers::Cst816S::Gestures::DoubleTap: + return TouchEvents::DoubleTap; + case Pinetime::Drivers::Cst816S::Gestures::SlideRight: + return TouchEvents::SwipeRight; + case Pinetime::Drivers::Cst816S::Gestures::SlideLeft: + return TouchEvents::SwipeLeft; + case Pinetime::Drivers::Cst816S::Gestures::SlideDown: + return TouchEvents::SwipeDown; + case Pinetime::Drivers::Cst816S::Gestures::SlideUp: + return TouchEvents::SwipeUp; + case Pinetime::Drivers::Cst816S::Gestures::None: + default: + return TouchEvents::None; + } + } + return TouchEvents::None; +} + +void DisplayApp::StartApp(Apps app) { + nextApp = app; +} + +void DisplayApp::SetFullRefresh(DisplayApp::FullRefreshDirections direction) { + switch(direction){ + case DisplayApp::FullRefreshDirections::Down: + lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down); + break; + case DisplayApp::FullRefreshDirections::Up: + lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up); + break; + default: break; + } + +} + +void DisplayApp::SetTouchMode(DisplayApp::TouchModes mode) { + touchMode = mode; +} diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h new file mode 100644 index 0000000..345e06d --- /dev/null +++ b/src/displayapp/DisplayApp.h @@ -0,0 +1,92 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../drivers/Cst816s.h" +#include "LittleVgl.h" +#include +#include +#include +#include +#include +#include +#include "TouchEvents.h" +#include "Apps.h" + + +namespace Pinetime { + namespace System { + class SystemTask; + }; + namespace Applications { + class DisplayApp { + public: + enum class States {Idle, Running}; + enum class Messages : uint8_t {GoToSleep, GoToRunning, UpdateDateTime, UpdateBleConnection, UpdateBatteryLevel, TouchEvent, ButtonPushed, + NewNotification, BleFirmwareUpdateStarted }; + + enum class FullRefreshDirections { None, Up, Down }; + 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); + void Start(); + void PushMessage(Messages msg); + + void StartApp(Apps app); + + void SetFullRefresh(FullRefreshDirections direction); + void SetTouchMode(TouchModes mode); + + private: + TaskHandle_t taskHandle; + static void Process(void* instance); + void InitHw(); + Pinetime::Drivers::St7789& lcd; + Pinetime::Components::LittleVgl& lvgl; + void Refresh(); + + States state = States::Running; + void RunningState(); + void IdleState(); + QueueHandle_t msgQueue; + + static constexpr uint8_t queueSize = 10; + static constexpr uint8_t itemSize = 1; + + Pinetime::Controllers::Battery &batteryController; + Pinetime::Controllers::Ble &bleController; + Pinetime::Controllers::DateTime& dateTimeController; + Pinetime::Drivers::WatchdogView& watchdog; + + Pinetime::Drivers::Cst816S& touchPanel; + TouchEvents OnTouchEvent(); + + std::unique_ptr currentScreen; + + bool isClock = true; + + Pinetime::System::SystemTask& systemTask; + Apps nextApp = Apps::None; + bool onClockApp = false; // TODO find a better way to know that we should handle gestures and button differently for the Clock app. + Controllers::BrightnessController brightnessController; + std::unique_ptr modal; + Pinetime::Controllers::NotificationManager& notificationManager; + Pinetime::Controllers::FirmwareValidator validator; + TouchModes touchMode = TouchModes::Gestures; + }; + } +} + + diff --git a/src/displayapp/Fonts/Readme.md b/src/displayapp/Fonts/Readme.md new file mode 100644 index 0000000..7ebf2e2 --- /dev/null +++ b/src/displayapp/Fonts/Readme.md @@ -0,0 +1,23 @@ +#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.woff` and specify the following range : `0x20-0x7f` + * 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` + * 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 + * 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"; +``` diff --git a/src/displayapp/Fonts/jetbrains_mono_bold_20.c b/src/displayapp/Fonts/jetbrains_mono_bold_20.c new file mode 100644 index 0000000..27ad005 --- /dev/null +++ b/src/displayapp/Fonts/jetbrains_mono_bold_20.c @@ -0,0 +1,766 @@ +#include "lvgl/lvgl.h" + +/******************************************************************************* + * Size: 20 px + * Bpp: 1 + * Opts: + ******************************************************************************/ + +#ifndef JETBRAINS_MONO_BOLD_20 +#define JETBRAINS_MONO_BOLD_20 1 +#endif + +#if JETBRAINS_MONO_BOLD_20 + +/*----------------- + * BITMAPS + *----------------*/ + +/*Store the image of the glyphs*/ +static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { + /* U+20 " " */ + 0x0, + + /* U+21 "!" */ + 0xff, 0xff, 0xff, 0xe0, 0xf, 0xc0, + + /* U+22 "\"" */ + 0xef, 0xdf, 0xbf, 0x7e, 0xfd, 0xc0, + + /* U+23 "#" */ + 0x8, 0xc3, 0x10, 0x62, 0x3f, 0xf7, 0xfe, 0x23, + 0x4, 0x61, 0x88, 0x31, 0x1f, 0xfb, 0xff, 0x19, + 0x82, 0x30, 0xc4, 0x0, + + /* U+24 "$" */ + 0x8, 0x2, 0x1, 0xc1, 0xfe, 0xeb, 0xf2, 0x7c, + 0x83, 0xa0, 0x7c, 0xf, 0xc0, 0xf8, 0x27, 0x9, + 0xf2, 0x7f, 0xf9, 0xfc, 0x8, 0x2, 0x0, 0x80, + + /* U+25 "%" */ + 0x78, 0x1f, 0x83, 0x30, 0x66, 0x1f, 0xcc, 0xf2, + 0x1, 0x80, 0xde, 0x67, 0xf8, 0xcc, 0x19, 0x83, + 0x30, 0x7e, 0x7, 0x80, + + /* U+26 "&" */ + 0x1e, 0x7, 0xe1, 0xce, 0x38, 0x7, 0x0, 0x70, + 0x1e, 0x7, 0x66, 0xed, 0xdc, 0xf3, 0x9c, 0x73, + 0xcf, 0xfc, 0xf9, 0x80, + + /* U+27 "'" */ + 0xff, 0xff, 0xc0, + + /* U+28 "(" */ + 0x2, 0x1c, 0xfb, 0xc7, 0x1e, 0x38, 0x70, 0xe1, + 0xc3, 0x87, 0xe, 0x1c, 0x3c, 0x38, 0x38, 0x7c, + 0x38, + + /* U+29 ")" */ + 0x1, 0xc3, 0xc1, 0xc1, 0xc3, 0xc3, 0x87, 0xe, + 0x1c, 0x38, 0x70, 0xe1, 0xc7, 0x8e, 0x79, 0xe3, + 0x80, + + /* U+2A "*" */ + 0xc, 0x3, 0x8, 0xc7, 0xb7, 0x7f, 0x83, 0x1, + 0xe0, 0xcc, 0x73, 0x80, 0x0, + + /* U+2B "+" */ + 0x1c, 0x7, 0x1, 0xc3, 0xff, 0xff, 0xc7, 0x1, + 0xc0, 0x70, 0x1c, 0x0, + + /* U+2C "," */ + 0x7b, 0x9c, 0xce, 0x60, + + /* U+2D "-" */ + 0xff, 0xff, + + /* U+2E "." */ + 0x6f, 0xf6, + + /* U+2F "/" */ + 0x1, 0xc0, 0x60, 0x38, 0xe, 0x3, 0x1, 0xc0, + 0x70, 0x18, 0xe, 0x3, 0x1, 0xc0, 0x70, 0x18, + 0xe, 0x3, 0x80, 0xc0, 0x70, 0x18, 0xe, 0x0, + + /* U+30 "0" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xed, 0xfb, 0x7e, + 0xdf, 0xb7, 0xed, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0x80, + + /* U+31 "1" */ + 0x3c, 0x3e, 0x3f, 0x13, 0x81, 0xc0, 0xe0, 0x70, + 0x38, 0x1c, 0xe, 0x7, 0x3, 0x8f, 0xff, 0xfc, + + /* U+32 "2" */ + 0x1f, 0x1f, 0xef, 0x3f, 0x87, 0x1, 0xc0, 0x70, + 0x38, 0x1e, 0xf, 0x7, 0x87, 0x83, 0xc0, 0xff, + 0xff, 0xf0, + + /* U+33 "3" */ + 0x7f, 0xdf, 0xf0, 0x3c, 0x1c, 0x1c, 0x7, 0xc1, + 0xf8, 0xf, 0x1, 0xc0, 0x7e, 0x1d, 0x8f, 0x7f, + 0x87, 0xc0, + + /* U+34 "4" */ + 0x7, 0x7, 0x3, 0x83, 0x83, 0x81, 0xc1, 0xcf, + 0xe7, 0xe3, 0xff, 0xff, 0xe0, 0x70, 0x38, 0x1c, + + /* U+35 "5" */ + 0xff, 0x7f, 0xb8, 0x1c, 0xe, 0x7, 0x73, 0xfd, + 0xcf, 0x3, 0x81, 0xc0, 0xfc, 0xff, 0xf1, 0xf0, + + /* U+36 "6" */ + 0x6, 0x3, 0x1, 0xc0, 0x60, 0x30, 0x1b, 0xc7, + 0xfb, 0xcf, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x87, 0x80, + + /* U+37 "7" */ + 0xff, 0xff, 0xfe, 0xb, 0x86, 0x1, 0x80, 0xc0, + 0x30, 0x18, 0x6, 0x3, 0x80, 0xc0, 0x70, 0x18, + 0xe, 0x0, + + /* U+38 "8" */ + 0x3e, 0x1f, 0xce, 0x3b, 0x6, 0xe3, 0x9f, 0xc7, + 0xf1, 0x8e, 0xc1, 0xf0, 0x7c, 0x1f, 0x8f, 0x7f, + 0x8f, 0x80, + + /* U+39 "9" */ + 0x1e, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, + 0x3d, 0xfe, 0x3d, 0x80, 0xc0, 0x60, 0x38, 0xc, + 0x6, 0x0, + + /* U+3A ":" */ + 0xff, 0x80, 0x0, 0xff, 0x80, + + /* U+3B ";" */ + 0x7b, 0xde, 0x0, 0x0, 0x0, 0x7b, 0x9c, 0xce, + 0x60, + + /* U+3C "<" */ + 0x0, 0x81, 0xc3, 0xe7, 0xcf, 0x6, 0x3, 0xc0, + 0x7c, 0xf, 0x81, 0xc0, 0x20, + + /* U+3D "=" */ + 0xff, 0xff, 0xc0, 0x0, 0x0, 0x7, 0xff, 0xfe, + + /* U+3E ">" */ + 0x0, 0x70, 0x3e, 0x7, 0xc0, 0xf8, 0xc, 0x1e, + 0x7c, 0xf8, 0x70, 0x20, 0x0, + + /* U+3F "?" */ + 0xfc, 0xfe, 0xf, 0x7, 0x7, 0xf, 0x3e, 0x3c, + 0x30, 0x30, 0x0, 0x0, 0x70, 0x70, + + /* U+40 "@" */ + 0x1f, 0x87, 0xf9, 0xc3, 0xf0, 0x3c, 0x77, 0x9f, + 0xf3, 0x1e, 0x63, 0xcc, 0x79, 0x8f, 0x31, 0xe7, + 0xfc, 0x77, 0xc0, 0x1c, 0x1, 0xf0, 0x1e, 0x0, + + /* U+41 "A" */ + 0xf, 0x0, 0xf0, 0xf, 0x1, 0xf8, 0x19, 0x81, + 0x98, 0x19, 0x83, 0x9c, 0x3f, 0xc3, 0xfc, 0x70, + 0xe7, 0xe, 0x60, 0x66, 0x6, + + /* U+42 "B" */ + 0xfe, 0x3f, 0xce, 0x3b, 0x8e, 0xe3, 0xb8, 0xcf, + 0xe3, 0xfc, 0xe3, 0xb8, 0x7e, 0x1f, 0x8f, 0xff, + 0xbf, 0xc0, + + /* U+43 "C" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe0, 0x38, 0xe, + 0x3, 0x80, 0xe0, 0x38, 0xe, 0x1f, 0xcf, 0x7f, + 0x8f, 0xc0, + + /* U+44 "D" */ + 0xfe, 0x3f, 0xee, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0x8f, 0xff, + 0xbf, 0x80, + + /* U+45 "E" */ + 0xff, 0xff, 0xf8, 0x1c, 0xe, 0x7, 0x3, 0xfd, + 0xfe, 0xe0, 0x70, 0x38, 0x1c, 0xf, 0xff, 0xfc, + + /* U+46 "F" */ + 0xff, 0xff, 0xf8, 0x1c, 0xe, 0x7, 0x3, 0xff, + 0xff, 0xe0, 0x70, 0x38, 0x1c, 0xe, 0x7, 0x0, + + /* U+47 "G" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe0, 0x38, 0xe, + 0x7f, 0x9f, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x87, 0x80, + + /* U+48 "H" */ + 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0xff, + 0xff, 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1c, + + /* U+49 "I" */ + 0xff, 0xff, 0xc7, 0x3, 0x81, 0xc0, 0xe0, 0x70, + 0x38, 0x1c, 0xe, 0x7, 0x3, 0x8f, 0xff, 0xfc, + + /* U+4A "J" */ + 0x3f, 0xcf, 0xf0, 0x1c, 0x7, 0x1, 0xc0, 0x70, + 0x1c, 0x7, 0x1, 0xc0, 0x7e, 0x1f, 0x8f, 0x7f, + 0x8f, 0xc0, + + /* U+4B "K" */ + 0xe1, 0xdc, 0x3b, 0x8e, 0x71, 0xce, 0x31, 0xce, + 0x3f, 0x87, 0xf0, 0xe7, 0x1c, 0x63, 0x8e, 0x70, + 0xce, 0x1d, 0xc3, 0x80, + + /* U+4C "L" */ + 0xe0, 0x70, 0x38, 0x1c, 0xe, 0x7, 0x3, 0x81, + 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0xf, 0xff, 0xfc, + + /* U+4D "M" */ + 0xe1, 0xf8, 0x7f, 0x3f, 0xcf, 0xda, 0xf7, 0xbd, + 0xef, 0x33, 0xc0, 0xf0, 0x3c, 0xf, 0x3, 0xc0, + 0xf0, 0x30, + + /* U+4E "N" */ + 0xe1, 0xf0, 0xfc, 0x7e, 0x3d, 0x9e, 0xcf, 0x67, + 0x9b, 0xcd, 0xe6, 0xf1, 0xf8, 0xfc, 0x3e, 0x1c, + + /* U+4F "O" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0x80, + + /* U+50 "P" */ + 0xff, 0x3f, 0xee, 0x3f, 0x87, 0xe1, 0xf8, 0xff, + 0xfb, 0xfc, 0xe0, 0x38, 0xe, 0x3, 0x80, 0xe0, + 0x38, 0x0, + + /* U+51 "Q" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0x80, 0x70, 0xe, 0x1, 0xc0, + + /* U+52 "R" */ + 0xff, 0x3f, 0xee, 0x3f, 0x87, 0xe1, 0xf8, 0xff, + 0xfb, 0xf8, 0xe6, 0x39, 0xce, 0x33, 0x8e, 0xe3, + 0xb8, 0x70, + + /* U+53 "S" */ + 0x3f, 0x1f, 0xee, 0x1f, 0x87, 0xe0, 0x3e, 0x7, + 0xf0, 0x7e, 0x3, 0xc0, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0xc0, + + /* U+54 "T" */ + 0xff, 0xff, 0xf0, 0xe0, 0x38, 0xe, 0x3, 0x80, + 0xe0, 0x38, 0xe, 0x3, 0x80, 0xe0, 0x38, 0xe, + 0x3, 0x80, + + /* U+55 "U" */ + 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, + 0xc7, 0xe3, 0xf1, 0xf8, 0xfc, 0x77, 0xf1, 0xf0, + + /* U+56 "V" */ + 0x60, 0x66, 0x6, 0x70, 0xe7, 0xe, 0x30, 0xc3, + 0xc, 0x39, 0xc1, 0x98, 0x19, 0x81, 0x98, 0x1f, + 0x80, 0xf0, 0xf, 0x0, 0xf0, + + /* U+57 "W" */ + 0xc6, 0x78, 0xcf, 0x39, 0xe7, 0x3e, 0xa6, 0xd6, + 0xda, 0xdb, 0x5b, 0x6b, 0x6d, 0x2d, 0xe7, 0x3c, + 0xe7, 0x9c, 0xe3, 0x80, + + /* U+58 "X" */ + 0xe1, 0xd8, 0x67, 0x38, 0xcc, 0x3f, 0x7, 0x81, + 0xe0, 0x78, 0x1e, 0xf, 0xc3, 0x31, 0xce, 0xe1, + 0xf8, 0x70, + + /* U+59 "Y" */ + 0xe0, 0xfc, 0x1d, 0xc7, 0x38, 0xe3, 0x98, 0x77, + 0x6, 0xc0, 0xf8, 0xe, 0x1, 0xc0, 0x38, 0x7, + 0x0, 0xe0, 0x1c, 0x0, + + /* U+5A "Z" */ + 0xff, 0xff, 0xc0, 0xe0, 0xe0, 0x60, 0x70, 0x70, + 0x38, 0x38, 0x38, 0x1c, 0x1c, 0xf, 0xff, 0xfc, + + /* U+5B "[" */ + 0xff, 0xfe, 0x38, 0xe3, 0x8e, 0x38, 0xe3, 0x8e, + 0x38, 0xe3, 0x8e, 0x38, 0xff, 0xf0, + + /* U+5C "\\" */ + 0xe0, 0x18, 0x7, 0x1, 0xc0, 0x30, 0xe, 0x3, + 0x80, 0x60, 0x1c, 0x3, 0x0, 0xe0, 0x38, 0x6, + 0x1, 0xc0, 0x70, 0xc, 0x3, 0x80, 0x60, 0x1c, + + /* U+5D "]" */ + 0xff, 0xf1, 0xc7, 0x1c, 0x71, 0xc7, 0x1c, 0x71, + 0xc7, 0x1c, 0x71, 0xc7, 0xff, 0xf0, + + /* U+5E "^" */ + 0xc, 0x7, 0x81, 0xe0, 0xfc, 0x33, 0x1c, 0xe6, + 0x19, 0x86, + + /* U+5F "_" */ + 0xff, 0xff, 0xf0, + + /* U+60 "`" */ + 0x63, 0x8e, + + /* U+61 "a" */ + 0x3f, 0x1f, 0xee, 0x1c, 0x7, 0x3f, 0xdf, 0xfe, + 0x1f, 0x87, 0xe3, 0xff, 0xf7, 0xdc, + + /* U+62 "b" */ + 0xe0, 0x38, 0xe, 0x3, 0xbc, 0xff, 0xbc, 0xfe, + 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0xff, + 0xbb, 0xc0, + + /* U+63 "c" */ + 0x3f, 0x1f, 0xef, 0x1f, 0x83, 0xe0, 0x38, 0xe, + 0x3, 0x87, 0xf1, 0xdf, 0xe3, 0xe0, + + /* U+64 "d" */ + 0x1, 0xc0, 0x70, 0x1c, 0xf7, 0x7f, 0xfc, 0xfe, + 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0xcf, 0x70, + + /* U+65 "e" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xff, 0xff, 0xfe, + 0x3, 0x80, 0xf1, 0xdf, 0xe3, 0xf0, + + /* U+66 "f" */ + 0xf, 0xc7, 0xf1, 0xc0, 0x70, 0xff, 0xff, 0xf1, + 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0x1c, + 0x7, 0x0, + + /* U+67 "g" */ + 0x3d, 0xdf, 0xff, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0xcf, 0x7f, 0xcf, 0x70, 0x1c, 0xf, 0x3f, + 0x8f, 0xc0, + + /* U+68 "h" */ + 0xe0, 0x70, 0x38, 0x1d, 0xcf, 0xf7, 0x9f, 0x8f, + 0xc7, 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1c, + + /* U+69 "i" */ + 0x1c, 0x7, 0x0, 0x0, 0x0, 0xfc, 0x3f, 0x1, + 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0x1c, + 0x3f, 0xff, 0xfc, + + /* U+6A "j" */ + 0x7, 0x7, 0x0, 0x0, 0x7f, 0x7f, 0x7, 0x7, + 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0xf, + 0xfe, 0xfc, + + /* U+6B "k" */ + 0xe0, 0x38, 0xe, 0x3, 0x87, 0xe1, 0xb8, 0xee, + 0x33, 0x9c, 0xfe, 0x3f, 0x8e, 0x73, 0x8e, 0xe3, + 0xb8, 0x70, + + /* U+6C "l" */ + 0xfe, 0x1f, 0xc0, 0x38, 0x7, 0x0, 0xe0, 0x1c, + 0x3, 0x80, 0x70, 0xe, 0x1, 0xc0, 0x38, 0x7, + 0x0, 0xfe, 0xf, 0xc0, + + /* U+6D "m" */ + 0xd9, 0xbf, 0xfc, 0xcf, 0x33, 0xcc, 0xf3, 0x3c, + 0xcf, 0x33, 0xcc, 0xf3, 0x3c, 0xcc, + + /* U+6E "n" */ + 0xee, 0x7f, 0xbc, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, + 0xc7, 0xe3, 0xf1, 0xf8, 0xe0, + + /* U+6F "o" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0x87, 0xf3, 0xdf, 0xe3, 0xf0, + + /* U+70 "p" */ + 0xef, 0x3f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0x87, 0xf3, 0xff, 0xee, 0xf3, 0x80, 0xe0, + 0x38, 0x0, + + /* U+71 "q" */ + 0x3d, 0xdf, 0xff, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0x87, 0xf3, 0xdf, 0xf3, 0xdc, 0x7, 0x1, + 0xc0, 0x70, + + /* U+72 "r" */ + 0xef, 0x3f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0xe, + 0x3, 0x80, 0xe0, 0x38, 0xe, 0x0, + + /* U+73 "s" */ + 0x3f, 0x3f, 0xee, 0x1f, 0x80, 0xfc, 0x1f, 0xe0, + 0x3c, 0x7, 0xe1, 0xff, 0xe3, 0xf0, + + /* U+74 "t" */ + 0x1c, 0x7, 0x1, 0xc3, 0xff, 0xff, 0xc7, 0x1, + 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0xf, + 0xc1, 0xf0, + + /* U+75 "u" */ + 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, + 0xc7, 0xe3, 0xbf, 0x8f, 0x80, + + /* U+76 "v" */ + 0xc0, 0xf8, 0x76, 0x19, 0x86, 0x73, 0x8c, 0xc3, + 0x30, 0xfc, 0x1e, 0x7, 0x81, 0xe0, + + /* U+77 "w" */ + 0xc6, 0x79, 0xcf, 0x39, 0xb5, 0x36, 0xa6, 0xd6, + 0xda, 0xdb, 0x4e, 0x79, 0xcf, 0x38, 0xc7, 0x0, + + /* U+78 "x" */ + 0xe1, 0xdc, 0xe3, 0x30, 0xfc, 0x1e, 0x7, 0x81, + 0xe0, 0xfc, 0x73, 0x9c, 0x6e, 0x1c, + + /* U+79 "y" */ + 0xe1, 0xf8, 0x76, 0x19, 0xce, 0x33, 0x8e, 0xc3, + 0xf0, 0x7c, 0x1e, 0x3, 0x80, 0xc0, 0x70, 0x1c, + 0x6, 0x0, + + /* U+7A "z" */ + 0xff, 0xff, 0xc1, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, + 0xe0, 0xe0, 0x7f, 0xff, 0xe0, + + /* U+7B "{" */ + 0x7, 0x87, 0xc3, 0x81, 0xc0, 0xe0, 0x70, 0x38, + 0x1c, 0xfc, 0x7e, 0x3, 0x81, 0xc0, 0xe0, 0x70, + 0x38, 0x1c, 0xf, 0x83, 0xc0, + + /* U+7C "|" */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, + + /* U+7D "}" */ + 0xf0, 0x3f, 0x1, 0xc0, 0x70, 0x1c, 0x7, 0x1, + 0xc0, 0x70, 0xf, 0xc3, 0xf1, 0xc0, 0x70, 0x1c, + 0x7, 0x1, 0xc0, 0x70, 0xf8, 0x3c, 0x0, + + /* U+7E "~" */ + 0x78, 0xff, 0x3c, 0xff, 0x1e, + + /* U+F001 "" */ + 0x0, 0x0, 0x70, 0x0, 0x7f, 0x0, 0x3f, 0xf0, + 0x1f, 0xff, 0x7, 0xff, 0xf0, 0x7f, 0xff, 0x7, + 0xfc, 0x70, 0x7e, 0x7, 0x7, 0x0, 0x70, 0x70, + 0x7, 0x7, 0x0, 0x70, 0x70, 0x7, 0x7, 0x0, + 0x70, 0x70, 0x7f, 0x7, 0xf, 0xf7, 0xf0, 0xff, + 0xff, 0x7, 0xef, 0xf0, 0x0, 0xff, 0x0, 0x3, + 0xc0, 0x0, + + /* U+F017 "" */ + 0x3, 0xf8, 0x1, 0xff, 0xc0, 0x7f, 0xfc, 0x1f, + 0xff, 0xc7, 0xf1, 0xfc, 0xfe, 0x3f, 0x9f, 0xc7, + 0xf7, 0xf8, 0xff, 0xff, 0x1f, 0xff, 0xe3, 0xff, + 0xfc, 0x3f, 0xff, 0x83, 0xff, 0xfc, 0x7e, 0xff, + 0xcf, 0x9f, 0xff, 0xf1, 0xff, 0xfc, 0x1f, 0xff, + 0x1, 0xff, 0xc0, 0x1f, 0xf0, 0x0, 0x70, 0x0, + + /* U+F03A "" */ + 0xf0, 0x0, 0xf, 0x3f, 0xff, 0xf3, 0xff, 0xff, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0xf, 0x0, 0x0, 0xf3, 0xff, 0xff, 0x3f, + 0xff, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xf, 0x0, 0x0, 0xf3, 0xff, 0xff, 0x3f, 0xff, + 0xf0, 0x0, 0x0, + + /* U+F069 "" */ + 0x0, 0xe0, 0x0, 0x1c, 0x0, 0x3, 0x80, 0x0, + 0x70, 0x6, 0xe, 0xc, 0xf1, 0xc7, 0x9f, 0xbb, + 0xf1, 0xff, 0xfc, 0xf, 0xfe, 0x0, 0x7f, 0x0, + 0xf, 0xe0, 0x7, 0xff, 0x3, 0xff, 0xf8, 0xfd, + 0xdf, 0x9e, 0x38, 0xf3, 0x7, 0x6, 0x0, 0xe0, + 0x0, 0x1c, 0x0, 0x3, 0x80, 0x0, 0x70, 0x0, + + /* U+F129 "" */ + 0x3c, 0x7e, 0x7e, 0x7e, 0x3c, 0x0, 0x0, 0xfc, + 0xfc, 0xfc, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, + 0xff, 0xff, 0xff, + + /* U+F185 "" */ + 0x0, 0x60, 0x0, 0x6, 0x0, 0x0, 0xf0, 0x1, + 0xcf, 0x38, 0x1f, 0xff, 0x81, 0xf0, 0xf8, 0xc, + 0xf3, 0x1, 0xdf, 0xb8, 0x7b, 0xfd, 0xef, 0xbf, + 0xdf, 0x7b, 0xfd, 0xe1, 0x9f, 0x98, 0xc, 0xf3, + 0x0, 0xc0, 0x30, 0x1f, 0xf, 0x81, 0xff, 0xf8, + 0x1c, 0xf3, 0x80, 0xf, 0x0, 0x0, 0x60, 0x0, + 0x6, 0x0, + + /* U+F1E6 "" */ + 0x18, 0x30, 0x70, 0x70, 0xe0, 0xe1, 0xc1, 0xc3, + 0x83, 0x80, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x7f, + 0xfc, 0xff, 0xf9, 0xff, 0xf1, 0xff, 0xc3, 0xff, + 0x83, 0xfe, 0x3, 0xf8, 0x1, 0xc0, 0x3, 0x80, + 0x7, 0x0, 0xe, 0x0, + + /* U+F1FC "" */ + 0x0, 0x0, 0xf0, 0x0, 0x1f, 0x0, 0x3, 0xf0, + 0x0, 0x7e, 0x0, 0xf, 0xe0, 0x3, 0xfc, 0x0, + 0x7f, 0xc0, 0xf, 0xf8, 0x0, 0xff, 0x80, 0x1f, + 0xf0, 0x0, 0xfe, 0x0, 0xf, 0xe0, 0xe, 0x7c, + 0x1, 0xf8, 0x0, 0x9f, 0xc0, 0xf, 0xfc, 0x0, + 0x7f, 0xc0, 0x7, 0xf8, 0x0, 0x1f, 0x0, 0x0, + + /* U+F21E "" */ + 0x1e, 0x7, 0x83, 0xf9, 0xfe, 0x7f, 0xff, 0xef, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xfc, + 0xf7, 0xf7, 0xd6, 0x3e, 0x79, 0x6b, 0xe0, 0x34, + 0x80, 0x1f, 0x9f, 0x80, 0xf9, 0xf0, 0x7, 0xfe, + 0x0, 0x3f, 0xc0, 0x1, 0xf8, 0x0, 0xf, 0x0, + 0x0, 0x60, 0x0, + + /* U+F240 "" */ + 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, + 0x1, 0xfd, 0xff, 0xfe, 0xfe, 0xff, 0xff, 0x7f, + 0x7f, 0xff, 0x9f, 0xbf, 0xff, 0xcf, 0xdf, 0xff, + 0xe7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, + 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, + + /* U+F241 "" */ + 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, + 0x1, 0xfd, 0xff, 0xe0, 0xfe, 0xff, 0xf0, 0x7f, + 0x7f, 0xf8, 0x1f, 0xbf, 0xfc, 0xf, 0xdf, 0xfe, + 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, + 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, + + /* U+F242 "" */ + 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, + 0x1, 0xfd, 0xfe, 0x0, 0xfe, 0xff, 0x0, 0x7f, + 0x7f, 0x80, 0x1f, 0xbf, 0xc0, 0xf, 0xdf, 0xe0, + 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, + 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, + + /* U+F243 "" */ + 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, + 0x1, 0xfd, 0xf0, 0x0, 0xfe, 0xf8, 0x0, 0x7f, + 0x7c, 0x0, 0x1f, 0xbe, 0x0, 0xf, 0xdf, 0x0, + 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, + 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, + + /* U+F244 "" */ + 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, + 0x1, 0xfc, 0x0, 0x0, 0xfe, 0x0, 0x0, 0x7f, + 0x0, 0x0, 0x1f, 0x80, 0x0, 0xf, 0xc0, 0x0, + 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, + 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, + + /* U+F293 "" */ + 0x7, 0xe0, 0x3f, 0xe0, 0xfb, 0xe3, 0xf3, 0xe7, + 0xe3, 0xdf, 0xd3, 0xf9, 0xb3, 0xf9, 0x4f, 0xf8, + 0x3f, 0xf8, 0xff, 0xf1, 0xff, 0xc1, 0xff, 0x29, + 0xfc, 0xd9, 0xff, 0xa7, 0xbf, 0x1e, 0x7e, 0x7c, + 0x7d, 0xf0, 0x7f, 0xe0, 0x7f, 0x0, + + /* U+F294 "" */ + 0x0, 0x0, 0x80, 0x18, 0x3, 0x80, 0x78, 0x8d, + 0xb9, 0x9b, 0xb6, 0x3f, 0x83, 0xe0, 0x38, 0x7, + 0x81, 0xf8, 0x6d, 0x99, 0x9a, 0x36, 0x7, 0x80, + 0xe0, 0x18, 0x2, 0x0, 0x0, + + /* U+F3FD "" */ + 0x0, 0xfe, 0x0, 0x7, 0xff, 0x0, 0x3f, 0xbf, + 0x80, 0xfe, 0x2f, 0x83, 0xfe, 0xcf, 0x8f, 0x3f, + 0x27, 0x9e, 0x7e, 0x4f, 0x3f, 0xfc, 0xfe, 0xff, + 0xf3, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xcf, 0xff, + 0xfe, 0x3f, 0xfe, 0x78, 0x3c, 0xff, 0xf0, 0x7f, + 0xdf, 0xe0, 0xff, 0x3f, 0xff, 0xfe, 0x3f, 0xff, + 0xf8, + + /* U+F54B "" */ + 0x0, 0xf, 0xf8, 0x1, 0xdf, 0xff, 0x1, 0xef, + 0xff, 0xc0, 0xf7, 0xff, 0xf0, 0x7b, 0xff, 0xf8, + 0x1d, 0xff, 0xfc, 0x0, 0x1f, 0xfc, 0x0, 0x3, + 0xfc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x7, 0xf8, 0x0, 0xf, 0xfe, + 0x3, 0xbf, 0xff, 0x83, 0xdf, 0xff, 0xc1, 0xef, + 0xff, 0xe0, 0xf7, 0xff, 0xe0, 0x3b, 0xff, 0xe0, + 0x0, 0x7f, 0xc0, 0x0, + + /* U+F560 "" */ + 0x0, 0x0, 0x0, 0x0, 0x60, 0x0, 0xf, 0x0, + 0x1, 0xf0, 0x8, 0x3e, 0x1, 0xc7, 0xc4, 0x1e, + 0xf8, 0xe1, 0xff, 0x1f, 0xf, 0xe3, 0xf0, 0x7c, + 0x7e, 0x23, 0x8f, 0xc7, 0x11, 0xf8, 0xf8, 0x3f, + 0xf, 0xc7, 0xe0, 0x7e, 0xfc, 0x3, 0xff, 0x80, + 0x1f, 0xf0, 0x0, 0xfe, 0x0, 0x7, 0xc0, 0x0, + 0x38, 0x0, 0x1, 0x0, 0x0 +}; + + +/*--------------------- + * GLYPH DESCRIPTION + *--------------------*/ + +static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { + {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, + {.bitmap_index = 0, .adv_w = 192, .box_w = 1, .box_h = 1, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1, .adv_w = 192, .box_w = 3, .box_h = 14, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 7, .adv_w = 192, .box_w = 7, .box_h = 6, .ofs_x = 3, .ofs_y = 8}, + {.bitmap_index = 13, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 33, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 57, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 77, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 97, .adv_w = 192, .box_w = 3, .box_h = 6, .ofs_x = 5, .ofs_y = 8}, + {.bitmap_index = 100, .adv_w = 192, .box_w = 7, .box_h = 19, .ofs_x = 3, .ofs_y = -2}, + {.bitmap_index = 117, .adv_w = 192, .box_w = 7, .box_h = 19, .ofs_x = 2, .ofs_y = -2}, + {.bitmap_index = 134, .adv_w = 192, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 1}, + {.bitmap_index = 147, .adv_w = 192, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = 2}, + {.bitmap_index = 159, .adv_w = 192, .box_w = 5, .box_h = 6, .ofs_x = 3, .ofs_y = -3}, + {.bitmap_index = 163, .adv_w = 192, .box_w = 8, .box_h = 2, .ofs_x = 2, .ofs_y = 5}, + {.bitmap_index = 165, .adv_w = 192, .box_w = 4, .box_h = 4, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 167, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 191, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 209, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 225, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 243, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 261, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 277, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 293, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 311, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 329, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 347, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 365, .adv_w = 192, .box_w = 3, .box_h = 11, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 370, .adv_w = 192, .box_w = 5, .box_h = 14, .ofs_x = 3, .ofs_y = -3}, + {.bitmap_index = 379, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 1}, + {.bitmap_index = 392, .adv_w = 192, .box_w = 9, .box_h = 7, .ofs_x = 2, .ofs_y = 3}, + {.bitmap_index = 400, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 1}, + {.bitmap_index = 413, .adv_w = 192, .box_w = 8, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 427, .adv_w = 192, .box_w = 11, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 451, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 472, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 490, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 508, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 526, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 542, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 558, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 576, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 592, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 608, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 626, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 646, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 662, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 680, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 696, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 714, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 732, .adv_w = 192, .box_w = 10, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 754, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 772, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 790, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 808, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 824, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 845, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 865, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 883, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 903, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 919, .adv_w = 192, .box_w = 6, .box_h = 18, .ofs_x = 4, .ofs_y = -2}, + {.bitmap_index = 933, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 957, .adv_w = 192, .box_w = 6, .box_h = 18, .ofs_x = 3, .ofs_y = -2}, + {.bitmap_index = 971, .adv_w = 192, .box_w = 10, .box_h = 8, .ofs_x = 1, .ofs_y = 6}, + {.bitmap_index = 981, .adv_w = 192, .box_w = 10, .box_h = 2, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 984, .adv_w = 192, .box_w = 5, .box_h = 3, .ofs_x = 3, .ofs_y = 13}, + {.bitmap_index = 986, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1000, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1018, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1032, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1050, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1064, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1082, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 1100, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1116, .adv_w = 192, .box_w = 10, .box_h = 15, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1135, .adv_w = 192, .box_w = 8, .box_h = 18, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 1153, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1171, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1191, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1205, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1218, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1232, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 1250, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 1268, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1282, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1296, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1314, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1327, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1341, .adv_w = 192, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1357, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1371, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 1389, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1402, .adv_w = 192, .box_w = 9, .box_h = 18, .ofs_x = 2, .ofs_y = -2}, + {.bitmap_index = 1423, .adv_w = 192, .box_w = 3, .box_h = 18, .ofs_x = 5, .ofs_y = -2}, + {.bitmap_index = 1430, .adv_w = 192, .box_w = 10, .box_h = 18, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 1453, .adv_w = 192, .box_w = 10, .box_h = 4, .ofs_x = 1, .ofs_y = 5}, + {.bitmap_index = 1458, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 1508, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 1556, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 1599, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 1647, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 1666, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 1716, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 1752, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 1800, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 1843, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 1881, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 1919, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 1957, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 1995, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 2033, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 2071, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 2100, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2149, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 2209, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3} +}; + +/*--------------------- + * CHARACTER MAPPING + *--------------------*/ + +static const uint16_t unicode_list_1[] = { + 0x0, 0x16, 0x39, 0x68, 0x128, 0x184, 0x1e5, 0x1fb, + 0x21d, 0x23f, 0x240, 0x241, 0x242, 0x243, 0x292, 0x293, + 0x3fc, 0x54a, 0x55f +}; + +/*Collect the unicode lists and glyph_id offsets*/ +static const lv_font_fmt_txt_cmap_t cmaps[] = +{ + { + .range_start = 32, .range_length = 95, .glyph_id_start = 1, + .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY + }, + { + .range_start = 61441, .range_length = 1376, .glyph_id_start = 96, + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 19, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + } +}; + + + +/*-------------------- + * ALL CUSTOM DATA + *--------------------*/ + +/*Store all the custom data of the font*/ +static lv_font_fmt_txt_dsc_t font_dsc = { + .glyph_bitmap = gylph_bitmap, + .glyph_dsc = glyph_dsc, + .cmaps = cmaps, + .kern_dsc = NULL, + .kern_scale = 0, + .cmap_num = 2, + .bpp = 1, + .kern_classes = 0, + .bitmap_format = 0 +}; + + +/*----------------- + * PUBLIC FONT + *----------------*/ + +/*Initialize a public general font descriptor*/ +lv_font_t jetbrains_mono_bold_20 = { + .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ + .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ + .line_height = 21, /*The maximum line height required by the font*/ + .base_line = 3, /*Baseline measured from the bottom of the line*/ +#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) + .subpx = LV_FONT_SUBPX_NONE, +#endif + .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ +}; + +#endif /*#if JETBRAINS_MONO_BOLD_20*/ + diff --git a/src/displayapp/Fonts/jetbrains_mono_extrabold_compressed.c b/src/displayapp/Fonts/jetbrains_mono_extrabold_compressed.c new file mode 100644 index 0000000..c9917e4 --- /dev/null +++ b/src/displayapp/Fonts/jetbrains_mono_extrabold_compressed.c @@ -0,0 +1,507 @@ +#include "lvgl/lvgl.h" + +/******************************************************************************* + * Size: 80 px + * Bpp: 1 + * Opts: + ******************************************************************************/ + +#ifndef JETBRAINS_MONO_EXTRABOLD_COMPRESSED +#define JETBRAINS_MONO_EXTRABOLD_COMPRESSED 1 +#endif + +#if JETBRAINS_MONO_EXTRABOLD_COMPRESSED + +/*----------------- + * BITMAPS + *----------------*/ + +/*Store the image of the glyphs*/ +static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { + /* U+30 "0" */ + 0x0, 0x1, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, + 0xfe, 0x0, 0x0, 0x1f, 0xff, 0xff, 0xc0, 0x0, + 0x3f, 0xff, 0xff, 0xf8, 0x0, 0x3f, 0xff, 0xff, + 0xfe, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x80, 0x3f, + 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, + 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, + 0xff, 0xff, 0xff, 0x1f, 0xff, 0xe0, 0x3f, 0xff, + 0xcf, 0xff, 0xc0, 0x7, 0xff, 0xe7, 0xff, 0xc0, + 0x1, 0xff, 0xf7, 0xff, 0xc0, 0x0, 0x7f, 0xff, + 0xff, 0xe0, 0x0, 0x3f, 0xff, 0xff, 0xe0, 0x0, + 0xf, 0xff, 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, + 0xf8, 0x0, 0x3, 0xff, 0xff, 0xfc, 0x0, 0x1, + 0xff, 0xff, 0xfe, 0x0, 0x0, 0xff, 0xff, 0xff, + 0x0, 0x0, 0x7f, 0xff, 0xff, 0x80, 0x0, 0x3f, + 0xff, 0xff, 0xc0, 0x70, 0x1f, 0xff, 0xff, 0xe0, + 0x7c, 0xf, 0xff, 0xff, 0xf0, 0x7f, 0x7, 0xff, + 0xff, 0xf8, 0x3f, 0x83, 0xff, 0xff, 0xfc, 0x1f, + 0xc1, 0xff, 0xff, 0xfe, 0xf, 0xe0, 0xff, 0xff, + 0xff, 0x7, 0xf0, 0x7f, 0xff, 0xff, 0x83, 0xf8, + 0x3f, 0xff, 0xff, 0xc1, 0xfc, 0x1f, 0xff, 0xff, + 0xe0, 0xfe, 0xf, 0xff, 0xff, 0xf0, 0x7f, 0x7, + 0xff, 0xff, 0xf8, 0x3f, 0x83, 0xff, 0xff, 0xfc, + 0x1f, 0xc1, 0xff, 0xff, 0xfe, 0xf, 0xe0, 0xff, + 0xff, 0xff, 0x3, 0xe0, 0x7f, 0xff, 0xff, 0x80, + 0xe0, 0x3f, 0xff, 0xff, 0xc0, 0x0, 0x1f, 0xff, + 0xff, 0xe0, 0x0, 0xf, 0xff, 0xff, 0xf0, 0x0, + 0x7, 0xff, 0xff, 0xf8, 0x0, 0x3, 0xff, 0xff, + 0xfc, 0x0, 0x1, 0xff, 0xff, 0xfe, 0x0, 0x0, + 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, + 0xc0, 0x0, 0x7f, 0xf9, 0xff, 0xf0, 0x0, 0x7f, + 0xfc, 0xff, 0xfc, 0x0, 0x7f, 0xfe, 0x7f, 0xff, + 0x80, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, + 0x7, 0xff, 0xff, 0xff, 0xff, 0x3, 0xff, 0xff, + 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0x80, + 0x3f, 0xff, 0xff, 0xff, 0x80, 0xf, 0xff, 0xff, + 0xff, 0x80, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, + 0x7f, 0xff, 0xff, 0x0, 0x0, 0xf, 0xff, 0xfc, + 0x0, 0x0, 0x0, 0x7f, 0xf0, 0x0, 0x0, + + /* U+31 "1" */ + 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0xf, 0xff, + 0xe0, 0x0, 0x0, 0x3f, 0xff, 0xe0, 0x0, 0x0, + 0x7f, 0xff, 0xe0, 0x0, 0x1, 0xff, 0xff, 0xe0, + 0x0, 0x3, 0xff, 0xff, 0xe0, 0x0, 0x7, 0xff, + 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xe0, 0x0, + 0x3f, 0xff, 0xff, 0xe0, 0x0, 0x7f, 0xff, 0xff, + 0xe0, 0x0, 0x7f, 0xff, 0xff, 0xe0, 0x0, 0x7f, + 0xfd, 0xff, 0xe0, 0x0, 0x7f, 0xf9, 0xff, 0xe0, + 0x0, 0x7f, 0xf1, 0xff, 0xe0, 0x0, 0x7f, 0xe1, + 0xff, 0xe0, 0x0, 0x7f, 0x81, 0xff, 0xe0, 0x0, + 0x7f, 0x1, 0xff, 0xe0, 0x0, 0x7c, 0x1, 0xff, + 0xe0, 0x0, 0x78, 0x1, 0xff, 0xe0, 0x0, 0x60, + 0x1, 0xff, 0xe0, 0x0, 0x40, 0x1, 0xff, 0xe0, + 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, + 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, + 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, + 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, + 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, + 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, + 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, + 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, + 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, + 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, + 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, + 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, + 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, + 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, + + /* U+32 "2" */ + 0x0, 0x1, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, + 0xfc, 0x0, 0x0, 0x1f, 0xff, 0xff, 0x80, 0x0, + 0x3f, 0xff, 0xff, 0xf0, 0x0, 0x3f, 0xff, 0xff, + 0xfc, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x0, 0x3f, + 0xff, 0xff, 0xff, 0xc0, 0x3f, 0xff, 0xff, 0xff, + 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, + 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xe0, 0x7f, 0xff, + 0x8f, 0xff, 0xc0, 0xf, 0xff, 0xc7, 0xff, 0xc0, + 0x3, 0xff, 0xe7, 0xff, 0xc0, 0x0, 0xff, 0xfb, + 0xff, 0xc0, 0x0, 0x7f, 0xfd, 0xff, 0xe0, 0x0, + 0x1f, 0xfe, 0xff, 0xf0, 0x0, 0xf, 0xff, 0x0, + 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, + 0xff, 0xc0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, + 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, + 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x0, 0x3f, 0xfe, + 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, + 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, + 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, + 0xff, 0x80, 0x0, 0x0, 0x7f, 0xff, 0x80, 0x0, + 0x0, 0x7f, 0xff, 0x80, 0x0, 0x0, 0x7f, 0xff, + 0x80, 0x0, 0x0, 0x7f, 0xff, 0x80, 0x0, 0x0, + 0xff, 0xff, 0x80, 0x0, 0x0, 0xff, 0xff, 0x80, + 0x0, 0x0, 0xff, 0xff, 0x80, 0x0, 0x0, 0xff, + 0xff, 0x80, 0x0, 0x1, 0xff, 0xff, 0x0, 0x0, + 0x1, 0xff, 0xff, 0x0, 0x0, 0x1, 0xff, 0xff, + 0x0, 0x0, 0x1, 0xff, 0xfe, 0x0, 0x0, 0x3, + 0xff, 0xfe, 0x0, 0x0, 0x3, 0xff, 0xfe, 0x0, + 0x0, 0x3, 0xff, 0xfc, 0x0, 0x0, 0x3, 0xff, + 0xfc, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, + 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, + 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, + 0xdf, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, + 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xfb, + 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, + 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, + 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, + 0xff, 0xc0, + + /* U+33 "3" */ + 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, 0xff, 0xff, + 0xff, 0xff, 0x7, 0xff, 0xff, 0xff, 0xff, 0x83, + 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, + 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x7f, + 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, + 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, 0xff, + 0xff, 0x8f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, + 0x80, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, + 0x1f, 0xff, 0x80, 0x0, 0x0, 0x3f, 0xff, 0x80, + 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, + 0xff, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, + 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfe, + 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, + 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, + 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, 0xf, + 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, 0xff, 0x0, + 0x0, 0x3, 0xff, 0xff, 0xe0, 0x0, 0x1, 0xff, + 0xff, 0xf8, 0x0, 0x0, 0xff, 0xff, 0xfe, 0x0, + 0x0, 0x7f, 0xff, 0xff, 0x80, 0x0, 0x3f, 0xff, + 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf0, 0x0, + 0xf, 0xff, 0xff, 0xfc, 0x0, 0x0, 0x0, 0xff, + 0xfe, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, + 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x1, 0xff, + 0xe0, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, + 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, 0xfe, + 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, + 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, + 0x0, 0x0, 0x1, 0xff, 0xff, 0xfe, 0x0, 0x0, + 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, + 0xc0, 0x0, 0x7f, 0xf9, 0xff, 0xf0, 0x0, 0x7f, + 0xfc, 0xff, 0xfc, 0x0, 0x7f, 0xfe, 0x7f, 0xff, + 0x80, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, + 0xf, 0xff, 0xff, 0xff, 0xff, 0x3, 0xff, 0xff, + 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0x80, + 0x3f, 0xff, 0xff, 0xff, 0x80, 0xf, 0xff, 0xff, + 0xff, 0x80, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, + 0x7f, 0xff, 0xff, 0x0, 0x0, 0xf, 0xff, 0xfc, + 0x0, 0x0, 0x0, 0x7f, 0xf0, 0x0, 0x0, + + /* U+34 "4" */ + 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, 0x1f, + 0xff, 0x80, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, + 0x3, 0xff, 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x80, + 0x0, 0x0, 0xff, 0xfc, 0x0, 0x0, 0x3, 0xff, + 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, + 0xff, 0xfc, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, + 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xff, 0xfc, + 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3f, + 0xff, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, + 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3f, 0xff, 0x0, + 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, + 0xc0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x1, + 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, + 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x1, 0xff, 0xf8, + 0x0, 0x0, 0xf, 0xff, 0xc0, 0x0, 0x0, 0x3f, + 0xfe, 0x0, 0xff, 0xf1, 0xff, 0xf0, 0x3, 0xff, + 0xcf, 0xff, 0xc0, 0xf, 0xff, 0x7f, 0xfe, 0x0, + 0x3f, 0xfd, 0xff, 0xf0, 0x0, 0xff, 0xff, 0xff, + 0xc0, 0x3, 0xff, 0xff, 0xfe, 0x0, 0xf, 0xff, + 0xff, 0xf0, 0x0, 0x3f, 0xff, 0xff, 0x80, 0x0, + 0xff, 0xff, 0xfe, 0x0, 0x3, 0xff, 0xff, 0xf8, + 0x0, 0xf, 0xff, 0xff, 0xe0, 0x0, 0x3f, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, + 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, + 0xfc, 0x0, 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, + 0x3, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, 0x0, + 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0xff, + 0xf0, 0x0, 0x0, 0x3, 0xff, 0xc0, 0x0, 0x0, + 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, + 0x0, 0x0, 0xff, 0xf0, + + /* U+35 "5" */ + 0x3f, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, + 0xff, 0xff, 0xf, 0xff, 0xff, 0xff, 0xff, 0x87, + 0xff, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, + 0xff, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, + 0xff, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff, 0xff, + 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, + 0xff, 0xff, 0xff, 0xf, 0xff, 0x0, 0x0, 0x0, + 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, + 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x0, + 0xff, 0xf0, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, + 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, + 0xfe, 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, + 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, + 0xc0, 0x7f, 0x80, 0x1, 0xff, 0xe1, 0xff, 0xf8, + 0x0, 0xff, 0xf1, 0xff, 0xff, 0x0, 0x7f, 0xf9, + 0xff, 0xff, 0xc0, 0x3f, 0xfd, 0xff, 0xff, 0xf0, + 0x1f, 0xff, 0xff, 0xff, 0xfc, 0xf, 0xff, 0xff, + 0xff, 0xff, 0x7, 0xff, 0xff, 0xff, 0xff, 0xc3, + 0xff, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xfc, 0x7, + 0xff, 0xf8, 0xff, 0xf8, 0x0, 0xff, 0xfc, 0x0, + 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0xf, + 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, + 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x0, 0xff, + 0xf0, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, + 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, 0xfe, + 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, + 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, + 0x0, 0x0, 0x1, 0xff, 0xff, 0xff, 0x0, 0x1, + 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xfb, 0xff, + 0xe0, 0x0, 0xff, 0xf9, 0xff, 0xf8, 0x0, 0xff, + 0xfc, 0xff, 0xff, 0x81, 0xff, 0xfe, 0x3f, 0xff, + 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, + 0x7, 0xff, 0xff, 0xff, 0xff, 0x1, 0xff, 0xff, + 0xff, 0xff, 0x0, 0x7f, 0xff, 0xff, 0xff, 0x0, + 0x1f, 0xff, 0xff, 0xff, 0x0, 0x7, 0xff, 0xff, + 0xff, 0x0, 0x0, 0xff, 0xff, 0xfe, 0x0, 0x0, + 0x1f, 0xff, 0xfc, 0x0, 0x0, 0x0, 0xff, 0xe0, + 0x0, 0x0, + + /* U+36 "6" */ + 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, + 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, + 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, + 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, + 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, + 0xc0, 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, + 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, + 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, + 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, + 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, 0x1, + 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, + 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0xf, + 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, + 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x0, 0xff, + 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x3f, 0xc0, + 0x0, 0x1f, 0xfe, 0x3f, 0xfe, 0x0, 0xf, 0xff, + 0xbf, 0xff, 0xe0, 0x3, 0xff, 0xdf, 0xff, 0xfc, + 0x1, 0xff, 0xef, 0xff, 0xff, 0x80, 0x7f, 0xff, + 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xfe, + 0xf, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, + 0xff, 0xff, 0xf1, 0xff, 0xff, 0x3, 0xff, 0xfc, + 0x7f, 0xff, 0x0, 0x3f, 0xff, 0x9f, 0xff, 0x0, + 0x3, 0xff, 0xef, 0xff, 0xc0, 0x0, 0xff, 0xfb, + 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf8, 0x0, + 0x7, 0xff, 0xff, 0xfc, 0x0, 0x0, 0xff, 0xff, + 0xff, 0x0, 0x0, 0x3f, 0xff, 0xff, 0xc0, 0x0, + 0xf, 0xff, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, + 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, + 0x3f, 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0x7f, + 0xf8, 0x0, 0x7, 0xff, 0xdf, 0xfe, 0x0, 0x3, + 0xff, 0xe7, 0xff, 0xc0, 0x0, 0xff, 0xf9, 0xff, + 0xfc, 0x0, 0xff, 0xfe, 0x3f, 0xff, 0xc0, 0xff, + 0xff, 0xf, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, + 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, + 0xf0, 0x7, 0xff, 0xff, 0xff, 0xf8, 0x0, 0xff, + 0xff, 0xff, 0xfe, 0x0, 0x1f, 0xff, 0xff, 0xfe, + 0x0, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, 0x3f, + 0xff, 0xff, 0x0, 0x0, 0x3, 0xff, 0xff, 0x0, + 0x0, 0x0, 0xf, 0xfc, 0x0, 0x0, + + /* U+37 "7" */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe0, 0x0, 0xf, 0xff, 0xff, 0xe0, 0x0, 0x1f, + 0xfe, 0xff, 0xe0, 0x0, 0x1f, 0xfe, 0xff, 0xe0, + 0x0, 0x3f, 0xfc, 0xff, 0xe0, 0x0, 0x3f, 0xfc, + 0xff, 0xe0, 0x0, 0x7f, 0xf8, 0xff, 0xe0, 0x0, + 0x7f, 0xf8, 0xff, 0xe0, 0x0, 0xff, 0xf8, 0xff, + 0xe0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x1, 0xff, + 0xf0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, + 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, 0xc0, + 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x7, + 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, + 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, + 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, + 0x1f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, + 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x7f, + 0xfc, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, + 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, 0xf8, + 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, 0x1, + 0xff, 0xf0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, + 0xc0, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, + 0x7, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, 0x80, + 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x1f, + 0xff, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, + 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfe, + 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x0, + 0x7f, 0xfc, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, + 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, + 0xf8, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, + 0x1, 0xff, 0xf0, 0x0, 0x0, 0x3, 0xff, 0xe0, + 0x0, 0x0, + + /* U+38 "8" */ + 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x7, 0xff, + 0xff, 0x80, 0x0, 0x7, 0xff, 0xff, 0xf8, 0x0, + 0x7, 0xff, 0xff, 0xff, 0x80, 0x3, 0xff, 0xff, + 0xff, 0xf0, 0x1, 0xff, 0xff, 0xff, 0xfe, 0x0, + 0xff, 0xff, 0xff, 0xff, 0xc0, 0x7f, 0xff, 0xff, + 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, + 0xff, 0xe0, 0x3f, 0xff, 0xc3, 0xff, 0xe0, 0x3, + 0xff, 0xf0, 0xff, 0xf0, 0x0, 0x7f, 0xfc, 0x7f, + 0xf8, 0x0, 0xf, 0xff, 0x9f, 0xfe, 0x0, 0x3, + 0xff, 0xe7, 0xff, 0x0, 0x0, 0x7f, 0xf9, 0xff, + 0xc0, 0x0, 0x1f, 0xfe, 0x7f, 0xf0, 0x0, 0x7, + 0xff, 0x9f, 0xfc, 0x0, 0x1, 0xff, 0xe7, 0xff, + 0x0, 0x0, 0x7f, 0xf9, 0xff, 0xc0, 0x0, 0x1f, + 0xfe, 0x3f, 0xf8, 0x0, 0xf, 0xff, 0xf, 0xfe, + 0x0, 0x3, 0xff, 0xc3, 0xff, 0xc0, 0x1, 0xff, + 0xe0, 0x7f, 0xf8, 0x0, 0xff, 0xf8, 0xf, 0xff, + 0x80, 0xff, 0xfc, 0x1, 0xff, 0xff, 0xff, 0xfe, + 0x0, 0x3f, 0xff, 0xff, 0xff, 0x0, 0x7, 0xff, + 0xff, 0xff, 0x0, 0x0, 0x7f, 0xff, 0xff, 0x0, + 0x0, 0x3, 0xff, 0xfe, 0x0, 0x0, 0x7, 0xff, + 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, 0xff, 0x80, + 0x7, 0xff, 0xff, 0xff, 0xf0, 0x3, 0xff, 0xff, + 0xff, 0xff, 0x1, 0xff, 0xf8, 0xf, 0xff, 0xe0, + 0xff, 0xf8, 0x0, 0x7f, 0xf8, 0x3f, 0xfc, 0x0, + 0xf, 0xff, 0x1f, 0xfe, 0x0, 0x1, 0xff, 0xe7, + 0xff, 0x80, 0x0, 0x7f, 0xfb, 0xff, 0xc0, 0x0, + 0xf, 0xfe, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, + 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, + 0x3f, 0xff, 0xff, 0xc0, 0x0, 0xf, 0xff, 0xff, + 0xf0, 0x0, 0x3, 0xff, 0xff, 0xfe, 0x0, 0x1, + 0xff, 0xff, 0xff, 0x80, 0x0, 0x7f, 0xff, 0xff, + 0xf0, 0x0, 0x3f, 0xff, 0x7f, 0xfe, 0x0, 0x1f, + 0xff, 0x9f, 0xff, 0xe0, 0x3f, 0xff, 0xe3, 0xff, + 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, + 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0x3, 0xff, + 0xff, 0xff, 0xff, 0x0, 0x7f, 0xff, 0xff, 0xff, + 0x80, 0xf, 0xff, 0xff, 0xff, 0xc0, 0x1, 0xff, + 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xe0, + 0x0, 0x1, 0xff, 0xff, 0xe0, 0x0, 0x0, 0x7, + 0xff, 0x80, 0x0, + + /* U+39 "9" */ + 0x0, 0x0, 0xff, 0xc0, 0x0, 0x0, 0x3, 0xff, + 0xff, 0x0, 0x0, 0x3, 0xff, 0xff, 0xf0, 0x0, + 0x3, 0xff, 0xff, 0xff, 0x0, 0x1, 0xff, 0xff, + 0xff, 0xe0, 0x1, 0xff, 0xff, 0xff, 0xfc, 0x0, + 0x7f, 0xff, 0xff, 0xff, 0x80, 0x3f, 0xff, 0xff, + 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, + 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xfc, 0xf, + 0xff, 0xf1, 0xff, 0xf8, 0x0, 0xff, 0xfc, 0x7f, + 0xfc, 0x0, 0xf, 0xff, 0x9f, 0xff, 0x0, 0x3, + 0xff, 0xef, 0xff, 0x80, 0x0, 0x7f, 0xfb, 0xff, + 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf0, 0x0, 0x3, + 0xff, 0xff, 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, + 0x0, 0x0, 0x3f, 0xff, 0xff, 0xc0, 0x0, 0xf, + 0xff, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, 0xfc, + 0x0, 0x0, 0xff, 0xff, 0xff, 0x80, 0x0, 0x7f, + 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0x7f, 0xf8, + 0x0, 0xf, 0xff, 0xdf, 0xff, 0x0, 0x3, 0xff, + 0xe7, 0xff, 0xf0, 0x3, 0xff, 0xf8, 0xff, 0xff, + 0x3, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, + 0x87, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, + 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xf8, + 0x7, 0xff, 0xff, 0xdf, 0xfe, 0x0, 0xff, 0xff, + 0xef, 0xff, 0x80, 0x1f, 0xff, 0xf7, 0xff, 0xc0, + 0x1, 0xff, 0xf1, 0xff, 0xf0, 0x0, 0xf, 0xf0, + 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, + 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, + 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, + 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, + 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, + 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, + 0x80, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, + 0x1, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, + 0x0, 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, 0x0, + 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, 0x80, + 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3, + 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, + 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, 0x0, 0x3f, + 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, + 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, + + /* U+3A ":" */ + 0x7, 0xe0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, + 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, + 0x7f, 0xfe, 0x3f, 0xfc, 0x1f, 0xf8, 0x7, 0xe0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x7, 0xe0, 0x1f, 0xf8, + 0x3f, 0xfc, 0x7f, 0xfe, 0x7f, 0xfe, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x7f, 0xfe, 0x7f, 0xfe, 0x3f, 0xfc, + 0x1f, 0xf8, 0x7, 0xe0 +}; + + +/*--------------------- + * GLYPH DESCRIPTION + *--------------------*/ + +static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { + {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, + {.bitmap_index = 0, .adv_w = 768, .box_w = 41, .box_h = 59, .ofs_x = 4, .ofs_y = -1}, + {.bitmap_index = 303, .adv_w = 768, .box_w = 40, .box_h = 58, .ofs_x = 6, .ofs_y = 0}, + {.bitmap_index = 593, .adv_w = 768, .box_w = 41, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 891, .adv_w = 768, .box_w = 41, .box_h = 59, .ofs_x = 3, .ofs_y = -1}, + {.bitmap_index = 1194, .adv_w = 768, .box_w = 38, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 1470, .adv_w = 768, .box_w = 41, .box_h = 58, .ofs_x = 4, .ofs_y = -1}, + {.bitmap_index = 1768, .adv_w = 768, .box_w = 42, .box_h = 59, .ofs_x = 3, .ofs_y = -1}, + {.bitmap_index = 2078, .adv_w = 768, .box_w = 40, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 2368, .adv_w = 768, .box_w = 42, .box_h = 60, .ofs_x = 3, .ofs_y = -1}, + {.bitmap_index = 2683, .adv_w = 768, .box_w = 42, .box_h = 59, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 2993, .adv_w = 768, .box_w = 16, .box_h = 46, .ofs_x = 16, .ofs_y = -1} +}; + +/*--------------------- + * CHARACTER MAPPING + *--------------------*/ + + + +/*Collect the unicode lists and glyph_id offsets*/ +static const lv_font_fmt_txt_cmap_t cmaps[] = +{ + { + .range_start = 48, .range_length = 11, .glyph_id_start = 1, + .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY + } +}; + + + +/*-------------------- + * ALL CUSTOM DATA + *--------------------*/ + +/*Store all the custom data of the font*/ +static lv_font_fmt_txt_dsc_t font_dsc = { + .glyph_bitmap = gylph_bitmap, + .glyph_dsc = glyph_dsc, + .cmaps = cmaps, + .kern_dsc = NULL, + .kern_scale = 0, + .cmap_num = 1, + .bpp = 1, + .kern_classes = 0, + .bitmap_format = 0 +}; + + +/*----------------- + * PUBLIC FONT + *----------------*/ + +/*Initialize a public general font descriptor*/ +lv_font_t jetbrains_mono_extrabold_compressed = { + .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ + .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ + .line_height = 60, /*The maximum line height required by the font*/ + .base_line = 1, /*Baseline measured from the bottom of the line*/ +#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) + .subpx = LV_FONT_SUBPX_NONE, +#endif + .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ +}; + +#endif /*#if JETBRAINS_MONO_EXTRABOLD_COMPRESSED*/ + diff --git a/src/displayapp/Icons/battery/os_battery_005.c b/src/displayapp/Icons/battery/os_battery_005.c new file mode 100644 index 0000000..64832b5 --- /dev/null +++ b/src/displayapp/Icons/battery/os_battery_005.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_005 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_005 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_005 uint8_t ck_os_battery_005_map[] = { + 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + + 0xfc, 0x00, 0x3f, + 0xf8, 0x00, 0x1f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0x00, 0xff, 0x00, + 0x00, 0xff, 0x00, + 0x00, 0xff, 0x00, + 0x00, 0xff, 0x00, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, +}; + +const lv_img_dsc_t ck_os_battery_005 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_005_map, +}; diff --git a/src/displayapp/Icons/battery/os_battery_005.png b/src/displayapp/Icons/battery/os_battery_005.png new file mode 100644 index 0000000..963767b Binary files /dev/null and b/src/displayapp/Icons/battery/os_battery_005.png differ diff --git a/src/displayapp/Icons/battery/os_battery_010.c b/src/displayapp/Icons/battery/os_battery_010.c new file mode 100644 index 0000000..f36b684 --- /dev/null +++ b/src/displayapp/Icons/battery/os_battery_010.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_010 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_010 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_010 uint8_t ck_os_battery_010_map[] = { + 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + 0x04, 0x7a, 0xf4, 0xff, /*Color of index 2*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 3*/ + + 0x55, 0x5f, 0xff, 0xff, 0xf5, 0x55, 0x55, + 0x55, 0x7f, 0xff, 0xff, 0xfd, 0x55, 0x55, + 0x55, 0xff, 0xff, 0xff, 0xff, 0x55, 0x55, + 0x55, 0xff, 0xff, 0xff, 0xff, 0x55, 0x55, + 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, + 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, + 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, + 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xff, 0x55, 0x55, 0x6a, 0xaa, 0xaa, 0xa9, + 0xff, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x50, 0x05, 0xaa, 0xaa, 0xaa, 0xaa, + 0xff, 0x50, 0x05, 0xaa, 0xaa, 0xaa, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0xff, 0xf5, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0xff, 0xf5, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0xff, 0xf5, 0xaa, 0xaa, 0xaa, 0xaa, + 0xff, 0xff, 0xf5, 0x6a, 0xaa, 0xaa, 0xa9, +}; + +const lv_img_dsc_t ck_os_battery_010 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 240, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_battery_010_map, +}; diff --git a/src/displayapp/Icons/battery/os_battery_010.png b/src/displayapp/Icons/battery/os_battery_010.png new file mode 100644 index 0000000..68a9f40 Binary files /dev/null and b/src/displayapp/Icons/battery/os_battery_010.png differ diff --git a/src/displayapp/Icons/battery/os_battery_020.c b/src/displayapp/Icons/battery/os_battery_020.c new file mode 100644 index 0000000..3f648fb --- /dev/null +++ b/src/displayapp/Icons/battery/os_battery_020.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_020 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_020 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_020 uint8_t ck_os_battery_020_map[] = { + 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, + 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, + 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, +}; + +const lv_img_dsc_t ck_os_battery_020 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 208, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_battery_020_map, +}; diff --git a/src/displayapp/Icons/battery/os_battery_020.png b/src/displayapp/Icons/battery/os_battery_020.png new file mode 100644 index 0000000..32eca65 Binary files /dev/null and b/src/displayapp/Icons/battery/os_battery_020.png differ diff --git a/src/displayapp/Icons/battery/os_battery_030.c b/src/displayapp/Icons/battery/os_battery_030.c new file mode 100644 index 0000000..4d5719b --- /dev/null +++ b/src/displayapp/Icons/battery/os_battery_030.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_030 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_030 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_030 uint8_t ck_os_battery_030_map[] = { + 0x04, 0x7a, 0xf4, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, + 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, + 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, + 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, + 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, +}; + +const lv_img_dsc_t ck_os_battery_030 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 208, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_battery_030_map, +}; diff --git a/src/displayapp/Icons/battery/os_battery_030.png b/src/displayapp/Icons/battery/os_battery_030.png new file mode 100644 index 0000000..aeb5eb1 Binary files /dev/null and b/src/displayapp/Icons/battery/os_battery_030.png differ diff --git a/src/displayapp/Icons/battery/os_battery_040.c b/src/displayapp/Icons/battery/os_battery_040.c new file mode 100644 index 0000000..0606fc3 --- /dev/null +++ b/src/displayapp/Icons/battery/os_battery_040.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_040 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_040 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_040 uint8_t ck_os_battery_040_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_battery_040 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_040_map, +}; diff --git a/src/displayapp/Icons/battery/os_battery_040.png b/src/displayapp/Icons/battery/os_battery_040.png new file mode 100644 index 0000000..d84fda4 Binary files /dev/null and b/src/displayapp/Icons/battery/os_battery_040.png differ diff --git a/src/displayapp/Icons/battery/os_battery_050.c b/src/displayapp/Icons/battery/os_battery_050.c new file mode 100644 index 0000000..8732dc7 --- /dev/null +++ b/src/displayapp/Icons/battery/os_battery_050.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_050 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_050 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_050 uint8_t ck_os_battery_050_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_battery_050 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_050_map, +}; diff --git a/src/displayapp/Icons/battery/os_battery_050.png b/src/displayapp/Icons/battery/os_battery_050.png new file mode 100644 index 0000000..224d38d Binary files /dev/null and b/src/displayapp/Icons/battery/os_battery_050.png differ diff --git a/src/displayapp/Icons/battery/os_battery_060.c b/src/displayapp/Icons/battery/os_battery_060.c new file mode 100644 index 0000000..a65936b --- /dev/null +++ b/src/displayapp/Icons/battery/os_battery_060.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_060 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_060 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_060 uint8_t ck_os_battery_060_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_battery_060 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_060_map, +}; diff --git a/src/displayapp/Icons/battery/os_battery_060.png b/src/displayapp/Icons/battery/os_battery_060.png new file mode 100644 index 0000000..e5e00ed Binary files /dev/null and b/src/displayapp/Icons/battery/os_battery_060.png differ diff --git a/src/displayapp/Icons/battery/os_battery_070.c b/src/displayapp/Icons/battery/os_battery_070.c new file mode 100644 index 0000000..949c0b8 --- /dev/null +++ b/src/displayapp/Icons/battery/os_battery_070.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_070 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_070 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_070 uint8_t ck_os_battery_070_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_battery_070 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_070_map, +}; diff --git a/src/displayapp/Icons/battery/os_battery_070.png b/src/displayapp/Icons/battery/os_battery_070.png new file mode 100644 index 0000000..dee969b Binary files /dev/null and b/src/displayapp/Icons/battery/os_battery_070.png differ diff --git a/src/displayapp/Icons/battery/os_battery_080.c b/src/displayapp/Icons/battery/os_battery_080.c new file mode 100644 index 0000000..f447370 --- /dev/null +++ b/src/displayapp/Icons/battery/os_battery_080.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_080 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_080 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_080 uint8_t ck_os_battery_080_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_battery_080 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_080_map, +}; diff --git a/src/displayapp/Icons/battery/os_battery_080.png b/src/displayapp/Icons/battery/os_battery_080.png new file mode 100644 index 0000000..3b13fbb Binary files /dev/null and b/src/displayapp/Icons/battery/os_battery_080.png differ diff --git a/src/displayapp/Icons/battery/os_battery_090.c b/src/displayapp/Icons/battery/os_battery_090.c new file mode 100644 index 0000000..6fa41b2 --- /dev/null +++ b/src/displayapp/Icons/battery/os_battery_090.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_090 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_090 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_090 uint8_t ck_os_battery_090_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_battery_090 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_090_map, +}; diff --git a/src/displayapp/Icons/battery/os_battery_090.png b/src/displayapp/Icons/battery/os_battery_090.png new file mode 100644 index 0000000..d79f396 Binary files /dev/null and b/src/displayapp/Icons/battery/os_battery_090.png differ diff --git a/src/displayapp/Icons/battery/os_battery_100.c b/src/displayapp/Icons/battery/os_battery_100.c new file mode 100644 index 0000000..92cf9a4 --- /dev/null +++ b/src/displayapp/Icons/battery/os_battery_100.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_100 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_100 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_100 uint8_t ck_os_battery_100_map[] = { + 0x7c, 0xd2, 0x34, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0xaa, 0xa5, 0x55, 0x55, 0x5a, 0xaa, + 0xaa, 0x95, 0x55, 0x55, 0x56, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, +}; + +const lv_img_dsc_t ck_os_battery_100 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 208, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_battery_100_map, +}; diff --git a/src/displayapp/Icons/battery/os_battery_100.png b/src/displayapp/Icons/battery/os_battery_100.png new file mode 100644 index 0000000..dd0d306 Binary files /dev/null and b/src/displayapp/Icons/battery/os_battery_100.png differ diff --git a/src/displayapp/Icons/battery/os_battery_error.c b/src/displayapp/Icons/battery/os_battery_error.c new file mode 100644 index 0000000..af6aba5 --- /dev/null +++ b/src/displayapp/Icons/battery/os_battery_error.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_ERROR +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_ERROR +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_ERROR uint8_t ck_os_battery_error_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xc4, 0xc2, 0xc4, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x00, 0x05, 0x55, 0x55, 0x50, 0x00, + 0x00, 0x15, 0x55, 0x55, 0x54, 0x00, + 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, + 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, + 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, + 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, + 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, + 0x55, 0x54, 0x00, 0x00, 0x15, 0x55, + 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, + 0x55, 0x00, 0xaa, 0xaa, 0x00, 0x55, + 0x55, 0x02, 0xaa, 0xaa, 0x80, 0x55, + 0x55, 0x02, 0xaa, 0xaa, 0x80, 0x55, + 0x55, 0x0a, 0xa8, 0x2a, 0xa0, 0x55, + 0x55, 0x0a, 0xa0, 0x0a, 0xa0, 0x55, + 0x55, 0x00, 0x00, 0x0a, 0xa0, 0x55, + 0x55, 0x00, 0x00, 0x2a, 0xa0, 0x55, + 0x55, 0x00, 0x02, 0xaa, 0x80, 0x55, + 0x55, 0x00, 0x0a, 0xaa, 0x80, 0x55, + 0x55, 0x00, 0x0a, 0xaa, 0x00, 0x55, + 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, + 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, + 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, + 0x55, 0x00, 0x00, 0x00, 0x00, 0x55, + 0x55, 0x00, 0x00, 0x00, 0x00, 0x55, + 0x55, 0x00, 0x02, 0x80, 0x00, 0x55, + 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, + 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, + 0x55, 0x00, 0x02, 0x80, 0x00, 0x55, + 0x55, 0x55, 0x40, 0x01, 0x55, 0x55, + 0x55, 0x55, 0x50, 0x05, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, +}; + +const lv_img_dsc_t ck_os_battery_error = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 208, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_battery_error_map, +}; diff --git a/src/displayapp/Icons/battery/os_battery_error.png b/src/displayapp/Icons/battery/os_battery_error.png new file mode 100644 index 0000000..4c7632f Binary files /dev/null and b/src/displayapp/Icons/battery/os_battery_error.png differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_005.c b/src/displayapp/Icons/battery/os_batterycharging_005.c new file mode 100644 index 0000000..1b0c71d --- /dev/null +++ b/src/displayapp/Icons/battery/os_batterycharging_005.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_005 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_005 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_005 uint8_t ck_os_batterycharging_005_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, 0x00, + 0x07, 0xff, 0xe0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x07, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x1f, 0x00, + 0xf0, 0x00, 0x3e, 0x00, + 0xf0, 0x00, 0x7e, 0x00, + 0xf0, 0x00, 0xfc, 0x00, + 0xf0, 0x01, 0xff, 0xf0, + 0xf0, 0x03, 0xff, 0xf0, + 0xf0, 0x03, 0xff, 0xf0, + 0xf0, 0x03, 0xff, 0xe0, + 0xf0, 0x00, 0x0f, 0xc0, + 0xf0, 0x00, 0x1f, 0x80, + 0xff, 0xff, 0x3f, 0x00, + 0xff, 0xff, 0x3e, 0x00, + 0xff, 0xff, 0x3c, 0x00, + 0xff, 0xff, 0x38, 0x00, +}; + +const lv_img_dsc_t ck_os_batterycharging_005 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 136, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_batterycharging_005_map, +}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_005.png b/src/displayapp/Icons/battery/os_batterycharging_005.png new file mode 100644 index 0000000..f9545bc Binary files /dev/null and b/src/displayapp/Icons/battery/os_batterycharging_005.png differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_010.c b/src/displayapp/Icons/battery/os_batterycharging_010.c new file mode 100644 index 0000000..304c018 --- /dev/null +++ b/src/displayapp/Icons/battery/os_batterycharging_010.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_010 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_010 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_010 uint8_t ck_os_batterycharging_010_map[] = { + 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, 0x55, + 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x6a, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x5a, 0xa9, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x6a, 0xa9, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0xaa, 0xa5, 0x55, + 0xaa, 0x55, 0x55, 0x56, 0xaa, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x5a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xa9, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xa5, + 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x95, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xaa, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa9, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa5, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0x95, 0x55, +}; + +const lv_img_dsc_t ck_os_batterycharging_010 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 240, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_batterycharging_010_map, +}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_010.png b/src/displayapp/Icons/battery/os_batterycharging_010.png new file mode 100644 index 0000000..04d5f82 Binary files /dev/null and b/src/displayapp/Icons/battery/os_batterycharging_010.png differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_020.c b/src/displayapp/Icons/battery/os_batterycharging_020.c new file mode 100644 index 0000000..1721be1 --- /dev/null +++ b/src/displayapp/Icons/battery/os_batterycharging_020.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_020 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_020 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_020 uint8_t ck_os_batterycharging_020_map[] = { + 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, 0x55, + 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x6a, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x5a, 0xa9, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x6a, 0xa9, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0xaa, 0xa5, 0x55, + 0xaa, 0x55, 0x55, 0x56, 0xaa, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x5a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xa9, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xa5, + 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x95, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xaa, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa9, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa5, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0x95, 0x55, +}; + +const lv_img_dsc_t ck_os_batterycharging_020 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 240, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_batterycharging_020_map, +}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_020.png b/src/displayapp/Icons/battery/os_batterycharging_020.png new file mode 100644 index 0000000..6416e1e Binary files /dev/null and b/src/displayapp/Icons/battery/os_batterycharging_020.png differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_030.c b/src/displayapp/Icons/battery/os_batterycharging_030.c new file mode 100644 index 0000000..83101fd --- /dev/null +++ b/src/displayapp/Icons/battery/os_batterycharging_030.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_030 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_030 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_030 uint8_t ck_os_batterycharging_030_map[] = { + 0x04, 0x7a, 0xf4, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, 0x55, + 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x6a, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x5a, 0xa9, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x6a, 0xa9, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0xaa, 0xa5, 0x55, + 0xaa, 0x50, 0x00, 0x56, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xa9, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xa5, + 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x95, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xaa, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa9, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa5, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0x95, 0x55, +}; + +const lv_img_dsc_t ck_os_batterycharging_030 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 240, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_batterycharging_030_map, +}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_030.png b/src/displayapp/Icons/battery/os_batterycharging_030.png new file mode 100644 index 0000000..96b44d2 Binary files /dev/null and b/src/displayapp/Icons/battery/os_batterycharging_030.png differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_040.c b/src/displayapp/Icons/battery/os_batterycharging_040.c new file mode 100644 index 0000000..02af00e --- /dev/null +++ b/src/displayapp/Icons/battery/os_batterycharging_040.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_040 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_040 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_040 uint8_t ck_os_batterycharging_040_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, 0x00, + 0x07, 0xff, 0xe0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x07, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x1f, 0x00, + 0xf0, 0x00, 0x3e, 0x00, + 0xf3, 0xf8, 0x7e, 0x00, + 0xf3, 0xf0, 0xfc, 0x00, + 0xf3, 0xf1, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xe0, + 0xf0, 0x00, 0x0f, 0xc0, + 0xf0, 0x00, 0x1f, 0x80, + 0xff, 0xff, 0x3f, 0x00, + 0xff, 0xff, 0x3e, 0x00, + 0xff, 0xff, 0x3c, 0x00, + 0xff, 0xff, 0x38, 0x00, +}; + +const lv_img_dsc_t ck_os_batterycharging_040 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 136, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_batterycharging_040_map, +}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_040.png b/src/displayapp/Icons/battery/os_batterycharging_040.png new file mode 100644 index 0000000..5a42caf Binary files /dev/null and b/src/displayapp/Icons/battery/os_batterycharging_040.png differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_050.c b/src/displayapp/Icons/battery/os_batterycharging_050.c new file mode 100644 index 0000000..d2eea82 --- /dev/null +++ b/src/displayapp/Icons/battery/os_batterycharging_050.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_050 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_050 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_050 uint8_t ck_os_batterycharging_050_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, 0x00, + 0x07, 0xff, 0xe0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x07, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf3, 0xfe, 0x1f, 0x00, + 0xf3, 0xfc, 0x3e, 0x00, + 0xf3, 0xf8, 0x7e, 0x00, + 0xf3, 0xf0, 0xfc, 0x00, + 0xf3, 0xf1, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xe0, + 0xf0, 0x00, 0x0f, 0xc0, + 0xf0, 0x00, 0x1f, 0x80, + 0xff, 0xff, 0x3f, 0x00, + 0xff, 0xff, 0x3e, 0x00, + 0xff, 0xff, 0x3c, 0x00, + 0xff, 0xff, 0x38, 0x00, +}; + +const lv_img_dsc_t ck_os_batterycharging_050 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 136, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_batterycharging_050_map, +}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_050.png b/src/displayapp/Icons/battery/os_batterycharging_050.png new file mode 100644 index 0000000..ca0e04d Binary files /dev/null and b/src/displayapp/Icons/battery/os_batterycharging_050.png differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_060.c b/src/displayapp/Icons/battery/os_batterycharging_060.c new file mode 100644 index 0000000..05f8b97 --- /dev/null +++ b/src/displayapp/Icons/battery/os_batterycharging_060.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_060 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_060 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_060 uint8_t ck_os_batterycharging_060_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, 0x00, + 0x07, 0xff, 0xe0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf3, 0xff, 0x87, 0x00, + 0xf3, 0xff, 0x0f, 0x00, + 0xf3, 0xfe, 0x1f, 0x00, + 0xf3, 0xfc, 0x3e, 0x00, + 0xf3, 0xf8, 0x7e, 0x00, + 0xf3, 0xf0, 0xfc, 0x00, + 0xf3, 0xf1, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xe0, + 0xf0, 0x00, 0x0f, 0xc0, + 0xf0, 0x00, 0x1f, 0x80, + 0xff, 0xff, 0x3f, 0x00, + 0xff, 0xff, 0x3e, 0x00, + 0xff, 0xff, 0x3c, 0x00, + 0xff, 0xff, 0x38, 0x00, +}; + +const lv_img_dsc_t ck_os_batterycharging_060 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 136, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_batterycharging_060_map, +}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_060.png b/src/displayapp/Icons/battery/os_batterycharging_060.png new file mode 100644 index 0000000..2930068 Binary files /dev/null and b/src/displayapp/Icons/battery/os_batterycharging_060.png differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_070.c b/src/displayapp/Icons/battery/os_batterycharging_070.c new file mode 100644 index 0000000..ac3e319 --- /dev/null +++ b/src/displayapp/Icons/battery/os_batterycharging_070.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_070 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_070 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_070 uint8_t ck_os_batterycharging_070_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, 0x00, + 0x07, 0xff, 0xe0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf3, 0xff, 0xc0, 0x00, + 0xf3, 0xff, 0xc0, 0x00, + 0xf3, 0xff, 0x87, 0x00, + 0xf3, 0xff, 0x0f, 0x00, + 0xf3, 0xfe, 0x1f, 0x00, + 0xf3, 0xfc, 0x3e, 0x00, + 0xf3, 0xf8, 0x7e, 0x00, + 0xf3, 0xf0, 0xfc, 0x00, + 0xf3, 0xf1, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xe0, + 0xf0, 0x00, 0x0f, 0xc0, + 0xf0, 0x00, 0x1f, 0x80, + 0xff, 0xff, 0x3f, 0x00, + 0xff, 0xff, 0x3e, 0x00, + 0xff, 0xff, 0x3c, 0x00, + 0xff, 0xff, 0x38, 0x00, +}; + +const lv_img_dsc_t ck_os_batterycharging_070 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 136, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_batterycharging_070_map, +}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_070.png b/src/displayapp/Icons/battery/os_batterycharging_070.png new file mode 100644 index 0000000..7d5f55d Binary files /dev/null and b/src/displayapp/Icons/battery/os_batterycharging_070.png differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_080.c b/src/displayapp/Icons/battery/os_batterycharging_080.c new file mode 100644 index 0000000..cc1c1d2 --- /dev/null +++ b/src/displayapp/Icons/battery/os_batterycharging_080.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_080 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_080 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_080 uint8_t ck_os_batterycharging_080_map[] = { + 0x7c, 0xd2, 0x34, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0xaa, 0xa5, 0x55, 0x55, 0x5a, 0xaa, 0xaa, + 0xaa, 0x95, 0x55, 0x55, 0x56, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x2a, 0x95, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0xaa, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x02, 0xa9, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x0a, 0xa5, 0x56, 0xaa, + 0x55, 0xa0, 0x00, 0x2a, 0x95, 0x56, 0xaa, + 0x55, 0xa0, 0x00, 0xaa, 0x55, 0x5a, 0xaa, + 0x55, 0xa0, 0x00, 0xa9, 0x55, 0x55, 0x55, + 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, + 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, + 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x56, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x5a, + 0x55, 0xaa, 0xaa, 0xaa, 0xa9, 0x55, 0x6a, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x55, 0xaa, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x56, 0xaa, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x5a, 0xaa, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x6a, 0xaa, +}; + +const lv_img_dsc_t ck_os_batterycharging_080 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 240, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_batterycharging_080_map, +}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_080.png b/src/displayapp/Icons/battery/os_batterycharging_080.png new file mode 100644 index 0000000..cce5052 Binary files /dev/null and b/src/displayapp/Icons/battery/os_batterycharging_080.png differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_090.c b/src/displayapp/Icons/battery/os_batterycharging_090.c new file mode 100644 index 0000000..85e1c26 --- /dev/null +++ b/src/displayapp/Icons/battery/os_batterycharging_090.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_090 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_090 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_090 uint8_t ck_os_batterycharging_090_map[] = { + 0x7c, 0xd2, 0x34, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0xaa, 0xa5, 0x55, 0x55, 0x5a, 0xaa, 0xaa, + 0xaa, 0x95, 0x55, 0x55, 0x56, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x2a, 0x95, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0xaa, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x02, 0xa9, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x0a, 0xa5, 0x56, 0xaa, + 0x55, 0xa0, 0x00, 0x2a, 0x95, 0x56, 0xaa, + 0x55, 0xa0, 0x00, 0xaa, 0x55, 0x5a, 0xaa, + 0x55, 0xa0, 0x00, 0xa9, 0x55, 0x55, 0x55, + 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, + 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, + 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x56, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x5a, + 0x55, 0xaa, 0xaa, 0xaa, 0xa9, 0x55, 0x6a, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x55, 0xaa, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x56, 0xaa, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x5a, 0xaa, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x6a, 0xaa, +}; + +const lv_img_dsc_t ck_os_batterycharging_090 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 240, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_batterycharging_090_map, +}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_090.png b/src/displayapp/Icons/battery/os_batterycharging_090.png new file mode 100644 index 0000000..fc7b443 Binary files /dev/null and b/src/displayapp/Icons/battery/os_batterycharging_090.png differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_100.c b/src/displayapp/Icons/battery/os_batterycharging_100.c new file mode 100644 index 0000000..8dec0cb --- /dev/null +++ b/src/displayapp/Icons/battery/os_batterycharging_100.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_100 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_100 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_100 uint8_t ck_os_batterycharging_100_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x07, 0x0f, + 0xf0, 0x0f, 0x0f, + 0xf0, 0x1f, 0x0f, + 0xf0, 0x3e, 0x0f, + 0xf0, 0x7e, 0x0f, + 0xf0, 0xfc, 0x0f, + 0xf1, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0x8f, + 0xf0, 0x3f, 0x0f, + 0xf0, 0x7e, 0x0f, + 0xf0, 0x7c, 0x0f, + 0xf0, 0xf8, 0x0f, + 0xf0, 0xf0, 0x0f, + 0xf0, 0xe0, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_batterycharging_100 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_batterycharging_100_map, +}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_100.png b/src/displayapp/Icons/battery/os_batterycharging_100.png new file mode 100644 index 0000000..7c8ce0c Binary files /dev/null and b/src/displayapp/Icons/battery/os_batterycharging_100.png differ diff --git a/src/displayapp/Icons/bluetooth/ck_os_bt_connected.png b/src/displayapp/Icons/bluetooth/ck_os_bt_connected.png new file mode 100644 index 0000000..5371611 Binary files /dev/null and b/src/displayapp/Icons/bluetooth/ck_os_bt_connected.png differ diff --git a/src/displayapp/Icons/bluetooth/ck_os_bt_disconnected.png b/src/displayapp/Icons/bluetooth/ck_os_bt_disconnected.png new file mode 100644 index 0000000..3275895 Binary files /dev/null and b/src/displayapp/Icons/bluetooth/ck_os_bt_disconnected.png differ diff --git a/src/displayapp/Icons/bluetooth/os_bt_connected.c b/src/displayapp/Icons/bluetooth/os_bt_connected.c new file mode 100644 index 0000000..d30dc9d --- /dev/null +++ b/src/displayapp/Icons/bluetooth/os_bt_connected.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BT_CONNECTED +#define LV_ATTRIBUTE_IMG_CK_OS_BT_CONNECTED +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BT_CONNECTED uint8_t ck_os_bt_connected_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x00, 0x0e, 0x00, 0x00, + 0x00, 0x0f, 0x00, 0x00, + 0x00, 0x0f, 0x80, 0x00, + 0x00, 0x0f, 0xc0, 0x00, + 0x00, 0x0f, 0xe0, 0x00, + 0x00, 0x0f, 0xf0, 0x00, + 0x03, 0x8f, 0xf8, 0x00, + 0x03, 0xcf, 0x7c, 0x00, + 0x03, 0xef, 0x3e, 0x00, + 0x01, 0xff, 0x1f, 0x00, + 0x00, 0xff, 0x1f, 0x00, + 0x00, 0x7f, 0x3e, 0x00, + 0x00, 0x3f, 0x7c, 0x00, + 0x00, 0x1f, 0xf8, 0x00, + 0x00, 0x0f, 0xf0, 0x00, + 0x00, 0x0f, 0xe0, 0x00, + 0x00, 0x0f, 0xe0, 0x00, + 0x00, 0x0f, 0xf0, 0x00, + 0x00, 0x1f, 0xf8, 0x00, + 0x00, 0x3f, 0x7c, 0x00, + 0x00, 0x7f, 0x3e, 0x00, + 0x00, 0xff, 0x1f, 0x00, + 0x01, 0xff, 0x1f, 0x00, + 0x03, 0xef, 0x3e, 0x00, + 0x03, 0xcf, 0x7c, 0x00, + 0x03, 0x8f, 0xf8, 0x00, + 0x00, 0x0f, 0xf0, 0x00, + 0x00, 0x0f, 0xe0, 0x00, + 0x00, 0x0f, 0xc0, 0x00, + 0x00, 0x0f, 0x80, 0x00, + 0x00, 0x0f, 0x00, 0x00, + 0x00, 0x0e, 0x00, 0x00, +}; + +const lv_img_dsc_t ck_os_bt_connected = { + .header.always_zero = 0, + .header.w = 32, + .header.h = 32, + .data_size = 136, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_bt_connected_map, +}; diff --git a/src/displayapp/Icons/bluetooth/os_bt_connected.png b/src/displayapp/Icons/bluetooth/os_bt_connected.png new file mode 100644 index 0000000..5371611 Binary files /dev/null and b/src/displayapp/Icons/bluetooth/os_bt_connected.png differ diff --git a/src/displayapp/Icons/bluetooth/os_bt_disconnected.c b/src/displayapp/Icons/bluetooth/os_bt_disconnected.c new file mode 100644 index 0000000..930179b --- /dev/null +++ b/src/displayapp/Icons/bluetooth/os_bt_disconnected.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BT_DISCONNECTED +#define LV_ATTRIBUTE_IMG_CK_OS_BT_DISCONNECTED +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BT_DISCONNECTED uint8_t ck_os_bt_disconnected_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xc4, 0xc2, 0xc4, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, + 0x2a, 0x80, 0x00, 0x55, 0x40, 0x00, 0x00, 0x00, + 0x2a, 0xa0, 0x00, 0x55, 0x50, 0x00, 0x00, 0x00, + 0x0a, 0xa8, 0x00, 0x55, 0x54, 0x00, 0x00, 0x00, + 0x02, 0xaa, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, + 0x00, 0xaa, 0x80, 0x55, 0x55, 0x40, 0x00, 0x00, + 0x00, 0x2a, 0xa0, 0x55, 0x15, 0x50, 0x00, 0x00, + 0x00, 0x0a, 0xa8, 0x15, 0x05, 0x54, 0x00, 0x00, + 0x00, 0x02, 0xaa, 0x05, 0x01, 0x55, 0x00, 0x00, + 0x00, 0x00, 0xaa, 0x81, 0x01, 0x55, 0x00, 0x00, + 0x00, 0x00, 0x2a, 0xa0, 0x05, 0x54, 0x00, 0x00, + 0x00, 0x00, 0x0a, 0xa8, 0x15, 0x50, 0x00, 0x00, + 0x00, 0x00, 0x02, 0xaa, 0x05, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xaa, 0x81, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x2a, 0xa0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0a, 0xa8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x42, 0xaa, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x50, 0xaa, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x54, 0x2a, 0xa0, 0x00, 0x00, + 0x00, 0x00, 0x15, 0x55, 0x0a, 0xa8, 0x00, 0x00, + 0x00, 0x00, 0x55, 0x55, 0x02, 0xaa, 0x00, 0x00, + 0x00, 0x01, 0x55, 0x55, 0x00, 0xaa, 0x80, 0x00, + 0x00, 0x05, 0x54, 0x55, 0x04, 0x2a, 0xa0, 0x00, + 0x00, 0x05, 0x50, 0x55, 0x15, 0x0a, 0xa8, 0x00, + 0x00, 0x05, 0x40, 0x55, 0x55, 0x42, 0xaa, 0x00, + 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0xaa, 0x80, + 0x00, 0x00, 0x00, 0x55, 0x54, 0x00, 0x2a, 0xa0, + 0x00, 0x00, 0x00, 0x55, 0x50, 0x00, 0x0a, 0xa8, + 0x00, 0x00, 0x00, 0x55, 0x40, 0x00, 0x02, 0xa8, + 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0xa0, + 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, +}; + +const lv_img_dsc_t ck_os_bt_disconnected = { + .header.always_zero = 0, + .header.w = 32, + .header.h = 32, + .data_size = 272, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_bt_disconnected_map, +}; diff --git a/src/displayapp/Icons/bluetooth/os_bt_disconnected.png b/src/displayapp/Icons/bluetooth/os_bt_disconnected.png new file mode 100644 index 0000000..3275895 Binary files /dev/null and b/src/displayapp/Icons/bluetooth/os_bt_disconnected.png differ diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp new file mode 100644 index 0000000..3483f8e --- /dev/null +++ b/src/displayapp/LittleVgl.cpp @@ -0,0 +1,836 @@ +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "LittleVgl.h" + +using namespace Pinetime::Components; + +extern "C" { +LV_FONT_DECLARE(jetbrains_mono_extrabold_compressed) +LV_FONT_DECLARE(jetbrains_mono_bold_20) +} + +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) { + 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) { + 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} { + lv_init(); + InitTheme(); + InitDisplay(); + InitTouchpad(); +} + +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*/ + + /*Set up the functions to access to your display*/ + + /*Set the resolution of the display*/ + disp_drv.hor_res = 240; + disp_drv.ver_res = 240; + + /*Used to copy the buffer's content to the display*/ + disp_drv.flush_cb = disp_flush; + /*Set a display buffer*/ + disp_drv.buffer = &disp_buf_2; + disp_drv.user_data = this; + + /*Finally register the driver*/ + lv_disp_drv_register(&disp_drv); +} + +void LittleVgl::InitTouchpad() { + lv_indev_drv_t indev_drv; + + lv_indev_drv_init(&indev_drv); + indev_drv.type = LV_INDEV_TYPE_POINTER; + indev_drv.read_cb = touchpad_read; + indev_drv.user_data = this; + lv_indev_drv_register(&indev_drv); +} + +void LittleVgl::SetFullRefresh(FullRefreshDirections direction) { + if(scrollDirection == FullRefreshDirections::None) { + scrollDirection = direction; + if (scrollDirection == FullRefreshDirections::Down) + lv_disp_set_direction(lv_disp_get_default(), 1); + } +} + +void LittleVgl::FlushDisplay(const lv_area_t *area, lv_color_t *color_p) { + ulTaskNotifyTake(pdTRUE, 500); + // 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. + + + // TODO refactore and remove duplicated code + + uint16_t x, y, y1, y2, width, height = 0; + if(scrollDirection == LittleVgl::FullRefreshDirections::Down) { + if(area->y2 == visibleNbLines-1) { + writeOffset = ((writeOffset + totalNbLines) - visibleNbLines) % totalNbLines; + } + x = area->x1; + width = (area->x2 - area->x1) + 1; + + y1 = (area->y1 + writeOffset) % totalNbLines; + y2 = (area->y2 + writeOffset) % totalNbLines; + y = y1; + height = (y2 - y1) + 1; + + if(area->y2 < visibleNbLines - 1) { + uint16_t toScroll = 0; + if(area->y1 == 0) { + toScroll = height*2; + scrollDirection = FullRefreshDirections::None; + lv_disp_set_direction(lv_disp_get_default(), 0); + } else { + toScroll = height; + } + + if(scrollOffset >= toScroll) + scrollOffset -= toScroll; + else { + toScroll -= scrollOffset; + scrollOffset = (totalNbLines) - toScroll; + } + + lcd.VerticalScrollDefinition(0, 320, 0); + lcd.VerticalScrollStartAddress(scrollOffset); + } + + lcd.BeginDrawBuffer(x, y, width, height); + lcd.NextDrawBuffer(reinterpret_cast(color_p), width * height*2) ; + + } else if(scrollDirection == FullRefreshDirections::Up) { + if(area->y1 == 0) { + writeOffset = (writeOffset + visibleNbLines) % totalNbLines; + } + + x = area->x1; + width = (area->x2 - area->x1) + 1; + + y1 = (area->y1 + writeOffset) % totalNbLines; + y2 = (area->y2 + writeOffset) % totalNbLines; + y = y1; + height = (y2 - y1) + 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); + } else { + scrollOffset += height; + } + scrollOffset = scrollOffset % totalNbLines; + lcd.VerticalScrollDefinition(0, 320, 0); + lcd.VerticalScrollStartAddress(scrollOffset); + } + + lcd.BeginDrawBuffer(x, y, width, height); + lcd.NextDrawBuffer(reinterpret_cast(color_p), width * height*2); + } else { + x = area->x1; + width = (area->x2 - area->x1) + 1; + y1 = (area->y1 + writeOffset) % totalNbLines; + y2 = (area->y2 + writeOffset) % totalNbLines; + y = y1; + height = (y2 - y1) + 1; + + if (y2 < y1) { + height = (totalNbLines - 1) - y1; + lcd.BeginDrawBuffer(x, y1, width, height); + lcd.NextDrawBuffer(reinterpret_cast(color_p), width * height * 2); + ulTaskNotifyTake(pdTRUE, 500); + height = y2; + lcd.BeginDrawBuffer(x, 0, width, height); + lcd.NextDrawBuffer(reinterpret_cast(color_p), width * height * 2); + } else { + lcd.BeginDrawBuffer(x, y, width, height); + lcd.NextDrawBuffer(reinterpret_cast(color_p), width * height * 2); + } + } + + /* IMPORTANT!!! + * Inform the graphics library that you are ready with the flushing*/ + lv_disp_flush_ready(&disp_drv); +} + +void LittleVgl::SetNewTapEvent(uint16_t x, uint16_t y) { + tap_x = x; + tap_y = y; + tapped = true; +} + +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; + tapped = false; + } else { + ptr->state = LV_INDEV_STATE_REL; + } + return false; + /* + auto info = touchPanel.GetTouchInfo(); + + if((previousClick.x != info.x || previousClick.y != info.y) && + (info.gesture == Drivers::Cst816S::Gestures::SingleTap)) { + // TODO For an unknown reason, the first touch is taken twice into account. + // 'firstTouch' is a quite'n'dirty workaound until I find a better solution + if(firstTouch) ptr->state = LV_INDEV_STATE_REL; + else ptr->state = LV_INDEV_STATE_PR; + firstTouch = false; + previousClick.x = info.x; + previousClick.y = info.y; + } + else { + ptr->state = LV_INDEV_STATE_REL; + } + + ptr->point.x = info.x; + ptr->point.y = info.y; + return false; + */ +} + +void LittleVgl::InitTheme() { + uint16_t i; + lv_style_t ** style_p = (lv_style_t **)&theme.style; + for(i = 0; i < LV_THEME_STYLE_COUNT; i++) { + *style_p = &def; + style_p++; + } + + InitBaseTheme(); + InitThemeContainer(); + InitThemeButton(); + InitThemeLabel(); + InitThemeLine(); + InitThemeLed(); + InitThemeImage(); + InitThemeBar(); + InitThemeSlider(); + InitThemeSwitch(); + InitThemeMeter(); + InitThemeGauge(); + InitThemeArc(); + InitThemePreload(); + InitThemeChart(); + InitThemeCalendar(); + InitThemeCheckBox(); + InitThemeButtonMatrix(); + InitThemeKnob(); + InitThemeMessageBox(); + InitThemePage(); + InitThemeTextArea(); + InitThemeSpinBox(); + InitThemeList(); + InitThemeDropDownList(); + InitThemeRoller(); + InitThemeTabView(); + InitThemeTileView(); + InitThemeTable(); + InitThemeWindow(); + + lv_theme_set_current(&theme); +} + +void LittleVgl::InitBaseTheme() { + if(font == nullptr) font = &jetbrains_mono_bold_20; + lv_style_copy(&def, &lv_style_plain); /*Initialize the default style*/ + def.text.font = font; + + lv_style_copy(&bg, &lv_style_plain); + bg.body.main_color = LV_COLOR_BLACK; + bg.body.grad_color = LV_COLOR_BLACK; + bg.text.color = LV_COLOR_WHITE; + bg.text.font = font; + bg.image.color = LV_COLOR_WHITE; + + lv_style_copy(&scr, &bg); + scr.body.padding.bottom = 0; + scr.body.padding.top = 0; + scr.body.padding.left = 0; + scr.body.padding.right = 0; + + lv_style_copy(&sb, &def); + sb.body.main_color = lv_color_hsv_to_rgb(hue, 30, 60); + sb.body.grad_color = lv_color_hsv_to_rgb(hue, 30, 60); + sb.body.border.width = 0; + sb.body.padding.inner = LV_DPI / 20; + sb.body.padding.left = 0; + sb.body.padding.right = 0; + sb.body.padding.top = 0; + sb.body.padding.bottom = 0; + sb.body.radius = LV_DPI / 30; + sb.body.opa = LV_OPA_COVER; + + lv_style_copy(&panel, &bg); + panel.body.main_color = lv_color_hsv_to_rgb(hue, 11, 18); + panel.body.grad_color = lv_color_hsv_to_rgb(hue, 11, 18); + panel.body.radius = LV_DPI / 20; + panel.body.border.color = lv_color_hsv_to_rgb(hue, 10, 25); + panel.body.border.width = 1; + panel.body.border.opa = LV_OPA_COVER; + panel.body.padding.left = LV_DPI / 10; + panel.body.padding.right = LV_DPI / 10; + panel.body.padding.top = LV_DPI / 10; + panel.body.padding.bottom = LV_DPI / 10; + panel.line.color = lv_color_hsv_to_rgb(hue, 20, 40); + panel.line.width = 1; + + theme.style.scr = &scr; + theme.style.bg = &bg; + theme.style.panel = &def; +} + +void LittleVgl::InitThemeContainer() { + theme.style.cont = &panel; +} + +void LittleVgl::InitThemeButton() { + + + lv_style_copy(&btn_rel, &def); + btn_rel.body.main_color = lv_color_hsv_to_rgb(hue, 10, 40); + btn_rel.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 20); + btn_rel.body.border.color = lv_color_hex3(0x111); + btn_rel.body.border.width = 1; + btn_rel.body.border.opa = LV_OPA_70; + btn_rel.body.padding.left = LV_DPI / 4; + btn_rel.body.padding.right = LV_DPI / 4; + btn_rel.body.padding.top = LV_DPI / 8; + btn_rel.body.padding.bottom = LV_DPI / 8; + btn_rel.body.shadow.type = LV_SHADOW_BOTTOM; + btn_rel.body.shadow.color = lv_color_hex3(0x111); + btn_rel.body.shadow.width = LV_DPI / 30; + btn_rel.text.color = lv_color_hex3(0xeee); + btn_rel.image.color = lv_color_hex3(0xeee); + + lv_style_copy(&btn_pr, &btn_rel); + btn_pr.body.main_color = lv_color_hsv_to_rgb(hue, 10, 30); + btn_pr.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 10); + + lv_style_copy(&btn_tgl_rel, &btn_rel); + btn_tgl_rel.body.main_color = lv_color_hsv_to_rgb(hue, 10, 20); + btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 40); + btn_tgl_rel.body.shadow.width = LV_DPI / 40; + btn_tgl_rel.text.color = lv_color_hex3(0xddd); + btn_tgl_rel.image.color = lv_color_hex3(0xddd); + + lv_style_copy(&btn_tgl_pr, &btn_rel); + btn_tgl_pr.body.main_color = lv_color_hsv_to_rgb(hue, 10, 10); + btn_tgl_pr.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 30); + btn_tgl_pr.body.shadow.width = LV_DPI / 30; + btn_tgl_pr.text.color = lv_color_hex3(0xddd); + btn_tgl_pr.image.color = lv_color_hex3(0xddd); + + lv_style_copy(&btn_ina, &btn_rel); + btn_ina.body.main_color = lv_color_hsv_to_rgb(hue, 10, 20); + btn_ina.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 20); + btn_ina.body.shadow.width = 0; + btn_ina.text.color = lv_color_hex3(0xaaa); + btn_ina.image.color = lv_color_hex3(0xaaa); + + theme.style.btn.rel = &btn_rel; + theme.style.btn.pr = &btn_pr; + theme.style.btn.tgl_rel = &btn_tgl_rel; + theme.style.btn.tgl_pr = &btn_tgl_pr; + theme.style.btn.ina = &btn_ina; +} + +void LittleVgl::InitThemeLabel() { + lv_style_copy(&prim, &bg); + prim.text.color = lv_color_hsv_to_rgb(hue, 5, 95); + + lv_style_copy(&labelBigStyle, &prim); + labelBigStyle.text.font = &jetbrains_mono_extrabold_compressed; + LabelBigStyle = &(this->labelBigStyle); + + lv_style_copy(&sec, &bg); + sec.text.color = lv_color_hsv_to_rgb(hue, 15, 65); + + lv_style_copy(&hint, &bg); + hint.text.color = lv_color_hsv_to_rgb(hue, 20, 55); + + theme.style.label.prim = &prim; + theme.style.label.sec = &sec; + theme.style.label.hint = &hint; +} + +void LittleVgl::InitThemeLine() { + theme.style.line.decor = &def; +} + +void LittleVgl::InitThemeLed() { + lv_style_copy(&led, &def); + led.body.shadow.width = LV_DPI / 10; + led.body.radius = LV_RADIUS_CIRCLE; + led.body.border.width = LV_DPI / 30; + led.body.border.opa = LV_OPA_30; + led.body.main_color = lv_color_hsv_to_rgb(hue, 100, 100); + led.body.grad_color = lv_color_hsv_to_rgb(hue, 100, 40); + led.body.border.color = lv_color_hsv_to_rgb(hue, 60, 60); + led.body.shadow.color = lv_color_hsv_to_rgb(hue, 100, 100); + + theme.style.led = &led; +} + +void LittleVgl::InitThemeImage() { + theme.style.img.light = &def; + theme.style.img.dark = &def; +} + +void LittleVgl::InitThemeBar() { + lv_style_copy(&bar_bg, &panel); + bar_bg.body.padding.left = LV_DPI / 16; + bar_bg.body.padding.right = LV_DPI / 16; + bar_bg.body.padding.top = LV_DPI / 16; + bar_bg.body.padding.bottom = LV_DPI / 16; + bar_bg.body.radius = LV_RADIUS_CIRCLE; + + lv_style_copy(&bar_indic, &def); + bar_indic.body.main_color = lv_color_hsv_to_rgb(hue, 80, 70); + bar_indic.body.grad_color = lv_color_hsv_to_rgb(hue, 80, 70); + bar_indic.body.border.color = lv_color_hsv_to_rgb(hue, 20, 15); + bar_indic.body.border.width = 1; + bar_indic.body.border.opa = LV_OPA_COVER; + bar_indic.body.radius = LV_RADIUS_CIRCLE; + bar_indic.body.padding.left = 0; + bar_indic.body.padding.right = 0; + bar_indic.body.padding.top = 0; + bar_indic.body.padding.bottom = 0; + + theme.style.bar.bg = &bar_bg; + theme.style.bar.indic = &bar_indic; +} + +void LittleVgl::InitThemeSlider() { + lv_style_copy(&slider_knob, theme.style.btn.rel); + slider_knob.body.radius = LV_RADIUS_CIRCLE; + + theme.style.slider.bg = theme.style.bar.bg; + theme.style.slider.indic = theme.style.bar.indic; + theme.style.slider.knob = &slider_knob; +} + +void LittleVgl::InitThemeSwitch() { + theme.style.sw.bg = theme.style.bar.bg; + theme.style.sw.indic = theme.style.bar.indic; + theme.style.sw.knob_off = theme.style.slider.knob; + theme.style.sw.knob_on = theme.style.slider.knob; +} + +void LittleVgl::InitThemeMeter() { + static lv_style_t lmeter_bg; + lv_style_copy(&lmeter_bg, &def); + lmeter_bg.body.main_color = lv_color_hsv_to_rgb(hue, 10, 70); + lmeter_bg.body.grad_color = lv_color_hsv_to_rgb(hue, 95, 90); + lmeter_bg.body.padding.left = LV_DPI / 10; /*Scale line length*/ + lmeter_bg.body.padding.inner = LV_DPI / 10; /*Text padding*/ + lmeter_bg.body.border.color = lv_color_hex3(0x333); + lmeter_bg.line.color = lv_color_hex3(0x555); + lmeter_bg.line.width = 1; + lmeter_bg.text.color = lv_color_hex3(0xddd); + + theme.style.lmeter = &lmeter_bg; +} + +void LittleVgl::InitThemeGauge() { + static lv_style_t gauge_bg; + lv_style_copy(&gauge_bg, &def); + gauge_bg.body.main_color = lv_color_hsv_to_rgb(hue, 10, 70); + gauge_bg.body.grad_color = gauge_bg.body.main_color; + gauge_bg.line.color = lv_color_hsv_to_rgb(hue, 80, 75); + gauge_bg.line.width = 1; + gauge_bg.text.color = lv_color_hex3(0xddd); + + theme.style.gauge = &gauge_bg; +} + +void LittleVgl::InitThemeArc() { + lv_style_copy(&arc, &def); + arc.line.width = 8; + arc.line.color = lv_color_hsv_to_rgb(hue, 80, 70); + arc.line.rounded = 1; + + /*For preloader*/ + arc.body.border.width = 7; + arc.body.border.color = lv_color_hsv_to_rgb(hue, 11, 48); + arc.body.padding.left = 1; + arc.body.padding.right = 1; + arc.body.padding.top = 1; + arc.body.padding.bottom = 1; + + theme.style.arc = &arc; +} + +void LittleVgl::InitThemePreload() { +// theme.style.preload = theme.style.arc; +} + +void LittleVgl::InitThemeChart() { + theme.style.chart = &panel; +} + +void LittleVgl::InitThemeCalendar() { + + lv_style_copy(&cal_bg, &bg); + cal_bg.body.main_color = lv_color_hsv_to_rgb(hue, 10, 40); + cal_bg.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 40); + cal_bg.body.border.color = lv_color_hex3(0x333); + cal_bg.body.border.width = 1; + cal_bg.body.radius = LV_DPI / 20; + cal_bg.body.padding.left = LV_DPI / 10; + cal_bg.body.padding.right = LV_DPI / 10; + cal_bg.body.padding.top = LV_DPI / 10; + cal_bg.body.padding.bottom = LV_DPI / 10; + + + lv_style_copy(&cal_header, &bg); + cal_header.body.main_color = lv_color_hsv_to_rgb(hue, 10, 20); + cal_header.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 20); + cal_header.body.radius = 0; + cal_header.body.border.width = 1; + cal_header.body.border.color = lv_color_hex3(0x333); + cal_header.body.padding.left = LV_DPI / 10; + cal_header.body.padding.right = LV_DPI / 10; + cal_header.body.padding.top = LV_DPI / 10; + cal_header.body.padding.bottom = LV_DPI / 10; + + + lv_style_copy(&week_box, &panel); + week_box.body.main_color = lv_color_hsv_to_rgb(hue, 30, 45); + week_box.body.grad_color = lv_color_hsv_to_rgb(hue, 30, 45); + week_box.body.radius = LV_DPI / 20; + week_box.body.border.width = 1; + week_box.body.padding.left = LV_DPI / 20; + week_box.body.padding.right = LV_DPI / 20; + week_box.body.padding.top = LV_DPI / 25; + week_box.body.padding.bottom = LV_DPI / 25; + + lv_style_copy(&today_box, &week_box); + today_box.body.main_color = lv_color_hsv_to_rgb(hue, 80, 70); + today_box.body.grad_color = lv_color_hsv_to_rgb(hue, 80, 70); + today_box.body.radius = LV_DPI / 20; + today_box.body.padding.left = LV_DPI / 14; + today_box.body.padding.right = LV_DPI / 14; + today_box.body.padding.top = LV_DPI / 14; + today_box.body.padding.bottom = LV_DPI / 14; + + lv_style_copy(&highlighted_days, &bg); + highlighted_days.text.color = lv_color_hsv_to_rgb(hue, 40, 80); + + lv_style_copy(&ina_days, &bg); + ina_days.text.color = lv_color_hsv_to_rgb(hue, 0, 60); + + theme.style.calendar.bg = &cal_bg; + theme.style.calendar.header = &cal_header; + theme.style.calendar.week_box = &week_box; + theme.style.calendar.today_box = &today_box; + theme.style.calendar.highlighted_days = &highlighted_days; + theme.style.calendar.day_names = &cal_bg; + theme.style.calendar.inactive_days = &ina_days; +} + +void LittleVgl::InitThemeCheckBox() { + + lv_style_copy(&rel, &def); + rel.body.radius = LV_DPI / 20; + rel.body.main_color = lv_color_hsv_to_rgb(hue, 10, 95); + rel.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 95); + rel.body.border.color = lv_color_hsv_to_rgb(hue, 10, 50); + rel.body.border.width = 2; + ; + + lv_style_copy(&pr, &rel); + pr.body.main_color = lv_color_hsv_to_rgb(hue, 10, 80); + pr.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 80); + pr.body.border.color = lv_color_hsv_to_rgb(hue, 10, 20); + pr.body.border.width = 1; + ; + + lv_style_copy(&tgl_rel, &rel); + tgl_rel.body.main_color = lv_color_hsv_to_rgb(hue, 80, 90); + tgl_rel.body.grad_color = lv_color_hsv_to_rgb(hue, 80, 90); + tgl_rel.body.border.color = lv_color_hsv_to_rgb(hue, 80, 50); + + lv_style_copy(&tgl_pr, &tgl_rel); + tgl_pr.body.main_color = lv_color_hsv_to_rgb(hue, 80, 70); + tgl_pr.body.grad_color = lv_color_hsv_to_rgb(hue, 80, 70); + tgl_pr.body.border.color = lv_color_hsv_to_rgb(hue, 80, 30); + tgl_pr.body.border.width = 1; + ; + + lv_style_copy(&ina, &rel); + ina.body.main_color = lv_color_hex3(0x777); + ina.body.grad_color = lv_color_hex3(0x777); + ina.body.border.width = 0; + + theme.style.cb.bg = &lv_style_transp; + theme.style.cb.box.rel = &rel; + theme.style.cb.box.pr = ≺ + theme.style.cb.box.tgl_rel = &tgl_rel; + theme.style.cb.box.tgl_pr = &tgl_pr; + theme.style.cb.box.ina = &def; +} + +void LittleVgl::InitThemeButtonMatrix() { + + lv_style_copy(&btnm_bg, theme.style.btn.rel); + btnm_bg.body.padding.left = 2; + btnm_bg.body.padding.right = 2; + btnm_bg.body.padding.top = 2; + btnm_bg.body.padding.bottom = 2; + btnm_bg.body.padding.inner = 0; + btnm_bg.body.border.width = 1; + + lv_style_copy(&btnm_rel, theme.style.btn.rel); + btnm_rel.body.border.part = LV_BORDER_FULL | LV_BORDER_INTERNAL; + btnm_rel.body.border.width = 1; + btnm_rel.body.radius = 2; + + lv_style_copy(&btnm_pr, theme.style.btn.pr); + btnm_pr.body.border.part = btnm_rel.body.border.part; + btnm_pr.body.border.width = btnm_rel.body.border.width; + btnm_pr.body.radius = btnm_rel.body.radius; + + lv_style_copy(&btnm_tgl_rel, theme.style.btn.tgl_rel); + btnm_tgl_rel.body.border.part = btnm_rel.body.border.part; + btnm_tgl_rel.body.border.width = btnm_rel.body.border.width; + btnm_tgl_rel.body.radius = btnm_rel.body.radius; + + lv_style_copy(&btnm_tgl_pr, theme.style.btn.pr); + btnm_tgl_pr.body.border.part = btnm_rel.body.border.part; + btnm_tgl_pr.body.border.width = btnm_rel.body.border.width; + btnm_tgl_pr.body.radius = btnm_rel.body.radius; + + lv_style_copy(&btnm_ina, theme.style.btn.ina); + btnm_ina.body.border.part = btnm_rel.body.border.part; + btnm_ina.body.border.width = btnm_rel.body.border.width; + btnm_ina.body.radius = btnm_rel.body.radius; + + theme.style.btnm.bg = &btnm_bg; + theme.style.btnm.btn.rel = &btnm_rel; + theme.style.btnm.btn.pr = &btnm_pr; + theme.style.btnm.btn.tgl_rel = &btnm_tgl_rel; + theme.style.btnm.btn.tgl_pr = &btnm_tgl_pr; + theme.style.btnm.btn.ina = &btnm_ina; +} + +void LittleVgl::InitThemeKnob() { + theme.style.kb.bg = &bg; + theme.style.kb.btn.rel = theme.style.btn.rel; + theme.style.kb.btn.pr = theme.style.btn.pr; + theme.style.kb.btn.tgl_rel = theme.style.btn.tgl_rel; + theme.style.kb.btn.tgl_pr = theme.style.btn.tgl_pr; + theme.style.kb.btn.ina = theme.style.btn.ina; +} + +void LittleVgl::InitThemeMessageBox() { + lv_style_copy(&mbox_bg, &bg); + mbox_bg.body.main_color = lv_color_hsv_to_rgb(hue, 30, 30); + mbox_bg.body.grad_color = lv_color_hsv_to_rgb(hue, 30, 30); + mbox_bg.body.border.color = lv_color_hsv_to_rgb(hue, 11, 20); + mbox_bg.body.border.width = 1; + mbox_bg.body.shadow.width = LV_DPI / 10; + mbox_bg.body.shadow.color = lv_color_hex3(0x222); + mbox_bg.body.radius = LV_DPI / 20; + theme.style.mbox.bg = &mbox_bg; + theme.style.mbox.btn.bg = &lv_style_transp; + theme.style.mbox.btn.rel = theme.style.btn.rel; + theme.style.mbox.btn.pr = theme.style.btn.pr; +} + +void LittleVgl::InitThemePage() { + lv_style_copy(&page_scrl, &bg); + page_scrl.body.main_color = lv_color_hsv_to_rgb(hue, 10, 40); + page_scrl.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 40); + page_scrl.body.border.color = lv_color_hex3(0x333); + page_scrl.body.border.width = 1; + page_scrl.body.radius = LV_DPI / 20; + + theme.style.page.bg = &panel; + theme.style.page.scrl = &page_scrl; + theme.style.page.sb = &sb; +} + +void LittleVgl::InitThemeTextArea() { + theme.style.ta.area = &panel; + theme.style.ta.oneline = &panel; + theme.style.ta.cursor = NULL; + theme.style.ta.sb = &def; +} + +void LittleVgl::InitThemeSpinBox() { + theme.style.spinbox.bg = &panel; + theme.style.spinbox.cursor = theme.style.ta.cursor; + theme.style.spinbox.sb = theme.style.ta.sb; +} + +void LittleVgl::InitThemeList() { + + lv_style_copy(&list_bg, &panel); + list_bg.body.padding.top = 0; + list_bg.body.padding.bottom = 0; + list_bg.body.padding.left = 0; + list_bg.body.padding.right = 0; + list_bg.body.padding.inner = 0; + + lv_style_copy(&list_btn_rel, &bg); + list_btn_rel.body.opa = LV_OPA_TRANSP; + list_btn_rel.body.border.part = LV_BORDER_BOTTOM; + list_btn_rel.body.border.color = lv_color_hsv_to_rgb(hue, 10, 5); + list_btn_rel.body.border.width = 1; + list_btn_rel.body.radius = LV_DPI / 10; + list_btn_rel.text.color = lv_color_hsv_to_rgb(hue, 5, 80); + list_btn_rel.image.color = lv_color_hsv_to_rgb(hue, 5, 80); + list_btn_rel.body.padding.top = LV_DPI / 6; + list_btn_rel.body.padding.bottom = LV_DPI / 6; + list_btn_rel.body.padding.left = LV_DPI / 8; + list_btn_rel.body.padding.right = LV_DPI / 8; + + lv_style_copy(&list_btn_pr, theme.style.btn.pr); + list_btn_pr.body.main_color = lv_color_hsv_to_rgb(hue, 10, 5); + list_btn_pr.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 5); + list_btn_pr.body.border.color = lv_color_hsv_to_rgb(hue, 10, 5); + list_btn_pr.body.border.width = 0; + list_btn_pr.body.padding.top = LV_DPI / 6; + list_btn_pr.body.padding.bottom = LV_DPI / 6; + list_btn_pr.body.padding.left = LV_DPI / 8; + list_btn_pr.body.padding.right = LV_DPI / 8; + list_btn_pr.text.color = lv_color_hsv_to_rgb(hue, 5, 80); + list_btn_pr.image.color = lv_color_hsv_to_rgb(hue, 5, 80); + + lv_style_copy(&list_btn_tgl_rel, &list_btn_rel); + list_btn_tgl_rel.body.opa = LV_OPA_COVER; + list_btn_tgl_rel.body.main_color = lv_color_hsv_to_rgb(hue, 80, 70); + list_btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(hue, 80, 70); + list_btn_tgl_rel.body.border.color = lv_color_hsv_to_rgb(hue, 60, 40); + list_btn_tgl_rel.body.radius = list_bg.body.radius; + + lv_style_copy(&list_btn_tgl_pr, &list_btn_tgl_rel); + list_btn_tgl_pr.body.main_color = lv_color_hsv_to_rgb(hue, 80, 60); + list_btn_tgl_pr.body.grad_color = lv_color_hsv_to_rgb(hue, 80, 60); + + theme.style.list.sb = &sb; + theme.style.list.bg = &list_bg; + theme.style.list.scrl = &lv_style_transp_tight; + theme.style.list.btn.rel = &list_btn_rel; + theme.style.list.btn.pr = &list_btn_pr; + theme.style.list.btn.tgl_rel = &list_btn_tgl_rel; + theme.style.list.btn.tgl_pr = &list_btn_tgl_pr; + theme.style.list.btn.ina = &def; +} + +void LittleVgl::InitThemeDropDownList() { + lv_style_copy(&ddlist_bg, theme.style.btn.rel); + ddlist_bg.text.line_space = LV_DPI / 8; + ddlist_bg.body.padding.top = LV_DPI / 8; + ddlist_bg.body.padding.bottom = LV_DPI / 8; + ddlist_bg.body.padding.left = LV_DPI / 8; + ddlist_bg.body.padding.right = LV_DPI / 8; + ddlist_bg.body.radius = LV_DPI / 30; + + lv_style_copy(&ddlist_sel, theme.style.btn.rel); + ddlist_sel.body.main_color = lv_color_hsv_to_rgb(hue, 20, 50); + ddlist_sel.body.grad_color = lv_color_hsv_to_rgb(hue, 20, 50); + ddlist_sel.body.radius = 0; + + theme.style.ddlist.bg = &ddlist_bg; + theme.style.ddlist.sel = &ddlist_sel; + theme.style.ddlist.sb = &def; +} + +void LittleVgl::InitThemeRoller() { + lv_style_t roller_bg; + + lv_style_copy(&roller_bg, theme.style.ddlist.bg); + roller_bg.body.main_color = lv_color_hsv_to_rgb(hue, 10, 20); + roller_bg.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 40); + roller_bg.text.color = lv_color_hsv_to_rgb(hue, 5, 70); + roller_bg.text.opa = LV_OPA_60; + + theme.style.roller.bg = &roller_bg; + theme.style.roller.sel = theme.style.ddlist.sel; +} + +void LittleVgl::InitThemeTabView() { + theme.style.tabview.bg = &bg; + theme.style.tabview.indic = &lv_style_transp; + theme.style.tabview.btn.bg = &lv_style_transp; + theme.style.tabview.btn.rel = theme.style.btn.rel; + theme.style.tabview.btn.pr = theme.style.btn.pr; + theme.style.tabview.btn.tgl_rel = theme.style.btn.tgl_rel; + theme.style.tabview.btn.tgl_pr = theme.style.btn.tgl_pr; +} + +void LittleVgl::InitThemeTileView() { + theme.style.tileview.bg = &lv_style_transp_tight; + theme.style.tileview.scrl = &lv_style_transp_tight; + theme.style.tileview.sb = theme.style.page.sb; +} + +void LittleVgl::InitThemeTable() { + lv_style_copy(&cell, &panel); + cell.body.radius = 0; + cell.body.border.width = 1; + cell.body.padding.left = LV_DPI / 12; + cell.body.padding.right = LV_DPI / 12; + cell.body.padding.top = LV_DPI / 12; + cell.body.padding.bottom = LV_DPI / 12; + + theme.style.table.bg = &lv_style_transp_tight; + theme.style.table.cell = &cell; +} + +void LittleVgl::InitThemeWindow() { +// lv_style_copy(&win_bg, &bg); +// win_bg.body.border.color = lv_color_hex3(0x333); +// win_bg.body.border.width = 1; +// +// lv_style_copy(&win_header, &win_bg); +// win_header.body.main_color = lv_color_hsv_to_rgb(hue, 10, 20); +// win_header.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 20); +// win_header.body.radius = 0; +// win_header.body.padding.left = 0; +// win_header.body.padding.right = 0; +// win_header.body.padding.top = 0; +// win_header.body.padding.bottom = 0; +// +// lv_style_copy(&win_btn_pr, &def); +// win_btn_pr.body.main_color = lv_color_hsv_to_rgb(hue, 10, 10); +// win_btn_pr.body.grad_color = lv_color_hsv_to_rgb(hue, 10, 10); +// win_btn_pr.text.color = lv_color_hex3(0xaaa); +// win_btn_pr.image.color = lv_color_hex3(0xaaa); +// +// theme.style.win.bg = &win_bg; +// theme.style.win.sb = &sb; +// theme.style.win.header = &win_header; +// theme.style.win.content = &lv_style_transp; +// theme.style.win.btn.rel = &lv_style_transp; +// theme.style.win.btn.pr = &win_btn_pr; +} + + + diff --git a/src/displayapp/LittleVgl.h b/src/displayapp/LittleVgl.h new file mode 100644 index 0000000..5c1c443 --- /dev/null +++ b/src/displayapp/LittleVgl.h @@ -0,0 +1,116 @@ +#pragma once + +#include +#include +#include +#include +#include + +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); + void SetFullRefresh(FullRefreshDirections direction); + void SetNewTapEvent(uint16_t x, uint16_t y); + + private: + void InitDisplay(); + void InitTouchpad(); + void InitTheme(); + void InitBaseTheme(); + void InitThemeContainer(); + void InitThemeButton(); + void InitThemeLabel(); + void InitThemeLine(); + void InitThemeLed(); + void InitThemeImage(); + void InitThemeBar(); + void InitThemeSlider(); + void InitThemeSwitch(); + void InitThemeMeter(); + void InitThemeGauge(); + void InitThemeArc(); + void InitThemePreload(); + void InitThemeChart(); + void InitThemeCalendar(); + void InitThemeCheckBox(); + void InitThemeButtonMatrix(); + void InitThemeKnob(); + void InitThemeMessageBox(); + void InitThemePage(); + void InitThemeTextArea(); + void InitThemeSpinBox(); + void InitThemeList(); + void InitThemeDropDownList(); + void InitThemeRoller(); + void InitThemeTabView(); + void InitThemeTileView(); + void InitThemeTable(); + void InitThemeWindow(); + + 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_style_t def; + lv_style_t scr, bg, sb, panel; + lv_font_t * font = nullptr; + uint16_t hue = 10; + lv_theme_t theme; + lv_style_t btn_rel, btn_pr, btn_tgl_rel, btn_tgl_pr, btn_ina; + lv_style_t labelBigStyle; + lv_style_t prim, sec, hint; + lv_style_t led; + lv_style_t bar_bg, bar_indic; + lv_style_t slider_knob; + lv_style_t arc; + lv_style_t cal_bg; + lv_style_t cal_header; + lv_style_t week_box; + lv_style_t today_box; + lv_style_t highlighted_days; + lv_style_t ina_days; + lv_style_t rel, pr, tgl_rel, tgl_pr, ina; + lv_style_t btnm_bg, btnm_rel, btnm_pr, btnm_tgl_rel, btnm_tgl_pr, btnm_ina; + lv_style_t mbox_bg; + lv_style_t page_scrl; + lv_style_t list_bg, list_btn_rel, list_btn_pr, list_btn_tgl_rel, list_btn_tgl_pr; + lv_style_t ddlist_bg, ddlist_sel; + lv_style_t cell; + lv_style_t win_bg; + lv_style_t win_header; + lv_style_t win_btn_pr; + + 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; + }; + } +} + diff --git a/src/displayapp/Screens/ApplicationList.cpp b/src/displayapp/Screens/ApplicationList.cpp new file mode 100644 index 0000000..eb85be4 --- /dev/null +++ b/src/displayapp/Screens/ApplicationList.cpp @@ -0,0 +1,82 @@ +#include +#include +#include +#include "ApplicationList.h" +#include "Tile.h" +#include "Symbols.h" + +using namespace Pinetime::Applications::Screens; + +ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp *app) : + Screen(app), + screens{app, { + [this]() -> std::unique_ptr { return CreateScreen1(); }, + [this]() -> std::unique_ptr { return CreateScreen2(); }, + //[this]() -> std::unique_ptr { return CreateScreen3(); } + } + } {} + + +ApplicationList::~ApplicationList() { + lv_obj_clean(lv_scr_act()); +} + +bool ApplicationList::Refresh() { + if(running) + running = screens.Refresh(); + return running; +} + +bool ApplicationList::OnButtonPushed() { + running = false; + app->StartApp(Apps::Clock); + return true; +} + +bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + return screens.OnTouchEvent(event); +} + +std::unique_ptr ApplicationList::CreateScreen1() { + std::array applications { + {{Symbols::clock, Apps::Clock}, + {Symbols::music, Apps::Music}, + {Symbols::sun, Apps::Brightness}, + {Symbols::list, Apps::SysInfo}, + {Symbols::check, Apps::FirmwareValidation}, + {Symbols::none, Apps::None} + } + + + }; + + return std::unique_ptr(new Screens::Tile(app, applications)); +} + +std::unique_ptr ApplicationList::CreateScreen2() { + std::array applications { + {{Symbols::tachometer, Apps::Gauge}, + {Symbols::asterisk, Apps::Meter}, + {Symbols::paintbrush, Apps::Paint}, + {Symbols::none, Apps::None}, + {Symbols::none, Apps::None}, + {Symbols::none, Apps::None} + } + }; + + return std::unique_ptr(new Screens::Tile(app, applications)); +} + +std::unique_ptr ApplicationList::CreateScreen3() { + std::array applications { + {{"A", Apps::Meter}, + {"B", Apps::Gauge}, + {"C", Apps::Clock}, + {"D", Apps::Music}, + {"E", Apps::SysInfo}, + {"F", Apps::Brightness} + } + }; + + return std::unique_ptr(new Screens::Tile(app, applications)); +} diff --git a/src/displayapp/Screens/ApplicationList.h b/src/displayapp/Screens/ApplicationList.h new file mode 100644 index 0000000..a1e6811 --- /dev/null +++ b/src/displayapp/Screens/ApplicationList.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include "Label.h" +#include "ScreenList.h" +#include "Gauge.h" +#include "Meter.h" +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + class ApplicationList : public Screen { + public: + explicit ApplicationList(DisplayApp* app); + ~ApplicationList() override; + bool Refresh() override; + bool OnButtonPushed() override; + bool OnTouchEvent(TouchEvents event) override; + private: + bool running = true; + + ScreenList<2> screens; + std::unique_ptr CreateScreen1(); + std::unique_ptr CreateScreen2(); + std::unique_ptr CreateScreen3(); + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/Screens/BatteryIcon.cpp b/src/displayapp/Screens/BatteryIcon.cpp new file mode 100644 index 0000000..26939d1 --- /dev/null +++ b/src/displayapp/Screens/BatteryIcon.cpp @@ -0,0 +1,21 @@ +#include "BatteryIcon.h" +#include "Symbols.h" +using namespace Pinetime::Applications::Screens; + +const char* BatteryIcon::GetBatteryIcon(float batteryPercent) { + if(batteryPercent > 90.0f) return Symbols::batteryFull; + if(batteryPercent > 75.0f) return Symbols::batteryThreeQuarter; + if(batteryPercent > 50.0f) return Symbols::batteryHalf; + if(batteryPercent > 25.0f) return Symbols::batteryOneQuarter; + return Symbols::batteryEmpty; +} + +const char* BatteryIcon::GetUnknownIcon() { + return Symbols::batteryEmpty; +} + +const char *BatteryIcon::GetPlugIcon(bool isCharging) { + if(isCharging) + return Symbols::plug; + else return ""; +} diff --git a/src/displayapp/Screens/BatteryIcon.h b/src/displayapp/Screens/BatteryIcon.h new file mode 100644 index 0000000..58f04a8 --- /dev/null +++ b/src/displayapp/Screens/BatteryIcon.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + class BatteryIcon { + public: + static const char* GetUnknownIcon(); + static const char* GetBatteryIcon(float batteryPercent); + static const char* GetPlugIcon(bool isCharging); + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/Screens/BleIcon.cpp b/src/displayapp/Screens/BleIcon.cpp new file mode 100644 index 0000000..1bbbd05 --- /dev/null +++ b/src/displayapp/Screens/BleIcon.cpp @@ -0,0 +1,8 @@ +#include "BleIcon.h" +#include "Symbols.h" +using namespace Pinetime::Applications::Screens; + +const char* BleIcon::GetIcon(bool isConnected) { + if(isConnected) return Symbols::bluetooth; + else return ""; +} \ No newline at end of file diff --git a/src/displayapp/Screens/BleIcon.h b/src/displayapp/Screens/BleIcon.h new file mode 100644 index 0000000..c1398d2 --- /dev/null +++ b/src/displayapp/Screens/BleIcon.h @@ -0,0 +1,12 @@ +#pragma once + +namespace Pinetime { + namespace Applications { + namespace Screens { + class BleIcon { + public: + static const char* GetIcon(bool isConnected); + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/Screens/Brightness.cpp b/src/displayapp/Screens/Brightness.cpp new file mode 100644 index 0000000..9e3416c --- /dev/null +++ b/src/displayapp/Screens/Brightness.cpp @@ -0,0 +1,92 @@ +#include +#include "Brightness.h" + +using namespace Pinetime::Applications::Screens; + +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} { + slider = lv_slider_create(lv_scr_act(), NULL); + lv_obj_set_user_data(slider, this); + lv_obj_set_width(slider, LV_DPI * 2); + lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_event_cb(slider, slider_event_cb); + lv_slider_set_range(slider, 0, 2); + lv_slider_set_value(slider, LevelToInt(brightness.Level()), LV_ANIM_OFF); + + slider_label = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(slider_label, LevelToString(brightness.Level())); + lv_obj_set_auto_realign(slider_label, true); + lv_obj_align(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); +} + +Brightness::~Brightness() { + lv_obj_clean(lv_scr_act()); +} + +bool Brightness::Refresh() { + return running; +} + +bool Brightness::OnButtonPushed() { + running = false; + return true; +} + +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 "???"; + } +} + +void Brightness::OnValueChanged() { + SetValue(lv_slider_get_value(slider)); +} + +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; + } + 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; + } +} + +bool Brightness::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + switch(event) { + case TouchEvents::SwipeLeft: + brightness.Lower(); + SetValue(); + return true; + case TouchEvents::SwipeRight: + brightness.Higher(); + SetValue(); + return true; + default: + return false; + } +} + +void Brightness::SetValue() { + lv_slider_set_value(slider, LevelToInt(brightness.Level()), LV_ANIM_OFF); + lv_label_set_text(slider_label, LevelToString(brightness.Level())); +} diff --git a/src/displayapp/Screens/Brightness.h b/src/displayapp/Screens/Brightness.h new file mode 100644 index 0000000..37cbcd7 --- /dev/null +++ b/src/displayapp/Screens/Brightness.h @@ -0,0 +1,33 @@ +#pragma once + +#include +#include +#include "Screen.h" + +namespace Pinetime { + namespace Applications { + namespace Screens { + class Brightness : public Screen { + public: + Brightness(DisplayApp* app, Controllers::BrightnessController& brightness); + ~Brightness() override; + bool Refresh() override; + bool OnButtonPushed() override; + bool OnTouchEvent(TouchEvents event) override; + + void OnValueChanged(); + private: + bool running = true; + 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(); + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/Screens/Clock.cpp b/src/displayapp/Screens/Clock.cpp new file mode 100644 index 0000000..06fab9a --- /dev/null +++ b/src/displayapp/Screens/Clock.cpp @@ -0,0 +1,227 @@ +#include +#include +#include +#include +#include "Clock.h" +#include "../DisplayApp.h" +#include "BatteryIcon.h" +#include "BleIcon.h" +#include "Symbols.h" +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; +extern lv_style_t* LabelBigStyle; + +static void event_handler(lv_obj_t * obj, lv_event_t event) { + Clock* screen = static_cast(obj->user_data); + screen->OnObjectEvent(obj, event); +} + +Clock::Clock(DisplayApp* app, + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController) : Screen(app), currentDateTime{{}}, + dateTimeController{dateTimeController}, batteryController{batteryController}, bleController{bleController} { + displayedChar[0] = 0; + displayedChar[1] = 0; + displayedChar[2] = 0; + displayedChar[3] = 0; + displayedChar[4] = 0; + + batteryIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(batteryIcon, Symbols::batteryFull); + lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 2); + + batteryPlug = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(batteryPlug, Symbols::plug); + lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); + + bleIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(bleIcon, Symbols::bluetooth); + lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); + + + label_date = lv_label_create(lv_scr_act(), NULL); + + lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); + + label_time = lv_label_create(lv_scr_act(), NULL); + lv_label_set_style(label_time, LV_LABEL_STYLE_MAIN, LabelBigStyle); + lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0); + + backgroundLabel = lv_label_create(lv_scr_act(), NULL); + backgroundLabel->user_data = this; + lv_obj_set_click(backgroundLabel, true); + lv_obj_set_event_cb(backgroundLabel, event_handler); + 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(backgroundLabel, ""); + + + heartbeatIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(heartbeatIcon, Symbols::heartBeat); + lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2); + + heartbeatValue = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(heartbeatValue, "0"); + lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0); + + heartbeatBpm = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(heartbeatBpm, "BPM"); + lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0); + + stepValue = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(stepValue, "0"); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2); + + stepIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(stepIcon, Symbols::shoe); + lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); +} + +Clock::~Clock() { + lv_obj_clean(lv_scr_act()); +} + +bool Clock::Refresh() { + batteryPercentRemaining = batteryController.PercentRemaining(); + if (batteryPercentRemaining.IsUpdated()) { + auto batteryPercent = batteryPercentRemaining.Get(); + lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); + auto isCharging = batteryController.IsCharging() || batteryController.IsPowerPresent(); + lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging)); + } + + bleState = bleController.IsConnected(); + if (bleState.IsUpdated()) { + if(bleState.Get() == true) { + lv_label_set_text(bleIcon, BleIcon::GetIcon(true)); + } else { + lv_label_set_text(bleIcon, BleIcon::GetIcon(false)); + } + } + lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 5); + lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); + lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); + + currentDateTime = dateTimeController.CurrentDateTime(); + + if(currentDateTime.IsUpdated()) { + auto newDateTime = currentDateTime.Get(); + + auto dp = date::floor(newDateTime); + 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 dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); + + auto hour = time.hours().count(); + auto minute = time.minutes().count(); + + char minutesChar[3]; + sprintf(minutesChar, "%02d", static_cast(minute)); + + char hoursChar[3]; + sprintf(hoursChar, "%02d", static_cast(hour)); + + char timeStr[6]; + sprintf(timeStr, "%c%c:%c%c", hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]); + + 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]; + displayedChar[3] = minutesChar[1]; + + lv_label_set_text(label_time, timeStr); + } + + if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { + char dateStr[22]; + sprintf(dateStr, "%s %d %s %d", DayOfWeekToString(dayOfWeek), day, MonthToString(month), year); + lv_label_set_text(label_date, dateStr); + + + currentYear = year; + currentMonth = month; + currentDayOfWeek = dayOfWeek; + currentDay = day; + } + } + + // TODO heartbeat = heartBeatController.GetValue(); + if(heartbeat.IsUpdated()) { + char heartbeatBuffer[4]; + sprintf(heartbeatBuffer, "%d", heartbeat.Get()); + lv_label_set_text(heartbeatValue, heartbeatBuffer); + 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); + } + + // TODO stepCount = stepController.GetValue(); + if(stepCount.IsUpdated()) { + char stepBuffer[5]; + sprintf(stepBuffer, "%lu", stepCount.Get()); + lv_label_set_text(stepValue, stepBuffer); + 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); + } + + return running; +} + +const char *Clock::MonthToString(Pinetime::Controllers::DateTime::Months month) { + return Clock::MonthsString[static_cast(month)]; +} + +const char *Clock::DayOfWeekToString(Pinetime::Controllers::DateTime::Days dayOfWeek) { + return Clock::DaysString[static_cast(dayOfWeek)]; +} + +char const *Clock::DaysString[] = { + "", + "MONDAY", + "TUESDAY", + "WEDNESDAY", + "THURSDAY", + "FRIDAY", + "SATURDAY", + "SUNDAY" +}; + +char const *Clock::MonthsString[] = { + "", + "JAN", + "FEB", + "MAR", + "APR", + "MAY", + "JUN", + "JUL", + "AUG", + "SEP", + "OCT", + "NOV", + "DEC" +}; + +void Clock::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { + if(obj == backgroundLabel) { + if (event == LV_EVENT_CLICKED) { + + running = false; + } + } +} + +bool Clock::OnButtonPushed() { + running = false; + return false; +} + + diff --git a/src/displayapp/Screens/Clock.h b/src/displayapp/Screens/Clock.h new file mode 100644 index 0000000..7363fda --- /dev/null +++ b/src/displayapp/Screens/Clock.h @@ -0,0 +1,88 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include +#include +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + template + class DirtyValue { + public: + explicit DirtyValue(T v) { value = v; } + explicit DirtyValue(T& v) { value = v; } + bool IsUpdated() const { return isUpdated; } + T& Get() { this->isUpdated = false; return value; } + + DirtyValue& operator=(const T& other) { + if (this->value != other) { + this->value = other; + this->isUpdated = true; + } + return *this; + } + private: + T value; + bool isUpdated = true; + }; + class Clock : public Screen{ + public: + Clock(DisplayApp* app, + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController); + ~Clock() override; + + bool Refresh() override; + bool OnButtonPushed() override; + + void OnObjectEvent(lv_obj_t *pObj, lv_event_t i); + private: + static const char* MonthToString(Pinetime::Controllers::DateTime::Months month); + static const char* DayOfWeekToString(Pinetime::Controllers::DateTime::Days dayOfWeek); + static char const *DaysString[]; + static char const *MonthsString[]; + + 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; + + DirtyValue batteryPercentRemaining {0}; + DirtyValue bleState {false}; + DirtyValue> currentDateTime; + DirtyValue stepCount {0}; + DirtyValue heartbeat {0}; + + + lv_obj_t* label_time; + 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; + + Controllers::DateTime& dateTimeController; + Controllers::Battery& batteryController; + Controllers::Ble& bleController; + + bool running = true; + + }; + } + } +} diff --git a/src/displayapp/Screens/DropDownDemo.cpp b/src/displayapp/Screens/DropDownDemo.cpp new file mode 100644 index 0000000..735a0cc --- /dev/null +++ b/src/displayapp/Screens/DropDownDemo.cpp @@ -0,0 +1,64 @@ +#include +#include +#include "DropDownDemo.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + +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(), NULL); + 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); + lv_obj_align(ddlist, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); +} + +DropDownDemo::~DropDownDemo() { + // Reset the touchmode + app->SetTouchMode(DisplayApp::TouchModes::Gestures); + lv_obj_clean(lv_scr_act()); +} + +bool DropDownDemo::Refresh() { + 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) + app->SetTouchMode(DisplayApp::TouchModes::Polling); + else + app->SetTouchMode(DisplayApp::TouchModes::Gestures); + return running; +} + +bool DropDownDemo::OnButtonPushed() { + running = false; + return true; +} + +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) { + return true; + } else { + return false; + } +} + diff --git a/src/displayapp/Screens/DropDownDemo.h b/src/displayapp/Screens/DropDownDemo.h new file mode 100644 index 0000000..7c75efc --- /dev/null +++ b/src/displayapp/Screens/DropDownDemo.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include "Screen.h" +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class DropDownDemo : public Screen{ + public: + DropDownDemo(DisplayApp* app); + ~DropDownDemo() override; + + bool Refresh() override; + bool OnButtonPushed() override; + bool OnTouchEvent(TouchEvents event) override; + + private: + lv_obj_t * ddlist; + bool running = true; + bool isDropDownOpened = false; + }; + } + } +} diff --git a/src/displayapp/Screens/FirmwareUpdate.cpp b/src/displayapp/Screens/FirmwareUpdate.cpp new file mode 100644 index 0000000..e831114 --- /dev/null +++ b/src/displayapp/Screens/FirmwareUpdate.cpp @@ -0,0 +1,82 @@ +#include +#include "FirmwareUpdate.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + + +FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Ble& bleController) : + Screen(app), bleController{bleController} { + + titleLabel = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(titleLabel, "Firmware update"); + lv_obj_set_auto_realign(titleLabel, true); + lv_obj_align(titleLabel, NULL, LV_ALIGN_IN_TOP_MID, 0, 50); + + bar1 = lv_bar_create(lv_scr_act(), NULL); + lv_obj_set_size(bar1, 200, 30); + lv_obj_align(bar1, NULL, LV_ALIGN_CENTER, 0, 0); + lv_bar_set_anim_time(bar1, 10); + lv_bar_set_range(bar1, 0, 100); + lv_bar_set_value(bar1, 0, LV_ANIM_OFF); + + percentLabel = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(percentLabel, ""); + lv_obj_set_auto_realign(percentLabel, true); + lv_obj_align(percentLabel, bar1, LV_ALIGN_OUT_TOP_MID, 0, 60); +} + +FirmwareUpdate::~FirmwareUpdate() { + lv_obj_clean(lv_scr_act()); +} + +bool FirmwareUpdate::Refresh() { + switch(bleController.State()) { + default: + case Pinetime::Controllers::Ble::FirmwareUpdateStates::Idle: + case Pinetime::Controllers::Ble::FirmwareUpdateStates::Running: + if(state != States::Running) + state = States::Running; + return DisplayProgression(); + case Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated: + if(state != States::Validated) { + UpdateValidated(); + state = States::Validated; + } + return running; + case Pinetime::Controllers::Ble::FirmwareUpdateStates::Error: + if(state != States::Error) { + UpdateError(); + state = States::Error; + } + return running; + } +} + +bool FirmwareUpdate::DisplayProgression() const { + float current = bleController.FirmwareUpdateCurrentBytes() / 1024.0f; + float total = bleController.FirmwareUpdateTotalBytes() / 1024.0f; + int16_t pc = (current / total) * 100.0f; + sprintf(percentStr, "%d %%", pc); + lv_label_set_text(percentLabel, percentStr); + + lv_bar_set_value(bar1, pc, LV_ANIM_OFF); + return running; +} + +bool FirmwareUpdate::OnButtonPushed() { + running = false; + return true; +} + +void FirmwareUpdate::UpdateValidated() { + lv_label_set_recolor(percentLabel, true); + lv_label_set_text(percentLabel, "#00ff00 Image Ok!#"); +} + +void FirmwareUpdate::UpdateError() { + lv_label_set_recolor(percentLabel, true); + lv_label_set_text(percentLabel, "#ff0000 Error!#"); +} diff --git a/src/displayapp/Screens/FirmwareUpdate.h b/src/displayapp/Screens/FirmwareUpdate.h new file mode 100644 index 0000000..faaf395 --- /dev/null +++ b/src/displayapp/Screens/FirmwareUpdate.h @@ -0,0 +1,41 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class FirmwareUpdate : public Screen{ + public: + FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController); + ~FirmwareUpdate() override; + + bool Refresh() override; + bool OnButtonPushed() 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]; + bool running = true; + States state; + + bool DisplayProgression() const; + + void UpdateValidated(); + + void UpdateError(); + }; + } + } +} diff --git a/src/displayapp/Screens/FirmwareValidation.cpp b/src/displayapp/Screens/FirmwareValidation.cpp new file mode 100644 index 0000000..fb2dd95 --- /dev/null +++ b/src/displayapp/Screens/FirmwareValidation.cpp @@ -0,0 +1,91 @@ +#include +#include "FirmwareValidation.h" +#include "../DisplayApp.h" +#include "../../Version.h" +#include "../../Components/FirmwareValidator/FirmwareValidator.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + +namespace { + 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} { + labelVersionInfo = lv_label_create(lv_scr_act(), NULL); + lv_obj_align(labelVersionInfo, NULL, 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(), NULL); + lv_obj_align(labelVersionValue, labelVersionInfo, LV_ALIGN_OUT_RIGHT_MID, 0, 0); + lv_label_set_recolor(labelVersionValue, true); + sprintf(version, "%ld.%ld.%ld", Version::Major(), Version::Minor(), Version::Patch()); + lv_label_set_text(labelVersionValue, version); + + labelIsValidated = lv_label_create(lv_scr_act(), NULL); + lv_obj_align(labelIsValidated, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 50); + lv_label_set_recolor(labelIsValidated, true); + lv_label_set_long_mode(labelIsValidated, LV_LABEL_LONG_BREAK); + lv_obj_set_width(labelIsValidated, 240); + + 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."); + + buttonValidate = lv_btn_create(lv_scr_act(), NULL); + lv_obj_align(buttonValidate, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); + buttonValidate->user_data = this; + lv_obj_set_event_cb(buttonValidate, ButtonEventHandler); + + labelButtonValidate = lv_label_create(buttonValidate, NULL); + lv_label_set_recolor(labelButtonValidate, true); + lv_label_set_text(labelButtonValidate, "#00ff00 Validate#"); + + buttonReset = lv_btn_create(lv_scr_act(), NULL); + buttonReset->user_data = this; + lv_obj_align(buttonReset, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); + lv_obj_set_event_cb(buttonReset, ButtonEventHandler); + + labelButtonReset = lv_label_create(buttonReset, NULL); + lv_label_set_recolor(labelButtonReset, true); + lv_label_set_text(labelButtonReset, "#ff0000 Reset#"); + } +} + + +FirmwareValidation::~FirmwareValidation() { + lv_obj_clean(lv_scr_act()); +} + +bool FirmwareValidation::Refresh() { + return running; +} + +bool FirmwareValidation::OnButtonPushed() { + running = false; + return true; +} + +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) { + validator.Reset(); + } + +} + + diff --git a/src/displayapp/Screens/FirmwareValidation.h b/src/displayapp/Screens/FirmwareValidation.h new file mode 100644 index 0000000..947f557 --- /dev/null +++ b/src/displayapp/Screens/FirmwareValidation.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include "Screen.h" +#include +#include +#include + +namespace Pinetime { + namespace Controllers { + class FirmwareValidator; + } + + namespace Applications { + namespace Screens { + + class FirmwareValidation : public Screen{ + public: + FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator); + ~FirmwareValidation() override; + + bool Refresh() override; + bool OnButtonPushed() override; + + void OnButtonEvent(lv_obj_t *object, lv_event_t event); + + 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; + bool running = true; + }; + } + } +} diff --git a/src/displayapp/Screens/Gauge.cpp b/src/displayapp/Screens/Gauge.cpp new file mode 100644 index 0000000..fd90523 --- /dev/null +++ b/src/displayapp/Screens/Gauge.cpp @@ -0,0 +1,58 @@ +#include +#include "Gauge.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + + +Gauge::Gauge(Pinetime::Applications::DisplayApp *app) : Screen(app) { + /*Create a style*/ + lv_style_copy(&style, &lv_style_pretty_color); + style.body.main_color = LV_COLOR_CYAN; /*Line color at the beginning*/ + style.body.grad_color = LV_COLOR_RED; /*Line color at the end*/ + style.body.padding.left = 10; /*Scale line length*/ + style.body.padding.inner = 8 ; /*Scale label padding*/ + style.body.border.color = lv_color_hex3(0x333); /*Needle middle circle color*/ + style.line.width = 3; + style.text.color = LV_COLOR_WHITE; + style.line.color = LV_COLOR_RED; /*Line color after the critical value*/ + + + /*Describe the color for the needles*/ + + needle_colors[0] = LV_COLOR_ORANGE; + + /*Create a gauge*/ + gauge1 = lv_gauge_create(lv_scr_act(), NULL); + lv_gauge_set_style(gauge1, LV_GAUGE_STYLE_MAIN, &style); + lv_gauge_set_needle_count(gauge1, 1, needle_colors); + lv_obj_set_size(gauge1, 180, 180); + lv_obj_align(gauge1, NULL, LV_ALIGN_CENTER, 0, 0); + lv_gauge_set_scale(gauge1, 360, 60, 0); + lv_gauge_set_range(gauge1, 0, 59); + + /*Set the values*/ + lv_gauge_set_value(gauge1, 0, value); +} + +Gauge::~Gauge() { + + + lv_obj_clean(lv_scr_act()); +} + +bool Gauge::Refresh() { +// lv_lmeter_set_value(lmeter, value++); /*Set the current value*/ +// if(value>=60) value = 0; + + lv_gauge_set_value(gauge1, 0, value++); + if(value == 59) value = 0; + return running; +} + +bool Gauge::OnButtonPushed() { + running = false; + return true; +} diff --git a/src/displayapp/Screens/Gauge.h b/src/displayapp/Screens/Gauge.h new file mode 100644 index 0000000..03c06be --- /dev/null +++ b/src/displayapp/Screens/Gauge.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include "Screen.h" +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class Gauge : public Screen{ + public: + Gauge(DisplayApp* app); + ~Gauge() override; + + bool Refresh() override; + bool OnButtonPushed() override; + + private: + lv_style_t style; + lv_color_t needle_colors[3]; + lv_obj_t * gauge1; + + uint32_t value=30; + bool running = true; + + }; + } + } +} diff --git a/src/displayapp/Screens/InfiniPaint.cpp b/src/displayapp/Screens/InfiniPaint.cpp new file mode 100644 index 0000000..b340f5d --- /dev/null +++ b/src/displayapp/Screens/InfiniPaint.cpp @@ -0,0 +1,44 @@ +#include +#include +#include "InfiniPaint.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + +InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp *app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl{lvgl} { + app->SetTouchMode(DisplayApp::TouchModes::Polling); + std::fill(b, b+bufferSize, LV_COLOR_WHITE); +} + +InfiniPaint::~InfiniPaint() { + // Reset the touchmode + app->SetTouchMode(DisplayApp::TouchModes::Gestures); + lv_obj_clean(lv_scr_act()); +} + +bool InfiniPaint::Refresh() { + return running; +} + +bool InfiniPaint::OnButtonPushed() { + running = false; + return true; +} + +bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + return true; +} + +bool InfiniPaint::OnTouchEvent(uint16_t x, uint16_t y) { + lv_area_t area; + area.x1 = x-(width/2); + area.y1 = y-(height/2); + area.x2 = x+(width/2)-1; + area.y2 = y+(height/2)-1; + lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::None); + lvgl.FlushDisplay(&area, b); + return true; +} + diff --git a/src/displayapp/Screens/InfiniPaint.h b/src/displayapp/Screens/InfiniPaint.h new file mode 100644 index 0000000..a1592f9 --- /dev/null +++ b/src/displayapp/Screens/InfiniPaint.h @@ -0,0 +1,35 @@ +#pragma once + +#include +#include "Screen.h" +#include +#include +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class InfiniPaint : public Screen{ + public: + InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl); + ~InfiniPaint() override; + + bool Refresh() override; + bool OnButtonPushed() override; + bool OnTouchEvent(TouchEvents event) override; + bool OnTouchEvent(uint16_t x, uint16_t y) override; + + private: + Pinetime::Components::LittleVgl& lvgl; + static constexpr uint16_t width = 10; + static constexpr uint16_t height = 10; + static constexpr uint16_t bufferSize = width*height; + lv_color_t b[bufferSize]; + bool running = true; + }; + } + } +} diff --git a/src/displayapp/Screens/Label.cpp b/src/displayapp/Screens/Label.cpp new file mode 100644 index 0000000..780ee88 --- /dev/null +++ b/src/displayapp/Screens/Label.cpp @@ -0,0 +1,15 @@ +#include +#include "Label.h" + +using namespace Pinetime::Applications::Screens; + +Label::Label(Pinetime::Applications::DisplayApp *app, const char *text) : Screen(app), text{text} { + label = lv_label_create(lv_scr_act(), NULL); + lv_label_set_align(label, LV_LABEL_ALIGN_LEFT); + lv_obj_set_size(label, 240, 240); + lv_label_set_text(label, text); +} + +Label::~Label() { + lv_obj_clean(lv_scr_act()); +} diff --git a/src/displayapp/Screens/Label.h b/src/displayapp/Screens/Label.h new file mode 100644 index 0000000..3e7b379 --- /dev/null +++ b/src/displayapp/Screens/Label.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include "Screen.h" +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class Label : public Screen { + public: + Label(DisplayApp* app, const char* text); + ~Label() override; + bool Refresh() override {return false;} + + private: + lv_obj_t * label = nullptr; + const char* text = nullptr; + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/Screens/Meter.cpp b/src/displayapp/Screens/Meter.cpp new file mode 100644 index 0000000..c74b8bd --- /dev/null +++ b/src/displayapp/Screens/Meter.cpp @@ -0,0 +1,47 @@ +#include +#include "Meter.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + + +Meter::Meter(Pinetime::Applications::DisplayApp *app) : Screen(app) { + + lv_style_copy(&style_lmeter, &lv_style_pretty_color); + style_lmeter.line.width = 2; + style_lmeter.line.color = LV_COLOR_SILVER; + style_lmeter.body.main_color = lv_color_make(255,0,0); + style_lmeter.body.grad_color = lv_color_make(160,0,0); + style_lmeter.body.padding.left = 16; /*Line length*/ + + /*Create a line meter */ + lmeter = lv_lmeter_create(lv_scr_act(), NULL); + lv_lmeter_set_range(lmeter, 0, 60); /*Set the range*/ + lv_lmeter_set_value(lmeter, value); /*Set the current value*/ + lv_lmeter_set_angle_offset(lmeter, 180); + lv_lmeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/ + lv_lmeter_set_style(lmeter, LV_LMETER_STYLE_MAIN, &style_lmeter); /*Apply the new style*/ + lv_obj_set_size(lmeter, 150, 150); + lv_obj_align(lmeter, NULL, LV_ALIGN_CENTER, 0, 0); + +} + +Meter::~Meter() { + + + lv_obj_clean(lv_scr_act()); +} + +bool Meter::Refresh() { + lv_lmeter_set_value(lmeter, value++); /*Set the current value*/ + if(value>=60) value = 0; + + return running; +} + +bool Meter::OnButtonPushed() { + running = false; + return true; +} diff --git a/src/displayapp/Screens/Meter.h b/src/displayapp/Screens/Meter.h new file mode 100644 index 0000000..ddf8be8 --- /dev/null +++ b/src/displayapp/Screens/Meter.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class Meter : public Screen{ + public: + Meter(DisplayApp* app); + ~Meter() override; + + bool Refresh() override; + bool OnButtonPushed() override; + + private: + lv_style_t style_lmeter; + lv_obj_t * lmeter; + + uint32_t value=0; + bool running = true; + + }; + } + } +} diff --git a/src/displayapp/Screens/Modal.cpp b/src/displayapp/Screens/Modal.cpp new file mode 100644 index 0000000..63ae70c --- /dev/null +++ b/src/displayapp/Screens/Modal.cpp @@ -0,0 +1,81 @@ +#include +#include "Modal.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + +Modal::Modal(Pinetime::Applications::DisplayApp *app) : Screen(app) { + + +} + +Modal::~Modal() { + lv_obj_clean(lv_scr_act()); +} + +bool Modal::Refresh() { + + return running; +} + +bool Modal::OnButtonPushed() { + running = false; + return true; +} + +void Modal::Hide() { + /* Delete the parent modal background */ + lv_obj_del_async(lv_obj_get_parent(mbox)); + mbox = NULL; /* happens before object is actually deleted! */ + isVisible = false; +} + +void Modal::mbox_event_cb(lv_obj_t *obj, lv_event_t evt) { + auto* m = static_cast(obj->user_data); + m->OnEvent(obj, evt); +} + +void Modal::OnEvent(lv_obj_t *event_obj, lv_event_t evt) { + if(evt == LV_EVENT_DELETE && event_obj == mbox) { + Hide(); + } else if(evt == LV_EVENT_VALUE_CHANGED) { + /* A button was clicked */ + lv_mbox_start_auto_close(mbox, 0); +// Hide(); + } +} + +void Modal::Show(const char* msg) { + if(isVisible) return; + isVisible = true; + lv_style_copy(&modal_style, &lv_style_plain_color); + modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK; + modal_style.body.opa = LV_OPA_50; + + obj = lv_obj_create(lv_scr_act(), NULL); + lv_obj_set_style(obj, &modal_style); + lv_obj_set_pos(obj, 0, 0); + lv_obj_set_size(obj, LV_HOR_RES, LV_VER_RES); + lv_obj_set_opa_scale_enable(obj, true); /* Enable opacity scaling for the animation */ + + static const char * btns2[] = {"Ok", ""}; + + /* Create the message box as a child of the modal background */ + mbox = lv_mbox_create(obj, NULL); + lv_mbox_add_btns(mbox, btns2); + lv_mbox_set_text(mbox, msg); + lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_event_cb(mbox, Modal::mbox_event_cb); + + mbox->user_data = this; + + /* Fade the message box in with an animation */ + lv_anim_t a; + lv_anim_init(&a); + lv_anim_set_time(&a, 500, 0); + lv_anim_set_values(&a, LV_OPA_TRANSP, LV_OPA_COVER); + lv_anim_set_exec_cb(&a, obj, (lv_anim_exec_xcb_t)lv_obj_set_opa_scale); + lv_anim_create(&a); +} diff --git a/src/displayapp/Screens/Modal.h b/src/displayapp/Screens/Modal.h new file mode 100644 index 0000000..c616c29 --- /dev/null +++ b/src/displayapp/Screens/Modal.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class Modal : public Screen{ + public: + Modal(DisplayApp* app); + ~Modal() override; + + void Show(const char* msg); + void Hide(); + + bool Refresh() override; + bool OnButtonPushed() override; + + static void mbox_event_cb(lv_obj_t *obj, lv_event_t evt); + private: + void OnEvent(lv_obj_t *event_obj, lv_event_t evt); + + lv_style_t modal_style; + lv_obj_t *obj; + lv_obj_t *mbox; + lv_obj_t *info; + bool running = true; + bool isVisible = false; + + }; + } + } +} diff --git a/src/displayapp/Screens/Music.cpp b/src/displayapp/Screens/Music.cpp new file mode 100644 index 0000000..9b7d198 --- /dev/null +++ b/src/displayapp/Screens/Music.cpp @@ -0,0 +1,125 @@ +#include +#include "Music.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + +static void event_handler(lv_obj_t * obj, lv_event_t event) +{ + Music* screen = static_cast(obj->user_data); + screen->OnObjectEvent(obj, event); +} + +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(), NULL); + btnVolDown->user_data = this; + lv_obj_set_event_cb(btnVolDown, event_handler); + lv_obj_align(btnVolDown, NULL, LV_ALIGN_IN_TOP_LEFT, 10, 10); + label = lv_label_create(btnVolDown, NULL); + lv_label_set_text(label, "v-"); + + btnVolUp = lv_btn_create(lv_scr_act(), NULL); + btnVolUp->user_data = this; + lv_obj_set_event_cb(btnVolUp, event_handler); + lv_obj_align(btnVolUp, NULL, LV_ALIGN_IN_TOP_RIGHT, -10, 10); + label = lv_label_create(btnVolUp, NULL); + lv_label_set_text(label, "v+"); + + btnPrev = lv_btn_create(lv_scr_act(), NULL); + btnPrev->user_data = this; + lv_obj_set_event_cb(btnPrev, event_handler); + lv_obj_set_size(btnPrev, LV_HOR_RES / 4, LV_VER_RES / 4); + lv_obj_align(btnPrev, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 10,-10); + label = lv_label_create(btnPrev, NULL); + lv_label_set_text(label, "<<"); + + btnPlayPause = lv_btn_create(lv_scr_act(), NULL); + btnPlayPause->user_data = this; + lv_obj_set_event_cb(btnPlayPause, event_handler); + lv_obj_set_size(btnPlayPause, LV_HOR_RES / 4, LV_VER_RES / 4); + lv_obj_align(btnPlayPause, NULL, LV_ALIGN_IN_BOTTOM_MID, 0,-10); + txtPlayPause = lv_label_create(btnPlayPause, NULL); + lv_label_set_text(txtPlayPause, ">"); + + btnNext = lv_btn_create(lv_scr_act(), NULL); + btnNext->user_data = this; + lv_obj_set_event_cb(btnNext, event_handler); + lv_obj_set_size(btnNext, LV_HOR_RES / 4, LV_VER_RES / 4); + lv_obj_align(btnNext, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -10,-10); + label = lv_label_create(btnNext, NULL); + lv_label_set_text(label, ">>"); + + txtArtist = lv_label_create(lv_scr_act(), NULL); + lv_label_set_long_mode(txtArtist, LV_LABEL_LONG_SROLL); + lv_obj_align(txtArtist, NULL, LV_ALIGN_IN_LEFT_MID, 0,-20); + lv_label_set_text(txtArtist, "Artist Name"); + lv_label_set_align(txtArtist, LV_LABEL_ALIGN_CENTER); + lv_obj_set_width(txtArtist, LV_HOR_RES); + + txtTrack = lv_label_create(lv_scr_act(), NULL); + lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_DOT); + lv_obj_align(txtTrack, NULL, LV_ALIGN_IN_LEFT_MID, 0,20); + lv_label_set_text(txtTrack, "This is a very long track name"); + lv_label_set_align(txtTrack, LV_LABEL_ALIGN_CENTER); + lv_obj_set_width(txtTrack, LV_HOR_RES); + + musicService.event(Controllers::MusicService::EVENT_MUSIC_OPEN); +} + +Music::~Music() { + lv_obj_clean(lv_scr_act()); +} + +bool Music::OnButtonPushed() { + running = false; + return true; +} + +bool Music::Refresh() { + + if (m_artist != musicService.artist()) { + m_artist = musicService.artist(); + lv_label_set_text(txtArtist, m_artist.data()); + } + if (m_track != musicService.track()) { + m_track = musicService.track(); + lv_label_set_text(txtTrack, m_track.data()); + } + if (m_album != musicService.album()) { + m_album = musicService.album(); + } + if (m_status != musicService.status()) { + m_status = musicService.status(); + } + if (m_status == Pinetime::Controllers::MusicService::STATUS_MUSIC_PLAYING) { + lv_label_set_text(txtPlayPause, "||"); + } else { + lv_label_set_text(txtPlayPause, ">"); + } + + return running; +} + +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); + } else if (obj == btnVolUp) { + musicService.event(Controllers::MusicService::EVENT_MUSIC_VOLUP); + } else if (obj == btnPrev) { + musicService.event(Controllers::MusicService::EVENT_MUSIC_PREV); + } else if (obj == btnPlayPause) { + if (m_status == Pinetime::Controllers::MusicService::STATUS_MUSIC_PLAYING) { + musicService.event(Controllers::MusicService::EVENT_MUSIC_PAUSE); + } else { + musicService.event(Controllers::MusicService::EVENT_MUSIC_PLAY); + } + } else if (obj == btnNext) { + musicService.event(Controllers::MusicService::EVENT_MUSIC_NEXT); + } + } +} diff --git a/src/displayapp/Screens/Music.h b/src/displayapp/Screens/Music.h new file mode 100644 index 0000000..95cac0f --- /dev/null +++ b/src/displayapp/Screens/Music.h @@ -0,0 +1,49 @@ +#pragma once + +#include +#include +#include +#include "Screen.h" +#include +#include +#include +#include +#include +#include "../../Version.h" +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class Music : public Screen{ + public: + Music(DisplayApp* app, Pinetime::Controllers::MusicService &music); + ~Music() override; + + bool Refresh() override; + bool OnButtonPushed() override; + + void OnObjectEvent(lv_obj_t* obj, lv_event_t event); + + private: + 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; + + bool running = true; + Pinetime::Controllers::MusicService &musicService; + std::string m_artist; + std::string m_album; + std::string m_track; + unsigned char m_status; + }; + } + } +} diff --git a/src/displayapp/Screens/Screen.cpp b/src/displayapp/Screens/Screen.cpp new file mode 100644 index 0000000..1467df3 --- /dev/null +++ b/src/displayapp/Screens/Screen.cpp @@ -0,0 +1,2 @@ +#include "Screen.h" +using namespace Pinetime::Applications::Screens; \ No newline at end of file diff --git a/src/displayapp/Screens/Screen.h b/src/displayapp/Screens/Screen.h new file mode 100644 index 0000000..dbf81a4 --- /dev/null +++ b/src/displayapp/Screens/Screen.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include "../TouchEvents.h" + +namespace Pinetime { + namespace Applications { + class DisplayApp; + namespace Screens { + class Screen { + public: + Screen(DisplayApp* app) : app{app} {} + virtual ~Screen() = default; + + // 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 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; + }; + } + } +} diff --git a/src/displayapp/Screens/ScreenList.h b/src/displayapp/Screens/ScreenList.h new file mode 100644 index 0000000..d873336 --- /dev/null +++ b/src/displayapp/Screens/ScreenList.h @@ -0,0 +1,66 @@ +#pragma once + +#include +#include +#include +#include "Screen.h" +#include "Label.h" + +namespace Pinetime { + namespace Applications { + namespace Screens { + template + class ScreenList : public Screen { + public: + ScreenList(DisplayApp* app, std::array()>, N>&& screens) + : Screen(app), screens{std::move(screens)}, current{this->screens[0]()} { + + } + + ~ScreenList() override { + + } + + bool Refresh() override { + running = current->Refresh(); + return running; + } + + bool OnButtonPushed() override { + running = false; + return true; + } + + bool OnTouchEvent(TouchEvents event) override { + switch (event) { + case TouchEvents::SwipeDown: + if (screenIndex > 0) { + current.reset(nullptr); + app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); + screenIndex--; + 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; + } + return false; + } + + private: + bool running = true; + uint8_t screenIndex = 0; + std::array()>, N> screens; + std::unique_ptr current; + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/Screens/Symbols.h b/src/displayapp/Screens/Symbols.h new file mode 100644 index 0000000..aeea324 --- /dev/null +++ b/src/displayapp/Screens/Symbols.h @@ -0,0 +1,30 @@ +#pragma once + +namespace Pinetime { + namespace Applications { + namespace Screens { + namespace Symbols { + static constexpr const char* none = ""; + static constexpr const char* batteryFull = "\xEF\x89\x80"; + static constexpr const char* batteryEmpty = "\xEF\x89\x84"; + static constexpr const char* batteryThreeQuarter = "\xEF\x89\x81"; + static constexpr const char* batteryHalf = "\xEF\x89\x82"; + static constexpr const char* batteryOneQuarter = "\xEF\x89\x83"; + static constexpr const char* heartBeat = "\xEF\x88\x9E"; + static constexpr const char* bluetoothFull = "\xEF\x8A\x93"; + static constexpr const char* bluetooth = "\xEF\x8A\x94"; + static constexpr const char* plug = "\xEF\x87\xA6"; + static constexpr const char* shoe = "\xEF\x95\x8B"; + static constexpr const char* clock = "\xEF\x80\x97"; + static constexpr const char* info = "\xEF\x84\xA9"; + static constexpr const char* list = "\xEF\x80\xBA"; + static constexpr const char* sun = "\xEF\x86\x85"; + static constexpr const char* check = "\xEF\x95\xA0"; + static constexpr const char* music = "\xEF\x80\x81"; + static constexpr const char* tachometer = "\xEF\x8F\xBD"; + static constexpr const char* asterisk = "\xEF\x81\xA9"; + static constexpr const char* paintbrush = "\xEF\x87\xBC"; + } + } + } +} \ No newline at end of file diff --git a/src/displayapp/Screens/SystemInfo.cpp b/src/displayapp/Screens/SystemInfo.cpp new file mode 100644 index 0000000..fcafcf7 --- /dev/null +++ b/src/displayapp/Screens/SystemInfo.cpp @@ -0,0 +1,116 @@ +#include +#include +#include +#include "SystemInfo.h" +#include "../../Version.h" +#include "Tile.h" + +using namespace Pinetime::Applications::Screens; + +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, { + [this]() -> std::unique_ptr { return CreateScreen1(); }, + [this]() -> std::unique_ptr { return CreateScreen2(); }, + [this]() -> std::unique_ptr { return CreateScreen3(); } + } + } {} + + +SystemInfo::~SystemInfo() { + lv_obj_clean(lv_scr_act()); +} + +bool SystemInfo::Refresh() { + screens.Refresh(); + return running; +} + +bool SystemInfo::OnButtonPushed() { + running = false; + return true; +} + +bool SystemInfo::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + return screens.OnTouchEvent(event); +} + +std::unique_ptr SystemInfo::CreateScreen1() { + auto batteryPercentF = batteryController.PercentRemaining(); + uint16_t batteryPercent = 0; + if(batteryPercentF > 100.0f) batteryPercent = 100; + else if(batteryPercentF < 0.0f) batteryPercent = 0; + + uint8_t brightness = 0; + switch(brightnessController.Level()) { + case Controllers::BrightnessController::Levels::Off: brightness = 0; break; + case Controllers::BrightnessController::Levels::Low: brightness = 1; break; + case Controllers::BrightnessController::Levels::Medium: brightness = 2; break; + case Controllers::BrightnessController::Levels::High: brightness = 3; break; + } + 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 "?"; + } + }(); + + // uptime + 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); + uptimeSeconds = uptimeSeconds % secondsInADay; + uint32_t uptimeHours = uptimeSeconds / secondsInAnHour; + uptimeSeconds = uptimeSeconds % secondsInAnHour; + uint32_t uptimeMinutes = uptimeSeconds / secondsInAMinute; + uptimeSeconds = uptimeSeconds % secondsInAMinute; + // TODO handle more than 100 days of uptime + + sprintf(t1, "Pinetime\n" + "Version:%ld.%ld.%ld\n" + "Build: %s\n" + " %s\n" + "Date: %02d/%02d/%04d\n" + "Time: %02d:%02d:%02d\n" + "Uptime: %02lud %02lu:%02lu:%02lu\n" + "Battery: %d%%\n" + "Backlight: %d/3\n" + "Last reset: %s\n", + Version::Major(), Version::Minor(), Version::Patch(), + __DATE__, __TIME__, + dateTimeController.Day(), static_cast(dateTimeController.Month()), dateTimeController.Year(), + dateTimeController.Hours(), dateTimeController.Minutes(), dateTimeController.Seconds(), + uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds, + batteryPercent, brightness, resetReason); + + return std::unique_ptr(new Screens::Label(app, t1)); +} + +std::unique_ptr SystemInfo::CreateScreen2() { + auto& bleAddr = bleController.Address(); + sprintf(t2, "BLE MAC: \n %2x:%2x:%2x:%2x:%2x:%2x", + bleAddr[5], bleAddr[4], bleAddr[3], bleAddr[2], bleAddr[1], bleAddr[0]); + return std::unique_ptr(new Screens::Label(app, t2)); +} + +std::unique_ptr SystemInfo::CreateScreen3() { + strncpy(t3, "Hello from\nthe developper!", 27); + return std::unique_ptr(new Screens::Label(app, t3)); +} diff --git a/src/displayapp/Screens/SystemInfo.h b/src/displayapp/Screens/SystemInfo.h new file mode 100644 index 0000000..ac8abae --- /dev/null +++ b/src/displayapp/Screens/SystemInfo.h @@ -0,0 +1,47 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include "Label.h" +#include "ScreenList.h" +#include "Gauge.h" +#include "Meter.h" +#include + +namespace Pinetime { + namespace Applications { + 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; + + Pinetime::Controllers::DateTime& dateTimeController; + Pinetime::Controllers::Battery& batteryController; + Pinetime::Controllers::BrightnessController& brightnessController; + Pinetime::Controllers::Ble& bleController; + Pinetime::Drivers::WatchdogView& watchdog; + + char t1[200]; + char t2[200]; + char t3[30]; + + ScreenList<3> screens; + std::unique_ptr CreateScreen1(); + std::unique_ptr CreateScreen2(); + std::unique_ptr CreateScreen3(); + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/Screens/Tab.cpp b/src/displayapp/Screens/Tab.cpp new file mode 100644 index 0000000..adc3257 --- /dev/null +++ b/src/displayapp/Screens/Tab.cpp @@ -0,0 +1,67 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "Tab.h" +#include + + +using namespace Pinetime::Applications::Screens; + +extern lv_font_t jetbrains_mono_bold_20; + +//static void event_handler(lv_obj_t * obj, lv_event_t event) { +// Tile* screen = static_cast(obj->user_data); +// screen->OnObjectEvent(obj, event); +//} + +Tab::Tab(DisplayApp* app, Pinetime::Components::Gfx &gfx) : Screen(app, gfx) { +/*Create a Tab view object*/ + lv_obj_t *tabview; + tabview = lv_tabview_create(lv_scr_act(), NULL); + + /*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/ + lv_obj_t *tab1 = lv_tabview_add_tab(tabview, "Tab 1"); + lv_obj_t *tab2 = lv_tabview_add_tab(tabview, "Tab 2"); + lv_obj_t *tab3 = lv_tabview_add_tab(tabview, "Tab 3"); + + + /*Add content to the tabs*/ + lv_obj_t * label = lv_label_create(tab1, NULL); + lv_label_set_text(label, "This the first tab\n\n" + "If the content\n" + "of a tab\n" + "become too long\n" + "the it \n" + "automatically\n" + "become\n" + "scrollable."); + + label = lv_label_create(tab2, NULL); + lv_label_set_text(label, "Second tab"); + + label = lv_label_create(tab3, NULL); + lv_label_set_text(label, "Third tab"); + +} + +Tab::~Tab() { + lv_obj_clean(lv_scr_act()); +} + +void Tab::Refresh(bool fullRefresh) { + +} + +void Tab::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { + if(event == LV_EVENT_CLICKED) { + NRF_LOG_INFO("Clicked"); + } + else if(event == LV_EVENT_VALUE_CHANGED) { + NRF_LOG_INFO("Toggled"); + } +} diff --git a/src/displayapp/Screens/Tab.h b/src/displayapp/Screens/Tab.h new file mode 100644 index 0000000..e16dbb9 --- /dev/null +++ b/src/displayapp/Screens/Tab.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include "Screen.h" +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + class Tab : public Screen { + public: + explicit Tab(DisplayApp* app, Components::Gfx& gfx); + ~Tab() override; + void Refresh(bool fullRefresh) override; + void OnObjectEvent(lv_obj_t* obj, lv_event_t event); + + private: + + }; + } + } +} diff --git a/src/displayapp/Screens/Tile.cpp b/src/displayapp/Screens/Tile.cpp new file mode 100644 index 0000000..1447d78 --- /dev/null +++ b/src/displayapp/Screens/Tile.cpp @@ -0,0 +1,61 @@ +#include +#include +#include +#include "Tile.h" +#include +#include "Symbols.h" +#include "../../Version.h" + +using namespace Pinetime::Applications::Screens; + +extern lv_font_t jetbrains_mono_bold_20; + +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(DisplayApp* app, std::array& applications) : Screen(app) { + for(int i = 0, appIndex = 0; i < 8; i++) { + if(i == 3) btnm_map1[i] = "\n"; + else if(i == 7) btnm_map1[i] = ""; + else { + btnm_map1[i] = applications[appIndex].icon; + apps[appIndex] = applications[appIndex].application; + appIndex++; + } + } + modal.reset(new Modal(app)); + + btnm1 = lv_btnm_create(lv_scr_act(), NULL); + lv_btnm_set_map(btnm1, btnm_map1); + lv_obj_set_size(btnm1, LV_HOR_RES, LV_VER_RES); + + btnm1->user_data = this; + lv_obj_set_event_cb(btnm1, event_handler); +} + +Tile::~Tile() { + lv_obj_clean(lv_scr_act()); +} + +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) { + app->StartApp(apps[buttonId]); + running = false; + } +} + +bool Tile::OnButtonPushed() { + app->StartApp(Apps::Clock); + running = false; + return true; +} + + diff --git a/src/displayapp/Screens/Tile.h b/src/displayapp/Screens/Tile.h new file mode 100644 index 0000000..3136d89 --- /dev/null +++ b/src/displayapp/Screens/Tile.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include "Screen.h" +#include +#include "Modal.h" +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + class Tile : public Screen { + public: + struct Applications { + const char* icon; + Pinetime::Applications::Apps application; + }; + + explicit Tile(DisplayApp* app, std::array& applications); + ~Tile() override; + + bool Refresh() override; + bool OnButtonPushed() override; + + void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId); + + private: + lv_obj_t * btnm1; + bool running = true; + + std::unique_ptr modal; + + const char* btnm_map1[8]; + Pinetime::Applications::Apps apps[6]; + }; + } + } +} diff --git a/src/displayapp/TouchEvents.h b/src/displayapp/TouchEvents.h new file mode 100644 index 0000000..cf2f88d --- /dev/null +++ b/src/displayapp/TouchEvents.h @@ -0,0 +1,8 @@ +#pragma once + +namespace Pinetime { + namespace Applications { + + enum class TouchEvents { None, Tap, SwipeLeft, SwipeRight, SwipeUp, SwipeDown, LongTap, DoubleTap}; + } +} \ No newline at end of file -- cgit v0.10.2 From 4daab2692692d47af24a9384eb0f402821527882 Mon Sep 17 00:00:00 2001 From: Avamander Date: Fri, 2 Oct 2020 21:49:55 +0300 Subject: Renamed displayapp/Screens to displayapp/screens diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 546ce81..9d03e90 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -324,23 +324,23 @@ list(APPEND IMAGE_FILES list(APPEND SOURCE_FILES logging/NrfLogger.cpp displayapp/DisplayApp.cpp - displayapp/Screens/Screen.cpp - displayapp/Screens/Clock.cpp - displayapp/Screens/Tile.cpp - displayapp/Screens/Meter.cpp - displayapp/Screens/Gauge.cpp - displayapp/Screens/InfiniPaint.cpp - displayapp/Screens/DropDownDemo.cpp - displayapp/Screens/Modal.cpp - displayapp/Screens/BatteryIcon.cpp - displayapp/Screens/BleIcon.cpp - displayapp/Screens/Brightness.cpp - displayapp/Screens/SystemInfo.cpp - displayapp/Screens/Label.cpp - displayapp/Screens/FirmwareUpdate.cpp - displayapp/Screens/Music.cpp - displayapp/Screens/FirmwareValidation.cpp - displayapp/Screens/ApplicationList.cpp + displayapp/screens/Screen.cpp + displayapp/screens/Clock.cpp + displayapp/screens/Tile.cpp + displayapp/screens/Meter.cpp + displayapp/screens/Gauge.cpp + displayapp/screens/InfiniPaint.cpp + displayapp/screens/DropDownDemo.cpp + displayapp/screens/Modal.cpp + displayapp/screens/BatteryIcon.cpp + displayapp/screens/BleIcon.cpp + displayapp/screens/Brightness.cpp + displayapp/screens/SystemInfo.cpp + displayapp/screens/Label.cpp + displayapp/screens/FirmwareUpdate.cpp + displayapp/screens/Music.cpp + displayapp/screens/FirmwareValidation.cpp + displayapp/screens/ApplicationList.cpp main.cpp drivers/St7789.cpp drivers/SpiNorFlash.cpp @@ -401,23 +401,23 @@ set(INCLUDE_FILES logging/NrfLogger.h displayapp/DisplayApp.h displayapp/TouchEvents.h - displayapp/Screens/Screen.h - displayapp/Screens/Clock.h - displayapp/Screens/Tile.h - displayapp/Screens/Meter.h - displayapp/Screens/Gauge.h - displayapp/Screens/InfiniPaint.h - displayapp/Screens/DropDownDemo.h - displayapp/Screens/Modal.h - displayapp/Screens/BatteryIcon.h - displayapp/Screens/BleIcon.cpp - displayapp/Screens/Brightness.h - displayapp/Screens/SystemInfo.h - displayapp/Screens/ScreenList.h - displayapp/Screens/Label.h - displayapp/Screens/FirmwareUpdate.h - displayapp/Screens/FirmwareValidation.h - displayapp/Screens/ApplicationList.h + displayapp/screens/Screen.h + displayapp/screens/Clock.h + displayapp/screens/Tile.h + displayapp/screens/Meter.h + displayapp/screens/Gauge.h + displayapp/screens/InfiniPaint.h + displayapp/screens/DropDownDemo.h + displayapp/screens/Modal.h + displayapp/screens/BatteryIcon.h + displayapp/screens/BleIcon.cpp + displayapp/screens/Brightness.h + displayapp/screens/SystemInfo.h + displayapp/screens/ScreenList.h + displayapp/screens/Label.h + displayapp/screens/FirmwareUpdate.h + displayapp/screens/FirmwareValidation.h + displayapp/screens/ApplicationList.h displayapp/Apps.h drivers/St7789.h drivers/SpiNorFlash.h @@ -453,7 +453,7 @@ set(INCLUDE_FILES displayapp/LittleVgl.h systemtask/SystemTask.h systemtask/SystemMonitor.h - displayapp/Screens/Symbols.h + displayapp/screens/Symbols.h drivers/TwiMaster.h ) diff --git a/src/displayapp/Screens/ApplicationList.cpp b/src/displayapp/Screens/ApplicationList.cpp deleted file mode 100644 index eb85be4..0000000 --- a/src/displayapp/Screens/ApplicationList.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include -#include -#include "ApplicationList.h" -#include "Tile.h" -#include "Symbols.h" - -using namespace Pinetime::Applications::Screens; - -ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp *app) : - Screen(app), - screens{app, { - [this]() -> std::unique_ptr { return CreateScreen1(); }, - [this]() -> std::unique_ptr { return CreateScreen2(); }, - //[this]() -> std::unique_ptr { return CreateScreen3(); } - } - } {} - - -ApplicationList::~ApplicationList() { - lv_obj_clean(lv_scr_act()); -} - -bool ApplicationList::Refresh() { - if(running) - running = screens.Refresh(); - return running; -} - -bool ApplicationList::OnButtonPushed() { - running = false; - app->StartApp(Apps::Clock); - return true; -} - -bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - return screens.OnTouchEvent(event); -} - -std::unique_ptr ApplicationList::CreateScreen1() { - std::array applications { - {{Symbols::clock, Apps::Clock}, - {Symbols::music, Apps::Music}, - {Symbols::sun, Apps::Brightness}, - {Symbols::list, Apps::SysInfo}, - {Symbols::check, Apps::FirmwareValidation}, - {Symbols::none, Apps::None} - } - - - }; - - return std::unique_ptr(new Screens::Tile(app, applications)); -} - -std::unique_ptr ApplicationList::CreateScreen2() { - std::array applications { - {{Symbols::tachometer, Apps::Gauge}, - {Symbols::asterisk, Apps::Meter}, - {Symbols::paintbrush, Apps::Paint}, - {Symbols::none, Apps::None}, - {Symbols::none, Apps::None}, - {Symbols::none, Apps::None} - } - }; - - return std::unique_ptr(new Screens::Tile(app, applications)); -} - -std::unique_ptr ApplicationList::CreateScreen3() { - std::array applications { - {{"A", Apps::Meter}, - {"B", Apps::Gauge}, - {"C", Apps::Clock}, - {"D", Apps::Music}, - {"E", Apps::SysInfo}, - {"F", Apps::Brightness} - } - }; - - return std::unique_ptr(new Screens::Tile(app, applications)); -} diff --git a/src/displayapp/Screens/ApplicationList.h b/src/displayapp/Screens/ApplicationList.h deleted file mode 100644 index a1e6811..0000000 --- a/src/displayapp/Screens/ApplicationList.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include "Label.h" -#include "ScreenList.h" -#include "Gauge.h" -#include "Meter.h" -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - class ApplicationList : public Screen { - public: - explicit ApplicationList(DisplayApp* app); - ~ApplicationList() override; - bool Refresh() override; - bool OnButtonPushed() override; - bool OnTouchEvent(TouchEvents event) override; - private: - bool running = true; - - ScreenList<2> screens; - std::unique_ptr CreateScreen1(); - std::unique_ptr CreateScreen2(); - std::unique_ptr CreateScreen3(); - }; - } - } -} \ No newline at end of file diff --git a/src/displayapp/Screens/BatteryIcon.cpp b/src/displayapp/Screens/BatteryIcon.cpp deleted file mode 100644 index 26939d1..0000000 --- a/src/displayapp/Screens/BatteryIcon.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "BatteryIcon.h" -#include "Symbols.h" -using namespace Pinetime::Applications::Screens; - -const char* BatteryIcon::GetBatteryIcon(float batteryPercent) { - if(batteryPercent > 90.0f) return Symbols::batteryFull; - if(batteryPercent > 75.0f) return Symbols::batteryThreeQuarter; - if(batteryPercent > 50.0f) return Symbols::batteryHalf; - if(batteryPercent > 25.0f) return Symbols::batteryOneQuarter; - return Symbols::batteryEmpty; -} - -const char* BatteryIcon::GetUnknownIcon() { - return Symbols::batteryEmpty; -} - -const char *BatteryIcon::GetPlugIcon(bool isCharging) { - if(isCharging) - return Symbols::plug; - else return ""; -} diff --git a/src/displayapp/Screens/BatteryIcon.h b/src/displayapp/Screens/BatteryIcon.h deleted file mode 100644 index 58f04a8..0000000 --- a/src/displayapp/Screens/BatteryIcon.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - class BatteryIcon { - public: - static const char* GetUnknownIcon(); - static const char* GetBatteryIcon(float batteryPercent); - static const char* GetPlugIcon(bool isCharging); - }; - } - } -} \ No newline at end of file diff --git a/src/displayapp/Screens/BleIcon.cpp b/src/displayapp/Screens/BleIcon.cpp deleted file mode 100644 index 1bbbd05..0000000 --- a/src/displayapp/Screens/BleIcon.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include "BleIcon.h" -#include "Symbols.h" -using namespace Pinetime::Applications::Screens; - -const char* BleIcon::GetIcon(bool isConnected) { - if(isConnected) return Symbols::bluetooth; - else return ""; -} \ No newline at end of file diff --git a/src/displayapp/Screens/BleIcon.h b/src/displayapp/Screens/BleIcon.h deleted file mode 100644 index c1398d2..0000000 --- a/src/displayapp/Screens/BleIcon.h +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -namespace Pinetime { - namespace Applications { - namespace Screens { - class BleIcon { - public: - static const char* GetIcon(bool isConnected); - }; - } - } -} \ No newline at end of file diff --git a/src/displayapp/Screens/Brightness.cpp b/src/displayapp/Screens/Brightness.cpp deleted file mode 100644 index 9e3416c..0000000 --- a/src/displayapp/Screens/Brightness.cpp +++ /dev/null @@ -1,92 +0,0 @@ -#include -#include "Brightness.h" - -using namespace Pinetime::Applications::Screens; - -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} { - slider = lv_slider_create(lv_scr_act(), NULL); - lv_obj_set_user_data(slider, this); - lv_obj_set_width(slider, LV_DPI * 2); - lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_set_event_cb(slider, slider_event_cb); - lv_slider_set_range(slider, 0, 2); - lv_slider_set_value(slider, LevelToInt(brightness.Level()), LV_ANIM_OFF); - - slider_label = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(slider_label, LevelToString(brightness.Level())); - lv_obj_set_auto_realign(slider_label, true); - lv_obj_align(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); -} - -Brightness::~Brightness() { - lv_obj_clean(lv_scr_act()); -} - -bool Brightness::Refresh() { - return running; -} - -bool Brightness::OnButtonPushed() { - running = false; - return true; -} - -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 "???"; - } -} - -void Brightness::OnValueChanged() { - SetValue(lv_slider_get_value(slider)); -} - -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; - } - 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; - } -} - -bool Brightness::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - switch(event) { - case TouchEvents::SwipeLeft: - brightness.Lower(); - SetValue(); - return true; - case TouchEvents::SwipeRight: - brightness.Higher(); - SetValue(); - return true; - default: - return false; - } -} - -void Brightness::SetValue() { - lv_slider_set_value(slider, LevelToInt(brightness.Level()), LV_ANIM_OFF); - lv_label_set_text(slider_label, LevelToString(brightness.Level())); -} diff --git a/src/displayapp/Screens/Brightness.h b/src/displayapp/Screens/Brightness.h deleted file mode 100644 index 37cbcd7..0000000 --- a/src/displayapp/Screens/Brightness.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" - -namespace Pinetime { - namespace Applications { - namespace Screens { - class Brightness : public Screen { - public: - Brightness(DisplayApp* app, Controllers::BrightnessController& brightness); - ~Brightness() override; - bool Refresh() override; - bool OnButtonPushed() override; - bool OnTouchEvent(TouchEvents event) override; - - void OnValueChanged(); - private: - bool running = true; - 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(); - }; - } - } -} \ No newline at end of file diff --git a/src/displayapp/Screens/Clock.cpp b/src/displayapp/Screens/Clock.cpp deleted file mode 100644 index 06fab9a..0000000 --- a/src/displayapp/Screens/Clock.cpp +++ /dev/null @@ -1,227 +0,0 @@ -#include -#include -#include -#include -#include "Clock.h" -#include "../DisplayApp.h" -#include "BatteryIcon.h" -#include "BleIcon.h" -#include "Symbols.h" -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; -extern lv_style_t* LabelBigStyle; - -static void event_handler(lv_obj_t * obj, lv_event_t event) { - Clock* screen = static_cast(obj->user_data); - screen->OnObjectEvent(obj, event); -} - -Clock::Clock(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController) : Screen(app), currentDateTime{{}}, - dateTimeController{dateTimeController}, batteryController{batteryController}, bleController{bleController} { - displayedChar[0] = 0; - displayedChar[1] = 0; - displayedChar[2] = 0; - displayedChar[3] = 0; - displayedChar[4] = 0; - - batteryIcon = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(batteryIcon, Symbols::batteryFull); - lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 2); - - batteryPlug = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(batteryPlug, Symbols::plug); - lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); - - bleIcon = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(bleIcon, Symbols::bluetooth); - lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); - - - label_date = lv_label_create(lv_scr_act(), NULL); - - lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); - - label_time = lv_label_create(lv_scr_act(), NULL); - lv_label_set_style(label_time, LV_LABEL_STYLE_MAIN, LabelBigStyle); - lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0); - - backgroundLabel = lv_label_create(lv_scr_act(), NULL); - backgroundLabel->user_data = this; - lv_obj_set_click(backgroundLabel, true); - lv_obj_set_event_cb(backgroundLabel, event_handler); - 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(backgroundLabel, ""); - - - heartbeatIcon = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(heartbeatIcon, Symbols::heartBeat); - lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2); - - heartbeatValue = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(heartbeatValue, "0"); - lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0); - - heartbeatBpm = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(heartbeatBpm, "BPM"); - lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0); - - stepValue = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(stepValue, "0"); - lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2); - - stepIcon = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(stepIcon, Symbols::shoe); - lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); -} - -Clock::~Clock() { - lv_obj_clean(lv_scr_act()); -} - -bool Clock::Refresh() { - batteryPercentRemaining = batteryController.PercentRemaining(); - if (batteryPercentRemaining.IsUpdated()) { - auto batteryPercent = batteryPercentRemaining.Get(); - lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); - auto isCharging = batteryController.IsCharging() || batteryController.IsPowerPresent(); - lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging)); - } - - bleState = bleController.IsConnected(); - if (bleState.IsUpdated()) { - if(bleState.Get() == true) { - lv_label_set_text(bleIcon, BleIcon::GetIcon(true)); - } else { - lv_label_set_text(bleIcon, BleIcon::GetIcon(false)); - } - } - lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 5); - lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); - lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); - - currentDateTime = dateTimeController.CurrentDateTime(); - - if(currentDateTime.IsUpdated()) { - auto newDateTime = currentDateTime.Get(); - - auto dp = date::floor(newDateTime); - 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 dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); - - auto hour = time.hours().count(); - auto minute = time.minutes().count(); - - char minutesChar[3]; - sprintf(minutesChar, "%02d", static_cast(minute)); - - char hoursChar[3]; - sprintf(hoursChar, "%02d", static_cast(hour)); - - char timeStr[6]; - sprintf(timeStr, "%c%c:%c%c", hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]); - - 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]; - displayedChar[3] = minutesChar[1]; - - lv_label_set_text(label_time, timeStr); - } - - if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { - char dateStr[22]; - sprintf(dateStr, "%s %d %s %d", DayOfWeekToString(dayOfWeek), day, MonthToString(month), year); - lv_label_set_text(label_date, dateStr); - - - currentYear = year; - currentMonth = month; - currentDayOfWeek = dayOfWeek; - currentDay = day; - } - } - - // TODO heartbeat = heartBeatController.GetValue(); - if(heartbeat.IsUpdated()) { - char heartbeatBuffer[4]; - sprintf(heartbeatBuffer, "%d", heartbeat.Get()); - lv_label_set_text(heartbeatValue, heartbeatBuffer); - 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); - } - - // TODO stepCount = stepController.GetValue(); - if(stepCount.IsUpdated()) { - char stepBuffer[5]; - sprintf(stepBuffer, "%lu", stepCount.Get()); - lv_label_set_text(stepValue, stepBuffer); - 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); - } - - return running; -} - -const char *Clock::MonthToString(Pinetime::Controllers::DateTime::Months month) { - return Clock::MonthsString[static_cast(month)]; -} - -const char *Clock::DayOfWeekToString(Pinetime::Controllers::DateTime::Days dayOfWeek) { - return Clock::DaysString[static_cast(dayOfWeek)]; -} - -char const *Clock::DaysString[] = { - "", - "MONDAY", - "TUESDAY", - "WEDNESDAY", - "THURSDAY", - "FRIDAY", - "SATURDAY", - "SUNDAY" -}; - -char const *Clock::MonthsString[] = { - "", - "JAN", - "FEB", - "MAR", - "APR", - "MAY", - "JUN", - "JUL", - "AUG", - "SEP", - "OCT", - "NOV", - "DEC" -}; - -void Clock::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { - if(obj == backgroundLabel) { - if (event == LV_EVENT_CLICKED) { - - running = false; - } - } -} - -bool Clock::OnButtonPushed() { - running = false; - return false; -} - - diff --git a/src/displayapp/Screens/Clock.h b/src/displayapp/Screens/Clock.h deleted file mode 100644 index 7363fda..0000000 --- a/src/displayapp/Screens/Clock.h +++ /dev/null @@ -1,88 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include -#include -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - template - class DirtyValue { - public: - explicit DirtyValue(T v) { value = v; } - explicit DirtyValue(T& v) { value = v; } - bool IsUpdated() const { return isUpdated; } - T& Get() { this->isUpdated = false; return value; } - - DirtyValue& operator=(const T& other) { - if (this->value != other) { - this->value = other; - this->isUpdated = true; - } - return *this; - } - private: - T value; - bool isUpdated = true; - }; - class Clock : public Screen{ - public: - Clock(DisplayApp* app, - Controllers::DateTime& dateTimeController, - Controllers::Battery& batteryController, - Controllers::Ble& bleController); - ~Clock() override; - - bool Refresh() override; - bool OnButtonPushed() override; - - void OnObjectEvent(lv_obj_t *pObj, lv_event_t i); - private: - static const char* MonthToString(Pinetime::Controllers::DateTime::Months month); - static const char* DayOfWeekToString(Pinetime::Controllers::DateTime::Days dayOfWeek); - static char const *DaysString[]; - static char const *MonthsString[]; - - 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; - - DirtyValue batteryPercentRemaining {0}; - DirtyValue bleState {false}; - DirtyValue> currentDateTime; - DirtyValue stepCount {0}; - DirtyValue heartbeat {0}; - - - lv_obj_t* label_time; - 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; - - Controllers::DateTime& dateTimeController; - Controllers::Battery& batteryController; - Controllers::Ble& bleController; - - bool running = true; - - }; - } - } -} diff --git a/src/displayapp/Screens/DropDownDemo.cpp b/src/displayapp/Screens/DropDownDemo.cpp deleted file mode 100644 index 735a0cc..0000000 --- a/src/displayapp/Screens/DropDownDemo.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include -#include "DropDownDemo.h" -#include "../DisplayApp.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - -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(), NULL); - 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); - lv_obj_align(ddlist, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); -} - -DropDownDemo::~DropDownDemo() { - // Reset the touchmode - app->SetTouchMode(DisplayApp::TouchModes::Gestures); - lv_obj_clean(lv_scr_act()); -} - -bool DropDownDemo::Refresh() { - 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) - app->SetTouchMode(DisplayApp::TouchModes::Polling); - else - app->SetTouchMode(DisplayApp::TouchModes::Gestures); - return running; -} - -bool DropDownDemo::OnButtonPushed() { - running = false; - return true; -} - -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) { - return true; - } else { - return false; - } -} - diff --git a/src/displayapp/Screens/DropDownDemo.h b/src/displayapp/Screens/DropDownDemo.h deleted file mode 100644 index 7c75efc..0000000 --- a/src/displayapp/Screens/DropDownDemo.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class DropDownDemo : public Screen{ - public: - DropDownDemo(DisplayApp* app); - ~DropDownDemo() override; - - bool Refresh() override; - bool OnButtonPushed() override; - bool OnTouchEvent(TouchEvents event) override; - - private: - lv_obj_t * ddlist; - bool running = true; - bool isDropDownOpened = false; - }; - } - } -} diff --git a/src/displayapp/Screens/FirmwareUpdate.cpp b/src/displayapp/Screens/FirmwareUpdate.cpp deleted file mode 100644 index e831114..0000000 --- a/src/displayapp/Screens/FirmwareUpdate.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include "FirmwareUpdate.h" -#include "../DisplayApp.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - - -FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Ble& bleController) : - Screen(app), bleController{bleController} { - - titleLabel = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(titleLabel, "Firmware update"); - lv_obj_set_auto_realign(titleLabel, true); - lv_obj_align(titleLabel, NULL, LV_ALIGN_IN_TOP_MID, 0, 50); - - bar1 = lv_bar_create(lv_scr_act(), NULL); - lv_obj_set_size(bar1, 200, 30); - lv_obj_align(bar1, NULL, LV_ALIGN_CENTER, 0, 0); - lv_bar_set_anim_time(bar1, 10); - lv_bar_set_range(bar1, 0, 100); - lv_bar_set_value(bar1, 0, LV_ANIM_OFF); - - percentLabel = lv_label_create(lv_scr_act(), NULL); - lv_label_set_text(percentLabel, ""); - lv_obj_set_auto_realign(percentLabel, true); - lv_obj_align(percentLabel, bar1, LV_ALIGN_OUT_TOP_MID, 0, 60); -} - -FirmwareUpdate::~FirmwareUpdate() { - lv_obj_clean(lv_scr_act()); -} - -bool FirmwareUpdate::Refresh() { - switch(bleController.State()) { - default: - case Pinetime::Controllers::Ble::FirmwareUpdateStates::Idle: - case Pinetime::Controllers::Ble::FirmwareUpdateStates::Running: - if(state != States::Running) - state = States::Running; - return DisplayProgression(); - case Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated: - if(state != States::Validated) { - UpdateValidated(); - state = States::Validated; - } - return running; - case Pinetime::Controllers::Ble::FirmwareUpdateStates::Error: - if(state != States::Error) { - UpdateError(); - state = States::Error; - } - return running; - } -} - -bool FirmwareUpdate::DisplayProgression() const { - float current = bleController.FirmwareUpdateCurrentBytes() / 1024.0f; - float total = bleController.FirmwareUpdateTotalBytes() / 1024.0f; - int16_t pc = (current / total) * 100.0f; - sprintf(percentStr, "%d %%", pc); - lv_label_set_text(percentLabel, percentStr); - - lv_bar_set_value(bar1, pc, LV_ANIM_OFF); - return running; -} - -bool FirmwareUpdate::OnButtonPushed() { - running = false; - return true; -} - -void FirmwareUpdate::UpdateValidated() { - lv_label_set_recolor(percentLabel, true); - lv_label_set_text(percentLabel, "#00ff00 Image Ok!#"); -} - -void FirmwareUpdate::UpdateError() { - lv_label_set_recolor(percentLabel, true); - lv_label_set_text(percentLabel, "#ff0000 Error!#"); -} diff --git a/src/displayapp/Screens/FirmwareUpdate.h b/src/displayapp/Screens/FirmwareUpdate.h deleted file mode 100644 index faaf395..0000000 --- a/src/displayapp/Screens/FirmwareUpdate.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class FirmwareUpdate : public Screen{ - public: - FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController); - ~FirmwareUpdate() override; - - bool Refresh() override; - bool OnButtonPushed() 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]; - bool running = true; - States state; - - bool DisplayProgression() const; - - void UpdateValidated(); - - void UpdateError(); - }; - } - } -} diff --git a/src/displayapp/Screens/FirmwareValidation.cpp b/src/displayapp/Screens/FirmwareValidation.cpp deleted file mode 100644 index fb2dd95..0000000 --- a/src/displayapp/Screens/FirmwareValidation.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include "FirmwareValidation.h" -#include "../DisplayApp.h" -#include "../../Version.h" -#include "../../Components/FirmwareValidator/FirmwareValidator.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - -namespace { - 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} { - labelVersionInfo = lv_label_create(lv_scr_act(), NULL); - lv_obj_align(labelVersionInfo, NULL, 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(), NULL); - lv_obj_align(labelVersionValue, labelVersionInfo, LV_ALIGN_OUT_RIGHT_MID, 0, 0); - lv_label_set_recolor(labelVersionValue, true); - sprintf(version, "%ld.%ld.%ld", Version::Major(), Version::Minor(), Version::Patch()); - lv_label_set_text(labelVersionValue, version); - - labelIsValidated = lv_label_create(lv_scr_act(), NULL); - lv_obj_align(labelIsValidated, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 50); - lv_label_set_recolor(labelIsValidated, true); - lv_label_set_long_mode(labelIsValidated, LV_LABEL_LONG_BREAK); - lv_obj_set_width(labelIsValidated, 240); - - 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."); - - buttonValidate = lv_btn_create(lv_scr_act(), NULL); - lv_obj_align(buttonValidate, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); - buttonValidate->user_data = this; - lv_obj_set_event_cb(buttonValidate, ButtonEventHandler); - - labelButtonValidate = lv_label_create(buttonValidate, NULL); - lv_label_set_recolor(labelButtonValidate, true); - lv_label_set_text(labelButtonValidate, "#00ff00 Validate#"); - - buttonReset = lv_btn_create(lv_scr_act(), NULL); - buttonReset->user_data = this; - lv_obj_align(buttonReset, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); - lv_obj_set_event_cb(buttonReset, ButtonEventHandler); - - labelButtonReset = lv_label_create(buttonReset, NULL); - lv_label_set_recolor(labelButtonReset, true); - lv_label_set_text(labelButtonReset, "#ff0000 Reset#"); - } -} - - -FirmwareValidation::~FirmwareValidation() { - lv_obj_clean(lv_scr_act()); -} - -bool FirmwareValidation::Refresh() { - return running; -} - -bool FirmwareValidation::OnButtonPushed() { - running = false; - return true; -} - -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) { - validator.Reset(); - } - -} - - diff --git a/src/displayapp/Screens/FirmwareValidation.h b/src/displayapp/Screens/FirmwareValidation.h deleted file mode 100644 index 947f557..0000000 --- a/src/displayapp/Screens/FirmwareValidation.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include -#include -#include - -namespace Pinetime { - namespace Controllers { - class FirmwareValidator; - } - - namespace Applications { - namespace Screens { - - class FirmwareValidation : public Screen{ - public: - FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator); - ~FirmwareValidation() override; - - bool Refresh() override; - bool OnButtonPushed() override; - - void OnButtonEvent(lv_obj_t *object, lv_event_t event); - - 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; - bool running = true; - }; - } - } -} diff --git a/src/displayapp/Screens/Gauge.cpp b/src/displayapp/Screens/Gauge.cpp deleted file mode 100644 index fd90523..0000000 --- a/src/displayapp/Screens/Gauge.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include "Gauge.h" -#include "../DisplayApp.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - - -Gauge::Gauge(Pinetime::Applications::DisplayApp *app) : Screen(app) { - /*Create a style*/ - lv_style_copy(&style, &lv_style_pretty_color); - style.body.main_color = LV_COLOR_CYAN; /*Line color at the beginning*/ - style.body.grad_color = LV_COLOR_RED; /*Line color at the end*/ - style.body.padding.left = 10; /*Scale line length*/ - style.body.padding.inner = 8 ; /*Scale label padding*/ - style.body.border.color = lv_color_hex3(0x333); /*Needle middle circle color*/ - style.line.width = 3; - style.text.color = LV_COLOR_WHITE; - style.line.color = LV_COLOR_RED; /*Line color after the critical value*/ - - - /*Describe the color for the needles*/ - - needle_colors[0] = LV_COLOR_ORANGE; - - /*Create a gauge*/ - gauge1 = lv_gauge_create(lv_scr_act(), NULL); - lv_gauge_set_style(gauge1, LV_GAUGE_STYLE_MAIN, &style); - lv_gauge_set_needle_count(gauge1, 1, needle_colors); - lv_obj_set_size(gauge1, 180, 180); - lv_obj_align(gauge1, NULL, LV_ALIGN_CENTER, 0, 0); - lv_gauge_set_scale(gauge1, 360, 60, 0); - lv_gauge_set_range(gauge1, 0, 59); - - /*Set the values*/ - lv_gauge_set_value(gauge1, 0, value); -} - -Gauge::~Gauge() { - - - lv_obj_clean(lv_scr_act()); -} - -bool Gauge::Refresh() { -// lv_lmeter_set_value(lmeter, value++); /*Set the current value*/ -// if(value>=60) value = 0; - - lv_gauge_set_value(gauge1, 0, value++); - if(value == 59) value = 0; - return running; -} - -bool Gauge::OnButtonPushed() { - running = false; - return true; -} diff --git a/src/displayapp/Screens/Gauge.h b/src/displayapp/Screens/Gauge.h deleted file mode 100644 index 03c06be..0000000 --- a/src/displayapp/Screens/Gauge.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class Gauge : public Screen{ - public: - Gauge(DisplayApp* app); - ~Gauge() override; - - bool Refresh() override; - bool OnButtonPushed() override; - - private: - lv_style_t style; - lv_color_t needle_colors[3]; - lv_obj_t * gauge1; - - uint32_t value=30; - bool running = true; - - }; - } - } -} diff --git a/src/displayapp/Screens/InfiniPaint.cpp b/src/displayapp/Screens/InfiniPaint.cpp deleted file mode 100644 index b340f5d..0000000 --- a/src/displayapp/Screens/InfiniPaint.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include "InfiniPaint.h" -#include "../DisplayApp.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - -InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp *app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl{lvgl} { - app->SetTouchMode(DisplayApp::TouchModes::Polling); - std::fill(b, b+bufferSize, LV_COLOR_WHITE); -} - -InfiniPaint::~InfiniPaint() { - // Reset the touchmode - app->SetTouchMode(DisplayApp::TouchModes::Gestures); - lv_obj_clean(lv_scr_act()); -} - -bool InfiniPaint::Refresh() { - return running; -} - -bool InfiniPaint::OnButtonPushed() { - running = false; - return true; -} - -bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - return true; -} - -bool InfiniPaint::OnTouchEvent(uint16_t x, uint16_t y) { - lv_area_t area; - area.x1 = x-(width/2); - area.y1 = y-(height/2); - area.x2 = x+(width/2)-1; - area.y2 = y+(height/2)-1; - lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::None); - lvgl.FlushDisplay(&area, b); - return true; -} - diff --git a/src/displayapp/Screens/InfiniPaint.h b/src/displayapp/Screens/InfiniPaint.h deleted file mode 100644 index a1592f9..0000000 --- a/src/displayapp/Screens/InfiniPaint.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include -#include -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class InfiniPaint : public Screen{ - public: - InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl); - ~InfiniPaint() override; - - bool Refresh() override; - bool OnButtonPushed() override; - bool OnTouchEvent(TouchEvents event) override; - bool OnTouchEvent(uint16_t x, uint16_t y) override; - - private: - Pinetime::Components::LittleVgl& lvgl; - static constexpr uint16_t width = 10; - static constexpr uint16_t height = 10; - static constexpr uint16_t bufferSize = width*height; - lv_color_t b[bufferSize]; - bool running = true; - }; - } - } -} diff --git a/src/displayapp/Screens/Label.cpp b/src/displayapp/Screens/Label.cpp deleted file mode 100644 index 780ee88..0000000 --- a/src/displayapp/Screens/Label.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include "Label.h" - -using namespace Pinetime::Applications::Screens; - -Label::Label(Pinetime::Applications::DisplayApp *app, const char *text) : Screen(app), text{text} { - label = lv_label_create(lv_scr_act(), NULL); - lv_label_set_align(label, LV_LABEL_ALIGN_LEFT); - lv_obj_set_size(label, 240, 240); - lv_label_set_text(label, text); -} - -Label::~Label() { - lv_obj_clean(lv_scr_act()); -} diff --git a/src/displayapp/Screens/Label.h b/src/displayapp/Screens/Label.h deleted file mode 100644 index 3e7b379..0000000 --- a/src/displayapp/Screens/Label.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class Label : public Screen { - public: - Label(DisplayApp* app, const char* text); - ~Label() override; - bool Refresh() override {return false;} - - private: - lv_obj_t * label = nullptr; - const char* text = nullptr; - }; - } - } -} \ No newline at end of file diff --git a/src/displayapp/Screens/Meter.cpp b/src/displayapp/Screens/Meter.cpp deleted file mode 100644 index c74b8bd..0000000 --- a/src/displayapp/Screens/Meter.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include "Meter.h" -#include "../DisplayApp.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - - -Meter::Meter(Pinetime::Applications::DisplayApp *app) : Screen(app) { - - lv_style_copy(&style_lmeter, &lv_style_pretty_color); - style_lmeter.line.width = 2; - style_lmeter.line.color = LV_COLOR_SILVER; - style_lmeter.body.main_color = lv_color_make(255,0,0); - style_lmeter.body.grad_color = lv_color_make(160,0,0); - style_lmeter.body.padding.left = 16; /*Line length*/ - - /*Create a line meter */ - lmeter = lv_lmeter_create(lv_scr_act(), NULL); - lv_lmeter_set_range(lmeter, 0, 60); /*Set the range*/ - lv_lmeter_set_value(lmeter, value); /*Set the current value*/ - lv_lmeter_set_angle_offset(lmeter, 180); - lv_lmeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/ - lv_lmeter_set_style(lmeter, LV_LMETER_STYLE_MAIN, &style_lmeter); /*Apply the new style*/ - lv_obj_set_size(lmeter, 150, 150); - lv_obj_align(lmeter, NULL, LV_ALIGN_CENTER, 0, 0); - -} - -Meter::~Meter() { - - - lv_obj_clean(lv_scr_act()); -} - -bool Meter::Refresh() { - lv_lmeter_set_value(lmeter, value++); /*Set the current value*/ - if(value>=60) value = 0; - - return running; -} - -bool Meter::OnButtonPushed() { - running = false; - return true; -} diff --git a/src/displayapp/Screens/Meter.h b/src/displayapp/Screens/Meter.h deleted file mode 100644 index ddf8be8..0000000 --- a/src/displayapp/Screens/Meter.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class Meter : public Screen{ - public: - Meter(DisplayApp* app); - ~Meter() override; - - bool Refresh() override; - bool OnButtonPushed() override; - - private: - lv_style_t style_lmeter; - lv_obj_t * lmeter; - - uint32_t value=0; - bool running = true; - - }; - } - } -} diff --git a/src/displayapp/Screens/Modal.cpp b/src/displayapp/Screens/Modal.cpp deleted file mode 100644 index 63ae70c..0000000 --- a/src/displayapp/Screens/Modal.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include -#include "Modal.h" -#include "../DisplayApp.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - -Modal::Modal(Pinetime::Applications::DisplayApp *app) : Screen(app) { - - -} - -Modal::~Modal() { - lv_obj_clean(lv_scr_act()); -} - -bool Modal::Refresh() { - - return running; -} - -bool Modal::OnButtonPushed() { - running = false; - return true; -} - -void Modal::Hide() { - /* Delete the parent modal background */ - lv_obj_del_async(lv_obj_get_parent(mbox)); - mbox = NULL; /* happens before object is actually deleted! */ - isVisible = false; -} - -void Modal::mbox_event_cb(lv_obj_t *obj, lv_event_t evt) { - auto* m = static_cast(obj->user_data); - m->OnEvent(obj, evt); -} - -void Modal::OnEvent(lv_obj_t *event_obj, lv_event_t evt) { - if(evt == LV_EVENT_DELETE && event_obj == mbox) { - Hide(); - } else if(evt == LV_EVENT_VALUE_CHANGED) { - /* A button was clicked */ - lv_mbox_start_auto_close(mbox, 0); -// Hide(); - } -} - -void Modal::Show(const char* msg) { - if(isVisible) return; - isVisible = true; - lv_style_copy(&modal_style, &lv_style_plain_color); - modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK; - modal_style.body.opa = LV_OPA_50; - - obj = lv_obj_create(lv_scr_act(), NULL); - lv_obj_set_style(obj, &modal_style); - lv_obj_set_pos(obj, 0, 0); - lv_obj_set_size(obj, LV_HOR_RES, LV_VER_RES); - lv_obj_set_opa_scale_enable(obj, true); /* Enable opacity scaling for the animation */ - - static const char * btns2[] = {"Ok", ""}; - - /* Create the message box as a child of the modal background */ - mbox = lv_mbox_create(obj, NULL); - lv_mbox_add_btns(mbox, btns2); - lv_mbox_set_text(mbox, msg); - lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_set_event_cb(mbox, Modal::mbox_event_cb); - - mbox->user_data = this; - - /* Fade the message box in with an animation */ - lv_anim_t a; - lv_anim_init(&a); - lv_anim_set_time(&a, 500, 0); - lv_anim_set_values(&a, LV_OPA_TRANSP, LV_OPA_COVER); - lv_anim_set_exec_cb(&a, obj, (lv_anim_exec_xcb_t)lv_obj_set_opa_scale); - lv_anim_create(&a); -} diff --git a/src/displayapp/Screens/Modal.h b/src/displayapp/Screens/Modal.h deleted file mode 100644 index c616c29..0000000 --- a/src/displayapp/Screens/Modal.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class Modal : public Screen{ - public: - Modal(DisplayApp* app); - ~Modal() override; - - void Show(const char* msg); - void Hide(); - - bool Refresh() override; - bool OnButtonPushed() override; - - static void mbox_event_cb(lv_obj_t *obj, lv_event_t evt); - private: - void OnEvent(lv_obj_t *event_obj, lv_event_t evt); - - lv_style_t modal_style; - lv_obj_t *obj; - lv_obj_t *mbox; - lv_obj_t *info; - bool running = true; - bool isVisible = false; - - }; - } - } -} diff --git a/src/displayapp/Screens/Music.cpp b/src/displayapp/Screens/Music.cpp deleted file mode 100644 index 9b7d198..0000000 --- a/src/displayapp/Screens/Music.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#include -#include "Music.h" - -using namespace Pinetime::Applications::Screens; -extern lv_font_t jetbrains_mono_extrabold_compressed; -extern lv_font_t jetbrains_mono_bold_20; - -static void event_handler(lv_obj_t * obj, lv_event_t event) -{ - Music* screen = static_cast(obj->user_data); - screen->OnObjectEvent(obj, event); -} - -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(), NULL); - btnVolDown->user_data = this; - lv_obj_set_event_cb(btnVolDown, event_handler); - lv_obj_align(btnVolDown, NULL, LV_ALIGN_IN_TOP_LEFT, 10, 10); - label = lv_label_create(btnVolDown, NULL); - lv_label_set_text(label, "v-"); - - btnVolUp = lv_btn_create(lv_scr_act(), NULL); - btnVolUp->user_data = this; - lv_obj_set_event_cb(btnVolUp, event_handler); - lv_obj_align(btnVolUp, NULL, LV_ALIGN_IN_TOP_RIGHT, -10, 10); - label = lv_label_create(btnVolUp, NULL); - lv_label_set_text(label, "v+"); - - btnPrev = lv_btn_create(lv_scr_act(), NULL); - btnPrev->user_data = this; - lv_obj_set_event_cb(btnPrev, event_handler); - lv_obj_set_size(btnPrev, LV_HOR_RES / 4, LV_VER_RES / 4); - lv_obj_align(btnPrev, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 10,-10); - label = lv_label_create(btnPrev, NULL); - lv_label_set_text(label, "<<"); - - btnPlayPause = lv_btn_create(lv_scr_act(), NULL); - btnPlayPause->user_data = this; - lv_obj_set_event_cb(btnPlayPause, event_handler); - lv_obj_set_size(btnPlayPause, LV_HOR_RES / 4, LV_VER_RES / 4); - lv_obj_align(btnPlayPause, NULL, LV_ALIGN_IN_BOTTOM_MID, 0,-10); - txtPlayPause = lv_label_create(btnPlayPause, NULL); - lv_label_set_text(txtPlayPause, ">"); - - btnNext = lv_btn_create(lv_scr_act(), NULL); - btnNext->user_data = this; - lv_obj_set_event_cb(btnNext, event_handler); - lv_obj_set_size(btnNext, LV_HOR_RES / 4, LV_VER_RES / 4); - lv_obj_align(btnNext, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -10,-10); - label = lv_label_create(btnNext, NULL); - lv_label_set_text(label, ">>"); - - txtArtist = lv_label_create(lv_scr_act(), NULL); - lv_label_set_long_mode(txtArtist, LV_LABEL_LONG_SROLL); - lv_obj_align(txtArtist, NULL, LV_ALIGN_IN_LEFT_MID, 0,-20); - lv_label_set_text(txtArtist, "Artist Name"); - lv_label_set_align(txtArtist, LV_LABEL_ALIGN_CENTER); - lv_obj_set_width(txtArtist, LV_HOR_RES); - - txtTrack = lv_label_create(lv_scr_act(), NULL); - lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_DOT); - lv_obj_align(txtTrack, NULL, LV_ALIGN_IN_LEFT_MID, 0,20); - lv_label_set_text(txtTrack, "This is a very long track name"); - lv_label_set_align(txtTrack, LV_LABEL_ALIGN_CENTER); - lv_obj_set_width(txtTrack, LV_HOR_RES); - - musicService.event(Controllers::MusicService::EVENT_MUSIC_OPEN); -} - -Music::~Music() { - lv_obj_clean(lv_scr_act()); -} - -bool Music::OnButtonPushed() { - running = false; - return true; -} - -bool Music::Refresh() { - - if (m_artist != musicService.artist()) { - m_artist = musicService.artist(); - lv_label_set_text(txtArtist, m_artist.data()); - } - if (m_track != musicService.track()) { - m_track = musicService.track(); - lv_label_set_text(txtTrack, m_track.data()); - } - if (m_album != musicService.album()) { - m_album = musicService.album(); - } - if (m_status != musicService.status()) { - m_status = musicService.status(); - } - if (m_status == Pinetime::Controllers::MusicService::STATUS_MUSIC_PLAYING) { - lv_label_set_text(txtPlayPause, "||"); - } else { - lv_label_set_text(txtPlayPause, ">"); - } - - return running; -} - -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); - } else if (obj == btnVolUp) { - musicService.event(Controllers::MusicService::EVENT_MUSIC_VOLUP); - } else if (obj == btnPrev) { - musicService.event(Controllers::MusicService::EVENT_MUSIC_PREV); - } else if (obj == btnPlayPause) { - if (m_status == Pinetime::Controllers::MusicService::STATUS_MUSIC_PLAYING) { - musicService.event(Controllers::MusicService::EVENT_MUSIC_PAUSE); - } else { - musicService.event(Controllers::MusicService::EVENT_MUSIC_PLAY); - } - } else if (obj == btnNext) { - musicService.event(Controllers::MusicService::EVENT_MUSIC_NEXT); - } - } -} diff --git a/src/displayapp/Screens/Music.h b/src/displayapp/Screens/Music.h deleted file mode 100644 index 95cac0f..0000000 --- a/src/displayapp/Screens/Music.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#include -#include -#include -#include "Screen.h" -#include -#include -#include -#include -#include -#include "../../Version.h" -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - - class Music : public Screen{ - public: - Music(DisplayApp* app, Pinetime::Controllers::MusicService &music); - ~Music() override; - - bool Refresh() override; - bool OnButtonPushed() override; - - void OnObjectEvent(lv_obj_t* obj, lv_event_t event); - - private: - 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; - - bool running = true; - Pinetime::Controllers::MusicService &musicService; - std::string m_artist; - std::string m_album; - std::string m_track; - unsigned char m_status; - }; - } - } -} diff --git a/src/displayapp/Screens/Screen.cpp b/src/displayapp/Screens/Screen.cpp deleted file mode 100644 index 1467df3..0000000 --- a/src/displayapp/Screens/Screen.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "Screen.h" -using namespace Pinetime::Applications::Screens; \ No newline at end of file diff --git a/src/displayapp/Screens/Screen.h b/src/displayapp/Screens/Screen.h deleted file mode 100644 index dbf81a4..0000000 --- a/src/displayapp/Screens/Screen.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include -#include "../TouchEvents.h" - -namespace Pinetime { - namespace Applications { - class DisplayApp; - namespace Screens { - class Screen { - public: - Screen(DisplayApp* app) : app{app} {} - virtual ~Screen() = default; - - // 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 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; - }; - } - } -} diff --git a/src/displayapp/Screens/ScreenList.h b/src/displayapp/Screens/ScreenList.h deleted file mode 100644 index d873336..0000000 --- a/src/displayapp/Screens/ScreenList.h +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#include -#include -#include -#include "Screen.h" -#include "Label.h" - -namespace Pinetime { - namespace Applications { - namespace Screens { - template - class ScreenList : public Screen { - public: - ScreenList(DisplayApp* app, std::array()>, N>&& screens) - : Screen(app), screens{std::move(screens)}, current{this->screens[0]()} { - - } - - ~ScreenList() override { - - } - - bool Refresh() override { - running = current->Refresh(); - return running; - } - - bool OnButtonPushed() override { - running = false; - return true; - } - - bool OnTouchEvent(TouchEvents event) override { - switch (event) { - case TouchEvents::SwipeDown: - if (screenIndex > 0) { - current.reset(nullptr); - app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); - screenIndex--; - 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; - } - return false; - } - - private: - bool running = true; - uint8_t screenIndex = 0; - std::array()>, N> screens; - std::unique_ptr current; - }; - } - } -} \ No newline at end of file diff --git a/src/displayapp/Screens/Symbols.h b/src/displayapp/Screens/Symbols.h deleted file mode 100644 index aeea324..0000000 --- a/src/displayapp/Screens/Symbols.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -namespace Pinetime { - namespace Applications { - namespace Screens { - namespace Symbols { - static constexpr const char* none = ""; - static constexpr const char* batteryFull = "\xEF\x89\x80"; - static constexpr const char* batteryEmpty = "\xEF\x89\x84"; - static constexpr const char* batteryThreeQuarter = "\xEF\x89\x81"; - static constexpr const char* batteryHalf = "\xEF\x89\x82"; - static constexpr const char* batteryOneQuarter = "\xEF\x89\x83"; - static constexpr const char* heartBeat = "\xEF\x88\x9E"; - static constexpr const char* bluetoothFull = "\xEF\x8A\x93"; - static constexpr const char* bluetooth = "\xEF\x8A\x94"; - static constexpr const char* plug = "\xEF\x87\xA6"; - static constexpr const char* shoe = "\xEF\x95\x8B"; - static constexpr const char* clock = "\xEF\x80\x97"; - static constexpr const char* info = "\xEF\x84\xA9"; - static constexpr const char* list = "\xEF\x80\xBA"; - static constexpr const char* sun = "\xEF\x86\x85"; - static constexpr const char* check = "\xEF\x95\xA0"; - static constexpr const char* music = "\xEF\x80\x81"; - static constexpr const char* tachometer = "\xEF\x8F\xBD"; - static constexpr const char* asterisk = "\xEF\x81\xA9"; - static constexpr const char* paintbrush = "\xEF\x87\xBC"; - } - } - } -} \ No newline at end of file diff --git a/src/displayapp/Screens/SystemInfo.cpp b/src/displayapp/Screens/SystemInfo.cpp deleted file mode 100644 index fcafcf7..0000000 --- a/src/displayapp/Screens/SystemInfo.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include -#include -#include -#include "SystemInfo.h" -#include "../../Version.h" -#include "Tile.h" - -using namespace Pinetime::Applications::Screens; - -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, { - [this]() -> std::unique_ptr { return CreateScreen1(); }, - [this]() -> std::unique_ptr { return CreateScreen2(); }, - [this]() -> std::unique_ptr { return CreateScreen3(); } - } - } {} - - -SystemInfo::~SystemInfo() { - lv_obj_clean(lv_scr_act()); -} - -bool SystemInfo::Refresh() { - screens.Refresh(); - return running; -} - -bool SystemInfo::OnButtonPushed() { - running = false; - return true; -} - -bool SystemInfo::OnTouchEvent(Pinetime::Applications::TouchEvents event) { - return screens.OnTouchEvent(event); -} - -std::unique_ptr SystemInfo::CreateScreen1() { - auto batteryPercentF = batteryController.PercentRemaining(); - uint16_t batteryPercent = 0; - if(batteryPercentF > 100.0f) batteryPercent = 100; - else if(batteryPercentF < 0.0f) batteryPercent = 0; - - uint8_t brightness = 0; - switch(brightnessController.Level()) { - case Controllers::BrightnessController::Levels::Off: brightness = 0; break; - case Controllers::BrightnessController::Levels::Low: brightness = 1; break; - case Controllers::BrightnessController::Levels::Medium: brightness = 2; break; - case Controllers::BrightnessController::Levels::High: brightness = 3; break; - } - 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 "?"; - } - }(); - - // uptime - 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); - uptimeSeconds = uptimeSeconds % secondsInADay; - uint32_t uptimeHours = uptimeSeconds / secondsInAnHour; - uptimeSeconds = uptimeSeconds % secondsInAnHour; - uint32_t uptimeMinutes = uptimeSeconds / secondsInAMinute; - uptimeSeconds = uptimeSeconds % secondsInAMinute; - // TODO handle more than 100 days of uptime - - sprintf(t1, "Pinetime\n" - "Version:%ld.%ld.%ld\n" - "Build: %s\n" - " %s\n" - "Date: %02d/%02d/%04d\n" - "Time: %02d:%02d:%02d\n" - "Uptime: %02lud %02lu:%02lu:%02lu\n" - "Battery: %d%%\n" - "Backlight: %d/3\n" - "Last reset: %s\n", - Version::Major(), Version::Minor(), Version::Patch(), - __DATE__, __TIME__, - dateTimeController.Day(), static_cast(dateTimeController.Month()), dateTimeController.Year(), - dateTimeController.Hours(), dateTimeController.Minutes(), dateTimeController.Seconds(), - uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds, - batteryPercent, brightness, resetReason); - - return std::unique_ptr(new Screens::Label(app, t1)); -} - -std::unique_ptr SystemInfo::CreateScreen2() { - auto& bleAddr = bleController.Address(); - sprintf(t2, "BLE MAC: \n %2x:%2x:%2x:%2x:%2x:%2x", - bleAddr[5], bleAddr[4], bleAddr[3], bleAddr[2], bleAddr[1], bleAddr[0]); - return std::unique_ptr(new Screens::Label(app, t2)); -} - -std::unique_ptr SystemInfo::CreateScreen3() { - strncpy(t3, "Hello from\nthe developper!", 27); - return std::unique_ptr(new Screens::Label(app, t3)); -} diff --git a/src/displayapp/Screens/SystemInfo.h b/src/displayapp/Screens/SystemInfo.h deleted file mode 100644 index ac8abae..0000000 --- a/src/displayapp/Screens/SystemInfo.h +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include -#include -#include "Screen.h" -#include "Label.h" -#include "ScreenList.h" -#include "Gauge.h" -#include "Meter.h" -#include - -namespace Pinetime { - namespace Applications { - 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; - - Pinetime::Controllers::DateTime& dateTimeController; - Pinetime::Controllers::Battery& batteryController; - Pinetime::Controllers::BrightnessController& brightnessController; - Pinetime::Controllers::Ble& bleController; - Pinetime::Drivers::WatchdogView& watchdog; - - char t1[200]; - char t2[200]; - char t3[30]; - - ScreenList<3> screens; - std::unique_ptr CreateScreen1(); - std::unique_ptr CreateScreen2(); - std::unique_ptr CreateScreen3(); - }; - } - } -} \ No newline at end of file diff --git a/src/displayapp/Screens/Tab.cpp b/src/displayapp/Screens/Tab.cpp deleted file mode 100644 index adc3257..0000000 --- a/src/displayapp/Screens/Tab.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "Tab.h" -#include - - -using namespace Pinetime::Applications::Screens; - -extern lv_font_t jetbrains_mono_bold_20; - -//static void event_handler(lv_obj_t * obj, lv_event_t event) { -// Tile* screen = static_cast(obj->user_data); -// screen->OnObjectEvent(obj, event); -//} - -Tab::Tab(DisplayApp* app, Pinetime::Components::Gfx &gfx) : Screen(app, gfx) { -/*Create a Tab view object*/ - lv_obj_t *tabview; - tabview = lv_tabview_create(lv_scr_act(), NULL); - - /*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/ - lv_obj_t *tab1 = lv_tabview_add_tab(tabview, "Tab 1"); - lv_obj_t *tab2 = lv_tabview_add_tab(tabview, "Tab 2"); - lv_obj_t *tab3 = lv_tabview_add_tab(tabview, "Tab 3"); - - - /*Add content to the tabs*/ - lv_obj_t * label = lv_label_create(tab1, NULL); - lv_label_set_text(label, "This the first tab\n\n" - "If the content\n" - "of a tab\n" - "become too long\n" - "the it \n" - "automatically\n" - "become\n" - "scrollable."); - - label = lv_label_create(tab2, NULL); - lv_label_set_text(label, "Second tab"); - - label = lv_label_create(tab3, NULL); - lv_label_set_text(label, "Third tab"); - -} - -Tab::~Tab() { - lv_obj_clean(lv_scr_act()); -} - -void Tab::Refresh(bool fullRefresh) { - -} - -void Tab::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { - if(event == LV_EVENT_CLICKED) { - NRF_LOG_INFO("Clicked"); - } - else if(event == LV_EVENT_VALUE_CHANGED) { - NRF_LOG_INFO("Toggled"); - } -} diff --git a/src/displayapp/Screens/Tab.h b/src/displayapp/Screens/Tab.h deleted file mode 100644 index e16dbb9..0000000 --- a/src/displayapp/Screens/Tab.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - class Tab : public Screen { - public: - explicit Tab(DisplayApp* app, Components::Gfx& gfx); - ~Tab() override; - void Refresh(bool fullRefresh) override; - void OnObjectEvent(lv_obj_t* obj, lv_event_t event); - - private: - - }; - } - } -} diff --git a/src/displayapp/Screens/Tile.cpp b/src/displayapp/Screens/Tile.cpp deleted file mode 100644 index 1447d78..0000000 --- a/src/displayapp/Screens/Tile.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include -#include -#include "Tile.h" -#include -#include "Symbols.h" -#include "../../Version.h" - -using namespace Pinetime::Applications::Screens; - -extern lv_font_t jetbrains_mono_bold_20; - -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(DisplayApp* app, std::array& applications) : Screen(app) { - for(int i = 0, appIndex = 0; i < 8; i++) { - if(i == 3) btnm_map1[i] = "\n"; - else if(i == 7) btnm_map1[i] = ""; - else { - btnm_map1[i] = applications[appIndex].icon; - apps[appIndex] = applications[appIndex].application; - appIndex++; - } - } - modal.reset(new Modal(app)); - - btnm1 = lv_btnm_create(lv_scr_act(), NULL); - lv_btnm_set_map(btnm1, btnm_map1); - lv_obj_set_size(btnm1, LV_HOR_RES, LV_VER_RES); - - btnm1->user_data = this; - lv_obj_set_event_cb(btnm1, event_handler); -} - -Tile::~Tile() { - lv_obj_clean(lv_scr_act()); -} - -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) { - app->StartApp(apps[buttonId]); - running = false; - } -} - -bool Tile::OnButtonPushed() { - app->StartApp(Apps::Clock); - running = false; - return true; -} - - diff --git a/src/displayapp/Screens/Tile.h b/src/displayapp/Screens/Tile.h deleted file mode 100644 index 3136d89..0000000 --- a/src/displayapp/Screens/Tile.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#include "Screen.h" -#include -#include "Modal.h" -#include -#include - -namespace Pinetime { - namespace Applications { - namespace Screens { - class Tile : public Screen { - public: - struct Applications { - const char* icon; - Pinetime::Applications::Apps application; - }; - - explicit Tile(DisplayApp* app, std::array& applications); - ~Tile() override; - - bool Refresh() override; - bool OnButtonPushed() override; - - void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId); - - private: - lv_obj_t * btnm1; - bool running = true; - - std::unique_ptr modal; - - const char* btnm_map1[8]; - Pinetime::Applications::Apps apps[6]; - }; - } - } -} diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp new file mode 100644 index 0000000..eb85be4 --- /dev/null +++ b/src/displayapp/screens/ApplicationList.cpp @@ -0,0 +1,82 @@ +#include +#include +#include +#include "ApplicationList.h" +#include "Tile.h" +#include "Symbols.h" + +using namespace Pinetime::Applications::Screens; + +ApplicationList::ApplicationList(Pinetime::Applications::DisplayApp *app) : + Screen(app), + screens{app, { + [this]() -> std::unique_ptr { return CreateScreen1(); }, + [this]() -> std::unique_ptr { return CreateScreen2(); }, + //[this]() -> std::unique_ptr { return CreateScreen3(); } + } + } {} + + +ApplicationList::~ApplicationList() { + lv_obj_clean(lv_scr_act()); +} + +bool ApplicationList::Refresh() { + if(running) + running = screens.Refresh(); + return running; +} + +bool ApplicationList::OnButtonPushed() { + running = false; + app->StartApp(Apps::Clock); + return true; +} + +bool ApplicationList::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + return screens.OnTouchEvent(event); +} + +std::unique_ptr ApplicationList::CreateScreen1() { + std::array applications { + {{Symbols::clock, Apps::Clock}, + {Symbols::music, Apps::Music}, + {Symbols::sun, Apps::Brightness}, + {Symbols::list, Apps::SysInfo}, + {Symbols::check, Apps::FirmwareValidation}, + {Symbols::none, Apps::None} + } + + + }; + + return std::unique_ptr(new Screens::Tile(app, applications)); +} + +std::unique_ptr ApplicationList::CreateScreen2() { + std::array applications { + {{Symbols::tachometer, Apps::Gauge}, + {Symbols::asterisk, Apps::Meter}, + {Symbols::paintbrush, Apps::Paint}, + {Symbols::none, Apps::None}, + {Symbols::none, Apps::None}, + {Symbols::none, Apps::None} + } + }; + + return std::unique_ptr(new Screens::Tile(app, applications)); +} + +std::unique_ptr ApplicationList::CreateScreen3() { + std::array applications { + {{"A", Apps::Meter}, + {"B", Apps::Gauge}, + {"C", Apps::Clock}, + {"D", Apps::Music}, + {"E", Apps::SysInfo}, + {"F", Apps::Brightness} + } + }; + + return std::unique_ptr(new Screens::Tile(app, applications)); +} diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h new file mode 100644 index 0000000..a1e6811 --- /dev/null +++ b/src/displayapp/screens/ApplicationList.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include "Label.h" +#include "ScreenList.h" +#include "Gauge.h" +#include "Meter.h" +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + class ApplicationList : public Screen { + public: + explicit ApplicationList(DisplayApp* app); + ~ApplicationList() override; + bool Refresh() override; + bool OnButtonPushed() override; + bool OnTouchEvent(TouchEvents event) override; + private: + bool running = true; + + ScreenList<2> screens; + std::unique_ptr CreateScreen1(); + std::unique_ptr CreateScreen2(); + std::unique_ptr CreateScreen3(); + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/screens/BatteryIcon.cpp b/src/displayapp/screens/BatteryIcon.cpp new file mode 100644 index 0000000..26939d1 --- /dev/null +++ b/src/displayapp/screens/BatteryIcon.cpp @@ -0,0 +1,21 @@ +#include "BatteryIcon.h" +#include "Symbols.h" +using namespace Pinetime::Applications::Screens; + +const char* BatteryIcon::GetBatteryIcon(float batteryPercent) { + if(batteryPercent > 90.0f) return Symbols::batteryFull; + if(batteryPercent > 75.0f) return Symbols::batteryThreeQuarter; + if(batteryPercent > 50.0f) return Symbols::batteryHalf; + if(batteryPercent > 25.0f) return Symbols::batteryOneQuarter; + return Symbols::batteryEmpty; +} + +const char* BatteryIcon::GetUnknownIcon() { + return Symbols::batteryEmpty; +} + +const char *BatteryIcon::GetPlugIcon(bool isCharging) { + if(isCharging) + return Symbols::plug; + else return ""; +} diff --git a/src/displayapp/screens/BatteryIcon.h b/src/displayapp/screens/BatteryIcon.h new file mode 100644 index 0000000..58f04a8 --- /dev/null +++ b/src/displayapp/screens/BatteryIcon.h @@ -0,0 +1,16 @@ +#pragma once + +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + class BatteryIcon { + public: + static const char* GetUnknownIcon(); + static const char* GetBatteryIcon(float batteryPercent); + static const char* GetPlugIcon(bool isCharging); + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/screens/BleIcon.cpp b/src/displayapp/screens/BleIcon.cpp new file mode 100644 index 0000000..1bbbd05 --- /dev/null +++ b/src/displayapp/screens/BleIcon.cpp @@ -0,0 +1,8 @@ +#include "BleIcon.h" +#include "Symbols.h" +using namespace Pinetime::Applications::Screens; + +const char* BleIcon::GetIcon(bool isConnected) { + if(isConnected) return Symbols::bluetooth; + else return ""; +} \ No newline at end of file diff --git a/src/displayapp/screens/BleIcon.h b/src/displayapp/screens/BleIcon.h new file mode 100644 index 0000000..c1398d2 --- /dev/null +++ b/src/displayapp/screens/BleIcon.h @@ -0,0 +1,12 @@ +#pragma once + +namespace Pinetime { + namespace Applications { + namespace Screens { + class BleIcon { + public: + static const char* GetIcon(bool isConnected); + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/screens/Brightness.cpp b/src/displayapp/screens/Brightness.cpp new file mode 100644 index 0000000..9e3416c --- /dev/null +++ b/src/displayapp/screens/Brightness.cpp @@ -0,0 +1,92 @@ +#include +#include "Brightness.h" + +using namespace Pinetime::Applications::Screens; + +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} { + slider = lv_slider_create(lv_scr_act(), NULL); + lv_obj_set_user_data(slider, this); + lv_obj_set_width(slider, LV_DPI * 2); + lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_event_cb(slider, slider_event_cb); + lv_slider_set_range(slider, 0, 2); + lv_slider_set_value(slider, LevelToInt(brightness.Level()), LV_ANIM_OFF); + + slider_label = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(slider_label, LevelToString(brightness.Level())); + lv_obj_set_auto_realign(slider_label, true); + lv_obj_align(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); +} + +Brightness::~Brightness() { + lv_obj_clean(lv_scr_act()); +} + +bool Brightness::Refresh() { + return running; +} + +bool Brightness::OnButtonPushed() { + running = false; + return true; +} + +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 "???"; + } +} + +void Brightness::OnValueChanged() { + SetValue(lv_slider_get_value(slider)); +} + +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; + } + 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; + } +} + +bool Brightness::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + switch(event) { + case TouchEvents::SwipeLeft: + brightness.Lower(); + SetValue(); + return true; + case TouchEvents::SwipeRight: + brightness.Higher(); + SetValue(); + return true; + default: + return false; + } +} + +void Brightness::SetValue() { + lv_slider_set_value(slider, LevelToInt(brightness.Level()), LV_ANIM_OFF); + lv_label_set_text(slider_label, LevelToString(brightness.Level())); +} diff --git a/src/displayapp/screens/Brightness.h b/src/displayapp/screens/Brightness.h new file mode 100644 index 0000000..37cbcd7 --- /dev/null +++ b/src/displayapp/screens/Brightness.h @@ -0,0 +1,33 @@ +#pragma once + +#include +#include +#include "Screen.h" + +namespace Pinetime { + namespace Applications { + namespace Screens { + class Brightness : public Screen { + public: + Brightness(DisplayApp* app, Controllers::BrightnessController& brightness); + ~Brightness() override; + bool Refresh() override; + bool OnButtonPushed() override; + bool OnTouchEvent(TouchEvents event) override; + + void OnValueChanged(); + private: + bool running = true; + 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(); + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp new file mode 100644 index 0000000..06fab9a --- /dev/null +++ b/src/displayapp/screens/Clock.cpp @@ -0,0 +1,227 @@ +#include +#include +#include +#include +#include "Clock.h" +#include "../DisplayApp.h" +#include "BatteryIcon.h" +#include "BleIcon.h" +#include "Symbols.h" +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; +extern lv_style_t* LabelBigStyle; + +static void event_handler(lv_obj_t * obj, lv_event_t event) { + Clock* screen = static_cast(obj->user_data); + screen->OnObjectEvent(obj, event); +} + +Clock::Clock(DisplayApp* app, + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController) : Screen(app), currentDateTime{{}}, + dateTimeController{dateTimeController}, batteryController{batteryController}, bleController{bleController} { + displayedChar[0] = 0; + displayedChar[1] = 0; + displayedChar[2] = 0; + displayedChar[3] = 0; + displayedChar[4] = 0; + + batteryIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(batteryIcon, Symbols::batteryFull); + lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 2); + + batteryPlug = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(batteryPlug, Symbols::plug); + lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); + + bleIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(bleIcon, Symbols::bluetooth); + lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); + + + label_date = lv_label_create(lv_scr_act(), NULL); + + lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); + + label_time = lv_label_create(lv_scr_act(), NULL); + lv_label_set_style(label_time, LV_LABEL_STYLE_MAIN, LabelBigStyle); + lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0); + + backgroundLabel = lv_label_create(lv_scr_act(), NULL); + backgroundLabel->user_data = this; + lv_obj_set_click(backgroundLabel, true); + lv_obj_set_event_cb(backgroundLabel, event_handler); + 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(backgroundLabel, ""); + + + heartbeatIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(heartbeatIcon, Symbols::heartBeat); + lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2); + + heartbeatValue = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(heartbeatValue, "0"); + lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0); + + heartbeatBpm = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(heartbeatBpm, "BPM"); + lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0); + + stepValue = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(stepValue, "0"); + lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2); + + stepIcon = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(stepIcon, Symbols::shoe); + lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); +} + +Clock::~Clock() { + lv_obj_clean(lv_scr_act()); +} + +bool Clock::Refresh() { + batteryPercentRemaining = batteryController.PercentRemaining(); + if (batteryPercentRemaining.IsUpdated()) { + auto batteryPercent = batteryPercentRemaining.Get(); + lv_label_set_text(batteryIcon, BatteryIcon::GetBatteryIcon(batteryPercent)); + auto isCharging = batteryController.IsCharging() || batteryController.IsPowerPresent(); + lv_label_set_text(batteryPlug, BatteryIcon::GetPlugIcon(isCharging)); + } + + bleState = bleController.IsConnected(); + if (bleState.IsUpdated()) { + if(bleState.Get() == true) { + lv_label_set_text(bleIcon, BleIcon::GetIcon(true)); + } else { + lv_label_set_text(bleIcon, BleIcon::GetIcon(false)); + } + } + lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 5); + lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); + lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); + + currentDateTime = dateTimeController.CurrentDateTime(); + + if(currentDateTime.IsUpdated()) { + auto newDateTime = currentDateTime.Get(); + + auto dp = date::floor(newDateTime); + 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 dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); + + auto hour = time.hours().count(); + auto minute = time.minutes().count(); + + char minutesChar[3]; + sprintf(minutesChar, "%02d", static_cast(minute)); + + char hoursChar[3]; + sprintf(hoursChar, "%02d", static_cast(hour)); + + char timeStr[6]; + sprintf(timeStr, "%c%c:%c%c", hoursChar[0],hoursChar[1],minutesChar[0], minutesChar[1]); + + 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]; + displayedChar[3] = minutesChar[1]; + + lv_label_set_text(label_time, timeStr); + } + + if ((year != currentYear) || (month != currentMonth) || (dayOfWeek != currentDayOfWeek) || (day != currentDay)) { + char dateStr[22]; + sprintf(dateStr, "%s %d %s %d", DayOfWeekToString(dayOfWeek), day, MonthToString(month), year); + lv_label_set_text(label_date, dateStr); + + + currentYear = year; + currentMonth = month; + currentDayOfWeek = dayOfWeek; + currentDay = day; + } + } + + // TODO heartbeat = heartBeatController.GetValue(); + if(heartbeat.IsUpdated()) { + char heartbeatBuffer[4]; + sprintf(heartbeatBuffer, "%d", heartbeat.Get()); + lv_label_set_text(heartbeatValue, heartbeatBuffer); + 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); + } + + // TODO stepCount = stepController.GetValue(); + if(stepCount.IsUpdated()) { + char stepBuffer[5]; + sprintf(stepBuffer, "%lu", stepCount.Get()); + lv_label_set_text(stepValue, stepBuffer); + 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); + } + + return running; +} + +const char *Clock::MonthToString(Pinetime::Controllers::DateTime::Months month) { + return Clock::MonthsString[static_cast(month)]; +} + +const char *Clock::DayOfWeekToString(Pinetime::Controllers::DateTime::Days dayOfWeek) { + return Clock::DaysString[static_cast(dayOfWeek)]; +} + +char const *Clock::DaysString[] = { + "", + "MONDAY", + "TUESDAY", + "WEDNESDAY", + "THURSDAY", + "FRIDAY", + "SATURDAY", + "SUNDAY" +}; + +char const *Clock::MonthsString[] = { + "", + "JAN", + "FEB", + "MAR", + "APR", + "MAY", + "JUN", + "JUL", + "AUG", + "SEP", + "OCT", + "NOV", + "DEC" +}; + +void Clock::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { + if(obj == backgroundLabel) { + if (event == LV_EVENT_CLICKED) { + + running = false; + } + } +} + +bool Clock::OnButtonPushed() { + running = false; + return false; +} + + diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h new file mode 100644 index 0000000..7363fda --- /dev/null +++ b/src/displayapp/screens/Clock.h @@ -0,0 +1,88 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include +#include +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + template + class DirtyValue { + public: + explicit DirtyValue(T v) { value = v; } + explicit DirtyValue(T& v) { value = v; } + bool IsUpdated() const { return isUpdated; } + T& Get() { this->isUpdated = false; return value; } + + DirtyValue& operator=(const T& other) { + if (this->value != other) { + this->value = other; + this->isUpdated = true; + } + return *this; + } + private: + T value; + bool isUpdated = true; + }; + class Clock : public Screen{ + public: + Clock(DisplayApp* app, + Controllers::DateTime& dateTimeController, + Controllers::Battery& batteryController, + Controllers::Ble& bleController); + ~Clock() override; + + bool Refresh() override; + bool OnButtonPushed() override; + + void OnObjectEvent(lv_obj_t *pObj, lv_event_t i); + private: + static const char* MonthToString(Pinetime::Controllers::DateTime::Months month); + static const char* DayOfWeekToString(Pinetime::Controllers::DateTime::Days dayOfWeek); + static char const *DaysString[]; + static char const *MonthsString[]; + + 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; + + DirtyValue batteryPercentRemaining {0}; + DirtyValue bleState {false}; + DirtyValue> currentDateTime; + DirtyValue stepCount {0}; + DirtyValue heartbeat {0}; + + + lv_obj_t* label_time; + 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; + + Controllers::DateTime& dateTimeController; + Controllers::Battery& batteryController; + Controllers::Ble& bleController; + + bool running = true; + + }; + } + } +} diff --git a/src/displayapp/screens/DropDownDemo.cpp b/src/displayapp/screens/DropDownDemo.cpp new file mode 100644 index 0000000..735a0cc --- /dev/null +++ b/src/displayapp/screens/DropDownDemo.cpp @@ -0,0 +1,64 @@ +#include +#include +#include "DropDownDemo.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + +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(), NULL); + 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); + lv_obj_align(ddlist, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); +} + +DropDownDemo::~DropDownDemo() { + // Reset the touchmode + app->SetTouchMode(DisplayApp::TouchModes::Gestures); + lv_obj_clean(lv_scr_act()); +} + +bool DropDownDemo::Refresh() { + 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) + app->SetTouchMode(DisplayApp::TouchModes::Polling); + else + app->SetTouchMode(DisplayApp::TouchModes::Gestures); + return running; +} + +bool DropDownDemo::OnButtonPushed() { + running = false; + return true; +} + +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) { + return true; + } else { + return false; + } +} + diff --git a/src/displayapp/screens/DropDownDemo.h b/src/displayapp/screens/DropDownDemo.h new file mode 100644 index 0000000..7c75efc --- /dev/null +++ b/src/displayapp/screens/DropDownDemo.h @@ -0,0 +1,29 @@ +#pragma once + +#include +#include "Screen.h" +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class DropDownDemo : public Screen{ + public: + DropDownDemo(DisplayApp* app); + ~DropDownDemo() override; + + bool Refresh() override; + bool OnButtonPushed() override; + bool OnTouchEvent(TouchEvents event) override; + + private: + lv_obj_t * ddlist; + bool running = true; + bool isDropDownOpened = false; + }; + } + } +} diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp new file mode 100644 index 0000000..e831114 --- /dev/null +++ b/src/displayapp/screens/FirmwareUpdate.cpp @@ -0,0 +1,82 @@ +#include +#include "FirmwareUpdate.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + + +FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Ble& bleController) : + Screen(app), bleController{bleController} { + + titleLabel = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(titleLabel, "Firmware update"); + lv_obj_set_auto_realign(titleLabel, true); + lv_obj_align(titleLabel, NULL, LV_ALIGN_IN_TOP_MID, 0, 50); + + bar1 = lv_bar_create(lv_scr_act(), NULL); + lv_obj_set_size(bar1, 200, 30); + lv_obj_align(bar1, NULL, LV_ALIGN_CENTER, 0, 0); + lv_bar_set_anim_time(bar1, 10); + lv_bar_set_range(bar1, 0, 100); + lv_bar_set_value(bar1, 0, LV_ANIM_OFF); + + percentLabel = lv_label_create(lv_scr_act(), NULL); + lv_label_set_text(percentLabel, ""); + lv_obj_set_auto_realign(percentLabel, true); + lv_obj_align(percentLabel, bar1, LV_ALIGN_OUT_TOP_MID, 0, 60); +} + +FirmwareUpdate::~FirmwareUpdate() { + lv_obj_clean(lv_scr_act()); +} + +bool FirmwareUpdate::Refresh() { + switch(bleController.State()) { + default: + case Pinetime::Controllers::Ble::FirmwareUpdateStates::Idle: + case Pinetime::Controllers::Ble::FirmwareUpdateStates::Running: + if(state != States::Running) + state = States::Running; + return DisplayProgression(); + case Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated: + if(state != States::Validated) { + UpdateValidated(); + state = States::Validated; + } + return running; + case Pinetime::Controllers::Ble::FirmwareUpdateStates::Error: + if(state != States::Error) { + UpdateError(); + state = States::Error; + } + return running; + } +} + +bool FirmwareUpdate::DisplayProgression() const { + float current = bleController.FirmwareUpdateCurrentBytes() / 1024.0f; + float total = bleController.FirmwareUpdateTotalBytes() / 1024.0f; + int16_t pc = (current / total) * 100.0f; + sprintf(percentStr, "%d %%", pc); + lv_label_set_text(percentLabel, percentStr); + + lv_bar_set_value(bar1, pc, LV_ANIM_OFF); + return running; +} + +bool FirmwareUpdate::OnButtonPushed() { + running = false; + return true; +} + +void FirmwareUpdate::UpdateValidated() { + lv_label_set_recolor(percentLabel, true); + lv_label_set_text(percentLabel, "#00ff00 Image Ok!#"); +} + +void FirmwareUpdate::UpdateError() { + lv_label_set_recolor(percentLabel, true); + lv_label_set_text(percentLabel, "#ff0000 Error!#"); +} diff --git a/src/displayapp/screens/FirmwareUpdate.h b/src/displayapp/screens/FirmwareUpdate.h new file mode 100644 index 0000000..faaf395 --- /dev/null +++ b/src/displayapp/screens/FirmwareUpdate.h @@ -0,0 +1,41 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class FirmwareUpdate : public Screen{ + public: + FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController); + ~FirmwareUpdate() override; + + bool Refresh() override; + bool OnButtonPushed() 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]; + bool running = true; + States state; + + bool DisplayProgression() const; + + void UpdateValidated(); + + void UpdateError(); + }; + } + } +} diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp new file mode 100644 index 0000000..fb2dd95 --- /dev/null +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -0,0 +1,91 @@ +#include +#include "FirmwareValidation.h" +#include "../DisplayApp.h" +#include "../../Version.h" +#include "../../Components/FirmwareValidator/FirmwareValidator.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + +namespace { + 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} { + labelVersionInfo = lv_label_create(lv_scr_act(), NULL); + lv_obj_align(labelVersionInfo, NULL, 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(), NULL); + lv_obj_align(labelVersionValue, labelVersionInfo, LV_ALIGN_OUT_RIGHT_MID, 0, 0); + lv_label_set_recolor(labelVersionValue, true); + sprintf(version, "%ld.%ld.%ld", Version::Major(), Version::Minor(), Version::Patch()); + lv_label_set_text(labelVersionValue, version); + + labelIsValidated = lv_label_create(lv_scr_act(), NULL); + lv_obj_align(labelIsValidated, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 50); + lv_label_set_recolor(labelIsValidated, true); + lv_label_set_long_mode(labelIsValidated, LV_LABEL_LONG_BREAK); + lv_obj_set_width(labelIsValidated, 240); + + 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."); + + buttonValidate = lv_btn_create(lv_scr_act(), NULL); + lv_obj_align(buttonValidate, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); + buttonValidate->user_data = this; + lv_obj_set_event_cb(buttonValidate, ButtonEventHandler); + + labelButtonValidate = lv_label_create(buttonValidate, NULL); + lv_label_set_recolor(labelButtonValidate, true); + lv_label_set_text(labelButtonValidate, "#00ff00 Validate#"); + + buttonReset = lv_btn_create(lv_scr_act(), NULL); + buttonReset->user_data = this; + lv_obj_align(buttonReset, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); + lv_obj_set_event_cb(buttonReset, ButtonEventHandler); + + labelButtonReset = lv_label_create(buttonReset, NULL); + lv_label_set_recolor(labelButtonReset, true); + lv_label_set_text(labelButtonReset, "#ff0000 Reset#"); + } +} + + +FirmwareValidation::~FirmwareValidation() { + lv_obj_clean(lv_scr_act()); +} + +bool FirmwareValidation::Refresh() { + return running; +} + +bool FirmwareValidation::OnButtonPushed() { + running = false; + return true; +} + +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) { + validator.Reset(); + } + +} + + diff --git a/src/displayapp/screens/FirmwareValidation.h b/src/displayapp/screens/FirmwareValidation.h new file mode 100644 index 0000000..947f557 --- /dev/null +++ b/src/displayapp/screens/FirmwareValidation.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include "Screen.h" +#include +#include +#include + +namespace Pinetime { + namespace Controllers { + class FirmwareValidator; + } + + namespace Applications { + namespace Screens { + + class FirmwareValidation : public Screen{ + public: + FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator); + ~FirmwareValidation() override; + + bool Refresh() override; + bool OnButtonPushed() override; + + void OnButtonEvent(lv_obj_t *object, lv_event_t event); + + 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; + bool running = true; + }; + } + } +} diff --git a/src/displayapp/screens/Gauge.cpp b/src/displayapp/screens/Gauge.cpp new file mode 100644 index 0000000..fd90523 --- /dev/null +++ b/src/displayapp/screens/Gauge.cpp @@ -0,0 +1,58 @@ +#include +#include "Gauge.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + + +Gauge::Gauge(Pinetime::Applications::DisplayApp *app) : Screen(app) { + /*Create a style*/ + lv_style_copy(&style, &lv_style_pretty_color); + style.body.main_color = LV_COLOR_CYAN; /*Line color at the beginning*/ + style.body.grad_color = LV_COLOR_RED; /*Line color at the end*/ + style.body.padding.left = 10; /*Scale line length*/ + style.body.padding.inner = 8 ; /*Scale label padding*/ + style.body.border.color = lv_color_hex3(0x333); /*Needle middle circle color*/ + style.line.width = 3; + style.text.color = LV_COLOR_WHITE; + style.line.color = LV_COLOR_RED; /*Line color after the critical value*/ + + + /*Describe the color for the needles*/ + + needle_colors[0] = LV_COLOR_ORANGE; + + /*Create a gauge*/ + gauge1 = lv_gauge_create(lv_scr_act(), NULL); + lv_gauge_set_style(gauge1, LV_GAUGE_STYLE_MAIN, &style); + lv_gauge_set_needle_count(gauge1, 1, needle_colors); + lv_obj_set_size(gauge1, 180, 180); + lv_obj_align(gauge1, NULL, LV_ALIGN_CENTER, 0, 0); + lv_gauge_set_scale(gauge1, 360, 60, 0); + lv_gauge_set_range(gauge1, 0, 59); + + /*Set the values*/ + lv_gauge_set_value(gauge1, 0, value); +} + +Gauge::~Gauge() { + + + lv_obj_clean(lv_scr_act()); +} + +bool Gauge::Refresh() { +// lv_lmeter_set_value(lmeter, value++); /*Set the current value*/ +// if(value>=60) value = 0; + + lv_gauge_set_value(gauge1, 0, value++); + if(value == 59) value = 0; + return running; +} + +bool Gauge::OnButtonPushed() { + running = false; + return true; +} diff --git a/src/displayapp/screens/Gauge.h b/src/displayapp/screens/Gauge.h new file mode 100644 index 0000000..03c06be --- /dev/null +++ b/src/displayapp/screens/Gauge.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include "Screen.h" +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class Gauge : public Screen{ + public: + Gauge(DisplayApp* app); + ~Gauge() override; + + bool Refresh() override; + bool OnButtonPushed() override; + + private: + lv_style_t style; + lv_color_t needle_colors[3]; + lv_obj_t * gauge1; + + uint32_t value=30; + bool running = true; + + }; + } + } +} diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp new file mode 100644 index 0000000..b340f5d --- /dev/null +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -0,0 +1,44 @@ +#include +#include +#include "InfiniPaint.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + +InfiniPaint::InfiniPaint(Pinetime::Applications::DisplayApp *app, Pinetime::Components::LittleVgl& lvgl) : Screen(app), lvgl{lvgl} { + app->SetTouchMode(DisplayApp::TouchModes::Polling); + std::fill(b, b+bufferSize, LV_COLOR_WHITE); +} + +InfiniPaint::~InfiniPaint() { + // Reset the touchmode + app->SetTouchMode(DisplayApp::TouchModes::Gestures); + lv_obj_clean(lv_scr_act()); +} + +bool InfiniPaint::Refresh() { + return running; +} + +bool InfiniPaint::OnButtonPushed() { + running = false; + return true; +} + +bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + return true; +} + +bool InfiniPaint::OnTouchEvent(uint16_t x, uint16_t y) { + lv_area_t area; + area.x1 = x-(width/2); + area.y1 = y-(height/2); + area.x2 = x+(width/2)-1; + area.y2 = y+(height/2)-1; + lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::None); + lvgl.FlushDisplay(&area, b); + return true; +} + diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h new file mode 100644 index 0000000..a1592f9 --- /dev/null +++ b/src/displayapp/screens/InfiniPaint.h @@ -0,0 +1,35 @@ +#pragma once + +#include +#include "Screen.h" +#include +#include +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class InfiniPaint : public Screen{ + public: + InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl); + ~InfiniPaint() override; + + bool Refresh() override; + bool OnButtonPushed() override; + bool OnTouchEvent(TouchEvents event) override; + bool OnTouchEvent(uint16_t x, uint16_t y) override; + + private: + Pinetime::Components::LittleVgl& lvgl; + static constexpr uint16_t width = 10; + static constexpr uint16_t height = 10; + static constexpr uint16_t bufferSize = width*height; + lv_color_t b[bufferSize]; + bool running = true; + }; + } + } +} diff --git a/src/displayapp/screens/Label.cpp b/src/displayapp/screens/Label.cpp new file mode 100644 index 0000000..780ee88 --- /dev/null +++ b/src/displayapp/screens/Label.cpp @@ -0,0 +1,15 @@ +#include +#include "Label.h" + +using namespace Pinetime::Applications::Screens; + +Label::Label(Pinetime::Applications::DisplayApp *app, const char *text) : Screen(app), text{text} { + label = lv_label_create(lv_scr_act(), NULL); + lv_label_set_align(label, LV_LABEL_ALIGN_LEFT); + lv_obj_set_size(label, 240, 240); + lv_label_set_text(label, text); +} + +Label::~Label() { + lv_obj_clean(lv_scr_act()); +} diff --git a/src/displayapp/screens/Label.h b/src/displayapp/screens/Label.h new file mode 100644 index 0000000..3e7b379 --- /dev/null +++ b/src/displayapp/screens/Label.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include "Screen.h" +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class Label : public Screen { + public: + Label(DisplayApp* app, const char* text); + ~Label() override; + bool Refresh() override {return false;} + + private: + lv_obj_t * label = nullptr; + const char* text = nullptr; + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/screens/Meter.cpp b/src/displayapp/screens/Meter.cpp new file mode 100644 index 0000000..c74b8bd --- /dev/null +++ b/src/displayapp/screens/Meter.cpp @@ -0,0 +1,47 @@ +#include +#include "Meter.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + + +Meter::Meter(Pinetime::Applications::DisplayApp *app) : Screen(app) { + + lv_style_copy(&style_lmeter, &lv_style_pretty_color); + style_lmeter.line.width = 2; + style_lmeter.line.color = LV_COLOR_SILVER; + style_lmeter.body.main_color = lv_color_make(255,0,0); + style_lmeter.body.grad_color = lv_color_make(160,0,0); + style_lmeter.body.padding.left = 16; /*Line length*/ + + /*Create a line meter */ + lmeter = lv_lmeter_create(lv_scr_act(), NULL); + lv_lmeter_set_range(lmeter, 0, 60); /*Set the range*/ + lv_lmeter_set_value(lmeter, value); /*Set the current value*/ + lv_lmeter_set_angle_offset(lmeter, 180); + lv_lmeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/ + lv_lmeter_set_style(lmeter, LV_LMETER_STYLE_MAIN, &style_lmeter); /*Apply the new style*/ + lv_obj_set_size(lmeter, 150, 150); + lv_obj_align(lmeter, NULL, LV_ALIGN_CENTER, 0, 0); + +} + +Meter::~Meter() { + + + lv_obj_clean(lv_scr_act()); +} + +bool Meter::Refresh() { + lv_lmeter_set_value(lmeter, value++); /*Set the current value*/ + if(value>=60) value = 0; + + return running; +} + +bool Meter::OnButtonPushed() { + running = false; + return true; +} diff --git a/src/displayapp/screens/Meter.h b/src/displayapp/screens/Meter.h new file mode 100644 index 0000000..ddf8be8 --- /dev/null +++ b/src/displayapp/screens/Meter.h @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class Meter : public Screen{ + public: + Meter(DisplayApp* app); + ~Meter() override; + + bool Refresh() override; + bool OnButtonPushed() override; + + private: + lv_style_t style_lmeter; + lv_obj_t * lmeter; + + uint32_t value=0; + bool running = true; + + }; + } + } +} diff --git a/src/displayapp/screens/Modal.cpp b/src/displayapp/screens/Modal.cpp new file mode 100644 index 0000000..63ae70c --- /dev/null +++ b/src/displayapp/screens/Modal.cpp @@ -0,0 +1,81 @@ +#include +#include "Modal.h" +#include "../DisplayApp.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + +Modal::Modal(Pinetime::Applications::DisplayApp *app) : Screen(app) { + + +} + +Modal::~Modal() { + lv_obj_clean(lv_scr_act()); +} + +bool Modal::Refresh() { + + return running; +} + +bool Modal::OnButtonPushed() { + running = false; + return true; +} + +void Modal::Hide() { + /* Delete the parent modal background */ + lv_obj_del_async(lv_obj_get_parent(mbox)); + mbox = NULL; /* happens before object is actually deleted! */ + isVisible = false; +} + +void Modal::mbox_event_cb(lv_obj_t *obj, lv_event_t evt) { + auto* m = static_cast(obj->user_data); + m->OnEvent(obj, evt); +} + +void Modal::OnEvent(lv_obj_t *event_obj, lv_event_t evt) { + if(evt == LV_EVENT_DELETE && event_obj == mbox) { + Hide(); + } else if(evt == LV_EVENT_VALUE_CHANGED) { + /* A button was clicked */ + lv_mbox_start_auto_close(mbox, 0); +// Hide(); + } +} + +void Modal::Show(const char* msg) { + if(isVisible) return; + isVisible = true; + lv_style_copy(&modal_style, &lv_style_plain_color); + modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK; + modal_style.body.opa = LV_OPA_50; + + obj = lv_obj_create(lv_scr_act(), NULL); + lv_obj_set_style(obj, &modal_style); + lv_obj_set_pos(obj, 0, 0); + lv_obj_set_size(obj, LV_HOR_RES, LV_VER_RES); + lv_obj_set_opa_scale_enable(obj, true); /* Enable opacity scaling for the animation */ + + static const char * btns2[] = {"Ok", ""}; + + /* Create the message box as a child of the modal background */ + mbox = lv_mbox_create(obj, NULL); + lv_mbox_add_btns(mbox, btns2); + lv_mbox_set_text(mbox, msg); + lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); + lv_obj_set_event_cb(mbox, Modal::mbox_event_cb); + + mbox->user_data = this; + + /* Fade the message box in with an animation */ + lv_anim_t a; + lv_anim_init(&a); + lv_anim_set_time(&a, 500, 0); + lv_anim_set_values(&a, LV_OPA_TRANSP, LV_OPA_COVER); + lv_anim_set_exec_cb(&a, obj, (lv_anim_exec_xcb_t)lv_obj_set_opa_scale); + lv_anim_create(&a); +} diff --git a/src/displayapp/screens/Modal.h b/src/displayapp/screens/Modal.h new file mode 100644 index 0000000..c616c29 --- /dev/null +++ b/src/displayapp/screens/Modal.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class Modal : public Screen{ + public: + Modal(DisplayApp* app); + ~Modal() override; + + void Show(const char* msg); + void Hide(); + + bool Refresh() override; + bool OnButtonPushed() override; + + static void mbox_event_cb(lv_obj_t *obj, lv_event_t evt); + private: + void OnEvent(lv_obj_t *event_obj, lv_event_t evt); + + lv_style_t modal_style; + lv_obj_t *obj; + lv_obj_t *mbox; + lv_obj_t *info; + bool running = true; + bool isVisible = false; + + }; + } + } +} diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp new file mode 100644 index 0000000..9b7d198 --- /dev/null +++ b/src/displayapp/screens/Music.cpp @@ -0,0 +1,125 @@ +#include +#include "Music.h" + +using namespace Pinetime::Applications::Screens; +extern lv_font_t jetbrains_mono_extrabold_compressed; +extern lv_font_t jetbrains_mono_bold_20; + +static void event_handler(lv_obj_t * obj, lv_event_t event) +{ + Music* screen = static_cast(obj->user_data); + screen->OnObjectEvent(obj, event); +} + +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(), NULL); + btnVolDown->user_data = this; + lv_obj_set_event_cb(btnVolDown, event_handler); + lv_obj_align(btnVolDown, NULL, LV_ALIGN_IN_TOP_LEFT, 10, 10); + label = lv_label_create(btnVolDown, NULL); + lv_label_set_text(label, "v-"); + + btnVolUp = lv_btn_create(lv_scr_act(), NULL); + btnVolUp->user_data = this; + lv_obj_set_event_cb(btnVolUp, event_handler); + lv_obj_align(btnVolUp, NULL, LV_ALIGN_IN_TOP_RIGHT, -10, 10); + label = lv_label_create(btnVolUp, NULL); + lv_label_set_text(label, "v+"); + + btnPrev = lv_btn_create(lv_scr_act(), NULL); + btnPrev->user_data = this; + lv_obj_set_event_cb(btnPrev, event_handler); + lv_obj_set_size(btnPrev, LV_HOR_RES / 4, LV_VER_RES / 4); + lv_obj_align(btnPrev, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 10,-10); + label = lv_label_create(btnPrev, NULL); + lv_label_set_text(label, "<<"); + + btnPlayPause = lv_btn_create(lv_scr_act(), NULL); + btnPlayPause->user_data = this; + lv_obj_set_event_cb(btnPlayPause, event_handler); + lv_obj_set_size(btnPlayPause, LV_HOR_RES / 4, LV_VER_RES / 4); + lv_obj_align(btnPlayPause, NULL, LV_ALIGN_IN_BOTTOM_MID, 0,-10); + txtPlayPause = lv_label_create(btnPlayPause, NULL); + lv_label_set_text(txtPlayPause, ">"); + + btnNext = lv_btn_create(lv_scr_act(), NULL); + btnNext->user_data = this; + lv_obj_set_event_cb(btnNext, event_handler); + lv_obj_set_size(btnNext, LV_HOR_RES / 4, LV_VER_RES / 4); + lv_obj_align(btnNext, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, -10,-10); + label = lv_label_create(btnNext, NULL); + lv_label_set_text(label, ">>"); + + txtArtist = lv_label_create(lv_scr_act(), NULL); + lv_label_set_long_mode(txtArtist, LV_LABEL_LONG_SROLL); + lv_obj_align(txtArtist, NULL, LV_ALIGN_IN_LEFT_MID, 0,-20); + lv_label_set_text(txtArtist, "Artist Name"); + lv_label_set_align(txtArtist, LV_LABEL_ALIGN_CENTER); + lv_obj_set_width(txtArtist, LV_HOR_RES); + + txtTrack = lv_label_create(lv_scr_act(), NULL); + lv_label_set_long_mode(txtTrack, LV_LABEL_LONG_DOT); + lv_obj_align(txtTrack, NULL, LV_ALIGN_IN_LEFT_MID, 0,20); + lv_label_set_text(txtTrack, "This is a very long track name"); + lv_label_set_align(txtTrack, LV_LABEL_ALIGN_CENTER); + lv_obj_set_width(txtTrack, LV_HOR_RES); + + musicService.event(Controllers::MusicService::EVENT_MUSIC_OPEN); +} + +Music::~Music() { + lv_obj_clean(lv_scr_act()); +} + +bool Music::OnButtonPushed() { + running = false; + return true; +} + +bool Music::Refresh() { + + if (m_artist != musicService.artist()) { + m_artist = musicService.artist(); + lv_label_set_text(txtArtist, m_artist.data()); + } + if (m_track != musicService.track()) { + m_track = musicService.track(); + lv_label_set_text(txtTrack, m_track.data()); + } + if (m_album != musicService.album()) { + m_album = musicService.album(); + } + if (m_status != musicService.status()) { + m_status = musicService.status(); + } + if (m_status == Pinetime::Controllers::MusicService::STATUS_MUSIC_PLAYING) { + lv_label_set_text(txtPlayPause, "||"); + } else { + lv_label_set_text(txtPlayPause, ">"); + } + + return running; +} + +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); + } else if (obj == btnVolUp) { + musicService.event(Controllers::MusicService::EVENT_MUSIC_VOLUP); + } else if (obj == btnPrev) { + musicService.event(Controllers::MusicService::EVENT_MUSIC_PREV); + } else if (obj == btnPlayPause) { + if (m_status == Pinetime::Controllers::MusicService::STATUS_MUSIC_PLAYING) { + musicService.event(Controllers::MusicService::EVENT_MUSIC_PAUSE); + } else { + musicService.event(Controllers::MusicService::EVENT_MUSIC_PLAY); + } + } else if (obj == btnNext) { + musicService.event(Controllers::MusicService::EVENT_MUSIC_NEXT); + } + } +} diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h new file mode 100644 index 0000000..95cac0f --- /dev/null +++ b/src/displayapp/screens/Music.h @@ -0,0 +1,49 @@ +#pragma once + +#include +#include +#include +#include "Screen.h" +#include +#include +#include +#include +#include +#include "../../Version.h" +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + + class Music : public Screen{ + public: + Music(DisplayApp* app, Pinetime::Controllers::MusicService &music); + ~Music() override; + + bool Refresh() override; + bool OnButtonPushed() override; + + void OnObjectEvent(lv_obj_t* obj, lv_event_t event); + + private: + 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; + + bool running = true; + Pinetime::Controllers::MusicService &musicService; + std::string m_artist; + std::string m_album; + std::string m_track; + unsigned char m_status; + }; + } + } +} diff --git a/src/displayapp/screens/Screen.cpp b/src/displayapp/screens/Screen.cpp new file mode 100644 index 0000000..1467df3 --- /dev/null +++ b/src/displayapp/screens/Screen.cpp @@ -0,0 +1,2 @@ +#include "Screen.h" +using namespace Pinetime::Applications::Screens; \ No newline at end of file diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h new file mode 100644 index 0000000..dbf81a4 --- /dev/null +++ b/src/displayapp/screens/Screen.h @@ -0,0 +1,30 @@ +#pragma once + +#include +#include "../TouchEvents.h" + +namespace Pinetime { + namespace Applications { + class DisplayApp; + namespace Screens { + class Screen { + public: + Screen(DisplayApp* app) : app{app} {} + virtual ~Screen() = default; + + // 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 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; + }; + } + } +} diff --git a/src/displayapp/screens/ScreenList.h b/src/displayapp/screens/ScreenList.h new file mode 100644 index 0000000..d873336 --- /dev/null +++ b/src/displayapp/screens/ScreenList.h @@ -0,0 +1,66 @@ +#pragma once + +#include +#include +#include +#include "Screen.h" +#include "Label.h" + +namespace Pinetime { + namespace Applications { + namespace Screens { + template + class ScreenList : public Screen { + public: + ScreenList(DisplayApp* app, std::array()>, N>&& screens) + : Screen(app), screens{std::move(screens)}, current{this->screens[0]()} { + + } + + ~ScreenList() override { + + } + + bool Refresh() override { + running = current->Refresh(); + return running; + } + + bool OnButtonPushed() override { + running = false; + return true; + } + + bool OnTouchEvent(TouchEvents event) override { + switch (event) { + case TouchEvents::SwipeDown: + if (screenIndex > 0) { + current.reset(nullptr); + app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down); + screenIndex--; + 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; + } + return false; + } + + private: + bool running = true; + uint8_t screenIndex = 0; + std::array()>, N> screens; + std::unique_ptr current; + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/screens/Symbols.h b/src/displayapp/screens/Symbols.h new file mode 100644 index 0000000..aeea324 --- /dev/null +++ b/src/displayapp/screens/Symbols.h @@ -0,0 +1,30 @@ +#pragma once + +namespace Pinetime { + namespace Applications { + namespace Screens { + namespace Symbols { + static constexpr const char* none = ""; + static constexpr const char* batteryFull = "\xEF\x89\x80"; + static constexpr const char* batteryEmpty = "\xEF\x89\x84"; + static constexpr const char* batteryThreeQuarter = "\xEF\x89\x81"; + static constexpr const char* batteryHalf = "\xEF\x89\x82"; + static constexpr const char* batteryOneQuarter = "\xEF\x89\x83"; + static constexpr const char* heartBeat = "\xEF\x88\x9E"; + static constexpr const char* bluetoothFull = "\xEF\x8A\x93"; + static constexpr const char* bluetooth = "\xEF\x8A\x94"; + static constexpr const char* plug = "\xEF\x87\xA6"; + static constexpr const char* shoe = "\xEF\x95\x8B"; + static constexpr const char* clock = "\xEF\x80\x97"; + static constexpr const char* info = "\xEF\x84\xA9"; + static constexpr const char* list = "\xEF\x80\xBA"; + static constexpr const char* sun = "\xEF\x86\x85"; + static constexpr const char* check = "\xEF\x95\xA0"; + static constexpr const char* music = "\xEF\x80\x81"; + static constexpr const char* tachometer = "\xEF\x8F\xBD"; + static constexpr const char* asterisk = "\xEF\x81\xA9"; + static constexpr const char* paintbrush = "\xEF\x87\xBC"; + } + } + } +} \ No newline at end of file diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp new file mode 100644 index 0000000..fcafcf7 --- /dev/null +++ b/src/displayapp/screens/SystemInfo.cpp @@ -0,0 +1,116 @@ +#include +#include +#include +#include "SystemInfo.h" +#include "../../Version.h" +#include "Tile.h" + +using namespace Pinetime::Applications::Screens; + +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, { + [this]() -> std::unique_ptr { return CreateScreen1(); }, + [this]() -> std::unique_ptr { return CreateScreen2(); }, + [this]() -> std::unique_ptr { return CreateScreen3(); } + } + } {} + + +SystemInfo::~SystemInfo() { + lv_obj_clean(lv_scr_act()); +} + +bool SystemInfo::Refresh() { + screens.Refresh(); + return running; +} + +bool SystemInfo::OnButtonPushed() { + running = false; + return true; +} + +bool SystemInfo::OnTouchEvent(Pinetime::Applications::TouchEvents event) { + return screens.OnTouchEvent(event); +} + +std::unique_ptr SystemInfo::CreateScreen1() { + auto batteryPercentF = batteryController.PercentRemaining(); + uint16_t batteryPercent = 0; + if(batteryPercentF > 100.0f) batteryPercent = 100; + else if(batteryPercentF < 0.0f) batteryPercent = 0; + + uint8_t brightness = 0; + switch(brightnessController.Level()) { + case Controllers::BrightnessController::Levels::Off: brightness = 0; break; + case Controllers::BrightnessController::Levels::Low: brightness = 1; break; + case Controllers::BrightnessController::Levels::Medium: brightness = 2; break; + case Controllers::BrightnessController::Levels::High: brightness = 3; break; + } + 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 "?"; + } + }(); + + // uptime + 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); + uptimeSeconds = uptimeSeconds % secondsInADay; + uint32_t uptimeHours = uptimeSeconds / secondsInAnHour; + uptimeSeconds = uptimeSeconds % secondsInAnHour; + uint32_t uptimeMinutes = uptimeSeconds / secondsInAMinute; + uptimeSeconds = uptimeSeconds % secondsInAMinute; + // TODO handle more than 100 days of uptime + + sprintf(t1, "Pinetime\n" + "Version:%ld.%ld.%ld\n" + "Build: %s\n" + " %s\n" + "Date: %02d/%02d/%04d\n" + "Time: %02d:%02d:%02d\n" + "Uptime: %02lud %02lu:%02lu:%02lu\n" + "Battery: %d%%\n" + "Backlight: %d/3\n" + "Last reset: %s\n", + Version::Major(), Version::Minor(), Version::Patch(), + __DATE__, __TIME__, + dateTimeController.Day(), static_cast(dateTimeController.Month()), dateTimeController.Year(), + dateTimeController.Hours(), dateTimeController.Minutes(), dateTimeController.Seconds(), + uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds, + batteryPercent, brightness, resetReason); + + return std::unique_ptr(new Screens::Label(app, t1)); +} + +std::unique_ptr SystemInfo::CreateScreen2() { + auto& bleAddr = bleController.Address(); + sprintf(t2, "BLE MAC: \n %2x:%2x:%2x:%2x:%2x:%2x", + bleAddr[5], bleAddr[4], bleAddr[3], bleAddr[2], bleAddr[1], bleAddr[0]); + return std::unique_ptr(new Screens::Label(app, t2)); +} + +std::unique_ptr SystemInfo::CreateScreen3() { + strncpy(t3, "Hello from\nthe developper!", 27); + return std::unique_ptr(new Screens::Label(app, t3)); +} diff --git a/src/displayapp/screens/SystemInfo.h b/src/displayapp/screens/SystemInfo.h new file mode 100644 index 0000000..ac8abae --- /dev/null +++ b/src/displayapp/screens/SystemInfo.h @@ -0,0 +1,47 @@ +#pragma once + +#include +#include +#include "Screen.h" +#include "Label.h" +#include "ScreenList.h" +#include "Gauge.h" +#include "Meter.h" +#include + +namespace Pinetime { + namespace Applications { + 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; + + Pinetime::Controllers::DateTime& dateTimeController; + Pinetime::Controllers::Battery& batteryController; + Pinetime::Controllers::BrightnessController& brightnessController; + Pinetime::Controllers::Ble& bleController; + Pinetime::Drivers::WatchdogView& watchdog; + + char t1[200]; + char t2[200]; + char t3[30]; + + ScreenList<3> screens; + std::unique_ptr CreateScreen1(); + std::unique_ptr CreateScreen2(); + std::unique_ptr CreateScreen3(); + }; + } + } +} \ No newline at end of file diff --git a/src/displayapp/screens/Tab.cpp b/src/displayapp/screens/Tab.cpp new file mode 100644 index 0000000..adc3257 --- /dev/null +++ b/src/displayapp/screens/Tab.cpp @@ -0,0 +1,67 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include "Tab.h" +#include + + +using namespace Pinetime::Applications::Screens; + +extern lv_font_t jetbrains_mono_bold_20; + +//static void event_handler(lv_obj_t * obj, lv_event_t event) { +// Tile* screen = static_cast(obj->user_data); +// screen->OnObjectEvent(obj, event); +//} + +Tab::Tab(DisplayApp* app, Pinetime::Components::Gfx &gfx) : Screen(app, gfx) { +/*Create a Tab view object*/ + lv_obj_t *tabview; + tabview = lv_tabview_create(lv_scr_act(), NULL); + + /*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/ + lv_obj_t *tab1 = lv_tabview_add_tab(tabview, "Tab 1"); + lv_obj_t *tab2 = lv_tabview_add_tab(tabview, "Tab 2"); + lv_obj_t *tab3 = lv_tabview_add_tab(tabview, "Tab 3"); + + + /*Add content to the tabs*/ + lv_obj_t * label = lv_label_create(tab1, NULL); + lv_label_set_text(label, "This the first tab\n\n" + "If the content\n" + "of a tab\n" + "become too long\n" + "the it \n" + "automatically\n" + "become\n" + "scrollable."); + + label = lv_label_create(tab2, NULL); + lv_label_set_text(label, "Second tab"); + + label = lv_label_create(tab3, NULL); + lv_label_set_text(label, "Third tab"); + +} + +Tab::~Tab() { + lv_obj_clean(lv_scr_act()); +} + +void Tab::Refresh(bool fullRefresh) { + +} + +void Tab::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { + if(event == LV_EVENT_CLICKED) { + NRF_LOG_INFO("Clicked"); + } + else if(event == LV_EVENT_VALUE_CHANGED) { + NRF_LOG_INFO("Toggled"); + } +} diff --git a/src/displayapp/screens/Tab.h b/src/displayapp/screens/Tab.h new file mode 100644 index 0000000..e16dbb9 --- /dev/null +++ b/src/displayapp/screens/Tab.h @@ -0,0 +1,23 @@ +#pragma once + +#include +#include "Screen.h" +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + class Tab : public Screen { + public: + explicit Tab(DisplayApp* app, Components::Gfx& gfx); + ~Tab() override; + void Refresh(bool fullRefresh) override; + void OnObjectEvent(lv_obj_t* obj, lv_event_t event); + + private: + + }; + } + } +} diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp new file mode 100644 index 0000000..1447d78 --- /dev/null +++ b/src/displayapp/screens/Tile.cpp @@ -0,0 +1,61 @@ +#include +#include +#include +#include "Tile.h" +#include +#include "Symbols.h" +#include "../../Version.h" + +using namespace Pinetime::Applications::Screens; + +extern lv_font_t jetbrains_mono_bold_20; + +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(DisplayApp* app, std::array& applications) : Screen(app) { + for(int i = 0, appIndex = 0; i < 8; i++) { + if(i == 3) btnm_map1[i] = "\n"; + else if(i == 7) btnm_map1[i] = ""; + else { + btnm_map1[i] = applications[appIndex].icon; + apps[appIndex] = applications[appIndex].application; + appIndex++; + } + } + modal.reset(new Modal(app)); + + btnm1 = lv_btnm_create(lv_scr_act(), NULL); + lv_btnm_set_map(btnm1, btnm_map1); + lv_obj_set_size(btnm1, LV_HOR_RES, LV_VER_RES); + + btnm1->user_data = this; + lv_obj_set_event_cb(btnm1, event_handler); +} + +Tile::~Tile() { + lv_obj_clean(lv_scr_act()); +} + +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) { + app->StartApp(apps[buttonId]); + running = false; + } +} + +bool Tile::OnButtonPushed() { + app->StartApp(Apps::Clock); + running = false; + return true; +} + + diff --git a/src/displayapp/screens/Tile.h b/src/displayapp/screens/Tile.h new file mode 100644 index 0000000..3136d89 --- /dev/null +++ b/src/displayapp/screens/Tile.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include "Screen.h" +#include +#include "Modal.h" +#include +#include + +namespace Pinetime { + namespace Applications { + namespace Screens { + class Tile : public Screen { + public: + struct Applications { + const char* icon; + Pinetime::Applications::Apps application; + }; + + explicit Tile(DisplayApp* app, std::array& applications); + ~Tile() override; + + bool Refresh() override; + bool OnButtonPushed() override; + + void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId); + + private: + lv_obj_t * btnm1; + bool running = true; + + std::unique_ptr modal; + + const char* btnm_map1[8]; + Pinetime::Applications::Apps apps[6]; + }; + } + } +} diff --git a/src/libs/lvgl/src/lv_core/lv_obj.c b/src/libs/lvgl/src/lv_core/lv_obj.c index 510a870..511e72d 100644 --- a/src/libs/lvgl/src/lv_core/lv_obj.c +++ b/src/libs/lvgl/src/lv_core/lv_obj.c @@ -163,7 +163,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) LV_ASSERT_MEM(new_obj); if(new_obj == NULL) return NULL; - new_obj->par = NULL; /*Screens has no a parent*/ + new_obj->par = NULL; /*screens has no a parent*/ lv_ll_init(&(new_obj->child_ll), sizeof(lv_obj_t)); /*Set the callbacks*/ -- cgit v0.10.2 From 6c86d1d9d706706fcb6f214aba8259e61ed68755 Mon Sep 17 00:00:00 2001 From: Avamander Date: Fri, 2 Oct 2020 22:16:48 +0300 Subject: Fixed all the includes that were broken due to the renames diff --git a/README.md b/README.md index 3a1b7b5..a3a589f 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ As of now, here is the list of achievements of this project: ## Documentation ### Develop - - [Generate the fonts and symbols](src/DisplayApp/Fonts/Readme.md) + - [Generate the fonts and symbols](src/displayapp/fonts/Readme.md) ### Build, flash and debug - [Project branches](doc/branches.md) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9d03e90..2f38ec5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -292,33 +292,33 @@ set(LVGL_SRC ) list(APPEND IMAGE_FILES - displayapp/Icons/battery/os_battery_error.c - displayapp/Icons/battery/os_battery_100.c - displayapp/Icons/battery/os_battery_090.c - displayapp/Icons/battery/os_battery_080.c - displayapp/Icons/battery/os_battery_070.c - displayapp/Icons/battery/os_battery_060.c - displayapp/Icons/battery/os_battery_050.c - displayapp/Icons/battery/os_battery_040.c - displayapp/Icons/battery/os_battery_030.c - displayapp/Icons/battery/os_battery_020.c - displayapp/Icons/battery/os_battery_010.c - displayapp/Icons/battery/os_battery_005.c - - displayapp/Icons/battery/os_batterycharging_100.c - displayapp/Icons/battery/os_batterycharging_090.c - displayapp/Icons/battery/os_batterycharging_080.c - displayapp/Icons/battery/os_batterycharging_070.c - displayapp/Icons/battery/os_batterycharging_060.c - displayapp/Icons/battery/os_batterycharging_050.c - displayapp/Icons/battery/os_batterycharging_040.c - displayapp/Icons/battery/os_batterycharging_030.c - displayapp/Icons/battery/os_batterycharging_020.c - displayapp/Icons/battery/os_batterycharging_010.c - displayapp/Icons/battery/os_batterycharging_005.c - - displayapp/Icons/bluetooth/os_bt_connected.c - displayapp/Icons/bluetooth/os_bt_disconnected.c + displayapp/icons/battery/os_battery_error.c + displayapp/icons/battery/os_battery_100.c + displayapp/icons/battery/os_battery_090.c + displayapp/icons/battery/os_battery_080.c + displayapp/icons/battery/os_battery_070.c + displayapp/icons/battery/os_battery_060.c + displayapp/icons/battery/os_battery_050.c + displayapp/icons/battery/os_battery_040.c + displayapp/icons/battery/os_battery_030.c + displayapp/icons/battery/os_battery_020.c + displayapp/icons/battery/os_battery_010.c + displayapp/icons/battery/os_battery_005.c + + displayapp/icons/battery/os_batterycharging_100.c + displayapp/icons/battery/os_batterycharging_090.c + displayapp/icons/battery/os_batterycharging_080.c + displayapp/icons/battery/os_batterycharging_070.c + displayapp/icons/battery/os_batterycharging_060.c + displayapp/icons/battery/os_batterycharging_050.c + displayapp/icons/battery/os_batterycharging_040.c + displayapp/icons/battery/os_batterycharging_030.c + displayapp/icons/battery/os_batterycharging_020.c + displayapp/icons/battery/os_batterycharging_010.c + displayapp/icons/battery/os_batterycharging_005.c + + displayapp/icons/bluetooth/os_bt_connected.c + displayapp/icons/bluetooth/os_bt_disconnected.c ) list(APPEND SOURCE_FILES @@ -349,30 +349,30 @@ list(APPEND SOURCE_FILES drivers/Watchdog.cpp drivers/DebugPins.cpp drivers/InternalFlash.cpp - components/Battery/BatteryController.cpp - components/Ble/BleController.cpp - components/Ble/NotificationManager.cpp - components/DateTime/DateTimeController.cpp - components/Brightness/BrightnessController.cpp - components/Ble/NimbleController.cpp - components/Ble/DeviceInformationService.cpp - components/Ble/CurrentTimeClient.cpp - components/Ble/AlertNotificationClient.cpp - components/Ble/DfuService.cpp - components/Ble/CurrentTimeService.cpp - components/Ble/AlertNotificationService.cpp - components/Ble/MusicService.cpp - components/Ble/BatteryInformationService.cpp - components/Ble/ImmediateAlertService.cpp - components/FirmwareValidator/FirmwareValidator.cpp + components/battery/BatteryController.cpp + components/ble/BleController.cpp + components/ble/NotificationManager.cpp + components/datetime/DateTimeController.cpp + components/brightness/BrightnessController.cpp + components/ble/NimbleController.cpp + components/ble/DeviceInformationService.cpp + components/ble/CurrentTimeClient.cpp + components/ble/AlertNotificationClient.cpp + components/ble/DfuService.cpp + components/ble/CurrentTimeService.cpp + components/ble/AlertNotificationService.cpp + components/ble/MusicService.cpp + components/ble/BatteryInformationService.cpp + components/ble/ImmediateAlertService.cpp + components/firmwarevalidator/FirmwareValidator.cpp drivers/Cst816s.cpp FreeRTOS/port.c FreeRTOS/port_cmsis_systick.c FreeRTOS/port_cmsis.c displayapp/LittleVgl.cpp - displayapp/Fonts/jetbrains_mono_extrabold_compressed.c - displayapp/Fonts/jetbrains_mono_bold_20.c + displayapp/fonts/jetbrains_mono_extrabold_compressed.c + displayapp/fonts/jetbrains_mono_bold_20.c systemtask/SystemTask.cpp drivers/TwiMaster.cpp @@ -389,9 +389,9 @@ list(APPEND GRAPHICS_SOURCE_FILES drivers/Spi.cpp logging/NrfLogger.cpp - components/Gfx/Gfx.cpp + components/gfx/Gfx.cpp drivers/St7789.cpp - components/Brightness/BrightnessController.cpp + components/brightness/BrightnessController.cpp graphics.cpp ) @@ -426,19 +426,19 @@ set(INCLUDE_FILES drivers/Watchdog.h drivers/DebugPins.h drivers/InternalFlash.h - components/Battery/BatteryController.h - components/Ble/BleController.h - components/Ble/NotificationManager.h - components/DateTime/DateTimeController.h - components/Brightness/BrightnessController.h - components/Ble/NimbleController.h - components/Ble/DeviceInformationService.h - components/Ble/CurrentTimeClient.h - components/Ble/AlertNotificationClient.h - components/Ble/DfuService.h - components/FirmwareValidator/FirmwareValidator.h - components/Ble/BatteryInformationService.h - components/Ble/ImmediateAlertService.h + components/battery/BatteryController.h + components/ble/BleController.h + components/ble/NotificationManager.h + components/datetime/DateTimeController.h + components/brightness/BrightnessController.h + components/ble/NimbleController.h + components/ble/DeviceInformationService.h + components/ble/CurrentTimeClient.h + components/ble/AlertNotificationClient.h + components/ble/DfuService.h + components/firmwarevalidator/FirmwareValidator.h + components/ble/BatteryInformationService.h + components/ble/ImmediateAlertService.h drivers/Cst816s.h FreeRTOS/portmacro.h FreeRTOS/portmacro_cmsis.h diff --git a/src/components/Battery/BatteryController.cpp b/src/components/Battery/BatteryController.cpp deleted file mode 100644 index 571efae..0000000 --- a/src/components/Battery/BatteryController.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include -#include -#include "BatteryController.h" - -using namespace Pinetime::Controllers; - -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); - - nrfx_saadc_config_t adcConfig = NRFX_SAADC_DEFAULT_CONFIG; - nrfx_saadc_init(&adcConfig, SaadcEventHandler); - 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_DISABLED, - .pin_p = batteryVoltageAdcInput, - .pin_n = NRF_SAADC_INPUT_DISABLED - }; - nrfx_saadc_channel_init(0, &adcChannelConfig); -} - -void Battery::Update() { - isCharging = !nrf_gpio_pin_read(chargingPin); - isPowerPresent = !nrf_gpio_pin_read(powerPresentPin); - - nrf_saadc_value_t value = 0; - nrfx_saadc_sample_convert(0, &value); - - // see https://forum.pine64.org/showthread.php?tid=8147 - voltage = (value * 2.0f) / (1024/3.0f); - percentRemaining = ((voltage - 3.55f)*100.0f)*3.9f; - percentRemaining = std::max(percentRemaining, 0.0f); - percentRemaining = std::min(percentRemaining, 100.0f); - -// NRF_LOG_INFO("BATTERY " NRF_LOG_FLOAT_MARKER " %% - " NRF_LOG_FLOAT_MARKER " v", NRF_LOG_FLOAT(percentRemaining), NRF_LOG_FLOAT(voltage)); -// NRF_LOG_INFO("POWER Charging : %d - Power : %d", isCharging, isPowerPresent); -} - -void Battery::SaadcEventHandler(nrfx_saadc_evt_t const * event) { - -} \ No newline at end of file diff --git a/src/components/Battery/BatteryController.h b/src/components/Battery/BatteryController.h deleted file mode 100644 index f07648a..0000000 --- a/src/components/Battery/BatteryController.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once -#include - - -namespace Pinetime { - namespace Controllers { - class Battery { - public: - void Init(); - void Update(); - float PercentRemaining() const { return percentRemaining; } - float Voltage() const { return voltage; } - bool IsCharging() const { return isCharging; } - bool IsPowerPresent() const { return isPowerPresent; } - - private: - static constexpr uint32_t chargingPin = 12; - static constexpr uint32_t powerPresentPin = 19; - static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7; - static void SaadcEventHandler(nrfx_saadc_evt_t const * p_event); - float percentRemaining = 0.0f; - float voltage = 0.0f; - bool isCharging = false; - bool isPowerPresent = false; - }; - } -} \ No newline at end of file diff --git a/src/components/Ble/AlertNotificationClient.cpp b/src/components/Ble/AlertNotificationClient.cpp deleted file mode 100644 index 3e4b495..0000000 --- a/src/components/Ble/AlertNotificationClient.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include -#include "NotificationManager.h" - -#include "AlertNotificationClient.h" - - -using namespace Pinetime::Controllers; -constexpr ble_uuid16_t AlertNotificationClient::ansServiceUuid; - -constexpr ble_uuid16_t AlertNotificationClient::supportedNewAlertCategoryUuid; -constexpr ble_uuid16_t AlertNotificationClient::supportedUnreadAlertCategoryUuid ; -constexpr ble_uuid16_t AlertNotificationClient::newAlertUuid; -constexpr ble_uuid16_t AlertNotificationClient::unreadAlertStatusUuid; -constexpr ble_uuid16_t AlertNotificationClient::controlPointUuid; - -int Pinetime::Controllers::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& notificationManager) : - systemTask{systemTask}, notificationManager{notificationManager}{ - -} - -bool AlertNotificationClient::OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, const ble_gatt_svc *service) { - if(service == nullptr && error->status == BLE_HS_EDONE) { - NRF_LOG_INFO("ANS Discovery complete"); - return true; - } - - if(service != nullptr && ble_uuid_cmp(((ble_uuid_t*)&ansServiceUuid), &service->uuid.u) == 0) { - NRF_LOG_INFO("ANS discovered : 0x%x", service->start_handle); - ansStartHandle = service->start_handle; - ansEndHandle = service->end_handle; - isDiscovered = true; - } - return false; -} - -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"); - return 0; - } - - if(characteristic == nullptr && error->status == BLE_HS_EDONE) { - NRF_LOG_INFO("ANS Characteristic discovery complete"); - } else { - 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) { - 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) { - NRF_LOG_INFO("ANS Characteristic discovered : newAlertUuid"); - newAlertHandle = characteristic->val_handle; - newAlertDefHandle = characteristic->def_handle; - } 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) { - NRF_LOG_INFO("ANS Characteristic discovered : controlPointUuid"); - controlPointHandle = 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) { - if(error->status == 0) { - NRF_LOG_INFO("ANS New alert subscribe OK"); - } else { - NRF_LOG_INFO("ANS New alert subscribe ERROR"); - } - - return 0; -} - -int AlertNotificationClient::OnDescriptorDiscoveryEventCallback(uint16_t connectionHandle, const ble_gatt_error *error, - uint16_t characteristicValueHandle, - const ble_gatt_dsc *descriptor) { - if(error->status == 0) { - 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; - uint8_t value[2]; - value[0] = 1; - value[1] = 0; - ble_gattc_write_flat(connectionHandle, newAlertDescriptorHandle, value, sizeof(value), NewAlertSubcribeCallback, this); - } - } - } - return 0; -} - -void AlertNotificationClient::OnNotification(ble_gap_event *event) { - if(event->notify_rx.attr_handle == newAlertHandle) { - // TODO implement this with more memory safety (and constexpr) - static const size_t maxBufferSize{21}; - static const size_t maxMessageSize{18}; - size_t bufferSize = min(OS_MBUF_PKTLEN(event->notify_rx.om), maxBufferSize); - - uint8_t data[bufferSize]; - os_mbuf_copydata(event->notify_rx.om, 0, bufferSize, data); - - char *s = (char *) &data[3]; - auto messageSize = min(maxMessageSize, (bufferSize-3)); - - for (uint i = 0; i < messageSize-1; i++) { - if (s[i] == 0x00) { - s[i] = 0x0A; - } - } - s[messageSize-1] = '\0'; - - notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, s, messageSize); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); - } -} - -bool AlertNotificationClient::IsDiscovered() const { - return isDiscovered; -} - -uint16_t AlertNotificationClient::StartHandle() const { - return ansStartHandle; -} - -uint16_t AlertNotificationClient::EndHandle() const { - return ansEndHandle; -} - -uint16_t AlertNotificationClient::NewAlerthandle() const { - return newAlertHandle; -} diff --git a/src/components/Ble/AlertNotificationClient.h b/src/components/Ble/AlertNotificationClient.h deleted file mode 100644 index ca4f4e9..0000000 --- a/src/components/Ble/AlertNotificationClient.h +++ /dev/null @@ -1,81 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace Pinetime { - namespace Controllers { - int NewAlertSubcribeCallback(uint16_t conn_handle, - const struct ble_gatt_error *error, - struct ble_gatt_attr *attr, - void *arg); - - class AlertNotificationClient { - public: - explicit AlertNotificationClient(Pinetime::System::SystemTask &systemTask, - Pinetime::Controllers::NotificationManager ¬ificationManager); - - 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); - bool IsDiscovered() const; - uint16_t StartHandle() const; - uint16_t EndHandle() const; - - static constexpr const ble_uuid16_t &Uuid() { return ansServiceUuid; } - - uint16_t NewAlerthandle() const; - 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 - }; - - uint16_t ansStartHandle; - uint16_t ansEndHandle; - uint16_t supportedNewAlertCategoryHandle; - uint16_t supportedUnreadAlertCategoryHandle; - uint16_t newAlertHandle; - uint16_t newAlertDescriptorHandle = 0; - uint16_t newAlertDefHandle; - uint16_t unreadAlertStatusHandle; - uint16_t controlPointHandle; - bool isDiscovered = false; - Pinetime::System::SystemTask &systemTask; - Pinetime::Controllers::NotificationManager ¬ificationManager; - }; - } -} \ No newline at end of file diff --git a/src/components/Ble/AlertNotificationService.cpp b/src/components/Ble/AlertNotificationService.cpp deleted file mode 100644 index ce2f7dd..0000000 --- a/src/components/Ble/AlertNotificationService.cpp +++ /dev/null @@ -1,80 +0,0 @@ - -#include -#include "NotificationManager.h" -#include - -#include "AlertNotificationService.h" -#include - -using namespace Pinetime::Controllers; - -constexpr ble_uuid16_t AlertNotificationService::ansUuid; -constexpr ble_uuid16_t AlertNotificationService::ansCharUuid; - - -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); -} - -void AlertNotificationService::Init() { - int res; - res = ble_gatts_count_cfg(serviceDefinition); - ASSERT(res == 0); - - res = ble_gatts_add_svcs(serviceDefinition); - 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 - }, - { - 0 - } - }, - serviceDefinition{ - { - /* Device Information Service */ - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &ansUuid, - .characteristics = characteristicDefinition - }, - { - 0 - }, - }, m_systemTask{systemTask}, m_notificationManager{notificationManager} { -} - -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) { - // TODO implement this with more memory safety (and constexpr) - static const size_t maxBufferSize{21}; - static const size_t maxMessageSize{18}; - size_t bufferSize = min(OS_MBUF_PKTLEN(ctxt->om), maxBufferSize); - - uint8_t data[bufferSize]; - os_mbuf_copydata(ctxt->om, 0, bufferSize, data); - - char *s = (char *) &data[3]; - auto messageSize = min(maxMessageSize, (bufferSize-3)); - - for (uint i = 0; i < messageSize-1; i++) { - if (s[i] == 0x00) { - s[i] = 0x0A; - } - } - s[messageSize-1] = '\0'; - - m_notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, s, messageSize); - m_systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); - } - return 0; -} diff --git a/src/components/Ble/AlertNotificationService.h b/src/components/Ble/AlertNotificationService.h deleted file mode 100644 index 53cb44c..0000000 --- a/src/components/Ble/AlertNotificationService.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once -#include -#include -#include - -namespace Pinetime { - namespace Controllers { - class AlertNotificationService { - public: - AlertNotificationService(Pinetime::System::SystemTask &systemTask, - Pinetime::Controllers::NotificationManager ¬ificationManager); - void Init(); - - int OnAlert(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt); - - - private: - 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 ansCharUuid { - .u { .type = BLE_UUID_TYPE_16 }, - .value = ansCharId - }; - - struct ble_gatt_chr_def characteristicDefinition[2]; - struct ble_gatt_svc_def serviceDefinition[2]; - - Pinetime::System::SystemTask &m_systemTask; - NotificationManager &m_notificationManager; - }; - } -} diff --git a/src/components/Ble/BatteryInformationService.cpp b/src/components/Ble/BatteryInformationService.cpp deleted file mode 100644 index c86830b..0000000 --- a/src/components/Ble/BatteryInformationService.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "BatteryInformationService.h" -#include "../Battery/BatteryController.h" - -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) { - 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 - }, - }{ - -} - -void BatteryInformationService::Init() { - int res = 0; - res = ble_gatts_count_cfg(serviceDefinition); - ASSERT(res == 0); - - res = ble_gatts_add_svcs(serviceDefinition); - ASSERT(res == 0); -} - -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); - return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; - } - return 0; -} \ No newline at end of file diff --git a/src/components/Ble/BatteryInformationService.h b/src/components/Ble/BatteryInformationService.h deleted file mode 100644 index 74b2222..0000000 --- a/src/components/Ble/BatteryInformationService.h +++ /dev/null @@ -1,40 +0,0 @@ -#pragma once -#include - -namespace Pinetime { - namespace System { - class SystemTask; - } - namespace Controllers { - class Battery; - class BatteryInformationService { - public: - BatteryInformationService(Controllers::Battery& batteryController); - void Init(); - - 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}; - - 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 - }; - - struct ble_gatt_chr_def characteristicDefinition[3]; - struct ble_gatt_svc_def serviceDefinition[2]; - - uint16_t batteryLevelHandle; - - }; - } -} diff --git a/src/components/Ble/BleController.cpp b/src/components/Ble/BleController.cpp deleted file mode 100644 index 2b396e1..0000000 --- a/src/components/Ble/BleController.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include -#include "BleController.h" - -using namespace Pinetime::Controllers; - -void Ble::Connect() { - isConnected = true; -} - -void Ble::Disconnect() { - isConnected = false; -} - -void Ble::StartFirmwareUpdate() { - isFirmwareUpdating = true; -} - -void Ble::StopFirmwareUpdate() { - isFirmwareUpdating = false; -} - -void Ble::FirmwareUpdateTotalBytes(uint32_t totalBytes) { - firmwareUpdateTotalBytes = totalBytes; -} - -void Ble::FirmwareUpdateCurrentBytes(uint32_t currentBytes) { - firmwareUpdateCurrentBytes = currentBytes; -} - - diff --git a/src/components/Ble/BleController.h b/src/components/Ble/BleController.h deleted file mode 100644 index 3f52ea2..0000000 --- a/src/components/Ble/BleController.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace Pinetime { - namespace Controllers { - class Ble { - 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(); - - 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; } - - 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 deleted file mode 100644 index 7a225f4..0000000 --- a/src/components/Ble/CurrentTimeClient.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include -#include "CurrentTimeClient.h" - -using namespace Pinetime::Controllers; - -constexpr ble_uuid16_t CurrentTimeClient::ctsServiceUuid; -constexpr ble_uuid16_t CurrentTimeClient::currentTimeCharacteristicUuid; - -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) { - if(service == nullptr && error->status == BLE_HS_EDONE) { - NRF_LOG_INFO("CTS Discovery complete"); - return true; - } - - if(service != nullptr && ble_uuid_cmp(((ble_uuid_t*)&ctsServiceUuid), &service->uuid.u) == 0) { - NRF_LOG_INFO("CTS discovered : 0x%x", service->start_handle); - isDiscovered = true; - ctsStartHandle = service->start_handle; - ctsEndHandle = service->end_handle; - return false; - } - return false; -} - -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) { - NRF_LOG_INFO("CTS Characteristic discovery complete"); - return 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); - currentTimeHandle = characteristic->val_handle; - } - return 0; -} - -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)); - } else { - NRF_LOG_INFO("Error retrieving current time: %d", error->status); - } - return 0; -} - -bool CurrentTimeClient::IsDiscovered() const { - return isDiscovered; -} - -uint16_t CurrentTimeClient::StartHandle() const { - return ctsStartHandle; -} - -uint16_t CurrentTimeClient::EndHandle() const { - return ctsEndHandle; -} - -uint16_t CurrentTimeClient::CurrentTimeHandle() const { - return currentTimeHandle; -} \ No newline at end of file diff --git a/src/components/Ble/CurrentTimeClient.h b/src/components/Ble/CurrentTimeClient.h deleted file mode 100644 index fabcdac..0000000 --- a/src/components/Ble/CurrentTimeClient.h +++ /dev/null @@ -1,55 +0,0 @@ -#pragma once -#include -#include -#include -#include - -namespace Pinetime { - namespace Controllers { - - class CurrentTimeClient { - public: - explicit CurrentTimeClient(DateTime& dateTimeController); - void Init(); - 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); - bool IsDiscovered() const; - uint16_t StartHandle() const; - uint16_t EndHandle() const; - uint16_t CurrentTimeHandle() const; - static constexpr const ble_uuid16_t* Uuid() { return &CurrentTimeClient::ctsServiceUuid; } - static constexpr const ble_uuid16_t* CurrentTimeCharacteristicUuid() { return &CurrentTimeClient::currentTimeCharacteristicUuid; } - 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 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 - }; - - uint16_t currentTimeHandle; - DateTime& dateTimeController; - bool isDiscovered = false; - uint16_t ctsStartHandle; - uint16_t ctsEndHandle; - }; - } -} \ No newline at end of file diff --git a/src/components/Ble/CurrentTimeService.cpp b/src/components/Ble/CurrentTimeService.cpp deleted file mode 100644 index 3a6264e..0000000 --- a/src/components/Ble/CurrentTimeService.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#include "CurrentTimeService.h" -#include - -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) { - auto cts = static_cast(arg); - return cts->OnTimeAccessed(conn_handle, attr_handle, ctxt); -} - -void CurrentTimeService::Init() { - int res; - res = ble_gatts_count_cfg(serviceDefinition); - ASSERT(res == 0); - - res = ble_gatts_add_svcs(serviceDefinition); - ASSERT(res == 0); -} - - -int CurrentTimeService::OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt) { - - 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); - - 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; - currentDateTime.year = m_dateTimeController.Year(); - currentDateTime.month = static_cast(m_dateTimeController.Month()); - currentDateTime.dayofmonth = m_dateTimeController.Day(); - currentDateTime.hour = m_dateTimeController.Hours(); - currentDateTime.minute = m_dateTimeController.Minutes(); - 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} { - -} - diff --git a/src/components/Ble/CurrentTimeService.h b/src/components/Ble/CurrentTimeService.h deleted file mode 100644 index 58bc5ba..0000000 --- a/src/components/Ble/CurrentTimeService.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once -#include -#include -#include -#include - -namespace Pinetime { - namespace Controllers { - class CurrentTimeService { - public: - CurrentTimeService(DateTime &dateTimeController); - void Init(); - - 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}; - - 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 - }; - - 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; - - DateTime &m_dateTimeController; - }; - } -} diff --git a/src/components/Ble/DeviceInformationService.cpp b/src/components/Ble/DeviceInformationService.cpp deleted file mode 100644 index 406db1c..0000000 --- a/src/components/Ble/DeviceInformationService.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include "DeviceInformationService.h" - -using namespace Pinetime::Controllers; - -constexpr ble_uuid16_t DeviceInformationService::manufacturerNameUuid; -constexpr ble_uuid16_t DeviceInformationService::modelNumberUuid; -constexpr ble_uuid16_t DeviceInformationService::serialNumberUuid; -constexpr ble_uuid16_t DeviceInformationService::fwRevisionUuid; -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) { - auto deviceInformationService = static_cast(arg); - return deviceInformationService->OnDeviceInfoRequested(conn_handle, attr_handle, ctxt); -} - -void DeviceInformationService::Init() { - int res = 0; - res = ble_gatts_count_cfg(serviceDefinition); - ASSERT(res == 0); - - res = ble_gatts_add_svcs(serviceDefinition); - ASSERT(res == 0); -} - - -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: - str = manufacturerName; - break; - case modelNumberId: - str = modelNumber; - break; - case serialNumberId: - str = serialNumber; - break; - case fwRevisionId: - str = fwRevision; - break; - case hwRevisionId: - str = hwRevision; - break; - case swRevisionId: - str = swRevision; - break; - default: - return BLE_ATT_ERR_UNLIKELY; - } - - int res = os_mbuf_append(ctxt->om, str, strlen(str)); - 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 - }, - } - { - -} - diff --git a/src/components/Ble/DeviceInformationService.h b/src/components/Ble/DeviceInformationService.h deleted file mode 100644 index 25ab840..0000000 --- a/src/components/Ble/DeviceInformationService.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once -#include -#include - -#include -#include - -namespace Pinetime { - namespace Controllers { - class DeviceInformationService { - public: - DeviceInformationService(); - void Init(); - - 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}; - - 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 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 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 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 deleted file mode 100644 index fcbefdd..0000000 --- a/src/components/Ble/DfuService.cpp +++ /dev/null @@ -1,440 +0,0 @@ -#include -#include -#include -#include "DfuService.h" - -using namespace Pinetime::Controllers; - -constexpr ble_uuid128_t DfuService::serviceUuid; -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); - return dfuService->OnServiceData(conn_handle, attr_handle, ctxt); -} - -void NotificationTimerCallback(TimerHandle_t xTimer) { - auto notificationManager = static_cast(pvTimerGetTimerID(xTimer)); - notificationManager->OnNotificationTimer(); -} - -void TimeoutTimerCallback(TimerHandle_t 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, - - }, - { - 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); -} - -void DfuService::Init() { - int res; - res = ble_gatts_count_cfg(serviceDefinition); - ASSERT(res == 0); - - res = ble_gatts_add_svcs(serviceDefinition); - ASSERT(res == 0); -} - -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); - - if (attributeHandle == packetCharacteristicHandle) { - if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) - return WritePacketHandler(connectionHandle, context->om); - 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 if (attributeHandle == revisionCharacteristicHandle) { - if (context->op == BLE_GATT_ACCESS_OP_READ_CHR) - return SendDfuRevision(context->om); - else return 0; - } else { - NRF_LOG_INFO("[DFU] Unknown Characteristic : %d", attributeHandle); - return 0; - } -} - -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) { - 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); - - dfuImage.Erase(); - - uint8_t data[]{16, 1, 1}; - notificationManager.Send(connectionHandle, controlPointCharacteristicHandle, data, 3); - state = States::Init; - } - return 0; - 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); - 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); - - 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); - - return 0; - } - - case States::Data: { - nbPacketReceived++; - dfuImage.Append(om->om_data, om->om_len); - bytesReceived += om->om_len; - 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)}; - 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)}; - NRF_LOG_INFO("[DFU] -> Send packet notification : all bytes received!"); - notificationManager.Send(connectionHandle, controlPointCharacteristicHandle, data, 3); - state = States::Validate; - } - } - return 0; - default: - // Invalid state - return 0; - } - return 0; -} - -int DfuService::ControlPointHandler(uint16_t connectionHandle, os_mbuf *om) { - auto opcode = static_cast(om->om_data[0]); - NRF_LOG_INFO("[DFU] -> ControlPointHandler"); - - switch (opcode) { - case Opcodes::StartDFU: { - if (state != States::Idle && state != States::Start) { - NRF_LOG_INFO("[DFU] -> Start DFU requested, but we are not in Idle state"); - return 0; - } - if (state == States::Start) { - NRF_LOG_INFO("[DFU] -> Start DFU requested, but we are already in Start state"); - return 0; - } - auto imageType = static_cast(om->om_data[1]); - if (imageType == ImageTypes::Application) { - NRF_LOG_INFO("[DFU] -> Start DFU, mode = Application"); - state = States::Start; - bleController.StartFirmwareUpdate(); - bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Running); - bleController.FirmwareUpdateTotalBytes(0xffffffffu); - bleController.FirmwareUpdateCurrentBytes(0); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleFirmwareUpdateStarted); - return 0; - } else { - NRF_LOG_INFO("[DFU] -> Start DFU, mode %d not supported!", imageType); - return 0; - } - } - break; - case Opcodes::InitDFUParameters: { - if (state != States::Init) { - NRF_LOG_INFO("[DFU] -> Init DFU requested, but we are not in Init state"); - return 0; - } - bool isInitComplete = (om->om_data[1] != 0); - 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}) - }; - notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3); - return 0; - } - } - return 0; - case Opcodes::PacketReceiptNotificationRequest: - nbPacketsToNotify = om->om_data[1]; - NRF_LOG_INFO("[DFU] -> Receive Packet Notification Request, nb packet = %d", nbPacketsToNotify); - return 0; - case Opcodes::ReceiveFirmwareImage: - if (state != States::Init) { - NRF_LOG_INFO("[DFU] -> Receive firmware image requested, but we are not in Start Init"); - return 0; - } - // TODO the chunk size is dependant of the implementation of the host application... - dfuImage.Init(20, applicationSize, expectedCrc); - NRF_LOG_INFO("[DFU] -> Starting receive firmware"); - state = States::Data; - return 0; - case Opcodes::ValidateFirmware: { - if (state != States::Validate) { - NRF_LOG_INFO("[DFU] -> Validate firmware image requested, but we are not in Data state %d", state); - return 0; - } - - NRF_LOG_INFO("[DFU] -> Validate firmware image requested -- %d", connectionHandle); - - 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) - }; - 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) - }; - notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3); - } - - return 0; - } - case Opcodes::ActivateImageAndReset: - if (state != States::Validated) { - NRF_LOG_INFO("[DFU] -> Activate image and reset requested, but we are not in Validated state"); - return 0; - } - NRF_LOG_INFO("[DFU] -> Activate image and reset!"); - bleController.StopFirmwareUpdate(); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleFirmwareUpdateFinished); - Reset(); - bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated); - return 0; - default: - return 0; - } -} - -void DfuService::OnTimeout() { - Reset(); -} - -void DfuService::Reset() { - state = States::Idle; - nbPacketsToNotify = 0; - nbPacketReceived = 0; - bytesReceived = 0; - softdeviceSize = 0; - bootloaderSize = 0; - applicationSize = 0; - expectedCrc = 0; - notificationManager.Reset(); - bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Error); - bleController.StopFirmwareUpdate(); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleFirmwareUpdateFinished); -} - -DfuService::NotificationManager::NotificationManager() { - 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) - return false; - - connectionHandle = connection; - characteristicHandle = charactHandle; - size = s; - std::memcpy(buffer, data, size); - xTimerStart(timer, 0); - return true; -} - -void DfuService::NotificationManager::OnNotificationTimer() { - 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); - auto ret = ble_gattc_notify_custom(connection, charactHandle, om); - ASSERT(ret == 0); -} - -void DfuService::NotificationManager::Reset() { - connectionHandle = 0; - characteristicHandle = 0; - size = 0; - xTimerStop(timer, 0); -} - -void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc) { - 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; - ASSERT(size <= 20); - - std::memcpy(tempBuffer + bufferWriteIndex, data, size); - bufferWriteIndex += size; - - if(bufferWriteIndex == bufferSize) { - spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); - totalWriteIndex += bufferWriteIndex; - bufferWriteIndex = 0; - } - - if(bufferWriteIndex > 0 && totalWriteIndex + bufferWriteIndex == totalSize) { - spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); - totalWriteIndex += bufferWriteIndex; - if (totalSize < maxSize) - WriteMagicNumber(); - } -} - -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 offset = writeOffset + (maxSize - (4 * sizeof(uint32_t))); - spiNorFlash.Write(offset, reinterpret_cast(magic), 4 * sizeof(uint32_t)); -} - -void DfuService::DfuImage::Erase() { - for (size_t erased = 0; erased < maxSize; erased += 0x1000) { - spiNorFlash.SectorErase(writeOffset + erased); - } -} - -bool DfuService::DfuImage::Validate() { - uint32_t chunkSize = 200; - size_t currentOffset = 0; - uint16_t crc = 0; - - bool first = true; - while (currentOffset < totalSize) { - uint32_t readSize = (totalSize - currentOffset) > chunkSize ? chunkSize : (totalSize - currentOffset); - - spiNorFlash.Read(writeOffset + currentOffset, tempBuffer, readSize); - if (first) { - crc = ComputeCrc(tempBuffer, readSize, NULL); - first = false; - } else - crc = ComputeCrc(tempBuffer, readSize, &crc); - currentOffset += readSize; - } - - return (crc == expectedCrc); -} - -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++) { - crc = (uint8_t) (crc >> 8) | (crc << 8); - crc ^= p_data[i]; - crc ^= (uint8_t) (crc & 0xFF) >> 4; - crc ^= (crc << 8) << 4; - crc ^= ((crc & 0xFF) << 4) << 1; - } - - return crc; -} - -bool DfuService::DfuImage::IsComplete() { - if(!ready) return false; - return totalWriteIndex == totalSize; -} diff --git a/src/components/Ble/DfuService.h b/src/components/Ble/DfuService.h deleted file mode 100644 index d7ba460..0000000 --- a/src/components/Ble/DfuService.h +++ /dev/null @@ -1,161 +0,0 @@ -#pragma once - -#include -#include - -#include - -namespace Pinetime { - namespace System { - class SystemTask; - } - namespace Drivers { - class SpiNorFlash; - } - namespace Controllers { - 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: - 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); - - }; - - 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/ImmediateAlertService.cpp b/src/components/Ble/ImmediateAlertService.cpp deleted file mode 100644 index d2c4cff..0000000 --- a/src/components/Ble/ImmediateAlertService.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include "ImmediateAlertService.h" -#include -#include "AlertNotificationService.h" - -using namespace Pinetime::Controllers; - -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); - 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 ""; - } - } -} - -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 - }, - }{ - -} - -void ImmediateAlertService::Init() { - int res = 0; - res = ble_gatts_count_cfg(serviceDefinition); - ASSERT(res == 0); - - res = ble_gatts_add_svcs(serviceDefinition); - 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) { - auto alertLevel = static_cast(context->om->om_data[0]); - auto* alertString = ToString(alertLevel); - notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, alertString, strlen(alertString)); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); - } - } - - return 0; -} \ No newline at end of file diff --git a/src/components/Ble/ImmediateAlertService.h b/src/components/Ble/ImmediateAlertService.h deleted file mode 100644 index c42846c..0000000 --- a/src/components/Ble/ImmediateAlertService.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once -#include - -namespace Pinetime { - namespace System { - class SystemTask; - } - namespace Controllers { - class NotificationManager; - class ImmediateAlertService { - 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); - - private: - Pinetime::System::SystemTask& systemTask; - NotificationManager& notificationManager; - - 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 alertLevelUuid { - .u {.type = BLE_UUID_TYPE_16}, - .value = alertLevelId - }; - - struct ble_gatt_chr_def characteristicDefinition[3]; - struct ble_gatt_svc_def serviceDefinition[2]; - - uint16_t alertLevelHandle; - }; - } -} diff --git a/src/components/Ble/MusicService.cpp b/src/components/Ble/MusicService.cpp deleted file mode 100644 index b5fa535..0000000 --- a/src/components/Ble/MusicService.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include -#include "MusicService.h" - -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) -{ - msUuid.value[11] = msId[0]; - msUuid.value[12] = msId[1]; - msEventCharUuid.value[11] = msEventCharId[0]; - msEventCharUuid.value[12] = msEventCharId[1]; - msStatusCharUuid.value[11] = msStatusCharId[0]; - msStatusCharUuid.value[12] = msStatusCharId[1]; - msTrackCharUuid.value[11] = msTrackCharId[0]; - msTrackCharUuid.value[12] = msTrackCharId[1]; - msArtistCharUuid.value[11] = msArtistCharId[0]; - msArtistCharUuid.value[12] = msArtistCharId[1]; - msAlbumCharUuid.value[11] = msAlbumCharId[0]; - msAlbumCharUuid.value[12] = msAlbumCharId[1]; - - characteristicDefinition[0] = { .uuid = (ble_uuid_t*)(&msEventCharUuid), - .access_cb = MSCallback, - .arg = this, - .flags = BLE_GATT_CHR_F_NOTIFY, - .val_handle = &m_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] = {0}; - - serviceDefinition[0] = { - .type = BLE_GATT_SVC_TYPE_PRIMARY, - .uuid = (ble_uuid_t *) &msUuid, - .characteristics = characteristicDefinition - }; - serviceDefinition[1] = {0}; - - m_artist = "Waiting for"; - m_album = ""; - m_track = "track information..."; -} - -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) { - - 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]; - NRF_LOG_INFO("DATA : %s", s); - if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msArtistCharUuid) == 0) { - m_artist = s; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msTrackCharUuid) == 0) { - m_track = s; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msAlbumCharUuid) == 0) { - m_album = s; - } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msStatusCharUuid) == 0) { - m_status = s[0]; - } - } - return 0; -} - -std::string Pinetime::Controllers::MusicService::album() -{ - return m_album; -} - -std::string Pinetime::Controllers::MusicService::artist() -{ - return m_artist; -} - -std::string Pinetime::Controllers::MusicService::track() -{ - return m_track; -} - -unsigned char Pinetime::Controllers::MusicService::status() -{ - return m_status; -} - -void Pinetime::Controllers::MusicService::event(char event) -{ - 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, m_eventHandle, om); -} - diff --git a/src/components/Ble/MusicService.h b/src/components/Ble/MusicService.h deleted file mode 100644 index ab6db57..0000000 --- a/src/components/Ble/MusicService.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -//c7e50000-78fc-48fe-8e23-43b37a1942d0 -#define MUSIC_SERVICE_UUID_BASE {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0xe5, 0xc7} - -namespace Pinetime { - namespace System { - class SystemTask; - } - namespace Controllers { - - class MusicService { - public: - MusicService(Pinetime::System::SystemTask &system); - void Init(); - int OnCommand(uint16_t conn_handle, uint16_t attr_handle, - struct ble_gatt_access_ctxt *ctxt); - - std::string artist(); - std::string track(); - std::string album(); - unsigned char status(); - - void event(char event); - - static const char EVENT_MUSIC_OPEN = 0xe0; - static const char EVENT_MUSIC_PLAY = 0x00; - static const char EVENT_MUSIC_PAUSE = 0x01; - static const char EVENT_MUSIC_NEXT = 0x03; - static const char EVENT_MUSIC_PREV = 0x04; - static const char EVENT_MUSIC_VOLUP = 0x05; - static const char EVENT_MUSIC_VOLDOWN = 0x06; - static const char STATUS_MUSIC_PAUSED = 0x00; - static const char STATUS_MUSIC_PLAYING = 0x01; - - private: - static constexpr uint8_t msId[2] = {0x00, 0x01}; - static constexpr uint8_t msEventCharId[2] = {0x00, 0x02}; - static constexpr uint8_t msStatusCharId[2] = {0x00, 0x03}; - static constexpr uint8_t msArtistCharId[2] = {0x00, 0x04}; - static constexpr uint8_t msTrackCharId[2] = {0x00, 0x05}; - static constexpr uint8_t msAlbumCharId[2] = {0x00, 0x06}; - - 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 - }; - - struct ble_gatt_chr_def characteristicDefinition[6]; - struct ble_gatt_svc_def serviceDefinition[2]; - - uint16_t m_eventHandle; - - std::string m_artist; - std::string m_album; - std::string m_track; - - unsigned char m_status; - - Pinetime::System::SystemTask& m_system; - - }; - } -} - diff --git a/src/components/Ble/NimbleController.cpp b/src/components/Ble/NimbleController.cpp deleted file mode 100644 index b13f9ce..0000000 --- a/src/components/Ble/NimbleController.cpp +++ /dev/null @@ -1,337 +0,0 @@ - -#include - -#include -#include -#include - -#include "NimbleController.h" -#include "MusicService.h" -#include -#include -#include -#include -#include -#include - - - -using namespace Pinetime::Controllers; - -// TODO I'm not satisfied by how this code looks like (AlertNotificationClient and CurrentTimeClient must -// expose too much data, too many callbacks -> NimbleController -> CTS/ANS client. -// Let's try to improve this code (and keep it working!) - -NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask, - Pinetime::Controllers::Ble& bleController, - DateTime& dateTimeController, - Pinetime::Controllers::NotificationManager& notificationManager, - Controllers::Battery& batteryController, - Pinetime::Drivers::SpiNorFlash& spiNorFlash) : - 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}, - batteryInformationService{batteryController}, - immediateAlertService{systemTask, notificationManager} { - -} - -int GAPEventCallback(struct ble_gap_event *event, void *arg) { - auto nimbleController = static_cast(arg); - return nimbleController->OnGAPEvent(event); -} - -int CurrentTimeCharacteristicDiscoveredCallback(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->OnCTSCharacteristicDiscoveryEvent(conn_handle, error, chr); -} - -int AlertNotificationCharacteristicDiscoveredCallback(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->OnANSCharacteristicDiscoveryEvent(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); - return client->OnCurrentTimeReadResult(conn_handle, error, attr); -} - -int AlertNotificationDescriptorDiscoveryEventCallback(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->OnANSDescriptorDiscoveryEventCallback(conn_handle, error, chr_val_handle, dsc); -} - -void NimbleController::Init() { - while (!ble_hs_synced()) {} - - ble_svc_gap_init(); - ble_svc_gatt_init(); - - deviceInformationService.Init(); - currentTimeClient.Init(); - currentTimeService.Init(); - musicService.Init(); - anService.Init(); - dfuService.Init(); - batteryInformationService.Init(); - immediateAlertService.Init(); - int res; - res = ble_hs_util_ensure_addr(0); - ASSERT(res == 0); - res = ble_hs_id_infer_auto(0, &addrType); - ASSERT(res == 0); - res = ble_svc_gap_device_name_set(deviceName); - ASSERT(res == 0); - Pinetime::Controllers::Ble::BleAddress address; - res = ble_hs_id_copy_addr(addrType, address.data(), nullptr); - ASSERT(res == 0); - bleController.AddressType((addrType == 0) ? Ble::AddressTypes::Public : Ble::AddressTypes::Random); - bleController.Address(std::move(address)); - - res = ble_gatts_start(); - ASSERT(res == 0); -} - -void NimbleController::StartAdvertising() { - if(ble_gap_adv_active()) return; - - ble_svc_gap_device_name_set(deviceName); - - /* set adv parameters */ - struct ble_gap_adv_params adv_params; - struct ble_hs_adv_fields fields; - /* advertising payload is split into advertising data and advertising - response, because all data cannot fit into single packet; name of device - is sent as response to scan request */ - struct ble_hs_adv_fields rsp_fields; - - /* fill all fields and parameters with zeros */ - memset(&adv_params, 0, sizeof(adv_params)); - memset(&fields, 0, sizeof(fields)); - memset(&rsp_fields, 0, sizeof(rsp_fields)); - - 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.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_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) - - ble_gap_adv_rsp_set_fields(&rsp_fields); -// 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. - // 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 - // the advertising should be improve (better error handling, and advertise for 3 minutes after - // the application has been woken up, for example. -} - -int OnAllSvrDisco(uint16_t conn_handle, - const struct ble_gatt_error *error, - const struct ble_gatt_svc *service, - void *arg) { - auto nimbleController = static_cast(arg); - return nimbleController->OnDiscoveryEvent(conn_handle, error, service); - return 0; -} - -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"); - NRF_LOG_INFO("advertise complete; reason=%dn status=%d", event->adv_complete.reason, event->connect.status); - break; - case BLE_GAP_EVENT_CONNECT: { - 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); - - if (event->connect.status != 0) { - /* Connection failed; resume advertising. */ - StartAdvertising(); - bleController.Disconnect(); - } else { - bleController.Connect(); - systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleConnected); - connectionHandle = event->connect.conn_handle; - // Service discovery is deffered via systemtask - } - } - break; - case BLE_GAP_EVENT_DISCONNECT: - NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_DISCONNECT"); - NRF_LOG_INFO("disconnect; reason=%d", event->disconnect.reason); - - /* Connection terminated; resume advertising. */ - connectionHandle = BLE_HS_CONN_HANDLE_NONE; - bleController.Disconnect(); - StartAdvertising(); - break; - case BLE_GAP_EVENT_CONN_UPDATE: - NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_CONN_UPDATE"); - /* The central has updated the connection parameters. */ - NRF_LOG_INFO("connection updated; status=%d ", event->conn_update.status); - break; - case BLE_GAP_EVENT_ENC_CHANGE: - /* Encryption has been enabled or disabled for this connection. */ - NRF_LOG_INFO("encryption change event; status=%d ", event->enc_change.status); - 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); - 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); - return 0; - - case BLE_GAP_EVENT_REPEAT_PAIRING: { - /* We already have a bond with the peer, but it is attempting to - * establish a new secure link. This app sacrifices security for - * convenience: just throw away the old bond and accept the new link. - */ - - /* Delete the old bond. */ - struct ble_gap_conn_desc desc; - ble_gap_conn_find(event->repeat_pairing.conn_handle, &desc); - ble_store_util_delete_peer(&desc.peer_id_addr); - - /* Return BLE_GAP_REPEAT_PAIRING_RETRY to indicate that the host should - * continue with the pairing operation. - */ - } - return BLE_GAP_REPEAT_PAIRING_RETRY; - - case BLE_GAP_EVENT_NOTIFY_RX: { - /* Peer sent us a notification or indication. */ - size_t notifSize = OS_MBUF_PKTLEN(event->notify_rx.om); - - NRF_LOG_INFO("received %s; conn_handle=%d attr_handle=%d " - "attr_len=%d", - event->notify_rx.indication ? - "indication" : - "notification", - event->notify_rx.conn_handle, - event->notify_rx.attr_handle, - notifSize); - - alertNotificationClient.OnNotification(event); - return 0; - } - /* Attribute data is contained in event->notify_rx.attr_data. */ - - default: -// NRF_LOG_INFO("Advertising event : %d", event->type); - break; - } - return 0; -} - -int NimbleController::OnDiscoveryEvent(uint16_t i, const ble_gatt_error *error, const ble_gatt_svc *service) { - if(service == nullptr && error->status == BLE_HS_EDONE) { - NRF_LOG_INFO("Service Discovery complete"); - if(currentTimeClient.IsDiscovered()) { - ble_gattc_disc_all_chrs(connectionHandle, currentTimeClient.StartHandle(), currentTimeClient.EndHandle(), - CurrentTimeCharacteristicDiscoveredCallback, this); - - } else if(alertNotificationClient.IsDiscovered()) { - ble_gattc_disc_all_chrs(connectionHandle, alertNotificationClient.StartHandle(), alertNotificationClient.EndHandle(), - AlertNotificationCharacteristicDiscoveredCallback, this); - } - } - - alertNotificationClient.OnDiscoveryEvent(i, error, service); - currentTimeClient.OnDiscoveryEvent(i, error, service); - return 0; -} - -int NimbleController::OnCTSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, - const ble_gatt_chr *characteristic) { - if(characteristic == nullptr && error->status == BLE_HS_EDONE) { - NRF_LOG_INFO("CTS characteristic Discovery complete"); - ble_gattc_read(connectionHandle, currentTimeClient.CurrentTimeHandle(), CurrentTimeReadCallback, this); - return 0; - } - return currentTimeClient.OnCharacteristicDiscoveryEvent(connectionHandle, error, characteristic); -} - -int NimbleController::OnANSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, - const ble_gatt_chr *characteristic) { - if(characteristic == nullptr && error->status == BLE_HS_EDONE) { - NRF_LOG_INFO("ANS characteristic Discovery complete"); - ble_gattc_disc_all_dscs(connectionHandle, - alertNotificationClient.NewAlerthandle(), alertNotificationClient.EndHandle(), - AlertNotificationDescriptorDiscoveryEventCallback, this); - return 0; - } - return alertNotificationClient.OnCharacteristicsDiscoveryEvent(connectionHandle, error, characteristic); -} - -int NimbleController::OnCurrentTimeReadResult(uint16_t connectionHandle, const ble_gatt_error *error, ble_gatt_attr *attribute) { - currentTimeClient.OnCurrentTimeReadResult(connectionHandle, error, attribute); - - if (alertNotificationClient.IsDiscovered()) { - ble_gattc_disc_all_chrs(connectionHandle, alertNotificationClient.StartHandle(), - alertNotificationClient.EndHandle(), - AlertNotificationCharacteristicDiscoveredCallback, this); - } - return 0; -} - -int NimbleController::OnANSDescriptorDiscoveryEventCallback(uint16_t connectionHandle, const ble_gatt_error *error, - uint16_t characteristicValueHandle, - const ble_gatt_dsc *descriptor) { - return alertNotificationClient.OnDescriptorDiscoveryEventCallback(connectionHandle, error, characteristicValueHandle, descriptor); -} - -void NimbleController::StartDiscovery() { - ble_gattc_disc_all_svcs(connectionHandle, OnAllSvrDisco, this); -} - - -uint16_t NimbleController::connHandle() { - return connectionHandle; -} - diff --git a/src/components/Ble/NimbleController.h b/src/components/Ble/NimbleController.h deleted file mode 100644 index 89fa425..0000000 --- a/src/components/Ble/NimbleController.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include -#include "AlertNotificationService.h" -#include "AlertNotificationClient.h" -#include "DeviceInformationService.h" -#include "CurrentTimeClient.h" -#include "DfuService.h" -#include "CurrentTimeService.h" -#include "MusicService.h" -#include "BatteryInformationService.h" -#include "ImmediateAlertService.h" -#include - -namespace Pinetime { - namespace Drivers { - class SpiNorFlash; - } - namespace Controllers { - class DateTime; - - 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); - 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); - - void StartDiscovery(); - - Pinetime::Controllers::MusicService& music() {return musicService;}; - - 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; - - DeviceInformationService deviceInformationService; - CurrentTimeClient currentTimeClient; - AlertNotificationService anService; - AlertNotificationClient alertNotificationClient; - CurrentTimeService currentTimeService; - MusicService musicService; - BatteryInformationService batteryInformationService; - ImmediateAlertService immediateAlertService; - - 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} - }; - }; - } -} diff --git a/src/components/Ble/NotificationManager.cpp b/src/components/Ble/NotificationManager.cpp deleted file mode 100644 index 0aea069..0000000 --- a/src/components/Ble/NotificationManager.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include "NotificationManager.h" - -using namespace Pinetime::Controllers; - -void NotificationManager::Push(Pinetime::Controllers::NotificationManager::Categories category, - const char *message, uint8_t currentMessageSize) { - // TODO handle edge cases on read/write index - auto checkedSize = std::min(currentMessageSize, uint8_t{18}); - auto& notif = notifications[writeIndex]; - std::memcpy(notif.message.data(), message, checkedSize); - notif.message[checkedSize] = '\0'; - notif.category = category; - - writeIndex = (writeIndex + 1 < TotalNbNotifications) ? writeIndex + 1 : 0; - if(!empty && writeIndex == readIndex) - readIndex = writeIndex + 1; -} - -NotificationManager::Notification Pinetime::Controllers::NotificationManager::Pop() { -// TODO handle edge cases on read/write index - NotificationManager::Notification notification = notifications[readIndex]; - - if(readIndex != writeIndex) { - readIndex = (readIndex + 1 < TotalNbNotifications) ? readIndex + 1 : 0; - } - - // TODO Check move optimization on return - return notification; -} diff --git a/src/components/Ble/NotificationManager.h b/src/components/Ble/NotificationManager.h deleted file mode 100644 index daa1571..0000000 --- a/src/components/Ble/NotificationManager.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include - -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{18}; - - struct Notification { - std::array message; - Categories category = Categories::Unknown; - }; - - void Push(Categories category, const char* message, uint8_t messageSize); - Notification Pop(); - - - private: - static constexpr uint8_t TotalNbNotifications = 5; - std::array notifications; - uint8_t readIndex = 0; - uint8_t writeIndex = 0; - bool empty = true; - }; - } -} \ No newline at end of file diff --git a/src/components/Brightness/BrightnessController.cpp b/src/components/Brightness/BrightnessController.cpp deleted file mode 100644 index c8825d6..0000000 --- a/src/components/Brightness/BrightnessController.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include "BrightnessController.h" - -using namespace Pinetime::Controllers; - - -void BrightnessController::Init() { - nrf_gpio_cfg_output(pinLcdBacklight1); - nrf_gpio_cfg_output(pinLcdBacklight2); - nrf_gpio_cfg_output(pinLcdBacklight3); - Set(level); -} - -void BrightnessController::Set(BrightnessController::Levels level) { - this->level = level; - switch(level) { - default: - case Levels::High: - nrf_gpio_pin_clear(pinLcdBacklight1); - nrf_gpio_pin_clear(pinLcdBacklight2); - nrf_gpio_pin_clear(pinLcdBacklight3); - break; - case Levels::Medium: - nrf_gpio_pin_clear(pinLcdBacklight1); - nrf_gpio_pin_clear(pinLcdBacklight2); - nrf_gpio_pin_set(pinLcdBacklight3); - break; - case Levels::Low: - nrf_gpio_pin_clear(pinLcdBacklight1); - nrf_gpio_pin_set(pinLcdBacklight2); - nrf_gpio_pin_set(pinLcdBacklight3); - break; - case Levels::Off: - nrf_gpio_pin_set(pinLcdBacklight1); - nrf_gpio_pin_set(pinLcdBacklight2); - nrf_gpio_pin_set(pinLcdBacklight3); - break; - } -} - -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; - } -} - -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; - } -} - -BrightnessController::Levels BrightnessController::Level() const { - return level; -} - -void BrightnessController::Backup() { - backupLevel = level; -} - -void BrightnessController::Restore() { - Set(backupLevel); -} - diff --git a/src/components/Brightness/BrightnessController.h b/src/components/Brightness/BrightnessController.h deleted file mode 100644 index b8354ec..0000000 --- a/src/components/Brightness/BrightnessController.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include - -namespace Pinetime { - namespace Controllers { - class BrightnessController { - public: - enum class Levels {Off, Low, Medium, High}; - void Init(); - - void Set(Levels level); - Levels Level() const; - void Lower(); - void Higher(); - - void Backup(); - void Restore(); - - private: - static constexpr uint8_t pinLcdBacklight1 = 14; - static constexpr uint8_t pinLcdBacklight2 = 22; - static constexpr uint8_t pinLcdBacklight3 = 23; - Levels level = Levels::High; - Levels backupLevel = Levels::High; - }; - } -} diff --git a/src/components/DateTime/DateTimeController.cpp b/src/components/DateTime/DateTimeController.cpp deleted file mode 100644 index 30d9c13..0000000 --- a/src/components/DateTime/DateTimeController.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#include "DateTimeController.h" -#include -#include - -using namespace Pinetime::Controllers; - - -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)); - - NRF_LOG_INFO("%d %d %d ", day, month, year); - NRF_LOG_INFO("%d %d %d ", hour, minute, second); - previousSystickCounter = systickCounter; - - UpdateTime(systickCounter); - NRF_LOG_INFO("* %d %d %d ", this->hour, this->minute, this->second); - NRF_LOG_INFO("* %d %d %d ", this->day, this->month, this->year); -} - -void DateTime::UpdateTime(uint32_t systickCounter) { - // Handle systick counter overflow - uint32_t systickDelta = 0; - if(systickCounter < previousSystickCounter) { - systickDelta = 0xffffff - previousSystickCounter; - systickDelta += systickCounter + 1; - } else { - systickDelta = systickCounter - previousSystickCounter; - } - - /* - * 1000 ms = 1024 ticks - */ - auto correctedDelta = systickDelta / 1024; - auto rest = (systickDelta - (correctedDelta*1024)); - if(systickCounter >= rest) { - previousSystickCounter = systickCounter - rest; - } else { - previousSystickCounter = 0xffffff - (rest - systickCounter); - } - - currentDateTime += std::chrono::seconds(correctedDelta); - uptime += std::chrono::seconds(correctedDelta); - - auto dp = date::floor(currentDateTime); - 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(); - dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); - - hour = time.hours().count(); - minute = time.minutes().count(); - second = time.seconds().count(); -} - diff --git a/src/components/DateTime/DateTimeController.h b/src/components/DateTime/DateTimeController.h deleted file mode 100644 index d602074..0000000 --- a/src/components/DateTime/DateTimeController.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once - -#include -#include - -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}; - - 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; } - - std::chrono::time_point CurrentDateTime() const { return currentDateTime; } - std::chrono::seconds Uptime() const { return uptime; } - private: - 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; - - uint32_t previousSystickCounter = 0; - std::chrono::time_point currentDateTime; - std::chrono::seconds uptime {0}; - }; - } -} \ No newline at end of file diff --git a/src/components/FirmwareValidator/FirmwareValidator.cpp b/src/components/FirmwareValidator/FirmwareValidator.cpp deleted file mode 100644 index 244d5c0..0000000 --- a/src/components/FirmwareValidator/FirmwareValidator.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -#include "FirmwareValidator.h" - -using namespace Pinetime::Controllers; - -bool FirmwareValidator::IsValidated() const { - auto* imageOkPtr = reinterpret_cast(validBitAdress); - return (*imageOkPtr) == validBitValue; -} - -void FirmwareValidator::Validate() { - if(!IsValidated()) - Pinetime::Drivers::InternalFlash::WriteWord(validBitAdress, validBitValue); -} - -void FirmwareValidator::Reset() { - NVIC_SystemReset(); -} diff --git a/src/components/FirmwareValidator/FirmwareValidator.h b/src/components/FirmwareValidator/FirmwareValidator.h deleted file mode 100644 index aa576d8..0000000 --- a/src/components/FirmwareValidator/FirmwareValidator.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include - -namespace Pinetime { - namespace Controllers { - class FirmwareValidator { - public: - void Validate(); - bool IsValidated() const; - - 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 deleted file mode 100644 index 3c5dbfb..0000000 --- a/src/components/Gfx/Gfx.cpp +++ /dev/null @@ -1,207 +0,0 @@ -#include -#include -#include -#include "Gfx.h" -#include "../../drivers/St7789.h" -using namespace Pinetime::Components; - -Gfx::Gfx(Pinetime::Drivers::St7789 &lcd) : lcd{lcd} { -} - -void Gfx::Init() { - -} - -void Gfx::ClearScreen() { - SetBackgroundColor(0x0000); - - state.remainingIterations = 240 + 1; - state.currentIteration = 0; - state.busy = true; - state.action = Action::FillRectangle; - state.taskToNotify = xTaskGetCurrentTaskHandle(); - - lcd.BeginDrawBuffer(0, 0, width, height); - lcd.NextDrawBuffer(reinterpret_cast(buffer), width * 2); - WaitTransfertFinished(); - -} - -void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t color) { - SetBackgroundColor(color); - - state.remainingIterations = h; - state.currentIteration = 0; - state.busy = true; - state.action = Action::FillRectangle; - state.color = color; - state.taskToNotify = xTaskGetCurrentTaskHandle(); - - lcd.BeginDrawBuffer(x, y, w, h); - lcd.NextDrawBuffer(reinterpret_cast(buffer), width * 2); - - WaitTransfertFinished(); -} - -void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t* b) { - state.remainingIterations = h; - state.currentIteration = 0; - state.busy = true; - state.action = Action::FillRectangle; - state.color = 0x00; - state.taskToNotify = xTaskGetCurrentTaskHandle(); - - lcd.BeginDrawBuffer(x, y, w, h); - lcd.NextDrawBuffer(reinterpret_cast(b), width * 2); - - WaitTransfertFinished(); -} - -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; - } - - uint8_t current_x = x; - uint8_t current_y = y; - - for (size_t i = 0; text[i] != '\0'; i++) { - if (text[i] == '\n') { - current_x = x; - current_y += p_font->height + p_font->height / 10; - } else { - DrawChar(p_font, (uint8_t) text[i], ¤t_x, current_y, color); - } - - uint8_t char_idx = text[i] - p_font->startChar; - uint16_t char_width = text[i] == ' ' ? (p_font->height / 2) : p_font->charInfo[char_idx].widthBits; - - if (current_x > (width - char_width)) { - if (wrap) { - current_x = x; - current_y += p_font->height + p_font->height / 10; - } else { - break; - } - - if (y > (height - p_font->height)) { - break; - } - } - } -} - -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; - - if (c == ' ') { - *x += font->height / 2; - return; - } - - // Build first line - 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; - } - } - } - - state.remainingIterations = font->height + 0; - state.currentIteration = 0; - state.busy = true; - state.action = Action::DrawChar; - state.font = const_cast(font); - state.character = c; - state.color = color; - state.taskToNotify = xTaskGetCurrentTaskHandle(); - - lcd.BeginDrawBuffer(*x, y, bytes_in_line*8, font->height); - lcd.NextDrawBuffer(reinterpret_cast(&buffer), bytes_in_line*8*2); - WaitTransfertFinished(); - - *x += font->charInfo[char_idx].widthBits + font->spacePixels; -} - -void Gfx::pixel_draw(uint8_t x, uint8_t y, uint16_t color) { - lcd.DrawPixel(x, y, color); -} - -void Gfx::Sleep() { - lcd.Sleep(); -} - -void Gfx::Wakeup() { - lcd.Wakeup(); -} - -void Gfx::SetBackgroundColor(uint16_t color) { - for(int i = 0; i < width; i++) { - buffer[i] = color; - } -} - -bool Gfx::GetNextBuffer(uint8_t **data, size_t &size) { - if(!state.busy) return false; - state.remainingIterations--; - if (state.remainingIterations == 0) { - state.busy = false; - NotifyEndOfTransfert(state.taskToNotify); - return false; - } - - if(state.action == Action::FillRectangle) { - *data = reinterpret_cast(buffer); - size = width * 2; - } 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; - } - } - } - - *data = reinterpret_cast(buffer); - size = bytes_in_line*8*2; - } - - state.currentIteration++; - - return true; -} - -void Gfx::NotifyEndOfTransfert(TaskHandle_t task) { - if(task != nullptr) { - BaseType_t xHigherPriorityTaskWoken = pdFALSE; - vTaskNotifyGiveFromISR(task, &xHigherPriorityTaskWoken); - portYIELD_FROM_ISR(xHigherPriorityTaskWoken); - } -} - -void Gfx::WaitTransfertFinished() const { - ulTaskNotifyTake(pdTRUE, 500); -} - -void Gfx::SetScrollArea(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines) { - lcd.VerticalScrollDefinition(topFixedLines, scrollLines, bottomFixedLines); -} - -void Gfx::SetScrollStartLine(uint16_t line) { - lcd.VerticalScrollStartAddress(line); -} - diff --git a/src/components/Gfx/Gfx.h b/src/components/Gfx/Gfx.h deleted file mode 100644 index 091f06f..0000000 --- a/src/components/Gfx/Gfx.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once -#include -#include -#include -#include -#include - - -namespace Pinetime { - namespace Drivers { - class St7789; - } - 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); - - - 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; - }; - - volatile State state; - - uint16_t buffer[width]; // 1 line buffer - Drivers::St7789& lcd; - - void SetBackgroundColor(uint16_t color); - void WaitTransfertFinished() const; - void NotifyEndOfTransfert(TaskHandle_t task); - }; - } -} diff --git a/src/components/battery/BatteryController.cpp b/src/components/battery/BatteryController.cpp new file mode 100644 index 0000000..571efae --- /dev/null +++ b/src/components/battery/BatteryController.cpp @@ -0,0 +1,48 @@ +#include +#include +#include +#include +#include "BatteryController.h" + +using namespace Pinetime::Controllers; + +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); + + nrfx_saadc_config_t adcConfig = NRFX_SAADC_DEFAULT_CONFIG; + nrfx_saadc_init(&adcConfig, SaadcEventHandler); + 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_DISABLED, + .pin_p = batteryVoltageAdcInput, + .pin_n = NRF_SAADC_INPUT_DISABLED + }; + nrfx_saadc_channel_init(0, &adcChannelConfig); +} + +void Battery::Update() { + isCharging = !nrf_gpio_pin_read(chargingPin); + isPowerPresent = !nrf_gpio_pin_read(powerPresentPin); + + nrf_saadc_value_t value = 0; + nrfx_saadc_sample_convert(0, &value); + + // see https://forum.pine64.org/showthread.php?tid=8147 + voltage = (value * 2.0f) / (1024/3.0f); + percentRemaining = ((voltage - 3.55f)*100.0f)*3.9f; + percentRemaining = std::max(percentRemaining, 0.0f); + percentRemaining = std::min(percentRemaining, 100.0f); + +// NRF_LOG_INFO("BATTERY " NRF_LOG_FLOAT_MARKER " %% - " NRF_LOG_FLOAT_MARKER " v", NRF_LOG_FLOAT(percentRemaining), NRF_LOG_FLOAT(voltage)); +// NRF_LOG_INFO("POWER Charging : %d - Power : %d", isCharging, isPowerPresent); +} + +void Battery::SaadcEventHandler(nrfx_saadc_evt_t const * event) { + +} \ No newline at end of file diff --git a/src/components/battery/BatteryController.h b/src/components/battery/BatteryController.h new file mode 100644 index 0000000..f07648a --- /dev/null +++ b/src/components/battery/BatteryController.h @@ -0,0 +1,27 @@ +#pragma once +#include + + +namespace Pinetime { + namespace Controllers { + class Battery { + public: + void Init(); + void Update(); + float PercentRemaining() const { return percentRemaining; } + float Voltage() const { return voltage; } + bool IsCharging() const { return isCharging; } + bool IsPowerPresent() const { return isPowerPresent; } + + private: + static constexpr uint32_t chargingPin = 12; + static constexpr uint32_t powerPresentPin = 19; + static constexpr nrf_saadc_input_t batteryVoltageAdcInput = NRF_SAADC_INPUT_AIN7; + static void SaadcEventHandler(nrfx_saadc_evt_t const * p_event); + float percentRemaining = 0.0f; + float voltage = 0.0f; + bool isCharging = false; + bool isPowerPresent = false; + }; + } +} \ No newline at end of file diff --git a/src/components/ble/AlertNotificationClient.cpp b/src/components/ble/AlertNotificationClient.cpp new file mode 100644 index 0000000..ddc7296 --- /dev/null +++ b/src/components/ble/AlertNotificationClient.cpp @@ -0,0 +1,145 @@ +#include +#include "NotificationManager.h" + +#include "AlertNotificationClient.h" + + +using namespace Pinetime::Controllers; +constexpr ble_uuid16_t AlertNotificationClient::ansServiceUuid; + +constexpr ble_uuid16_t AlertNotificationClient::supportedNewAlertCategoryUuid; +constexpr ble_uuid16_t AlertNotificationClient::supportedUnreadAlertCategoryUuid ; +constexpr ble_uuid16_t AlertNotificationClient::newAlertUuid; +constexpr ble_uuid16_t AlertNotificationClient::unreadAlertStatusUuid; +constexpr ble_uuid16_t AlertNotificationClient::controlPointUuid; + +int Pinetime::Controllers::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& notificationManager) : + systemTask{systemTask}, notificationManager{notificationManager}{ + +} + +bool AlertNotificationClient::OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, const ble_gatt_svc *service) { + if(service == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("ANS Discovery complete"); + return true; + } + + if(service != nullptr && ble_uuid_cmp(((ble_uuid_t*)&ansServiceUuid), &service->uuid.u) == 0) { + NRF_LOG_INFO("ANS discovered : 0x%x", service->start_handle); + ansStartHandle = service->start_handle; + ansEndHandle = service->end_handle; + isDiscovered = true; + } + return false; +} + +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"); + return 0; + } + + if(characteristic == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("ANS Characteristic discovery complete"); + } else { + 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) { + 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) { + NRF_LOG_INFO("ANS Characteristic discovered : newAlertUuid"); + newAlertHandle = characteristic->val_handle; + newAlertDefHandle = characteristic->def_handle; + } 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) { + NRF_LOG_INFO("ANS Characteristic discovered : controlPointUuid"); + controlPointHandle = 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) { + if(error->status == 0) { + NRF_LOG_INFO("ANS New alert subscribe OK"); + } else { + NRF_LOG_INFO("ANS New alert subscribe ERROR"); + } + + return 0; +} + +int AlertNotificationClient::OnDescriptorDiscoveryEventCallback(uint16_t connectionHandle, const ble_gatt_error *error, + uint16_t characteristicValueHandle, + const ble_gatt_dsc *descriptor) { + if(error->status == 0) { + 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; + uint8_t value[2]; + value[0] = 1; + value[1] = 0; + ble_gattc_write_flat(connectionHandle, newAlertDescriptorHandle, value, sizeof(value), NewAlertSubcribeCallback, this); + } + } + } + return 0; +} + +void AlertNotificationClient::OnNotification(ble_gap_event *event) { + if(event->notify_rx.attr_handle == newAlertHandle) { + // TODO implement this with more memory safety (and constexpr) + static const size_t maxBufferSize{21}; + static const size_t maxMessageSize{18}; + size_t bufferSize = min(OS_MBUF_PKTLEN(event->notify_rx.om), maxBufferSize); + + uint8_t data[bufferSize]; + os_mbuf_copydata(event->notify_rx.om, 0, bufferSize, data); + + char *s = (char *) &data[3]; + auto messageSize = min(maxMessageSize, (bufferSize-3)); + + for (uint i = 0; i < messageSize-1; i++) { + if (s[i] == 0x00) { + s[i] = 0x0A; + } + } + s[messageSize-1] = '\0'; + + notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, s, messageSize); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); + } +} + +bool AlertNotificationClient::IsDiscovered() const { + return isDiscovered; +} + +uint16_t AlertNotificationClient::StartHandle() const { + return ansStartHandle; +} + +uint16_t AlertNotificationClient::EndHandle() const { + return ansEndHandle; +} + +uint16_t AlertNotificationClient::NewAlerthandle() const { + return newAlertHandle; +} diff --git a/src/components/ble/AlertNotificationClient.h b/src/components/ble/AlertNotificationClient.h new file mode 100644 index 0000000..ca4f4e9 --- /dev/null +++ b/src/components/ble/AlertNotificationClient.h @@ -0,0 +1,81 @@ +#pragma once + +#include +#include +#include + + +namespace Pinetime { + namespace Controllers { + int NewAlertSubcribeCallback(uint16_t conn_handle, + const struct ble_gatt_error *error, + struct ble_gatt_attr *attr, + void *arg); + + class AlertNotificationClient { + public: + explicit AlertNotificationClient(Pinetime::System::SystemTask &systemTask, + Pinetime::Controllers::NotificationManager ¬ificationManager); + + 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); + bool IsDiscovered() const; + uint16_t StartHandle() const; + uint16_t EndHandle() const; + + static constexpr const ble_uuid16_t &Uuid() { return ansServiceUuid; } + + uint16_t NewAlerthandle() const; + 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 + }; + + uint16_t ansStartHandle; + uint16_t ansEndHandle; + uint16_t supportedNewAlertCategoryHandle; + uint16_t supportedUnreadAlertCategoryHandle; + uint16_t newAlertHandle; + uint16_t newAlertDescriptorHandle = 0; + uint16_t newAlertDefHandle; + uint16_t unreadAlertStatusHandle; + uint16_t controlPointHandle; + bool isDiscovered = false; + Pinetime::System::SystemTask &systemTask; + Pinetime::Controllers::NotificationManager ¬ificationManager; + }; + } +} \ No newline at end of file diff --git a/src/components/ble/AlertNotificationService.cpp b/src/components/ble/AlertNotificationService.cpp new file mode 100644 index 0000000..9a9b535 --- /dev/null +++ b/src/components/ble/AlertNotificationService.cpp @@ -0,0 +1,80 @@ + +#include +#include "NotificationManager.h" +#include + +#include "AlertNotificationService.h" +#include + +using namespace Pinetime::Controllers; + +constexpr ble_uuid16_t AlertNotificationService::ansUuid; +constexpr ble_uuid16_t AlertNotificationService::ansCharUuid; + + +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); +} + +void AlertNotificationService::Init() { + int res; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + 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 + }, + { + 0 + } + }, + serviceDefinition{ + { + /* Device Information Service */ + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = (ble_uuid_t *) &ansUuid, + .characteristics = characteristicDefinition + }, + { + 0 + }, + }, m_systemTask{systemTask}, m_notificationManager{notificationManager} { +} + +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) { + // TODO implement this with more memory safety (and constexpr) + static const size_t maxBufferSize{21}; + static const size_t maxMessageSize{18}; + size_t bufferSize = min(OS_MBUF_PKTLEN(ctxt->om), maxBufferSize); + + uint8_t data[bufferSize]; + os_mbuf_copydata(ctxt->om, 0, bufferSize, data); + + char *s = (char *) &data[3]; + auto messageSize = min(maxMessageSize, (bufferSize-3)); + + for (uint i = 0; i < messageSize-1; i++) { + if (s[i] == 0x00) { + s[i] = 0x0A; + } + } + s[messageSize-1] = '\0'; + + m_notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, s, messageSize); + m_systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); + } + return 0; +} diff --git a/src/components/ble/AlertNotificationService.h b/src/components/ble/AlertNotificationService.h new file mode 100644 index 0000000..53cb44c --- /dev/null +++ b/src/components/ble/AlertNotificationService.h @@ -0,0 +1,39 @@ +#pragma once +#include +#include +#include + +namespace Pinetime { + namespace Controllers { + class AlertNotificationService { + public: + AlertNotificationService(Pinetime::System::SystemTask &systemTask, + Pinetime::Controllers::NotificationManager ¬ificationManager); + void Init(); + + int OnAlert(uint16_t conn_handle, uint16_t attr_handle, + struct ble_gatt_access_ctxt *ctxt); + + + private: + 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 ansCharUuid { + .u { .type = BLE_UUID_TYPE_16 }, + .value = ansCharId + }; + + struct ble_gatt_chr_def characteristicDefinition[2]; + struct ble_gatt_svc_def serviceDefinition[2]; + + Pinetime::System::SystemTask &m_systemTask; + NotificationManager &m_notificationManager; + }; + } +} diff --git a/src/components/ble/BatteryInformationService.cpp b/src/components/ble/BatteryInformationService.cpp new file mode 100644 index 0000000..f7d895c --- /dev/null +++ b/src/components/ble/BatteryInformationService.cpp @@ -0,0 +1,62 @@ +#include "BatteryInformationService.h" +#include "components/battery/BatteryController.h" + +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) { + 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 + }, + }{ + +} + +void BatteryInformationService::Init() { + int res = 0; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); +} + +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); + return (res == 0) ? 0 : BLE_ATT_ERR_INSUFFICIENT_RES; + } + return 0; +} \ No newline at end of file diff --git a/src/components/ble/BatteryInformationService.h b/src/components/ble/BatteryInformationService.h new file mode 100644 index 0000000..74b2222 --- /dev/null +++ b/src/components/ble/BatteryInformationService.h @@ -0,0 +1,40 @@ +#pragma once +#include + +namespace Pinetime { + namespace System { + class SystemTask; + } + namespace Controllers { + class Battery; + class BatteryInformationService { + public: + BatteryInformationService(Controllers::Battery& batteryController); + void Init(); + + 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}; + + 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 + }; + + struct ble_gatt_chr_def characteristicDefinition[3]; + struct ble_gatt_svc_def serviceDefinition[2]; + + uint16_t batteryLevelHandle; + + }; + } +} diff --git a/src/components/ble/BleController.cpp b/src/components/ble/BleController.cpp new file mode 100644 index 0000000..2b396e1 --- /dev/null +++ b/src/components/ble/BleController.cpp @@ -0,0 +1,31 @@ +#include +#include +#include "BleController.h" + +using namespace Pinetime::Controllers; + +void Ble::Connect() { + isConnected = true; +} + +void Ble::Disconnect() { + isConnected = false; +} + +void Ble::StartFirmwareUpdate() { + isFirmwareUpdating = true; +} + +void Ble::StopFirmwareUpdate() { + isFirmwareUpdating = false; +} + +void Ble::FirmwareUpdateTotalBytes(uint32_t totalBytes) { + firmwareUpdateTotalBytes = totalBytes; +} + +void Ble::FirmwareUpdateCurrentBytes(uint32_t currentBytes) { + firmwareUpdateCurrentBytes = currentBytes; +} + + diff --git a/src/components/ble/BleController.h b/src/components/ble/BleController.h new file mode 100644 index 0000000..3f52ea2 --- /dev/null +++ b/src/components/ble/BleController.h @@ -0,0 +1,45 @@ +#pragma once + +#include +#include +#include + +namespace Pinetime { + namespace Controllers { + class Ble { + 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(); + + 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; } + + 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 new file mode 100644 index 0000000..7a225f4 --- /dev/null +++ b/src/components/ble/CurrentTimeClient.cpp @@ -0,0 +1,77 @@ +#include +#include "CurrentTimeClient.h" + +using namespace Pinetime::Controllers; + +constexpr ble_uuid16_t CurrentTimeClient::ctsServiceUuid; +constexpr ble_uuid16_t CurrentTimeClient::currentTimeCharacteristicUuid; + +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) { + if(service == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("CTS Discovery complete"); + return true; + } + + if(service != nullptr && ble_uuid_cmp(((ble_uuid_t*)&ctsServiceUuid), &service->uuid.u) == 0) { + NRF_LOG_INFO("CTS discovered : 0x%x", service->start_handle); + isDiscovered = true; + ctsStartHandle = service->start_handle; + ctsEndHandle = service->end_handle; + return false; + } + return false; +} + +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) { + NRF_LOG_INFO("CTS Characteristic discovery complete"); + return 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); + currentTimeHandle = characteristic->val_handle; + } + return 0; +} + +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)); + } else { + NRF_LOG_INFO("Error retrieving current time: %d", error->status); + } + return 0; +} + +bool CurrentTimeClient::IsDiscovered() const { + return isDiscovered; +} + +uint16_t CurrentTimeClient::StartHandle() const { + return ctsStartHandle; +} + +uint16_t CurrentTimeClient::EndHandle() const { + return ctsEndHandle; +} + +uint16_t CurrentTimeClient::CurrentTimeHandle() const { + return currentTimeHandle; +} \ No newline at end of file diff --git a/src/components/ble/CurrentTimeClient.h b/src/components/ble/CurrentTimeClient.h new file mode 100644 index 0000000..639ec83 --- /dev/null +++ b/src/components/ble/CurrentTimeClient.h @@ -0,0 +1,56 @@ +#pragma once +#include +#include + +#include "components/datetime/DateTimeController.h" +#include + +namespace Pinetime { + namespace Controllers { + + class CurrentTimeClient { + public: + explicit CurrentTimeClient(DateTime& dateTimeController); + void Init(); + 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); + bool IsDiscovered() const; + uint16_t StartHandle() const; + uint16_t EndHandle() const; + uint16_t CurrentTimeHandle() const; + static constexpr const ble_uuid16_t* Uuid() { return &CurrentTimeClient::ctsServiceUuid; } + static constexpr const ble_uuid16_t* CurrentTimeCharacteristicUuid() { return &CurrentTimeClient::currentTimeCharacteristicUuid; } + 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 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 + }; + + uint16_t currentTimeHandle; + DateTime& dateTimeController; + bool isDiscovered = false; + uint16_t ctsStartHandle; + uint16_t ctsEndHandle; + }; + } +} \ No newline at end of file diff --git a/src/components/ble/CurrentTimeService.cpp b/src/components/ble/CurrentTimeService.cpp new file mode 100644 index 0000000..3a6264e --- /dev/null +++ b/src/components/ble/CurrentTimeService.cpp @@ -0,0 +1,86 @@ +#include "CurrentTimeService.h" +#include + +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) { + auto cts = static_cast(arg); + return cts->OnTimeAccessed(conn_handle, attr_handle, ctxt); +} + +void CurrentTimeService::Init() { + int res; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); +} + + +int CurrentTimeService::OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, + struct ble_gatt_access_ctxt *ctxt) { + + 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); + + 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; + currentDateTime.year = m_dateTimeController.Year(); + currentDateTime.month = static_cast(m_dateTimeController.Month()); + currentDateTime.dayofmonth = m_dateTimeController.Day(); + currentDateTime.hour = m_dateTimeController.Hours(); + currentDateTime.minute = m_dateTimeController.Minutes(); + 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} { + +} + diff --git a/src/components/ble/CurrentTimeService.h b/src/components/ble/CurrentTimeService.h new file mode 100644 index 0000000..a6be964 --- /dev/null +++ b/src/components/ble/CurrentTimeService.h @@ -0,0 +1,49 @@ +#pragma once +#include +#include + +#include "components/datetime/DateTimeController.h" +#include + +namespace Pinetime { + namespace Controllers { + class CurrentTimeService { + public: + CurrentTimeService(DateTime &dateTimeController); + void Init(); + + 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}; + + 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 + }; + + 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; + + DateTime &m_dateTimeController; + }; + } +} diff --git a/src/components/ble/DeviceInformationService.cpp b/src/components/ble/DeviceInformationService.cpp new file mode 100644 index 0000000..406db1c --- /dev/null +++ b/src/components/ble/DeviceInformationService.cpp @@ -0,0 +1,116 @@ +#include "DeviceInformationService.h" + +using namespace Pinetime::Controllers; + +constexpr ble_uuid16_t DeviceInformationService::manufacturerNameUuid; +constexpr ble_uuid16_t DeviceInformationService::modelNumberUuid; +constexpr ble_uuid16_t DeviceInformationService::serialNumberUuid; +constexpr ble_uuid16_t DeviceInformationService::fwRevisionUuid; +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) { + auto deviceInformationService = static_cast(arg); + return deviceInformationService->OnDeviceInfoRequested(conn_handle, attr_handle, ctxt); +} + +void DeviceInformationService::Init() { + int res = 0; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); +} + + +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: + str = manufacturerName; + break; + case modelNumberId: + str = modelNumber; + break; + case serialNumberId: + str = serialNumber; + break; + case fwRevisionId: + str = fwRevision; + break; + case hwRevisionId: + str = hwRevision; + break; + case swRevisionId: + str = swRevision; + break; + default: + return BLE_ATT_ERR_UNLIKELY; + } + + int res = os_mbuf_append(ctxt->om, str, strlen(str)); + 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 + }, + } + { + +} + diff --git a/src/components/ble/DeviceInformationService.h b/src/components/ble/DeviceInformationService.h new file mode 100644 index 0000000..25ab840 --- /dev/null +++ b/src/components/ble/DeviceInformationService.h @@ -0,0 +1,76 @@ +#pragma once +#include +#include + +#include +#include + +namespace Pinetime { + namespace Controllers { + class DeviceInformationService { + public: + DeviceInformationService(); + void Init(); + + 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}; + + 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 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 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 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 new file mode 100644 index 0000000..4dec514 --- /dev/null +++ b/src/components/ble/DfuService.cpp @@ -0,0 +1,441 @@ +#include + +#include "components/ble/BleController.h" +#include "systemtask/SystemTask.h" +#include "DfuService.h" + +using namespace Pinetime::Controllers; + +constexpr ble_uuid128_t DfuService::serviceUuid; +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); + return dfuService->OnServiceData(conn_handle, attr_handle, ctxt); +} + +void NotificationTimerCallback(TimerHandle_t xTimer) { + auto notificationManager = static_cast(pvTimerGetTimerID(xTimer)); + notificationManager->OnNotificationTimer(); +} + +void TimeoutTimerCallback(TimerHandle_t 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, + + }, + { + 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); +} + +void DfuService::Init() { + int res; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + ASSERT(res == 0); +} + +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); + + if (attributeHandle == packetCharacteristicHandle) { + if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) + return WritePacketHandler(connectionHandle, context->om); + 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 if (attributeHandle == revisionCharacteristicHandle) { + if (context->op == BLE_GATT_ACCESS_OP_READ_CHR) + return SendDfuRevision(context->om); + else return 0; + } else { + NRF_LOG_INFO("[DFU] Unknown Characteristic : %d", attributeHandle); + return 0; + } +} + +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) { + 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); + + dfuImage.Erase(); + + uint8_t data[]{16, 1, 1}; + notificationManager.Send(connectionHandle, controlPointCharacteristicHandle, data, 3); + state = States::Init; + } + return 0; + 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); + 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); + + 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); + + return 0; + } + + case States::Data: { + nbPacketReceived++; + dfuImage.Append(om->om_data, om->om_len); + bytesReceived += om->om_len; + 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)}; + 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)}; + NRF_LOG_INFO("[DFU] -> Send packet notification : all bytes received!"); + notificationManager.Send(connectionHandle, controlPointCharacteristicHandle, data, 3); + state = States::Validate; + } + } + return 0; + default: + // Invalid state + return 0; + } + return 0; +} + +int DfuService::ControlPointHandler(uint16_t connectionHandle, os_mbuf *om) { + auto opcode = static_cast(om->om_data[0]); + NRF_LOG_INFO("[DFU] -> ControlPointHandler"); + + switch (opcode) { + case Opcodes::StartDFU: { + if (state != States::Idle && state != States::Start) { + NRF_LOG_INFO("[DFU] -> Start DFU requested, but we are not in Idle state"); + return 0; + } + if (state == States::Start) { + NRF_LOG_INFO("[DFU] -> Start DFU requested, but we are already in Start state"); + return 0; + } + auto imageType = static_cast(om->om_data[1]); + if (imageType == ImageTypes::Application) { + NRF_LOG_INFO("[DFU] -> Start DFU, mode = Application"); + state = States::Start; + bleController.StartFirmwareUpdate(); + bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Running); + bleController.FirmwareUpdateTotalBytes(0xffffffffu); + bleController.FirmwareUpdateCurrentBytes(0); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleFirmwareUpdateStarted); + return 0; + } else { + NRF_LOG_INFO("[DFU] -> Start DFU, mode %d not supported!", imageType); + return 0; + } + } + break; + case Opcodes::InitDFUParameters: { + if (state != States::Init) { + NRF_LOG_INFO("[DFU] -> Init DFU requested, but we are not in Init state"); + return 0; + } + bool isInitComplete = (om->om_data[1] != 0); + 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}) + }; + notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3); + return 0; + } + } + return 0; + case Opcodes::PacketReceiptNotificationRequest: + nbPacketsToNotify = om->om_data[1]; + NRF_LOG_INFO("[DFU] -> Receive Packet Notification Request, nb packet = %d", nbPacketsToNotify); + return 0; + case Opcodes::ReceiveFirmwareImage: + if (state != States::Init) { + NRF_LOG_INFO("[DFU] -> Receive firmware image requested, but we are not in Start Init"); + return 0; + } + // TODO the chunk size is dependant of the implementation of the host application... + dfuImage.Init(20, applicationSize, expectedCrc); + NRF_LOG_INFO("[DFU] -> Starting receive firmware"); + state = States::Data; + return 0; + case Opcodes::ValidateFirmware: { + if (state != States::Validate) { + NRF_LOG_INFO("[DFU] -> Validate firmware image requested, but we are not in Data state %d", state); + return 0; + } + + NRF_LOG_INFO("[DFU] -> Validate firmware image requested -- %d", connectionHandle); + + 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) + }; + 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) + }; + notificationManager.AsyncSend(connectionHandle, controlPointCharacteristicHandle, data, 3); + } + + return 0; + } + case Opcodes::ActivateImageAndReset: + if (state != States::Validated) { + NRF_LOG_INFO("[DFU] -> Activate image and reset requested, but we are not in Validated state"); + return 0; + } + NRF_LOG_INFO("[DFU] -> Activate image and reset!"); + bleController.StopFirmwareUpdate(); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleFirmwareUpdateFinished); + Reset(); + bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated); + return 0; + default: + return 0; + } +} + +void DfuService::OnTimeout() { + Reset(); +} + +void DfuService::Reset() { + state = States::Idle; + nbPacketsToNotify = 0; + nbPacketReceived = 0; + bytesReceived = 0; + softdeviceSize = 0; + bootloaderSize = 0; + applicationSize = 0; + expectedCrc = 0; + notificationManager.Reset(); + bleController.State(Pinetime::Controllers::Ble::FirmwareUpdateStates::Error); + bleController.StopFirmwareUpdate(); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleFirmwareUpdateFinished); +} + +DfuService::NotificationManager::NotificationManager() { + 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) + return false; + + connectionHandle = connection; + characteristicHandle = charactHandle; + size = s; + std::memcpy(buffer, data, size); + xTimerStart(timer, 0); + return true; +} + +void DfuService::NotificationManager::OnNotificationTimer() { + 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); + auto ret = ble_gattc_notify_custom(connection, charactHandle, om); + ASSERT(ret == 0); +} + +void DfuService::NotificationManager::Reset() { + connectionHandle = 0; + characteristicHandle = 0; + size = 0; + xTimerStop(timer, 0); +} + +void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc) { + 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; + ASSERT(size <= 20); + + std::memcpy(tempBuffer + bufferWriteIndex, data, size); + bufferWriteIndex += size; + + if(bufferWriteIndex == bufferSize) { + spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); + totalWriteIndex += bufferWriteIndex; + bufferWriteIndex = 0; + } + + if(bufferWriteIndex > 0 && totalWriteIndex + bufferWriteIndex == totalSize) { + spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); + totalWriteIndex += bufferWriteIndex; + if (totalSize < maxSize) + WriteMagicNumber(); + } +} + +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 offset = writeOffset + (maxSize - (4 * sizeof(uint32_t))); + spiNorFlash.Write(offset, reinterpret_cast(magic), 4 * sizeof(uint32_t)); +} + +void DfuService::DfuImage::Erase() { + for (size_t erased = 0; erased < maxSize; erased += 0x1000) { + spiNorFlash.SectorErase(writeOffset + erased); + } +} + +bool DfuService::DfuImage::Validate() { + uint32_t chunkSize = 200; + size_t currentOffset = 0; + uint16_t crc = 0; + + bool first = true; + while (currentOffset < totalSize) { + uint32_t readSize = (totalSize - currentOffset) > chunkSize ? chunkSize : (totalSize - currentOffset); + + spiNorFlash.Read(writeOffset + currentOffset, tempBuffer, readSize); + if (first) { + crc = ComputeCrc(tempBuffer, readSize, NULL); + first = false; + } else + crc = ComputeCrc(tempBuffer, readSize, &crc); + currentOffset += readSize; + } + + return (crc == expectedCrc); +} + +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++) { + crc = (uint8_t) (crc >> 8) | (crc << 8); + crc ^= p_data[i]; + crc ^= (uint8_t) (crc & 0xFF) >> 4; + crc ^= (crc << 8) << 4; + crc ^= ((crc & 0xFF) << 4) << 1; + } + + return crc; +} + +bool DfuService::DfuImage::IsComplete() { + if(!ready) return false; + return totalWriteIndex == totalSize; +} diff --git a/src/components/ble/DfuService.h b/src/components/ble/DfuService.h new file mode 100644 index 0000000..d7ba460 --- /dev/null +++ b/src/components/ble/DfuService.h @@ -0,0 +1,161 @@ +#pragma once + +#include +#include + +#include + +namespace Pinetime { + namespace System { + class SystemTask; + } + namespace Drivers { + class SpiNorFlash; + } + namespace Controllers { + 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: + 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); + + }; + + 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/ImmediateAlertService.cpp b/src/components/ble/ImmediateAlertService.cpp new file mode 100644 index 0000000..3b7f47b --- /dev/null +++ b/src/components/ble/ImmediateAlertService.cpp @@ -0,0 +1,76 @@ +#include +#include "ImmediateAlertService.h" +#include "AlertNotificationService.h" + +using namespace Pinetime::Controllers; + +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); + 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 ""; + } + } +} + +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 + }, + }{ + +} + +void ImmediateAlertService::Init() { + int res = 0; + res = ble_gatts_count_cfg(serviceDefinition); + ASSERT(res == 0); + + res = ble_gatts_add_svcs(serviceDefinition); + 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) { + auto alertLevel = static_cast(context->om->om_data[0]); + auto* alertString = ToString(alertLevel); + notificationManager.Push(Pinetime::Controllers::NotificationManager::Categories::SimpleAlert, alertString, strlen(alertString)); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::OnNewNotification); + } + } + + return 0; +} \ No newline at end of file diff --git a/src/components/ble/ImmediateAlertService.h b/src/components/ble/ImmediateAlertService.h new file mode 100644 index 0000000..c42846c --- /dev/null +++ b/src/components/ble/ImmediateAlertService.h @@ -0,0 +1,46 @@ +#pragma once +#include + +namespace Pinetime { + namespace System { + class SystemTask; + } + namespace Controllers { + class NotificationManager; + class ImmediateAlertService { + 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); + + private: + Pinetime::System::SystemTask& systemTask; + NotificationManager& notificationManager; + + 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 alertLevelUuid { + .u {.type = BLE_UUID_TYPE_16}, + .value = alertLevelId + }; + + struct ble_gatt_chr_def characteristicDefinition[3]; + struct ble_gatt_svc_def serviceDefinition[2]; + + uint16_t alertLevelHandle; + }; + } +} diff --git a/src/components/ble/MusicService.cpp b/src/components/ble/MusicService.cpp new file mode 100644 index 0000000..9105a8e --- /dev/null +++ b/src/components/ble/MusicService.cpp @@ -0,0 +1,129 @@ +#include +#include "MusicService.h" + +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) +{ + msUuid.value[11] = msId[0]; + msUuid.value[12] = msId[1]; + msEventCharUuid.value[11] = msEventCharId[0]; + msEventCharUuid.value[12] = msEventCharId[1]; + msStatusCharUuid.value[11] = msStatusCharId[0]; + msStatusCharUuid.value[12] = msStatusCharId[1]; + msTrackCharUuid.value[11] = msTrackCharId[0]; + msTrackCharUuid.value[12] = msTrackCharId[1]; + msArtistCharUuid.value[11] = msArtistCharId[0]; + msArtistCharUuid.value[12] = msArtistCharId[1]; + msAlbumCharUuid.value[11] = msAlbumCharId[0]; + msAlbumCharUuid.value[12] = msAlbumCharId[1]; + + characteristicDefinition[0] = { .uuid = (ble_uuid_t*)(&msEventCharUuid), + .access_cb = MSCallback, + .arg = this, + .flags = BLE_GATT_CHR_F_NOTIFY, + .val_handle = &m_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] = {0}; + + serviceDefinition[0] = { + .type = BLE_GATT_SVC_TYPE_PRIMARY, + .uuid = (ble_uuid_t *) &msUuid, + .characteristics = characteristicDefinition + }; + serviceDefinition[1] = {0}; + + m_artist = "Waiting for"; + m_album = ""; + m_track = "track information..."; +} + +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) { + + 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]; + NRF_LOG_INFO("DATA : %s", s); + if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msArtistCharUuid) == 0) { + m_artist = s; + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msTrackCharUuid) == 0) { + m_track = s; + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msAlbumCharUuid) == 0) { + m_album = s; + } else if (ble_uuid_cmp(ctxt->chr->uuid, (ble_uuid_t *)&msStatusCharUuid) == 0) { + m_status = s[0]; + } + } + return 0; +} + +std::string Pinetime::Controllers::MusicService::album() +{ + return m_album; +} + +std::string Pinetime::Controllers::MusicService::artist() +{ + return m_artist; +} + +std::string Pinetime::Controllers::MusicService::track() +{ + return m_track; +} + +unsigned char Pinetime::Controllers::MusicService::status() +{ + return m_status; +} + +void Pinetime::Controllers::MusicService::event(char event) +{ + 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, m_eventHandle, om); +} + diff --git a/src/components/ble/MusicService.h b/src/components/ble/MusicService.h new file mode 100644 index 0000000..ab6db57 --- /dev/null +++ b/src/components/ble/MusicService.h @@ -0,0 +1,92 @@ +#pragma once + +#include +#include +#include +#include +#include + +//c7e50000-78fc-48fe-8e23-43b37a1942d0 +#define MUSIC_SERVICE_UUID_BASE {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0xe5, 0xc7} + +namespace Pinetime { + namespace System { + class SystemTask; + } + namespace Controllers { + + class MusicService { + public: + MusicService(Pinetime::System::SystemTask &system); + void Init(); + int OnCommand(uint16_t conn_handle, uint16_t attr_handle, + struct ble_gatt_access_ctxt *ctxt); + + std::string artist(); + std::string track(); + std::string album(); + unsigned char status(); + + void event(char event); + + static const char EVENT_MUSIC_OPEN = 0xe0; + static const char EVENT_MUSIC_PLAY = 0x00; + static const char EVENT_MUSIC_PAUSE = 0x01; + static const char EVENT_MUSIC_NEXT = 0x03; + static const char EVENT_MUSIC_PREV = 0x04; + static const char EVENT_MUSIC_VOLUP = 0x05; + static const char EVENT_MUSIC_VOLDOWN = 0x06; + static const char STATUS_MUSIC_PAUSED = 0x00; + static const char STATUS_MUSIC_PLAYING = 0x01; + + private: + static constexpr uint8_t msId[2] = {0x00, 0x01}; + static constexpr uint8_t msEventCharId[2] = {0x00, 0x02}; + static constexpr uint8_t msStatusCharId[2] = {0x00, 0x03}; + static constexpr uint8_t msArtistCharId[2] = {0x00, 0x04}; + static constexpr uint8_t msTrackCharId[2] = {0x00, 0x05}; + static constexpr uint8_t msAlbumCharId[2] = {0x00, 0x06}; + + 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 + }; + + struct ble_gatt_chr_def characteristicDefinition[6]; + struct ble_gatt_svc_def serviceDefinition[2]; + + uint16_t m_eventHandle; + + std::string m_artist; + std::string m_album; + std::string m_track; + + unsigned char m_status; + + Pinetime::System::SystemTask& m_system; + + }; + } +} + diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp new file mode 100644 index 0000000..022cc51 --- /dev/null +++ b/src/components/ble/NimbleController.cpp @@ -0,0 +1,337 @@ + +#include "components/datetime/DateTimeController.h" + +#include +#include "components/ble/NotificationManager.h" +#include + +#include "NimbleController.h" +#include "MusicService.h" +#include +#include +#include +#include +#include +#include + + + +using namespace Pinetime::Controllers; + +// TODO I'm not satisfied by how this code looks like (AlertNotificationClient and CurrentTimeClient must +// expose too much data, too many callbacks -> NimbleController -> CTS/ANS client. +// Let's try to improve this code (and keep it working!) + +NimbleController::NimbleController(Pinetime::System::SystemTask& systemTask, + Pinetime::Controllers::Ble& bleController, + DateTime& dateTimeController, + Pinetime::Controllers::NotificationManager& notificationManager, + Controllers::Battery& batteryController, + Pinetime::Drivers::SpiNorFlash& spiNorFlash) : + 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}, + batteryInformationService{batteryController}, + immediateAlertService{systemTask, notificationManager} { + +} + +int GAPEventCallback(struct ble_gap_event *event, void *arg) { + auto nimbleController = static_cast(arg); + return nimbleController->OnGAPEvent(event); +} + +int CurrentTimeCharacteristicDiscoveredCallback(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->OnCTSCharacteristicDiscoveryEvent(conn_handle, error, chr); +} + +int AlertNotificationCharacteristicDiscoveredCallback(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->OnANSCharacteristicDiscoveryEvent(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); + return client->OnCurrentTimeReadResult(conn_handle, error, attr); +} + +int AlertNotificationDescriptorDiscoveryEventCallback(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->OnANSDescriptorDiscoveryEventCallback(conn_handle, error, chr_val_handle, dsc); +} + +void NimbleController::Init() { + while (!ble_hs_synced()) {} + + ble_svc_gap_init(); + ble_svc_gatt_init(); + + deviceInformationService.Init(); + currentTimeClient.Init(); + currentTimeService.Init(); + musicService.Init(); + anService.Init(); + dfuService.Init(); + batteryInformationService.Init(); + immediateAlertService.Init(); + int res; + res = ble_hs_util_ensure_addr(0); + ASSERT(res == 0); + res = ble_hs_id_infer_auto(0, &addrType); + ASSERT(res == 0); + res = ble_svc_gap_device_name_set(deviceName); + ASSERT(res == 0); + Pinetime::Controllers::Ble::BleAddress address; + res = ble_hs_id_copy_addr(addrType, address.data(), nullptr); + ASSERT(res == 0); + bleController.AddressType((addrType == 0) ? Ble::AddressTypes::Public : Ble::AddressTypes::Random); + bleController.Address(std::move(address)); + + res = ble_gatts_start(); + ASSERT(res == 0); +} + +void NimbleController::StartAdvertising() { + if(ble_gap_adv_active()) return; + + ble_svc_gap_device_name_set(deviceName); + + /* set adv parameters */ + struct ble_gap_adv_params adv_params; + struct ble_hs_adv_fields fields; + /* advertising payload is split into advertising data and advertising + response, because all data cannot fit into single packet; name of device + is sent as response to scan request */ + struct ble_hs_adv_fields rsp_fields; + + /* fill all fields and parameters with zeros */ + memset(&adv_params, 0, sizeof(adv_params)); + memset(&fields, 0, sizeof(fields)); + memset(&rsp_fields, 0, sizeof(rsp_fields)); + + 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.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_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) + + ble_gap_adv_rsp_set_fields(&rsp_fields); +// 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. + // 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 + // the advertising should be improve (better error handling, and advertise for 3 minutes after + // the application has been woken up, for example. +} + +int OnAllSvrDisco(uint16_t conn_handle, + const struct ble_gatt_error *error, + const struct ble_gatt_svc *service, + void *arg) { + auto nimbleController = static_cast(arg); + return nimbleController->OnDiscoveryEvent(conn_handle, error, service); + return 0; +} + +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"); + NRF_LOG_INFO("advertise complete; reason=%dn status=%d", event->adv_complete.reason, event->connect.status); + break; + case BLE_GAP_EVENT_CONNECT: { + 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); + + if (event->connect.status != 0) { + /* Connection failed; resume advertising. */ + StartAdvertising(); + bleController.Disconnect(); + } else { + bleController.Connect(); + systemTask.PushMessage(Pinetime::System::SystemTask::Messages::BleConnected); + connectionHandle = event->connect.conn_handle; + // Service discovery is deffered via systemtask + } + } + break; + case BLE_GAP_EVENT_DISCONNECT: + NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_DISCONNECT"); + NRF_LOG_INFO("disconnect; reason=%d", event->disconnect.reason); + + /* Connection terminated; resume advertising. */ + connectionHandle = BLE_HS_CONN_HANDLE_NONE; + bleController.Disconnect(); + StartAdvertising(); + break; + case BLE_GAP_EVENT_CONN_UPDATE: + NRF_LOG_INFO("Advertising event : BLE_GAP_EVENT_CONN_UPDATE"); + /* The central has updated the connection parameters. */ + NRF_LOG_INFO("connection updated; status=%d ", event->conn_update.status); + break; + case BLE_GAP_EVENT_ENC_CHANGE: + /* Encryption has been enabled or disabled for this connection. */ + NRF_LOG_INFO("encryption change event; status=%d ", event->enc_change.status); + 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); + 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); + return 0; + + case BLE_GAP_EVENT_REPEAT_PAIRING: { + /* We already have a bond with the peer, but it is attempting to + * establish a new secure link. This app sacrifices security for + * convenience: just throw away the old bond and accept the new link. + */ + + /* Delete the old bond. */ + struct ble_gap_conn_desc desc; + ble_gap_conn_find(event->repeat_pairing.conn_handle, &desc); + ble_store_util_delete_peer(&desc.peer_id_addr); + + /* Return BLE_GAP_REPEAT_PAIRING_RETRY to indicate that the host should + * continue with the pairing operation. + */ + } + return BLE_GAP_REPEAT_PAIRING_RETRY; + + case BLE_GAP_EVENT_NOTIFY_RX: { + /* Peer sent us a notification or indication. */ + size_t notifSize = OS_MBUF_PKTLEN(event->notify_rx.om); + + NRF_LOG_INFO("received %s; conn_handle=%d attr_handle=%d " + "attr_len=%d", + event->notify_rx.indication ? + "indication" : + "notification", + event->notify_rx.conn_handle, + event->notify_rx.attr_handle, + notifSize); + + alertNotificationClient.OnNotification(event); + return 0; + } + /* Attribute data is contained in event->notify_rx.attr_data. */ + + default: +// NRF_LOG_INFO("Advertising event : %d", event->type); + break; + } + return 0; +} + +int NimbleController::OnDiscoveryEvent(uint16_t i, const ble_gatt_error *error, const ble_gatt_svc *service) { + if(service == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("Service Discovery complete"); + if(currentTimeClient.IsDiscovered()) { + ble_gattc_disc_all_chrs(connectionHandle, currentTimeClient.StartHandle(), currentTimeClient.EndHandle(), + CurrentTimeCharacteristicDiscoveredCallback, this); + + } else if(alertNotificationClient.IsDiscovered()) { + ble_gattc_disc_all_chrs(connectionHandle, alertNotificationClient.StartHandle(), alertNotificationClient.EndHandle(), + AlertNotificationCharacteristicDiscoveredCallback, this); + } + } + + alertNotificationClient.OnDiscoveryEvent(i, error, service); + currentTimeClient.OnDiscoveryEvent(i, error, service); + return 0; +} + +int NimbleController::OnCTSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, + const ble_gatt_chr *characteristic) { + if(characteristic == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("CTS characteristic Discovery complete"); + ble_gattc_read(connectionHandle, currentTimeClient.CurrentTimeHandle(), CurrentTimeReadCallback, this); + return 0; + } + return currentTimeClient.OnCharacteristicDiscoveryEvent(connectionHandle, error, characteristic); +} + +int NimbleController::OnANSCharacteristicDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error *error, + const ble_gatt_chr *characteristic) { + if(characteristic == nullptr && error->status == BLE_HS_EDONE) { + NRF_LOG_INFO("ANS characteristic Discovery complete"); + ble_gattc_disc_all_dscs(connectionHandle, + alertNotificationClient.NewAlerthandle(), alertNotificationClient.EndHandle(), + AlertNotificationDescriptorDiscoveryEventCallback, this); + return 0; + } + return alertNotificationClient.OnCharacteristicsDiscoveryEvent(connectionHandle, error, characteristic); +} + +int NimbleController::OnCurrentTimeReadResult(uint16_t connectionHandle, const ble_gatt_error *error, ble_gatt_attr *attribute) { + currentTimeClient.OnCurrentTimeReadResult(connectionHandle, error, attribute); + + if (alertNotificationClient.IsDiscovered()) { + ble_gattc_disc_all_chrs(connectionHandle, alertNotificationClient.StartHandle(), + alertNotificationClient.EndHandle(), + AlertNotificationCharacteristicDiscoveredCallback, this); + } + return 0; +} + +int NimbleController::OnANSDescriptorDiscoveryEventCallback(uint16_t connectionHandle, const ble_gatt_error *error, + uint16_t characteristicValueHandle, + const ble_gatt_dsc *descriptor) { + return alertNotificationClient.OnDescriptorDiscoveryEventCallback(connectionHandle, error, characteristicValueHandle, descriptor); +} + +void NimbleController::StartDiscovery() { + ble_gattc_disc_all_svcs(connectionHandle, OnAllSvrDisco, this); +} + + +uint16_t NimbleController::connHandle() { + return connectionHandle; +} + diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h new file mode 100644 index 0000000..9d20caf --- /dev/null +++ b/src/components/ble/NimbleController.h @@ -0,0 +1,76 @@ +#pragma once + +#include + +#include "AlertNotificationService.h" +#include "AlertNotificationClient.h" +#include "DeviceInformationService.h" +#include "CurrentTimeClient.h" +#include "DfuService.h" +#include "CurrentTimeService.h" +#include "MusicService.h" +#include "BatteryInformationService.h" +#include "ImmediateAlertService.h" +#include + +namespace Pinetime { + namespace Drivers { + class SpiNorFlash; + } + namespace Controllers { + class DateTime; + + 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); + 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); + + void StartDiscovery(); + + Pinetime::Controllers::MusicService& music() {return musicService;}; + + 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; + + DeviceInformationService deviceInformationService; + CurrentTimeClient currentTimeClient; + AlertNotificationService anService; + AlertNotificationClient alertNotificationClient; + CurrentTimeService currentTimeService; + MusicService musicService; + BatteryInformationService batteryInformationService; + ImmediateAlertService immediateAlertService; + + 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} + }; + }; + } +} diff --git a/src/components/ble/NotificationManager.cpp b/src/components/ble/NotificationManager.cpp new file mode 100644 index 0000000..0aea069 --- /dev/null +++ b/src/components/ble/NotificationManager.cpp @@ -0,0 +1,30 @@ +#include +#include "NotificationManager.h" + +using namespace Pinetime::Controllers; + +void NotificationManager::Push(Pinetime::Controllers::NotificationManager::Categories category, + const char *message, uint8_t currentMessageSize) { + // TODO handle edge cases on read/write index + auto checkedSize = std::min(currentMessageSize, uint8_t{18}); + auto& notif = notifications[writeIndex]; + std::memcpy(notif.message.data(), message, checkedSize); + notif.message[checkedSize] = '\0'; + notif.category = category; + + writeIndex = (writeIndex + 1 < TotalNbNotifications) ? writeIndex + 1 : 0; + if(!empty && writeIndex == readIndex) + readIndex = writeIndex + 1; +} + +NotificationManager::Notification Pinetime::Controllers::NotificationManager::Pop() { +// TODO handle edge cases on read/write index + NotificationManager::Notification notification = notifications[readIndex]; + + if(readIndex != writeIndex) { + readIndex = (readIndex + 1 < TotalNbNotifications) ? readIndex + 1 : 0; + } + + // TODO Check move optimization on return + return notification; +} diff --git a/src/components/ble/NotificationManager.h b/src/components/ble/NotificationManager.h new file mode 100644 index 0000000..daa1571 --- /dev/null +++ b/src/components/ble/NotificationManager.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +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{18}; + + struct Notification { + std::array message; + Categories category = Categories::Unknown; + }; + + void Push(Categories category, const char* message, uint8_t messageSize); + Notification Pop(); + + + private: + static constexpr uint8_t TotalNbNotifications = 5; + std::array notifications; + uint8_t readIndex = 0; + uint8_t writeIndex = 0; + bool empty = true; + }; + } +} \ No newline at end of file diff --git a/src/components/brightness/BrightnessController.cpp b/src/components/brightness/BrightnessController.cpp new file mode 100644 index 0000000..c8825d6 --- /dev/null +++ b/src/components/brightness/BrightnessController.cpp @@ -0,0 +1,70 @@ +#include +#include "BrightnessController.h" + +using namespace Pinetime::Controllers; + + +void BrightnessController::Init() { + nrf_gpio_cfg_output(pinLcdBacklight1); + nrf_gpio_cfg_output(pinLcdBacklight2); + nrf_gpio_cfg_output(pinLcdBacklight3); + Set(level); +} + +void BrightnessController::Set(BrightnessController::Levels level) { + this->level = level; + switch(level) { + default: + case Levels::High: + nrf_gpio_pin_clear(pinLcdBacklight1); + nrf_gpio_pin_clear(pinLcdBacklight2); + nrf_gpio_pin_clear(pinLcdBacklight3); + break; + case Levels::Medium: + nrf_gpio_pin_clear(pinLcdBacklight1); + nrf_gpio_pin_clear(pinLcdBacklight2); + nrf_gpio_pin_set(pinLcdBacklight3); + break; + case Levels::Low: + nrf_gpio_pin_clear(pinLcdBacklight1); + nrf_gpio_pin_set(pinLcdBacklight2); + nrf_gpio_pin_set(pinLcdBacklight3); + break; + case Levels::Off: + nrf_gpio_pin_set(pinLcdBacklight1); + nrf_gpio_pin_set(pinLcdBacklight2); + nrf_gpio_pin_set(pinLcdBacklight3); + break; + } +} + +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; + } +} + +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; + } +} + +BrightnessController::Levels BrightnessController::Level() const { + return level; +} + +void BrightnessController::Backup() { + backupLevel = level; +} + +void BrightnessController::Restore() { + Set(backupLevel); +} + diff --git a/src/components/brightness/BrightnessController.h b/src/components/brightness/BrightnessController.h new file mode 100644 index 0000000..b8354ec --- /dev/null +++ b/src/components/brightness/BrightnessController.h @@ -0,0 +1,28 @@ +#pragma once + +#include + +namespace Pinetime { + namespace Controllers { + class BrightnessController { + public: + enum class Levels {Off, Low, Medium, High}; + void Init(); + + void Set(Levels level); + Levels Level() const; + void Lower(); + void Higher(); + + void Backup(); + void Restore(); + + private: + static constexpr uint8_t pinLcdBacklight1 = 14; + static constexpr uint8_t pinLcdBacklight2 = 22; + static constexpr uint8_t pinLcdBacklight3 = 23; + Levels level = Levels::High; + Levels backupLevel = Levels::High; + }; + } +} diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp new file mode 100644 index 0000000..30d9c13 --- /dev/null +++ b/src/components/datetime/DateTimeController.cpp @@ -0,0 +1,66 @@ +#include "DateTimeController.h" +#include +#include + +using namespace Pinetime::Controllers; + + +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)); + + NRF_LOG_INFO("%d %d %d ", day, month, year); + NRF_LOG_INFO("%d %d %d ", hour, minute, second); + previousSystickCounter = systickCounter; + + UpdateTime(systickCounter); + NRF_LOG_INFO("* %d %d %d ", this->hour, this->minute, this->second); + NRF_LOG_INFO("* %d %d %d ", this->day, this->month, this->year); +} + +void DateTime::UpdateTime(uint32_t systickCounter) { + // Handle systick counter overflow + uint32_t systickDelta = 0; + if(systickCounter < previousSystickCounter) { + systickDelta = 0xffffff - previousSystickCounter; + systickDelta += systickCounter + 1; + } else { + systickDelta = systickCounter - previousSystickCounter; + } + + /* + * 1000 ms = 1024 ticks + */ + auto correctedDelta = systickDelta / 1024; + auto rest = (systickDelta - (correctedDelta*1024)); + if(systickCounter >= rest) { + previousSystickCounter = systickCounter - rest; + } else { + previousSystickCounter = 0xffffff - (rest - systickCounter); + } + + currentDateTime += std::chrono::seconds(correctedDelta); + uptime += std::chrono::seconds(correctedDelta); + + auto dp = date::floor(currentDateTime); + 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(); + dayOfWeek = static_cast(date::weekday(yearMonthDay).iso_encoding()); + + hour = time.hours().count(); + minute = time.minutes().count(); + second = time.seconds().count(); +} + diff --git a/src/components/datetime/DateTimeController.h b/src/components/datetime/DateTimeController.h new file mode 100644 index 0000000..d602074 --- /dev/null +++ b/src/components/datetime/DateTimeController.h @@ -0,0 +1,39 @@ +#pragma once + +#include +#include + +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}; + + 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; } + + std::chrono::time_point CurrentDateTime() const { return currentDateTime; } + std::chrono::seconds Uptime() const { return uptime; } + private: + 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; + + uint32_t previousSystickCounter = 0; + std::chrono::time_point currentDateTime; + std::chrono::seconds uptime {0}; + }; + } +} \ No newline at end of file diff --git a/src/components/firmwarevalidator/FirmwareValidator.cpp b/src/components/firmwarevalidator/FirmwareValidator.cpp new file mode 100644 index 0000000..244d5c0 --- /dev/null +++ b/src/components/firmwarevalidator/FirmwareValidator.cpp @@ -0,0 +1,20 @@ +#include +#include + +#include "FirmwareValidator.h" + +using namespace Pinetime::Controllers; + +bool FirmwareValidator::IsValidated() const { + auto* imageOkPtr = reinterpret_cast(validBitAdress); + return (*imageOkPtr) == validBitValue; +} + +void FirmwareValidator::Validate() { + if(!IsValidated()) + Pinetime::Drivers::InternalFlash::WriteWord(validBitAdress, validBitValue); +} + +void FirmwareValidator::Reset() { + NVIC_SystemReset(); +} diff --git a/src/components/firmwarevalidator/FirmwareValidator.h b/src/components/firmwarevalidator/FirmwareValidator.h new file mode 100644 index 0000000..aa576d8 --- /dev/null +++ b/src/components/firmwarevalidator/FirmwareValidator.h @@ -0,0 +1,18 @@ +#pragma once + +#include + +namespace Pinetime { + namespace Controllers { + class FirmwareValidator { + public: + void Validate(); + bool IsValidated() const; + + 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 new file mode 100644 index 0000000..3c5dbfb --- /dev/null +++ b/src/components/gfx/Gfx.cpp @@ -0,0 +1,207 @@ +#include +#include +#include +#include "Gfx.h" +#include "../../drivers/St7789.h" +using namespace Pinetime::Components; + +Gfx::Gfx(Pinetime::Drivers::St7789 &lcd) : lcd{lcd} { +} + +void Gfx::Init() { + +} + +void Gfx::ClearScreen() { + SetBackgroundColor(0x0000); + + state.remainingIterations = 240 + 1; + state.currentIteration = 0; + state.busy = true; + state.action = Action::FillRectangle; + state.taskToNotify = xTaskGetCurrentTaskHandle(); + + lcd.BeginDrawBuffer(0, 0, width, height); + lcd.NextDrawBuffer(reinterpret_cast(buffer), width * 2); + WaitTransfertFinished(); + +} + +void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t color) { + SetBackgroundColor(color); + + state.remainingIterations = h; + state.currentIteration = 0; + state.busy = true; + state.action = Action::FillRectangle; + state.color = color; + state.taskToNotify = xTaskGetCurrentTaskHandle(); + + lcd.BeginDrawBuffer(x, y, w, h); + lcd.NextDrawBuffer(reinterpret_cast(buffer), width * 2); + + WaitTransfertFinished(); +} + +void Gfx::FillRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint8_t* b) { + state.remainingIterations = h; + state.currentIteration = 0; + state.busy = true; + state.action = Action::FillRectangle; + state.color = 0x00; + state.taskToNotify = xTaskGetCurrentTaskHandle(); + + lcd.BeginDrawBuffer(x, y, w, h); + lcd.NextDrawBuffer(reinterpret_cast(b), width * 2); + + WaitTransfertFinished(); +} + +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; + } + + uint8_t current_x = x; + uint8_t current_y = y; + + for (size_t i = 0; text[i] != '\0'; i++) { + if (text[i] == '\n') { + current_x = x; + current_y += p_font->height + p_font->height / 10; + } else { + DrawChar(p_font, (uint8_t) text[i], ¤t_x, current_y, color); + } + + uint8_t char_idx = text[i] - p_font->startChar; + uint16_t char_width = text[i] == ' ' ? (p_font->height / 2) : p_font->charInfo[char_idx].widthBits; + + if (current_x > (width - char_width)) { + if (wrap) { + current_x = x; + current_y += p_font->height + p_font->height / 10; + } else { + break; + } + + if (y > (height - p_font->height)) { + break; + } + } + } +} + +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; + + if (c == ' ') { + *x += font->height / 2; + return; + } + + // Build first line + 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; + } + } + } + + state.remainingIterations = font->height + 0; + state.currentIteration = 0; + state.busy = true; + state.action = Action::DrawChar; + state.font = const_cast(font); + state.character = c; + state.color = color; + state.taskToNotify = xTaskGetCurrentTaskHandle(); + + lcd.BeginDrawBuffer(*x, y, bytes_in_line*8, font->height); + lcd.NextDrawBuffer(reinterpret_cast(&buffer), bytes_in_line*8*2); + WaitTransfertFinished(); + + *x += font->charInfo[char_idx].widthBits + font->spacePixels; +} + +void Gfx::pixel_draw(uint8_t x, uint8_t y, uint16_t color) { + lcd.DrawPixel(x, y, color); +} + +void Gfx::Sleep() { + lcd.Sleep(); +} + +void Gfx::Wakeup() { + lcd.Wakeup(); +} + +void Gfx::SetBackgroundColor(uint16_t color) { + for(int i = 0; i < width; i++) { + buffer[i] = color; + } +} + +bool Gfx::GetNextBuffer(uint8_t **data, size_t &size) { + if(!state.busy) return false; + state.remainingIterations--; + if (state.remainingIterations == 0) { + state.busy = false; + NotifyEndOfTransfert(state.taskToNotify); + return false; + } + + if(state.action == Action::FillRectangle) { + *data = reinterpret_cast(buffer); + size = width * 2; + } 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; + } + } + } + + *data = reinterpret_cast(buffer); + size = bytes_in_line*8*2; + } + + state.currentIteration++; + + return true; +} + +void Gfx::NotifyEndOfTransfert(TaskHandle_t task) { + if(task != nullptr) { + BaseType_t xHigherPriorityTaskWoken = pdFALSE; + vTaskNotifyGiveFromISR(task, &xHigherPriorityTaskWoken); + portYIELD_FROM_ISR(xHigherPriorityTaskWoken); + } +} + +void Gfx::WaitTransfertFinished() const { + ulTaskNotifyTake(pdTRUE, 500); +} + +void Gfx::SetScrollArea(uint16_t topFixedLines, uint16_t scrollLines, uint16_t bottomFixedLines) { + lcd.VerticalScrollDefinition(topFixedLines, scrollLines, bottomFixedLines); +} + +void Gfx::SetScrollStartLine(uint16_t line) { + lcd.VerticalScrollStartAddress(line); +} + diff --git a/src/components/gfx/Gfx.h b/src/components/gfx/Gfx.h new file mode 100644 index 0000000..091f06f --- /dev/null +++ b/src/components/gfx/Gfx.h @@ -0,0 +1,60 @@ +#pragma once +#include +#include +#include +#include +#include + + +namespace Pinetime { + namespace Drivers { + class St7789; + } + 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); + + + 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; + }; + + volatile State state; + + uint16_t buffer[width]; // 1 line buffer + Drivers::St7789& lcd; + + void SetBackgroundColor(uint16_t color); + void WaitTransfertFinished() const; + void NotifyEndOfTransfert(TaskHandle_t task); + }; + } +} diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index 46e81f1..d65e4f9 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -1,24 +1,25 @@ +#include + #include "DisplayApp.h" #include #include #include #include #include -#include +#include "components/datetime/DateTimeController.h" #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../SystemTask/SystemTask.h" +#include "displayapp/screens/Tile.h" +#include "displayapp/screens/Meter.h" +#include "displayapp/screens/Gauge.h" +#include "displayapp/screens/Brightness.h" +#include "displayapp/screens/SystemInfo.h" +#include "displayapp/screens/Music.h" +#include "components/ble/NotificationManager.h" +#include "displayapp/screens/FirmwareUpdate.h" +#include "displayapp/screens/ApplicationList.h" +#include "displayapp/screens/FirmwareValidation.h" +#include "displayapp/screens/InfiniPaint.h" +#include "systemtask/SystemTask.h" using namespace Pinetime::Applications; @@ -148,7 +149,7 @@ void DisplayApp::Refresh() { } } -// lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down); +// lvgl.SetFullRefresh(components::LittleVgl::FullRefreshDirections::Down); // currentScreen.reset(nullptr); // if(toggle) { // currentScreen.reset(new Screens::Tile(this)); diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index 345e06d..2a0efde 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -3,21 +3,21 @@ #include #include #include -#include #include #include -#include -#include -#include -#include -#include "../drivers/Cst816s.h" +#include "components/gfx/Gfx.h" +#include "components/battery/BatteryController.h" +#include "components/brightness/BrightnessController.h" +#include "components/ble/BleController.h" +#include "components/datetime/DateTimeController.h" +#include "components/ble/NotificationManager.h" +#include "components/firmwarevalidator/FirmwareValidator.h" +#include "drivers/Cst816s.h" #include "LittleVgl.h" #include -#include +#include "displayapp/screens/Clock.h" +#include "displayapp/screens/Modal.h" #include -#include -#include -#include #include "TouchEvents.h" #include "Apps.h" diff --git a/src/displayapp/Fonts/Readme.md b/src/displayapp/Fonts/Readme.md deleted file mode 100644 index 7ebf2e2..0000000 --- a/src/displayapp/Fonts/Readme.md +++ /dev/null @@ -1,23 +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.woff` and specify the following range : `0x20-0x7f` - * 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` - * 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 - * 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"; -``` diff --git a/src/displayapp/Fonts/jetbrains_mono_bold_20.c b/src/displayapp/Fonts/jetbrains_mono_bold_20.c deleted file mode 100644 index 27ad005..0000000 --- a/src/displayapp/Fonts/jetbrains_mono_bold_20.c +++ /dev/null @@ -1,766 +0,0 @@ -#include "lvgl/lvgl.h" - -/******************************************************************************* - * Size: 20 px - * Bpp: 1 - * Opts: - ******************************************************************************/ - -#ifndef JETBRAINS_MONO_BOLD_20 -#define JETBRAINS_MONO_BOLD_20 1 -#endif - -#if JETBRAINS_MONO_BOLD_20 - -/*----------------- - * BITMAPS - *----------------*/ - -/*Store the image of the glyphs*/ -static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { - /* U+20 " " */ - 0x0, - - /* U+21 "!" */ - 0xff, 0xff, 0xff, 0xe0, 0xf, 0xc0, - - /* U+22 "\"" */ - 0xef, 0xdf, 0xbf, 0x7e, 0xfd, 0xc0, - - /* U+23 "#" */ - 0x8, 0xc3, 0x10, 0x62, 0x3f, 0xf7, 0xfe, 0x23, - 0x4, 0x61, 0x88, 0x31, 0x1f, 0xfb, 0xff, 0x19, - 0x82, 0x30, 0xc4, 0x0, - - /* U+24 "$" */ - 0x8, 0x2, 0x1, 0xc1, 0xfe, 0xeb, 0xf2, 0x7c, - 0x83, 0xa0, 0x7c, 0xf, 0xc0, 0xf8, 0x27, 0x9, - 0xf2, 0x7f, 0xf9, 0xfc, 0x8, 0x2, 0x0, 0x80, - - /* U+25 "%" */ - 0x78, 0x1f, 0x83, 0x30, 0x66, 0x1f, 0xcc, 0xf2, - 0x1, 0x80, 0xde, 0x67, 0xf8, 0xcc, 0x19, 0x83, - 0x30, 0x7e, 0x7, 0x80, - - /* U+26 "&" */ - 0x1e, 0x7, 0xe1, 0xce, 0x38, 0x7, 0x0, 0x70, - 0x1e, 0x7, 0x66, 0xed, 0xdc, 0xf3, 0x9c, 0x73, - 0xcf, 0xfc, 0xf9, 0x80, - - /* U+27 "'" */ - 0xff, 0xff, 0xc0, - - /* U+28 "(" */ - 0x2, 0x1c, 0xfb, 0xc7, 0x1e, 0x38, 0x70, 0xe1, - 0xc3, 0x87, 0xe, 0x1c, 0x3c, 0x38, 0x38, 0x7c, - 0x38, - - /* U+29 ")" */ - 0x1, 0xc3, 0xc1, 0xc1, 0xc3, 0xc3, 0x87, 0xe, - 0x1c, 0x38, 0x70, 0xe1, 0xc7, 0x8e, 0x79, 0xe3, - 0x80, - - /* U+2A "*" */ - 0xc, 0x3, 0x8, 0xc7, 0xb7, 0x7f, 0x83, 0x1, - 0xe0, 0xcc, 0x73, 0x80, 0x0, - - /* U+2B "+" */ - 0x1c, 0x7, 0x1, 0xc3, 0xff, 0xff, 0xc7, 0x1, - 0xc0, 0x70, 0x1c, 0x0, - - /* U+2C "," */ - 0x7b, 0x9c, 0xce, 0x60, - - /* U+2D "-" */ - 0xff, 0xff, - - /* U+2E "." */ - 0x6f, 0xf6, - - /* U+2F "/" */ - 0x1, 0xc0, 0x60, 0x38, 0xe, 0x3, 0x1, 0xc0, - 0x70, 0x18, 0xe, 0x3, 0x1, 0xc0, 0x70, 0x18, - 0xe, 0x3, 0x80, 0xc0, 0x70, 0x18, 0xe, 0x0, - - /* U+30 "0" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xed, 0xfb, 0x7e, - 0xdf, 0xb7, 0xed, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, - 0x8f, 0x80, - - /* U+31 "1" */ - 0x3c, 0x3e, 0x3f, 0x13, 0x81, 0xc0, 0xe0, 0x70, - 0x38, 0x1c, 0xe, 0x7, 0x3, 0x8f, 0xff, 0xfc, - - /* U+32 "2" */ - 0x1f, 0x1f, 0xef, 0x3f, 0x87, 0x1, 0xc0, 0x70, - 0x38, 0x1e, 0xf, 0x7, 0x87, 0x83, 0xc0, 0xff, - 0xff, 0xf0, - - /* U+33 "3" */ - 0x7f, 0xdf, 0xf0, 0x3c, 0x1c, 0x1c, 0x7, 0xc1, - 0xf8, 0xf, 0x1, 0xc0, 0x7e, 0x1d, 0x8f, 0x7f, - 0x87, 0xc0, - - /* U+34 "4" */ - 0x7, 0x7, 0x3, 0x83, 0x83, 0x81, 0xc1, 0xcf, - 0xe7, 0xe3, 0xff, 0xff, 0xe0, 0x70, 0x38, 0x1c, - - /* U+35 "5" */ - 0xff, 0x7f, 0xb8, 0x1c, 0xe, 0x7, 0x73, 0xfd, - 0xcf, 0x3, 0x81, 0xc0, 0xfc, 0xff, 0xf1, 0xf0, - - /* U+36 "6" */ - 0x6, 0x3, 0x1, 0xc0, 0x60, 0x30, 0x1b, 0xc7, - 0xfb, 0xcf, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, - 0x87, 0x80, - - /* U+37 "7" */ - 0xff, 0xff, 0xfe, 0xb, 0x86, 0x1, 0x80, 0xc0, - 0x30, 0x18, 0x6, 0x3, 0x80, 0xc0, 0x70, 0x18, - 0xe, 0x0, - - /* U+38 "8" */ - 0x3e, 0x1f, 0xce, 0x3b, 0x6, 0xe3, 0x9f, 0xc7, - 0xf1, 0x8e, 0xc1, 0xf0, 0x7c, 0x1f, 0x8f, 0x7f, - 0x8f, 0x80, - - /* U+39 "9" */ - 0x1e, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, - 0x3d, 0xfe, 0x3d, 0x80, 0xc0, 0x60, 0x38, 0xc, - 0x6, 0x0, - - /* U+3A ":" */ - 0xff, 0x80, 0x0, 0xff, 0x80, - - /* U+3B ";" */ - 0x7b, 0xde, 0x0, 0x0, 0x0, 0x7b, 0x9c, 0xce, - 0x60, - - /* U+3C "<" */ - 0x0, 0x81, 0xc3, 0xe7, 0xcf, 0x6, 0x3, 0xc0, - 0x7c, 0xf, 0x81, 0xc0, 0x20, - - /* U+3D "=" */ - 0xff, 0xff, 0xc0, 0x0, 0x0, 0x7, 0xff, 0xfe, - - /* U+3E ">" */ - 0x0, 0x70, 0x3e, 0x7, 0xc0, 0xf8, 0xc, 0x1e, - 0x7c, 0xf8, 0x70, 0x20, 0x0, - - /* U+3F "?" */ - 0xfc, 0xfe, 0xf, 0x7, 0x7, 0xf, 0x3e, 0x3c, - 0x30, 0x30, 0x0, 0x0, 0x70, 0x70, - - /* U+40 "@" */ - 0x1f, 0x87, 0xf9, 0xc3, 0xf0, 0x3c, 0x77, 0x9f, - 0xf3, 0x1e, 0x63, 0xcc, 0x79, 0x8f, 0x31, 0xe7, - 0xfc, 0x77, 0xc0, 0x1c, 0x1, 0xf0, 0x1e, 0x0, - - /* U+41 "A" */ - 0xf, 0x0, 0xf0, 0xf, 0x1, 0xf8, 0x19, 0x81, - 0x98, 0x19, 0x83, 0x9c, 0x3f, 0xc3, 0xfc, 0x70, - 0xe7, 0xe, 0x60, 0x66, 0x6, - - /* U+42 "B" */ - 0xfe, 0x3f, 0xce, 0x3b, 0x8e, 0xe3, 0xb8, 0xcf, - 0xe3, 0xfc, 0xe3, 0xb8, 0x7e, 0x1f, 0x8f, 0xff, - 0xbf, 0xc0, - - /* U+43 "C" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe0, 0x38, 0xe, - 0x3, 0x80, 0xe0, 0x38, 0xe, 0x1f, 0xcf, 0x7f, - 0x8f, 0xc0, - - /* U+44 "D" */ - 0xfe, 0x3f, 0xee, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0x8f, 0xff, - 0xbf, 0x80, - - /* U+45 "E" */ - 0xff, 0xff, 0xf8, 0x1c, 0xe, 0x7, 0x3, 0xfd, - 0xfe, 0xe0, 0x70, 0x38, 0x1c, 0xf, 0xff, 0xfc, - - /* U+46 "F" */ - 0xff, 0xff, 0xf8, 0x1c, 0xe, 0x7, 0x3, 0xff, - 0xff, 0xe0, 0x70, 0x38, 0x1c, 0xe, 0x7, 0x0, - - /* U+47 "G" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe0, 0x38, 0xe, - 0x7f, 0x9f, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, - 0x87, 0x80, - - /* U+48 "H" */ - 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0xff, - 0xff, 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1c, - - /* U+49 "I" */ - 0xff, 0xff, 0xc7, 0x3, 0x81, 0xc0, 0xe0, 0x70, - 0x38, 0x1c, 0xe, 0x7, 0x3, 0x8f, 0xff, 0xfc, - - /* U+4A "J" */ - 0x3f, 0xcf, 0xf0, 0x1c, 0x7, 0x1, 0xc0, 0x70, - 0x1c, 0x7, 0x1, 0xc0, 0x7e, 0x1f, 0x8f, 0x7f, - 0x8f, 0xc0, - - /* U+4B "K" */ - 0xe1, 0xdc, 0x3b, 0x8e, 0x71, 0xce, 0x31, 0xce, - 0x3f, 0x87, 0xf0, 0xe7, 0x1c, 0x63, 0x8e, 0x70, - 0xce, 0x1d, 0xc3, 0x80, - - /* U+4C "L" */ - 0xe0, 0x70, 0x38, 0x1c, 0xe, 0x7, 0x3, 0x81, - 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0xf, 0xff, 0xfc, - - /* U+4D "M" */ - 0xe1, 0xf8, 0x7f, 0x3f, 0xcf, 0xda, 0xf7, 0xbd, - 0xef, 0x33, 0xc0, 0xf0, 0x3c, 0xf, 0x3, 0xc0, - 0xf0, 0x30, - - /* U+4E "N" */ - 0xe1, 0xf0, 0xfc, 0x7e, 0x3d, 0x9e, 0xcf, 0x67, - 0x9b, 0xcd, 0xe6, 0xf1, 0xf8, 0xfc, 0x3e, 0x1c, - - /* U+4F "O" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, - 0x8f, 0x80, - - /* U+50 "P" */ - 0xff, 0x3f, 0xee, 0x3f, 0x87, 0xe1, 0xf8, 0xff, - 0xfb, 0xfc, 0xe0, 0x38, 0xe, 0x3, 0x80, 0xe0, - 0x38, 0x0, - - /* U+51 "Q" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, - 0x8f, 0x80, 0x70, 0xe, 0x1, 0xc0, - - /* U+52 "R" */ - 0xff, 0x3f, 0xee, 0x3f, 0x87, 0xe1, 0xf8, 0xff, - 0xfb, 0xf8, 0xe6, 0x39, 0xce, 0x33, 0x8e, 0xe3, - 0xb8, 0x70, - - /* U+53 "S" */ - 0x3f, 0x1f, 0xee, 0x1f, 0x87, 0xe0, 0x3e, 0x7, - 0xf0, 0x7e, 0x3, 0xc0, 0x7e, 0x1f, 0xcf, 0x7f, - 0x8f, 0xc0, - - /* U+54 "T" */ - 0xff, 0xff, 0xf0, 0xe0, 0x38, 0xe, 0x3, 0x80, - 0xe0, 0x38, 0xe, 0x3, 0x80, 0xe0, 0x38, 0xe, - 0x3, 0x80, - - /* U+55 "U" */ - 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, - 0xc7, 0xe3, 0xf1, 0xf8, 0xfc, 0x77, 0xf1, 0xf0, - - /* U+56 "V" */ - 0x60, 0x66, 0x6, 0x70, 0xe7, 0xe, 0x30, 0xc3, - 0xc, 0x39, 0xc1, 0x98, 0x19, 0x81, 0x98, 0x1f, - 0x80, 0xf0, 0xf, 0x0, 0xf0, - - /* U+57 "W" */ - 0xc6, 0x78, 0xcf, 0x39, 0xe7, 0x3e, 0xa6, 0xd6, - 0xda, 0xdb, 0x5b, 0x6b, 0x6d, 0x2d, 0xe7, 0x3c, - 0xe7, 0x9c, 0xe3, 0x80, - - /* U+58 "X" */ - 0xe1, 0xd8, 0x67, 0x38, 0xcc, 0x3f, 0x7, 0x81, - 0xe0, 0x78, 0x1e, 0xf, 0xc3, 0x31, 0xce, 0xe1, - 0xf8, 0x70, - - /* U+59 "Y" */ - 0xe0, 0xfc, 0x1d, 0xc7, 0x38, 0xe3, 0x98, 0x77, - 0x6, 0xc0, 0xf8, 0xe, 0x1, 0xc0, 0x38, 0x7, - 0x0, 0xe0, 0x1c, 0x0, - - /* U+5A "Z" */ - 0xff, 0xff, 0xc0, 0xe0, 0xe0, 0x60, 0x70, 0x70, - 0x38, 0x38, 0x38, 0x1c, 0x1c, 0xf, 0xff, 0xfc, - - /* U+5B "[" */ - 0xff, 0xfe, 0x38, 0xe3, 0x8e, 0x38, 0xe3, 0x8e, - 0x38, 0xe3, 0x8e, 0x38, 0xff, 0xf0, - - /* U+5C "\\" */ - 0xe0, 0x18, 0x7, 0x1, 0xc0, 0x30, 0xe, 0x3, - 0x80, 0x60, 0x1c, 0x3, 0x0, 0xe0, 0x38, 0x6, - 0x1, 0xc0, 0x70, 0xc, 0x3, 0x80, 0x60, 0x1c, - - /* U+5D "]" */ - 0xff, 0xf1, 0xc7, 0x1c, 0x71, 0xc7, 0x1c, 0x71, - 0xc7, 0x1c, 0x71, 0xc7, 0xff, 0xf0, - - /* U+5E "^" */ - 0xc, 0x7, 0x81, 0xe0, 0xfc, 0x33, 0x1c, 0xe6, - 0x19, 0x86, - - /* U+5F "_" */ - 0xff, 0xff, 0xf0, - - /* U+60 "`" */ - 0x63, 0x8e, - - /* U+61 "a" */ - 0x3f, 0x1f, 0xee, 0x1c, 0x7, 0x3f, 0xdf, 0xfe, - 0x1f, 0x87, 0xe3, 0xff, 0xf7, 0xdc, - - /* U+62 "b" */ - 0xe0, 0x38, 0xe, 0x3, 0xbc, 0xff, 0xbc, 0xfe, - 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0xff, - 0xbb, 0xc0, - - /* U+63 "c" */ - 0x3f, 0x1f, 0xef, 0x1f, 0x83, 0xe0, 0x38, 0xe, - 0x3, 0x87, 0xf1, 0xdf, 0xe3, 0xe0, - - /* U+64 "d" */ - 0x1, 0xc0, 0x70, 0x1c, 0xf7, 0x7f, 0xfc, 0xfe, - 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, - 0xcf, 0x70, - - /* U+65 "e" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xff, 0xff, 0xfe, - 0x3, 0x80, 0xf1, 0xdf, 0xe3, 0xf0, - - /* U+66 "f" */ - 0xf, 0xc7, 0xf1, 0xc0, 0x70, 0xff, 0xff, 0xf1, - 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0x1c, - 0x7, 0x0, - - /* U+67 "g" */ - 0x3d, 0xdf, 0xff, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0xcf, 0x7f, 0xcf, 0x70, 0x1c, 0xf, 0x3f, - 0x8f, 0xc0, - - /* U+68 "h" */ - 0xe0, 0x70, 0x38, 0x1d, 0xcf, 0xf7, 0x9f, 0x8f, - 0xc7, 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1c, - - /* U+69 "i" */ - 0x1c, 0x7, 0x0, 0x0, 0x0, 0xfc, 0x3f, 0x1, - 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0x1c, - 0x3f, 0xff, 0xfc, - - /* U+6A "j" */ - 0x7, 0x7, 0x0, 0x0, 0x7f, 0x7f, 0x7, 0x7, - 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0xf, - 0xfe, 0xfc, - - /* U+6B "k" */ - 0xe0, 0x38, 0xe, 0x3, 0x87, 0xe1, 0xb8, 0xee, - 0x33, 0x9c, 0xfe, 0x3f, 0x8e, 0x73, 0x8e, 0xe3, - 0xb8, 0x70, - - /* U+6C "l" */ - 0xfe, 0x1f, 0xc0, 0x38, 0x7, 0x0, 0xe0, 0x1c, - 0x3, 0x80, 0x70, 0xe, 0x1, 0xc0, 0x38, 0x7, - 0x0, 0xfe, 0xf, 0xc0, - - /* U+6D "m" */ - 0xd9, 0xbf, 0xfc, 0xcf, 0x33, 0xcc, 0xf3, 0x3c, - 0xcf, 0x33, 0xcc, 0xf3, 0x3c, 0xcc, - - /* U+6E "n" */ - 0xee, 0x7f, 0xbc, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, - 0xc7, 0xe3, 0xf1, 0xf8, 0xe0, - - /* U+6F "o" */ - 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0x87, 0xf3, 0xdf, 0xe3, 0xf0, - - /* U+70 "p" */ - 0xef, 0x3f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0x87, 0xf3, 0xff, 0xee, 0xf3, 0x80, 0xe0, - 0x38, 0x0, - - /* U+71 "q" */ - 0x3d, 0xdf, 0xff, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, - 0x1f, 0x87, 0xf3, 0xdf, 0xf3, 0xdc, 0x7, 0x1, - 0xc0, 0x70, - - /* U+72 "r" */ - 0xef, 0x3f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0xe, - 0x3, 0x80, 0xe0, 0x38, 0xe, 0x0, - - /* U+73 "s" */ - 0x3f, 0x3f, 0xee, 0x1f, 0x80, 0xfc, 0x1f, 0xe0, - 0x3c, 0x7, 0xe1, 0xff, 0xe3, 0xf0, - - /* U+74 "t" */ - 0x1c, 0x7, 0x1, 0xc3, 0xff, 0xff, 0xc7, 0x1, - 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0xf, - 0xc1, 0xf0, - - /* U+75 "u" */ - 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, - 0xc7, 0xe3, 0xbf, 0x8f, 0x80, - - /* U+76 "v" */ - 0xc0, 0xf8, 0x76, 0x19, 0x86, 0x73, 0x8c, 0xc3, - 0x30, 0xfc, 0x1e, 0x7, 0x81, 0xe0, - - /* U+77 "w" */ - 0xc6, 0x79, 0xcf, 0x39, 0xb5, 0x36, 0xa6, 0xd6, - 0xda, 0xdb, 0x4e, 0x79, 0xcf, 0x38, 0xc7, 0x0, - - /* U+78 "x" */ - 0xe1, 0xdc, 0xe3, 0x30, 0xfc, 0x1e, 0x7, 0x81, - 0xe0, 0xfc, 0x73, 0x9c, 0x6e, 0x1c, - - /* U+79 "y" */ - 0xe1, 0xf8, 0x76, 0x19, 0xce, 0x33, 0x8e, 0xc3, - 0xf0, 0x7c, 0x1e, 0x3, 0x80, 0xc0, 0x70, 0x1c, - 0x6, 0x0, - - /* U+7A "z" */ - 0xff, 0xff, 0xc1, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, - 0xe0, 0xe0, 0x7f, 0xff, 0xe0, - - /* U+7B "{" */ - 0x7, 0x87, 0xc3, 0x81, 0xc0, 0xe0, 0x70, 0x38, - 0x1c, 0xfc, 0x7e, 0x3, 0x81, 0xc0, 0xe0, 0x70, - 0x38, 0x1c, 0xf, 0x83, 0xc0, - - /* U+7C "|" */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, - - /* U+7D "}" */ - 0xf0, 0x3f, 0x1, 0xc0, 0x70, 0x1c, 0x7, 0x1, - 0xc0, 0x70, 0xf, 0xc3, 0xf1, 0xc0, 0x70, 0x1c, - 0x7, 0x1, 0xc0, 0x70, 0xf8, 0x3c, 0x0, - - /* U+7E "~" */ - 0x78, 0xff, 0x3c, 0xff, 0x1e, - - /* U+F001 "" */ - 0x0, 0x0, 0x70, 0x0, 0x7f, 0x0, 0x3f, 0xf0, - 0x1f, 0xff, 0x7, 0xff, 0xf0, 0x7f, 0xff, 0x7, - 0xfc, 0x70, 0x7e, 0x7, 0x7, 0x0, 0x70, 0x70, - 0x7, 0x7, 0x0, 0x70, 0x70, 0x7, 0x7, 0x0, - 0x70, 0x70, 0x7f, 0x7, 0xf, 0xf7, 0xf0, 0xff, - 0xff, 0x7, 0xef, 0xf0, 0x0, 0xff, 0x0, 0x3, - 0xc0, 0x0, - - /* U+F017 "" */ - 0x3, 0xf8, 0x1, 0xff, 0xc0, 0x7f, 0xfc, 0x1f, - 0xff, 0xc7, 0xf1, 0xfc, 0xfe, 0x3f, 0x9f, 0xc7, - 0xf7, 0xf8, 0xff, 0xff, 0x1f, 0xff, 0xe3, 0xff, - 0xfc, 0x3f, 0xff, 0x83, 0xff, 0xfc, 0x7e, 0xff, - 0xcf, 0x9f, 0xff, 0xf1, 0xff, 0xfc, 0x1f, 0xff, - 0x1, 0xff, 0xc0, 0x1f, 0xf0, 0x0, 0x70, 0x0, - - /* U+F03A "" */ - 0xf0, 0x0, 0xf, 0x3f, 0xff, 0xf3, 0xff, 0xff, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0xf, 0x0, 0x0, 0xf3, 0xff, 0xff, 0x3f, - 0xff, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0xf, 0x0, 0x0, 0xf3, 0xff, 0xff, 0x3f, 0xff, - 0xf0, 0x0, 0x0, - - /* U+F069 "" */ - 0x0, 0xe0, 0x0, 0x1c, 0x0, 0x3, 0x80, 0x0, - 0x70, 0x6, 0xe, 0xc, 0xf1, 0xc7, 0x9f, 0xbb, - 0xf1, 0xff, 0xfc, 0xf, 0xfe, 0x0, 0x7f, 0x0, - 0xf, 0xe0, 0x7, 0xff, 0x3, 0xff, 0xf8, 0xfd, - 0xdf, 0x9e, 0x38, 0xf3, 0x7, 0x6, 0x0, 0xe0, - 0x0, 0x1c, 0x0, 0x3, 0x80, 0x0, 0x70, 0x0, - - /* U+F129 "" */ - 0x3c, 0x7e, 0x7e, 0x7e, 0x3c, 0x0, 0x0, 0xfc, - 0xfc, 0xfc, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, - 0xff, 0xff, 0xff, - - /* U+F185 "" */ - 0x0, 0x60, 0x0, 0x6, 0x0, 0x0, 0xf0, 0x1, - 0xcf, 0x38, 0x1f, 0xff, 0x81, 0xf0, 0xf8, 0xc, - 0xf3, 0x1, 0xdf, 0xb8, 0x7b, 0xfd, 0xef, 0xbf, - 0xdf, 0x7b, 0xfd, 0xe1, 0x9f, 0x98, 0xc, 0xf3, - 0x0, 0xc0, 0x30, 0x1f, 0xf, 0x81, 0xff, 0xf8, - 0x1c, 0xf3, 0x80, 0xf, 0x0, 0x0, 0x60, 0x0, - 0x6, 0x0, - - /* U+F1E6 "" */ - 0x18, 0x30, 0x70, 0x70, 0xe0, 0xe1, 0xc1, 0xc3, - 0x83, 0x80, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x7f, - 0xfc, 0xff, 0xf9, 0xff, 0xf1, 0xff, 0xc3, 0xff, - 0x83, 0xfe, 0x3, 0xf8, 0x1, 0xc0, 0x3, 0x80, - 0x7, 0x0, 0xe, 0x0, - - /* U+F1FC "" */ - 0x0, 0x0, 0xf0, 0x0, 0x1f, 0x0, 0x3, 0xf0, - 0x0, 0x7e, 0x0, 0xf, 0xe0, 0x3, 0xfc, 0x0, - 0x7f, 0xc0, 0xf, 0xf8, 0x0, 0xff, 0x80, 0x1f, - 0xf0, 0x0, 0xfe, 0x0, 0xf, 0xe0, 0xe, 0x7c, - 0x1, 0xf8, 0x0, 0x9f, 0xc0, 0xf, 0xfc, 0x0, - 0x7f, 0xc0, 0x7, 0xf8, 0x0, 0x1f, 0x0, 0x0, - - /* U+F21E "" */ - 0x1e, 0x7, 0x83, 0xf9, 0xfe, 0x7f, 0xff, 0xef, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xfc, - 0xf7, 0xf7, 0xd6, 0x3e, 0x79, 0x6b, 0xe0, 0x34, - 0x80, 0x1f, 0x9f, 0x80, 0xf9, 0xf0, 0x7, 0xfe, - 0x0, 0x3f, 0xc0, 0x1, 0xf8, 0x0, 0xf, 0x0, - 0x0, 0x60, 0x0, - - /* U+F240 "" */ - 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, - 0x1, 0xfd, 0xff, 0xfe, 0xfe, 0xff, 0xff, 0x7f, - 0x7f, 0xff, 0x9f, 0xbf, 0xff, 0xcf, 0xdf, 0xff, - 0xe7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, - 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, - - /* U+F241 "" */ - 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, - 0x1, 0xfd, 0xff, 0xe0, 0xfe, 0xff, 0xf0, 0x7f, - 0x7f, 0xf8, 0x1f, 0xbf, 0xfc, 0xf, 0xdf, 0xfe, - 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, - 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, - - /* U+F242 "" */ - 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, - 0x1, 0xfd, 0xfe, 0x0, 0xfe, 0xff, 0x0, 0x7f, - 0x7f, 0x80, 0x1f, 0xbf, 0xc0, 0xf, 0xdf, 0xe0, - 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, - 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, - - /* U+F243 "" */ - 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, - 0x1, 0xfd, 0xf0, 0x0, 0xfe, 0xf8, 0x0, 0x7f, - 0x7c, 0x0, 0x1f, 0xbe, 0x0, 0xf, 0xdf, 0x0, - 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, - 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, - - /* U+F244 "" */ - 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, - 0x1, 0xfc, 0x0, 0x0, 0xfe, 0x0, 0x0, 0x7f, - 0x0, 0x0, 0x1f, 0x80, 0x0, 0xf, 0xc0, 0x0, - 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, - 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, - - /* U+F293 "" */ - 0x7, 0xe0, 0x3f, 0xe0, 0xfb, 0xe3, 0xf3, 0xe7, - 0xe3, 0xdf, 0xd3, 0xf9, 0xb3, 0xf9, 0x4f, 0xf8, - 0x3f, 0xf8, 0xff, 0xf1, 0xff, 0xc1, 0xff, 0x29, - 0xfc, 0xd9, 0xff, 0xa7, 0xbf, 0x1e, 0x7e, 0x7c, - 0x7d, 0xf0, 0x7f, 0xe0, 0x7f, 0x0, - - /* U+F294 "" */ - 0x0, 0x0, 0x80, 0x18, 0x3, 0x80, 0x78, 0x8d, - 0xb9, 0x9b, 0xb6, 0x3f, 0x83, 0xe0, 0x38, 0x7, - 0x81, 0xf8, 0x6d, 0x99, 0x9a, 0x36, 0x7, 0x80, - 0xe0, 0x18, 0x2, 0x0, 0x0, - - /* U+F3FD "" */ - 0x0, 0xfe, 0x0, 0x7, 0xff, 0x0, 0x3f, 0xbf, - 0x80, 0xfe, 0x2f, 0x83, 0xfe, 0xcf, 0x8f, 0x3f, - 0x27, 0x9e, 0x7e, 0x4f, 0x3f, 0xfc, 0xfe, 0xff, - 0xf3, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xcf, 0xff, - 0xfe, 0x3f, 0xfe, 0x78, 0x3c, 0xff, 0xf0, 0x7f, - 0xdf, 0xe0, 0xff, 0x3f, 0xff, 0xfe, 0x3f, 0xff, - 0xf8, - - /* U+F54B "" */ - 0x0, 0xf, 0xf8, 0x1, 0xdf, 0xff, 0x1, 0xef, - 0xff, 0xc0, 0xf7, 0xff, 0xf0, 0x7b, 0xff, 0xf8, - 0x1d, 0xff, 0xfc, 0x0, 0x1f, 0xfc, 0x0, 0x3, - 0xfc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x7, 0xf8, 0x0, 0xf, 0xfe, - 0x3, 0xbf, 0xff, 0x83, 0xdf, 0xff, 0xc1, 0xef, - 0xff, 0xe0, 0xf7, 0xff, 0xe0, 0x3b, 0xff, 0xe0, - 0x0, 0x7f, 0xc0, 0x0, - - /* U+F560 "" */ - 0x0, 0x0, 0x0, 0x0, 0x60, 0x0, 0xf, 0x0, - 0x1, 0xf0, 0x8, 0x3e, 0x1, 0xc7, 0xc4, 0x1e, - 0xf8, 0xe1, 0xff, 0x1f, 0xf, 0xe3, 0xf0, 0x7c, - 0x7e, 0x23, 0x8f, 0xc7, 0x11, 0xf8, 0xf8, 0x3f, - 0xf, 0xc7, 0xe0, 0x7e, 0xfc, 0x3, 0xff, 0x80, - 0x1f, 0xf0, 0x0, 0xfe, 0x0, 0x7, 0xc0, 0x0, - 0x38, 0x0, 0x1, 0x0, 0x0 -}; - - -/*--------------------- - * GLYPH DESCRIPTION - *--------------------*/ - -static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { - {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, - {.bitmap_index = 0, .adv_w = 192, .box_w = 1, .box_h = 1, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 1, .adv_w = 192, .box_w = 3, .box_h = 14, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 7, .adv_w = 192, .box_w = 7, .box_h = 6, .ofs_x = 3, .ofs_y = 8}, - {.bitmap_index = 13, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 33, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 57, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 77, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 97, .adv_w = 192, .box_w = 3, .box_h = 6, .ofs_x = 5, .ofs_y = 8}, - {.bitmap_index = 100, .adv_w = 192, .box_w = 7, .box_h = 19, .ofs_x = 3, .ofs_y = -2}, - {.bitmap_index = 117, .adv_w = 192, .box_w = 7, .box_h = 19, .ofs_x = 2, .ofs_y = -2}, - {.bitmap_index = 134, .adv_w = 192, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 1}, - {.bitmap_index = 147, .adv_w = 192, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = 2}, - {.bitmap_index = 159, .adv_w = 192, .box_w = 5, .box_h = 6, .ofs_x = 3, .ofs_y = -3}, - {.bitmap_index = 163, .adv_w = 192, .box_w = 8, .box_h = 2, .ofs_x = 2, .ofs_y = 5}, - {.bitmap_index = 165, .adv_w = 192, .box_w = 4, .box_h = 4, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 167, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 191, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 209, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 225, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 243, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 261, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 277, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 293, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 311, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 329, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 347, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 365, .adv_w = 192, .box_w = 3, .box_h = 11, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 370, .adv_w = 192, .box_w = 5, .box_h = 14, .ofs_x = 3, .ofs_y = -3}, - {.bitmap_index = 379, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 1}, - {.bitmap_index = 392, .adv_w = 192, .box_w = 9, .box_h = 7, .ofs_x = 2, .ofs_y = 3}, - {.bitmap_index = 400, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 1}, - {.bitmap_index = 413, .adv_w = 192, .box_w = 8, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 427, .adv_w = 192, .box_w = 11, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 451, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 472, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 490, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 508, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 526, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 542, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 558, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 576, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 592, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 608, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 626, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 646, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 662, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 680, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 696, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 714, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 732, .adv_w = 192, .box_w = 10, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 754, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 772, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 790, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 808, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 824, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 845, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 865, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 883, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 903, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 919, .adv_w = 192, .box_w = 6, .box_h = 18, .ofs_x = 4, .ofs_y = -2}, - {.bitmap_index = 933, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 957, .adv_w = 192, .box_w = 6, .box_h = 18, .ofs_x = 3, .ofs_y = -2}, - {.bitmap_index = 971, .adv_w = 192, .box_w = 10, .box_h = 8, .ofs_x = 1, .ofs_y = 6}, - {.bitmap_index = 981, .adv_w = 192, .box_w = 10, .box_h = 2, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 984, .adv_w = 192, .box_w = 5, .box_h = 3, .ofs_x = 3, .ofs_y = 13}, - {.bitmap_index = 986, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1000, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1018, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1032, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1050, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1064, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1082, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 1100, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1116, .adv_w = 192, .box_w = 10, .box_h = 15, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1135, .adv_w = 192, .box_w = 8, .box_h = 18, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 1153, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1171, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 1191, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1205, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1218, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1232, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 1250, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 1268, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1282, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1296, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1314, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1327, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1341, .adv_w = 192, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, - {.bitmap_index = 1357, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, - {.bitmap_index = 1371, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 1389, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, - {.bitmap_index = 1402, .adv_w = 192, .box_w = 9, .box_h = 18, .ofs_x = 2, .ofs_y = -2}, - {.bitmap_index = 1423, .adv_w = 192, .box_w = 3, .box_h = 18, .ofs_x = 5, .ofs_y = -2}, - {.bitmap_index = 1430, .adv_w = 192, .box_w = 10, .box_h = 18, .ofs_x = 1, .ofs_y = -2}, - {.bitmap_index = 1453, .adv_w = 192, .box_w = 10, .box_h = 4, .ofs_x = 1, .ofs_y = 5}, - {.bitmap_index = 1458, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 1508, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 1556, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 1599, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 1647, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 1666, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 1716, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 1752, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 1800, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 1843, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 1881, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 1919, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 1957, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 1995, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, - {.bitmap_index = 2033, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3}, - {.bitmap_index = 2071, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, - {.bitmap_index = 2100, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, - {.bitmap_index = 2149, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, - {.bitmap_index = 2209, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3} -}; - -/*--------------------- - * CHARACTER MAPPING - *--------------------*/ - -static const uint16_t unicode_list_1[] = { - 0x0, 0x16, 0x39, 0x68, 0x128, 0x184, 0x1e5, 0x1fb, - 0x21d, 0x23f, 0x240, 0x241, 0x242, 0x243, 0x292, 0x293, - 0x3fc, 0x54a, 0x55f -}; - -/*Collect the unicode lists and glyph_id offsets*/ -static const lv_font_fmt_txt_cmap_t cmaps[] = -{ - { - .range_start = 32, .range_length = 95, .glyph_id_start = 1, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - }, - { - .range_start = 61441, .range_length = 1376, .glyph_id_start = 96, - .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 19, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY - } -}; - - - -/*-------------------- - * ALL CUSTOM DATA - *--------------------*/ - -/*Store all the custom data of the font*/ -static lv_font_fmt_txt_dsc_t font_dsc = { - .glyph_bitmap = gylph_bitmap, - .glyph_dsc = glyph_dsc, - .cmaps = cmaps, - .kern_dsc = NULL, - .kern_scale = 0, - .cmap_num = 2, - .bpp = 1, - .kern_classes = 0, - .bitmap_format = 0 -}; - - -/*----------------- - * PUBLIC FONT - *----------------*/ - -/*Initialize a public general font descriptor*/ -lv_font_t jetbrains_mono_bold_20 = { - .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ - .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ - .line_height = 21, /*The maximum line height required by the font*/ - .base_line = 3, /*Baseline measured from the bottom of the line*/ -#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) - .subpx = LV_FONT_SUBPX_NONE, -#endif - .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ -}; - -#endif /*#if JETBRAINS_MONO_BOLD_20*/ - diff --git a/src/displayapp/Fonts/jetbrains_mono_extrabold_compressed.c b/src/displayapp/Fonts/jetbrains_mono_extrabold_compressed.c deleted file mode 100644 index c9917e4..0000000 --- a/src/displayapp/Fonts/jetbrains_mono_extrabold_compressed.c +++ /dev/null @@ -1,507 +0,0 @@ -#include "lvgl/lvgl.h" - -/******************************************************************************* - * Size: 80 px - * Bpp: 1 - * Opts: - ******************************************************************************/ - -#ifndef JETBRAINS_MONO_EXTRABOLD_COMPRESSED -#define JETBRAINS_MONO_EXTRABOLD_COMPRESSED 1 -#endif - -#if JETBRAINS_MONO_EXTRABOLD_COMPRESSED - -/*----------------- - * BITMAPS - *----------------*/ - -/*Store the image of the glyphs*/ -static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { - /* U+30 "0" */ - 0x0, 0x1, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, - 0xfe, 0x0, 0x0, 0x1f, 0xff, 0xff, 0xc0, 0x0, - 0x3f, 0xff, 0xff, 0xf8, 0x0, 0x3f, 0xff, 0xff, - 0xfe, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x80, 0x3f, - 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, - 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, - 0xff, 0xff, 0xff, 0x1f, 0xff, 0xe0, 0x3f, 0xff, - 0xcf, 0xff, 0xc0, 0x7, 0xff, 0xe7, 0xff, 0xc0, - 0x1, 0xff, 0xf7, 0xff, 0xc0, 0x0, 0x7f, 0xff, - 0xff, 0xe0, 0x0, 0x3f, 0xff, 0xff, 0xe0, 0x0, - 0xf, 0xff, 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, - 0xf8, 0x0, 0x3, 0xff, 0xff, 0xfc, 0x0, 0x1, - 0xff, 0xff, 0xfe, 0x0, 0x0, 0xff, 0xff, 0xff, - 0x0, 0x0, 0x7f, 0xff, 0xff, 0x80, 0x0, 0x3f, - 0xff, 0xff, 0xc0, 0x70, 0x1f, 0xff, 0xff, 0xe0, - 0x7c, 0xf, 0xff, 0xff, 0xf0, 0x7f, 0x7, 0xff, - 0xff, 0xf8, 0x3f, 0x83, 0xff, 0xff, 0xfc, 0x1f, - 0xc1, 0xff, 0xff, 0xfe, 0xf, 0xe0, 0xff, 0xff, - 0xff, 0x7, 0xf0, 0x7f, 0xff, 0xff, 0x83, 0xf8, - 0x3f, 0xff, 0xff, 0xc1, 0xfc, 0x1f, 0xff, 0xff, - 0xe0, 0xfe, 0xf, 0xff, 0xff, 0xf0, 0x7f, 0x7, - 0xff, 0xff, 0xf8, 0x3f, 0x83, 0xff, 0xff, 0xfc, - 0x1f, 0xc1, 0xff, 0xff, 0xfe, 0xf, 0xe0, 0xff, - 0xff, 0xff, 0x3, 0xe0, 0x7f, 0xff, 0xff, 0x80, - 0xe0, 0x3f, 0xff, 0xff, 0xc0, 0x0, 0x1f, 0xff, - 0xff, 0xe0, 0x0, 0xf, 0xff, 0xff, 0xf0, 0x0, - 0x7, 0xff, 0xff, 0xf8, 0x0, 0x3, 0xff, 0xff, - 0xfc, 0x0, 0x1, 0xff, 0xff, 0xfe, 0x0, 0x0, - 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, - 0xc0, 0x0, 0x7f, 0xf9, 0xff, 0xf0, 0x0, 0x7f, - 0xfc, 0xff, 0xfc, 0x0, 0x7f, 0xfe, 0x7f, 0xff, - 0x80, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, - 0x7, 0xff, 0xff, 0xff, 0xff, 0x3, 0xff, 0xff, - 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0x80, - 0x3f, 0xff, 0xff, 0xff, 0x80, 0xf, 0xff, 0xff, - 0xff, 0x80, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, - 0x7f, 0xff, 0xff, 0x0, 0x0, 0xf, 0xff, 0xfc, - 0x0, 0x0, 0x0, 0x7f, 0xf0, 0x0, 0x0, - - /* U+31 "1" */ - 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0xf, 0xff, - 0xe0, 0x0, 0x0, 0x3f, 0xff, 0xe0, 0x0, 0x0, - 0x7f, 0xff, 0xe0, 0x0, 0x1, 0xff, 0xff, 0xe0, - 0x0, 0x3, 0xff, 0xff, 0xe0, 0x0, 0x7, 0xff, - 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xe0, 0x0, - 0x3f, 0xff, 0xff, 0xe0, 0x0, 0x7f, 0xff, 0xff, - 0xe0, 0x0, 0x7f, 0xff, 0xff, 0xe0, 0x0, 0x7f, - 0xfd, 0xff, 0xe0, 0x0, 0x7f, 0xf9, 0xff, 0xe0, - 0x0, 0x7f, 0xf1, 0xff, 0xe0, 0x0, 0x7f, 0xe1, - 0xff, 0xe0, 0x0, 0x7f, 0x81, 0xff, 0xe0, 0x0, - 0x7f, 0x1, 0xff, 0xe0, 0x0, 0x7c, 0x1, 0xff, - 0xe0, 0x0, 0x78, 0x1, 0xff, 0xe0, 0x0, 0x60, - 0x1, 0xff, 0xe0, 0x0, 0x40, 0x1, 0xff, 0xe0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, - 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, - 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, - 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, - 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, - 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, - 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, - 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, - 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, - 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, - 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, - - /* U+32 "2" */ - 0x0, 0x1, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, - 0xfc, 0x0, 0x0, 0x1f, 0xff, 0xff, 0x80, 0x0, - 0x3f, 0xff, 0xff, 0xf0, 0x0, 0x3f, 0xff, 0xff, - 0xfc, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x0, 0x3f, - 0xff, 0xff, 0xff, 0xc0, 0x3f, 0xff, 0xff, 0xff, - 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, - 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xe0, 0x7f, 0xff, - 0x8f, 0xff, 0xc0, 0xf, 0xff, 0xc7, 0xff, 0xc0, - 0x3, 0xff, 0xe7, 0xff, 0xc0, 0x0, 0xff, 0xfb, - 0xff, 0xc0, 0x0, 0x7f, 0xfd, 0xff, 0xe0, 0x0, - 0x1f, 0xfe, 0xff, 0xf0, 0x0, 0xf, 0xff, 0x0, - 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, - 0xff, 0xc0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, - 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, - 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x0, 0x3f, 0xfe, - 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, - 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, - 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, - 0xff, 0x80, 0x0, 0x0, 0x7f, 0xff, 0x80, 0x0, - 0x0, 0x7f, 0xff, 0x80, 0x0, 0x0, 0x7f, 0xff, - 0x80, 0x0, 0x0, 0x7f, 0xff, 0x80, 0x0, 0x0, - 0xff, 0xff, 0x80, 0x0, 0x0, 0xff, 0xff, 0x80, - 0x0, 0x0, 0xff, 0xff, 0x80, 0x0, 0x0, 0xff, - 0xff, 0x80, 0x0, 0x1, 0xff, 0xff, 0x0, 0x0, - 0x1, 0xff, 0xff, 0x0, 0x0, 0x1, 0xff, 0xff, - 0x0, 0x0, 0x1, 0xff, 0xfe, 0x0, 0x0, 0x3, - 0xff, 0xfe, 0x0, 0x0, 0x3, 0xff, 0xfe, 0x0, - 0x0, 0x3, 0xff, 0xfc, 0x0, 0x0, 0x3, 0xff, - 0xfc, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, - 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, - 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, - 0xdf, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, - 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xfb, - 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, - 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, - 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, - 0xff, 0xc0, - - /* U+33 "3" */ - 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, 0xff, 0xff, - 0xff, 0xff, 0x7, 0xff, 0xff, 0xff, 0xff, 0x83, - 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, - 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x7f, - 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, - 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, 0xff, - 0xff, 0x8f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, - 0x80, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, - 0x1f, 0xff, 0x80, 0x0, 0x0, 0x3f, 0xff, 0x80, - 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, - 0xff, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, - 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfe, - 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, - 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, - 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, 0xf, - 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, 0xff, 0x0, - 0x0, 0x3, 0xff, 0xff, 0xe0, 0x0, 0x1, 0xff, - 0xff, 0xf8, 0x0, 0x0, 0xff, 0xff, 0xfe, 0x0, - 0x0, 0x7f, 0xff, 0xff, 0x80, 0x0, 0x3f, 0xff, - 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf0, 0x0, - 0xf, 0xff, 0xff, 0xfc, 0x0, 0x0, 0x0, 0xff, - 0xfe, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, - 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x1, 0xff, - 0xe0, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, - 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, 0xfe, - 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, - 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, - 0x0, 0x0, 0x1, 0xff, 0xff, 0xfe, 0x0, 0x0, - 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, - 0xc0, 0x0, 0x7f, 0xf9, 0xff, 0xf0, 0x0, 0x7f, - 0xfc, 0xff, 0xfc, 0x0, 0x7f, 0xfe, 0x7f, 0xff, - 0x80, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, - 0xf, 0xff, 0xff, 0xff, 0xff, 0x3, 0xff, 0xff, - 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0x80, - 0x3f, 0xff, 0xff, 0xff, 0x80, 0xf, 0xff, 0xff, - 0xff, 0x80, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, - 0x7f, 0xff, 0xff, 0x0, 0x0, 0xf, 0xff, 0xfc, - 0x0, 0x0, 0x0, 0x7f, 0xf0, 0x0, 0x0, - - /* U+34 "4" */ - 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, 0x1f, - 0xff, 0x80, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, - 0x3, 0xff, 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x80, - 0x0, 0x0, 0xff, 0xfc, 0x0, 0x0, 0x3, 0xff, - 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, - 0xff, 0xfc, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, - 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xff, 0xfc, - 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3f, - 0xff, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, - 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3f, 0xff, 0x0, - 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, - 0xc0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x1, - 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, - 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x1, 0xff, 0xf8, - 0x0, 0x0, 0xf, 0xff, 0xc0, 0x0, 0x0, 0x3f, - 0xfe, 0x0, 0xff, 0xf1, 0xff, 0xf0, 0x3, 0xff, - 0xcf, 0xff, 0xc0, 0xf, 0xff, 0x7f, 0xfe, 0x0, - 0x3f, 0xfd, 0xff, 0xf0, 0x0, 0xff, 0xff, 0xff, - 0xc0, 0x3, 0xff, 0xff, 0xfe, 0x0, 0xf, 0xff, - 0xff, 0xf0, 0x0, 0x3f, 0xff, 0xff, 0x80, 0x0, - 0xff, 0xff, 0xfe, 0x0, 0x3, 0xff, 0xff, 0xf8, - 0x0, 0xf, 0xff, 0xff, 0xe0, 0x0, 0x3f, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, - 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, - 0xfc, 0x0, 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, - 0x3, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, 0x0, - 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0xff, - 0xf0, 0x0, 0x0, 0x3, 0xff, 0xc0, 0x0, 0x0, - 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, - 0x0, 0x0, 0xff, 0xf0, - - /* U+35 "5" */ - 0x3f, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, - 0xff, 0xff, 0xf, 0xff, 0xff, 0xff, 0xff, 0x87, - 0xff, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, - 0xff, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, - 0xff, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff, 0xff, - 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, - 0xff, 0xff, 0xff, 0xf, 0xff, 0x0, 0x0, 0x0, - 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, - 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x0, - 0xff, 0xf0, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, - 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, - 0xfe, 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, - 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, - 0xc0, 0x7f, 0x80, 0x1, 0xff, 0xe1, 0xff, 0xf8, - 0x0, 0xff, 0xf1, 0xff, 0xff, 0x0, 0x7f, 0xf9, - 0xff, 0xff, 0xc0, 0x3f, 0xfd, 0xff, 0xff, 0xf0, - 0x1f, 0xff, 0xff, 0xff, 0xfc, 0xf, 0xff, 0xff, - 0xff, 0xff, 0x7, 0xff, 0xff, 0xff, 0xff, 0xc3, - 0xff, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xfc, 0x7, - 0xff, 0xf8, 0xff, 0xf8, 0x0, 0xff, 0xfc, 0x0, - 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0xf, - 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x0, 0xff, - 0xf0, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, - 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, 0xfe, - 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, - 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, - 0x0, 0x0, 0x1, 0xff, 0xff, 0xff, 0x0, 0x1, - 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xfb, 0xff, - 0xe0, 0x0, 0xff, 0xf9, 0xff, 0xf8, 0x0, 0xff, - 0xfc, 0xff, 0xff, 0x81, 0xff, 0xfe, 0x3f, 0xff, - 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, - 0x7, 0xff, 0xff, 0xff, 0xff, 0x1, 0xff, 0xff, - 0xff, 0xff, 0x0, 0x7f, 0xff, 0xff, 0xff, 0x0, - 0x1f, 0xff, 0xff, 0xff, 0x0, 0x7, 0xff, 0xff, - 0xff, 0x0, 0x0, 0xff, 0xff, 0xfe, 0x0, 0x0, - 0x1f, 0xff, 0xfc, 0x0, 0x0, 0x0, 0xff, 0xe0, - 0x0, 0x0, - - /* U+36 "6" */ - 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, - 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, - 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, - 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, - 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, - 0xc0, 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, - 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, - 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, - 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, - 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, 0x1, - 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, - 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0xf, - 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, - 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x0, 0xff, - 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x3f, 0xc0, - 0x0, 0x1f, 0xfe, 0x3f, 0xfe, 0x0, 0xf, 0xff, - 0xbf, 0xff, 0xe0, 0x3, 0xff, 0xdf, 0xff, 0xfc, - 0x1, 0xff, 0xef, 0xff, 0xff, 0x80, 0x7f, 0xff, - 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xfe, - 0xf, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, - 0xff, 0xff, 0xf1, 0xff, 0xff, 0x3, 0xff, 0xfc, - 0x7f, 0xff, 0x0, 0x3f, 0xff, 0x9f, 0xff, 0x0, - 0x3, 0xff, 0xef, 0xff, 0xc0, 0x0, 0xff, 0xfb, - 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf8, 0x0, - 0x7, 0xff, 0xff, 0xfc, 0x0, 0x0, 0xff, 0xff, - 0xff, 0x0, 0x0, 0x3f, 0xff, 0xff, 0xc0, 0x0, - 0xf, 0xff, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, - 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, - 0x3f, 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0x7f, - 0xf8, 0x0, 0x7, 0xff, 0xdf, 0xfe, 0x0, 0x3, - 0xff, 0xe7, 0xff, 0xc0, 0x0, 0xff, 0xf9, 0xff, - 0xfc, 0x0, 0xff, 0xfe, 0x3f, 0xff, 0xc0, 0xff, - 0xff, 0xf, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, - 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, - 0xf0, 0x7, 0xff, 0xff, 0xff, 0xf8, 0x0, 0xff, - 0xff, 0xff, 0xfe, 0x0, 0x1f, 0xff, 0xff, 0xfe, - 0x0, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, 0x3f, - 0xff, 0xff, 0x0, 0x0, 0x3, 0xff, 0xff, 0x0, - 0x0, 0x0, 0xf, 0xfc, 0x0, 0x0, - - /* U+37 "7" */ - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xe0, 0x0, 0xf, 0xff, 0xff, 0xe0, 0x0, 0x1f, - 0xfe, 0xff, 0xe0, 0x0, 0x1f, 0xfe, 0xff, 0xe0, - 0x0, 0x3f, 0xfc, 0xff, 0xe0, 0x0, 0x3f, 0xfc, - 0xff, 0xe0, 0x0, 0x7f, 0xf8, 0xff, 0xe0, 0x0, - 0x7f, 0xf8, 0xff, 0xe0, 0x0, 0xff, 0xf8, 0xff, - 0xe0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x1, 0xff, - 0xf0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, - 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, 0xc0, - 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x7, - 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, - 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, - 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, - 0x1f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, - 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x7f, - 0xfc, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, - 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, 0xf8, - 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, 0x1, - 0xff, 0xf0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, - 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, - 0xc0, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, - 0x7, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, 0x80, - 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x1f, - 0xff, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, - 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfe, - 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x0, - 0x7f, 0xfc, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, - 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, - 0xf8, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, - 0x1, 0xff, 0xf0, 0x0, 0x0, 0x3, 0xff, 0xe0, - 0x0, 0x0, - - /* U+38 "8" */ - 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x7, 0xff, - 0xff, 0x80, 0x0, 0x7, 0xff, 0xff, 0xf8, 0x0, - 0x7, 0xff, 0xff, 0xff, 0x80, 0x3, 0xff, 0xff, - 0xff, 0xf0, 0x1, 0xff, 0xff, 0xff, 0xfe, 0x0, - 0xff, 0xff, 0xff, 0xff, 0xc0, 0x7f, 0xff, 0xff, - 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, - 0xff, 0xe0, 0x3f, 0xff, 0xc3, 0xff, 0xe0, 0x3, - 0xff, 0xf0, 0xff, 0xf0, 0x0, 0x7f, 0xfc, 0x7f, - 0xf8, 0x0, 0xf, 0xff, 0x9f, 0xfe, 0x0, 0x3, - 0xff, 0xe7, 0xff, 0x0, 0x0, 0x7f, 0xf9, 0xff, - 0xc0, 0x0, 0x1f, 0xfe, 0x7f, 0xf0, 0x0, 0x7, - 0xff, 0x9f, 0xfc, 0x0, 0x1, 0xff, 0xe7, 0xff, - 0x0, 0x0, 0x7f, 0xf9, 0xff, 0xc0, 0x0, 0x1f, - 0xfe, 0x3f, 0xf8, 0x0, 0xf, 0xff, 0xf, 0xfe, - 0x0, 0x3, 0xff, 0xc3, 0xff, 0xc0, 0x1, 0xff, - 0xe0, 0x7f, 0xf8, 0x0, 0xff, 0xf8, 0xf, 0xff, - 0x80, 0xff, 0xfc, 0x1, 0xff, 0xff, 0xff, 0xfe, - 0x0, 0x3f, 0xff, 0xff, 0xff, 0x0, 0x7, 0xff, - 0xff, 0xff, 0x0, 0x0, 0x7f, 0xff, 0xff, 0x0, - 0x0, 0x3, 0xff, 0xfe, 0x0, 0x0, 0x7, 0xff, - 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, 0xff, 0x80, - 0x7, 0xff, 0xff, 0xff, 0xf0, 0x3, 0xff, 0xff, - 0xff, 0xff, 0x1, 0xff, 0xf8, 0xf, 0xff, 0xe0, - 0xff, 0xf8, 0x0, 0x7f, 0xf8, 0x3f, 0xfc, 0x0, - 0xf, 0xff, 0x1f, 0xfe, 0x0, 0x1, 0xff, 0xe7, - 0xff, 0x80, 0x0, 0x7f, 0xfb, 0xff, 0xc0, 0x0, - 0xf, 0xfe, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, - 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, - 0x3f, 0xff, 0xff, 0xc0, 0x0, 0xf, 0xff, 0xff, - 0xf0, 0x0, 0x3, 0xff, 0xff, 0xfe, 0x0, 0x1, - 0xff, 0xff, 0xff, 0x80, 0x0, 0x7f, 0xff, 0xff, - 0xf0, 0x0, 0x3f, 0xff, 0x7f, 0xfe, 0x0, 0x1f, - 0xff, 0x9f, 0xff, 0xe0, 0x3f, 0xff, 0xe3, 0xff, - 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0x3, 0xff, - 0xff, 0xff, 0xff, 0x0, 0x7f, 0xff, 0xff, 0xff, - 0x80, 0xf, 0xff, 0xff, 0xff, 0xc0, 0x1, 0xff, - 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xe0, - 0x0, 0x1, 0xff, 0xff, 0xe0, 0x0, 0x0, 0x7, - 0xff, 0x80, 0x0, - - /* U+39 "9" */ - 0x0, 0x0, 0xff, 0xc0, 0x0, 0x0, 0x3, 0xff, - 0xff, 0x0, 0x0, 0x3, 0xff, 0xff, 0xf0, 0x0, - 0x3, 0xff, 0xff, 0xff, 0x0, 0x1, 0xff, 0xff, - 0xff, 0xe0, 0x1, 0xff, 0xff, 0xff, 0xfc, 0x0, - 0x7f, 0xff, 0xff, 0xff, 0x80, 0x3f, 0xff, 0xff, - 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, - 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xfc, 0xf, - 0xff, 0xf1, 0xff, 0xf8, 0x0, 0xff, 0xfc, 0x7f, - 0xfc, 0x0, 0xf, 0xff, 0x9f, 0xff, 0x0, 0x3, - 0xff, 0xef, 0xff, 0x80, 0x0, 0x7f, 0xfb, 0xff, - 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf0, 0x0, 0x3, - 0xff, 0xff, 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, - 0x0, 0x0, 0x3f, 0xff, 0xff, 0xc0, 0x0, 0xf, - 0xff, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, 0xfc, - 0x0, 0x0, 0xff, 0xff, 0xff, 0x80, 0x0, 0x7f, - 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0x7f, 0xf8, - 0x0, 0xf, 0xff, 0xdf, 0xff, 0x0, 0x3, 0xff, - 0xe7, 0xff, 0xf0, 0x3, 0xff, 0xf8, 0xff, 0xff, - 0x3, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, - 0x87, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, - 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xf8, - 0x7, 0xff, 0xff, 0xdf, 0xfe, 0x0, 0xff, 0xff, - 0xef, 0xff, 0x80, 0x1f, 0xff, 0xf7, 0xff, 0xc0, - 0x1, 0xff, 0xf1, 0xff, 0xf0, 0x0, 0xf, 0xf0, - 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, - 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, - 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, - 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, - 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, - 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, - 0x80, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, - 0x1, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, - 0x0, 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, 0x0, - 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, 0x80, - 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3, - 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, - 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, 0x0, 0x3f, - 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, - 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, - - /* U+3A ":" */ - 0x7, 0xe0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, - 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, - 0x7f, 0xfe, 0x3f, 0xfc, 0x1f, 0xf8, 0x7, 0xe0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x7, 0xe0, 0x1f, 0xf8, - 0x3f, 0xfc, 0x7f, 0xfe, 0x7f, 0xfe, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x7f, 0xfe, 0x7f, 0xfe, 0x3f, 0xfc, - 0x1f, 0xf8, 0x7, 0xe0 -}; - - -/*--------------------- - * GLYPH DESCRIPTION - *--------------------*/ - -static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { - {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, - {.bitmap_index = 0, .adv_w = 768, .box_w = 41, .box_h = 59, .ofs_x = 4, .ofs_y = -1}, - {.bitmap_index = 303, .adv_w = 768, .box_w = 40, .box_h = 58, .ofs_x = 6, .ofs_y = 0}, - {.bitmap_index = 593, .adv_w = 768, .box_w = 41, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 891, .adv_w = 768, .box_w = 41, .box_h = 59, .ofs_x = 3, .ofs_y = -1}, - {.bitmap_index = 1194, .adv_w = 768, .box_w = 38, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 1470, .adv_w = 768, .box_w = 41, .box_h = 58, .ofs_x = 4, .ofs_y = -1}, - {.bitmap_index = 1768, .adv_w = 768, .box_w = 42, .box_h = 59, .ofs_x = 3, .ofs_y = -1}, - {.bitmap_index = 2078, .adv_w = 768, .box_w = 40, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, - {.bitmap_index = 2368, .adv_w = 768, .box_w = 42, .box_h = 60, .ofs_x = 3, .ofs_y = -1}, - {.bitmap_index = 2683, .adv_w = 768, .box_w = 42, .box_h = 59, .ofs_x = 3, .ofs_y = 0}, - {.bitmap_index = 2993, .adv_w = 768, .box_w = 16, .box_h = 46, .ofs_x = 16, .ofs_y = -1} -}; - -/*--------------------- - * CHARACTER MAPPING - *--------------------*/ - - - -/*Collect the unicode lists and glyph_id offsets*/ -static const lv_font_fmt_txt_cmap_t cmaps[] = -{ - { - .range_start = 48, .range_length = 11, .glyph_id_start = 1, - .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY - } -}; - - - -/*-------------------- - * ALL CUSTOM DATA - *--------------------*/ - -/*Store all the custom data of the font*/ -static lv_font_fmt_txt_dsc_t font_dsc = { - .glyph_bitmap = gylph_bitmap, - .glyph_dsc = glyph_dsc, - .cmaps = cmaps, - .kern_dsc = NULL, - .kern_scale = 0, - .cmap_num = 1, - .bpp = 1, - .kern_classes = 0, - .bitmap_format = 0 -}; - - -/*----------------- - * PUBLIC FONT - *----------------*/ - -/*Initialize a public general font descriptor*/ -lv_font_t jetbrains_mono_extrabold_compressed = { - .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ - .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ - .line_height = 60, /*The maximum line height required by the font*/ - .base_line = 1, /*Baseline measured from the bottom of the line*/ -#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) - .subpx = LV_FONT_SUBPX_NONE, -#endif - .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ -}; - -#endif /*#if JETBRAINS_MONO_EXTRABOLD_COMPRESSED*/ - diff --git a/src/displayapp/Icons/battery/os_battery_005.c b/src/displayapp/Icons/battery/os_battery_005.c deleted file mode 100644 index 64832b5..0000000 --- a/src/displayapp/Icons/battery/os_battery_005.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_005 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_005 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_005 uint8_t ck_os_battery_005_map[] = { - 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - - 0xfc, 0x00, 0x3f, - 0xf8, 0x00, 0x1f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, - 0x00, 0xff, 0x00, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, -}; - -const lv_img_dsc_t ck_os_battery_005 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_005_map, -}; diff --git a/src/displayapp/Icons/battery/os_battery_005.png b/src/displayapp/Icons/battery/os_battery_005.png deleted file mode 100644 index 963767b..0000000 Binary files a/src/displayapp/Icons/battery/os_battery_005.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_battery_010.c b/src/displayapp/Icons/battery/os_battery_010.c deleted file mode 100644 index f36b684..0000000 --- a/src/displayapp/Icons/battery/os_battery_010.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_010 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_010 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_010 uint8_t ck_os_battery_010_map[] = { - 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - 0x04, 0x7a, 0xf4, 0xff, /*Color of index 2*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 3*/ - - 0x55, 0x5f, 0xff, 0xff, 0xf5, 0x55, 0x55, - 0x55, 0x7f, 0xff, 0xff, 0xfd, 0x55, 0x55, - 0x55, 0xff, 0xff, 0xff, 0xff, 0x55, 0x55, - 0x55, 0xff, 0xff, 0xff, 0xff, 0x55, 0x55, - 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, - 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, - 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, - 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xff, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xff, 0x55, 0x55, 0x6a, 0xaa, 0xaa, 0xa9, - 0xff, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x50, 0x05, 0xaa, 0xaa, 0xaa, 0xaa, - 0xff, 0x50, 0x05, 0xaa, 0xaa, 0xaa, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0xff, 0xf5, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0xff, 0xf5, 0xaa, 0xa5, 0x5a, 0xaa, - 0xff, 0xff, 0xf5, 0xaa, 0xaa, 0xaa, 0xaa, - 0xff, 0xff, 0xf5, 0x6a, 0xaa, 0xaa, 0xa9, -}; - -const lv_img_dsc_t ck_os_battery_010 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 240, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_battery_010_map, -}; diff --git a/src/displayapp/Icons/battery/os_battery_010.png b/src/displayapp/Icons/battery/os_battery_010.png deleted file mode 100644 index 68a9f40..0000000 Binary files a/src/displayapp/Icons/battery/os_battery_010.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_battery_020.c b/src/displayapp/Icons/battery/os_battery_020.c deleted file mode 100644 index 3f648fb..0000000 --- a/src/displayapp/Icons/battery/os_battery_020.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_020 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_020 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_020 uint8_t ck_os_battery_020_map[] = { - 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, - 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, - 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, -}; - -const lv_img_dsc_t ck_os_battery_020 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 208, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_battery_020_map, -}; diff --git a/src/displayapp/Icons/battery/os_battery_020.png b/src/displayapp/Icons/battery/os_battery_020.png deleted file mode 100644 index 32eca65..0000000 Binary files a/src/displayapp/Icons/battery/os_battery_020.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_battery_030.c b/src/displayapp/Icons/battery/os_battery_030.c deleted file mode 100644 index 4d5719b..0000000 --- a/src/displayapp/Icons/battery/os_battery_030.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_030 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_030 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_030 uint8_t ck_os_battery_030_map[] = { - 0x04, 0x7a, 0xf4, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, - 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, - 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, - 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, - 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, -}; - -const lv_img_dsc_t ck_os_battery_030 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 208, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_battery_030_map, -}; diff --git a/src/displayapp/Icons/battery/os_battery_030.png b/src/displayapp/Icons/battery/os_battery_030.png deleted file mode 100644 index aeb5eb1..0000000 Binary files a/src/displayapp/Icons/battery/os_battery_030.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_battery_040.c b/src/displayapp/Icons/battery/os_battery_040.c deleted file mode 100644 index 0606fc3..0000000 --- a/src/displayapp/Icons/battery/os_battery_040.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_040 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_040 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_040 uint8_t ck_os_battery_040_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_battery_040 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_040_map, -}; diff --git a/src/displayapp/Icons/battery/os_battery_040.png b/src/displayapp/Icons/battery/os_battery_040.png deleted file mode 100644 index d84fda4..0000000 Binary files a/src/displayapp/Icons/battery/os_battery_040.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_battery_050.c b/src/displayapp/Icons/battery/os_battery_050.c deleted file mode 100644 index 8732dc7..0000000 --- a/src/displayapp/Icons/battery/os_battery_050.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_050 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_050 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_050 uint8_t ck_os_battery_050_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_battery_050 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_050_map, -}; diff --git a/src/displayapp/Icons/battery/os_battery_050.png b/src/displayapp/Icons/battery/os_battery_050.png deleted file mode 100644 index 224d38d..0000000 Binary files a/src/displayapp/Icons/battery/os_battery_050.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_battery_060.c b/src/displayapp/Icons/battery/os_battery_060.c deleted file mode 100644 index a65936b..0000000 --- a/src/displayapp/Icons/battery/os_battery_060.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_060 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_060 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_060 uint8_t ck_os_battery_060_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_battery_060 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_060_map, -}; diff --git a/src/displayapp/Icons/battery/os_battery_060.png b/src/displayapp/Icons/battery/os_battery_060.png deleted file mode 100644 index e5e00ed..0000000 Binary files a/src/displayapp/Icons/battery/os_battery_060.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_battery_070.c b/src/displayapp/Icons/battery/os_battery_070.c deleted file mode 100644 index 949c0b8..0000000 --- a/src/displayapp/Icons/battery/os_battery_070.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_070 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_070 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_070 uint8_t ck_os_battery_070_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_battery_070 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_070_map, -}; diff --git a/src/displayapp/Icons/battery/os_battery_070.png b/src/displayapp/Icons/battery/os_battery_070.png deleted file mode 100644 index dee969b..0000000 Binary files a/src/displayapp/Icons/battery/os_battery_070.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_battery_080.c b/src/displayapp/Icons/battery/os_battery_080.c deleted file mode 100644 index f447370..0000000 --- a/src/displayapp/Icons/battery/os_battery_080.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_080 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_080 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_080 uint8_t ck_os_battery_080_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_battery_080 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_080_map, -}; diff --git a/src/displayapp/Icons/battery/os_battery_080.png b/src/displayapp/Icons/battery/os_battery_080.png deleted file mode 100644 index 3b13fbb..0000000 Binary files a/src/displayapp/Icons/battery/os_battery_080.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_battery_090.c b/src/displayapp/Icons/battery/os_battery_090.c deleted file mode 100644 index 6fa41b2..0000000 --- a/src/displayapp/Icons/battery/os_battery_090.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_090 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_090 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_090 uint8_t ck_os_battery_090_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_battery_090 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_battery_090_map, -}; diff --git a/src/displayapp/Icons/battery/os_battery_090.png b/src/displayapp/Icons/battery/os_battery_090.png deleted file mode 100644 index d79f396..0000000 Binary files a/src/displayapp/Icons/battery/os_battery_090.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_battery_100.c b/src/displayapp/Icons/battery/os_battery_100.c deleted file mode 100644 index 92cf9a4..0000000 --- a/src/displayapp/Icons/battery/os_battery_100.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_100 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_100 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_100 uint8_t ck_os_battery_100_map[] = { - 0x7c, 0xd2, 0x34, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0xaa, 0xa5, 0x55, 0x55, 0x5a, 0xaa, - 0xaa, 0x95, 0x55, 0x55, 0x56, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, -}; - -const lv_img_dsc_t ck_os_battery_100 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 208, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_battery_100_map, -}; diff --git a/src/displayapp/Icons/battery/os_battery_100.png b/src/displayapp/Icons/battery/os_battery_100.png deleted file mode 100644 index dd0d306..0000000 Binary files a/src/displayapp/Icons/battery/os_battery_100.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_battery_error.c b/src/displayapp/Icons/battery/os_battery_error.c deleted file mode 100644 index af6aba5..0000000 --- a/src/displayapp/Icons/battery/os_battery_error.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_ERROR -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_ERROR -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_ERROR uint8_t ck_os_battery_error_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xc4, 0xc2, 0xc4, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x00, 0x05, 0x55, 0x55, 0x50, 0x00, - 0x00, 0x15, 0x55, 0x55, 0x54, 0x00, - 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, - 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, - 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, - 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, - 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, - 0x55, 0x54, 0x00, 0x00, 0x15, 0x55, - 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, - 0x55, 0x00, 0xaa, 0xaa, 0x00, 0x55, - 0x55, 0x02, 0xaa, 0xaa, 0x80, 0x55, - 0x55, 0x02, 0xaa, 0xaa, 0x80, 0x55, - 0x55, 0x0a, 0xa8, 0x2a, 0xa0, 0x55, - 0x55, 0x0a, 0xa0, 0x0a, 0xa0, 0x55, - 0x55, 0x00, 0x00, 0x0a, 0xa0, 0x55, - 0x55, 0x00, 0x00, 0x2a, 0xa0, 0x55, - 0x55, 0x00, 0x02, 0xaa, 0x80, 0x55, - 0x55, 0x00, 0x0a, 0xaa, 0x80, 0x55, - 0x55, 0x00, 0x0a, 0xaa, 0x00, 0x55, - 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, - 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, - 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, - 0x55, 0x00, 0x00, 0x00, 0x00, 0x55, - 0x55, 0x00, 0x00, 0x00, 0x00, 0x55, - 0x55, 0x00, 0x02, 0x80, 0x00, 0x55, - 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, - 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, - 0x55, 0x00, 0x02, 0x80, 0x00, 0x55, - 0x55, 0x55, 0x40, 0x01, 0x55, 0x55, - 0x55, 0x55, 0x50, 0x05, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, -}; - -const lv_img_dsc_t ck_os_battery_error = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 208, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_battery_error_map, -}; diff --git a/src/displayapp/Icons/battery/os_battery_error.png b/src/displayapp/Icons/battery/os_battery_error.png deleted file mode 100644 index 4c7632f..0000000 Binary files a/src/displayapp/Icons/battery/os_battery_error.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_005.c b/src/displayapp/Icons/battery/os_batterycharging_005.c deleted file mode 100644 index 1b0c71d..0000000 --- a/src/displayapp/Icons/battery/os_batterycharging_005.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_005 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_005 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_005 uint8_t ck_os_batterycharging_005_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, 0x00, - 0x07, 0xff, 0xe0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x07, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x1f, 0x00, - 0xf0, 0x00, 0x3e, 0x00, - 0xf0, 0x00, 0x7e, 0x00, - 0xf0, 0x00, 0xfc, 0x00, - 0xf0, 0x01, 0xff, 0xf0, - 0xf0, 0x03, 0xff, 0xf0, - 0xf0, 0x03, 0xff, 0xf0, - 0xf0, 0x03, 0xff, 0xe0, - 0xf0, 0x00, 0x0f, 0xc0, - 0xf0, 0x00, 0x1f, 0x80, - 0xff, 0xff, 0x3f, 0x00, - 0xff, 0xff, 0x3e, 0x00, - 0xff, 0xff, 0x3c, 0x00, - 0xff, 0xff, 0x38, 0x00, -}; - -const lv_img_dsc_t ck_os_batterycharging_005 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 136, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_batterycharging_005_map, -}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_005.png b/src/displayapp/Icons/battery/os_batterycharging_005.png deleted file mode 100644 index f9545bc..0000000 Binary files a/src/displayapp/Icons/battery/os_batterycharging_005.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_010.c b/src/displayapp/Icons/battery/os_batterycharging_010.c deleted file mode 100644 index 304c018..0000000 --- a/src/displayapp/Icons/battery/os_batterycharging_010.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_010 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_010 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_010 uint8_t ck_os_batterycharging_010_map[] = { - 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, 0x55, - 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x6a, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x5a, 0xa9, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x6a, 0xa9, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0xaa, 0xa5, 0x55, - 0xaa, 0x55, 0x55, 0x56, 0xaa, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x5a, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xa9, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xa5, - 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x95, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xaa, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa9, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa5, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0x95, 0x55, -}; - -const lv_img_dsc_t ck_os_batterycharging_010 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 240, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_batterycharging_010_map, -}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_010.png b/src/displayapp/Icons/battery/os_batterycharging_010.png deleted file mode 100644 index 04d5f82..0000000 Binary files a/src/displayapp/Icons/battery/os_batterycharging_010.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_020.c b/src/displayapp/Icons/battery/os_batterycharging_020.c deleted file mode 100644 index 1721be1..0000000 --- a/src/displayapp/Icons/battery/os_batterycharging_020.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_020 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_020 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_020 uint8_t ck_os_batterycharging_020_map[] = { - 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, 0x55, - 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x6a, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x5a, 0xa9, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x6a, 0xa9, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0xaa, 0xa5, 0x55, - 0xaa, 0x55, 0x55, 0x56, 0xaa, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x5a, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xa9, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xa5, - 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x95, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xaa, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa9, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa5, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0x95, 0x55, -}; - -const lv_img_dsc_t ck_os_batterycharging_020 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 240, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_batterycharging_020_map, -}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_020.png b/src/displayapp/Icons/battery/os_batterycharging_020.png deleted file mode 100644 index 6416e1e..0000000 Binary files a/src/displayapp/Icons/battery/os_batterycharging_020.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_030.c b/src/displayapp/Icons/battery/os_batterycharging_030.c deleted file mode 100644 index 83101fd..0000000 --- a/src/displayapp/Icons/battery/os_batterycharging_030.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_030 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_030 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_030 uint8_t ck_os_batterycharging_030_map[] = { - 0x04, 0x7a, 0xf4, 0xff, /*Color of index 0*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, 0x55, - 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0x6a, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x5a, 0xa9, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0x6a, 0xa9, 0x55, - 0xaa, 0x55, 0x55, 0x55, 0xaa, 0xa5, 0x55, - 0xaa, 0x50, 0x00, 0x56, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, - 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xa9, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xa5, - 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x95, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xaa, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa9, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa5, 0x55, - 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0x95, 0x55, -}; - -const lv_img_dsc_t ck_os_batterycharging_030 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 240, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_batterycharging_030_map, -}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_030.png b/src/displayapp/Icons/battery/os_batterycharging_030.png deleted file mode 100644 index 96b44d2..0000000 Binary files a/src/displayapp/Icons/battery/os_batterycharging_030.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_040.c b/src/displayapp/Icons/battery/os_batterycharging_040.c deleted file mode 100644 index 02af00e..0000000 --- a/src/displayapp/Icons/battery/os_batterycharging_040.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_040 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_040 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_040 uint8_t ck_os_batterycharging_040_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, 0x00, - 0x07, 0xff, 0xe0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x07, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x1f, 0x00, - 0xf0, 0x00, 0x3e, 0x00, - 0xf3, 0xf8, 0x7e, 0x00, - 0xf3, 0xf0, 0xfc, 0x00, - 0xf3, 0xf1, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xe0, - 0xf0, 0x00, 0x0f, 0xc0, - 0xf0, 0x00, 0x1f, 0x80, - 0xff, 0xff, 0x3f, 0x00, - 0xff, 0xff, 0x3e, 0x00, - 0xff, 0xff, 0x3c, 0x00, - 0xff, 0xff, 0x38, 0x00, -}; - -const lv_img_dsc_t ck_os_batterycharging_040 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 136, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_batterycharging_040_map, -}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_040.png b/src/displayapp/Icons/battery/os_batterycharging_040.png deleted file mode 100644 index 5a42caf..0000000 Binary files a/src/displayapp/Icons/battery/os_batterycharging_040.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_050.c b/src/displayapp/Icons/battery/os_batterycharging_050.c deleted file mode 100644 index d2eea82..0000000 --- a/src/displayapp/Icons/battery/os_batterycharging_050.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_050 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_050 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_050 uint8_t ck_os_batterycharging_050_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, 0x00, - 0x07, 0xff, 0xe0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x07, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf3, 0xfe, 0x1f, 0x00, - 0xf3, 0xfc, 0x3e, 0x00, - 0xf3, 0xf8, 0x7e, 0x00, - 0xf3, 0xf0, 0xfc, 0x00, - 0xf3, 0xf1, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xe0, - 0xf0, 0x00, 0x0f, 0xc0, - 0xf0, 0x00, 0x1f, 0x80, - 0xff, 0xff, 0x3f, 0x00, - 0xff, 0xff, 0x3e, 0x00, - 0xff, 0xff, 0x3c, 0x00, - 0xff, 0xff, 0x38, 0x00, -}; - -const lv_img_dsc_t ck_os_batterycharging_050 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 136, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_batterycharging_050_map, -}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_050.png b/src/displayapp/Icons/battery/os_batterycharging_050.png deleted file mode 100644 index ca0e04d..0000000 Binary files a/src/displayapp/Icons/battery/os_batterycharging_050.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_060.c b/src/displayapp/Icons/battery/os_batterycharging_060.c deleted file mode 100644 index 05f8b97..0000000 --- a/src/displayapp/Icons/battery/os_batterycharging_060.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_060 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_060 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_060 uint8_t ck_os_batterycharging_060_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, 0x00, - 0x07, 0xff, 0xe0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf0, 0x00, 0x00, 0x00, - 0xf3, 0xff, 0x87, 0x00, - 0xf3, 0xff, 0x0f, 0x00, - 0xf3, 0xfe, 0x1f, 0x00, - 0xf3, 0xfc, 0x3e, 0x00, - 0xf3, 0xf8, 0x7e, 0x00, - 0xf3, 0xf0, 0xfc, 0x00, - 0xf3, 0xf1, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xe0, - 0xf0, 0x00, 0x0f, 0xc0, - 0xf0, 0x00, 0x1f, 0x80, - 0xff, 0xff, 0x3f, 0x00, - 0xff, 0xff, 0x3e, 0x00, - 0xff, 0xff, 0x3c, 0x00, - 0xff, 0xff, 0x38, 0x00, -}; - -const lv_img_dsc_t ck_os_batterycharging_060 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 136, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_batterycharging_060_map, -}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_060.png b/src/displayapp/Icons/battery/os_batterycharging_060.png deleted file mode 100644 index 2930068..0000000 Binary files a/src/displayapp/Icons/battery/os_batterycharging_060.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_070.c b/src/displayapp/Icons/battery/os_batterycharging_070.c deleted file mode 100644 index ac3e319..0000000 --- a/src/displayapp/Icons/battery/os_batterycharging_070.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_070 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_070 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_070 uint8_t ck_os_batterycharging_070_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, 0x00, - 0x07, 0xff, 0xe0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0x0f, 0xff, 0xf0, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xff, 0x00, 0xff, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf0, 0x00, 0x0f, 0x00, - 0xf3, 0xff, 0xc0, 0x00, - 0xf3, 0xff, 0xc0, 0x00, - 0xf3, 0xff, 0x87, 0x00, - 0xf3, 0xff, 0x0f, 0x00, - 0xf3, 0xfe, 0x1f, 0x00, - 0xf3, 0xfc, 0x3e, 0x00, - 0xf3, 0xf8, 0x7e, 0x00, - 0xf3, 0xf0, 0xfc, 0x00, - 0xf3, 0xf1, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xf0, - 0xf3, 0xf3, 0xff, 0xe0, - 0xf0, 0x00, 0x0f, 0xc0, - 0xf0, 0x00, 0x1f, 0x80, - 0xff, 0xff, 0x3f, 0x00, - 0xff, 0xff, 0x3e, 0x00, - 0xff, 0xff, 0x3c, 0x00, - 0xff, 0xff, 0x38, 0x00, -}; - -const lv_img_dsc_t ck_os_batterycharging_070 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 136, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_batterycharging_070_map, -}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_070.png b/src/displayapp/Icons/battery/os_batterycharging_070.png deleted file mode 100644 index 7d5f55d..0000000 Binary files a/src/displayapp/Icons/battery/os_batterycharging_070.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_080.c b/src/displayapp/Icons/battery/os_batterycharging_080.c deleted file mode 100644 index cc1c1d2..0000000 --- a/src/displayapp/Icons/battery/os_batterycharging_080.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_080 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_080 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_080 uint8_t ck_os_batterycharging_080_map[] = { - 0x7c, 0xd2, 0x34, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0xaa, 0xa5, 0x55, 0x55, 0x5a, 0xaa, 0xaa, - 0xaa, 0x95, 0x55, 0x55, 0x56, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x2a, 0x95, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0xaa, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x02, 0xa9, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x0a, 0xa5, 0x56, 0xaa, - 0x55, 0xa0, 0x00, 0x2a, 0x95, 0x56, 0xaa, - 0x55, 0xa0, 0x00, 0xaa, 0x55, 0x5a, 0xaa, - 0x55, 0xa0, 0x00, 0xa9, 0x55, 0x55, 0x55, - 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, - 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, - 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x56, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x5a, - 0x55, 0xaa, 0xaa, 0xaa, 0xa9, 0x55, 0x6a, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x55, 0xaa, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x56, 0xaa, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x5a, 0xaa, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x6a, 0xaa, -}; - -const lv_img_dsc_t ck_os_batterycharging_080 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 240, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_batterycharging_080_map, -}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_080.png b/src/displayapp/Icons/battery/os_batterycharging_080.png deleted file mode 100644 index cce5052..0000000 Binary files a/src/displayapp/Icons/battery/os_batterycharging_080.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_090.c b/src/displayapp/Icons/battery/os_batterycharging_090.c deleted file mode 100644 index 85e1c26..0000000 --- a/src/displayapp/Icons/battery/os_batterycharging_090.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_090 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_090 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_090 uint8_t ck_os_batterycharging_090_map[] = { - 0x7c, 0xd2, 0x34, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0xaa, 0xa5, 0x55, 0x55, 0x5a, 0xaa, 0xaa, - 0xaa, 0x95, 0x55, 0x55, 0x56, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, - 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0x2a, 0x95, 0xaa, - 0x55, 0xa0, 0x00, 0x00, 0xaa, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x02, 0xa9, 0x55, 0xaa, - 0x55, 0xa0, 0x00, 0x0a, 0xa5, 0x56, 0xaa, - 0x55, 0xa0, 0x00, 0x2a, 0x95, 0x56, 0xaa, - 0x55, 0xa0, 0x00, 0xaa, 0x55, 0x5a, 0xaa, - 0x55, 0xa0, 0x00, 0xa9, 0x55, 0x55, 0x55, - 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, - 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, - 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x56, - 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x5a, - 0x55, 0xaa, 0xaa, 0xaa, 0xa9, 0x55, 0x6a, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x55, 0xaa, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x56, 0xaa, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x5a, 0xaa, - 0x55, 0x55, 0x55, 0x55, 0xa5, 0x6a, 0xaa, -}; - -const lv_img_dsc_t ck_os_batterycharging_090 = { - .header.always_zero = 0, - .header.w = 28, - .header.h = 32, - .data_size = 240, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_batterycharging_090_map, -}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_090.png b/src/displayapp/Icons/battery/os_batterycharging_090.png deleted file mode 100644 index fc7b443..0000000 Binary files a/src/displayapp/Icons/battery/os_batterycharging_090.png and /dev/null differ diff --git a/src/displayapp/Icons/battery/os_batterycharging_100.c b/src/displayapp/Icons/battery/os_batterycharging_100.c deleted file mode 100644 index 8dec0cb..0000000 --- a/src/displayapp/Icons/battery/os_batterycharging_100.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_100 -#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_100 -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_100 uint8_t ck_os_batterycharging_100_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x03, 0xff, 0xc0, - 0x07, 0xff, 0xe0, - 0x0f, 0xff, 0xf0, - 0x0f, 0xff, 0xf0, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xff, 0x00, 0xff, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x07, 0x0f, - 0xf0, 0x0f, 0x0f, - 0xf0, 0x1f, 0x0f, - 0xf0, 0x3e, 0x0f, - 0xf0, 0x7e, 0x0f, - 0xf0, 0xfc, 0x0f, - 0xf1, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0xcf, - 0xf3, 0xff, 0x8f, - 0xf0, 0x3f, 0x0f, - 0xf0, 0x7e, 0x0f, - 0xf0, 0x7c, 0x0f, - 0xf0, 0xf8, 0x0f, - 0xf0, 0xf0, 0x0f, - 0xf0, 0xe0, 0x0f, - 0xf0, 0x00, 0x0f, - 0xf0, 0x00, 0x0f, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, -}; - -const lv_img_dsc_t ck_os_batterycharging_100 = { - .header.always_zero = 0, - .header.w = 24, - .header.h = 32, - .data_size = 104, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_batterycharging_100_map, -}; diff --git a/src/displayapp/Icons/battery/os_batterycharging_100.png b/src/displayapp/Icons/battery/os_batterycharging_100.png deleted file mode 100644 index 7c8ce0c..0000000 Binary files a/src/displayapp/Icons/battery/os_batterycharging_100.png and /dev/null differ diff --git a/src/displayapp/Icons/bluetooth/ck_os_bt_connected.png b/src/displayapp/Icons/bluetooth/ck_os_bt_connected.png deleted file mode 100644 index 5371611..0000000 Binary files a/src/displayapp/Icons/bluetooth/ck_os_bt_connected.png and /dev/null differ diff --git a/src/displayapp/Icons/bluetooth/ck_os_bt_disconnected.png b/src/displayapp/Icons/bluetooth/ck_os_bt_disconnected.png deleted file mode 100644 index 3275895..0000000 Binary files a/src/displayapp/Icons/bluetooth/ck_os_bt_disconnected.png and /dev/null differ diff --git a/src/displayapp/Icons/bluetooth/os_bt_connected.c b/src/displayapp/Icons/bluetooth/os_bt_connected.c deleted file mode 100644 index d30dc9d..0000000 --- a/src/displayapp/Icons/bluetooth/os_bt_connected.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BT_CONNECTED -#define LV_ATTRIBUTE_IMG_CK_OS_BT_CONNECTED -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BT_CONNECTED uint8_t ck_os_bt_connected_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ - - 0x00, 0x0e, 0x00, 0x00, - 0x00, 0x0f, 0x00, 0x00, - 0x00, 0x0f, 0x80, 0x00, - 0x00, 0x0f, 0xc0, 0x00, - 0x00, 0x0f, 0xe0, 0x00, - 0x00, 0x0f, 0xf0, 0x00, - 0x03, 0x8f, 0xf8, 0x00, - 0x03, 0xcf, 0x7c, 0x00, - 0x03, 0xef, 0x3e, 0x00, - 0x01, 0xff, 0x1f, 0x00, - 0x00, 0xff, 0x1f, 0x00, - 0x00, 0x7f, 0x3e, 0x00, - 0x00, 0x3f, 0x7c, 0x00, - 0x00, 0x1f, 0xf8, 0x00, - 0x00, 0x0f, 0xf0, 0x00, - 0x00, 0x0f, 0xe0, 0x00, - 0x00, 0x0f, 0xe0, 0x00, - 0x00, 0x0f, 0xf0, 0x00, - 0x00, 0x1f, 0xf8, 0x00, - 0x00, 0x3f, 0x7c, 0x00, - 0x00, 0x7f, 0x3e, 0x00, - 0x00, 0xff, 0x1f, 0x00, - 0x01, 0xff, 0x1f, 0x00, - 0x03, 0xef, 0x3e, 0x00, - 0x03, 0xcf, 0x7c, 0x00, - 0x03, 0x8f, 0xf8, 0x00, - 0x00, 0x0f, 0xf0, 0x00, - 0x00, 0x0f, 0xe0, 0x00, - 0x00, 0x0f, 0xc0, 0x00, - 0x00, 0x0f, 0x80, 0x00, - 0x00, 0x0f, 0x00, 0x00, - 0x00, 0x0e, 0x00, 0x00, -}; - -const lv_img_dsc_t ck_os_bt_connected = { - .header.always_zero = 0, - .header.w = 32, - .header.h = 32, - .data_size = 136, - .header.cf = LV_IMG_CF_INDEXED_1BIT, - .data = ck_os_bt_connected_map, -}; diff --git a/src/displayapp/Icons/bluetooth/os_bt_connected.png b/src/displayapp/Icons/bluetooth/os_bt_connected.png deleted file mode 100644 index 5371611..0000000 Binary files a/src/displayapp/Icons/bluetooth/os_bt_connected.png and /dev/null differ diff --git a/src/displayapp/Icons/bluetooth/os_bt_disconnected.c b/src/displayapp/Icons/bluetooth/os_bt_disconnected.c deleted file mode 100644 index 930179b..0000000 --- a/src/displayapp/Icons/bluetooth/os_bt_disconnected.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "lvgl/lvgl.h" - -#ifndef LV_ATTRIBUTE_MEM_ALIGN -#define LV_ATTRIBUTE_MEM_ALIGN -#endif - -#ifndef LV_ATTRIBUTE_IMG_CK_OS_BT_DISCONNECTED -#define LV_ATTRIBUTE_IMG_CK_OS_BT_DISCONNECTED -#endif - -const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BT_DISCONNECTED uint8_t ck_os_bt_disconnected_map[] = { - 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ - 0xc4, 0xc2, 0xc4, 0xff, /*Color of index 1*/ - 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ - 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ - - 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, - 0x0a, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, - 0x2a, 0x80, 0x00, 0x55, 0x40, 0x00, 0x00, 0x00, - 0x2a, 0xa0, 0x00, 0x55, 0x50, 0x00, 0x00, 0x00, - 0x0a, 0xa8, 0x00, 0x55, 0x54, 0x00, 0x00, 0x00, - 0x02, 0xaa, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, - 0x00, 0xaa, 0x80, 0x55, 0x55, 0x40, 0x00, 0x00, - 0x00, 0x2a, 0xa0, 0x55, 0x15, 0x50, 0x00, 0x00, - 0x00, 0x0a, 0xa8, 0x15, 0x05, 0x54, 0x00, 0x00, - 0x00, 0x02, 0xaa, 0x05, 0x01, 0x55, 0x00, 0x00, - 0x00, 0x00, 0xaa, 0x81, 0x01, 0x55, 0x00, 0x00, - 0x00, 0x00, 0x2a, 0xa0, 0x05, 0x54, 0x00, 0x00, - 0x00, 0x00, 0x0a, 0xa8, 0x15, 0x50, 0x00, 0x00, - 0x00, 0x00, 0x02, 0xaa, 0x05, 0x40, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xaa, 0x81, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x2a, 0xa0, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0a, 0xa8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x42, 0xaa, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x01, 0x50, 0xaa, 0x80, 0x00, 0x00, - 0x00, 0x00, 0x05, 0x54, 0x2a, 0xa0, 0x00, 0x00, - 0x00, 0x00, 0x15, 0x55, 0x0a, 0xa8, 0x00, 0x00, - 0x00, 0x00, 0x55, 0x55, 0x02, 0xaa, 0x00, 0x00, - 0x00, 0x01, 0x55, 0x55, 0x00, 0xaa, 0x80, 0x00, - 0x00, 0x05, 0x54, 0x55, 0x04, 0x2a, 0xa0, 0x00, - 0x00, 0x05, 0x50, 0x55, 0x15, 0x0a, 0xa8, 0x00, - 0x00, 0x05, 0x40, 0x55, 0x55, 0x42, 0xaa, 0x00, - 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0xaa, 0x80, - 0x00, 0x00, 0x00, 0x55, 0x54, 0x00, 0x2a, 0xa0, - 0x00, 0x00, 0x00, 0x55, 0x50, 0x00, 0x0a, 0xa8, - 0x00, 0x00, 0x00, 0x55, 0x40, 0x00, 0x02, 0xa8, - 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0xa0, - 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, -}; - -const lv_img_dsc_t ck_os_bt_disconnected = { - .header.always_zero = 0, - .header.w = 32, - .header.h = 32, - .data_size = 272, - .header.cf = LV_IMG_CF_INDEXED_2BIT, - .data = ck_os_bt_disconnected_map, -}; diff --git a/src/displayapp/Icons/bluetooth/os_bt_disconnected.png b/src/displayapp/Icons/bluetooth/os_bt_disconnected.png deleted file mode 100644 index 3275895..0000000 Binary files a/src/displayapp/Icons/bluetooth/os_bt_disconnected.png and /dev/null differ diff --git a/src/displayapp/fonts/Readme.md b/src/displayapp/fonts/Readme.md new file mode 100644 index 0000000..7ebf2e2 --- /dev/null +++ b/src/displayapp/fonts/Readme.md @@ -0,0 +1,23 @@ +#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.woff` and specify the following range : `0x20-0x7f` + * 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` + * 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 + * 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"; +``` diff --git a/src/displayapp/fonts/jetbrains_mono_bold_20.c b/src/displayapp/fonts/jetbrains_mono_bold_20.c new file mode 100644 index 0000000..27ad005 --- /dev/null +++ b/src/displayapp/fonts/jetbrains_mono_bold_20.c @@ -0,0 +1,766 @@ +#include "lvgl/lvgl.h" + +/******************************************************************************* + * Size: 20 px + * Bpp: 1 + * Opts: + ******************************************************************************/ + +#ifndef JETBRAINS_MONO_BOLD_20 +#define JETBRAINS_MONO_BOLD_20 1 +#endif + +#if JETBRAINS_MONO_BOLD_20 + +/*----------------- + * BITMAPS + *----------------*/ + +/*Store the image of the glyphs*/ +static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { + /* U+20 " " */ + 0x0, + + /* U+21 "!" */ + 0xff, 0xff, 0xff, 0xe0, 0xf, 0xc0, + + /* U+22 "\"" */ + 0xef, 0xdf, 0xbf, 0x7e, 0xfd, 0xc0, + + /* U+23 "#" */ + 0x8, 0xc3, 0x10, 0x62, 0x3f, 0xf7, 0xfe, 0x23, + 0x4, 0x61, 0x88, 0x31, 0x1f, 0xfb, 0xff, 0x19, + 0x82, 0x30, 0xc4, 0x0, + + /* U+24 "$" */ + 0x8, 0x2, 0x1, 0xc1, 0xfe, 0xeb, 0xf2, 0x7c, + 0x83, 0xa0, 0x7c, 0xf, 0xc0, 0xf8, 0x27, 0x9, + 0xf2, 0x7f, 0xf9, 0xfc, 0x8, 0x2, 0x0, 0x80, + + /* U+25 "%" */ + 0x78, 0x1f, 0x83, 0x30, 0x66, 0x1f, 0xcc, 0xf2, + 0x1, 0x80, 0xde, 0x67, 0xf8, 0xcc, 0x19, 0x83, + 0x30, 0x7e, 0x7, 0x80, + + /* U+26 "&" */ + 0x1e, 0x7, 0xe1, 0xce, 0x38, 0x7, 0x0, 0x70, + 0x1e, 0x7, 0x66, 0xed, 0xdc, 0xf3, 0x9c, 0x73, + 0xcf, 0xfc, 0xf9, 0x80, + + /* U+27 "'" */ + 0xff, 0xff, 0xc0, + + /* U+28 "(" */ + 0x2, 0x1c, 0xfb, 0xc7, 0x1e, 0x38, 0x70, 0xe1, + 0xc3, 0x87, 0xe, 0x1c, 0x3c, 0x38, 0x38, 0x7c, + 0x38, + + /* U+29 ")" */ + 0x1, 0xc3, 0xc1, 0xc1, 0xc3, 0xc3, 0x87, 0xe, + 0x1c, 0x38, 0x70, 0xe1, 0xc7, 0x8e, 0x79, 0xe3, + 0x80, + + /* U+2A "*" */ + 0xc, 0x3, 0x8, 0xc7, 0xb7, 0x7f, 0x83, 0x1, + 0xe0, 0xcc, 0x73, 0x80, 0x0, + + /* U+2B "+" */ + 0x1c, 0x7, 0x1, 0xc3, 0xff, 0xff, 0xc7, 0x1, + 0xc0, 0x70, 0x1c, 0x0, + + /* U+2C "," */ + 0x7b, 0x9c, 0xce, 0x60, + + /* U+2D "-" */ + 0xff, 0xff, + + /* U+2E "." */ + 0x6f, 0xf6, + + /* U+2F "/" */ + 0x1, 0xc0, 0x60, 0x38, 0xe, 0x3, 0x1, 0xc0, + 0x70, 0x18, 0xe, 0x3, 0x1, 0xc0, 0x70, 0x18, + 0xe, 0x3, 0x80, 0xc0, 0x70, 0x18, 0xe, 0x0, + + /* U+30 "0" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xed, 0xfb, 0x7e, + 0xdf, 0xb7, 0xed, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0x80, + + /* U+31 "1" */ + 0x3c, 0x3e, 0x3f, 0x13, 0x81, 0xc0, 0xe0, 0x70, + 0x38, 0x1c, 0xe, 0x7, 0x3, 0x8f, 0xff, 0xfc, + + /* U+32 "2" */ + 0x1f, 0x1f, 0xef, 0x3f, 0x87, 0x1, 0xc0, 0x70, + 0x38, 0x1e, 0xf, 0x7, 0x87, 0x83, 0xc0, 0xff, + 0xff, 0xf0, + + /* U+33 "3" */ + 0x7f, 0xdf, 0xf0, 0x3c, 0x1c, 0x1c, 0x7, 0xc1, + 0xf8, 0xf, 0x1, 0xc0, 0x7e, 0x1d, 0x8f, 0x7f, + 0x87, 0xc0, + + /* U+34 "4" */ + 0x7, 0x7, 0x3, 0x83, 0x83, 0x81, 0xc1, 0xcf, + 0xe7, 0xe3, 0xff, 0xff, 0xe0, 0x70, 0x38, 0x1c, + + /* U+35 "5" */ + 0xff, 0x7f, 0xb8, 0x1c, 0xe, 0x7, 0x73, 0xfd, + 0xcf, 0x3, 0x81, 0xc0, 0xfc, 0xff, 0xf1, 0xf0, + + /* U+36 "6" */ + 0x6, 0x3, 0x1, 0xc0, 0x60, 0x30, 0x1b, 0xc7, + 0xfb, 0xcf, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x87, 0x80, + + /* U+37 "7" */ + 0xff, 0xff, 0xfe, 0xb, 0x86, 0x1, 0x80, 0xc0, + 0x30, 0x18, 0x6, 0x3, 0x80, 0xc0, 0x70, 0x18, + 0xe, 0x0, + + /* U+38 "8" */ + 0x3e, 0x1f, 0xce, 0x3b, 0x6, 0xe3, 0x9f, 0xc7, + 0xf1, 0x8e, 0xc1, 0xf0, 0x7c, 0x1f, 0x8f, 0x7f, + 0x8f, 0x80, + + /* U+39 "9" */ + 0x1e, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7f, + 0x3d, 0xfe, 0x3d, 0x80, 0xc0, 0x60, 0x38, 0xc, + 0x6, 0x0, + + /* U+3A ":" */ + 0xff, 0x80, 0x0, 0xff, 0x80, + + /* U+3B ";" */ + 0x7b, 0xde, 0x0, 0x0, 0x0, 0x7b, 0x9c, 0xce, + 0x60, + + /* U+3C "<" */ + 0x0, 0x81, 0xc3, 0xe7, 0xcf, 0x6, 0x3, 0xc0, + 0x7c, 0xf, 0x81, 0xc0, 0x20, + + /* U+3D "=" */ + 0xff, 0xff, 0xc0, 0x0, 0x0, 0x7, 0xff, 0xfe, + + /* U+3E ">" */ + 0x0, 0x70, 0x3e, 0x7, 0xc0, 0xf8, 0xc, 0x1e, + 0x7c, 0xf8, 0x70, 0x20, 0x0, + + /* U+3F "?" */ + 0xfc, 0xfe, 0xf, 0x7, 0x7, 0xf, 0x3e, 0x3c, + 0x30, 0x30, 0x0, 0x0, 0x70, 0x70, + + /* U+40 "@" */ + 0x1f, 0x87, 0xf9, 0xc3, 0xf0, 0x3c, 0x77, 0x9f, + 0xf3, 0x1e, 0x63, 0xcc, 0x79, 0x8f, 0x31, 0xe7, + 0xfc, 0x77, 0xc0, 0x1c, 0x1, 0xf0, 0x1e, 0x0, + + /* U+41 "A" */ + 0xf, 0x0, 0xf0, 0xf, 0x1, 0xf8, 0x19, 0x81, + 0x98, 0x19, 0x83, 0x9c, 0x3f, 0xc3, 0xfc, 0x70, + 0xe7, 0xe, 0x60, 0x66, 0x6, + + /* U+42 "B" */ + 0xfe, 0x3f, 0xce, 0x3b, 0x8e, 0xe3, 0xb8, 0xcf, + 0xe3, 0xfc, 0xe3, 0xb8, 0x7e, 0x1f, 0x8f, 0xff, + 0xbf, 0xc0, + + /* U+43 "C" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe0, 0x38, 0xe, + 0x3, 0x80, 0xe0, 0x38, 0xe, 0x1f, 0xcf, 0x7f, + 0x8f, 0xc0, + + /* U+44 "D" */ + 0xfe, 0x3f, 0xee, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0x8f, 0xff, + 0xbf, 0x80, + + /* U+45 "E" */ + 0xff, 0xff, 0xf8, 0x1c, 0xe, 0x7, 0x3, 0xfd, + 0xfe, 0xe0, 0x70, 0x38, 0x1c, 0xf, 0xff, 0xfc, + + /* U+46 "F" */ + 0xff, 0xff, 0xf8, 0x1c, 0xe, 0x7, 0x3, 0xff, + 0xff, 0xe0, 0x70, 0x38, 0x1c, 0xe, 0x7, 0x0, + + /* U+47 "G" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe0, 0x38, 0xe, + 0x7f, 0x9f, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x87, 0x80, + + /* U+48 "H" */ + 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0xff, + 0xff, 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1c, + + /* U+49 "I" */ + 0xff, 0xff, 0xc7, 0x3, 0x81, 0xc0, 0xe0, 0x70, + 0x38, 0x1c, 0xe, 0x7, 0x3, 0x8f, 0xff, 0xfc, + + /* U+4A "J" */ + 0x3f, 0xcf, 0xf0, 0x1c, 0x7, 0x1, 0xc0, 0x70, + 0x1c, 0x7, 0x1, 0xc0, 0x7e, 0x1f, 0x8f, 0x7f, + 0x8f, 0xc0, + + /* U+4B "K" */ + 0xe1, 0xdc, 0x3b, 0x8e, 0x71, 0xce, 0x31, 0xce, + 0x3f, 0x87, 0xf0, 0xe7, 0x1c, 0x63, 0x8e, 0x70, + 0xce, 0x1d, 0xc3, 0x80, + + /* U+4C "L" */ + 0xe0, 0x70, 0x38, 0x1c, 0xe, 0x7, 0x3, 0x81, + 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0xf, 0xff, 0xfc, + + /* U+4D "M" */ + 0xe1, 0xf8, 0x7f, 0x3f, 0xcf, 0xda, 0xf7, 0xbd, + 0xef, 0x33, 0xc0, 0xf0, 0x3c, 0xf, 0x3, 0xc0, + 0xf0, 0x30, + + /* U+4E "N" */ + 0xe1, 0xf0, 0xfc, 0x7e, 0x3d, 0x9e, 0xcf, 0x67, + 0x9b, 0xcd, 0xe6, 0xf1, 0xf8, 0xfc, 0x3e, 0x1c, + + /* U+4F "O" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0x80, + + /* U+50 "P" */ + 0xff, 0x3f, 0xee, 0x3f, 0x87, 0xe1, 0xf8, 0xff, + 0xfb, 0xfc, 0xe0, 0x38, 0xe, 0x3, 0x80, 0xe0, + 0x38, 0x0, + + /* U+51 "Q" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0x80, 0x70, 0xe, 0x1, 0xc0, + + /* U+52 "R" */ + 0xff, 0x3f, 0xee, 0x3f, 0x87, 0xe1, 0xf8, 0xff, + 0xfb, 0xf8, 0xe6, 0x39, 0xce, 0x33, 0x8e, 0xe3, + 0xb8, 0x70, + + /* U+53 "S" */ + 0x3f, 0x1f, 0xee, 0x1f, 0x87, 0xe0, 0x3e, 0x7, + 0xf0, 0x7e, 0x3, 0xc0, 0x7e, 0x1f, 0xcf, 0x7f, + 0x8f, 0xc0, + + /* U+54 "T" */ + 0xff, 0xff, 0xf0, 0xe0, 0x38, 0xe, 0x3, 0x80, + 0xe0, 0x38, 0xe, 0x3, 0x80, 0xe0, 0x38, 0xe, + 0x3, 0x80, + + /* U+55 "U" */ + 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, + 0xc7, 0xe3, 0xf1, 0xf8, 0xfc, 0x77, 0xf1, 0xf0, + + /* U+56 "V" */ + 0x60, 0x66, 0x6, 0x70, 0xe7, 0xe, 0x30, 0xc3, + 0xc, 0x39, 0xc1, 0x98, 0x19, 0x81, 0x98, 0x1f, + 0x80, 0xf0, 0xf, 0x0, 0xf0, + + /* U+57 "W" */ + 0xc6, 0x78, 0xcf, 0x39, 0xe7, 0x3e, 0xa6, 0xd6, + 0xda, 0xdb, 0x5b, 0x6b, 0x6d, 0x2d, 0xe7, 0x3c, + 0xe7, 0x9c, 0xe3, 0x80, + + /* U+58 "X" */ + 0xe1, 0xd8, 0x67, 0x38, 0xcc, 0x3f, 0x7, 0x81, + 0xe0, 0x78, 0x1e, 0xf, 0xc3, 0x31, 0xce, 0xe1, + 0xf8, 0x70, + + /* U+59 "Y" */ + 0xe0, 0xfc, 0x1d, 0xc7, 0x38, 0xe3, 0x98, 0x77, + 0x6, 0xc0, 0xf8, 0xe, 0x1, 0xc0, 0x38, 0x7, + 0x0, 0xe0, 0x1c, 0x0, + + /* U+5A "Z" */ + 0xff, 0xff, 0xc0, 0xe0, 0xe0, 0x60, 0x70, 0x70, + 0x38, 0x38, 0x38, 0x1c, 0x1c, 0xf, 0xff, 0xfc, + + /* U+5B "[" */ + 0xff, 0xfe, 0x38, 0xe3, 0x8e, 0x38, 0xe3, 0x8e, + 0x38, 0xe3, 0x8e, 0x38, 0xff, 0xf0, + + /* U+5C "\\" */ + 0xe0, 0x18, 0x7, 0x1, 0xc0, 0x30, 0xe, 0x3, + 0x80, 0x60, 0x1c, 0x3, 0x0, 0xe0, 0x38, 0x6, + 0x1, 0xc0, 0x70, 0xc, 0x3, 0x80, 0x60, 0x1c, + + /* U+5D "]" */ + 0xff, 0xf1, 0xc7, 0x1c, 0x71, 0xc7, 0x1c, 0x71, + 0xc7, 0x1c, 0x71, 0xc7, 0xff, 0xf0, + + /* U+5E "^" */ + 0xc, 0x7, 0x81, 0xe0, 0xfc, 0x33, 0x1c, 0xe6, + 0x19, 0x86, + + /* U+5F "_" */ + 0xff, 0xff, 0xf0, + + /* U+60 "`" */ + 0x63, 0x8e, + + /* U+61 "a" */ + 0x3f, 0x1f, 0xee, 0x1c, 0x7, 0x3f, 0xdf, 0xfe, + 0x1f, 0x87, 0xe3, 0xff, 0xf7, 0xdc, + + /* U+62 "b" */ + 0xe0, 0x38, 0xe, 0x3, 0xbc, 0xff, 0xbc, 0xfe, + 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0xff, + 0xbb, 0xc0, + + /* U+63 "c" */ + 0x3f, 0x1f, 0xef, 0x1f, 0x83, 0xe0, 0x38, 0xe, + 0x3, 0x87, 0xf1, 0xdf, 0xe3, 0xe0, + + /* U+64 "d" */ + 0x1, 0xc0, 0x70, 0x1c, 0xf7, 0x7f, 0xfc, 0xfe, + 0x1f, 0x87, 0xe1, 0xf8, 0x7e, 0x1f, 0xcf, 0x7f, + 0xcf, 0x70, + + /* U+65 "e" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xff, 0xff, 0xfe, + 0x3, 0x80, 0xf1, 0xdf, 0xe3, 0xf0, + + /* U+66 "f" */ + 0xf, 0xc7, 0xf1, 0xc0, 0x70, 0xff, 0xff, 0xf1, + 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0x1c, + 0x7, 0x0, + + /* U+67 "g" */ + 0x3d, 0xdf, 0xff, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0xcf, 0x7f, 0xcf, 0x70, 0x1c, 0xf, 0x3f, + 0x8f, 0xc0, + + /* U+68 "h" */ + 0xe0, 0x70, 0x38, 0x1d, 0xcf, 0xf7, 0x9f, 0x8f, + 0xc7, 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1c, + + /* U+69 "i" */ + 0x1c, 0x7, 0x0, 0x0, 0x0, 0xfc, 0x3f, 0x1, + 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0x1c, + 0x3f, 0xff, 0xfc, + + /* U+6A "j" */ + 0x7, 0x7, 0x0, 0x0, 0x7f, 0x7f, 0x7, 0x7, + 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0x7, 0xf, + 0xfe, 0xfc, + + /* U+6B "k" */ + 0xe0, 0x38, 0xe, 0x3, 0x87, 0xe1, 0xb8, 0xee, + 0x33, 0x9c, 0xfe, 0x3f, 0x8e, 0x73, 0x8e, 0xe3, + 0xb8, 0x70, + + /* U+6C "l" */ + 0xfe, 0x1f, 0xc0, 0x38, 0x7, 0x0, 0xe0, 0x1c, + 0x3, 0x80, 0x70, 0xe, 0x1, 0xc0, 0x38, 0x7, + 0x0, 0xfe, 0xf, 0xc0, + + /* U+6D "m" */ + 0xd9, 0xbf, 0xfc, 0xcf, 0x33, 0xcc, 0xf3, 0x3c, + 0xcf, 0x33, 0xcc, 0xf3, 0x3c, 0xcc, + + /* U+6E "n" */ + 0xee, 0x7f, 0xbc, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, + 0xc7, 0xe3, 0xf1, 0xf8, 0xe0, + + /* U+6F "o" */ + 0x3f, 0x1f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0x87, 0xf3, 0xdf, 0xe3, 0xf0, + + /* U+70 "p" */ + 0xef, 0x3f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0x87, 0xf3, 0xff, 0xee, 0xf3, 0x80, 0xe0, + 0x38, 0x0, + + /* U+71 "q" */ + 0x3d, 0xdf, 0xff, 0x3f, 0x87, 0xe1, 0xf8, 0x7e, + 0x1f, 0x87, 0xf3, 0xdf, 0xf3, 0xdc, 0x7, 0x1, + 0xc0, 0x70, + + /* U+72 "r" */ + 0xef, 0x3f, 0xef, 0x3f, 0x87, 0xe1, 0xf8, 0xe, + 0x3, 0x80, 0xe0, 0x38, 0xe, 0x0, + + /* U+73 "s" */ + 0x3f, 0x3f, 0xee, 0x1f, 0x80, 0xfc, 0x1f, 0xe0, + 0x3c, 0x7, 0xe1, 0xff, 0xe3, 0xf0, + + /* U+74 "t" */ + 0x1c, 0x7, 0x1, 0xc3, 0xff, 0xff, 0xc7, 0x1, + 0xc0, 0x70, 0x1c, 0x7, 0x1, 0xc0, 0x70, 0xf, + 0xc1, 0xf0, + + /* U+75 "u" */ + 0xe3, 0xf1, 0xf8, 0xfc, 0x7e, 0x3f, 0x1f, 0x8f, + 0xc7, 0xe3, 0xbf, 0x8f, 0x80, + + /* U+76 "v" */ + 0xc0, 0xf8, 0x76, 0x19, 0x86, 0x73, 0x8c, 0xc3, + 0x30, 0xfc, 0x1e, 0x7, 0x81, 0xe0, + + /* U+77 "w" */ + 0xc6, 0x79, 0xcf, 0x39, 0xb5, 0x36, 0xa6, 0xd6, + 0xda, 0xdb, 0x4e, 0x79, 0xcf, 0x38, 0xc7, 0x0, + + /* U+78 "x" */ + 0xe1, 0xdc, 0xe3, 0x30, 0xfc, 0x1e, 0x7, 0x81, + 0xe0, 0xfc, 0x73, 0x9c, 0x6e, 0x1c, + + /* U+79 "y" */ + 0xe1, 0xf8, 0x76, 0x19, 0xce, 0x33, 0x8e, 0xc3, + 0xf0, 0x7c, 0x1e, 0x3, 0x80, 0xc0, 0x70, 0x1c, + 0x6, 0x0, + + /* U+7A "z" */ + 0xff, 0xff, 0xc1, 0xe0, 0xe0, 0xe0, 0xe0, 0xe0, + 0xe0, 0xe0, 0x7f, 0xff, 0xe0, + + /* U+7B "{" */ + 0x7, 0x87, 0xc3, 0x81, 0xc0, 0xe0, 0x70, 0x38, + 0x1c, 0xfc, 0x7e, 0x3, 0x81, 0xc0, 0xe0, 0x70, + 0x38, 0x1c, 0xf, 0x83, 0xc0, + + /* U+7C "|" */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, + + /* U+7D "}" */ + 0xf0, 0x3f, 0x1, 0xc0, 0x70, 0x1c, 0x7, 0x1, + 0xc0, 0x70, 0xf, 0xc3, 0xf1, 0xc0, 0x70, 0x1c, + 0x7, 0x1, 0xc0, 0x70, 0xf8, 0x3c, 0x0, + + /* U+7E "~" */ + 0x78, 0xff, 0x3c, 0xff, 0x1e, + + /* U+F001 "" */ + 0x0, 0x0, 0x70, 0x0, 0x7f, 0x0, 0x3f, 0xf0, + 0x1f, 0xff, 0x7, 0xff, 0xf0, 0x7f, 0xff, 0x7, + 0xfc, 0x70, 0x7e, 0x7, 0x7, 0x0, 0x70, 0x70, + 0x7, 0x7, 0x0, 0x70, 0x70, 0x7, 0x7, 0x0, + 0x70, 0x70, 0x7f, 0x7, 0xf, 0xf7, 0xf0, 0xff, + 0xff, 0x7, 0xef, 0xf0, 0x0, 0xff, 0x0, 0x3, + 0xc0, 0x0, + + /* U+F017 "" */ + 0x3, 0xf8, 0x1, 0xff, 0xc0, 0x7f, 0xfc, 0x1f, + 0xff, 0xc7, 0xf1, 0xfc, 0xfe, 0x3f, 0x9f, 0xc7, + 0xf7, 0xf8, 0xff, 0xff, 0x1f, 0xff, 0xe3, 0xff, + 0xfc, 0x3f, 0xff, 0x83, 0xff, 0xfc, 0x7e, 0xff, + 0xcf, 0x9f, 0xff, 0xf1, 0xff, 0xfc, 0x1f, 0xff, + 0x1, 0xff, 0xc0, 0x1f, 0xf0, 0x0, 0x70, 0x0, + + /* U+F03A "" */ + 0xf0, 0x0, 0xf, 0x3f, 0xff, 0xf3, 0xff, 0xff, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0xf, 0x0, 0x0, 0xf3, 0xff, 0xff, 0x3f, + 0xff, 0xf0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0xf, 0x0, 0x0, 0xf3, 0xff, 0xff, 0x3f, 0xff, + 0xf0, 0x0, 0x0, + + /* U+F069 "" */ + 0x0, 0xe0, 0x0, 0x1c, 0x0, 0x3, 0x80, 0x0, + 0x70, 0x6, 0xe, 0xc, 0xf1, 0xc7, 0x9f, 0xbb, + 0xf1, 0xff, 0xfc, 0xf, 0xfe, 0x0, 0x7f, 0x0, + 0xf, 0xe0, 0x7, 0xff, 0x3, 0xff, 0xf8, 0xfd, + 0xdf, 0x9e, 0x38, 0xf3, 0x7, 0x6, 0x0, 0xe0, + 0x0, 0x1c, 0x0, 0x3, 0x80, 0x0, 0x70, 0x0, + + /* U+F129 "" */ + 0x3c, 0x7e, 0x7e, 0x7e, 0x3c, 0x0, 0x0, 0xfc, + 0xfc, 0xfc, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, + 0xff, 0xff, 0xff, + + /* U+F185 "" */ + 0x0, 0x60, 0x0, 0x6, 0x0, 0x0, 0xf0, 0x1, + 0xcf, 0x38, 0x1f, 0xff, 0x81, 0xf0, 0xf8, 0xc, + 0xf3, 0x1, 0xdf, 0xb8, 0x7b, 0xfd, 0xef, 0xbf, + 0xdf, 0x7b, 0xfd, 0xe1, 0x9f, 0x98, 0xc, 0xf3, + 0x0, 0xc0, 0x30, 0x1f, 0xf, 0x81, 0xff, 0xf8, + 0x1c, 0xf3, 0x80, 0xf, 0x0, 0x0, 0x60, 0x0, + 0x6, 0x0, + + /* U+F1E6 "" */ + 0x18, 0x30, 0x70, 0x70, 0xe0, 0xe1, 0xc1, 0xc3, + 0x83, 0x80, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x7f, + 0xfc, 0xff, 0xf9, 0xff, 0xf1, 0xff, 0xc3, 0xff, + 0x83, 0xfe, 0x3, 0xf8, 0x1, 0xc0, 0x3, 0x80, + 0x7, 0x0, 0xe, 0x0, + + /* U+F1FC "" */ + 0x0, 0x0, 0xf0, 0x0, 0x1f, 0x0, 0x3, 0xf0, + 0x0, 0x7e, 0x0, 0xf, 0xe0, 0x3, 0xfc, 0x0, + 0x7f, 0xc0, 0xf, 0xf8, 0x0, 0xff, 0x80, 0x1f, + 0xf0, 0x0, 0xfe, 0x0, 0xf, 0xe0, 0xe, 0x7c, + 0x1, 0xf8, 0x0, 0x9f, 0xc0, 0xf, 0xfc, 0x0, + 0x7f, 0xc0, 0x7, 0xf8, 0x0, 0x1f, 0x0, 0x0, + + /* U+F21E "" */ + 0x1e, 0x7, 0x83, 0xf9, 0xfe, 0x7f, 0xff, 0xef, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xfc, + 0xf7, 0xf7, 0xd6, 0x3e, 0x79, 0x6b, 0xe0, 0x34, + 0x80, 0x1f, 0x9f, 0x80, 0xf9, 0xf0, 0x7, 0xfe, + 0x0, 0x3f, 0xc0, 0x1, 0xf8, 0x0, 0xf, 0x0, + 0x0, 0x60, 0x0, + + /* U+F240 "" */ + 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, + 0x1, 0xfd, 0xff, 0xfe, 0xfe, 0xff, 0xff, 0x7f, + 0x7f, 0xff, 0x9f, 0xbf, 0xff, 0xcf, 0xdf, 0xff, + 0xe7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, + 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, + + /* U+F241 "" */ + 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, + 0x1, 0xfd, 0xff, 0xe0, 0xfe, 0xff, 0xf0, 0x7f, + 0x7f, 0xf8, 0x1f, 0xbf, 0xfc, 0xf, 0xdf, 0xfe, + 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, + 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, + + /* U+F242 "" */ + 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, + 0x1, 0xfd, 0xfe, 0x0, 0xfe, 0xff, 0x0, 0x7f, + 0x7f, 0x80, 0x1f, 0xbf, 0xc0, 0xf, 0xdf, 0xe0, + 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, + 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, + + /* U+F243 "" */ + 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, + 0x1, 0xfd, 0xf0, 0x0, 0xfe, 0xf8, 0x0, 0x7f, + 0x7c, 0x0, 0x1f, 0xbe, 0x0, 0xf, 0xdf, 0x0, + 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, + 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, + + /* U+F244 "" */ + 0x7f, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xb8, 0x0, + 0x1, 0xfc, 0x0, 0x0, 0xfe, 0x0, 0x0, 0x7f, + 0x0, 0x0, 0x1f, 0x80, 0x0, 0xf, 0xc0, 0x0, + 0x7, 0xe0, 0x0, 0x7, 0xf0, 0x0, 0x3, 0xff, + 0xff, 0xff, 0xcf, 0xff, 0xff, 0xe0, + + /* U+F293 "" */ + 0x7, 0xe0, 0x3f, 0xe0, 0xfb, 0xe3, 0xf3, 0xe7, + 0xe3, 0xdf, 0xd3, 0xf9, 0xb3, 0xf9, 0x4f, 0xf8, + 0x3f, 0xf8, 0xff, 0xf1, 0xff, 0xc1, 0xff, 0x29, + 0xfc, 0xd9, 0xff, 0xa7, 0xbf, 0x1e, 0x7e, 0x7c, + 0x7d, 0xf0, 0x7f, 0xe0, 0x7f, 0x0, + + /* U+F294 "" */ + 0x0, 0x0, 0x80, 0x18, 0x3, 0x80, 0x78, 0x8d, + 0xb9, 0x9b, 0xb6, 0x3f, 0x83, 0xe0, 0x38, 0x7, + 0x81, 0xf8, 0x6d, 0x99, 0x9a, 0x36, 0x7, 0x80, + 0xe0, 0x18, 0x2, 0x0, 0x0, + + /* U+F3FD "" */ + 0x0, 0xfe, 0x0, 0x7, 0xff, 0x0, 0x3f, 0xbf, + 0x80, 0xfe, 0x2f, 0x83, 0xfe, 0xcf, 0x8f, 0x3f, + 0x27, 0x9e, 0x7e, 0x4f, 0x3f, 0xfc, 0xfe, 0xff, + 0xf3, 0xff, 0xff, 0xe7, 0xff, 0xff, 0xcf, 0xff, + 0xfe, 0x3f, 0xfe, 0x78, 0x3c, 0xff, 0xf0, 0x7f, + 0xdf, 0xe0, 0xff, 0x3f, 0xff, 0xfe, 0x3f, 0xff, + 0xf8, + + /* U+F54B "" */ + 0x0, 0xf, 0xf8, 0x1, 0xdf, 0xff, 0x1, 0xef, + 0xff, 0xc0, 0xf7, 0xff, 0xf0, 0x7b, 0xff, 0xf8, + 0x1d, 0xff, 0xfc, 0x0, 0x1f, 0xfc, 0x0, 0x3, + 0xfc, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x7, 0xf8, 0x0, 0xf, 0xfe, + 0x3, 0xbf, 0xff, 0x83, 0xdf, 0xff, 0xc1, 0xef, + 0xff, 0xe0, 0xf7, 0xff, 0xe0, 0x3b, 0xff, 0xe0, + 0x0, 0x7f, 0xc0, 0x0, + + /* U+F560 "" */ + 0x0, 0x0, 0x0, 0x0, 0x60, 0x0, 0xf, 0x0, + 0x1, 0xf0, 0x8, 0x3e, 0x1, 0xc7, 0xc4, 0x1e, + 0xf8, 0xe1, 0xff, 0x1f, 0xf, 0xe3, 0xf0, 0x7c, + 0x7e, 0x23, 0x8f, 0xc7, 0x11, 0xf8, 0xf8, 0x3f, + 0xf, 0xc7, 0xe0, 0x7e, 0xfc, 0x3, 0xff, 0x80, + 0x1f, 0xf0, 0x0, 0xfe, 0x0, 0x7, 0xc0, 0x0, + 0x38, 0x0, 0x1, 0x0, 0x0 +}; + + +/*--------------------- + * GLYPH DESCRIPTION + *--------------------*/ + +static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { + {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, + {.bitmap_index = 0, .adv_w = 192, .box_w = 1, .box_h = 1, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1, .adv_w = 192, .box_w = 3, .box_h = 14, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 7, .adv_w = 192, .box_w = 7, .box_h = 6, .ofs_x = 3, .ofs_y = 8}, + {.bitmap_index = 13, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 33, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 57, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 77, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 97, .adv_w = 192, .box_w = 3, .box_h = 6, .ofs_x = 5, .ofs_y = 8}, + {.bitmap_index = 100, .adv_w = 192, .box_w = 7, .box_h = 19, .ofs_x = 3, .ofs_y = -2}, + {.bitmap_index = 117, .adv_w = 192, .box_w = 7, .box_h = 19, .ofs_x = 2, .ofs_y = -2}, + {.bitmap_index = 134, .adv_w = 192, .box_w = 10, .box_h = 10, .ofs_x = 1, .ofs_y = 1}, + {.bitmap_index = 147, .adv_w = 192, .box_w = 10, .box_h = 9, .ofs_x = 1, .ofs_y = 2}, + {.bitmap_index = 159, .adv_w = 192, .box_w = 5, .box_h = 6, .ofs_x = 3, .ofs_y = -3}, + {.bitmap_index = 163, .adv_w = 192, .box_w = 8, .box_h = 2, .ofs_x = 2, .ofs_y = 5}, + {.bitmap_index = 165, .adv_w = 192, .box_w = 4, .box_h = 4, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 167, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 191, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 209, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 225, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 243, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 261, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 277, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 293, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 311, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 329, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 347, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 365, .adv_w = 192, .box_w = 3, .box_h = 11, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 370, .adv_w = 192, .box_w = 5, .box_h = 14, .ofs_x = 3, .ofs_y = -3}, + {.bitmap_index = 379, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 1}, + {.bitmap_index = 392, .adv_w = 192, .box_w = 9, .box_h = 7, .ofs_x = 2, .ofs_y = 3}, + {.bitmap_index = 400, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 1}, + {.bitmap_index = 413, .adv_w = 192, .box_w = 8, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 427, .adv_w = 192, .box_w = 11, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 451, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 472, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 490, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 508, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 526, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 542, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 558, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 576, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 592, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 608, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 626, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 646, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 662, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 680, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 696, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 714, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 732, .adv_w = 192, .box_w = 10, .box_h = 17, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 754, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 772, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 790, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 808, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 824, .adv_w = 192, .box_w = 12, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 845, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 865, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 883, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 903, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 919, .adv_w = 192, .box_w = 6, .box_h = 18, .ofs_x = 4, .ofs_y = -2}, + {.bitmap_index = 933, .adv_w = 192, .box_w = 10, .box_h = 19, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 957, .adv_w = 192, .box_w = 6, .box_h = 18, .ofs_x = 3, .ofs_y = -2}, + {.bitmap_index = 971, .adv_w = 192, .box_w = 10, .box_h = 8, .ofs_x = 1, .ofs_y = 6}, + {.bitmap_index = 981, .adv_w = 192, .box_w = 10, .box_h = 2, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 984, .adv_w = 192, .box_w = 5, .box_h = 3, .ofs_x = 3, .ofs_y = 13}, + {.bitmap_index = 986, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1000, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1018, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1032, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1050, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1064, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1082, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 1100, .adv_w = 192, .box_w = 9, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1116, .adv_w = 192, .box_w = 10, .box_h = 15, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1135, .adv_w = 192, .box_w = 8, .box_h = 18, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 1153, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1171, .adv_w = 192, .box_w = 11, .box_h = 14, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1191, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1205, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1218, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1232, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 1250, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 1268, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1282, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1296, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1314, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1327, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1341, .adv_w = 192, .box_w = 11, .box_h = 11, .ofs_x = 0, .ofs_y = 0}, + {.bitmap_index = 1357, .adv_w = 192, .box_w = 10, .box_h = 11, .ofs_x = 1, .ofs_y = 0}, + {.bitmap_index = 1371, .adv_w = 192, .box_w = 10, .box_h = 14, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 1389, .adv_w = 192, .box_w = 9, .box_h = 11, .ofs_x = 2, .ofs_y = 0}, + {.bitmap_index = 1402, .adv_w = 192, .box_w = 9, .box_h = 18, .ofs_x = 2, .ofs_y = -2}, + {.bitmap_index = 1423, .adv_w = 192, .box_w = 3, .box_h = 18, .ofs_x = 5, .ofs_y = -2}, + {.bitmap_index = 1430, .adv_w = 192, .box_w = 10, .box_h = 18, .ofs_x = 1, .ofs_y = -2}, + {.bitmap_index = 1453, .adv_w = 192, .box_w = 10, .box_h = 4, .ofs_x = 1, .ofs_y = 5}, + {.bitmap_index = 1458, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 1508, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 1556, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 1599, .adv_w = 320, .box_w = 19, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 1647, .adv_w = 120, .box_w = 8, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 1666, .adv_w = 320, .box_w = 20, .box_h = 20, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 1716, .adv_w = 240, .box_w = 15, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 1752, .adv_w = 320, .box_w = 20, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 1800, .adv_w = 320, .box_w = 20, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 1843, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 1881, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 1919, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 1957, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 1995, .adv_w = 400, .box_w = 25, .box_h = 12, .ofs_x = 0, .ofs_y = 1}, + {.bitmap_index = 2033, .adv_w = 280, .box_w = 15, .box_h = 20, .ofs_x = 1, .ofs_y = -3}, + {.bitmap_index = 2071, .adv_w = 200, .box_w = 11, .box_h = 21, .ofs_x = 0, .ofs_y = -3}, + {.bitmap_index = 2100, .adv_w = 360, .box_w = 23, .box_h = 17, .ofs_x = 0, .ofs_y = -1}, + {.bitmap_index = 2149, .adv_w = 400, .box_w = 25, .box_h = 19, .ofs_x = 0, .ofs_y = -2}, + {.bitmap_index = 2209, .adv_w = 320, .box_w = 20, .box_h = 21, .ofs_x = 0, .ofs_y = -3} +}; + +/*--------------------- + * CHARACTER MAPPING + *--------------------*/ + +static const uint16_t unicode_list_1[] = { + 0x0, 0x16, 0x39, 0x68, 0x128, 0x184, 0x1e5, 0x1fb, + 0x21d, 0x23f, 0x240, 0x241, 0x242, 0x243, 0x292, 0x293, + 0x3fc, 0x54a, 0x55f +}; + +/*Collect the unicode lists and glyph_id offsets*/ +static const lv_font_fmt_txt_cmap_t cmaps[] = +{ + { + .range_start = 32, .range_length = 95, .glyph_id_start = 1, + .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY + }, + { + .range_start = 61441, .range_length = 1376, .glyph_id_start = 96, + .unicode_list = unicode_list_1, .glyph_id_ofs_list = NULL, .list_length = 19, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY + } +}; + + + +/*-------------------- + * ALL CUSTOM DATA + *--------------------*/ + +/*Store all the custom data of the font*/ +static lv_font_fmt_txt_dsc_t font_dsc = { + .glyph_bitmap = gylph_bitmap, + .glyph_dsc = glyph_dsc, + .cmaps = cmaps, + .kern_dsc = NULL, + .kern_scale = 0, + .cmap_num = 2, + .bpp = 1, + .kern_classes = 0, + .bitmap_format = 0 +}; + + +/*----------------- + * PUBLIC FONT + *----------------*/ + +/*Initialize a public general font descriptor*/ +lv_font_t jetbrains_mono_bold_20 = { + .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ + .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ + .line_height = 21, /*The maximum line height required by the font*/ + .base_line = 3, /*Baseline measured from the bottom of the line*/ +#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) + .subpx = LV_FONT_SUBPX_NONE, +#endif + .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ +}; + +#endif /*#if JETBRAINS_MONO_BOLD_20*/ + diff --git a/src/displayapp/fonts/jetbrains_mono_extrabold_compressed.c b/src/displayapp/fonts/jetbrains_mono_extrabold_compressed.c new file mode 100644 index 0000000..c9917e4 --- /dev/null +++ b/src/displayapp/fonts/jetbrains_mono_extrabold_compressed.c @@ -0,0 +1,507 @@ +#include "lvgl/lvgl.h" + +/******************************************************************************* + * Size: 80 px + * Bpp: 1 + * Opts: + ******************************************************************************/ + +#ifndef JETBRAINS_MONO_EXTRABOLD_COMPRESSED +#define JETBRAINS_MONO_EXTRABOLD_COMPRESSED 1 +#endif + +#if JETBRAINS_MONO_EXTRABOLD_COMPRESSED + +/*----------------- + * BITMAPS + *----------------*/ + +/*Store the image of the glyphs*/ +static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = { + /* U+30 "0" */ + 0x0, 0x1, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, + 0xfe, 0x0, 0x0, 0x1f, 0xff, 0xff, 0xc0, 0x0, + 0x3f, 0xff, 0xff, 0xf8, 0x0, 0x3f, 0xff, 0xff, + 0xfe, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x80, 0x3f, + 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, + 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, + 0xff, 0xff, 0xff, 0x1f, 0xff, 0xe0, 0x3f, 0xff, + 0xcf, 0xff, 0xc0, 0x7, 0xff, 0xe7, 0xff, 0xc0, + 0x1, 0xff, 0xf7, 0xff, 0xc0, 0x0, 0x7f, 0xff, + 0xff, 0xe0, 0x0, 0x3f, 0xff, 0xff, 0xe0, 0x0, + 0xf, 0xff, 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, + 0xf8, 0x0, 0x3, 0xff, 0xff, 0xfc, 0x0, 0x1, + 0xff, 0xff, 0xfe, 0x0, 0x0, 0xff, 0xff, 0xff, + 0x0, 0x0, 0x7f, 0xff, 0xff, 0x80, 0x0, 0x3f, + 0xff, 0xff, 0xc0, 0x70, 0x1f, 0xff, 0xff, 0xe0, + 0x7c, 0xf, 0xff, 0xff, 0xf0, 0x7f, 0x7, 0xff, + 0xff, 0xf8, 0x3f, 0x83, 0xff, 0xff, 0xfc, 0x1f, + 0xc1, 0xff, 0xff, 0xfe, 0xf, 0xe0, 0xff, 0xff, + 0xff, 0x7, 0xf0, 0x7f, 0xff, 0xff, 0x83, 0xf8, + 0x3f, 0xff, 0xff, 0xc1, 0xfc, 0x1f, 0xff, 0xff, + 0xe0, 0xfe, 0xf, 0xff, 0xff, 0xf0, 0x7f, 0x7, + 0xff, 0xff, 0xf8, 0x3f, 0x83, 0xff, 0xff, 0xfc, + 0x1f, 0xc1, 0xff, 0xff, 0xfe, 0xf, 0xe0, 0xff, + 0xff, 0xff, 0x3, 0xe0, 0x7f, 0xff, 0xff, 0x80, + 0xe0, 0x3f, 0xff, 0xff, 0xc0, 0x0, 0x1f, 0xff, + 0xff, 0xe0, 0x0, 0xf, 0xff, 0xff, 0xf0, 0x0, + 0x7, 0xff, 0xff, 0xf8, 0x0, 0x3, 0xff, 0xff, + 0xfc, 0x0, 0x1, 0xff, 0xff, 0xfe, 0x0, 0x0, + 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, + 0xc0, 0x0, 0x7f, 0xf9, 0xff, 0xf0, 0x0, 0x7f, + 0xfc, 0xff, 0xfc, 0x0, 0x7f, 0xfe, 0x7f, 0xff, + 0x80, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, + 0x7, 0xff, 0xff, 0xff, 0xff, 0x3, 0xff, 0xff, + 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0x80, + 0x3f, 0xff, 0xff, 0xff, 0x80, 0xf, 0xff, 0xff, + 0xff, 0x80, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, + 0x7f, 0xff, 0xff, 0x0, 0x0, 0xf, 0xff, 0xfc, + 0x0, 0x0, 0x0, 0x7f, 0xf0, 0x0, 0x0, + + /* U+31 "1" */ + 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0xf, 0xff, + 0xe0, 0x0, 0x0, 0x3f, 0xff, 0xe0, 0x0, 0x0, + 0x7f, 0xff, 0xe0, 0x0, 0x1, 0xff, 0xff, 0xe0, + 0x0, 0x3, 0xff, 0xff, 0xe0, 0x0, 0x7, 0xff, + 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xe0, 0x0, + 0x3f, 0xff, 0xff, 0xe0, 0x0, 0x7f, 0xff, 0xff, + 0xe0, 0x0, 0x7f, 0xff, 0xff, 0xe0, 0x0, 0x7f, + 0xfd, 0xff, 0xe0, 0x0, 0x7f, 0xf9, 0xff, 0xe0, + 0x0, 0x7f, 0xf1, 0xff, 0xe0, 0x0, 0x7f, 0xe1, + 0xff, 0xe0, 0x0, 0x7f, 0x81, 0xff, 0xe0, 0x0, + 0x7f, 0x1, 0xff, 0xe0, 0x0, 0x7c, 0x1, 0xff, + 0xe0, 0x0, 0x78, 0x1, 0xff, 0xe0, 0x0, 0x60, + 0x1, 0xff, 0xe0, 0x0, 0x40, 0x1, 0xff, 0xe0, + 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, + 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, + 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, + 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, + 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, + 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, + 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, + 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, + 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, + 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, + 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, + 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, + 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x1, + 0xff, 0xe0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, + + /* U+32 "2" */ + 0x0, 0x1, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, + 0xfc, 0x0, 0x0, 0x1f, 0xff, 0xff, 0x80, 0x0, + 0x3f, 0xff, 0xff, 0xf0, 0x0, 0x3f, 0xff, 0xff, + 0xfc, 0x0, 0x3f, 0xff, 0xff, 0xff, 0x0, 0x3f, + 0xff, 0xff, 0xff, 0xc0, 0x3f, 0xff, 0xff, 0xff, + 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xff, + 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xe0, 0x7f, 0xff, + 0x8f, 0xff, 0xc0, 0xf, 0xff, 0xc7, 0xff, 0xc0, + 0x3, 0xff, 0xe7, 0xff, 0xc0, 0x0, 0xff, 0xfb, + 0xff, 0xc0, 0x0, 0x7f, 0xfd, 0xff, 0xe0, 0x0, + 0x1f, 0xfe, 0xff, 0xf0, 0x0, 0xf, 0xff, 0x0, + 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, + 0xff, 0xc0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, + 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, + 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x0, 0x3f, 0xfe, + 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, + 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, + 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, + 0xff, 0x80, 0x0, 0x0, 0x7f, 0xff, 0x80, 0x0, + 0x0, 0x7f, 0xff, 0x80, 0x0, 0x0, 0x7f, 0xff, + 0x80, 0x0, 0x0, 0x7f, 0xff, 0x80, 0x0, 0x0, + 0xff, 0xff, 0x80, 0x0, 0x0, 0xff, 0xff, 0x80, + 0x0, 0x0, 0xff, 0xff, 0x80, 0x0, 0x0, 0xff, + 0xff, 0x80, 0x0, 0x1, 0xff, 0xff, 0x0, 0x0, + 0x1, 0xff, 0xff, 0x0, 0x0, 0x1, 0xff, 0xff, + 0x0, 0x0, 0x1, 0xff, 0xfe, 0x0, 0x0, 0x3, + 0xff, 0xfe, 0x0, 0x0, 0x3, 0xff, 0xfe, 0x0, + 0x0, 0x3, 0xff, 0xfc, 0x0, 0x0, 0x3, 0xff, + 0xfc, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, + 0x0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, + 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, 0xff, + 0xdf, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, + 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xfb, + 0xff, 0xff, 0xff, 0xff, 0xfd, 0xff, 0xff, 0xff, + 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, + 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0xff, + 0xff, 0xc0, + + /* U+33 "3" */ + 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, 0xff, 0xff, + 0xff, 0xff, 0x7, 0xff, 0xff, 0xff, 0xff, 0x83, + 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, 0xff, + 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x7f, + 0xff, 0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xff, + 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, 0xff, + 0xff, 0x8f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, + 0x80, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, + 0x1f, 0xff, 0x80, 0x0, 0x0, 0x3f, 0xff, 0x80, + 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, + 0xff, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, + 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfe, + 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, + 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, + 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, 0x0, 0xf, + 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, 0xff, 0x0, + 0x0, 0x3, 0xff, 0xff, 0xe0, 0x0, 0x1, 0xff, + 0xff, 0xf8, 0x0, 0x0, 0xff, 0xff, 0xfe, 0x0, + 0x0, 0x7f, 0xff, 0xff, 0x80, 0x0, 0x3f, 0xff, + 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf0, 0x0, + 0xf, 0xff, 0xff, 0xfc, 0x0, 0x0, 0x0, 0xff, + 0xfe, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x80, 0x0, + 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x1, 0xff, + 0xe0, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, + 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, 0xfe, + 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, + 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, + 0x0, 0x0, 0x1, 0xff, 0xff, 0xfe, 0x0, 0x0, + 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xff, 0xff, + 0xc0, 0x0, 0x7f, 0xf9, 0xff, 0xf0, 0x0, 0x7f, + 0xfc, 0xff, 0xfc, 0x0, 0x7f, 0xfe, 0x7f, 0xff, + 0x80, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, + 0xf, 0xff, 0xff, 0xff, 0xff, 0x3, 0xff, 0xff, + 0xff, 0xff, 0x80, 0xff, 0xff, 0xff, 0xff, 0x80, + 0x3f, 0xff, 0xff, 0xff, 0x80, 0xf, 0xff, 0xff, + 0xff, 0x80, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, + 0x7f, 0xff, 0xff, 0x0, 0x0, 0xf, 0xff, 0xfc, + 0x0, 0x0, 0x0, 0x7f, 0xf0, 0x0, 0x0, + + /* U+34 "4" */ + 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, 0x1f, + 0xff, 0x80, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, + 0x3, 0xff, 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x80, + 0x0, 0x0, 0xff, 0xfc, 0x0, 0x0, 0x3, 0xff, + 0xe0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, + 0xff, 0xfc, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, + 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xff, 0xfc, + 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3f, + 0xff, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, + 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3f, 0xff, 0x0, + 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, + 0xc0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x1, + 0xff, 0xf8, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, + 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x1, 0xff, 0xf8, + 0x0, 0x0, 0xf, 0xff, 0xc0, 0x0, 0x0, 0x3f, + 0xfe, 0x0, 0xff, 0xf1, 0xff, 0xf0, 0x3, 0xff, + 0xcf, 0xff, 0xc0, 0xf, 0xff, 0x7f, 0xfe, 0x0, + 0x3f, 0xfd, 0xff, 0xf0, 0x0, 0xff, 0xff, 0xff, + 0xc0, 0x3, 0xff, 0xff, 0xfe, 0x0, 0xf, 0xff, + 0xff, 0xf0, 0x0, 0x3f, 0xff, 0xff, 0x80, 0x0, + 0xff, 0xff, 0xfe, 0x0, 0x3, 0xff, 0xff, 0xf8, + 0x0, 0xf, 0xff, 0xff, 0xe0, 0x0, 0x3f, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, + 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, + 0xfc, 0x0, 0x0, 0x0, 0xff, 0xf0, 0x0, 0x0, + 0x3, 0xff, 0xc0, 0x0, 0x0, 0xf, 0xff, 0x0, + 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0xff, + 0xf0, 0x0, 0x0, 0x3, 0xff, 0xc0, 0x0, 0x0, + 0xf, 0xff, 0x0, 0x0, 0x0, 0x3f, 0xfc, 0x0, + 0x0, 0x0, 0xff, 0xf0, + + /* U+35 "5" */ + 0x3f, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, + 0xff, 0xff, 0xf, 0xff, 0xff, 0xff, 0xff, 0x87, + 0xff, 0xff, 0xff, 0xff, 0xc3, 0xff, 0xff, 0xff, + 0xff, 0xe1, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, + 0xff, 0xff, 0xff, 0xf8, 0x7f, 0xff, 0xff, 0xff, + 0xfc, 0x3f, 0xff, 0xff, 0xff, 0xfe, 0x1f, 0xff, + 0xff, 0xff, 0xff, 0xf, 0xff, 0x0, 0x0, 0x0, + 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, + 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x0, + 0xff, 0xf0, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, + 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, + 0xfe, 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, + 0x0, 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, + 0xc0, 0x7f, 0x80, 0x1, 0xff, 0xe1, 0xff, 0xf8, + 0x0, 0xff, 0xf1, 0xff, 0xff, 0x0, 0x7f, 0xf9, + 0xff, 0xff, 0xc0, 0x3f, 0xfd, 0xff, 0xff, 0xf0, + 0x1f, 0xff, 0xff, 0xff, 0xfc, 0xf, 0xff, 0xff, + 0xff, 0xff, 0x7, 0xff, 0xff, 0xff, 0xff, 0xc3, + 0xff, 0xff, 0xff, 0xff, 0xe1, 0xff, 0xfc, 0x7, + 0xff, 0xf8, 0xff, 0xf8, 0x0, 0xff, 0xfc, 0x0, + 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0xf, + 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, + 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x0, 0xff, + 0xf0, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, + 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x1f, 0xfe, + 0x0, 0x0, 0x0, 0xf, 0xff, 0x0, 0x0, 0x0, + 0x7, 0xff, 0x80, 0x0, 0x0, 0x3, 0xff, 0xc0, + 0x0, 0x0, 0x1, 0xff, 0xff, 0xff, 0x0, 0x1, + 0xff, 0xff, 0xff, 0x80, 0x0, 0xff, 0xfb, 0xff, + 0xe0, 0x0, 0xff, 0xf9, 0xff, 0xf8, 0x0, 0xff, + 0xfc, 0xff, 0xff, 0x81, 0xff, 0xfe, 0x3f, 0xff, + 0xff, 0xff, 0xfe, 0x1f, 0xff, 0xff, 0xff, 0xff, + 0x7, 0xff, 0xff, 0xff, 0xff, 0x1, 0xff, 0xff, + 0xff, 0xff, 0x0, 0x7f, 0xff, 0xff, 0xff, 0x0, + 0x1f, 0xff, 0xff, 0xff, 0x0, 0x7, 0xff, 0xff, + 0xff, 0x0, 0x0, 0xff, 0xff, 0xfe, 0x0, 0x0, + 0x1f, 0xff, 0xfc, 0x0, 0x0, 0x0, 0xff, 0xe0, + 0x0, 0x0, + + /* U+36 "6" */ + 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, + 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, + 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, + 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, + 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, + 0xc0, 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, + 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, + 0x0, 0x0, 0x0, 0x3f, 0xff, 0x0, 0x0, 0x0, + 0xf, 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, + 0x0, 0x0, 0x3, 0xff, 0xf0, 0x0, 0x0, 0x1, + 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, + 0x0, 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0xf, + 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, + 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x0, 0xff, + 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x3f, 0xc0, + 0x0, 0x1f, 0xfe, 0x3f, 0xfe, 0x0, 0xf, 0xff, + 0xbf, 0xff, 0xe0, 0x3, 0xff, 0xdf, 0xff, 0xfc, + 0x1, 0xff, 0xef, 0xff, 0xff, 0x80, 0x7f, 0xff, + 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xfe, + 0xf, 0xff, 0xff, 0xff, 0xff, 0x87, 0xff, 0xff, + 0xff, 0xff, 0xf1, 0xff, 0xff, 0x3, 0xff, 0xfc, + 0x7f, 0xff, 0x0, 0x3f, 0xff, 0x9f, 0xff, 0x0, + 0x3, 0xff, 0xef, 0xff, 0xc0, 0x0, 0xff, 0xfb, + 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf8, 0x0, + 0x7, 0xff, 0xff, 0xfc, 0x0, 0x0, 0xff, 0xff, + 0xff, 0x0, 0x0, 0x3f, 0xff, 0xff, 0xc0, 0x0, + 0xf, 0xff, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, + 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, + 0x3f, 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0x7f, + 0xf8, 0x0, 0x7, 0xff, 0xdf, 0xfe, 0x0, 0x3, + 0xff, 0xe7, 0xff, 0xc0, 0x0, 0xff, 0xf9, 0xff, + 0xfc, 0x0, 0xff, 0xfe, 0x3f, 0xff, 0xc0, 0xff, + 0xff, 0xf, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, + 0xff, 0xff, 0xff, 0xe0, 0x3f, 0xff, 0xff, 0xff, + 0xf0, 0x7, 0xff, 0xff, 0xff, 0xf8, 0x0, 0xff, + 0xff, 0xff, 0xfe, 0x0, 0x1f, 0xff, 0xff, 0xfe, + 0x0, 0x3, 0xff, 0xff, 0xff, 0x0, 0x0, 0x3f, + 0xff, 0xff, 0x0, 0x0, 0x3, 0xff, 0xff, 0x0, + 0x0, 0x0, 0xf, 0xfc, 0x0, 0x0, + + /* U+37 "7" */ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xe0, 0x0, 0xf, 0xff, 0xff, 0xe0, 0x0, 0x1f, + 0xfe, 0xff, 0xe0, 0x0, 0x1f, 0xfe, 0xff, 0xe0, + 0x0, 0x3f, 0xfc, 0xff, 0xe0, 0x0, 0x3f, 0xfc, + 0xff, 0xe0, 0x0, 0x7f, 0xf8, 0xff, 0xe0, 0x0, + 0x7f, 0xf8, 0xff, 0xe0, 0x0, 0xff, 0xf8, 0xff, + 0xe0, 0x0, 0xff, 0xf0, 0x0, 0x0, 0x1, 0xff, + 0xf0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, + 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, 0xc0, + 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, 0x7, + 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0x80, 0x0, + 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, + 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, + 0x1f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfe, 0x0, + 0x0, 0x0, 0x3f, 0xfc, 0x0, 0x0, 0x0, 0x7f, + 0xfc, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, 0x0, + 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, 0xf8, + 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, 0x1, + 0xff, 0xf0, 0x0, 0x0, 0x1, 0xff, 0xe0, 0x0, + 0x0, 0x3, 0xff, 0xe0, 0x0, 0x0, 0x3, 0xff, + 0xc0, 0x0, 0x0, 0x7, 0xff, 0xc0, 0x0, 0x0, + 0x7, 0xff, 0x80, 0x0, 0x0, 0xf, 0xff, 0x80, + 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, 0x0, 0x1f, + 0xff, 0x0, 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, + 0x0, 0x3f, 0xfe, 0x0, 0x0, 0x0, 0x3f, 0xfe, + 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, 0x0, 0x0, + 0x7f, 0xfc, 0x0, 0x0, 0x0, 0x7f, 0xf8, 0x0, + 0x0, 0x0, 0xff, 0xf8, 0x0, 0x0, 0x0, 0xff, + 0xf8, 0x0, 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, + 0x1, 0xff, 0xf0, 0x0, 0x0, 0x3, 0xff, 0xe0, + 0x0, 0x0, + + /* U+38 "8" */ + 0x0, 0x1, 0xff, 0xe0, 0x0, 0x0, 0x7, 0xff, + 0xff, 0x80, 0x0, 0x7, 0xff, 0xff, 0xf8, 0x0, + 0x7, 0xff, 0xff, 0xff, 0x80, 0x3, 0xff, 0xff, + 0xff, 0xf0, 0x1, 0xff, 0xff, 0xff, 0xfe, 0x0, + 0xff, 0xff, 0xff, 0xff, 0xc0, 0x7f, 0xff, 0xff, + 0xff, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, + 0xff, 0xe0, 0x3f, 0xff, 0xc3, 0xff, 0xe0, 0x3, + 0xff, 0xf0, 0xff, 0xf0, 0x0, 0x7f, 0xfc, 0x7f, + 0xf8, 0x0, 0xf, 0xff, 0x9f, 0xfe, 0x0, 0x3, + 0xff, 0xe7, 0xff, 0x0, 0x0, 0x7f, 0xf9, 0xff, + 0xc0, 0x0, 0x1f, 0xfe, 0x7f, 0xf0, 0x0, 0x7, + 0xff, 0x9f, 0xfc, 0x0, 0x1, 0xff, 0xe7, 0xff, + 0x0, 0x0, 0x7f, 0xf9, 0xff, 0xc0, 0x0, 0x1f, + 0xfe, 0x3f, 0xf8, 0x0, 0xf, 0xff, 0xf, 0xfe, + 0x0, 0x3, 0xff, 0xc3, 0xff, 0xc0, 0x1, 0xff, + 0xe0, 0x7f, 0xf8, 0x0, 0xff, 0xf8, 0xf, 0xff, + 0x80, 0xff, 0xfc, 0x1, 0xff, 0xff, 0xff, 0xfe, + 0x0, 0x3f, 0xff, 0xff, 0xff, 0x0, 0x7, 0xff, + 0xff, 0xff, 0x0, 0x0, 0x7f, 0xff, 0xff, 0x0, + 0x0, 0x3, 0xff, 0xfe, 0x0, 0x0, 0x7, 0xff, + 0xff, 0xf0, 0x0, 0x7, 0xff, 0xff, 0xff, 0x80, + 0x7, 0xff, 0xff, 0xff, 0xf0, 0x3, 0xff, 0xff, + 0xff, 0xff, 0x1, 0xff, 0xf8, 0xf, 0xff, 0xe0, + 0xff, 0xf8, 0x0, 0x7f, 0xf8, 0x3f, 0xfc, 0x0, + 0xf, 0xff, 0x1f, 0xfe, 0x0, 0x1, 0xff, 0xe7, + 0xff, 0x80, 0x0, 0x7f, 0xfb, 0xff, 0xc0, 0x0, + 0xf, 0xfe, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, + 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, + 0x3f, 0xff, 0xff, 0xc0, 0x0, 0xf, 0xff, 0xff, + 0xf0, 0x0, 0x3, 0xff, 0xff, 0xfe, 0x0, 0x1, + 0xff, 0xff, 0xff, 0x80, 0x0, 0x7f, 0xff, 0xff, + 0xf0, 0x0, 0x3f, 0xff, 0x7f, 0xfe, 0x0, 0x1f, + 0xff, 0x9f, 0xff, 0xe0, 0x3f, 0xff, 0xe3, 0xff, + 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, + 0xfc, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0x3, 0xff, + 0xff, 0xff, 0xff, 0x0, 0x7f, 0xff, 0xff, 0xff, + 0x80, 0xf, 0xff, 0xff, 0xff, 0xc0, 0x1, 0xff, + 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xe0, + 0x0, 0x1, 0xff, 0xff, 0xe0, 0x0, 0x0, 0x7, + 0xff, 0x80, 0x0, + + /* U+39 "9" */ + 0x0, 0x0, 0xff, 0xc0, 0x0, 0x0, 0x3, 0xff, + 0xff, 0x0, 0x0, 0x3, 0xff, 0xff, 0xf0, 0x0, + 0x3, 0xff, 0xff, 0xff, 0x0, 0x1, 0xff, 0xff, + 0xff, 0xe0, 0x1, 0xff, 0xff, 0xff, 0xfc, 0x0, + 0x7f, 0xff, 0xff, 0xff, 0x80, 0x3f, 0xff, 0xff, + 0xff, 0xf0, 0x1f, 0xff, 0xff, 0xff, 0xfe, 0xf, + 0xff, 0xff, 0xff, 0xff, 0x83, 0xff, 0xfc, 0xf, + 0xff, 0xf1, 0xff, 0xf8, 0x0, 0xff, 0xfc, 0x7f, + 0xfc, 0x0, 0xf, 0xff, 0x9f, 0xff, 0x0, 0x3, + 0xff, 0xef, 0xff, 0x80, 0x0, 0x7f, 0xfb, 0xff, + 0xe0, 0x0, 0x1f, 0xff, 0xff, 0xf0, 0x0, 0x3, + 0xff, 0xff, 0xfc, 0x0, 0x0, 0xff, 0xff, 0xff, + 0x0, 0x0, 0x3f, 0xff, 0xff, 0xc0, 0x0, 0xf, + 0xff, 0xff, 0xf0, 0x0, 0x3, 0xff, 0xff, 0xfc, + 0x0, 0x0, 0xff, 0xff, 0xff, 0x80, 0x0, 0x7f, + 0xff, 0xff, 0xe0, 0x0, 0x1f, 0xff, 0x7f, 0xf8, + 0x0, 0xf, 0xff, 0xdf, 0xff, 0x0, 0x3, 0xff, + 0xe7, 0xff, 0xf0, 0x3, 0xff, 0xf8, 0xff, 0xff, + 0x3, 0xff, 0xfe, 0x3f, 0xff, 0xff, 0xff, 0xff, + 0x87, 0xff, 0xff, 0xff, 0xff, 0xc1, 0xff, 0xff, + 0xff, 0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xf8, + 0x7, 0xff, 0xff, 0xdf, 0xfe, 0x0, 0xff, 0xff, + 0xef, 0xff, 0x80, 0x1f, 0xff, 0xf7, 0xff, 0xc0, + 0x1, 0xff, 0xf1, 0xff, 0xf0, 0x0, 0xf, 0xf0, + 0xff, 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfc, 0x0, + 0x0, 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, + 0xff, 0x80, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, + 0x0, 0x1, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, + 0xf8, 0x0, 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, + 0x0, 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, + 0x80, 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, + 0x1, 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, + 0x0, 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, 0x0, + 0x1f, 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, 0x80, + 0x0, 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, 0x3, + 0xff, 0xf0, 0x0, 0x0, 0x0, 0xff, 0xf8, 0x0, + 0x0, 0x0, 0x7f, 0xfe, 0x0, 0x0, 0x0, 0x3f, + 0xff, 0x0, 0x0, 0x0, 0xf, 0xff, 0x80, 0x0, + 0x0, 0x7, 0xff, 0xe0, 0x0, 0x0, + + /* U+3A ":" */ + 0x7, 0xe0, 0x1f, 0xf8, 0x3f, 0xfc, 0x7f, 0xfe, + 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, + 0x7f, 0xfe, 0x3f, 0xfc, 0x1f, 0xf8, 0x7, 0xe0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x7, 0xe0, 0x1f, 0xf8, + 0x3f, 0xfc, 0x7f, 0xfe, 0x7f, 0xfe, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0x7f, 0xfe, 0x7f, 0xfe, 0x3f, 0xfc, + 0x1f, 0xf8, 0x7, 0xe0 +}; + + +/*--------------------- + * GLYPH DESCRIPTION + *--------------------*/ + +static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = { + {.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */, + {.bitmap_index = 0, .adv_w = 768, .box_w = 41, .box_h = 59, .ofs_x = 4, .ofs_y = -1}, + {.bitmap_index = 303, .adv_w = 768, .box_w = 40, .box_h = 58, .ofs_x = 6, .ofs_y = 0}, + {.bitmap_index = 593, .adv_w = 768, .box_w = 41, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 891, .adv_w = 768, .box_w = 41, .box_h = 59, .ofs_x = 3, .ofs_y = -1}, + {.bitmap_index = 1194, .adv_w = 768, .box_w = 38, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 1470, .adv_w = 768, .box_w = 41, .box_h = 58, .ofs_x = 4, .ofs_y = -1}, + {.bitmap_index = 1768, .adv_w = 768, .box_w = 42, .box_h = 59, .ofs_x = 3, .ofs_y = -1}, + {.bitmap_index = 2078, .adv_w = 768, .box_w = 40, .box_h = 58, .ofs_x = 4, .ofs_y = 0}, + {.bitmap_index = 2368, .adv_w = 768, .box_w = 42, .box_h = 60, .ofs_x = 3, .ofs_y = -1}, + {.bitmap_index = 2683, .adv_w = 768, .box_w = 42, .box_h = 59, .ofs_x = 3, .ofs_y = 0}, + {.bitmap_index = 2993, .adv_w = 768, .box_w = 16, .box_h = 46, .ofs_x = 16, .ofs_y = -1} +}; + +/*--------------------- + * CHARACTER MAPPING + *--------------------*/ + + + +/*Collect the unicode lists and glyph_id offsets*/ +static const lv_font_fmt_txt_cmap_t cmaps[] = +{ + { + .range_start = 48, .range_length = 11, .glyph_id_start = 1, + .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY + } +}; + + + +/*-------------------- + * ALL CUSTOM DATA + *--------------------*/ + +/*Store all the custom data of the font*/ +static lv_font_fmt_txt_dsc_t font_dsc = { + .glyph_bitmap = gylph_bitmap, + .glyph_dsc = glyph_dsc, + .cmaps = cmaps, + .kern_dsc = NULL, + .kern_scale = 0, + .cmap_num = 1, + .bpp = 1, + .kern_classes = 0, + .bitmap_format = 0 +}; + + +/*----------------- + * PUBLIC FONT + *----------------*/ + +/*Initialize a public general font descriptor*/ +lv_font_t jetbrains_mono_extrabold_compressed = { + .get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/ + .get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/ + .line_height = 60, /*The maximum line height required by the font*/ + .base_line = 1, /*Baseline measured from the bottom of the line*/ +#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) + .subpx = LV_FONT_SUBPX_NONE, +#endif + .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ +}; + +#endif /*#if JETBRAINS_MONO_EXTRABOLD_COMPRESSED*/ + diff --git a/src/displayapp/icons/battery/os_battery_005.c b/src/displayapp/icons/battery/os_battery_005.c new file mode 100644 index 0000000..64832b5 --- /dev/null +++ b/src/displayapp/icons/battery/os_battery_005.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_005 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_005 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_005 uint8_t ck_os_battery_005_map[] = { + 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + + 0xfc, 0x00, 0x3f, + 0xf8, 0x00, 0x1f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0x00, 0xff, 0x00, + 0x00, 0xff, 0x00, + 0x00, 0xff, 0x00, + 0x00, 0xff, 0x00, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, +}; + +const lv_img_dsc_t ck_os_battery_005 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_005_map, +}; diff --git a/src/displayapp/icons/battery/os_battery_005.png b/src/displayapp/icons/battery/os_battery_005.png new file mode 100644 index 0000000..963767b Binary files /dev/null and b/src/displayapp/icons/battery/os_battery_005.png differ diff --git a/src/displayapp/icons/battery/os_battery_010.c b/src/displayapp/icons/battery/os_battery_010.c new file mode 100644 index 0000000..f36b684 --- /dev/null +++ b/src/displayapp/icons/battery/os_battery_010.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_010 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_010 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_010 uint8_t ck_os_battery_010_map[] = { + 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + 0x04, 0x7a, 0xf4, 0xff, /*Color of index 2*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 3*/ + + 0x55, 0x5f, 0xff, 0xff, 0xf5, 0x55, 0x55, + 0x55, 0x7f, 0xff, 0xff, 0xfd, 0x55, 0x55, + 0x55, 0xff, 0xff, 0xff, 0xff, 0x55, 0x55, + 0x55, 0xff, 0xff, 0xff, 0xff, 0x55, 0x55, + 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, + 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, + 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, + 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0xff, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xff, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xff, 0x55, 0x55, 0x6a, 0xaa, 0xaa, 0xa9, + 0xff, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x50, 0x05, 0xaa, 0xaa, 0xaa, 0xaa, + 0xff, 0x50, 0x05, 0xaa, 0xaa, 0xaa, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0x55, 0x55, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0xff, 0xf5, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0xff, 0xf5, 0xaa, 0xa5, 0x5a, 0xaa, + 0xff, 0xff, 0xf5, 0xaa, 0xaa, 0xaa, 0xaa, + 0xff, 0xff, 0xf5, 0x6a, 0xaa, 0xaa, 0xa9, +}; + +const lv_img_dsc_t ck_os_battery_010 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 240, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_battery_010_map, +}; diff --git a/src/displayapp/icons/battery/os_battery_010.png b/src/displayapp/icons/battery/os_battery_010.png new file mode 100644 index 0000000..68a9f40 Binary files /dev/null and b/src/displayapp/icons/battery/os_battery_010.png differ diff --git a/src/displayapp/icons/battery/os_battery_020.c b/src/displayapp/icons/battery/os_battery_020.c new file mode 100644 index 0000000..3f648fb --- /dev/null +++ b/src/displayapp/icons/battery/os_battery_020.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_020 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_020 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_020 uint8_t ck_os_battery_020_map[] = { + 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, + 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, + 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, +}; + +const lv_img_dsc_t ck_os_battery_020 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 208, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_battery_020_map, +}; diff --git a/src/displayapp/icons/battery/os_battery_020.png b/src/displayapp/icons/battery/os_battery_020.png new file mode 100644 index 0000000..32eca65 Binary files /dev/null and b/src/displayapp/icons/battery/os_battery_020.png differ diff --git a/src/displayapp/icons/battery/os_battery_030.c b/src/displayapp/icons/battery/os_battery_030.c new file mode 100644 index 0000000..4d5719b --- /dev/null +++ b/src/displayapp/icons/battery/os_battery_030.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_030 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_030 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_030 uint8_t ck_os_battery_030_map[] = { + 0x04, 0x7a, 0xf4, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, + 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, + 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, + 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, + 0xaa, 0x50, 0x00, 0x00, 0x05, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, + 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, +}; + +const lv_img_dsc_t ck_os_battery_030 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 208, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_battery_030_map, +}; diff --git a/src/displayapp/icons/battery/os_battery_030.png b/src/displayapp/icons/battery/os_battery_030.png new file mode 100644 index 0000000..aeb5eb1 Binary files /dev/null and b/src/displayapp/icons/battery/os_battery_030.png differ diff --git a/src/displayapp/icons/battery/os_battery_040.c b/src/displayapp/icons/battery/os_battery_040.c new file mode 100644 index 0000000..0606fc3 --- /dev/null +++ b/src/displayapp/icons/battery/os_battery_040.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_040 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_040 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_040 uint8_t ck_os_battery_040_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_battery_040 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_040_map, +}; diff --git a/src/displayapp/icons/battery/os_battery_040.png b/src/displayapp/icons/battery/os_battery_040.png new file mode 100644 index 0000000..d84fda4 Binary files /dev/null and b/src/displayapp/icons/battery/os_battery_040.png differ diff --git a/src/displayapp/icons/battery/os_battery_050.c b/src/displayapp/icons/battery/os_battery_050.c new file mode 100644 index 0000000..8732dc7 --- /dev/null +++ b/src/displayapp/icons/battery/os_battery_050.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_050 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_050 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_050 uint8_t ck_os_battery_050_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_battery_050 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_050_map, +}; diff --git a/src/displayapp/icons/battery/os_battery_050.png b/src/displayapp/icons/battery/os_battery_050.png new file mode 100644 index 0000000..224d38d Binary files /dev/null and b/src/displayapp/icons/battery/os_battery_050.png differ diff --git a/src/displayapp/icons/battery/os_battery_060.c b/src/displayapp/icons/battery/os_battery_060.c new file mode 100644 index 0000000..a65936b --- /dev/null +++ b/src/displayapp/icons/battery/os_battery_060.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_060 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_060 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_060 uint8_t ck_os_battery_060_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_battery_060 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_060_map, +}; diff --git a/src/displayapp/icons/battery/os_battery_060.png b/src/displayapp/icons/battery/os_battery_060.png new file mode 100644 index 0000000..e5e00ed Binary files /dev/null and b/src/displayapp/icons/battery/os_battery_060.png differ diff --git a/src/displayapp/icons/battery/os_battery_070.c b/src/displayapp/icons/battery/os_battery_070.c new file mode 100644 index 0000000..949c0b8 --- /dev/null +++ b/src/displayapp/icons/battery/os_battery_070.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_070 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_070 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_070 uint8_t ck_os_battery_070_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_battery_070 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_070_map, +}; diff --git a/src/displayapp/icons/battery/os_battery_070.png b/src/displayapp/icons/battery/os_battery_070.png new file mode 100644 index 0000000..dee969b Binary files /dev/null and b/src/displayapp/icons/battery/os_battery_070.png differ diff --git a/src/displayapp/icons/battery/os_battery_080.c b/src/displayapp/icons/battery/os_battery_080.c new file mode 100644 index 0000000..f447370 --- /dev/null +++ b/src/displayapp/icons/battery/os_battery_080.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_080 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_080 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_080 uint8_t ck_os_battery_080_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_battery_080 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_080_map, +}; diff --git a/src/displayapp/icons/battery/os_battery_080.png b/src/displayapp/icons/battery/os_battery_080.png new file mode 100644 index 0000000..3b13fbb Binary files /dev/null and b/src/displayapp/icons/battery/os_battery_080.png differ diff --git a/src/displayapp/icons/battery/os_battery_090.c b/src/displayapp/icons/battery/os_battery_090.c new file mode 100644 index 0000000..6fa41b2 --- /dev/null +++ b/src/displayapp/icons/battery/os_battery_090.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_090 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_090 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_090 uint8_t ck_os_battery_090_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_battery_090 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_battery_090_map, +}; diff --git a/src/displayapp/icons/battery/os_battery_090.png b/src/displayapp/icons/battery/os_battery_090.png new file mode 100644 index 0000000..d79f396 Binary files /dev/null and b/src/displayapp/icons/battery/os_battery_090.png differ diff --git a/src/displayapp/icons/battery/os_battery_100.c b/src/displayapp/icons/battery/os_battery_100.c new file mode 100644 index 0000000..92cf9a4 --- /dev/null +++ b/src/displayapp/icons/battery/os_battery_100.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_100 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_100 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_100 uint8_t ck_os_battery_100_map[] = { + 0x7c, 0xd2, 0x34, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0xaa, 0xa5, 0x55, 0x55, 0x5a, 0xaa, + 0xaa, 0x95, 0x55, 0x55, 0x56, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, +}; + +const lv_img_dsc_t ck_os_battery_100 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 208, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_battery_100_map, +}; diff --git a/src/displayapp/icons/battery/os_battery_100.png b/src/displayapp/icons/battery/os_battery_100.png new file mode 100644 index 0000000..dd0d306 Binary files /dev/null and b/src/displayapp/icons/battery/os_battery_100.png differ diff --git a/src/displayapp/icons/battery/os_battery_error.c b/src/displayapp/icons/battery/os_battery_error.c new file mode 100644 index 0000000..af6aba5 --- /dev/null +++ b/src/displayapp/icons/battery/os_battery_error.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERY_ERROR +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERY_ERROR +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERY_ERROR uint8_t ck_os_battery_error_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xc4, 0xc2, 0xc4, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x00, 0x05, 0x55, 0x55, 0x50, 0x00, + 0x00, 0x15, 0x55, 0x55, 0x54, 0x00, + 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, + 0x00, 0x55, 0x55, 0x55, 0x55, 0x00, + 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, + 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, + 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, + 0x55, 0x54, 0x00, 0x00, 0x15, 0x55, + 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, + 0x55, 0x00, 0xaa, 0xaa, 0x00, 0x55, + 0x55, 0x02, 0xaa, 0xaa, 0x80, 0x55, + 0x55, 0x02, 0xaa, 0xaa, 0x80, 0x55, + 0x55, 0x0a, 0xa8, 0x2a, 0xa0, 0x55, + 0x55, 0x0a, 0xa0, 0x0a, 0xa0, 0x55, + 0x55, 0x00, 0x00, 0x0a, 0xa0, 0x55, + 0x55, 0x00, 0x00, 0x2a, 0xa0, 0x55, + 0x55, 0x00, 0x02, 0xaa, 0x80, 0x55, + 0x55, 0x00, 0x0a, 0xaa, 0x80, 0x55, + 0x55, 0x00, 0x0a, 0xaa, 0x00, 0x55, + 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, + 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, + 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, + 0x55, 0x00, 0x00, 0x00, 0x00, 0x55, + 0x55, 0x00, 0x00, 0x00, 0x00, 0x55, + 0x55, 0x00, 0x02, 0x80, 0x00, 0x55, + 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, + 0x55, 0x00, 0x0a, 0xa0, 0x00, 0x55, + 0x55, 0x00, 0x02, 0x80, 0x00, 0x55, + 0x55, 0x55, 0x40, 0x01, 0x55, 0x55, + 0x55, 0x55, 0x50, 0x05, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, +}; + +const lv_img_dsc_t ck_os_battery_error = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 208, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_battery_error_map, +}; diff --git a/src/displayapp/icons/battery/os_battery_error.png b/src/displayapp/icons/battery/os_battery_error.png new file mode 100644 index 0000000..4c7632f Binary files /dev/null and b/src/displayapp/icons/battery/os_battery_error.png differ diff --git a/src/displayapp/icons/battery/os_batterycharging_005.c b/src/displayapp/icons/battery/os_batterycharging_005.c new file mode 100644 index 0000000..1b0c71d --- /dev/null +++ b/src/displayapp/icons/battery/os_batterycharging_005.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_005 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_005 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_005 uint8_t ck_os_batterycharging_005_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, 0x00, + 0x07, 0xff, 0xe0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x07, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x1f, 0x00, + 0xf0, 0x00, 0x3e, 0x00, + 0xf0, 0x00, 0x7e, 0x00, + 0xf0, 0x00, 0xfc, 0x00, + 0xf0, 0x01, 0xff, 0xf0, + 0xf0, 0x03, 0xff, 0xf0, + 0xf0, 0x03, 0xff, 0xf0, + 0xf0, 0x03, 0xff, 0xe0, + 0xf0, 0x00, 0x0f, 0xc0, + 0xf0, 0x00, 0x1f, 0x80, + 0xff, 0xff, 0x3f, 0x00, + 0xff, 0xff, 0x3e, 0x00, + 0xff, 0xff, 0x3c, 0x00, + 0xff, 0xff, 0x38, 0x00, +}; + +const lv_img_dsc_t ck_os_batterycharging_005 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 136, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_batterycharging_005_map, +}; diff --git a/src/displayapp/icons/battery/os_batterycharging_005.png b/src/displayapp/icons/battery/os_batterycharging_005.png new file mode 100644 index 0000000..f9545bc Binary files /dev/null and b/src/displayapp/icons/battery/os_batterycharging_005.png differ diff --git a/src/displayapp/icons/battery/os_batterycharging_010.c b/src/displayapp/icons/battery/os_batterycharging_010.c new file mode 100644 index 0000000..304c018 --- /dev/null +++ b/src/displayapp/icons/battery/os_batterycharging_010.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_010 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_010 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_010 uint8_t ck_os_batterycharging_010_map[] = { + 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, 0x55, + 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x6a, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x5a, 0xa9, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x6a, 0xa9, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0xaa, 0xa5, 0x55, + 0xaa, 0x55, 0x55, 0x56, 0xaa, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x5a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xa9, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xa5, + 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x95, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xaa, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa9, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa5, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0x95, 0x55, +}; + +const lv_img_dsc_t ck_os_batterycharging_010 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 240, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_batterycharging_010_map, +}; diff --git a/src/displayapp/icons/battery/os_batterycharging_010.png b/src/displayapp/icons/battery/os_batterycharging_010.png new file mode 100644 index 0000000..04d5f82 Binary files /dev/null and b/src/displayapp/icons/battery/os_batterycharging_010.png differ diff --git a/src/displayapp/icons/battery/os_batterycharging_020.c b/src/displayapp/icons/battery/os_batterycharging_020.c new file mode 100644 index 0000000..1721be1 --- /dev/null +++ b/src/displayapp/icons/battery/os_batterycharging_020.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_020 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_020 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_020 uint8_t ck_os_batterycharging_020_map[] = { + 0x04, 0x02, 0xcc, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, 0x55, + 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x6a, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x5a, 0xa9, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x6a, 0xa9, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0xaa, 0xa5, 0x55, + 0xaa, 0x55, 0x55, 0x56, 0xaa, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x5a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xa9, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xa5, + 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x95, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xaa, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa9, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa5, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0x95, 0x55, +}; + +const lv_img_dsc_t ck_os_batterycharging_020 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 240, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_batterycharging_020_map, +}; diff --git a/src/displayapp/icons/battery/os_batterycharging_020.png b/src/displayapp/icons/battery/os_batterycharging_020.png new file mode 100644 index 0000000..6416e1e Binary files /dev/null and b/src/displayapp/icons/battery/os_batterycharging_020.png differ diff --git a/src/displayapp/icons/battery/os_batterycharging_030.c b/src/displayapp/icons/battery/os_batterycharging_030.c new file mode 100644 index 0000000..83101fd --- /dev/null +++ b/src/displayapp/icons/battery/os_batterycharging_030.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_030 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_030 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_030 uint8_t ck_os_batterycharging_030_map[] = { + 0x04, 0x7a, 0xf4, 0xff, /*Color of index 0*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x55, 0x5a, 0xaa, 0xaa, 0xa5, 0x55, 0x55, + 0x55, 0x6a, 0xaa, 0xaa, 0xa9, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0x6a, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x5a, 0xa9, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0x6a, 0xa9, 0x55, + 0xaa, 0x55, 0x55, 0x55, 0xaa, 0xa5, 0x55, + 0xaa, 0x50, 0x00, 0x56, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xaa, + 0xaa, 0x50, 0x00, 0x5a, 0xaa, 0xaa, 0xa9, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xa5, + 0xaa, 0x55, 0x55, 0x55, 0x56, 0xaa, 0x95, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xaa, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa9, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0xa5, 0x55, + 0xaa, 0xaa, 0xaa, 0xaa, 0x5a, 0x95, 0x55, +}; + +const lv_img_dsc_t ck_os_batterycharging_030 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 240, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_batterycharging_030_map, +}; diff --git a/src/displayapp/icons/battery/os_batterycharging_030.png b/src/displayapp/icons/battery/os_batterycharging_030.png new file mode 100644 index 0000000..96b44d2 Binary files /dev/null and b/src/displayapp/icons/battery/os_batterycharging_030.png differ diff --git a/src/displayapp/icons/battery/os_batterycharging_040.c b/src/displayapp/icons/battery/os_batterycharging_040.c new file mode 100644 index 0000000..02af00e --- /dev/null +++ b/src/displayapp/icons/battery/os_batterycharging_040.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_040 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_040 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_040 uint8_t ck_os_batterycharging_040_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, 0x00, + 0x07, 0xff, 0xe0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x07, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x1f, 0x00, + 0xf0, 0x00, 0x3e, 0x00, + 0xf3, 0xf8, 0x7e, 0x00, + 0xf3, 0xf0, 0xfc, 0x00, + 0xf3, 0xf1, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xe0, + 0xf0, 0x00, 0x0f, 0xc0, + 0xf0, 0x00, 0x1f, 0x80, + 0xff, 0xff, 0x3f, 0x00, + 0xff, 0xff, 0x3e, 0x00, + 0xff, 0xff, 0x3c, 0x00, + 0xff, 0xff, 0x38, 0x00, +}; + +const lv_img_dsc_t ck_os_batterycharging_040 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 136, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_batterycharging_040_map, +}; diff --git a/src/displayapp/icons/battery/os_batterycharging_040.png b/src/displayapp/icons/battery/os_batterycharging_040.png new file mode 100644 index 0000000..5a42caf Binary files /dev/null and b/src/displayapp/icons/battery/os_batterycharging_040.png differ diff --git a/src/displayapp/icons/battery/os_batterycharging_050.c b/src/displayapp/icons/battery/os_batterycharging_050.c new file mode 100644 index 0000000..d2eea82 --- /dev/null +++ b/src/displayapp/icons/battery/os_batterycharging_050.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_050 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_050 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_050 uint8_t ck_os_batterycharging_050_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, 0x00, + 0x07, 0xff, 0xe0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x07, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf3, 0xfe, 0x1f, 0x00, + 0xf3, 0xfc, 0x3e, 0x00, + 0xf3, 0xf8, 0x7e, 0x00, + 0xf3, 0xf0, 0xfc, 0x00, + 0xf3, 0xf1, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xe0, + 0xf0, 0x00, 0x0f, 0xc0, + 0xf0, 0x00, 0x1f, 0x80, + 0xff, 0xff, 0x3f, 0x00, + 0xff, 0xff, 0x3e, 0x00, + 0xff, 0xff, 0x3c, 0x00, + 0xff, 0xff, 0x38, 0x00, +}; + +const lv_img_dsc_t ck_os_batterycharging_050 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 136, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_batterycharging_050_map, +}; diff --git a/src/displayapp/icons/battery/os_batterycharging_050.png b/src/displayapp/icons/battery/os_batterycharging_050.png new file mode 100644 index 0000000..ca0e04d Binary files /dev/null and b/src/displayapp/icons/battery/os_batterycharging_050.png differ diff --git a/src/displayapp/icons/battery/os_batterycharging_060.c b/src/displayapp/icons/battery/os_batterycharging_060.c new file mode 100644 index 0000000..05f8b97 --- /dev/null +++ b/src/displayapp/icons/battery/os_batterycharging_060.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_060 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_060 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_060 uint8_t ck_os_batterycharging_060_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, 0x00, + 0x07, 0xff, 0xe0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x00, 0x00, + 0xf3, 0xff, 0x87, 0x00, + 0xf3, 0xff, 0x0f, 0x00, + 0xf3, 0xfe, 0x1f, 0x00, + 0xf3, 0xfc, 0x3e, 0x00, + 0xf3, 0xf8, 0x7e, 0x00, + 0xf3, 0xf0, 0xfc, 0x00, + 0xf3, 0xf1, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xe0, + 0xf0, 0x00, 0x0f, 0xc0, + 0xf0, 0x00, 0x1f, 0x80, + 0xff, 0xff, 0x3f, 0x00, + 0xff, 0xff, 0x3e, 0x00, + 0xff, 0xff, 0x3c, 0x00, + 0xff, 0xff, 0x38, 0x00, +}; + +const lv_img_dsc_t ck_os_batterycharging_060 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 136, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_batterycharging_060_map, +}; diff --git a/src/displayapp/icons/battery/os_batterycharging_060.png b/src/displayapp/icons/battery/os_batterycharging_060.png new file mode 100644 index 0000000..2930068 Binary files /dev/null and b/src/displayapp/icons/battery/os_batterycharging_060.png differ diff --git a/src/displayapp/icons/battery/os_batterycharging_070.c b/src/displayapp/icons/battery/os_batterycharging_070.c new file mode 100644 index 0000000..ac3e319 --- /dev/null +++ b/src/displayapp/icons/battery/os_batterycharging_070.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_070 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_070 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_070 uint8_t ck_os_batterycharging_070_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, 0x00, + 0x07, 0xff, 0xe0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0x0f, 0xff, 0xf0, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xff, 0x00, 0xff, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf0, 0x00, 0x0f, 0x00, + 0xf3, 0xff, 0xc0, 0x00, + 0xf3, 0xff, 0xc0, 0x00, + 0xf3, 0xff, 0x87, 0x00, + 0xf3, 0xff, 0x0f, 0x00, + 0xf3, 0xfe, 0x1f, 0x00, + 0xf3, 0xfc, 0x3e, 0x00, + 0xf3, 0xf8, 0x7e, 0x00, + 0xf3, 0xf0, 0xfc, 0x00, + 0xf3, 0xf1, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xf0, + 0xf3, 0xf3, 0xff, 0xe0, + 0xf0, 0x00, 0x0f, 0xc0, + 0xf0, 0x00, 0x1f, 0x80, + 0xff, 0xff, 0x3f, 0x00, + 0xff, 0xff, 0x3e, 0x00, + 0xff, 0xff, 0x3c, 0x00, + 0xff, 0xff, 0x38, 0x00, +}; + +const lv_img_dsc_t ck_os_batterycharging_070 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 136, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_batterycharging_070_map, +}; diff --git a/src/displayapp/icons/battery/os_batterycharging_070.png b/src/displayapp/icons/battery/os_batterycharging_070.png new file mode 100644 index 0000000..7d5f55d Binary files /dev/null and b/src/displayapp/icons/battery/os_batterycharging_070.png differ diff --git a/src/displayapp/icons/battery/os_batterycharging_080.c b/src/displayapp/icons/battery/os_batterycharging_080.c new file mode 100644 index 0000000..cc1c1d2 --- /dev/null +++ b/src/displayapp/icons/battery/os_batterycharging_080.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_080 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_080 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_080 uint8_t ck_os_batterycharging_080_map[] = { + 0x7c, 0xd2, 0x34, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0xaa, 0xa5, 0x55, 0x55, 0x5a, 0xaa, 0xaa, + 0xaa, 0x95, 0x55, 0x55, 0x56, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x2a, 0x95, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0xaa, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x02, 0xa9, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x0a, 0xa5, 0x56, 0xaa, + 0x55, 0xa0, 0x00, 0x2a, 0x95, 0x56, 0xaa, + 0x55, 0xa0, 0x00, 0xaa, 0x55, 0x5a, 0xaa, + 0x55, 0xa0, 0x00, 0xa9, 0x55, 0x55, 0x55, + 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, + 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, + 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x56, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x5a, + 0x55, 0xaa, 0xaa, 0xaa, 0xa9, 0x55, 0x6a, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x55, 0xaa, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x56, 0xaa, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x5a, 0xaa, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x6a, 0xaa, +}; + +const lv_img_dsc_t ck_os_batterycharging_080 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 240, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_batterycharging_080_map, +}; diff --git a/src/displayapp/icons/battery/os_batterycharging_080.png b/src/displayapp/icons/battery/os_batterycharging_080.png new file mode 100644 index 0000000..cce5052 Binary files /dev/null and b/src/displayapp/icons/battery/os_batterycharging_080.png differ diff --git a/src/displayapp/icons/battery/os_batterycharging_090.c b/src/displayapp/icons/battery/os_batterycharging_090.c new file mode 100644 index 0000000..85e1c26 --- /dev/null +++ b/src/displayapp/icons/battery/os_batterycharging_090.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_090 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_090 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_090 uint8_t ck_os_batterycharging_090_map[] = { + 0x7c, 0xd2, 0x34, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0xaa, 0xa5, 0x55, 0x55, 0x5a, 0xaa, 0xaa, + 0xaa, 0x95, 0x55, 0x55, 0x56, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, + 0xaa, 0x55, 0x55, 0x55, 0x55, 0xaa, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x0a, 0xaa, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0x2a, 0x95, 0xaa, + 0x55, 0xa0, 0x00, 0x00, 0xaa, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x02, 0xa9, 0x55, 0xaa, + 0x55, 0xa0, 0x00, 0x0a, 0xa5, 0x56, 0xaa, + 0x55, 0xa0, 0x00, 0x2a, 0x95, 0x56, 0xaa, + 0x55, 0xa0, 0x00, 0xaa, 0x55, 0x5a, 0xaa, + 0x55, 0xa0, 0x00, 0xa9, 0x55, 0x55, 0x55, + 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, + 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x55, + 0x55, 0xa0, 0x00, 0xa5, 0x55, 0x55, 0x56, + 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0x55, 0x5a, + 0x55, 0xaa, 0xaa, 0xaa, 0xa9, 0x55, 0x6a, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x55, 0xaa, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x56, 0xaa, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x5a, 0xaa, + 0x55, 0x55, 0x55, 0x55, 0xa5, 0x6a, 0xaa, +}; + +const lv_img_dsc_t ck_os_batterycharging_090 = { + .header.always_zero = 0, + .header.w = 28, + .header.h = 32, + .data_size = 240, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_batterycharging_090_map, +}; diff --git a/src/displayapp/icons/battery/os_batterycharging_090.png b/src/displayapp/icons/battery/os_batterycharging_090.png new file mode 100644 index 0000000..fc7b443 Binary files /dev/null and b/src/displayapp/icons/battery/os_batterycharging_090.png differ diff --git a/src/displayapp/icons/battery/os_batterycharging_100.c b/src/displayapp/icons/battery/os_batterycharging_100.c new file mode 100644 index 0000000..8dec0cb --- /dev/null +++ b/src/displayapp/icons/battery/os_batterycharging_100.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_100 +#define LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_100 +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BATTERYCHARGING_100 uint8_t ck_os_batterycharging_100_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x03, 0xff, 0xc0, + 0x07, 0xff, 0xe0, + 0x0f, 0xff, 0xf0, + 0x0f, 0xff, 0xf0, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xff, 0x00, 0xff, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x07, 0x0f, + 0xf0, 0x0f, 0x0f, + 0xf0, 0x1f, 0x0f, + 0xf0, 0x3e, 0x0f, + 0xf0, 0x7e, 0x0f, + 0xf0, 0xfc, 0x0f, + 0xf1, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0xcf, + 0xf3, 0xff, 0x8f, + 0xf0, 0x3f, 0x0f, + 0xf0, 0x7e, 0x0f, + 0xf0, 0x7c, 0x0f, + 0xf0, 0xf8, 0x0f, + 0xf0, 0xf0, 0x0f, + 0xf0, 0xe0, 0x0f, + 0xf0, 0x00, 0x0f, + 0xf0, 0x00, 0x0f, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, +}; + +const lv_img_dsc_t ck_os_batterycharging_100 = { + .header.always_zero = 0, + .header.w = 24, + .header.h = 32, + .data_size = 104, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_batterycharging_100_map, +}; diff --git a/src/displayapp/icons/battery/os_batterycharging_100.png b/src/displayapp/icons/battery/os_batterycharging_100.png new file mode 100644 index 0000000..7c8ce0c Binary files /dev/null and b/src/displayapp/icons/battery/os_batterycharging_100.png differ diff --git a/src/displayapp/icons/bluetooth/ck_os_bt_connected.png b/src/displayapp/icons/bluetooth/ck_os_bt_connected.png new file mode 100644 index 0000000..5371611 Binary files /dev/null and b/src/displayapp/icons/bluetooth/ck_os_bt_connected.png differ diff --git a/src/displayapp/icons/bluetooth/ck_os_bt_disconnected.png b/src/displayapp/icons/bluetooth/ck_os_bt_disconnected.png new file mode 100644 index 0000000..3275895 Binary files /dev/null and b/src/displayapp/icons/bluetooth/ck_os_bt_disconnected.png differ diff --git a/src/displayapp/icons/bluetooth/os_bt_connected.c b/src/displayapp/icons/bluetooth/os_bt_connected.c new file mode 100644 index 0000000..d30dc9d --- /dev/null +++ b/src/displayapp/icons/bluetooth/os_bt_connected.c @@ -0,0 +1,56 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BT_CONNECTED +#define LV_ATTRIBUTE_IMG_CK_OS_BT_CONNECTED +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BT_CONNECTED uint8_t ck_os_bt_connected_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 1*/ + + 0x00, 0x0e, 0x00, 0x00, + 0x00, 0x0f, 0x00, 0x00, + 0x00, 0x0f, 0x80, 0x00, + 0x00, 0x0f, 0xc0, 0x00, + 0x00, 0x0f, 0xe0, 0x00, + 0x00, 0x0f, 0xf0, 0x00, + 0x03, 0x8f, 0xf8, 0x00, + 0x03, 0xcf, 0x7c, 0x00, + 0x03, 0xef, 0x3e, 0x00, + 0x01, 0xff, 0x1f, 0x00, + 0x00, 0xff, 0x1f, 0x00, + 0x00, 0x7f, 0x3e, 0x00, + 0x00, 0x3f, 0x7c, 0x00, + 0x00, 0x1f, 0xf8, 0x00, + 0x00, 0x0f, 0xf0, 0x00, + 0x00, 0x0f, 0xe0, 0x00, + 0x00, 0x0f, 0xe0, 0x00, + 0x00, 0x0f, 0xf0, 0x00, + 0x00, 0x1f, 0xf8, 0x00, + 0x00, 0x3f, 0x7c, 0x00, + 0x00, 0x7f, 0x3e, 0x00, + 0x00, 0xff, 0x1f, 0x00, + 0x01, 0xff, 0x1f, 0x00, + 0x03, 0xef, 0x3e, 0x00, + 0x03, 0xcf, 0x7c, 0x00, + 0x03, 0x8f, 0xf8, 0x00, + 0x00, 0x0f, 0xf0, 0x00, + 0x00, 0x0f, 0xe0, 0x00, + 0x00, 0x0f, 0xc0, 0x00, + 0x00, 0x0f, 0x80, 0x00, + 0x00, 0x0f, 0x00, 0x00, + 0x00, 0x0e, 0x00, 0x00, +}; + +const lv_img_dsc_t ck_os_bt_connected = { + .header.always_zero = 0, + .header.w = 32, + .header.h = 32, + .data_size = 136, + .header.cf = LV_IMG_CF_INDEXED_1BIT, + .data = ck_os_bt_connected_map, +}; diff --git a/src/displayapp/icons/bluetooth/os_bt_connected.png b/src/displayapp/icons/bluetooth/os_bt_connected.png new file mode 100644 index 0000000..5371611 Binary files /dev/null and b/src/displayapp/icons/bluetooth/os_bt_connected.png differ diff --git a/src/displayapp/icons/bluetooth/os_bt_disconnected.c b/src/displayapp/icons/bluetooth/os_bt_disconnected.c new file mode 100644 index 0000000..930179b --- /dev/null +++ b/src/displayapp/icons/bluetooth/os_bt_disconnected.c @@ -0,0 +1,58 @@ +#include "lvgl/lvgl.h" + +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +#ifndef LV_ATTRIBUTE_IMG_CK_OS_BT_DISCONNECTED +#define LV_ATTRIBUTE_IMG_CK_OS_BT_DISCONNECTED +#endif + +const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_CK_OS_BT_DISCONNECTED uint8_t ck_os_bt_disconnected_map[] = { + 0x6c, 0xfe, 0x6c, 0xff, /*Color of index 0*/ + 0xc4, 0xc2, 0xc4, 0xff, /*Color of index 1*/ + 0xe4, 0xe6, 0xe4, 0xff, /*Color of index 2*/ + 0xff, 0xff, 0xff, 0xff, /*Color of index 3*/ + + 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, + 0x2a, 0x80, 0x00, 0x55, 0x40, 0x00, 0x00, 0x00, + 0x2a, 0xa0, 0x00, 0x55, 0x50, 0x00, 0x00, 0x00, + 0x0a, 0xa8, 0x00, 0x55, 0x54, 0x00, 0x00, 0x00, + 0x02, 0xaa, 0x00, 0x55, 0x55, 0x00, 0x00, 0x00, + 0x00, 0xaa, 0x80, 0x55, 0x55, 0x40, 0x00, 0x00, + 0x00, 0x2a, 0xa0, 0x55, 0x15, 0x50, 0x00, 0x00, + 0x00, 0x0a, 0xa8, 0x15, 0x05, 0x54, 0x00, 0x00, + 0x00, 0x02, 0xaa, 0x05, 0x01, 0x55, 0x00, 0x00, + 0x00, 0x00, 0xaa, 0x81, 0x01, 0x55, 0x00, 0x00, + 0x00, 0x00, 0x2a, 0xa0, 0x05, 0x54, 0x00, 0x00, + 0x00, 0x00, 0x0a, 0xa8, 0x15, 0x50, 0x00, 0x00, + 0x00, 0x00, 0x02, 0xaa, 0x05, 0x40, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xaa, 0x81, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x2a, 0xa0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0a, 0xa8, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x42, 0xaa, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x50, 0xaa, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x54, 0x2a, 0xa0, 0x00, 0x00, + 0x00, 0x00, 0x15, 0x55, 0x0a, 0xa8, 0x00, 0x00, + 0x00, 0x00, 0x55, 0x55, 0x02, 0xaa, 0x00, 0x00, + 0x00, 0x01, 0x55, 0x55, 0x00, 0xaa, 0x80, 0x00, + 0x00, 0x05, 0x54, 0x55, 0x04, 0x2a, 0xa0, 0x00, + 0x00, 0x05, 0x50, 0x55, 0x15, 0x0a, 0xa8, 0x00, + 0x00, 0x05, 0x40, 0x55, 0x55, 0x42, 0xaa, 0x00, + 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0xaa, 0x80, + 0x00, 0x00, 0x00, 0x55, 0x54, 0x00, 0x2a, 0xa0, + 0x00, 0x00, 0x00, 0x55, 0x50, 0x00, 0x0a, 0xa8, + 0x00, 0x00, 0x00, 0x55, 0x40, 0x00, 0x02, 0xa8, + 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0xa0, + 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x00, +}; + +const lv_img_dsc_t ck_os_bt_disconnected = { + .header.always_zero = 0, + .header.w = 32, + .header.h = 32, + .data_size = 272, + .header.cf = LV_IMG_CF_INDEXED_2BIT, + .data = ck_os_bt_disconnected_map, +}; diff --git a/src/displayapp/icons/bluetooth/os_bt_disconnected.png b/src/displayapp/icons/bluetooth/os_bt_disconnected.png new file mode 100644 index 0000000..3275895 Binary files /dev/null and b/src/displayapp/icons/bluetooth/os_bt_disconnected.png differ diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp index eb85be4..71ba91c 100644 --- a/src/displayapp/screens/ApplicationList.cpp +++ b/src/displayapp/screens/ApplicationList.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include "ApplicationList.h" #include "Tile.h" diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h index a1e6811..9c95acb 100644 --- a/src/displayapp/screens/ApplicationList.h +++ b/src/displayapp/screens/ApplicationList.h @@ -1,13 +1,14 @@ #pragma once +#include #include -#include + +#include "components/ble/NimbleController.h" #include "Screen.h" #include "Label.h" #include "ScreenList.h" #include "Gauge.h" #include "Meter.h" -#include namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/Brightness.h b/src/displayapp/screens/Brightness.h index 37cbcd7..7d599ac 100644 --- a/src/displayapp/screens/Brightness.h +++ b/src/displayapp/screens/Brightness.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include "components/brightness/BrightnessController.h" #include "Screen.h" namespace Pinetime { diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 06fab9a..243d4c0 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -1,6 +1,7 @@ #include + #include -#include +#include "components/datetime/DateTimeController.h" #include #include "Clock.h" #include "../DisplayApp.h" diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index 7363fda..5753f6a 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -2,12 +2,13 @@ #include #include + #include "Screen.h" #include #include #include -#include -#include +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/FirmwareUpdate.h b/src/displayapp/screens/FirmwareUpdate.h index faaf395..893fe68 100644 --- a/src/displayapp/screens/FirmwareUpdate.h +++ b/src/displayapp/screens/FirmwareUpdate.h @@ -2,11 +2,12 @@ #include #include + #include "Screen.h" #include #include #include -#include +#include "components/ble/BleController.h" namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp index fb2dd95..2300b41 100644 --- a/src/displayapp/screens/FirmwareValidation.cpp +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -2,7 +2,7 @@ #include "FirmwareValidation.h" #include "../DisplayApp.h" #include "../../Version.h" -#include "../../Components/FirmwareValidator/FirmwareValidator.h" +#include "components/firmwarevalidator/FirmwareValidator.h" using namespace Pinetime::Applications::Screens; extern lv_font_t jetbrains_mono_extrabold_compressed; diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h index a1592f9..fb4f979 100644 --- a/src/displayapp/screens/InfiniPaint.h +++ b/src/displayapp/screens/InfiniPaint.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include "displayapp/LittleVgl.h" namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h index 95cac0f..d43d31c 100644 --- a/src/displayapp/screens/Music.h +++ b/src/displayapp/screens/Music.h @@ -2,16 +2,17 @@ #include #include -#include +#include + +#include "components/gfx/Gfx.h" +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" +#include "components/ble/MusicService.h" #include "Screen.h" #include #include #include -#include -#include #include "../../Version.h" -#include -#include namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/ScreenList.h b/src/displayapp/screens/ScreenList.h index d873336..b198634 100644 --- a/src/displayapp/screens/ScreenList.h +++ b/src/displayapp/screens/ScreenList.h @@ -1,8 +1,8 @@ #pragma once #include -#include #include +#include "components/ble/NimbleController.h" #include "Screen.h" #include "Label.h" diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index fcafcf7..8a3b8db 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include "SystemInfo.h" #include "../../Version.h" diff --git a/src/displayapp/screens/SystemInfo.h b/src/displayapp/screens/SystemInfo.h index ac8abae..987a584 100644 --- a/src/displayapp/screens/SystemInfo.h +++ b/src/displayapp/screens/SystemInfo.h @@ -1,13 +1,14 @@ #pragma once +#include #include -#include + +#include "components/ble/NimbleController.h" #include "Screen.h" #include "Label.h" #include "ScreenList.h" #include "Gauge.h" #include "Meter.h" -#include namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index 1447d78..deb8847 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -1,8 +1,9 @@ #include #include #include + #include "Tile.h" -#include +#include "displayapp/DisplayApp.h" #include "Symbols.h" #include "../../Version.h" diff --git a/src/displayapp/screens/Tile.h b/src/displayapp/screens/Tile.h index 3136d89..cf5fcf1 100644 --- a/src/displayapp/screens/Tile.h +++ b/src/displayapp/screens/Tile.h @@ -5,7 +5,7 @@ #include #include "Modal.h" #include -#include +#include namespace Pinetime { namespace Applications { diff --git a/src/main.cpp b/src/main.cpp index fe41358..e324336 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,29 +1,29 @@ #include #include +#include #include +#include +#include +#include #include #include -#include +#include "displayapp/DisplayApp.h" #include -#include -#include -#include -#include "Components/Battery/BatteryController.h" -#include "Components/Ble/BleController.h" +#include "components/datetime/DateTimeController.h" +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" +#include "components/ble/NotificationManager.h" #include #include #include -#include -#include -#include +#include "displayapp/LittleVgl.h" +#include #include #include #include #include #include -#include #include -#include #include #include @@ -32,7 +32,7 @@ #include "Logging/NrfLogger.h" Pinetime::Logging::NrfLogger logger; #else -#include "Logging/DummyLogger.h" +#include "logging/DummyLogger.h" Pinetime::Logging::DummyLogger logger; #endif diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 24f688e..68f8ab5 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -1,9 +1,9 @@ #include #include #include -#include +#include "displayapp/LittleVgl.h" #include -#include +#include "components/ble/NotificationManager.h" #include #include #include "SystemTask.h" @@ -12,7 +12,7 @@ #include #include #include "../main.h" -#include "Components/Ble/NimbleController.h" +#include "components/ble/NimbleController.h" using namespace Pinetime::System; diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 40277cf..1be28e3 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -1,16 +1,17 @@ #pragma once +#include + #include #include -#include #include #include -#include -#include +#include "components/battery/BatteryController.h" +#include "displayapp/DisplayApp.h" #include #include #include "SystemMonitor.h" -#include "Components/Ble/NimbleController.h" +#include "components/ble/NimbleController.h" #include "timers.h" namespace Pinetime { -- cgit v0.10.2 From d5717c7ee83e0e4a9a4e4662dadea1b758381e30 Mon Sep 17 00:00:00 2001 From: Avamander Date: Fri, 2 Oct 2020 23:11:27 +0300 Subject: Added the nRF52 SVD file for ease-of-use to the repository diff --git a/nrf52.svd b/nrf52.svd new file mode 100644 index 0000000..da84887 --- /dev/null +++ b/nrf52.svd @@ -0,0 +1,42660 @@ + + + + Nordic Semiconductor + Nordic + nrf52 + nrf52 + 1 + nRF52832 reference description for radio MCU with ARM 32-bit Cortex-M4 Microcontroller + +Copyright (c) 2010 - 2020, Nordic Semiconductor ASA All rights reserved.\n +\n +Redistribution and use in source and binary forms, with or without\n +modification, are permitted provided that the following conditions are met:\n +\n +1. Redistributions of source code must retain the above copyright notice, this\n + list of conditions and the following disclaimer.\n +\n +2. Redistributions in binary form must reproduce the above copyright\n + notice, this list of conditions and the following disclaimer in the\n + documentation and/or other materials provided with the distribution.\n +\n +3. Neither the name of Nordic Semiconductor ASA nor the names of its\n + contributors may be used to endorse or promote products derived from this\n + software without specific prior written permission.\n +\n +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\n +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n +IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE\n +ARE DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE\n +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n +POSSIBILITY OF SUCH DAMAGE.\n + + 8 + 32 + 32 + 0x00000000 + 0xFFFFFFFF + + CM4 + r0p1 + little + 1 + 1 + 3 + 0 + + system_nrf52 + NRF_ + + 2048 + 2048 + 112 + + + + FICR + Factory Information Configuration Registers + FICR + 0x10000000 + 32 + + 0 + 0x1000 + registers + + + + CODEPAGESIZE + Code memory page size + 0x010 + read-only + 0xFFFFFFFF + + + CODEPAGESIZE + Code memory page size + 0 + 31 + + + + + CODESIZE + Code memory size + 0x014 + read-only + 0xFFFFFFFF + + + CODESIZE + Code memory size in number of pages + 0 + 31 + + + + + 2 + 4 + DEVICEID[%s] + Description collection[0]: Device identifier + 0x060 + read-only + 0xFFFFFFFF + + + DEVICEID + 64 bit unique device identifier + 0 + 31 + + + + + 4 + 4 + ER[%s] + Description collection[0]: Encryption Root, word 0 + 0x080 + read-only + 0xFFFFFFFF + + + ER + Encryption Root, word n + 0 + 31 + + + + + 4 + 4 + IR[%s] + Description collection[0]: Identity Root, word 0 + 0x090 + read-only + 0xFFFFFFFF + + + IR + Identity Root, word n + 0 + 31 + + + + + DEVICEADDRTYPE + Device address type + 0x0A0 + read-only + 0xFFFFFFFF + + + DEVICEADDRTYPE + Device address type + 0 + 0 + + + Public + Public address + 0 + + + Random + Random address + 1 + + + + + + + 2 + 4 + DEVICEADDR[%s] + Description collection[0]: Device address 0 + 0x0A4 + read-only + 0xFFFFFFFF + + + DEVICEADDR + 48 bit device address + 0 + 31 + + + + + INFO + Device info + 0x100 + + PART + Part code + 0x000 + read-only + 0x00052832 + + + PART + Part code + 0 + 31 + + + N52832 + nRF52832 + 0x52832 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + VARIANT + Part Variant, Hardware version and Production configuration + 0x004 + read-only + 0x41414142 + + + VARIANT + Part Variant, Hardware version and Production configuration, encoded as ASCII + 0 + 31 + + + AAAA + AAAA + 0x41414141 + + + AAAB + AAAB + 0x41414142 + + + AABA + AABA + 0x41414241 + + + AABB + AABB + 0x41414242 + + + AAB0 + AAB0 + 0x41414230 + + + AAE0 + AAE0 + 0x41414530 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + PACKAGE + Package option + 0x008 + read-only + 0x00002000 + + + PACKAGE + Package option + 0 + 31 + + + QF + QFxx - 48-pin QFN + 0x2000 + + + CH + CHxx - 7x8 WLCSP 56 balls + 0x2001 + + + CI + CIxx - 7x8 WLCSP 56 balls + 0x2002 + + + CK + CKxx - 7x8 WLCSP 56 balls with backside coating for light protection + 0x2005 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + RAM + RAM variant + 0x00C + read-only + 0x00000040 + + + RAM + RAM variant + 0 + 31 + + + K16 + 16 kByte RAM + 0x10 + + + K32 + 32 kByte RAM + 0x20 + + + K64 + 64 kByte RAM + 0x40 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + FLASH + Flash variant + 0x010 + read-only + 0x00000200 + + + FLASH + Flash variant + 0 + 31 + + + K128 + 128 kByte FLASH + 0x80 + + + K256 + 256 kByte FLASH + 0x100 + + + K512 + 512 kByte FLASH + 0x200 + + + Unspecified + Unspecified + 0xFFFFFFFF + + + + + + + 3 + 4 + UNUSED0[%s] + Description collection[0]: Unspecified + 0x014 + read-write + + + + TEMP + Registers storing factory TEMP module linearization coefficients + 0x404 + + A0 + Slope definition A0. + 0x000 + read-only + 0x00000320 + + + A + A (slope definition) register. + 0 + 11 + + + + + A1 + Slope definition A1. + 0x004 + read-only + 0x00000343 + + + A + A (slope definition) register. + 0 + 11 + + + + + A2 + Slope definition A2. + 0x008 + read-only + 0x0000035D + + + A + A (slope definition) register. + 0 + 11 + + + + + A3 + Slope definition A3. + 0x00C + read-only + 0x00000400 + + + A + A (slope definition) register. + 0 + 11 + + + + + A4 + Slope definition A4. + 0x010 + read-only + 0x00000452 + + + A + A (slope definition) register. + 0 + 11 + + + + + A5 + Slope definition A5. + 0x014 + read-only + 0x0000037B + + + A + A (slope definition) register. + 0 + 11 + + + + + B0 + y-intercept B0. + 0x018 + read-only + 0x00003FCC + + + B + B (y-intercept) + 0 + 13 + + + + + B1 + y-intercept B1. + 0x01C + read-only + 0x00003F98 + + + B + B (y-intercept) + 0 + 13 + + + + + B2 + y-intercept B2. + 0x020 + read-only + 0x00003F98 + + + B + B (y-intercept) + 0 + 13 + + + + + B3 + y-intercept B3. + 0x024 + read-only + 0x00000012 + + + B + B (y-intercept) + 0 + 13 + + + + + B4 + y-intercept B4. + 0x028 + read-only + 0x0000004D + + + B + B (y-intercept) + 0 + 13 + + + + + B5 + y-intercept B5. + 0x02C + read-only + 0x00003E10 + + + B + B (y-intercept) + 0 + 13 + + + + + T0 + Segment end T0. + 0x030 + read-only + 0x000000E2 + + + T + T (segment end)register. + 0 + 7 + + + + + T1 + Segment end T1. + 0x034 + read-only + 0x00000000 + + + T + T (segment end)register. + 0 + 7 + + + + + T2 + Segment end T2. + 0x038 + read-only + 0x00000014 + + + T + T (segment end)register. + 0 + 7 + + + + + T3 + Segment end T3. + 0x03C + read-only + 0x00000019 + + + T + T (segment end)register. + 0 + 7 + + + + + T4 + Segment end T4. + 0x040 + read-only + 0x00000050 + + + T + T (segment end)register. + 0 + 7 + + + + + + NFC + Unspecified + 0x450 + + TAGHEADER0 + Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. + 0x000 + read-only + 0xFFFFFF5F + + + MFGID + Default Manufacturer ID: Nordic Semiconductor ASA has ICM 0x5F + 0 + 7 + + + UD1 + Unique identifier byte 1 + 8 + 15 + + + UD2 + Unique identifier byte 2 + 16 + 23 + + + UD3 + Unique identifier byte 3 + 24 + 31 + + + + + TAGHEADER1 + Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. + 0x004 + read-only + 0xFFFFFFFF + + + UD4 + Unique identifier byte 4 + 0 + 7 + + + UD5 + Unique identifier byte 5 + 8 + 15 + + + UD6 + Unique identifier byte 6 + 16 + 23 + + + UD7 + Unique identifier byte 7 + 24 + 31 + + + + + TAGHEADER2 + Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. + 0x008 + read-only + 0xFFFFFFFF + + + UD8 + Unique identifier byte 8 + 0 + 7 + + + UD9 + Unique identifier byte 9 + 8 + 15 + + + UD10 + Unique identifier byte 10 + 16 + 23 + + + UD11 + Unique identifier byte 11 + 24 + 31 + + + + + TAGHEADER3 + Default header for NFC Tag. Software can read these values to populate NFCID1_3RD_LAST, NFCID1_2ND_LAST and NFCID1_LAST. + 0x00C + read-only + 0xFFFFFFFF + + + UD12 + Unique identifier byte 12 + 0 + 7 + + + UD13 + Unique identifier byte 13 + 8 + 15 + + + UD14 + Unique identifier byte 14 + 16 + 23 + + + UD15 + Unique identifier byte 15 + 24 + 31 + + + + + + + + UICR + User Information Configuration Registers + UICR + 0x10001000 + 32 + + 0 + 0x1000 + registers + + + + UNUSED0 + Unspecified + 0x000 + read-write + + + UNUSED1 + Unspecified + 0x004 + read-write + + + UNUSED2 + Unspecified + 0x008 + read-write + + + UNUSED3 + Unspecified + 0x010 + read-write + + + 15 + 4 + NRFFW[%s] + Description collection[0]: Reserved for Nordic firmware design + 0x014 + read-write + 0xFFFFFFFF + + + NRFFW + Reserved for Nordic firmware design + 0 + 31 + + + + + 12 + 4 + NRFHW[%s] + Description collection[0]: Reserved for Nordic hardware design + 0x050 + read-write + 0xFFFFFFFF + + + NRFHW + Reserved for Nordic hardware design + 0 + 31 + + + + + 32 + 4 + CUSTOMER[%s] + Description collection[0]: Reserved for customer + 0x080 + read-write + 0xFFFFFFFF + + + CUSTOMER + Reserved for customer + 0 + 31 + + + + + 2 + 4 + PSELRESET[%s] + Description collection[0]: Mapping of the nRESET function (see POWER chapter for details) + 0x200 + read-write + 0xFFFFFFFF + + + PIN + GPIO number P0.n onto which Reset is exposed + 0 + 5 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + APPROTECT + Access Port protection + 0x208 + read-write + 0xFFFFFFFF + + + PALL + Enable or disable Access Port protection. Any other value than 0xFF being written to this field will enable protection. + 0 + 7 + + + Disabled + Disable + 0xFF + + + Enabled + Enable + 0x00 + + + + + + + NFCPINS + Setting of pins dedicated to NFC functionality: NFC antenna or GPIO + 0x20C + read-write + 0xFFFFFFFF + + + PROTECT + Setting of pins dedicated to NFC functionality + 0 + 0 + + + Disabled + Operation as GPIO pins. Same protection as normal GPIO pins + 0 + + + NFC + Operation as NFC antenna pins. Configures the protection for NFC operation + 1 + + + + + + + + + BPROT + Block Protect + BPROT + 0x40000000 + 32 + + 0 + 0x1000 + registers + + + + CONFIG0 + Block protect configuration register 0 + 0x600 + read-write + + + REGION0 + Enable protection for region 0. Write '0' has no effect. + 0 + 0 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION1 + Enable protection for region 1. Write '0' has no effect. + 1 + 1 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION2 + Enable protection for region 2. Write '0' has no effect. + 2 + 2 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION3 + Enable protection for region 3. Write '0' has no effect. + 3 + 3 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION4 + Enable protection for region 4. Write '0' has no effect. + 4 + 4 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION5 + Enable protection for region 5. Write '0' has no effect. + 5 + 5 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION6 + Enable protection for region 6. Write '0' has no effect. + 6 + 6 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION7 + Enable protection for region 7. Write '0' has no effect. + 7 + 7 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION8 + Enable protection for region 8. Write '0' has no effect. + 8 + 8 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION9 + Enable protection for region 9. Write '0' has no effect. + 9 + 9 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION10 + Enable protection for region 10. Write '0' has no effect. + 10 + 10 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION11 + Enable protection for region 11. Write '0' has no effect. + 11 + 11 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION12 + Enable protection for region 12. Write '0' has no effect. + 12 + 12 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION13 + Enable protection for region 13. Write '0' has no effect. + 13 + 13 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION14 + Enable protection for region 14. Write '0' has no effect. + 14 + 14 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION15 + Enable protection for region 15. Write '0' has no effect. + 15 + 15 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION16 + Enable protection for region 16. Write '0' has no effect. + 16 + 16 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION17 + Enable protection for region 17. Write '0' has no effect. + 17 + 17 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION18 + Enable protection for region 18. Write '0' has no effect. + 18 + 18 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION19 + Enable protection for region 19. Write '0' has no effect. + 19 + 19 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION20 + Enable protection for region 20. Write '0' has no effect. + 20 + 20 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION21 + Enable protection for region 21. Write '0' has no effect. + 21 + 21 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION22 + Enable protection for region 22. Write '0' has no effect. + 22 + 22 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION23 + Enable protection for region 23. Write '0' has no effect. + 23 + 23 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION24 + Enable protection for region 24. Write '0' has no effect. + 24 + 24 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION25 + Enable protection for region 25. Write '0' has no effect. + 25 + 25 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION26 + Enable protection for region 26. Write '0' has no effect. + 26 + 26 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION27 + Enable protection for region 27. Write '0' has no effect. + 27 + 27 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION28 + Enable protection for region 28. Write '0' has no effect. + 28 + 28 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION29 + Enable protection for region 29. Write '0' has no effect. + 29 + 29 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION30 + Enable protection for region 30. Write '0' has no effect. + 30 + 30 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + REGION31 + Enable protection for region 31. Write '0' has no effect. + 31 + 31 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enable + 1 + + + + + + + CONFIG1 + Block protect configuration register 1 + 0x604 + read-write + + + REGION32 + Enable protection for region 32. Write '0' has no effect. + 0 + 0 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION33 + Enable protection for region 33. Write '0' has no effect. + 1 + 1 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION34 + Enable protection for region 34. Write '0' has no effect. + 2 + 2 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION35 + Enable protection for region 35. Write '0' has no effect. + 3 + 3 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION36 + Enable protection for region 36. Write '0' has no effect. + 4 + 4 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION37 + Enable protection for region 37. Write '0' has no effect. + 5 + 5 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION38 + Enable protection for region 38. Write '0' has no effect. + 6 + 6 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION39 + Enable protection for region 39. Write '0' has no effect. + 7 + 7 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION40 + Enable protection for region 40. Write '0' has no effect. + 8 + 8 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION41 + Enable protection for region 41. Write '0' has no effect. + 9 + 9 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION42 + Enable protection for region 42. Write '0' has no effect. + 10 + 10 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION43 + Enable protection for region 43. Write '0' has no effect. + 11 + 11 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION44 + Enable protection for region 44. Write '0' has no effect. + 12 + 12 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION45 + Enable protection for region 45. Write '0' has no effect. + 13 + 13 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION46 + Enable protection for region 46. Write '0' has no effect. + 14 + 14 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION47 + Enable protection for region 47. Write '0' has no effect. + 15 + 15 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION48 + Enable protection for region 48. Write '0' has no effect. + 16 + 16 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION49 + Enable protection for region 49. Write '0' has no effect. + 17 + 17 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION50 + Enable protection for region 50. Write '0' has no effect. + 18 + 18 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION51 + Enable protection for region 51. Write '0' has no effect. + 19 + 19 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION52 + Enable protection for region 52. Write '0' has no effect. + 20 + 20 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION53 + Enable protection for region 53. Write '0' has no effect. + 21 + 21 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION54 + Enable protection for region 54. Write '0' has no effect. + 22 + 22 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION55 + Enable protection for region 55. Write '0' has no effect. + 23 + 23 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION56 + Enable protection for region 56. Write '0' has no effect. + 24 + 24 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION57 + Enable protection for region 57. Write '0' has no effect. + 25 + 25 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION58 + Enable protection for region 58. Write '0' has no effect. + 26 + 26 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION59 + Enable protection for region 59. Write '0' has no effect. + 27 + 27 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION60 + Enable protection for region 60. Write '0' has no effect. + 28 + 28 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION61 + Enable protection for region 61. Write '0' has no effect. + 29 + 29 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION62 + Enable protection for region 62. Write '0' has no effect. + 30 + 30 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION63 + Enable protection for region 63. Write '0' has no effect. + 31 + 31 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + + + DISABLEINDEBUG + Disable protection mechanism in debug interface mode + 0x608 + read-write + 0x00000001 + + + DISABLEINDEBUG + Disable the protection mechanism for NVM regions while in debug interface mode. This register will only disable the protection mechanism if the device is in debug interface mode. + 0 + 0 + + + Disabled + Disable in debug + 1 + + + Enabled + Enable in debug + 0 + + + + + + + UNUSED0 + Unspecified + 0x60C + read-write + + + CONFIG2 + Block protect configuration register 2 + 0x610 + read-write + + + REGION64 + Enable protection for region 64. Write '0' has no effect. + 0 + 0 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION65 + Enable protection for region 65. Write '0' has no effect. + 1 + 1 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION66 + Enable protection for region 66. Write '0' has no effect. + 2 + 2 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION67 + Enable protection for region 67. Write '0' has no effect. + 3 + 3 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION68 + Enable protection for region 68. Write '0' has no effect. + 4 + 4 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION69 + Enable protection for region 69. Write '0' has no effect. + 5 + 5 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION70 + Enable protection for region 70. Write '0' has no effect. + 6 + 6 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION71 + Enable protection for region 71. Write '0' has no effect. + 7 + 7 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION72 + Enable protection for region 72. Write '0' has no effect. + 8 + 8 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION73 + Enable protection for region 73. Write '0' has no effect. + 9 + 9 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION74 + Enable protection for region 74. Write '0' has no effect. + 10 + 10 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION75 + Enable protection for region 75. Write '0' has no effect. + 11 + 11 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION76 + Enable protection for region 76. Write '0' has no effect. + 12 + 12 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION77 + Enable protection for region 77. Write '0' has no effect. + 13 + 13 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION78 + Enable protection for region 78. Write '0' has no effect. + 14 + 14 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION79 + Enable protection for region 79. Write '0' has no effect. + 15 + 15 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION80 + Enable protection for region 80. Write '0' has no effect. + 16 + 16 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION81 + Enable protection for region 81. Write '0' has no effect. + 17 + 17 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION82 + Enable protection for region 82. Write '0' has no effect. + 18 + 18 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION83 + Enable protection for region 83. Write '0' has no effect. + 19 + 19 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION84 + Enable protection for region 84. Write '0' has no effect. + 20 + 20 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION85 + Enable protection for region 85. Write '0' has no effect. + 21 + 21 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION86 + Enable protection for region 86. Write '0' has no effect. + 22 + 22 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION87 + Enable protection for region 87. Write '0' has no effect. + 23 + 23 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION88 + Enable protection for region 88. Write '0' has no effect. + 24 + 24 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION89 + Enable protection for region 89. Write '0' has no effect. + 25 + 25 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION90 + Enable protection for region 90. Write '0' has no effect. + 26 + 26 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION91 + Enable protection for region 91. Write '0' has no effect. + 27 + 27 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION92 + Enable protection for region 92. Write '0' has no effect. + 28 + 28 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION93 + Enable protection for region 93. Write '0' has no effect. + 29 + 29 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION94 + Enable protection for region 94. Write '0' has no effect. + 30 + 30 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION95 + Enable protection for region 95. Write '0' has no effect. + 31 + 31 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + + + CONFIG3 + Block protect configuration register 3 + 0x614 + read-write + + + REGION96 + Enable protection for region 96. Write '0' has no effect. + 0 + 0 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION97 + Enable protection for region 97. Write '0' has no effect. + 1 + 1 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION98 + Enable protection for region 98. Write '0' has no effect. + 2 + 2 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION99 + Enable protection for region 99. Write '0' has no effect. + 3 + 3 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION100 + Enable protection for region 100. Write '0' has no effect. + 4 + 4 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION101 + Enable protection for region 101. Write '0' has no effect. + 5 + 5 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION102 + Enable protection for region 102. Write '0' has no effect. + 6 + 6 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION103 + Enable protection for region 103. Write '0' has no effect. + 7 + 7 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION104 + Enable protection for region 104. Write '0' has no effect. + 8 + 8 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION105 + Enable protection for region 105. Write '0' has no effect. + 9 + 9 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION106 + Enable protection for region 106. Write '0' has no effect. + 10 + 10 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION107 + Enable protection for region 107. Write '0' has no effect. + 11 + 11 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION108 + Enable protection for region 108. Write '0' has no effect. + 12 + 12 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION109 + Enable protection for region 109. Write '0' has no effect. + 13 + 13 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION110 + Enable protection for region 110. Write '0' has no effect. + 14 + 14 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION111 + Enable protection for region 111. Write '0' has no effect. + 15 + 15 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION112 + Enable protection for region 112. Write '0' has no effect. + 16 + 16 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION113 + Enable protection for region 113. Write '0' has no effect. + 17 + 17 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION114 + Enable protection for region 114. Write '0' has no effect. + 18 + 18 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION115 + Enable protection for region 115. Write '0' has no effect. + 19 + 19 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION116 + Enable protection for region 116. Write '0' has no effect. + 20 + 20 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION117 + Enable protection for region 117. Write '0' has no effect. + 21 + 21 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION118 + Enable protection for region 118. Write '0' has no effect. + 22 + 22 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION119 + Enable protection for region 119. Write '0' has no effect. + 23 + 23 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION120 + Enable protection for region 120. Write '0' has no effect. + 24 + 24 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION121 + Enable protection for region 121. Write '0' has no effect. + 25 + 25 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION122 + Enable protection for region 122. Write '0' has no effect. + 26 + 26 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION123 + Enable protection for region 123. Write '0' has no effect. + 27 + 27 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION124 + Enable protection for region 124. Write '0' has no effect. + 28 + 28 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION125 + Enable protection for region 125. Write '0' has no effect. + 29 + 29 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION126 + Enable protection for region 126. Write '0' has no effect. + 30 + 30 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + REGION127 + Enable protection for region 127. Write '0' has no effect. + 31 + 31 + + + Disabled + Protection disabled + 0 + + + Enabled + Protection enabled + 1 + + + + + + + + + POWER + Power control + POWER + 0x40000000 + 32 + BPROT + + 0 + 0x1000 + registers + + + POWER_CLOCK + 0 + + + + TASKS_CONSTLAT + Enable constant latency mode + 0x078 + write-only + + + TASKS_LOWPWR + Enable low power mode (variable latency) + 0x07C + write-only + + + EVENTS_POFWARN + Power failure warning + 0x108 + read-write + + + EVENTS_SLEEPENTER + CPU entered WFI/WFE sleep + 0x114 + read-write + + + EVENTS_SLEEPEXIT + CPU exited WFI/WFE sleep + 0x118 + read-write + + + INTENSET + Enable interrupt + 0x304 + read-write + + + POFWARN + Write '1' to Enable interrupt for POFWARN event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SLEEPENTER + Write '1' to Enable interrupt for SLEEPENTER event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SLEEPEXIT + Write '1' to Enable interrupt for SLEEPEXIT event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + POFWARN + Write '1' to Disable interrupt for POFWARN event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SLEEPENTER + Write '1' to Disable interrupt for SLEEPENTER event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SLEEPEXIT + Write '1' to Disable interrupt for SLEEPEXIT event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + RESETREAS + Reset reason + 0x400 + read-write + + + RESETPIN + Reset from pin-reset detected + 0 + 0 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + DOG + Reset from watchdog detected + 1 + 1 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + SREQ + Reset from soft reset detected + 2 + 2 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + LOCKUP + Reset from CPU lock-up detected + 3 + 3 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + OFF + Reset due to wake up from System OFF mode when wakeup is triggered from DETECT signal from GPIO + 16 + 16 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + LPCOMP + Reset due to wake up from System OFF mode when wakeup is triggered from ANADETECT signal from LPCOMP + 17 + 17 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + DIF + Reset due to wake up from System OFF mode when wakeup is triggered from entering into debug interface mode + 18 + 18 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + NFC + Reset due to wake up from System OFF mode by NFC field detect + 19 + 19 + + + NotDetected + Not detected + 0 + + + Detected + Detected + 1 + + + + + + + RAMSTATUS + Deprecated register - RAM status register + 0x428 + read-only + 0x00000000 + + + RAMBLOCK0 + RAM block 0 is on or off/powering up + 0 + 0 + + + Off + Off + 0 + + + On + On + 1 + + + + + RAMBLOCK1 + RAM block 1 is on or off/powering up + 1 + 1 + + + Off + Off + 0 + + + On + On + 1 + + + + + RAMBLOCK2 + RAM block 2 is on or off/powering up + 2 + 2 + + + Off + Off + 0 + + + On + On + 1 + + + + + RAMBLOCK3 + RAM block 3 is on or off/powering up + 3 + 3 + + + Off + Off + 0 + + + On + On + 1 + + + + + + + SYSTEMOFF + System OFF register + 0x500 + write-only + + + SYSTEMOFF + Enable System OFF mode + 0 + 0 + + + Enter + Enable System OFF mode + 1 + + + + + + + POFCON + Power failure comparator configuration + 0x510 + read-write + + + POF + Enable or disable power failure comparator + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + THRESHOLD + Power failure comparator threshold setting + 1 + 4 + + + V17 + Set threshold to 1.7 V + 4 + + + V18 + Set threshold to 1.8 V + 5 + + + V19 + Set threshold to 1.9 V + 6 + + + V20 + Set threshold to 2.0 V + 7 + + + V21 + Set threshold to 2.1 V + 8 + + + V22 + Set threshold to 2.2 V + 9 + + + V23 + Set threshold to 2.3 V + 10 + + + V24 + Set threshold to 2.4 V + 11 + + + V25 + Set threshold to 2.5 V + 12 + + + V26 + Set threshold to 2.6 V + 13 + + + V27 + Set threshold to 2.7 V + 14 + + + V28 + Set threshold to 2.8 V + 15 + + + + + + + GPREGRET + General purpose retention register + 0x51C + read-write + + + GPREGRET + General purpose retention register + 0 + 7 + + + + + GPREGRET2 + General purpose retention register + 0x520 + read-write + + + GPREGRET + General purpose retention register + 0 + 7 + + + + + RAMON + Deprecated register - RAM on/off register (this register is retained) + 0x524 + read-write + 0x00000003 + + + ONRAM0 + Keep RAM block 0 on or off in system ON Mode + 0 + 0 + + + RAM0Off + Off + 0 + + + RAM0On + On + 1 + + + + + ONRAM1 + Keep RAM block 1 on or off in system ON Mode + 1 + 1 + + + RAM1Off + Off + 0 + + + RAM1On + On + 1 + + + + + OFFRAM0 + Keep retention on RAM block 0 when RAM block is switched off + 16 + 16 + + + RAM0Off + Off + 0 + + + RAM0On + On + 1 + + + + + OFFRAM1 + Keep retention on RAM block 1 when RAM block is switched off + 17 + 17 + + + RAM1Off + Off + 0 + + + RAM1On + On + 1 + + + + + + + RAMONB + Deprecated register - RAM on/off register (this register is retained) + 0x554 + read-write + 0x00000003 + + + ONRAM2 + Keep RAM block 2 on or off in system ON Mode + 0 + 0 + + + RAM2Off + Off + 0 + + + RAM2On + On + 1 + + + + + ONRAM3 + Keep RAM block 3 on or off in system ON Mode + 1 + 1 + + + RAM3Off + Off + 0 + + + RAM3On + On + 1 + + + + + OFFRAM2 + Keep retention on RAM block 2 when RAM block is switched off + 16 + 16 + + + RAM2Off + Off + 0 + + + RAM2On + On + 1 + + + + + OFFRAM3 + Keep retention on RAM block 3 when RAM block is switched off + 17 + 17 + + + RAM3Off + Off + 0 + + + RAM3On + On + 1 + + + + + + + DCDCEN + DC/DC enable register + 0x578 + read-write + + + DCDCEN + Enable or disable DC/DC converter + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + 8 + 16 + RAM[%s] + Unspecified + 0x900 + + POWER + Description cluster[0]: RAM0 power control register + 0x000 + read-write + 0x0000FFFF + + + S0POWER + Keep RAM section S0 ON or OFF in System ON mode. + 0 + 0 + + + Off + Off + 0 + + + On + On + 1 + + + + + S1POWER + Keep RAM section S1 ON or OFF in System ON mode. + 1 + 1 + + + Off + Off + 0 + + + On + On + 1 + + + + + S0RETENTION + Keep retention on RAM section S0 when RAM section is in OFF + 16 + 16 + + + Off + Off + 0 + + + On + On + 1 + + + + + S1RETENTION + Keep retention on RAM section S1 when RAM section is in OFF + 17 + 17 + + + Off + Off + 0 + + + On + On + 1 + + + + + + + POWERSET + Description cluster[0]: RAM0 power control set register + 0x004 + write-only + 0x0000FFFF + + + S0POWER + Keep RAM section S0 of RAM0 on or off in System ON mode + 0 + 0 + + + On + On + 1 + + + + + S1POWER + Keep RAM section S1 of RAM0 on or off in System ON mode + 1 + 1 + + + On + On + 1 + + + + + S0RETENTION + Keep retention on RAM section S0 when RAM section is switched off + 16 + 16 + + + On + On + 1 + + + + + S1RETENTION + Keep retention on RAM section S1 when RAM section is switched off + 17 + 17 + + + On + On + 1 + + + + + + + POWERCLR + Description cluster[0]: RAM0 power control clear register + 0x008 + write-only + 0x0000FFFF + + + S0POWER + Keep RAM section S0 of RAM0 on or off in System ON mode + 0 + 0 + + + Off + Off + 1 + + + + + S1POWER + Keep RAM section S1 of RAM0 on or off in System ON mode + 1 + 1 + + + Off + Off + 1 + + + + + S0RETENTION + Keep retention on RAM section S0 when RAM section is switched off + 16 + 16 + + + Off + Off + 1 + + + + + S1RETENTION + Keep retention on RAM section S1 when RAM section is switched off + 17 + 17 + + + Off + Off + 1 + + + + + + + + + + CLOCK + Clock control + CLOCK + 0x40000000 + 32 + BPROT + + 0 + 0x1000 + registers + + + POWER_CLOCK + 0 + + + + TASKS_HFCLKSTART + Start HFCLK crystal oscillator + 0x000 + write-only + + + TASKS_HFCLKSTOP + Stop HFCLK crystal oscillator + 0x004 + write-only + + + TASKS_LFCLKSTART + Start LFCLK source + 0x008 + write-only + + + TASKS_LFCLKSTOP + Stop LFCLK source + 0x00C + write-only + + + TASKS_CAL + Start calibration of LFRC oscillator + 0x010 + write-only + + + TASKS_CTSTART + Start calibration timer + 0x014 + write-only + + + TASKS_CTSTOP + Stop calibration timer + 0x018 + write-only + + + EVENTS_HFCLKSTARTED + HFCLK oscillator started + 0x100 + read-write + + + EVENTS_LFCLKSTARTED + LFCLK started + 0x104 + read-write + + + EVENTS_DONE + Calibration of LFCLK RC oscillator complete event + 0x10C + read-write + + + EVENTS_CTTO + Calibration timer timeout + 0x110 + read-write + + + INTENSET + Enable interrupt + 0x304 + read-write + + + HFCLKSTARTED + Write '1' to Enable interrupt for HFCLKSTARTED event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + LFCLKSTARTED + Write '1' to Enable interrupt for LFCLKSTARTED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DONE + Write '1' to Enable interrupt for DONE event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CTTO + Write '1' to Enable interrupt for CTTO event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + HFCLKSTARTED + Write '1' to Disable interrupt for HFCLKSTARTED event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + LFCLKSTARTED + Write '1' to Disable interrupt for LFCLKSTARTED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DONE + Write '1' to Disable interrupt for DONE event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CTTO + Write '1' to Disable interrupt for CTTO event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + HFCLKRUN + Status indicating that HFCLKSTART task has been triggered + 0x408 + read-only + + + STATUS + HFCLKSTART task triggered or not + 0 + 0 + + + NotTriggered + Task not triggered + 0 + + + Triggered + Task triggered + 1 + + + + + + + HFCLKSTAT + HFCLK status + 0x40C + read-only + + + SRC + Source of HFCLK + 0 + 0 + + + RC + 64 MHz internal oscillator (HFINT) + 0 + + + Xtal + 64 MHz crystal oscillator (HFXO) + 1 + + + + + STATE + HFCLK state + 16 + 16 + + + NotRunning + HFCLK not running + 0 + + + Running + HFCLK running + 1 + + + + + + + LFCLKRUN + Status indicating that LFCLKSTART task has been triggered + 0x414 + read-only + + + STATUS + LFCLKSTART task triggered or not + 0 + 0 + + + NotTriggered + Task not triggered + 0 + + + Triggered + Task triggered + 1 + + + + + + + LFCLKSTAT + LFCLK status + 0x418 + read-only + + + SRC + Source of LFCLK + 0 + 1 + + + RC + 32.768 kHz RC oscillator + 0 + + + Xtal + 32.768 kHz crystal oscillator + 1 + + + Synth + 32.768 kHz synthesized from HFCLK + 2 + + + + + STATE + LFCLK state + 16 + 16 + + + NotRunning + LFCLK not running + 0 + + + Running + LFCLK running + 1 + + + + + + + LFCLKSRCCOPY + Copy of LFCLKSRC register, set when LFCLKSTART task was triggered + 0x41C + read-only + + + SRC + Clock source + 0 + 1 + + + RC + 32.768 kHz RC oscillator + 0 + + + Xtal + 32.768 kHz crystal oscillator + 1 + + + Synth + 32.768 kHz synthesized from HFCLK + 2 + + + + + + + LFCLKSRC + Clock source for the LFCLK + 0x518 + read-write + + + SRC + Clock source + 0 + 1 + + + RC + 32.768 kHz RC oscillator + 0 + + + Xtal + 32.768 kHz crystal oscillator + 1 + + + Synth + 32.768 kHz synthesized from HFCLK + 2 + + + + + BYPASS + Enable or disable bypass of LFCLK crystal oscillator with external clock source + 16 + 16 + + + Disabled + Disable (use with Xtal or low-swing external source) + 0 + + + Enabled + Enable (use with rail-to-rail external source) + 1 + + + + + EXTERNAL + Enable or disable external source for LFCLK + 17 + 17 + + + Disabled + Disable external source (use with Xtal) + 0 + + + Enabled + Enable use of external source instead of Xtal (SRC needs to be set to Xtal) + 1 + + + + + + + CTIV + Calibration timer interval + 0x538 + read-write + + + CTIV + Calibration timer interval in multiple of 0.25 seconds. Range: 0.25 seconds to 31.75 seconds. + 0 + 6 + + + + + TRACECONFIG + Clocking options for the Trace Port debug interface + 0x55C + read-write + 0x00000000 + + + TRACEPORTSPEED + Speed of Trace Port clock. Note that the TRACECLK pin will output this clock divided by two. + 0 + 1 + + + 32MHz + 32 MHz Trace Port clock (TRACECLK = 16 MHz) + 0 + + + 16MHz + 16 MHz Trace Port clock (TRACECLK = 8 MHz) + 1 + + + 8MHz + 8 MHz Trace Port clock (TRACECLK = 4 MHz) + 2 + + + 4MHz + 4 MHz Trace Port clock (TRACECLK = 2 MHz) + 3 + + + + + TRACEMUX + Pin multiplexing of trace signals. + 16 + 17 + + + GPIO + GPIOs multiplexed onto all trace-pins + 0 + + + Serial + SWO multiplexed onto P0.18, GPIO multiplexed onto other trace pins + 1 + + + Parallel + TRACECLK and TRACEDATA multiplexed onto P0.20, P0.18, P0.16, P0.15 and P0.14. + 2 + + + + + + + + + RADIO + 2.4 GHz Radio + RADIO + 0x40001000 + 32 + + 0 + 0x1000 + registers + + + RADIO + 1 + + + + TASKS_TXEN + Enable RADIO in TX mode + 0x000 + write-only + + + TASKS_RXEN + Enable RADIO in RX mode + 0x004 + write-only + + + TASKS_START + Start RADIO + 0x008 + write-only + + + TASKS_STOP + Stop RADIO + 0x00C + write-only + + + TASKS_DISABLE + Disable RADIO + 0x010 + write-only + + + TASKS_RSSISTART + Start the RSSI and take one single sample of the receive signal strength. + 0x014 + write-only + + + TASKS_RSSISTOP + Stop the RSSI measurement + 0x018 + write-only + + + TASKS_BCSTART + Start the bit counter + 0x01C + write-only + + + TASKS_BCSTOP + Stop the bit counter + 0x020 + write-only + + + EVENTS_READY + RADIO has ramped up and is ready to be started + 0x100 + read-write + + + EVENTS_ADDRESS + Address sent or received + 0x104 + read-write + + + EVENTS_PAYLOAD + Packet payload sent or received + 0x108 + read-write + + + EVENTS_END + Packet sent or received + 0x10C + read-write + + + EVENTS_DISABLED + RADIO has been disabled + 0x110 + read-write + + + EVENTS_DEVMATCH + A device address match occurred on the last received packet + 0x114 + read-write + + + EVENTS_DEVMISS + No device address match occurred on the last received packet + 0x118 + read-write + + + EVENTS_RSSIEND + Sampling of receive signal strength complete. + 0x11C + read-write + + + EVENTS_BCMATCH + Bit counter reached bit count value. + 0x128 + read-write + + + EVENTS_CRCOK + Packet received with CRC ok + 0x130 + read-write + + + EVENTS_CRCERROR + Packet received with CRC error + 0x134 + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + READY_START + Shortcut between READY event and START task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + END_DISABLE + Shortcut between END event and DISABLE task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DISABLED_TXEN + Shortcut between DISABLED event and TXEN task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DISABLED_RXEN + Shortcut between DISABLED event and RXEN task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ADDRESS_RSSISTART + Shortcut between ADDRESS event and RSSISTART task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + END_START + Shortcut between END event and START task + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ADDRESS_BCSTART + Shortcut between ADDRESS event and BCSTART task + 6 + 6 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DISABLED_RSSISTOP + Shortcut between DISABLED event and RSSISTOP task + 8 + 8 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to Enable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ADDRESS + Write '1' to Enable interrupt for ADDRESS event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PAYLOAD + Write '1' to Enable interrupt for PAYLOAD event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + END + Write '1' to Enable interrupt for END event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DISABLED + Write '1' to Enable interrupt for DISABLED event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DEVMATCH + Write '1' to Enable interrupt for DEVMATCH event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DEVMISS + Write '1' to Enable interrupt for DEVMISS event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RSSIEND + Write '1' to Enable interrupt for RSSIEND event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + BCMATCH + Write '1' to Enable interrupt for BCMATCH event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CRCOK + Write '1' to Enable interrupt for CRCOK event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CRCERROR + Write '1' to Enable interrupt for CRCERROR event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to Disable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ADDRESS + Write '1' to Disable interrupt for ADDRESS event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PAYLOAD + Write '1' to Disable interrupt for PAYLOAD event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + END + Write '1' to Disable interrupt for END event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DISABLED + Write '1' to Disable interrupt for DISABLED event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DEVMATCH + Write '1' to Disable interrupt for DEVMATCH event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DEVMISS + Write '1' to Disable interrupt for DEVMISS event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RSSIEND + Write '1' to Disable interrupt for RSSIEND event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + BCMATCH + Write '1' to Disable interrupt for BCMATCH event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CRCOK + Write '1' to Disable interrupt for CRCOK event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CRCERROR + Write '1' to Disable interrupt for CRCERROR event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + CRCSTATUS + CRC status + 0x400 + read-only + + + CRCSTATUS + CRC status of packet received + 0 + 0 + + + CRCError + Packet received with CRC error + 0 + + + CRCOk + Packet received with CRC ok + 1 + + + + + + + RXMATCH + Received address + 0x408 + read-only + + + RXMATCH + Received address + 0 + 2 + + + + + RXCRC + CRC field of previously received packet + 0x40C + read-only + + + RXCRC + CRC field of previously received packet + 0 + 23 + + + + + DAI + Device address match index + 0x410 + read-only + + + DAI + Device address match index + 0 + 2 + + + + + PACKETPTR + Packet pointer + 0x504 + read-write + + + PACKETPTR + Packet pointer + 0 + 31 + + + + + FREQUENCY + Frequency + 0x508 + read-write + 0x00000002 + + + FREQUENCY + Radio channel frequency + 0 + 6 + + + MAP + Channel map selection. + 8 + 8 + + + Default + Channel map between 2400 MHZ .. 2500 MHz + 0 + + + Low + Channel map between 2360 MHZ .. 2460 MHz + 1 + + + + + + + TXPOWER + Output power + 0x50C + read-write + + + TXPOWER + RADIO output power. + 0 + 7 + + + Pos4dBm + +4 dBm + 0x04 + + + Pos3dBm + +3 dBm + 0x03 + + + 0dBm + 0 dBm + 0x00 + + + Neg4dBm + -4 dBm + 0xFC + + + Neg8dBm + -8 dBm + 0xF8 + + + Neg12dBm + -12 dBm + 0xF4 + + + Neg16dBm + -16 dBm + 0xF0 + + + Neg20dBm + -20 dBm + 0xEC + + + Neg30dBm + Deprecated enumerator - -40 dBm + 0xFF + + + Neg40dBm + -40 dBm + 0xD8 + + + + + + + MODE + Data rate and modulation + 0x510 + read-write + + + MODE + Radio data rate and modulation setting. The radio supports Frequency-shift Keying (FSK) modulation. + 0 + 3 + + + Nrf_1Mbit + 1 Mbit/s Nordic proprietary radio mode + 0 + + + Nrf_2Mbit + 2 Mbit/s Nordic proprietary radio mode + 1 + + + Nrf_250Kbit + Deprecated enumerator - 250 kbit/s Nordic proprietary radio mode + 2 + + + Ble_1Mbit + 1 Mbit/s Bluetooth Low Energy + 3 + + + Ble_2Mbit + 2 Mbit/s Bluetooth Low Energy + 4 + + + + + + + PCNF0 + Packet configuration register 0 + 0x514 + read-write + + + LFLEN + Length on air of LENGTH field in number of bits. + 0 + 3 + + + S0LEN + Length on air of S0 field in number of bytes. + 8 + 8 + + + S1LEN + Length on air of S1 field in number of bits. + 16 + 19 + + + S1INCL + Include or exclude S1 field in RAM + 20 + 20 + + + Automatic + Include S1 field in RAM only if S1LEN &gt; 0 + 0 + + + Include + Always include S1 field in RAM independent of S1LEN + 1 + + + + + PLEN + Length of preamble on air. Decision point: TASKS_START task + 24 + 24 + + + 8bit + 8-bit preamble + 0 + + + 16bit + 16-bit preamble + 1 + + + + + + + PCNF1 + Packet configuration register 1 + 0x518 + read-write + + + MAXLEN + Maximum length of packet payload. If the packet payload is larger than MAXLEN, the radio will truncate the payload to MAXLEN. + 0 + 7 + + + STATLEN + Static length in number of bytes + 8 + 15 + + + BALEN + Base address length in number of bytes + 16 + 18 + + + ENDIAN + On air endianness of packet, this applies to the S0, LENGTH, S1 and the PAYLOAD fields. + 24 + 24 + + + Little + Least Significant bit on air first + 0 + + + Big + Most significant bit on air first + 1 + + + + + WHITEEN + Enable or disable packet whitening + 25 + 25 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + BASE0 + Base address 0 + 0x51C + read-write + + + BASE0 + Base address 0 + 0 + 31 + + + + + BASE1 + Base address 1 + 0x520 + read-write + + + BASE1 + Base address 1 + 0 + 31 + + + + + PREFIX0 + Prefixes bytes for logical addresses 0-3 + 0x524 + read-write + + + AP0 + Address prefix 0. + 0 + 7 + + + AP1 + Address prefix 1. + 8 + 15 + + + AP2 + Address prefix 2. + 16 + 23 + + + AP3 + Address prefix 3. + 24 + 31 + + + + + PREFIX1 + Prefixes bytes for logical addresses 4-7 + 0x528 + read-write + + + AP4 + Address prefix 4. + 0 + 7 + + + AP5 + Address prefix 5. + 8 + 15 + + + AP6 + Address prefix 6. + 16 + 23 + + + AP7 + Address prefix 7. + 24 + 31 + + + + + TXADDRESS + Transmit address select + 0x52C + read-write + + + TXADDRESS + Transmit address select + 0 + 2 + + + + + RXADDRESSES + Receive address select + 0x530 + read-write + + + ADDR0 + Enable or disable reception on logical address 0. + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR1 + Enable or disable reception on logical address 1. + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR2 + Enable or disable reception on logical address 2. + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR3 + Enable or disable reception on logical address 3. + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR4 + Enable or disable reception on logical address 4. + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR5 + Enable or disable reception on logical address 5. + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR6 + Enable or disable reception on logical address 6. + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ADDR7 + Enable or disable reception on logical address 7. + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + CRCCNF + CRC configuration + 0x534 + read-write + + + LEN + CRC length in number of bytes. + 0 + 1 + + + Disabled + CRC length is zero and CRC calculation is disabled + 0 + + + One + CRC length is one byte and CRC calculation is enabled + 1 + + + Two + CRC length is two bytes and CRC calculation is enabled + 2 + + + Three + CRC length is three bytes and CRC calculation is enabled + 3 + + + + + SKIPADDR + Include or exclude packet address field out of CRC calculation. + 8 + 8 + + + Include + CRC calculation includes address field + 0 + + + Skip + CRC calculation does not include address field. The CRC calculation will start at the first byte after the address. + 1 + + + + + + + CRCPOLY + CRC polynomial + 0x538 + read-write + 0x00000000 + + + CRCPOLY + CRC polynomial + 0 + 23 + + + + + CRCINIT + CRC initial value + 0x53C + read-write + + + CRCINIT + CRC initial value + 0 + 23 + + + + + UNUSED0 + Unspecified + 0x540 + read-write + + + TIFS + Inter Frame Spacing in us + 0x544 + read-write + + + TIFS + Inter Frame Spacing in us + 0 + 7 + + + + + RSSISAMPLE + RSSI sample + 0x548 + read-only + + + RSSISAMPLE + RSSI sample + 0 + 6 + + + + + STATE + Current radio state + 0x550 + read-only + + + STATE + Current radio state + 0 + 3 + + + Disabled + RADIO is in the Disabled state + 0 + + + RxRu + RADIO is in the RXRU state + 1 + + + RxIdle + RADIO is in the RXIDLE state + 2 + + + Rx + RADIO is in the RX state + 3 + + + RxDisable + RADIO is in the RXDISABLED state + 4 + + + TxRu + RADIO is in the TXRU state + 9 + + + TxIdle + RADIO is in the TXIDLE state + 10 + + + Tx + RADIO is in the TX state + 11 + + + TxDisable + RADIO is in the TXDISABLED state + 12 + + + + + + + DATAWHITEIV + Data whitening initial value + 0x554 + read-write + 0x00000040 + + + DATAWHITEIV + Data whitening initial value. Bit 6 is hard-wired to '1', writing '0' to it has no effect, and it will always be read back and used by the device as '1'. + 0 + 6 + + + + + BCC + Bit counter compare + 0x560 + read-write + + + BCC + Bit counter compare + 0 + 31 + + + + + 8 + 4 + DAB[%s] + Description collection[0]: Device address base segment 0 + 0x600 + read-write + + + DAB + Device address base segment 0 + 0 + 31 + + + + + 8 + 4 + DAP[%s] + Description collection[0]: Device address prefix 0 + 0x620 + read-write + + + DAP + Device address prefix 0 + 0 + 15 + + + + + DACNF + Device address match configuration + 0x640 + read-write + + + ENA0 + Enable or disable device address matching using device address 0 + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA1 + Enable or disable device address matching using device address 1 + 1 + 1 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA2 + Enable or disable device address matching using device address 2 + 2 + 2 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA3 + Enable or disable device address matching using device address 3 + 3 + 3 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA4 + Enable or disable device address matching using device address 4 + 4 + 4 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA5 + Enable or disable device address matching using device address 5 + 5 + 5 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA6 + Enable or disable device address matching using device address 6 + 6 + 6 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ENA7 + Enable or disable device address matching using device address 7 + 7 + 7 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + TXADD0 + TxAdd for device address 0 + 8 + 8 + + + TXADD1 + TxAdd for device address 1 + 9 + 9 + + + TXADD2 + TxAdd for device address 2 + 10 + 10 + + + TXADD3 + TxAdd for device address 3 + 11 + 11 + + + TXADD4 + TxAdd for device address 4 + 12 + 12 + + + TXADD5 + TxAdd for device address 5 + 13 + 13 + + + TXADD6 + TxAdd for device address 6 + 14 + 14 + + + TXADD7 + TxAdd for device address 7 + 15 + 15 + + + + + MODECNF0 + Radio mode configuration register 0 + 0x650 + read-write + 0x00000200 + + + RU + Radio ramp-up time + 0 + 0 + + + Default + Default ramp-up time (tRXEN), compatible with firmware written for nRF51 + 0 + + + Fast + Fast ramp-up (tRXEN,FAST), see electrical specification for more information + 1 + + + + + DTX + Default TX value + 8 + 9 + + + B1 + Transmit '1' + 0 + + + B0 + Transmit '0' + 1 + + + Center + Transmit center frequency + 2 + + + + + + + POWER + Peripheral power control + 0xFFC + read-write + 0x00000001 + + + POWER + Peripheral power control. The peripheral and its registers will be reset to its initial state by switching the peripheral off and then back on again. + 0 + 0 + + + Disabled + Peripheral is powered off + 0 + + + Enabled + Peripheral is powered on + 1 + + + + + + + + + UARTE0 + UART with EasyDMA + UARTE + 0x40002000 + 32 + UARTE + + 0 + 0x1000 + registers + + + UARTE0_UART0 + 2 + + + + TASKS_STARTRX + Start UART receiver + 0x000 + write-only + + + TASKS_STOPRX + Stop UART receiver + 0x004 + write-only + + + TASKS_STARTTX + Start UART transmitter + 0x008 + write-only + + + TASKS_STOPTX + Stop UART transmitter + 0x00C + write-only + + + TASKS_FLUSHRX + Flush RX FIFO into RX buffer + 0x02C + write-only + + + EVENTS_CTS + CTS is activated (set low). Clear To Send. + 0x100 + read-write + + + EVENTS_NCTS + CTS is deactivated (set high). Not Clear To Send. + 0x104 + read-write + + + EVENTS_RXDRDY + Data received in RXD (but potentially not yet transferred to Data RAM) + 0x108 + read-write + + + EVENTS_ENDRX + Receive buffer is filled up + 0x110 + read-write + + + EVENTS_TXDRDY + Data sent from TXD + 0x11C + read-write + + + EVENTS_ENDTX + Last TX byte transmitted + 0x120 + read-write + + + EVENTS_ERROR + Error detected + 0x124 + read-write + + + EVENTS_RXTO + Receiver timeout + 0x144 + read-write + + + EVENTS_RXSTARTED + UART receiver has started + 0x14C + read-write + + + EVENTS_TXSTARTED + UART transmitter has started + 0x150 + read-write + + + EVENTS_TXSTOPPED + Transmitter stopped + 0x158 + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + ENDRX_STARTRX + Shortcut between ENDRX event and STARTRX task + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + ENDRX_STOPRX + Shortcut between ENDRX event and STOPRX task + 6 + 6 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + CTS + Enable or disable interrupt for CTS event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + NCTS + Enable or disable interrupt for NCTS event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXDRDY + Enable or disable interrupt for RXDRDY event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDRX + Enable or disable interrupt for ENDRX event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXDRDY + Enable or disable interrupt for TXDRDY event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDTX + Enable or disable interrupt for ENDTX event + 8 + 8 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ERROR + Enable or disable interrupt for ERROR event + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXTO + Enable or disable interrupt for RXTO event + 17 + 17 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXSTARTED + Enable or disable interrupt for RXSTARTED event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXSTARTED + Enable or disable interrupt for TXSTARTED event + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXSTOPPED + Enable or disable interrupt for TXSTOPPED event + 22 + 22 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + CTS + Write '1' to Enable interrupt for CTS event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + NCTS + Write '1' to Enable interrupt for NCTS event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXDRDY + Write '1' to Enable interrupt for RXDRDY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDRX + Write '1' to Enable interrupt for ENDRX event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXDRDY + Write '1' to Enable interrupt for TXDRDY event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDTX + Write '1' to Enable interrupt for ENDTX event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to Enable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXTO + Write '1' to Enable interrupt for RXTO event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXSTARTED + Write '1' to Enable interrupt for RXSTARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXSTARTED + Write '1' to Enable interrupt for TXSTARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXSTOPPED + Write '1' to Enable interrupt for TXSTOPPED event + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + CTS + Write '1' to Disable interrupt for CTS event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + NCTS + Write '1' to Disable interrupt for NCTS event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXDRDY + Write '1' to Disable interrupt for RXDRDY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDRX + Write '1' to Disable interrupt for ENDRX event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXDRDY + Write '1' to Disable interrupt for TXDRDY event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDTX + Write '1' to Disable interrupt for ENDTX event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to Disable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXTO + Write '1' to Disable interrupt for RXTO event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXSTARTED + Write '1' to Disable interrupt for RXSTARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXSTARTED + Write '1' to Disable interrupt for TXSTARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXSTOPPED + Write '1' to Disable interrupt for TXSTOPPED event + 22 + 22 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x480 + read-write + oneToClear + + + OVERRUN + Overrun error + 0 + 0 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + PARITY + Parity error + 1 + 1 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + FRAMING + Framing error occurred + 2 + 2 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + BREAK + Break condition + 3 + 3 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + + + ENABLE + Enable UART + 0x500 + read-write + + + ENABLE + Enable or disable UARTE + 0 + 3 + + + Disabled + Disable UARTE + 0 + + + Enabled + Enable UARTE + 8 + + + + + + + PSEL + Unspecified + UARTE_PSEL + 0x508 + + RTS + Pin select for RTS signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + TXD + Pin select for TXD signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + CTS + Pin select for CTS signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + RXD + Pin select for RXD signal + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + BAUDRATE + Baud rate. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + BAUDRATE + Baud rate + 0 + 31 + + + Baud1200 + 1200 baud (actual rate: 1205) + 0x0004F000 + + + Baud2400 + 2400 baud (actual rate: 2396) + 0x0009D000 + + + Baud4800 + 4800 baud (actual rate: 4808) + 0x0013B000 + + + Baud9600 + 9600 baud (actual rate: 9598) + 0x00275000 + + + Baud14400 + 14400 baud (actual rate: 14401) + 0x003AF000 + + + Baud19200 + 19200 baud (actual rate: 19208) + 0x004EA000 + + + Baud28800 + 28800 baud (actual rate: 28777) + 0x0075C000 + + + Baud31250 + 31250 baud + 0x00800000 + + + Baud38400 + 38400 baud (actual rate: 38369) + 0x009D0000 + + + Baud56000 + 56000 baud (actual rate: 55944) + 0x00E50000 + + + Baud57600 + 57600 baud (actual rate: 57554) + 0x00EB0000 + + + Baud76800 + 76800 baud (actual rate: 76923) + 0x013A9000 + + + Baud115200 + 115200 baud (actual rate: 115108) + 0x01D60000 + + + Baud230400 + 230400 baud (actual rate: 231884) + 0x03B00000 + + + Baud250000 + 250000 baud + 0x04000000 + + + Baud460800 + 460800 baud (actual rate: 457143) + 0x07400000 + + + Baud921600 + 921600 baud (actual rate: 941176) + 0x0F000000 + + + Baud1M + 1Mega baud + 0x10000000 + + + + + + + RXD + RXD EasyDMA channel + UARTE_RXD + 0x534 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in receive buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in receive buffer + 0 + 7 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 7 + + + + + + TXD + TXD EasyDMA channel + UARTE_TXD + 0x544 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in transmit buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in transmit buffer + 0 + 7 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 7 + + + + + + CONFIG + Configuration of parity and hardware flow control + 0x56C + read-write + + + HWFC + Hardware flow control + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + PARITY + Parity + 1 + 3 + + + Excluded + Exclude parity bit + 0x0 + + + Included + Include parity bit + 0x7 + + + + + + + + + UART0 + Universal Asynchronous Receiver/Transmitter + UART + 0x40002000 + 32 + UARTE0 + UART + + 0 + 0x1000 + registers + + + UARTE0_UART0 + 2 + + + + TASKS_STARTRX + Start UART receiver + 0x000 + write-only + + + TASKS_STOPRX + Stop UART receiver + 0x004 + write-only + + + TASKS_STARTTX + Start UART transmitter + 0x008 + write-only + + + TASKS_STOPTX + Stop UART transmitter + 0x00C + write-only + + + TASKS_SUSPEND + Suspend UART + 0x01C + write-only + + + EVENTS_CTS + CTS is activated (set low). Clear To Send. + 0x100 + read-write + + + EVENTS_NCTS + CTS is deactivated (set high). Not Clear To Send. + 0x104 + read-write + + + EVENTS_RXDRDY + Data received in RXD + 0x108 + read-write + + + EVENTS_TXDRDY + Data sent from TXD + 0x11C + read-write + + + EVENTS_ERROR + Error detected + 0x124 + read-write + + + EVENTS_RXTO + Receiver timeout + 0x144 + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + CTS_STARTRX + Shortcut between CTS event and STARTRX task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + NCTS_STOPRX + Shortcut between NCTS event and STOPRX task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + CTS + Write '1' to Enable interrupt for CTS event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + NCTS + Write '1' to Enable interrupt for NCTS event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXDRDY + Write '1' to Enable interrupt for RXDRDY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXDRDY + Write '1' to Enable interrupt for TXDRDY event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to Enable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXTO + Write '1' to Enable interrupt for RXTO event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + CTS + Write '1' to Disable interrupt for CTS event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + NCTS + Write '1' to Disable interrupt for NCTS event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXDRDY + Write '1' to Disable interrupt for RXDRDY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXDRDY + Write '1' to Disable interrupt for TXDRDY event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to Disable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXTO + Write '1' to Disable interrupt for RXTO event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x480 + read-write + oneToClear + + + OVERRUN + Overrun error + 0 + 0 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + PARITY + Parity error + 1 + 1 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + FRAMING + Framing error occurred + 2 + 2 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + BREAK + Break condition + 3 + 3 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + + + + ENABLE + Enable UART + 0x500 + read-write + + + ENABLE + Enable or disable UART + 0 + 3 + + + Disabled + Disable UART + 0 + + + Enabled + Enable UART + 4 + + + + + + + PSELRTS + Pin select for RTS + 0x508 + read-write + 0xFFFFFFFF + + + PSELRTS + Pin number configuration for UART RTS signal + 0 + 31 + + + Disconnected + Disconnect + 0xFFFFFFFF + + + + + + + PSELTXD + Pin select for TXD + 0x50C + read-write + 0xFFFFFFFF + + + PSELTXD + Pin number configuration for UART TXD signal + 0 + 31 + + + Disconnected + Disconnect + 0xFFFFFFFF + + + + + + + PSELCTS + Pin select for CTS + 0x510 + read-write + 0xFFFFFFFF + + + PSELCTS + Pin number configuration for UART CTS signal + 0 + 31 + + + Disconnected + Disconnect + 0xFFFFFFFF + + + + + + + PSELRXD + Pin select for RXD + 0x514 + read-write + 0xFFFFFFFF + + + PSELRXD + Pin number configuration for UART RXD signal + 0 + 31 + + + Disconnected + Disconnect + 0xFFFFFFFF + + + + + + + RXD + RXD register + 0x518 + read-only + modifyExternal + + + RXD + RX data received in previous transfers, double buffered + 0 + 7 + + + + + TXD + TXD register + 0x51C + write-only + + + TXD + TX data to be transferred + 0 + 7 + + + + + BAUDRATE + Baud rate + 0x524 + read-write + 0x04000000 + + + BAUDRATE + Baud rate + 0 + 31 + + + Baud1200 + 1200 baud (actual rate: 1205) + 0x0004F000 + + + Baud2400 + 2400 baud (actual rate: 2396) + 0x0009D000 + + + Baud4800 + 4800 baud (actual rate: 4808) + 0x0013B000 + + + Baud9600 + 9600 baud (actual rate: 9598) + 0x00275000 + + + Baud14400 + 14400 baud (actual rate: 14414) + 0x003B0000 + + + Baud19200 + 19200 baud (actual rate: 19208) + 0x004EA000 + + + Baud28800 + 28800 baud (actual rate: 28829) + 0x0075F000 + + + Baud31250 + 31250 baud + 0x00800000 + + + Baud38400 + 38400 baud (actual rate: 38462) + 0x009D5000 + + + Baud56000 + 56000 baud (actual rate: 55944) + 0x00E50000 + + + Baud57600 + 57600 baud (actual rate: 57762) + 0x00EBF000 + + + Baud76800 + 76800 baud (actual rate: 76923) + 0x013A9000 + + + Baud115200 + 115200 baud (actual rate: 115942) + 0x01D7E000 + + + Baud230400 + 230400 baud (actual rate: 231884) + 0x03AFB000 + + + Baud250000 + 250000 baud + 0x04000000 + + + Baud460800 + 460800 baud (actual rate: 470588) + 0x075F7000 + + + Baud921600 + 921600 baud (actual rate: 941176) + 0x0EBED000 + + + Baud1M + 1Mega baud + 0x10000000 + + + + + + + CONFIG + Configuration of parity and hardware flow control + 0x56C + read-write + + + HWFC + Hardware flow control + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + PARITY + Parity + 1 + 3 + + + Excluded + Exclude parity bit + 0x0 + + + Included + Include parity bit + 0x7 + + + + + + + + + SPIM0 + Serial Peripheral Interface Master with EasyDMA 0 + SPIM + 0x40003000 + 32 + SPIM + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + + + TASKS_START + Start SPI transaction + 0x010 + write-only + + + TASKS_STOP + Stop SPI transaction + 0x014 + write-only + + + TASKS_SUSPEND + Suspend SPI transaction + 0x01C + write-only + + + TASKS_RESUME + Resume SPI transaction + 0x020 + write-only + + + EVENTS_STOPPED + SPI transaction has stopped + 0x104 + read-write + + + EVENTS_ENDRX + End of RXD buffer reached + 0x110 + read-write + + + EVENTS_END + End of RXD buffer and TXD buffer reached + 0x118 + read-write + + + EVENTS_ENDTX + End of TXD buffer reached + 0x120 + read-write + + + EVENTS_STARTED + Transaction started + 0x14C + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + END_START + Shortcut between END event and START task + 17 + 17 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to Enable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDRX + Write '1' to Enable interrupt for ENDRX event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + END + Write '1' to Enable interrupt for END event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDTX + Write '1' to Enable interrupt for ENDTX event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STARTED + Write '1' to Enable interrupt for STARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to Disable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDRX + Write '1' to Disable interrupt for ENDRX event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + END + Write '1' to Disable interrupt for END event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDTX + Write '1' to Disable interrupt for ENDTX event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STARTED + Write '1' to Disable interrupt for STARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + Enable SPIM + 0x500 + read-write + + + ENABLE + Enable or disable SPIM + 0 + 3 + + + Disabled + Disable SPIM + 0 + + + Enabled + Enable SPIM + 7 + + + + + + + PSEL + Unspecified + SPIM_PSEL + 0x508 + + SCK + Pin select for SCK + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MOSI + Pin select for MOSI signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MISO + Pin select for MISO signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + FREQUENCY + SPI frequency. Accuracy depends on the HFCLK source selected. + 0x524 + read-write + 0x04000000 + + + FREQUENCY + SPI master data rate + 0 + 31 + + + K125 + 125 kbps + 0x02000000 + + + K250 + 250 kbps + 0x04000000 + + + K500 + 500 kbps + 0x08000000 + + + M1 + 1 Mbps + 0x10000000 + + + M2 + 2 Mbps + 0x20000000 + + + M4 + 4 Mbps + 0x40000000 + + + M8 + 8 Mbps + 0x80000000 + + + + + + + RXD + RXD EasyDMA channel + SPIM_RXD + 0x534 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in receive buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in receive buffer + 0 + 7 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 7 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 2 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + TXD + TXD EasyDMA channel + SPIM_TXD + 0x544 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in transmit buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in transmit buffer + 0 + 7 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction + 0 + 7 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 2 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + CONFIG + Configuration register + 0x554 + read-write + + + ORDER + Bit order + 0 + 0 + + + MsbFirst + Most significant bit shifted out first + 0 + + + LsbFirst + Least significant bit shifted out first + 1 + + + + + CPHA + Serial clock (SCK) phase + 1 + 1 + + + Leading + Sample on leading edge of clock, shift serial data on trailing edge + 0 + + + Trailing + Sample on trailing edge of clock, shift serial data on leading edge + 1 + + + + + CPOL + Serial clock (SCK) polarity + 2 + 2 + + + ActiveHigh + Active high + 0 + + + ActiveLow + Active low + 1 + + + + + + + ORC + Over-read character. Character clocked out in case and over-read of the TXD buffer. + 0x5C0 + read-write + + + ORC + Over-read character. Character clocked out in case and over-read of the TXD buffer. + 0 + 7 + + + + + + + SPIS0 + SPI Slave 0 + SPIS + 0x40003000 + 32 + SPIM0 + SPIS + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + + + TASKS_ACQUIRE + Acquire SPI semaphore + 0x024 + write-only + + + TASKS_RELEASE + Release SPI semaphore, enabling the SPI slave to acquire it + 0x028 + write-only + + + EVENTS_END + Granted transaction completed + 0x104 + read-write + + + EVENTS_ENDRX + End of RXD buffer reached + 0x110 + read-write + + + EVENTS_ACQUIRED + Semaphore acquired + 0x128 + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + END_ACQUIRE + Shortcut between END event and ACQUIRE task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + END + Write '1' to Enable interrupt for END event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDRX + Write '1' to Enable interrupt for ENDRX event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ACQUIRED + Write '1' to Enable interrupt for ACQUIRED event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + END + Write '1' to Disable interrupt for END event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDRX + Write '1' to Disable interrupt for ENDRX event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ACQUIRED + Write '1' to Disable interrupt for ACQUIRED event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + SEMSTAT + Semaphore status register + 0x400 + read-only + 0x00000001 + + + SEMSTAT + Semaphore status + 0 + 1 + + + Free + Semaphore is free + 0 + + + CPU + Semaphore is assigned to CPU + 1 + + + SPIS + Semaphore is assigned to SPI slave + 2 + + + CPUPending + Semaphore is assigned to SPI but a handover to the CPU is pending + 3 + + + + + + + STATUS + Status from last transaction + 0x440 + read-write + + + OVERREAD + TX buffer over-read detected, and prevented + 0 + 0 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + write + + Clear + Write: clear error on writing '1' + 1 + + + + + OVERFLOW + RX buffer overflow detected, and prevented + 1 + 1 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + write + + Clear + Write: clear error on writing '1' + 1 + + + + + + + ENABLE + Enable SPI slave + 0x500 + read-write + + + ENABLE + Enable or disable SPI slave + 0 + 3 + + + Disabled + Disable SPI slave + 0 + + + Enabled + Enable SPI slave + 2 + + + + + + + PSEL + Unspecified + SPIS_PSEL + 0x508 + + SCK + Pin select for SCK + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MISO + Pin select for MISO signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + MOSI + Pin select for MOSI signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + CSN + Pin select for CSN signal + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + RXD + Unspecified + SPIS_RXD + 0x534 + + PTR + RXD data pointer + 0x000 + read-write + + + PTR + RXD data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in receive buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in receive buffer + 0 + 7 + + + + + AMOUNT + Number of bytes received in last granted transaction + 0x008 + read-only + + + AMOUNT + Number of bytes received in the last granted transaction + 0 + 7 + + + + + + TXD + Unspecified + SPIS_TXD + 0x544 + + PTR + TXD data pointer + 0x000 + read-write + + + PTR + TXD data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in transmit buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in transmit buffer + 0 + 7 + + + + + AMOUNT + Number of bytes transmitted in last granted transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transmitted in last granted transaction + 0 + 7 + + + + + + CONFIG + Configuration register + 0x554 + read-write + + + ORDER + Bit order + 0 + 0 + + + MsbFirst + Most significant bit shifted out first + 0 + + + LsbFirst + Least significant bit shifted out first + 1 + + + + + CPHA + Serial clock (SCK) phase + 1 + 1 + + + Leading + Sample on leading edge of clock, shift serial data on trailing edge + 0 + + + Trailing + Sample on trailing edge of clock, shift serial data on leading edge + 1 + + + + + CPOL + Serial clock (SCK) polarity + 2 + 2 + + + ActiveHigh + Active high + 0 + + + ActiveLow + Active low + 1 + + + + + + + DEF + Default character. Character clocked out in case of an ignored transaction. + 0x55C + read-write + + + DEF + Default character. Character clocked out in case of an ignored transaction. + 0 + 7 + + + + + ORC + Over-read character + 0x5C0 + read-write + + + ORC + Over-read character. Character clocked out after an over-read of the transmit buffer. + 0 + 7 + + + + + + + TWIM0 + I2C compatible Two-Wire Master Interface with EasyDMA 0 + TWIM + 0x40003000 + 32 + SPIM0 + TWIM + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + + + TASKS_STARTRX + Start TWI receive sequence + 0x000 + write-only + + + TASKS_STARTTX + Start TWI transmit sequence + 0x008 + write-only + + + TASKS_STOP + Stop TWI transaction. Must be issued while the TWI master is not suspended. + 0x014 + write-only + + + TASKS_SUSPEND + Suspend TWI transaction + 0x01C + write-only + + + TASKS_RESUME + Resume TWI transaction + 0x020 + write-only + + + EVENTS_STOPPED + TWI stopped + 0x104 + read-write + + + EVENTS_ERROR + TWI error + 0x124 + read-write + + + EVENTS_SUSPENDED + Last byte has been sent out after the SUSPEND task has been issued, TWI traffic is now suspended. + 0x148 + read-write + + + EVENTS_RXSTARTED + Receive sequence started + 0x14C + read-write + + + EVENTS_TXSTARTED + Transmit sequence started + 0x150 + read-write + + + EVENTS_LASTRX + Byte boundary, starting to receive the last byte + 0x15C + read-write + + + EVENTS_LASTTX + Byte boundary, starting to transmit the last byte + 0x160 + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + LASTTX_STARTRX + Shortcut between LASTTX event and STARTRX task + 7 + 7 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTTX_SUSPEND + Shortcut between LASTTX event and SUSPEND task + 8 + 8 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTTX_STOP + Shortcut between LASTTX event and STOP task + 9 + 9 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTRX_STARTTX + Shortcut between LASTRX event and STARTTX task + 10 + 10 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LASTRX_STOP + Shortcut between LASTRX event and STOP task + 12 + 12 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STOPPED + Enable or disable interrupt for STOPPED event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ERROR + Enable or disable interrupt for ERROR event + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SUSPENDED + Enable or disable interrupt for SUSPENDED event + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXSTARTED + Enable or disable interrupt for RXSTARTED event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXSTARTED + Enable or disable interrupt for TXSTARTED event + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + LASTRX + Enable or disable interrupt for LASTRX event + 23 + 23 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + LASTTX + Enable or disable interrupt for LASTTX event + 24 + 24 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to Enable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to Enable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SUSPENDED + Write '1' to Enable interrupt for SUSPENDED event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXSTARTED + Write '1' to Enable interrupt for RXSTARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXSTARTED + Write '1' to Enable interrupt for TXSTARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + LASTRX + Write '1' to Enable interrupt for LASTRX event + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + LASTTX + Write '1' to Enable interrupt for LASTTX event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to Disable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to Disable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SUSPENDED + Write '1' to Disable interrupt for SUSPENDED event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXSTARTED + Write '1' to Disable interrupt for RXSTARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXSTARTED + Write '1' to Disable interrupt for TXSTARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + LASTRX + Write '1' to Disable interrupt for LASTRX event + 23 + 23 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + LASTTX + Write '1' to Disable interrupt for LASTTX event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x4C4 + read-write + oneToClear + + + OVERRUN + Overrun error + 0 + 0 + + + NotReceived + Error did not occur + 0 + + + Received + Error occurred + 1 + + + + + ANACK + NACK received after sending the address (write '1' to clear) + 1 + 1 + + + NotReceived + Error did not occur + 0 + + + Received + Error occurred + 1 + + + + + DNACK + NACK received after sending a data byte (write '1' to clear) + 2 + 2 + + + NotReceived + Error did not occur + 0 + + + Received + Error occurred + 1 + + + + + + + ENABLE + Enable TWIM + 0x500 + read-write + + + ENABLE + Enable or disable TWIM + 0 + 3 + + + Disabled + Disable TWIM + 0 + + + Enabled + Enable TWIM + 6 + + + + + + + PSEL + Unspecified + TWIM_PSEL + 0x508 + + SCL + Pin select for SCL signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDA + Pin select for SDA signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + FREQUENCY + TWI frequency + 0x524 + read-write + 0x04000000 + + + FREQUENCY + TWI master clock frequency + 0 + 31 + + + K100 + 100 kbps + 0x01980000 + + + K250 + 250 kbps + 0x04000000 + + + K400 + 400 kbps + 0x06400000 + + + + + + + RXD + RXD EasyDMA channel + TWIM_RXD + 0x534 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in receive buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in receive buffer + 0 + 7 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte. + 0 + 7 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 2 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + TXD + TXD EasyDMA channel + TWIM_TXD + 0x544 + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in transmit buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in transmit buffer + 0 + 7 + + + + + AMOUNT + Number of bytes transferred in the last transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last transaction. In case of NACK error, includes the NACK'ed byte. + 0 + 7 + + + + + LIST + EasyDMA list type + 0x00C + read-write + + + LIST + List type + 0 + 2 + + + Disabled + Disable EasyDMA list + 0 + + + ArrayList + Use array list + 1 + + + + + + + + ADDRESS + Address used in the TWI transfer + 0x588 + read-write + + + ADDRESS + Address used in the TWI transfer + 0 + 6 + + + + + + + TWIS0 + I2C compatible Two-Wire Slave Interface with EasyDMA 0 + TWIS + 0x40003000 + 32 + SPIM0 + TWIS + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + + + TASKS_STOP + Stop TWI transaction + 0x014 + write-only + + + TASKS_SUSPEND + Suspend TWI transaction + 0x01C + write-only + + + TASKS_RESUME + Resume TWI transaction + 0x020 + write-only + + + TASKS_PREPARERX + Prepare the TWI slave to respond to a write command + 0x030 + write-only + + + TASKS_PREPARETX + Prepare the TWI slave to respond to a read command + 0x034 + write-only + + + EVENTS_STOPPED + TWI stopped + 0x104 + read-write + + + EVENTS_ERROR + TWI error + 0x124 + read-write + + + EVENTS_RXSTARTED + Receive sequence started + 0x14C + read-write + + + EVENTS_TXSTARTED + Transmit sequence started + 0x150 + read-write + + + EVENTS_WRITE + Write command received + 0x164 + read-write + + + EVENTS_READ + Read command received + 0x168 + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + WRITE_SUSPEND + Shortcut between WRITE event and SUSPEND task + 13 + 13 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + READ_SUSPEND + Shortcut between READ event and SUSPEND task + 14 + 14 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STOPPED + Enable or disable interrupt for STOPPED event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ERROR + Enable or disable interrupt for ERROR event + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXSTARTED + Enable or disable interrupt for RXSTARTED event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXSTARTED + Enable or disable interrupt for TXSTARTED event + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + WRITE + Enable or disable interrupt for WRITE event + 25 + 25 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + READ + Enable or disable interrupt for READ event + 26 + 26 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to Enable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to Enable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXSTARTED + Write '1' to Enable interrupt for RXSTARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXSTARTED + Write '1' to Enable interrupt for TXSTARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + WRITE + Write '1' to Enable interrupt for WRITE event + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + READ + Write '1' to Enable interrupt for READ event + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to Disable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to Disable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXSTARTED + Write '1' to Disable interrupt for RXSTARTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXSTARTED + Write '1' to Disable interrupt for TXSTARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + WRITE + Write '1' to Disable interrupt for WRITE event + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + READ + Write '1' to Disable interrupt for READ event + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x4D0 + read-write + oneToClear + + + OVERFLOW + RX buffer overflow detected, and prevented + 0 + 0 + + + NotDetected + Error did not occur + 0 + + + Detected + Error occurred + 1 + + + + + DNACK + NACK sent after receiving a data byte + 2 + 2 + + + NotReceived + Error did not occur + 0 + + + Received + Error occurred + 1 + + + + + OVERREAD + TX buffer over-read detected, and prevented + 3 + 3 + + + NotDetected + Error did not occur + 0 + + + Detected + Error occurred + 1 + + + + + + + MATCH + Status register indicating which address had a match + 0x4D4 + read-only + + + MATCH + Which of the addresses in {ADDRESS} matched the incoming address + 0 + 0 + + + + + ENABLE + Enable TWIS + 0x500 + read-write + + + ENABLE + Enable or disable TWIS + 0 + 3 + + + Disabled + Disable TWIS + 0 + + + Enabled + Enable TWIS + 9 + + + + + + + PSEL + Unspecified + TWIS_PSEL + 0x508 + + SCL + Pin select for SCL signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDA + Pin select for SDA signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + RXD + RXD EasyDMA channel + TWIS_RXD + 0x534 + + PTR + RXD Data pointer + 0x000 + read-write + + + PTR + RXD Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in RXD buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in RXD buffer + 0 + 7 + + + + + AMOUNT + Number of bytes transferred in the last RXD transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last RXD transaction + 0 + 7 + + + + + + TXD + TXD EasyDMA channel + TWIS_TXD + 0x544 + + PTR + TXD Data pointer + 0x000 + read-write + + + PTR + TXD Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of bytes in TXD buffer + 0x004 + read-write + + + MAXCNT + Maximum number of bytes in TXD buffer + 0 + 7 + + + + + AMOUNT + Number of bytes transferred in the last TXD transaction + 0x008 + read-only + + + AMOUNT + Number of bytes transferred in the last TXD transaction + 0 + 7 + + + + + + 2 + 4 + ADDRESS[%s] + Description collection[0]: TWI slave address 0 + 0x588 + read-write + + + ADDRESS + TWI slave address + 0 + 6 + + + + + CONFIG + Configuration register for the address match mechanism + 0x594 + read-write + 0x00000001 + + + ADDRESS0 + Enable or disable address matching on ADDRESS[0] + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + ADDRESS1 + Enable or disable address matching on ADDRESS[1] + 1 + 1 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + + + ORC + Over-read character. Character sent out in case of an over-read of the transmit buffer. + 0x5C0 + read-write + + + ORC + Over-read character. Character sent out in case of an over-read of the transmit buffer. + 0 + 7 + + + + + + + SPI0 + Serial Peripheral Interface 0 + SPI + 0x40003000 + 32 + SPIM0 + SPI + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + + + EVENTS_READY + TXD byte sent and RXD byte received + 0x108 + read-write + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to Enable interrupt for READY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to Disable interrupt for READY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + Enable SPI + 0x500 + read-write + + + ENABLE + Enable or disable SPI + 0 + 3 + + + Disabled + Disable SPI + 0 + + + Enabled + Enable SPI + 1 + + + + + + + PSEL + Unspecified + SPI_PSEL + 0x508 + + SCK + Pin select for SCK + 0x000 + read-write + 0xFFFFFFFF + + + PSELSCK + Pin number configuration for SPI SCK signal + 0 + 31 + + + Disconnected + Disconnect + 0xFFFFFFFF + + + + + + + MOSI + Pin select for MOSI + 0x004 + read-write + 0xFFFFFFFF + + + PSELMOSI + Pin number configuration for SPI MOSI signal + 0 + 31 + + + Disconnected + Disconnect + 0xFFFFFFFF + + + + + + + MISO + Pin select for MISO + 0x008 + read-write + 0xFFFFFFFF + + + PSELMISO + Pin number configuration for SPI MISO signal + 0 + 31 + + + Disconnected + Disconnect + 0xFFFFFFFF + + + + + + + + RXD + RXD register + 0x518 + read-only + modifyExternal + + + RXD + RX data received. Double buffered + 0 + 7 + + + + + TXD + TXD register + 0x51C + read-write + + + TXD + TX data to send. Double buffered + 0 + 7 + + + + + FREQUENCY + SPI frequency + 0x524 + read-write + 0x04000000 + + + FREQUENCY + SPI master data rate + 0 + 31 + + + K125 + 125 kbps + 0x02000000 + + + K250 + 250 kbps + 0x04000000 + + + K500 + 500 kbps + 0x08000000 + + + M1 + 1 Mbps + 0x10000000 + + + M2 + 2 Mbps + 0x20000000 + + + M4 + 4 Mbps + 0x40000000 + + + M8 + 8 Mbps + 0x80000000 + + + + + + + CONFIG + Configuration register + 0x554 + read-write + + + ORDER + Bit order + 0 + 0 + + + MsbFirst + Most significant bit shifted out first + 0 + + + LsbFirst + Least significant bit shifted out first + 1 + + + + + CPHA + Serial clock (SCK) phase + 1 + 1 + + + Leading + Sample on leading edge of clock, shift serial data on trailing edge + 0 + + + Trailing + Sample on trailing edge of clock, shift serial data on leading edge + 1 + + + + + CPOL + Serial clock (SCK) polarity + 2 + 2 + + + ActiveHigh + Active high + 0 + + + ActiveLow + Active low + 1 + + + + + + + + + TWI0 + I2C compatible Two-Wire Interface 0 + TWI + 0x40003000 + 32 + SPIM0 + TWI + + 0 + 0x1000 + registers + + + SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0 + 3 + + + + TASKS_STARTRX + Start TWI receive sequence + 0x000 + write-only + + + TASKS_STARTTX + Start TWI transmit sequence + 0x008 + write-only + + + TASKS_STOP + Stop TWI transaction + 0x014 + write-only + + + TASKS_SUSPEND + Suspend TWI transaction + 0x01C + write-only + + + TASKS_RESUME + Resume TWI transaction + 0x020 + write-only + + + EVENTS_STOPPED + TWI stopped + 0x104 + read-write + + + EVENTS_RXDREADY + TWI RXD byte received + 0x108 + read-write + + + EVENTS_TXDSENT + TWI TXD byte sent + 0x11C + read-write + + + EVENTS_ERROR + TWI error + 0x124 + read-write + + + EVENTS_BB + TWI byte boundary, generated before each byte that is sent or received + 0x138 + read-write + + + EVENTS_SUSPENDED + TWI entered the suspended state + 0x148 + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + BB_SUSPEND + Shortcut between BB event and SUSPEND task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + BB_STOP + Shortcut between BB event and STOP task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to Enable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXDREADY + Write '1' to Enable interrupt for RXDREADY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXDSENT + Write '1' to Enable interrupt for TXDSENT event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to Enable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + BB + Write '1' to Enable interrupt for BB event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SUSPENDED + Write '1' to Enable interrupt for SUSPENDED event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to Disable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXDREADY + Write '1' to Disable interrupt for RXDREADY event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXDSENT + Write '1' to Disable interrupt for TXDSENT event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to Disable interrupt for ERROR event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + BB + Write '1' to Disable interrupt for BB event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SUSPENDED + Write '1' to Disable interrupt for SUSPENDED event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSRC + Error source + 0x4C4 + read-write + oneToClear + + + OVERRUN + Overrun error + 0 + 0 + + read + + NotPresent + Read: no overrun occured + 0 + + + Present + Read: overrun occured + 1 + + + + write + + Clear + Write: clear error on writing '1' + 1 + + + + + ANACK + NACK received after sending the address (write '1' to clear) + 1 + 1 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + write + + Clear + Write: clear error on writing '1' + 1 + + + + + DNACK + NACK received after sending a data byte (write '1' to clear) + 2 + 2 + + read + + NotPresent + Read: error not present + 0 + + + Present + Read: error present + 1 + + + + write + + Clear + Write: clear error on writing '1' + 1 + + + + + + + ENABLE + Enable TWI + 0x500 + read-write + + + ENABLE + Enable or disable TWI + 0 + 3 + + + Disabled + Disable TWI + 0 + + + Enabled + Enable TWI + 5 + + + + + + + PSELSCL + Pin select for SCL + 0x508 + read-write + 0xFFFFFFFF + + + PSELSCL + Pin number configuration for TWI SCL signal + 0 + 31 + + + Disconnected + Disconnect + 0xFFFFFFFF + + + + + + + PSELSDA + Pin select for SDA + 0x50C + read-write + 0xFFFFFFFF + + + PSELSDA + Pin number configuration for TWI SDA signal + 0 + 31 + + + Disconnected + Disconnect + 0xFFFFFFFF + + + + + + + RXD + RXD register + 0x518 + read-only + modifyExternal + + + RXD + RXD register + 0 + 7 + + + + + TXD + TXD register + 0x51C + read-write + + + TXD + TXD register + 0 + 7 + + + + + FREQUENCY + TWI frequency + 0x524 + read-write + 0x04000000 + + + FREQUENCY + TWI master clock frequency + 0 + 31 + + + K100 + 100 kbps + 0x01980000 + + + K250 + 250 kbps + 0x04000000 + + + K400 + 400 kbps (actual rate 410.256 kbps) + 0x06680000 + + + + + + + ADDRESS + Address used in the TWI transfer + 0x588 + read-write + + + ADDRESS + Address used in the TWI transfer + 0 + 6 + + + + + + + SPIM1 + Serial Peripheral Interface Master with EasyDMA 1 + 0x40004000 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + SPIS1 + SPI Slave 1 + 0x40004000 + SPIM1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + TWIM1 + I2C compatible Two-Wire Master Interface with EasyDMA 1 + 0x40004000 + SPIM1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + TWIS1 + I2C compatible Two-Wire Slave Interface with EasyDMA 1 + 0x40004000 + SPIM1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + SPI1 + Serial Peripheral Interface 1 + 0x40004000 + SPIM1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + TWI1 + I2C compatible Two-Wire Interface 1 + 0x40004000 + SPIM1 + + SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1 + 4 + + + + NFCT + NFC-A compatible radio + NFCT + 0x40005000 + 32 + + 0 + 0x1000 + registers + + + NFCT + 5 + + + + TASKS_ACTIVATE + Activate NFC peripheral for incoming and outgoing frames, change state to activated + 0x000 + write-only + + + TASKS_DISABLE + Disable NFC peripheral + 0x004 + write-only + + + TASKS_SENSE + Enable NFC sense field mode, change state to sense mode + 0x008 + write-only + + + TASKS_STARTTX + Start transmission of a outgoing frame, change state to transmit + 0x00C + write-only + + + TASKS_ENABLERXDATA + Initializes the EasyDMA for receive. + 0x01C + write-only + + + TASKS_GOIDLE + Force state machine to IDLE state + 0x024 + write-only + + + TASKS_GOSLEEP + Force state machine to SLEEP_A state + 0x028 + write-only + + + EVENTS_READY + The NFC peripheral is ready to receive and send frames + 0x100 + read-write + + + EVENTS_FIELDDETECTED + Remote NFC field detected + 0x104 + read-write + + + EVENTS_FIELDLOST + Remote NFC field lost + 0x108 + read-write + + + EVENTS_TXFRAMESTART + Marks the start of the first symbol of a transmitted frame + 0x10C + read-write + + + EVENTS_TXFRAMEEND + Marks the end of the last transmitted on-air symbol of a frame + 0x110 + read-write + + + EVENTS_RXFRAMESTART + Marks the end of the first symbol of a received frame + 0x114 + read-write + + + EVENTS_RXFRAMEEND + Received data have been checked (CRC, parity) and transferred to RAM, and EasyDMA has ended accessing the RX buffer + 0x118 + read-write + + + EVENTS_ERROR + NFC error reported. The ERRORSTATUS register contains details on the source of the error. + 0x11C + read-write + + + EVENTS_RXERROR + NFC RX frame error reported. The FRAMESTATUS.RX register contains details on the source of the error. + 0x128 + read-write + + + EVENTS_ENDRX + RX buffer (as defined by PACKETPTR and MAXLEN) in Data RAM full. + 0x12C + read-write + + + EVENTS_ENDTX + Transmission of data in RAM has ended, and EasyDMA has ended accessing the TX buffer + 0x130 + read-write + + + EVENTS_AUTOCOLRESSTARTED + Auto collision resolution process has started + 0x138 + read-write + + + EVENTS_COLLISION + NFC Auto collision resolution error reported. + 0x148 + read-write + + + EVENTS_SELECTED + NFC Auto collision resolution successfully completed + 0x14C + read-write + + + EVENTS_STARTED + EasyDMA is ready to receive or send frames. + 0x150 + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + FIELDDETECTED_ACTIVATE + Shortcut between FIELDDETECTED event and ACTIVATE task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + FIELDLOST_SENSE + Shortcut between FIELDLOST event and SENSE task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + READY + Enable or disable interrupt for READY event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + FIELDDETECTED + Enable or disable interrupt for FIELDDETECTED event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + FIELDLOST + Enable or disable interrupt for FIELDLOST event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXFRAMESTART + Enable or disable interrupt for TXFRAMESTART event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXFRAMEEND + Enable or disable interrupt for TXFRAMEEND event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXFRAMESTART + Enable or disable interrupt for RXFRAMESTART event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXFRAMEEND + Enable or disable interrupt for RXFRAMEEND event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ERROR + Enable or disable interrupt for ERROR event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RXERROR + Enable or disable interrupt for RXERROR event + 10 + 10 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDRX + Enable or disable interrupt for ENDRX event + 11 + 11 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + ENDTX + Enable or disable interrupt for ENDTX event + 12 + 12 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + AUTOCOLRESSTARTED + Enable or disable interrupt for AUTOCOLRESSTARTED event + 14 + 14 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + COLLISION + Enable or disable interrupt for COLLISION event + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SELECTED + Enable or disable interrupt for SELECTED event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STARTED + Enable or disable interrupt for STARTED event + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to Enable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + FIELDDETECTED + Write '1' to Enable interrupt for FIELDDETECTED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + FIELDLOST + Write '1' to Enable interrupt for FIELDLOST event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXFRAMESTART + Write '1' to Enable interrupt for TXFRAMESTART event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXFRAMEEND + Write '1' to Enable interrupt for TXFRAMEEND event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXFRAMESTART + Write '1' to Enable interrupt for RXFRAMESTART event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXFRAMEEND + Write '1' to Enable interrupt for RXFRAMEEND event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to Enable interrupt for ERROR event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RXERROR + Write '1' to Enable interrupt for RXERROR event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDRX + Write '1' to Enable interrupt for ENDRX event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDTX + Write '1' to Enable interrupt for ENDTX event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + AUTOCOLRESSTARTED + Write '1' to Enable interrupt for AUTOCOLRESSTARTED event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COLLISION + Write '1' to Enable interrupt for COLLISION event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SELECTED + Write '1' to Enable interrupt for SELECTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STARTED + Write '1' to Enable interrupt for STARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to Disable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + FIELDDETECTED + Write '1' to Disable interrupt for FIELDDETECTED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + FIELDLOST + Write '1' to Disable interrupt for FIELDLOST event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXFRAMESTART + Write '1' to Disable interrupt for TXFRAMESTART event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXFRAMEEND + Write '1' to Disable interrupt for TXFRAMEEND event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXFRAMESTART + Write '1' to Disable interrupt for RXFRAMESTART event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXFRAMEEND + Write '1' to Disable interrupt for RXFRAMEEND event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to Disable interrupt for ERROR event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RXERROR + Write '1' to Disable interrupt for RXERROR event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDRX + Write '1' to Disable interrupt for ENDRX event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDTX + Write '1' to Disable interrupt for ENDTX event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + AUTOCOLRESSTARTED + Write '1' to Disable interrupt for AUTOCOLRESSTARTED event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COLLISION + Write '1' to Disable interrupt for COLLISION event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SELECTED + Write '1' to Disable interrupt for SELECTED event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STARTED + Write '1' to Disable interrupt for STARTED event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ERRORSTATUS + NFC Error Status register + 0x404 + read-write + oneToClear + + + FRAMEDELAYTIMEOUT + No STARTTX task triggered before expiration of the time set in FRAMEDELAYMAX + 0 + 0 + + + NFCFIELDTOOSTRONG + Field level is too high at max load resistance + 2 + 2 + + + NFCFIELDTOOWEAK + Field level is too low at min load resistance + 3 + 3 + + + + + FRAMESTATUS + Unspecified + 0x40C + + RX + Result of last incoming frames + 0x000 + read-write + oneToClear + + + CRCERROR + No valid End of Frame detected + 0 + 0 + + + CRCCorrect + Valid CRC detected + 0 + + + CRCError + CRC received does not match local check + 1 + + + + + PARITYSTATUS + Parity status of received frame + 2 + 2 + + + ParityOK + Frame received with parity OK + 0 + + + ParityError + Frame received with parity error + 1 + + + + + OVERRUN + Overrun detected + 3 + 3 + + + NoOverrun + No overrun detected + 0 + + + Overrun + Overrun error + 1 + + + + + + + + CURRENTLOADCTRL + Current value driven to the NFC Load Control + 0x430 + read-only + 0x00000000 + + + CURRENTLOADCTRL + Current value driven to the NFC Load Control + 0 + 5 + + + + + FIELDPRESENT + Indicates the presence or not of a valid field + 0x43C + read-only + + + FIELDPRESENT + Indicates the presence or not of a valid field. Available only in the activated state. + 0 + 0 + + + NoField + No valid field detected + 0 + + + FieldPresent + Valid field detected + 1 + + + + + LOCKDETECT + Indicates if the low level has locked to the field + 1 + 1 + + + NotLocked + Not locked to field + 0 + + + Locked + Locked to field + 1 + + + + + + + FRAMEDELAYMIN + Minimum frame delay + 0x504 + read-write + 0x00000480 + + + FRAMEDELAYMIN + Minimum frame delay in number of 13.56 MHz clocks + 0 + 15 + + + + + FRAMEDELAYMAX + Maximum frame delay + 0x508 + read-write + 0x00001000 + + + FRAMEDELAYMAX + Maximum frame delay in number of 13.56 MHz clocks + 0 + 15 + + + + + FRAMEDELAYMODE + Configuration register for the Frame Delay Timer + 0x50C + read-write + 0x00000001 + + + FRAMEDELAYMODE + Configuration register for the Frame Delay Timer + 0 + 1 + + + FreeRun + Transmission is independent of frame timer and will start when the STARTTX task is triggered. No timeout. + 0 + + + Window + Frame is transmitted between FRAMEDELAYMIN and FRAMEDELAYMAX + 1 + + + ExactVal + Frame is transmitted exactly at FRAMEDELAYMAX + 2 + + + WindowGrid + Frame is transmitted on a bit grid between FRAMEDELAYMIN and FRAMEDELAYMAX + 3 + + + + + + + PACKETPTR + Packet pointer for TXD and RXD data storage in Data RAM + 0x510 + read-write + + + PTR + Packet pointer for TXD and RXD data storage in Data RAM. This address is a byte aligned RAM address. + 0 + 31 + + + + + MAXLEN + Size of allocated for TXD and RXD data storage buffer in Data RAM + 0x514 + read-write + + + MAXLEN + Size of allocated for TXD and RXD data storage buffer in Data RAM + 0 + 8 + + + + + TXD + Unspecified + 0x518 + + FRAMECONFIG + Configuration of outgoing frames + 0x000 + read-write + 0x00000017 + + + PARITY + Adding parity or not in the frame + 0 + 0 + + + NoParity + Parity is not added in TX frames + 0 + + + Parity + Parity is added TX frames + 1 + + + + + DISCARDMODE + Discarding unused bits in start or at end of a Frame + 1 + 1 + + + DiscardEnd + Unused bits is discarded at end of frame + 0 + + + DiscardStart + Unused bits is discarded at start of frame + 1 + + + + + SOF + Adding SoF or not in TX frames + 2 + 2 + + + NoSoF + Start of Frame symbol not added + 0 + + + SoF + Start of Frame symbol added + 1 + + + + + CRCMODETX + CRC mode for outgoing frames + 4 + 4 + + + NoCRCTX + CRC is not added to the frame + 0 + + + CRC16TX + 16 bit CRC added to the frame based on all the data read from RAM that is used in the frame + 1 + + + + + + + AMOUNT + Size of outgoing frame + 0x004 + read-write + + + TXDATABITS + Number of bits in the last or first byte read from RAM that shall be included in the frame (excluding parity bit). + 0 + 2 + + + TXDATABYTES + Number of complete bytes that shall be included in the frame, excluding CRC, parity and framing + 3 + 11 + + + + + + RXD + Unspecified + 0x520 + + FRAMECONFIG + Configuration of incoming frames + 0x000 + read-write + 0x00000015 + + + PARITY + Parity expected or not in RX frame + 0 + 0 + + + NoParity + Parity is not expected in RX frames + 0 + + + Parity + Parity is expected in RX frames + 1 + + + + + SOF + SoF expected or not in RX frames + 2 + 2 + + + NoSoF + Start of Frame symbol is not expected in RX frames + 0 + + + SoF + Start of Frame symbol is expected in RX frames + 1 + + + + + CRCMODERX + CRC mode for incoming frames + 4 + 4 + + + NoCRCRX + CRC is not expected in RX frames + 0 + + + CRC16RX + Last 16 bits in RX frame is CRC, CRC is checked and CRCSTATUS updated + 1 + + + + + + + AMOUNT + Size of last incoming frame + 0x004 + read-only + + + RXDATABITS + Number of bits in the last byte in the frame, if less than 8 (including CRC, but excluding parity and SoF/EoF framing). + 0 + 2 + + + RXDATABYTES + Number of complete bytes received in the frame (including CRC, but excluding parity and SoF/EoF framing) + 3 + 11 + + + + + + NFCID1_LAST + Last NFCID1 part (4, 7 or 10 bytes ID) + 0x590 + read-write + 0x00006363 + + + NFCID1_Z + NFCID1 byte Z (very last byte sent) + 0 + 7 + + + NFCID1_Y + NFCID1 byte Y + 8 + 15 + + + NFCID1_X + NFCID1 byte X + 16 + 23 + + + NFCID1_W + NFCID1 byte W + 24 + 31 + + + + + NFCID1_2ND_LAST + Second last NFCID1 part (7 or 10 bytes ID) + 0x594 + read-write + + + NFCID1_V + NFCID1 byte V + 0 + 7 + + + NFCID1_U + NFCID1 byte U + 8 + 15 + + + NFCID1_T + NFCID1 byte T + 16 + 23 + + + + + NFCID1_3RD_LAST + Third last NFCID1 part (10 bytes ID) + 0x598 + read-write + + + NFCID1_S + NFCID1 byte S + 0 + 7 + + + NFCID1_R + NFCID1 byte R + 8 + 15 + + + NFCID1_Q + NFCID1 byte Q + 16 + 23 + + + + + SENSRES + NFC-A SENS_RES auto-response settings + 0x5A0 + read-write + 0x00000001 + + + BITFRAMESDD + Bit frame SDD as defined by the b5:b1 of byte 1 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification + 0 + 4 + + + SDD00000 + SDD pattern 00000 + 0 + + + SDD00001 + SDD pattern 00001 + 1 + + + SDD00010 + SDD pattern 00010 + 2 + + + SDD00100 + SDD pattern 00100 + 4 + + + SDD01000 + SDD pattern 01000 + 8 + + + SDD10000 + SDD pattern 10000 + 16 + + + + + RFU5 + Reserved for future use. Shall be 0. + 5 + 5 + + + NFCIDSIZE + NFCID1 size. This value is used by the Auto collision resolution engine. + 6 + 7 + + + NFCID1Single + NFCID1 size: single (4 bytes) + 0 + + + NFCID1Double + NFCID1 size: double (7 bytes) + 1 + + + NFCID1Triple + NFCID1 size: triple (10 bytes) + 2 + + + + + PLATFCONFIG + Tag platform configuration as defined by the b4:b1 of byte 2 in SENS_RES response in the NFC Forum, NFC Digital Protocol Technical Specification + 8 + 11 + + + RFU74 + Reserved for future use. Shall be 0. + 12 + 15 + + + + + SELRES + NFC-A SEL_RES auto-response settings + 0x5A4 + read-write + + + RFU10 + Reserved for future use. Shall be 0. + 0 + 1 + + + CASCADE + Cascade bit (controlled by hardware, write has no effect) + 2 + 2 + + + Complete + NFCID1 complete + 0 + + + NotComplete + NFCID1 not complete + 1 + + + + + RFU43 + Reserved for future use. Shall be 0. + 3 + 4 + + + PROTOCOL + Protocol as defined by the b7:b6 of SEL_RES response in the NFC Forum, NFC Digital Protocol Technical Specification + 5 + 6 + + + RFU7 + Reserved for future use. Shall be 0. + 7 + 7 + + + + + + + GPIOTE + GPIO Tasks and Events + GPIOTE + 0x40006000 + 32 + + 0 + 0x1000 + registers + + + GPIOTE + 6 + + + + 8 + 4 + TASKS_OUT[%s] + Description collection[0]: Task for writing to pin specified in CONFIG[0].PSEL. Action on pin is configured in CONFIG[0].POLARITY. + 0x000 + write-only + + + 8 + 4 + TASKS_SET[%s] + Description collection[0]: Task for writing to pin specified in CONFIG[0].PSEL. Action on pin is to set it high. + 0x030 + write-only + + + 8 + 4 + TASKS_CLR[%s] + Description collection[0]: Task for writing to pin specified in CONFIG[0].PSEL. Action on pin is to set it low. + 0x060 + write-only + + + 8 + 4 + EVENTS_IN[%s] + Description collection[0]: Event generated from pin specified in CONFIG[0].PSEL + 0x100 + read-write + + + EVENTS_PORT + Event generated from multiple input GPIO pins with SENSE mechanism enabled + 0x17C + read-write + + + INTENSET + Enable interrupt + 0x304 + read-write + + + IN0 + Write '1' to Enable interrupt for IN[0] event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN1 + Write '1' to Enable interrupt for IN[1] event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN2 + Write '1' to Enable interrupt for IN[2] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN3 + Write '1' to Enable interrupt for IN[3] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN4 + Write '1' to Enable interrupt for IN[4] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN5 + Write '1' to Enable interrupt for IN[5] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN6 + Write '1' to Enable interrupt for IN[6] event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + IN7 + Write '1' to Enable interrupt for IN[7] event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PORT + Write '1' to Enable interrupt for PORT event + 31 + 31 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + IN0 + Write '1' to Disable interrupt for IN[0] event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN1 + Write '1' to Disable interrupt for IN[1] event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN2 + Write '1' to Disable interrupt for IN[2] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN3 + Write '1' to Disable interrupt for IN[3] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN4 + Write '1' to Disable interrupt for IN[4] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN5 + Write '1' to Disable interrupt for IN[5] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN6 + Write '1' to Disable interrupt for IN[6] event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + IN7 + Write '1' to Disable interrupt for IN[7] event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PORT + Write '1' to Disable interrupt for PORT event + 31 + 31 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + 8 + 4 + CONFIG[%s] + Description collection[0]: Configuration for OUT[n], SET[n] and CLR[n] tasks and IN[n] event + 0x510 + read-write + + + MODE + Mode + 0 + 1 + + + Disabled + Disabled. Pin specified by PSEL will not be acquired by the GPIOTE module. + 0 + + + Event + Event mode + 1 + + + Task + Task mode + 3 + + + + + PSEL + GPIO number associated with SET[n], CLR[n] and OUT[n] tasks and IN[n] event + 8 + 12 + + + POLARITY + When In task mode: Operation to be performed on output when OUT[n] task is triggered. When In event mode: Operation on input that shall trigger IN[n] event. + 16 + 17 + + + None + Task mode: No effect on pin from OUT[n] task. Event mode: no IN[n] event generated on pin activity. + 0 + + + LoToHi + Task mode: Set pin from OUT[n] task. Event mode: Generate IN[n] event when rising edge on pin. + 1 + + + HiToLo + Task mode: Clear pin from OUT[n] task. Event mode: Generate IN[n] event when falling edge on pin. + 2 + + + Toggle + Task mode: Toggle pin from OUT[n]. Event mode: Generate IN[n] when any change on pin. + 3 + + + + + OUTINIT + When in task mode: Initial value of the output when the GPIOTE channel is configured. When in event mode: No effect. + 20 + 20 + + + Low + Task mode: Initial value of pin before task triggering is low + 0 + + + High + Task mode: Initial value of pin before task triggering is high + 1 + + + + + + + + + SAADC + Analog to Digital Converter + SAADC + 0x40007000 + 32 + + 0 + 0x1000 + registers + + + SAADC + 7 + + + + TASKS_START + Start the ADC and prepare the result buffer in RAM + 0x000 + write-only + + + TASKS_SAMPLE + Take one ADC sample, if scan is enabled all channels are sampled + 0x004 + write-only + + + TASKS_STOP + Stop the ADC and terminate any on-going conversion + 0x008 + write-only + + + TASKS_CALIBRATEOFFSET + Starts offset auto-calibration + 0x00C + write-only + + + EVENTS_STARTED + The ADC has started + 0x100 + read-write + + + EVENTS_END + The ADC has filled up the Result buffer + 0x104 + read-write + + + EVENTS_DONE + A conversion task has been completed. Depending on the mode, multiple conversions might be needed for a result to be transferred to RAM. + 0x108 + read-write + + + EVENTS_RESULTDONE + A result is ready to get transferred to RAM. + 0x10C + read-write + + + EVENTS_CALIBRATEDONE + Calibration is complete + 0x110 + read-write + + + EVENTS_STOPPED + The ADC has stopped + 0x114 + read-write + + + 8 + 8 + EVENTS_CH[%s] + Unspecified + 0x118 + + LIMITH + Description cluster[0]: Last results is equal or above CH[0].LIMIT.HIGH + 0x000 + read-write + + + LIMITL + Description cluster[0]: Last results is equal or below CH[0].LIMIT.LOW + 0x004 + read-write + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STARTED + Enable or disable interrupt for STARTED event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + END + Enable or disable interrupt for END event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + DONE + Enable or disable interrupt for DONE event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + RESULTDONE + Enable or disable interrupt for RESULTDONE event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CALIBRATEDONE + Enable or disable interrupt for CALIBRATEDONE event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STOPPED + Enable or disable interrupt for STOPPED event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH0LIMITH + Enable or disable interrupt for CH[0].LIMITH event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH0LIMITL + Enable or disable interrupt for CH[0].LIMITL event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH1LIMITH + Enable or disable interrupt for CH[1].LIMITH event + 8 + 8 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH1LIMITL + Enable or disable interrupt for CH[1].LIMITL event + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH2LIMITH + Enable or disable interrupt for CH[2].LIMITH event + 10 + 10 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH2LIMITL + Enable or disable interrupt for CH[2].LIMITL event + 11 + 11 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH3LIMITH + Enable or disable interrupt for CH[3].LIMITH event + 12 + 12 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH3LIMITL + Enable or disable interrupt for CH[3].LIMITL event + 13 + 13 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH4LIMITH + Enable or disable interrupt for CH[4].LIMITH event + 14 + 14 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH4LIMITL + Enable or disable interrupt for CH[4].LIMITL event + 15 + 15 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH5LIMITH + Enable or disable interrupt for CH[5].LIMITH event + 16 + 16 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH5LIMITL + Enable or disable interrupt for CH[5].LIMITL event + 17 + 17 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH6LIMITH + Enable or disable interrupt for CH[6].LIMITH event + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH6LIMITL + Enable or disable interrupt for CH[6].LIMITL event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH7LIMITH + Enable or disable interrupt for CH[7].LIMITH event + 20 + 20 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CH7LIMITL + Enable or disable interrupt for CH[7].LIMITL event + 21 + 21 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STARTED + Write '1' to Enable interrupt for STARTED event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + END + Write '1' to Enable interrupt for END event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DONE + Write '1' to Enable interrupt for DONE event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RESULTDONE + Write '1' to Enable interrupt for RESULTDONE event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CALIBRATEDONE + Write '1' to Enable interrupt for CALIBRATEDONE event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STOPPED + Write '1' to Enable interrupt for STOPPED event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH0LIMITH + Write '1' to Enable interrupt for CH[0].LIMITH event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH0LIMITL + Write '1' to Enable interrupt for CH[0].LIMITL event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH1LIMITH + Write '1' to Enable interrupt for CH[1].LIMITH event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH1LIMITL + Write '1' to Enable interrupt for CH[1].LIMITL event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH2LIMITH + Write '1' to Enable interrupt for CH[2].LIMITH event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH2LIMITL + Write '1' to Enable interrupt for CH[2].LIMITL event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH3LIMITH + Write '1' to Enable interrupt for CH[3].LIMITH event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH3LIMITL + Write '1' to Enable interrupt for CH[3].LIMITL event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH4LIMITH + Write '1' to Enable interrupt for CH[4].LIMITH event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH4LIMITL + Write '1' to Enable interrupt for CH[4].LIMITL event + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH5LIMITH + Write '1' to Enable interrupt for CH[5].LIMITH event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH5LIMITL + Write '1' to Enable interrupt for CH[5].LIMITL event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH6LIMITH + Write '1' to Enable interrupt for CH[6].LIMITH event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH6LIMITL + Write '1' to Enable interrupt for CH[6].LIMITL event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH7LIMITH + Write '1' to Enable interrupt for CH[7].LIMITH event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CH7LIMITL + Write '1' to Enable interrupt for CH[7].LIMITL event + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STARTED + Write '1' to Disable interrupt for STARTED event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + END + Write '1' to Disable interrupt for END event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DONE + Write '1' to Disable interrupt for DONE event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RESULTDONE + Write '1' to Disable interrupt for RESULTDONE event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CALIBRATEDONE + Write '1' to Disable interrupt for CALIBRATEDONE event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STOPPED + Write '1' to Disable interrupt for STOPPED event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH0LIMITH + Write '1' to Disable interrupt for CH[0].LIMITH event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH0LIMITL + Write '1' to Disable interrupt for CH[0].LIMITL event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH1LIMITH + Write '1' to Disable interrupt for CH[1].LIMITH event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH1LIMITL + Write '1' to Disable interrupt for CH[1].LIMITL event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH2LIMITH + Write '1' to Disable interrupt for CH[2].LIMITH event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH2LIMITL + Write '1' to Disable interrupt for CH[2].LIMITL event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH3LIMITH + Write '1' to Disable interrupt for CH[3].LIMITH event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH3LIMITL + Write '1' to Disable interrupt for CH[3].LIMITL event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH4LIMITH + Write '1' to Disable interrupt for CH[4].LIMITH event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH4LIMITL + Write '1' to Disable interrupt for CH[4].LIMITL event + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH5LIMITH + Write '1' to Disable interrupt for CH[5].LIMITH event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH5LIMITL + Write '1' to Disable interrupt for CH[5].LIMITL event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH6LIMITH + Write '1' to Disable interrupt for CH[6].LIMITH event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH6LIMITL + Write '1' to Disable interrupt for CH[6].LIMITL event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH7LIMITH + Write '1' to Disable interrupt for CH[7].LIMITH event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CH7LIMITL + Write '1' to Disable interrupt for CH[7].LIMITL event + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + STATUS + Status + 0x400 + read-only + + + STATUS + Status + 0 + 0 + + + Ready + ADC is ready. No on-going conversion. + 0 + + + Busy + ADC is busy. Conversion in progress. + 1 + + + + + + + ENABLE + Enable or disable ADC + 0x500 + read-write + + + ENABLE + Enable or disable ADC + 0 + 0 + + + Disabled + Disable ADC + 0 + + + Enabled + Enable ADC + 1 + + + + + + + 8 + 16 + CH[%s] + Unspecified + 0x510 + + PSELP + Description cluster[0]: Input positive pin selection for CH[0] + 0x000 + read-write + 0x00000000 + + + PSELP + Analog positive input channel + 0 + 4 + + + NC + Not connected + 0 + + + AnalogInput0 + AIN0 + 1 + + + AnalogInput1 + AIN1 + 2 + + + AnalogInput2 + AIN2 + 3 + + + AnalogInput3 + AIN3 + 4 + + + AnalogInput4 + AIN4 + 5 + + + AnalogInput5 + AIN5 + 6 + + + AnalogInput6 + AIN6 + 7 + + + AnalogInput7 + AIN7 + 8 + + + VDD + VDD + 9 + + + + + + + PSELN + Description cluster[0]: Input negative pin selection for CH[0] + 0x004 + read-write + 0x00000000 + + + PSELN + Analog negative input, enables differential channel + 0 + 4 + + + NC + Not connected + 0 + + + AnalogInput0 + AIN0 + 1 + + + AnalogInput1 + AIN1 + 2 + + + AnalogInput2 + AIN2 + 3 + + + AnalogInput3 + AIN3 + 4 + + + AnalogInput4 + AIN4 + 5 + + + AnalogInput5 + AIN5 + 6 + + + AnalogInput6 + AIN6 + 7 + + + AnalogInput7 + AIN7 + 8 + + + VDD + VDD + 9 + + + + + + + CONFIG + Description cluster[0]: Input configuration for CH[0] + 0x008 + read-write + 0x00020000 + + + RESP + Positive channel resistor control + 0 + 1 + + + Bypass + Bypass resistor ladder + 0 + + + Pulldown + Pull-down to GND + 1 + + + Pullup + Pull-up to VDD + 2 + + + VDD1_2 + Set input at VDD/2 + 3 + + + + + RESN + Negative channel resistor control + 4 + 5 + + + Bypass + Bypass resistor ladder + 0 + + + Pulldown + Pull-down to GND + 1 + + + Pullup + Pull-up to VDD + 2 + + + VDD1_2 + Set input at VDD/2 + 3 + + + + + GAIN + Gain control + 8 + 10 + + + Gain1_6 + 1/6 + 0 + + + Gain1_5 + 1/5 + 1 + + + Gain1_4 + 1/4 + 2 + + + Gain1_3 + 1/3 + 3 + + + Gain1_2 + 1/2 + 4 + + + Gain1 + 1 + 5 + + + Gain2 + 2 + 6 + + + Gain4 + 4 + 7 + + + + + REFSEL + Reference control + 12 + 12 + + + Internal + Internal reference (0.6 V) + 0 + + + VDD1_4 + VDD/4 as reference + 1 + + + + + TACQ + Acquisition time, the time the ADC uses to sample the input voltage + 16 + 18 + + + 3us + 3 us + 0 + + + 5us + 5 us + 1 + + + 10us + 10 us + 2 + + + 15us + 15 us + 3 + + + 20us + 20 us + 4 + + + 40us + 40 us + 5 + + + + + MODE + Enable differential mode + 20 + 20 + + + SE + Single ended, PSELN will be ignored, negative input to ADC shorted to GND + 0 + + + Diff + Differential + 1 + + + + + BURST + Enable burst mode + 24 + 24 + + + Disabled + Burst mode is disabled (normal operation) + 0 + + + Enabled + Burst mode is enabled. SAADC takes 2^OVERSAMPLE number of samples as fast as it can, and sends the average to Data RAM. + 1 + + + + + + + LIMIT + Description cluster[0]: High/low limits for event monitoring a channel + 0x00C + read-write + 0x7FFF8000 + + + LOW + Low level limit + 0 + 15 + + + HIGH + High level limit + 16 + 31 + + + + + + RESOLUTION + Resolution configuration + 0x5F0 + read-write + 0x00000001 + + + VAL + Set the resolution + 0 + 2 + + + 8bit + 8 bit + 0 + + + 10bit + 10 bit + 1 + + + 12bit + 12 bit + 2 + + + 14bit + 14 bit + 3 + + + + + + + OVERSAMPLE + Oversampling configuration. OVERSAMPLE should not be combined with SCAN. The RESOLUTION is applied before averaging, thus for high OVERSAMPLE a higher RESOLUTION should be used. + 0x5F4 + read-write + + + OVERSAMPLE + Oversample control + 0 + 3 + + + Bypass + Bypass oversampling + 0 + + + Over2x + Oversample 2x + 1 + + + Over4x + Oversample 4x + 2 + + + Over8x + Oversample 8x + 3 + + + Over16x + Oversample 16x + 4 + + + Over32x + Oversample 32x + 5 + + + Over64x + Oversample 64x + 6 + + + Over128x + Oversample 128x + 7 + + + Over256x + Oversample 256x + 8 + + + + + + + SAMPLERATE + Controls normal or continuous sample rate + 0x5F8 + read-write + + + CC + Capture and compare value. Sample rate is 16 MHz/CC + 0 + 10 + + + MODE + Select mode for sample rate control + 12 + 12 + + + Task + Rate is controlled from SAMPLE task + 0 + + + Timers + Rate is controlled from local timer (use CC to control the rate) + 1 + + + + + + + RESULT + RESULT EasyDMA channel + 0x62C + + PTR + Data pointer + 0x000 + read-write + + + PTR + Data pointer + 0 + 31 + + + + + MAXCNT + Maximum number of buffer words to transfer + 0x004 + read-write + + + MAXCNT + Maximum number of buffer words to transfer + 0 + 14 + + + + + AMOUNT + Number of buffer words transferred since last START + 0x008 + read-only + + + AMOUNT + Number of buffer words transferred since last START. This register can be read after an END or STOPPED event. + 0 + 14 + + + + + + + + TIMER0 + Timer/Counter 0 + TIMER + 0x40008000 + 32 + TIMER + + 0 + 0x1000 + registers + + + TIMER0 + 8 + + + + TASKS_START + Start Timer + 0x000 + write-only + + + TASKS_STOP + Stop Timer + 0x004 + write-only + + + TASKS_COUNT + Increment Timer (Counter mode only) + 0x008 + write-only + + + TASKS_CLEAR + Clear time + 0x00C + write-only + + + TASKS_SHUTDOWN + Deprecated register - Shut down timer + 0x010 + write-only + + + 6 + 4 + TASKS_CAPTURE[%s] + Description collection[0]: Capture Timer value to CC[0] register + 0x040 + write-only + + + 6 + 4 + EVENTS_COMPARE[%s] + Description collection[0]: Compare event on CC[0] match + 0x140 + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + COMPARE0_CLEAR + Shortcut between COMPARE[0] event and CLEAR task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE1_CLEAR + Shortcut between COMPARE[1] event and CLEAR task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE2_CLEAR + Shortcut between COMPARE[2] event and CLEAR task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE3_CLEAR + Shortcut between COMPARE[3] event and CLEAR task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE4_CLEAR + Shortcut between COMPARE[4] event and CLEAR task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE5_CLEAR + Shortcut between COMPARE[5] event and CLEAR task + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE0_STOP + Shortcut between COMPARE[0] event and STOP task + 8 + 8 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE1_STOP + Shortcut between COMPARE[1] event and STOP task + 9 + 9 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE2_STOP + Shortcut between COMPARE[2] event and STOP task + 10 + 10 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE3_STOP + Shortcut between COMPARE[3] event and STOP task + 11 + 11 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE4_STOP + Shortcut between COMPARE[4] event and STOP task + 12 + 12 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + COMPARE5_STOP + Shortcut between COMPARE[5] event and STOP task + 13 + 13 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + COMPARE0 + Write '1' to Enable interrupt for COMPARE[0] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE1 + Write '1' to Enable interrupt for COMPARE[1] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE2 + Write '1' to Enable interrupt for COMPARE[2] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE3 + Write '1' to Enable interrupt for COMPARE[3] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE4 + Write '1' to Enable interrupt for COMPARE[4] event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE5 + Write '1' to Enable interrupt for COMPARE[5] event + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + COMPARE0 + Write '1' to Disable interrupt for COMPARE[0] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE1 + Write '1' to Disable interrupt for COMPARE[1] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE2 + Write '1' to Disable interrupt for COMPARE[2] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE3 + Write '1' to Disable interrupt for COMPARE[3] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE4 + Write '1' to Disable interrupt for COMPARE[4] event + 20 + 20 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE5 + Write '1' to Disable interrupt for COMPARE[5] event + 21 + 21 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + MODE + Timer mode selection + 0x504 + read-write + + + MODE + Timer mode + 0 + 1 + + + Timer + Select Timer mode + 0 + + + Counter + Deprecated enumerator - Select Counter mode + 1 + + + LowPowerCounter + Select Low Power Counter mode + 2 + + + + + + + BITMODE + Configure the number of bits used by the TIMER + 0x508 + read-write + + + BITMODE + Timer bit width + 0 + 1 + + + 16Bit + 16 bit timer bit width + 0 + + + 08Bit + 8 bit timer bit width + 1 + + + 24Bit + 24 bit timer bit width + 2 + + + 32Bit + 32 bit timer bit width + 3 + + + + + + + PRESCALER + Timer prescaler register + 0x510 + read-write + 0x00000004 + + + PRESCALER + Prescaler value + 0 + 3 + + + + + 6 + 4 + CC[%s] + Description collection[0]: Capture/Compare register 0 + 0x540 + read-write + + + CC + Capture/Compare value + 0 + 31 + + + + + + + TIMER1 + Timer/Counter 1 + 0x40009000 + + TIMER1 + 9 + + + + TIMER2 + Timer/Counter 2 + 0x4000A000 + + TIMER2 + 10 + + + + RTC0 + Real time counter 0 + RTC + 0x4000B000 + 32 + RTC + + 0 + 0x1000 + registers + + + RTC0 + 11 + + + + TASKS_START + Start RTC COUNTER + 0x000 + write-only + + + TASKS_STOP + Stop RTC COUNTER + 0x004 + write-only + + + TASKS_CLEAR + Clear RTC COUNTER + 0x008 + write-only + + + TASKS_TRIGOVRFLW + Set COUNTER to 0xFFFFF0 + 0x00C + write-only + + + EVENTS_TICK + Event on COUNTER increment + 0x100 + read-write + + + EVENTS_OVRFLW + Event on COUNTER overflow + 0x104 + read-write + + + 4 + 4 + EVENTS_COMPARE[%s] + Description collection[0]: Compare event on CC[0] match + 0x140 + read-write + + + INTENSET + Enable interrupt + 0x304 + read-write + + + TICK + Write '1' to Enable interrupt for TICK event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + OVRFLW + Write '1' to Enable interrupt for OVRFLW event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE0 + Write '1' to Enable interrupt for COMPARE[0] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE1 + Write '1' to Enable interrupt for COMPARE[1] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE2 + Write '1' to Enable interrupt for COMPARE[2] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE3 + Write '1' to Enable interrupt for COMPARE[3] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + TICK + Write '1' to Disable interrupt for TICK event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + OVRFLW + Write '1' to Disable interrupt for OVRFLW event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE0 + Write '1' to Disable interrupt for COMPARE[0] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE1 + Write '1' to Disable interrupt for COMPARE[1] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE2 + Write '1' to Disable interrupt for COMPARE[2] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE3 + Write '1' to Disable interrupt for COMPARE[3] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + EVTEN + Enable or disable event routing + 0x340 + read-write + + + TICK + Enable or disable event routing for TICK event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + OVRFLW + Enable or disable event routing for OVRFLW event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + COMPARE0 + Enable or disable event routing for COMPARE[0] event + 16 + 16 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + COMPARE1 + Enable or disable event routing for COMPARE[1] event + 17 + 17 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + COMPARE2 + Enable or disable event routing for COMPARE[2] event + 18 + 18 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + COMPARE3 + Enable or disable event routing for COMPARE[3] event + 19 + 19 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + EVTENSET + Enable event routing + 0x344 + read-write + + + TICK + Write '1' to Enable event routing for TICK event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + OVRFLW + Write '1' to Enable event routing for OVRFLW event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE0 + Write '1' to Enable event routing for COMPARE[0] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE1 + Write '1' to Enable event routing for COMPARE[1] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE2 + Write '1' to Enable event routing for COMPARE[2] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + COMPARE3 + Write '1' to Enable event routing for COMPARE[3] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + EVTENCLR + Disable event routing + 0x348 + read-write + + + TICK + Write '1' to Disable event routing for TICK event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + OVRFLW + Write '1' to Disable event routing for OVRFLW event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE0 + Write '1' to Disable event routing for COMPARE[0] event + 16 + 16 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE1 + Write '1' to Disable event routing for COMPARE[1] event + 17 + 17 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE2 + Write '1' to Disable event routing for COMPARE[2] event + 18 + 18 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + COMPARE3 + Write '1' to Disable event routing for COMPARE[3] event + 19 + 19 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + COUNTER + Current COUNTER value + 0x504 + read-only + + + COUNTER + Counter value + 0 + 23 + + + + + PRESCALER + 12 bit prescaler for COUNTER frequency (32768/(PRESCALER+1)).Must be written when RTC is stopped + 0x508 + read-write + + + PRESCALER + Prescaler value + 0 + 11 + + + + + 4 + 4 + CC[%s] + Description collection[0]: Compare register 0 + 0x540 + read-write + + + COMPARE + Compare value + 0 + 23 + + + + + + + TEMP + Temperature Sensor + TEMP + 0x4000C000 + 32 + + 0 + 0x1000 + registers + + + TEMP + 12 + + + + TASKS_START + Start temperature measurement + 0x000 + write-only + + + TASKS_STOP + Stop temperature measurement + 0x004 + write-only + + + EVENTS_DATARDY + Temperature measurement complete, data ready + 0x100 + read-write + + + INTENSET + Enable interrupt + 0x304 + read-write + + + DATARDY + Write '1' to Enable interrupt for DATARDY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + DATARDY + Write '1' to Disable interrupt for DATARDY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + TEMP + Temperature in degC (0.25deg steps) + 0x508 + read-only + int32_t + + + TEMP + Temperature in degC (0.25deg steps) + 0 + 31 + + + + + A0 + Slope of 1st piece wise linear function + 0x520 + read-write + 0x00000320 + + + A0 + Slope of 1st piece wise linear function + 0 + 11 + + + + + A1 + Slope of 2nd piece wise linear function + 0x524 + read-write + 0x00000343 + + + A1 + Slope of 2nd piece wise linear function + 0 + 11 + + + + + A2 + Slope of 3rd piece wise linear function + 0x528 + read-write + 0x0000035D + + + A2 + Slope of 3rd piece wise linear function + 0 + 11 + + + + + A3 + Slope of 4th piece wise linear function + 0x52C + read-write + 0x00000400 + + + A3 + Slope of 4th piece wise linear function + 0 + 11 + + + + + A4 + Slope of 5th piece wise linear function + 0x530 + read-write + 0x0000047F + + + A4 + Slope of 5th piece wise linear function + 0 + 11 + + + + + A5 + Slope of 6th piece wise linear function + 0x534 + read-write + 0x0000037B + + + A5 + Slope of 6th piece wise linear function + 0 + 11 + + + + + B0 + y-intercept of 1st piece wise linear function + 0x540 + read-write + 0x00003FCC + + + B0 + y-intercept of 1st piece wise linear function + 0 + 13 + + + + + B1 + y-intercept of 2nd piece wise linear function + 0x544 + read-write + 0x00003F98 + + + B1 + y-intercept of 2nd piece wise linear function + 0 + 13 + + + + + B2 + y-intercept of 3rd piece wise linear function + 0x548 + read-write + 0x00003F98 + + + B2 + y-intercept of 3rd piece wise linear function + 0 + 13 + + + + + B3 + y-intercept of 4th piece wise linear function + 0x54C + read-write + 0x00000012 + + + B3 + y-intercept of 4th piece wise linear function + 0 + 13 + + + + + B4 + y-intercept of 5th piece wise linear function + 0x550 + read-write + 0x0000006A + + + B4 + y-intercept of 5th piece wise linear function + 0 + 13 + + + + + B5 + y-intercept of 6th piece wise linear function + 0x554 + read-write + 0x00003DD0 + + + B5 + y-intercept of 6th piece wise linear function + 0 + 13 + + + + + T0 + End point of 1st piece wise linear function + 0x560 + read-write + 0x000000E2 + + + T0 + End point of 1st piece wise linear function + 0 + 7 + + + + + T1 + End point of 2nd piece wise linear function + 0x564 + read-write + 0x00000000 + + + T1 + End point of 2nd piece wise linear function + 0 + 7 + + + + + T2 + End point of 3rd piece wise linear function + 0x568 + read-write + 0x00000014 + + + T2 + End point of 3rd piece wise linear function + 0 + 7 + + + + + T3 + End point of 4th piece wise linear function + 0x56C + read-write + 0x00000019 + + + T3 + End point of 4th piece wise linear function + 0 + 7 + + + + + T4 + End point of 5th piece wise linear function + 0x570 + read-write + 0x00000050 + + + T4 + End point of 5th piece wise linear function + 0 + 7 + + + + + + + RNG + Random Number Generator + RNG + 0x4000D000 + 32 + + 0 + 0x1000 + registers + + + RNG + 13 + + + + TASKS_START + Task starting the random number generator + 0x000 + write-only + + + TASKS_STOP + Task stopping the random number generator + 0x004 + write-only + + + EVENTS_VALRDY + Event being generated for every new random number written to the VALUE register + 0x100 + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + VALRDY_STOP + Shortcut between VALRDY event and STOP task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + VALRDY + Write '1' to Enable interrupt for VALRDY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + VALRDY + Write '1' to Disable interrupt for VALRDY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + CONFIG + Configuration register + 0x504 + read-write + + + DERCEN + Bias correction + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enabled + 1 + + + + + + + VALUE + Output random number + 0x508 + read-only + + + VALUE + Generated random number + 0 + 7 + + + + + + + ECB + AES ECB Mode Encryption + ECB + 0x4000E000 + 32 + + 0 + 0x1000 + registers + + + ECB + 14 + + + + TASKS_STARTECB + Start ECB block encrypt + 0x000 + write-only + + + TASKS_STOPECB + Abort a possible executing ECB operation + 0x004 + write-only + + + EVENTS_ENDECB + ECB block encrypt complete + 0x100 + read-write + + + EVENTS_ERRORECB + ECB block encrypt aborted because of a STOPECB task or due to an error + 0x104 + read-write + + + INTENSET + Enable interrupt + 0x304 + read-write + + + ENDECB + Write '1' to Enable interrupt for ENDECB event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERRORECB + Write '1' to Enable interrupt for ERRORECB event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + ENDECB + Write '1' to Disable interrupt for ENDECB event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERRORECB + Write '1' to Disable interrupt for ERRORECB event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ECBDATAPTR + ECB block encrypt memory pointers + 0x504 + read-write + + + ECBDATAPTR + Pointer to the ECB data structure (see Table 1 ECB data structure overview) + 0 + 31 + + + + + + + CCM + AES CCM Mode Encryption + CCM + 0x4000F000 + 32 + + 0 + 0x1000 + registers + + + CCM_AAR + 15 + + + + TASKS_KSGEN + Start generation of key-stream. This operation will stop by itself when completed. + 0x000 + write-only + + + TASKS_CRYPT + Start encryption/decryption. This operation will stop by itself when completed. + 0x004 + write-only + + + TASKS_STOP + Stop encryption/decryption + 0x008 + write-only + + + EVENTS_ENDKSGEN + Key-stream generation complete + 0x100 + read-write + + + EVENTS_ENDCRYPT + Encrypt/decrypt complete + 0x104 + read-write + + + EVENTS_ERROR + CCM error event + 0x108 + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + ENDKSGEN_CRYPT + Shortcut between ENDKSGEN event and CRYPT task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + ENDKSGEN + Write '1' to Enable interrupt for ENDKSGEN event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ENDCRYPT + Write '1' to Enable interrupt for ENDCRYPT event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ERROR + Write '1' to Enable interrupt for ERROR event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + ENDKSGEN + Write '1' to Disable interrupt for ENDKSGEN event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ENDCRYPT + Write '1' to Disable interrupt for ENDCRYPT event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ERROR + Write '1' to Disable interrupt for ERROR event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + MICSTATUS + MIC check result + 0x400 + read-only + + + MICSTATUS + The result of the MIC check performed during the previous decryption operation + 0 + 0 + + + CheckFailed + MIC check failed + 0 + + + CheckPassed + MIC check passed + 1 + + + + + + + ENABLE + Enable + 0x500 + read-write + + + ENABLE + Enable or disable CCM + 0 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 2 + + + + + + + MODE + Operation mode + 0x504 + read-write + 0x00000001 + + + MODE + The mode of operation to be used + 0 + 0 + + + Encryption + AES CCM packet encryption mode + 0 + + + Decryption + AES CCM packet decryption mode + 1 + + + + + DATARATE + Data rate that the CCM shall run in synch with + 16 + 16 + + + 1Mbit + In synch with 1 Mbit data rate + 0 + + + 2Mbit + In synch with 2 Mbit data rate + 1 + + + + + LENGTH + Packet length configuration + 24 + 24 + + + Default + Default length. Effective length of LENGTH field is 5-bit + 0 + + + Extended + Extended length. Effective length of LENGTH field is 8-bit + 1 + + + + + + + CNFPTR + Pointer to data structure holding AES key and NONCE vector + 0x508 + read-write + + + CNFPTR + Pointer to the data structure holding the AES key and the CCM NONCE vector (see Table 1 CCM data structure overview) + 0 + 31 + + + + + INPTR + Input pointer + 0x50C + read-write + + + INPTR + Input pointer + 0 + 31 + + + + + OUTPTR + Output pointer + 0x510 + read-write + + + OUTPTR + Output pointer + 0 + 31 + + + + + SCRATCHPTR + Pointer to data area used for temporary storage + 0x514 + read-write + + + SCRATCHPTR + Pointer to a scratch data area used for temporary storage during key-stream generation, MIC generation and encryption/decryption. + 0 + 31 + + + + + + + AAR + Accelerated Address Resolver + AAR + 0x4000F000 + 32 + CCM + + 0 + 0x1000 + registers + + + CCM_AAR + 15 + + + + TASKS_START + Start resolving addresses based on IRKs specified in the IRK data structure + 0x000 + write-only + + + TASKS_STOP + Stop resolving addresses + 0x008 + write-only + + + EVENTS_END + Address resolution procedure complete + 0x100 + read-write + + + EVENTS_RESOLVED + Address resolved + 0x104 + read-write + + + EVENTS_NOTRESOLVED + Address not resolved + 0x108 + read-write + + + INTENSET + Enable interrupt + 0x304 + read-write + + + END + Write '1' to Enable interrupt for END event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + RESOLVED + Write '1' to Enable interrupt for RESOLVED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + NOTRESOLVED + Write '1' to Enable interrupt for NOTRESOLVED event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + END + Write '1' to Disable interrupt for END event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + RESOLVED + Write '1' to Disable interrupt for RESOLVED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + NOTRESOLVED + Write '1' to Disable interrupt for NOTRESOLVED event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + STATUS + Resolution status + 0x400 + read-only + + + STATUS + The IRK that was used last time an address was resolved + 0 + 3 + + + + + ENABLE + Enable AAR + 0x500 + read-write + + + ENABLE + Enable or disable AAR + 0 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 3 + + + + + + + NIRK + Number of IRKs + 0x504 + read-write + 0x00000001 + + + NIRK + Number of Identity root keys available in the IRK data structure + 0 + 4 + + + + + IRKPTR + Pointer to IRK data structure + 0x508 + read-write + + + IRKPTR + Pointer to the IRK data structure + 0 + 31 + + + + + ADDRPTR + Pointer to the resolvable address + 0x510 + read-write + + + ADDRPTR + Pointer to the resolvable address (6-bytes) + 0 + 31 + + + + + SCRATCHPTR + Pointer to data area used for temporary storage + 0x514 + read-write + + + SCRATCHPTR + Pointer to a scratch data area used for temporary storage during resolution.A space of minimum 3 bytes must be reserved. + 0 + 31 + + + + + + + WDT + Watchdog Timer + WDT + 0x40010000 + 32 + + 0 + 0x1000 + registers + + + WDT + 16 + + + + TASKS_START + Start the watchdog + 0x000 + write-only + + + EVENTS_TIMEOUT + Watchdog timeout + 0x100 + read-write + + + INTENSET + Enable interrupt + 0x304 + read-write + + + TIMEOUT + Write '1' to Enable interrupt for TIMEOUT event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + TIMEOUT + Write '1' to Disable interrupt for TIMEOUT event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + RUNSTATUS + Run status + 0x400 + read-only + + + RUNSTATUS + Indicates whether or not the watchdog is running + 0 + 0 + + + NotRunning + Watchdog not running + 0 + + + Running + Watchdog is running + 1 + + + + + + + REQSTATUS + Request status + 0x404 + read-only + 0x00000001 + + + RR0 + Request status for RR[0] register + 0 + 0 + + + DisabledOrRequested + RR[0] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[0] register is enabled, and are not yet requesting reload + 1 + + + + + RR1 + Request status for RR[1] register + 1 + 1 + + + DisabledOrRequested + RR[1] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[1] register is enabled, and are not yet requesting reload + 1 + + + + + RR2 + Request status for RR[2] register + 2 + 2 + + + DisabledOrRequested + RR[2] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[2] register is enabled, and are not yet requesting reload + 1 + + + + + RR3 + Request status for RR[3] register + 3 + 3 + + + DisabledOrRequested + RR[3] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[3] register is enabled, and are not yet requesting reload + 1 + + + + + RR4 + Request status for RR[4] register + 4 + 4 + + + DisabledOrRequested + RR[4] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[4] register is enabled, and are not yet requesting reload + 1 + + + + + RR5 + Request status for RR[5] register + 5 + 5 + + + DisabledOrRequested + RR[5] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[5] register is enabled, and are not yet requesting reload + 1 + + + + + RR6 + Request status for RR[6] register + 6 + 6 + + + DisabledOrRequested + RR[6] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[6] register is enabled, and are not yet requesting reload + 1 + + + + + RR7 + Request status for RR[7] register + 7 + 7 + + + DisabledOrRequested + RR[7] register is not enabled, or are already requesting reload + 0 + + + EnabledAndUnrequested + RR[7] register is enabled, and are not yet requesting reload + 1 + + + + + + + CRV + Counter reload value + 0x504 + read-write + 0xFFFFFFFF + + + CRV + Counter reload value in number of cycles of the 32.768 kHz clock + 0 + 31 + + + + + RREN + Enable register for reload request registers + 0x508 + read-write + 0x00000001 + + + RR0 + Enable or disable RR[0] register + 0 + 0 + + + Disabled + Disable RR[0] register + 0 + + + Enabled + Enable RR[0] register + 1 + + + + + RR1 + Enable or disable RR[1] register + 1 + 1 + + + Disabled + Disable RR[1] register + 0 + + + Enabled + Enable RR[1] register + 1 + + + + + RR2 + Enable or disable RR[2] register + 2 + 2 + + + Disabled + Disable RR[2] register + 0 + + + Enabled + Enable RR[2] register + 1 + + + + + RR3 + Enable or disable RR[3] register + 3 + 3 + + + Disabled + Disable RR[3] register + 0 + + + Enabled + Enable RR[3] register + 1 + + + + + RR4 + Enable or disable RR[4] register + 4 + 4 + + + Disabled + Disable RR[4] register + 0 + + + Enabled + Enable RR[4] register + 1 + + + + + RR5 + Enable or disable RR[5] register + 5 + 5 + + + Disabled + Disable RR[5] register + 0 + + + Enabled + Enable RR[5] register + 1 + + + + + RR6 + Enable or disable RR[6] register + 6 + 6 + + + Disabled + Disable RR[6] register + 0 + + + Enabled + Enable RR[6] register + 1 + + + + + RR7 + Enable or disable RR[7] register + 7 + 7 + + + Disabled + Disable RR[7] register + 0 + + + Enabled + Enable RR[7] register + 1 + + + + + + + CONFIG + Configuration register + 0x50C + read-write + 0x00000001 + + + SLEEP + Configure the watchdog to either be paused, or kept running, while the CPU is sleeping + 0 + 0 + + + Pause + Pause watchdog while the CPU is sleeping + 0 + + + Run + Keep the watchdog running while the CPU is sleeping + 1 + + + + + HALT + Configure the watchdog to either be paused, or kept running, while the CPU is halted by the debugger + 3 + 3 + + + Pause + Pause watchdog while the CPU is halted by the debugger + 0 + + + Run + Keep the watchdog running while the CPU is halted by the debugger + 1 + + + + + + + 8 + 4 + RR[%s] + Description collection[0]: Reload request 0 + 0x600 + write-only + + + RR + Reload request register + 0 + 31 + + + Reload + Value to request a reload of the watchdog timer + 0x6E524635 + + + + + + + + + RTC1 + Real time counter 1 + 0x40011000 + + RTC1 + 17 + + + + QDEC + Quadrature Decoder + QDEC + 0x40012000 + 32 + + 0 + 0x1000 + registers + + + QDEC + 18 + + + + TASKS_START + Task starting the quadrature decoder + 0x000 + write-only + + + TASKS_STOP + Task stopping the quadrature decoder + 0x004 + write-only + + + TASKS_READCLRACC + Read and clear ACC and ACCDBL + 0x008 + write-only + + + TASKS_RDCLRACC + Read and clear ACC + 0x00C + write-only + + + TASKS_RDCLRDBL + Read and clear ACCDBL + 0x010 + write-only + + + EVENTS_SAMPLERDY + Event being generated for every new sample value written to the SAMPLE register + 0x100 + read-write + + + EVENTS_REPORTRDY + Non-null report ready + 0x104 + read-write + + + EVENTS_ACCOF + ACC or ACCDBL register overflow + 0x108 + read-write + + + EVENTS_DBLRDY + Double displacement(s) detected + 0x10C + read-write + + + EVENTS_STOPPED + QDEC has been stopped + 0x110 + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + REPORTRDY_READCLRACC + Shortcut between REPORTRDY event and READCLRACC task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + SAMPLERDY_STOP + Shortcut between SAMPLERDY event and STOP task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + REPORTRDY_RDCLRACC + Shortcut between REPORTRDY event and RDCLRACC task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + REPORTRDY_STOP + Shortcut between REPORTRDY event and STOP task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DBLRDY_RDCLRDBL + Shortcut between DBLRDY event and RDCLRDBL task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DBLRDY_STOP + Shortcut between DBLRDY event and STOP task + 5 + 5 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + SAMPLERDY_READCLRACC + Shortcut between SAMPLERDY event and READCLRACC task + 6 + 6 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + SAMPLERDY + Write '1' to Enable interrupt for SAMPLERDY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REPORTRDY + Write '1' to Enable interrupt for REPORTRDY event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + ACCOF + Write '1' to Enable interrupt for ACCOF event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DBLRDY + Write '1' to Enable interrupt for DBLRDY event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STOPPED + Write '1' to Enable interrupt for STOPPED event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + SAMPLERDY + Write '1' to Disable interrupt for SAMPLERDY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REPORTRDY + Write '1' to Disable interrupt for REPORTRDY event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + ACCOF + Write '1' to Disable interrupt for ACCOF event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DBLRDY + Write '1' to Disable interrupt for DBLRDY event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STOPPED + Write '1' to Disable interrupt for STOPPED event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + Enable the quadrature decoder + 0x500 + read-write + + + ENABLE + Enable or disable the quadrature decoder + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + LEDPOL + LED output pin polarity + 0x504 + read-write + + + LEDPOL + LED output pin polarity + 0 + 0 + + + ActiveLow + Led active on output pin low + 0 + + + ActiveHigh + Led active on output pin high + 1 + + + + + + + SAMPLEPER + Sample period + 0x508 + read-write + + + SAMPLEPER + Sample period. The SAMPLE register will be updated for every new sample + 0 + 3 + + + 128us + 128 us + 0 + + + 256us + 256 us + 1 + + + 512us + 512 us + 2 + + + 1024us + 1024 us + 3 + + + 2048us + 2048 us + 4 + + + 4096us + 4096 us + 5 + + + 8192us + 8192 us + 6 + + + 16384us + 16384 us + 7 + + + 32ms + 32768 us + 8 + + + 65ms + 65536 us + 9 + + + 131ms + 131072 us + 10 + + + + + + + SAMPLE + Motion sample value + 0x50C + read-only + int32_t + + + SAMPLE + Last motion sample + 0 + 31 + + + + + REPORTPER + Number of samples to be taken before REPORTRDY and DBLRDY events can be generated + 0x510 + read-write + + + REPORTPER + Specifies the number of samples to be accumulated in the ACC register before the REPORTRDY and DBLRDY events can be generated + 0 + 3 + + + 10Smpl + 10 samples / report + 0 + + + 40Smpl + 40 samples / report + 1 + + + 80Smpl + 80 samples / report + 2 + + + 120Smpl + 120 samples / report + 3 + + + 160Smpl + 160 samples / report + 4 + + + 200Smpl + 200 samples / report + 5 + + + 240Smpl + 240 samples / report + 6 + + + 280Smpl + 280 samples / report + 7 + + + 1Smpl + 1 sample / report + 8 + + + + + + + ACC + Register accumulating the valid transitions + 0x514 + read-only + int32_t + + + ACC + Register accumulating all valid samples (not double transition) read from the SAMPLE register + 0 + 31 + + + + + ACCREAD + Snapshot of the ACC register, updated by the READCLRACC or RDCLRACC task + 0x518 + read-only + int32_t + + + ACCREAD + Snapshot of the ACC register. + 0 + 31 + + + + + PSEL + Unspecified + 0x51C + + LED + Pin select for LED signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + A + Pin select for A signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + B + Pin select for B signal + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + DBFEN + Enable input debounce filters + 0x528 + read-write + + + DBFEN + Enable input debounce filters + 0 + 0 + + + Disabled + Debounce input filters disabled + 0 + + + Enabled + Debounce input filters enabled + 1 + + + + + + + LEDPRE + Time period the LED is switched ON prior to sampling + 0x540 + read-write + 0x00000010 + + + LEDPRE + Period in us the LED is switched on prior to sampling + 0 + 8 + + + + + ACCDBL + Register accumulating the number of detected double transitions + 0x544 + read-only + + + ACCDBL + Register accumulating the number of detected double or illegal transitions. ( SAMPLE = 2 ). + 0 + 3 + + + + + ACCDBLREAD + Snapshot of the ACCDBL, updated by the READCLRACC or RDCLRDBL task + 0x548 + read-only + + + ACCDBLREAD + Snapshot of the ACCDBL register. This field is updated when the READCLRACC or RDCLRDBL task is triggered. + 0 + 3 + + + + + + + COMP + Comparator + COMP + 0x40013000 + 32 + + 0 + 0x1000 + registers + + + COMP_LPCOMP + 19 + + + + TASKS_START + Start comparator + 0x000 + write-only + + + TASKS_STOP + Stop comparator + 0x004 + write-only + + + TASKS_SAMPLE + Sample comparator value + 0x008 + write-only + + + EVENTS_READY + COMP is ready and output is valid + 0x100 + read-write + + + EVENTS_DOWN + Downward crossing + 0x104 + read-write + + + EVENTS_UP + Upward crossing + 0x108 + read-write + + + EVENTS_CROSS + Downward or upward crossing + 0x10C + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + READY_SAMPLE + Shortcut between READY event and SAMPLE task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + READY_STOP + Shortcut between READY event and STOP task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DOWN_STOP + Shortcut between DOWN event and STOP task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + UP_STOP + Shortcut between UP event and STOP task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + CROSS_STOP + Shortcut between CROSS event and STOP task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + READY + Enable or disable interrupt for READY event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + DOWN + Enable or disable interrupt for DOWN event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + UP + Enable or disable interrupt for UP event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + CROSS + Enable or disable interrupt for CROSS event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to Enable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DOWN + Write '1' to Enable interrupt for DOWN event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + UP + Write '1' to Enable interrupt for UP event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CROSS + Write '1' to Enable interrupt for CROSS event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to Disable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DOWN + Write '1' to Disable interrupt for DOWN event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + UP + Write '1' to Disable interrupt for UP event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CROSS + Write '1' to Disable interrupt for CROSS event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + RESULT + Compare result + 0x400 + read-only + + + RESULT + Result of last compare. Decision point SAMPLE task. + 0 + 0 + + + Below + Input voltage is below the threshold (VIN+ &lt; VIN-) + 0 + + + Above + Input voltage is above the threshold (VIN+ &gt; VIN-) + 1 + + + + + + + ENABLE + COMP enable + 0x500 + read-write + + + ENABLE + Enable or disable COMP + 0 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 2 + + + + + + + PSEL + Pin select + 0x504 + read-write + + + PSEL + Analog pin select + 0 + 2 + + + AnalogInput0 + AIN0 selected as analog input + 0 + + + AnalogInput1 + AIN1 selected as analog input + 1 + + + AnalogInput2 + AIN2 selected as analog input + 2 + + + AnalogInput3 + AIN3 selected as analog input + 3 + + + AnalogInput4 + AIN4 selected as analog input + 4 + + + AnalogInput5 + AIN5 selected as analog input + 5 + + + AnalogInput6 + AIN6 selected as analog input + 6 + + + AnalogInput7 + AIN7 selected as analog input + 7 + + + + + + + REFSEL + Reference source select for single-ended mode + 0x508 + read-write + 0x00000004 + + + REFSEL + Reference select + 0 + 2 + + + Int1V2 + VREF = internal 1.2 V reference (VDD &gt;= 1.7 V) + 0 + + + Int1V8 + VREF = internal 1.8 V reference (VDD &gt;= VREF + 0.2 V) + 1 + + + Int2V4 + VREF = internal 2.4 V reference (VDD &gt;= VREF + 0.2 V) + 2 + + + VDD + VREF = VDD + 4 + + + ARef + VREF = AREF (VDD &gt;= VREF &gt;= AREFMIN) + 7 + + + + + + + EXTREFSEL + External reference select + 0x50C + read-write + + + EXTREFSEL + External analog reference select + 0 + 2 + + + AnalogReference0 + Use AIN0 as external analog reference + 0 + + + AnalogReference1 + Use AIN1 as external analog reference + 1 + + + AnalogReference2 + Use AIN2 as external analog reference + 2 + + + AnalogReference3 + Use AIN3 as external analog reference + 3 + + + AnalogReference4 + Use AIN4 as external analog reference + 4 + + + AnalogReference5 + Use AIN5 as external analog reference + 5 + + + AnalogReference6 + Use AIN6 as external analog reference + 6 + + + AnalogReference7 + Use AIN7 as external analog reference + 7 + + + + + + + TH + Threshold configuration for hysteresis unit + 0x530 + read-write + 0x00000000 + + + THDOWN + VDOWN = (THDOWN+1)/64*VREF + 0 + 5 + + + THUP + VUP = (THUP+1)/64*VREF + 8 + 13 + + + + + MODE + Mode configuration + 0x534 + read-write + + + SP + Speed and power modes + 0 + 1 + + + Low + Low-power mode + 0 + + + Normal + Normal mode + 1 + + + High + High-speed mode + 2 + + + + + MAIN + Main operation modes + 8 + 8 + + + SE + Single-ended mode + 0 + + + Diff + Differential mode + 1 + + + + + + + HYST + Comparator hysteresis enable + 0x538 + read-write + + + HYST + Comparator hysteresis + 0 + 0 + + + NoHyst + Comparator hysteresis disabled + 0 + + + Hyst50mV + Comparator hysteresis enabled + 1 + + + + + + + ISOURCE + Current source select on analog input + 0x53C + read-write + + + ISOURCE + Comparator hysteresis + 0 + 1 + + + Off + Current source disabled + 0 + + + Ien2mA5 + Current source enabled (+/- 2.5 uA) + 1 + + + Ien5mA + Current source enabled (+/- 5 uA) + 2 + + + Ien10mA + Current source enabled (+/- 10 uA) + 3 + + + + + + + + + LPCOMP + Low Power Comparator + LPCOMP + 0x40013000 + 32 + COMP + + 0 + 0x1000 + registers + + + COMP_LPCOMP + 19 + + + + TASKS_START + Start comparator + 0x000 + write-only + + + TASKS_STOP + Stop comparator + 0x004 + write-only + + + TASKS_SAMPLE + Sample comparator value + 0x008 + write-only + + + EVENTS_READY + LPCOMP is ready and output is valid + 0x100 + read-write + + + EVENTS_DOWN + Downward crossing + 0x104 + read-write + + + EVENTS_UP + Upward crossing + 0x108 + read-write + + + EVENTS_CROSS + Downward or upward crossing + 0x10C + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + READY_SAMPLE + Shortcut between READY event and SAMPLE task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + READY_STOP + Shortcut between READY event and STOP task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + DOWN_STOP + Shortcut between DOWN event and STOP task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + UP_STOP + Shortcut between UP event and STOP task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + CROSS_STOP + Shortcut between CROSS event and STOP task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + READY + Write '1' to Enable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + DOWN + Write '1' to Enable interrupt for DOWN event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + UP + Write '1' to Enable interrupt for UP event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + CROSS + Write '1' to Enable interrupt for CROSS event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + READY + Write '1' to Disable interrupt for READY event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + DOWN + Write '1' to Disable interrupt for DOWN event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + UP + Write '1' to Disable interrupt for UP event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + CROSS + Write '1' to Disable interrupt for CROSS event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + RESULT + Compare result + 0x400 + read-only + + + RESULT + Result of last compare. Decision point SAMPLE task. + 0 + 0 + + + Below + Input voltage is below the reference threshold (VIN+ &lt; VIN-). + 0 + + + Above + Input voltage is above the reference threshold (VIN+ &gt; VIN-). + 1 + + + + + + + ENABLE + Enable LPCOMP + 0x500 + read-write + + + ENABLE + Enable or disable LPCOMP + 0 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + PSEL + Input pin select + 0x504 + read-write + + + PSEL + Analog pin select + 0 + 2 + + + AnalogInput0 + AIN0 selected as analog input + 0 + + + AnalogInput1 + AIN1 selected as analog input + 1 + + + AnalogInput2 + AIN2 selected as analog input + 2 + + + AnalogInput3 + AIN3 selected as analog input + 3 + + + AnalogInput4 + AIN4 selected as analog input + 4 + + + AnalogInput5 + AIN5 selected as analog input + 5 + + + AnalogInput6 + AIN6 selected as analog input + 6 + + + AnalogInput7 + AIN7 selected as analog input + 7 + + + + + + + REFSEL + Reference select + 0x508 + read-write + 0x00000004 + + + REFSEL + Reference select + 0 + 3 + + + Ref1_8Vdd + VDD * 1/8 selected as reference + 0 + + + Ref2_8Vdd + VDD * 2/8 selected as reference + 1 + + + Ref3_8Vdd + VDD * 3/8 selected as reference + 2 + + + Ref4_8Vdd + VDD * 4/8 selected as reference + 3 + + + Ref5_8Vdd + VDD * 5/8 selected as reference + 4 + + + Ref6_8Vdd + VDD * 6/8 selected as reference + 5 + + + Ref7_8Vdd + VDD * 7/8 selected as reference + 6 + + + ARef + External analog reference selected + 7 + + + Ref1_16Vdd + VDD * 1/16 selected as reference + 8 + + + Ref3_16Vdd + VDD * 3/16 selected as reference + 9 + + + Ref5_16Vdd + VDD * 5/16 selected as reference + 10 + + + Ref7_16Vdd + VDD * 7/16 selected as reference + 11 + + + Ref9_16Vdd + VDD * 9/16 selected as reference + 12 + + + Ref11_16Vdd + VDD * 11/16 selected as reference + 13 + + + Ref13_16Vdd + VDD * 13/16 selected as reference + 14 + + + Ref15_16Vdd + VDD * 15/16 selected as reference + 15 + + + + + + + EXTREFSEL + External reference select + 0x50C + read-write + + + EXTREFSEL + External analog reference select + 0 + 0 + + + AnalogReference0 + Use AIN0 as external analog reference + 0 + + + AnalogReference1 + Use AIN1 as external analog reference + 1 + + + + + + + ANADETECT + Analog detect configuration + 0x520 + read-write + + + ANADETECT + Analog detect configuration + 0 + 1 + + + Cross + Generate ANADETECT on crossing, both upward crossing and downward crossing + 0 + + + Up + Generate ANADETECT on upward crossing only + 1 + + + Down + Generate ANADETECT on downward crossing only + 2 + + + + + + + HYST + Comparator hysteresis enable + 0x538 + read-write + + + HYST + Comparator hysteresis enable + 0 + 0 + + + NoHyst + Comparator hysteresis disabled + 0 + + + Hyst50mV + Comparator hysteresis disabled (typ. 50 mV) + 1 + + + + + + + + + SWI0 + Software interrupt 0 + SWI + 0x40014000 + 32 + SWI + + 0 + 0x1000 + registers + + + SWI0_EGU0 + 20 + + + + UNUSED + Unused. + 0x000 + 0x00000000 + read-only + + + + + EGU0 + Event Generator Unit 0 + EGU + 0x40014000 + 32 + SWI0 + EGU + + 0 + 0x1000 + registers + + + SWI0_EGU0 + 20 + + + + 16 + 4 + TASKS_TRIGGER[%s] + Description collection[0]: Trigger 0 for triggering the corresponding TRIGGERED[0] event + 0x000 + write-only + + + 16 + 4 + EVENTS_TRIGGERED[%s] + Description collection[0]: Event number 0 generated by triggering the corresponding TRIGGER[0] task + 0x100 + read-write + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + TRIGGERED0 + Enable or disable interrupt for TRIGGERED[0] event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED1 + Enable or disable interrupt for TRIGGERED[1] event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED2 + Enable or disable interrupt for TRIGGERED[2] event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED3 + Enable or disable interrupt for TRIGGERED[3] event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED4 + Enable or disable interrupt for TRIGGERED[4] event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED5 + Enable or disable interrupt for TRIGGERED[5] event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED6 + Enable or disable interrupt for TRIGGERED[6] event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED7 + Enable or disable interrupt for TRIGGERED[7] event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED8 + Enable or disable interrupt for TRIGGERED[8] event + 8 + 8 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED9 + Enable or disable interrupt for TRIGGERED[9] event + 9 + 9 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED10 + Enable or disable interrupt for TRIGGERED[10] event + 10 + 10 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED11 + Enable or disable interrupt for TRIGGERED[11] event + 11 + 11 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED12 + Enable or disable interrupt for TRIGGERED[12] event + 12 + 12 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED13 + Enable or disable interrupt for TRIGGERED[13] event + 13 + 13 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED14 + Enable or disable interrupt for TRIGGERED[14] event + 14 + 14 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TRIGGERED15 + Enable or disable interrupt for TRIGGERED[15] event + 15 + 15 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + TRIGGERED0 + Write '1' to Enable interrupt for TRIGGERED[0] event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED1 + Write '1' to Enable interrupt for TRIGGERED[1] event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED2 + Write '1' to Enable interrupt for TRIGGERED[2] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED3 + Write '1' to Enable interrupt for TRIGGERED[3] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED4 + Write '1' to Enable interrupt for TRIGGERED[4] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED5 + Write '1' to Enable interrupt for TRIGGERED[5] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED6 + Write '1' to Enable interrupt for TRIGGERED[6] event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED7 + Write '1' to Enable interrupt for TRIGGERED[7] event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED8 + Write '1' to Enable interrupt for TRIGGERED[8] event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED9 + Write '1' to Enable interrupt for TRIGGERED[9] event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED10 + Write '1' to Enable interrupt for TRIGGERED[10] event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED11 + Write '1' to Enable interrupt for TRIGGERED[11] event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED12 + Write '1' to Enable interrupt for TRIGGERED[12] event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED13 + Write '1' to Enable interrupt for TRIGGERED[13] event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED14 + Write '1' to Enable interrupt for TRIGGERED[14] event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TRIGGERED15 + Write '1' to Enable interrupt for TRIGGERED[15] event + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + TRIGGERED0 + Write '1' to Disable interrupt for TRIGGERED[0] event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED1 + Write '1' to Disable interrupt for TRIGGERED[1] event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED2 + Write '1' to Disable interrupt for TRIGGERED[2] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED3 + Write '1' to Disable interrupt for TRIGGERED[3] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED4 + Write '1' to Disable interrupt for TRIGGERED[4] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED5 + Write '1' to Disable interrupt for TRIGGERED[5] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED6 + Write '1' to Disable interrupt for TRIGGERED[6] event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED7 + Write '1' to Disable interrupt for TRIGGERED[7] event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED8 + Write '1' to Disable interrupt for TRIGGERED[8] event + 8 + 8 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED9 + Write '1' to Disable interrupt for TRIGGERED[9] event + 9 + 9 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED10 + Write '1' to Disable interrupt for TRIGGERED[10] event + 10 + 10 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED11 + Write '1' to Disable interrupt for TRIGGERED[11] event + 11 + 11 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED12 + Write '1' to Disable interrupt for TRIGGERED[12] event + 12 + 12 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED13 + Write '1' to Disable interrupt for TRIGGERED[13] event + 13 + 13 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED14 + Write '1' to Disable interrupt for TRIGGERED[14] event + 14 + 14 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TRIGGERED15 + Write '1' to Disable interrupt for TRIGGERED[15] event + 15 + 15 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + + + SWI1 + Software interrupt 1 + 0x40015000 + + SWI1_EGU1 + 21 + + + + EGU1 + Event Generator Unit 1 + 0x40015000 + SWI1 + + SWI1_EGU1 + 21 + + + + SWI2 + Software interrupt 2 + 0x40016000 + + SWI2_EGU2 + 22 + + + + EGU2 + Event Generator Unit 2 + 0x40016000 + SWI2 + + SWI2_EGU2 + 22 + + + + SWI3 + Software interrupt 3 + 0x40017000 + + SWI3_EGU3 + 23 + + + + EGU3 + Event Generator Unit 3 + 0x40017000 + SWI3 + + SWI3_EGU3 + 23 + + + + SWI4 + Software interrupt 4 + 0x40018000 + + SWI4_EGU4 + 24 + + + + EGU4 + Event Generator Unit 4 + 0x40018000 + SWI4 + + SWI4_EGU4 + 24 + + + + SWI5 + Software interrupt 5 + 0x40019000 + + SWI5_EGU5 + 25 + + + + EGU5 + Event Generator Unit 5 + 0x40019000 + SWI5 + + SWI5_EGU5 + 25 + + + + TIMER3 + Timer/Counter 3 + 0x4001A000 + + TIMER3 + 26 + + + + TIMER4 + Timer/Counter 4 + 0x4001B000 + + TIMER4 + 27 + + + + PWM0 + Pulse Width Modulation Unit 0 + PWM + 0x4001C000 + 32 + PWM + + 0 + 0x1000 + registers + + + PWM0 + 28 + + + + TASKS_STOP + Stops PWM pulse generation on all channels at the end of current PWM period, and stops sequence playback + 0x004 + write-only + + + 2 + 4 + TASKS_SEQSTART[%s] + Description collection[0]: Loads the first PWM value on all enabled channels from sequence 0, and starts playing that sequence at the rate defined in SEQ[0]REFRESH and/or DECODER.MODE. Causes PWM generation to start it was not running. + 0x008 + write-only + + + TASKS_NEXTSTEP + Steps by one value in the current sequence on all enabled channels if DECODER.MODE=NextStep. Does not cause PWM generation to start it was not running. + 0x010 + write-only + + + EVENTS_STOPPED + Response to STOP task, emitted when PWM pulses are no longer generated + 0x104 + read-write + + + 2 + 4 + EVENTS_SEQSTARTED[%s] + Description collection[0]: First PWM period started on sequence 0 + 0x108 + read-write + + + 2 + 4 + EVENTS_SEQEND[%s] + Description collection[0]: Emitted at end of every sequence 0, when last value from RAM has been applied to wave counter + 0x110 + read-write + + + EVENTS_PWMPERIODEND + Emitted at the end of each PWM period + 0x118 + read-write + + + EVENTS_LOOPSDONE + Concatenated sequences have been played the amount of times defined in LOOP.CNT + 0x11C + read-write + + + SHORTS + Shortcut register + 0x200 + read-write + + + SEQEND0_STOP + Shortcut between SEQEND[0] event and STOP task + 0 + 0 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + SEQEND1_STOP + Shortcut between SEQEND[1] event and STOP task + 1 + 1 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LOOPSDONE_SEQSTART0 + Shortcut between LOOPSDONE event and SEQSTART[0] task + 2 + 2 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LOOPSDONE_SEQSTART1 + Shortcut between LOOPSDONE event and SEQSTART[1] task + 3 + 3 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + LOOPSDONE_STOP + Shortcut between LOOPSDONE event and STOP task + 4 + 4 + + + Disabled + Disable shortcut + 0 + + + Enabled + Enable shortcut + 1 + + + + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STOPPED + Enable or disable interrupt for STOPPED event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SEQSTARTED0 + Enable or disable interrupt for SEQSTARTED[0] event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SEQSTARTED1 + Enable or disable interrupt for SEQSTARTED[1] event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SEQEND0 + Enable or disable interrupt for SEQEND[0] event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + SEQEND1 + Enable or disable interrupt for SEQEND[1] event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PWMPERIODEND + Enable or disable interrupt for PWMPERIODEND event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + LOOPSDONE + Enable or disable interrupt for LOOPSDONE event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STOPPED + Write '1' to Enable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SEQSTARTED0 + Write '1' to Enable interrupt for SEQSTARTED[0] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SEQSTARTED1 + Write '1' to Enable interrupt for SEQSTARTED[1] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SEQEND0 + Write '1' to Enable interrupt for SEQEND[0] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + SEQEND1 + Write '1' to Enable interrupt for SEQEND[1] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PWMPERIODEND + Write '1' to Enable interrupt for PWMPERIODEND event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + LOOPSDONE + Write '1' to Enable interrupt for LOOPSDONE event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STOPPED + Write '1' to Disable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SEQSTARTED0 + Write '1' to Disable interrupt for SEQSTARTED[0] event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SEQSTARTED1 + Write '1' to Disable interrupt for SEQSTARTED[1] event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SEQEND0 + Write '1' to Disable interrupt for SEQEND[0] event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + SEQEND1 + Write '1' to Disable interrupt for SEQEND[1] event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PWMPERIODEND + Write '1' to Disable interrupt for PWMPERIODEND event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + LOOPSDONE + Write '1' to Disable interrupt for LOOPSDONE event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + PWM module enable register + 0x500 + read-write + 0x00000000 + + + ENABLE + Enable or disable PWM module + 0 + 0 + + + Disabled + Disabled + 0 + + + Enabled + Enable + 1 + + + + + + + MODE + Selects operating mode of the wave counter + 0x504 + read-write + 0x00000000 + + + UPDOWN + Selects up or up and down as wave counter mode + 0 + 0 + + + Up + Up counter - edge aligned PWM duty-cycle + 0 + + + UpAndDown + Up and down counter - center aligned PWM duty cycle + 1 + + + + + + + COUNTERTOP + Value up to which the pulse generator counter counts + 0x508 + read-write + 0x000003FF + + + COUNTERTOP + Value up to which the pulse generator counter counts. This register is ignored when DECODER.MODE=WaveForm and only values from RAM will be used. + 0 + 14 + + + + + PRESCALER + Configuration for PWM_CLK + 0x50C + read-write + 0x00000000 + + + PRESCALER + Pre-scaler of PWM_CLK + 0 + 2 + + + DIV_1 + Divide by 1 (16MHz) + 0 + + + DIV_2 + Divide by 2 ( 8MHz) + 1 + + + DIV_4 + Divide by 4 ( 4MHz) + 2 + + + DIV_8 + Divide by 8 ( 2MHz) + 3 + + + DIV_16 + Divide by 16 ( 1MHz) + 4 + + + DIV_32 + Divide by 32 ( 500kHz) + 5 + + + DIV_64 + Divide by 64 ( 250kHz) + 6 + + + DIV_128 + Divide by 128 ( 125kHz) + 7 + + + + + + + DECODER + Configuration of the decoder + 0x510 + read-write + 0x00000000 + + + LOAD + How a sequence is read from RAM and spread to the compare register + 0 + 1 + + + Common + 1st half word (16-bit) used in all PWM channels 0..3 + 0 + + + Grouped + 1st half word (16-bit) used in channel 0..1; 2nd word in channel 2..3 + 1 + + + Individual + 1st half word (16-bit) in ch.0; 2nd in ch.1; ...; 4th in ch.3 + 2 + + + WaveForm + 1st half word (16-bit) in ch.0; 2nd in ch.1; ...; 4th in COUNTERTOP + 3 + + + + + MODE + Selects source for advancing the active sequence + 8 + 8 + + + RefreshCount + SEQ[n].REFRESH is used to determine loading internal compare registers + 0 + + + NextStep + NEXTSTEP task causes a new value to be loaded to internal compare registers + 1 + + + + + + + LOOP + Amount of playback of a loop + 0x514 + read-write + 0x00000000 + + + CNT + Amount of playback of pattern cycles + 0 + 15 + + + Disabled + Looping disabled (stop at the end of the sequence) + 0 + + + + + + + 2 + 32 + SEQ[%s] + Unspecified + PWM_SEQ + 0x520 + + PTR + Description cluster[0]: Beginning address in Data RAM of this sequence + 0x000 + read-write + 0x00000000 + + + PTR + Beginning address in Data RAM of this sequence + 0 + 31 + + + + + CNT + Description cluster[0]: Amount of values (duty cycles) in this sequence + 0x004 + read-write + 0x00000000 + + + CNT + Amount of values (duty cycles) in this sequence + 0 + 14 + + + Disabled + Sequence is disabled, and shall not be started as it is empty + 0 + + + + + + + REFRESH + Description cluster[0]: Amount of additional PWM periods between samples loaded into compare register + 0x008 + read-write + 0x00000001 + + + CNT + Amount of additional PWM periods between samples loaded into compare register (load every REFRESH.CNT+1 PWM periods) + 0 + 23 + + + Continuous + Update every PWM period + 0 + + + + + + + ENDDELAY + Description cluster[0]: Time added after the sequence + 0x00C + read-write + 0x00000000 + + + CNT + Time added after the sequence in PWM periods + 0 + 23 + + + + + + PSEL + Unspecified + PWM_PSEL + 0x560 + + 4 + 4 + OUT[%s] + Description collection[0]: Output pin select for PWM channel 0 + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + + + PDM + Pulse Density Modulation (Digital Microphone) Interface + PDM + 0x4001D000 + 32 + + 0 + 0x1000 + registers + + + PDM + 29 + + + + TASKS_START + Starts continuous PDM transfer + 0x000 + write-only + + + TASKS_STOP + Stops PDM transfer + 0x004 + write-only + + + EVENTS_STARTED + PDM transfer has started + 0x100 + read-write + + + EVENTS_STOPPED + PDM transfer has finished + 0x104 + read-write + + + EVENTS_END + The PDM has written the last sample specified by SAMPLE.MAXCNT (or the last sample after a STOP task has been received) to Data RAM + 0x108 + read-write + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + STARTED + Enable or disable interrupt for STARTED event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STOPPED + Enable or disable interrupt for STOPPED event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + END + Enable or disable interrupt for END event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + STARTED + Write '1' to Enable interrupt for STARTED event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STOPPED + Write '1' to Enable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + END + Write '1' to Enable interrupt for END event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + STARTED + Write '1' to Disable interrupt for STARTED event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STOPPED + Write '1' to Disable interrupt for STOPPED event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + END + Write '1' to Disable interrupt for END event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + PDM module enable register + 0x500 + read-write + 0x00000000 + + + ENABLE + Enable or disable PDM module + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + PDMCLKCTRL + PDM clock generator control + 0x504 + read-write + 0x08400000 + + + FREQ + PDM_CLK frequency + 0 + 31 + + + 1000K + PDM_CLK = 32 MHz / 32 = 1.000 MHz + 0x08000000 + + + Default + PDM_CLK = 32 MHz / 31 = 1.032 MHz + 0x08400000 + + + 1067K + PDM_CLK = 32 MHz / 30 = 1.067 MHz + 0x08800000 + + + + + + + MODE + Defines the routing of the connected PDM microphones' signals + 0x508 + read-write + 0x00000000 + + + OPERATION + Mono or stereo operation + 0 + 0 + + + Stereo + Sample and store one pair (Left + Right) of 16bit samples per RAM word R=[31:16]; L=[15:0] + 0 + + + Mono + Sample and store two successive Left samples (16 bit each) per RAM word L1=[31:16]; L0=[15:0] + 1 + + + + + EDGE + Defines on which PDM_CLK edge Left (or mono) is sampled + 1 + 1 + + + LeftFalling + Left (or mono) is sampled on falling edge of PDM_CLK + 0 + + + LeftRising + Left (or mono) is sampled on rising edge of PDM_CLK + 1 + + + + + + + GAINL + Left output gain adjustment + 0x518 + read-write + 0x00000028 + + + GAINL + Left output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters) 0x00 -20 dB gain adjust 0x01 -19.5 dB gain adjust (...) 0x27 -0.5 dB gain adjust 0x28 0 dB gain adjust 0x29 +0.5 dB gain adjust (...) 0x4F +19.5 dB gain adjust 0x50 +20 dB gain adjust + 0 + 6 + + + MinGain + -20dB gain adjustment (minimum) + 0x00 + + + DefaultGain + 0dB gain adjustment ('2500 RMS' requirement) + 0x28 + + + MaxGain + +20dB gain adjustment (maximum) + 0x50 + + + + + + + GAINR + Right output gain adjustment + 0x51C + read-write + 0x00000028 + + + GAINR + Right output gain adjustment, in 0.5 dB steps, around the default module gain (see electrical parameters) + 0 + 7 + + + MinGain + -20dB gain adjustment (minimum) + 0x00 + + + DefaultGain + 0dB gain adjustment ('2500 RMS' requirement) + 0x28 + + + MaxGain + +20dB gain adjustment (maximum) + 0x50 + + + + + + + PSEL + Unspecified + 0x540 + + CLK + Pin number configuration for PDM CLK signal + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + DIN + Pin number configuration for PDM DIN signal + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + SAMPLE + Unspecified + 0x560 + + PTR + RAM address pointer to write samples to with EasyDMA + 0x000 + read-write + + + SAMPLEPTR + Address to write PDM samples to over DMA + 0 + 31 + + + + + MAXCNT + Number of samples to allocate memory for in EasyDMA mode + 0x004 + read-write + + + BUFFSIZE + Length of DMA RAM allocation in number of samples + 0 + 14 + + + + + + + + NVMC + Non Volatile Memory Controller + NVMC + 0x4001E000 + 32 + + 0 + 0x1000 + registers + + + + READY + Ready flag + 0x400 + read-only + + + READY + NVMC is ready or busy + 0 + 0 + + + Busy + NVMC is busy (on-going write or erase operation) + 0 + + + Ready + NVMC is ready + 1 + + + + + + + CONFIG + Configuration register + 0x504 + read-write + + + WEN + Program memory access mode. It is strongly recommended to only activate erase and write modes when they are actively used. Enabling write or erase will invalidate the cache and keep it invalidated. + 0 + 1 + + + Ren + Read only access + 0 + + + Wen + Write Enabled + 1 + + + Een + Erase enabled + 2 + + + + + + + ERASEPAGE + Register for erasing a page in Code area + 0x508 + read-write + + + ERASEPAGE + Register for starting erase of a page in Code area + 0 + 31 + + + + + ERASEPCR1 + Deprecated register - Register for erasing a page in Code area. Equivalent to ERASEPAGE. + 0x508 + read-write + ERASEPAGE + + + ERASEPCR1 + Register for erasing a page in Code area. Equivalent to ERASEPAGE. + 0 + 31 + + + + + ERASEALL + Register for erasing all non-volatile user memory + 0x50C + read-write + + + ERASEALL + Erase all non-volatile memory including UICR registers. Note that code erase has to be enabled by CONFIG.EEN before the UICR can be erased. + 0 + 0 + + + NoOperation + No operation + 0 + + + Erase + Start chip erase + 1 + + + + + + + ERASEPCR0 + Deprecated register - Register for erasing a page in Code area. Equivalent to ERASEPAGE. + 0x510 + read-write + + + ERASEPCR0 + Register for starting erase of a page in Code area. Equivalent to ERASEPAGE. + 0 + 31 + + + + + ERASEUICR + Register for erasing User Information Configuration Registers + 0x514 + read-write + + + ERASEUICR + Register starting erase of all User Information Configuration Registers. Note that code erase has to be enabled by CONFIG.EEN before the UICR can be erased. + 0 + 0 + + + NoOperation + No operation + 0 + + + Erase + Start erase of UICR + 1 + + + + + + + ICACHECNF + I-Code cache configuration register. + 0x540 + read-write + 0x00000000 + + + CACHEEN + Cache enable + 0 + 0 + + + Disabled + Disable cache. Invalidates all cache entries. + 0 + + + Enabled + Enable cache + 1 + + + + + CACHEPROFEN + Cache profiling enable + 8 + 8 + + + Disabled + Disable cache profiling + 0 + + + Enabled + Enable cache profiling + 1 + + + + + + + IHIT + I-Code cache hit counter. + 0x548 + read-write + + + HITS + Number of cache hits + 0 + 31 + + + + + IMISS + I-Code cache miss counter. + 0x54C + read-write + + + MISSES + Number of cache misses + 0 + 31 + + + + + + + PPI + Programmable Peripheral Interconnect + PPI + 0x4001F000 + 32 + + 0 + 0x1000 + registers + + + + 6 + 8 + TASKS_CHG[%s] + Channel group tasks + 0x000 + + EN + Description cluster[0]: Enable channel group 0 + 0x000 + write-only + + + DIS + Description cluster[0]: Disable channel group 0 + 0x004 + write-only + + + + CHEN + Channel enable register + 0x500 + read-write + + + CH0 + Enable or disable channel 0 + 0 + 0 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH1 + Enable or disable channel 1 + 1 + 1 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH2 + Enable or disable channel 2 + 2 + 2 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH3 + Enable or disable channel 3 + 3 + 3 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH4 + Enable or disable channel 4 + 4 + 4 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH5 + Enable or disable channel 5 + 5 + 5 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH6 + Enable or disable channel 6 + 6 + 6 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH7 + Enable or disable channel 7 + 7 + 7 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH8 + Enable or disable channel 8 + 8 + 8 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH9 + Enable or disable channel 9 + 9 + 9 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH10 + Enable or disable channel 10 + 10 + 10 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH11 + Enable or disable channel 11 + 11 + 11 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH12 + Enable or disable channel 12 + 12 + 12 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH13 + Enable or disable channel 13 + 13 + 13 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH14 + Enable or disable channel 14 + 14 + 14 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH15 + Enable or disable channel 15 + 15 + 15 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH16 + Enable or disable channel 16 + 16 + 16 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH17 + Enable or disable channel 17 + 17 + 17 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH18 + Enable or disable channel 18 + 18 + 18 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH19 + Enable or disable channel 19 + 19 + 19 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH20 + Enable or disable channel 20 + 20 + 20 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH21 + Enable or disable channel 21 + 21 + 21 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH22 + Enable or disable channel 22 + 22 + 22 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH23 + Enable or disable channel 23 + 23 + 23 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH24 + Enable or disable channel 24 + 24 + 24 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH25 + Enable or disable channel 25 + 25 + 25 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH26 + Enable or disable channel 26 + 26 + 26 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH27 + Enable or disable channel 27 + 27 + 27 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH28 + Enable or disable channel 28 + 28 + 28 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH29 + Enable or disable channel 29 + 29 + 29 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH30 + Enable or disable channel 30 + 30 + 30 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + CH31 + Enable or disable channel 31 + 31 + 31 + + + Disabled + Disable channel + 0 + + + Enabled + Enable channel + 1 + + + + + + + CHENSET + Channel enable set register + 0x504 + read-write + oneToSet + + + CH0 + Channel 0 enable set register. Writing '0' has no effect + 0 + 0 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH1 + Channel 1 enable set register. Writing '0' has no effect + 1 + 1 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH2 + Channel 2 enable set register. Writing '0' has no effect + 2 + 2 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH3 + Channel 3 enable set register. Writing '0' has no effect + 3 + 3 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH4 + Channel 4 enable set register. Writing '0' has no effect + 4 + 4 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH5 + Channel 5 enable set register. Writing '0' has no effect + 5 + 5 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH6 + Channel 6 enable set register. Writing '0' has no effect + 6 + 6 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH7 + Channel 7 enable set register. Writing '0' has no effect + 7 + 7 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH8 + Channel 8 enable set register. Writing '0' has no effect + 8 + 8 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH9 + Channel 9 enable set register. Writing '0' has no effect + 9 + 9 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH10 + Channel 10 enable set register. Writing '0' has no effect + 10 + 10 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH11 + Channel 11 enable set register. Writing '0' has no effect + 11 + 11 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH12 + Channel 12 enable set register. Writing '0' has no effect + 12 + 12 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH13 + Channel 13 enable set register. Writing '0' has no effect + 13 + 13 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH14 + Channel 14 enable set register. Writing '0' has no effect + 14 + 14 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH15 + Channel 15 enable set register. Writing '0' has no effect + 15 + 15 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH16 + Channel 16 enable set register. Writing '0' has no effect + 16 + 16 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH17 + Channel 17 enable set register. Writing '0' has no effect + 17 + 17 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH18 + Channel 18 enable set register. Writing '0' has no effect + 18 + 18 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH19 + Channel 19 enable set register. Writing '0' has no effect + 19 + 19 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH20 + Channel 20 enable set register. Writing '0' has no effect + 20 + 20 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH21 + Channel 21 enable set register. Writing '0' has no effect + 21 + 21 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH22 + Channel 22 enable set register. Writing '0' has no effect + 22 + 22 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH23 + Channel 23 enable set register. Writing '0' has no effect + 23 + 23 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH24 + Channel 24 enable set register. Writing '0' has no effect + 24 + 24 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH25 + Channel 25 enable set register. Writing '0' has no effect + 25 + 25 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH26 + Channel 26 enable set register. Writing '0' has no effect + 26 + 26 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH27 + Channel 27 enable set register. Writing '0' has no effect + 27 + 27 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH28 + Channel 28 enable set register. Writing '0' has no effect + 28 + 28 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH29 + Channel 29 enable set register. Writing '0' has no effect + 29 + 29 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH30 + Channel 30 enable set register. Writing '0' has no effect + 30 + 30 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + CH31 + Channel 31 enable set register. Writing '0' has no effect + 31 + 31 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Set + Write: Enable channel + 1 + + + + + + + CHENCLR + Channel enable clear register + 0x508 + read-write + oneToClear + + + CH0 + Channel 0 enable clear register. Writing '0' has no effect + 0 + 0 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH1 + Channel 1 enable clear register. Writing '0' has no effect + 1 + 1 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH2 + Channel 2 enable clear register. Writing '0' has no effect + 2 + 2 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH3 + Channel 3 enable clear register. Writing '0' has no effect + 3 + 3 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH4 + Channel 4 enable clear register. Writing '0' has no effect + 4 + 4 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH5 + Channel 5 enable clear register. Writing '0' has no effect + 5 + 5 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH6 + Channel 6 enable clear register. Writing '0' has no effect + 6 + 6 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH7 + Channel 7 enable clear register. Writing '0' has no effect + 7 + 7 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH8 + Channel 8 enable clear register. Writing '0' has no effect + 8 + 8 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH9 + Channel 9 enable clear register. Writing '0' has no effect + 9 + 9 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH10 + Channel 10 enable clear register. Writing '0' has no effect + 10 + 10 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH11 + Channel 11 enable clear register. Writing '0' has no effect + 11 + 11 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH12 + Channel 12 enable clear register. Writing '0' has no effect + 12 + 12 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH13 + Channel 13 enable clear register. Writing '0' has no effect + 13 + 13 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH14 + Channel 14 enable clear register. Writing '0' has no effect + 14 + 14 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH15 + Channel 15 enable clear register. Writing '0' has no effect + 15 + 15 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH16 + Channel 16 enable clear register. Writing '0' has no effect + 16 + 16 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH17 + Channel 17 enable clear register. Writing '0' has no effect + 17 + 17 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH18 + Channel 18 enable clear register. Writing '0' has no effect + 18 + 18 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH19 + Channel 19 enable clear register. Writing '0' has no effect + 19 + 19 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH20 + Channel 20 enable clear register. Writing '0' has no effect + 20 + 20 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH21 + Channel 21 enable clear register. Writing '0' has no effect + 21 + 21 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH22 + Channel 22 enable clear register. Writing '0' has no effect + 22 + 22 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH23 + Channel 23 enable clear register. Writing '0' has no effect + 23 + 23 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH24 + Channel 24 enable clear register. Writing '0' has no effect + 24 + 24 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH25 + Channel 25 enable clear register. Writing '0' has no effect + 25 + 25 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH26 + Channel 26 enable clear register. Writing '0' has no effect + 26 + 26 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH27 + Channel 27 enable clear register. Writing '0' has no effect + 27 + 27 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH28 + Channel 28 enable clear register. Writing '0' has no effect + 28 + 28 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH29 + Channel 29 enable clear register. Writing '0' has no effect + 29 + 29 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH30 + Channel 30 enable clear register. Writing '0' has no effect + 30 + 30 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + CH31 + Channel 31 enable clear register. Writing '0' has no effect + 31 + 31 + + read + + Disabled + Read: channel disabled + 0 + + + Enabled + Read: channel enabled + 1 + + + + write + + Clear + Write: disable channel + 1 + + + + + + + 20 + 8 + CH[%s] + PPI Channel + 0x510 + + EEP + Description cluster[0]: Channel 0 event end-point + 0x000 + read-write + + + EEP + Pointer to event register. Accepts only addresses to registers from the Event group. + 0 + 31 + + + + + TEP + Description cluster[0]: Channel 0 task end-point + 0x004 + read-write + + + TEP + Pointer to task register. Accepts only addresses to registers from the Task group. + 0 + 31 + + + + + + 6 + 4 + CHG[%s] + Description collection[0]: Channel group 0 + 0x800 + read-write + + + CH0 + Include or exclude channel 0 + 0 + 0 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH1 + Include or exclude channel 1 + 1 + 1 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH2 + Include or exclude channel 2 + 2 + 2 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH3 + Include or exclude channel 3 + 3 + 3 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH4 + Include or exclude channel 4 + 4 + 4 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH5 + Include or exclude channel 5 + 5 + 5 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH6 + Include or exclude channel 6 + 6 + 6 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH7 + Include or exclude channel 7 + 7 + 7 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH8 + Include or exclude channel 8 + 8 + 8 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH9 + Include or exclude channel 9 + 9 + 9 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH10 + Include or exclude channel 10 + 10 + 10 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH11 + Include or exclude channel 11 + 11 + 11 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH12 + Include or exclude channel 12 + 12 + 12 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH13 + Include or exclude channel 13 + 13 + 13 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH14 + Include or exclude channel 14 + 14 + 14 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH15 + Include or exclude channel 15 + 15 + 15 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH16 + Include or exclude channel 16 + 16 + 16 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH17 + Include or exclude channel 17 + 17 + 17 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH18 + Include or exclude channel 18 + 18 + 18 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH19 + Include or exclude channel 19 + 19 + 19 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH20 + Include or exclude channel 20 + 20 + 20 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH21 + Include or exclude channel 21 + 21 + 21 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH22 + Include or exclude channel 22 + 22 + 22 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH23 + Include or exclude channel 23 + 23 + 23 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH24 + Include or exclude channel 24 + 24 + 24 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH25 + Include or exclude channel 25 + 25 + 25 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH26 + Include or exclude channel 26 + 26 + 26 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH27 + Include or exclude channel 27 + 27 + 27 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH28 + Include or exclude channel 28 + 28 + 28 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH29 + Include or exclude channel 29 + 29 + 29 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH30 + Include or exclude channel 30 + 30 + 30 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + CH31 + Include or exclude channel 31 + 31 + 31 + + + Excluded + Exclude + 0 + + + Included + Include + 1 + + + + + + + 32 + 4 + FORK[%s] + Fork + 0x910 + + TEP + Description cluster[0]: Channel 0 task end-point + 0x000 + read-write + + + TEP + Pointer to task register + 0 + 31 + + + + + + + + MWU + Memory Watch Unit + MWU + 0x40020000 + 32 + + 0 + 0x1000 + registers + + + MWU + 32 + + + + 4 + 8 + EVENTS_REGION[%s] + Unspecified + 0x100 + + WA + Description cluster[0]: Write access to region 0 detected + 0x000 + read-write + + + RA + Description cluster[0]: Read access to region 0 detected + 0x004 + read-write + + + + 2 + 8 + EVENTS_PREGION[%s] + Unspecified + 0x160 + + WA + Description cluster[0]: Write access to peripheral region 0 detected + 0x000 + read-write + + + RA + Description cluster[0]: Read access to peripheral region 0 detected + 0x004 + read-write + + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + REGION0WA + Enable or disable interrupt for REGION[0].WA event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION0RA + Enable or disable interrupt for REGION[0].RA event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION1WA + Enable or disable interrupt for REGION[1].WA event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION1RA + Enable or disable interrupt for REGION[1].RA event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION2WA + Enable or disable interrupt for REGION[2].WA event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION2RA + Enable or disable interrupt for REGION[2].RA event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION3WA + Enable or disable interrupt for REGION[3].WA event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION3RA + Enable or disable interrupt for REGION[3].RA event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION0WA + Enable or disable interrupt for PREGION[0].WA event + 24 + 24 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION0RA + Enable or disable interrupt for PREGION[0].RA event + 25 + 25 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION1WA + Enable or disable interrupt for PREGION[1].WA event + 26 + 26 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION1RA + Enable or disable interrupt for PREGION[1].RA event + 27 + 27 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + REGION0WA + Write '1' to Enable interrupt for REGION[0].WA event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION0RA + Write '1' to Enable interrupt for REGION[0].RA event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION1WA + Write '1' to Enable interrupt for REGION[1].WA event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION1RA + Write '1' to Enable interrupt for REGION[1].RA event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION2WA + Write '1' to Enable interrupt for REGION[2].WA event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION2RA + Write '1' to Enable interrupt for REGION[2].RA event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION3WA + Write '1' to Enable interrupt for REGION[3].WA event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION3RA + Write '1' to Enable interrupt for REGION[3].RA event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION0WA + Write '1' to Enable interrupt for PREGION[0].WA event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION0RA + Write '1' to Enable interrupt for PREGION[0].RA event + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION1WA + Write '1' to Enable interrupt for PREGION[1].WA event + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION1RA + Write '1' to Enable interrupt for PREGION[1].RA event + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + REGION0WA + Write '1' to Disable interrupt for REGION[0].WA event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION0RA + Write '1' to Disable interrupt for REGION[0].RA event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION1WA + Write '1' to Disable interrupt for REGION[1].WA event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION1RA + Write '1' to Disable interrupt for REGION[1].RA event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION2WA + Write '1' to Disable interrupt for REGION[2].WA event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION2RA + Write '1' to Disable interrupt for REGION[2].RA event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION3WA + Write '1' to Disable interrupt for REGION[3].WA event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION3RA + Write '1' to Disable interrupt for REGION[3].RA event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION0WA + Write '1' to Disable interrupt for PREGION[0].WA event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION0RA + Write '1' to Disable interrupt for PREGION[0].RA event + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION1WA + Write '1' to Disable interrupt for PREGION[1].WA event + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION1RA + Write '1' to Disable interrupt for PREGION[1].RA event + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + NMIEN + Enable or disable non-maskable interrupt + 0x320 + read-write + + + REGION0WA + Enable or disable non-maskable interrupt for REGION[0].WA event + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION0RA + Enable or disable non-maskable interrupt for REGION[0].RA event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION1WA + Enable or disable non-maskable interrupt for REGION[1].WA event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION1RA + Enable or disable non-maskable interrupt for REGION[1].RA event + 3 + 3 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION2WA + Enable or disable non-maskable interrupt for REGION[2].WA event + 4 + 4 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION2RA + Enable or disable non-maskable interrupt for REGION[2].RA event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION3WA + Enable or disable non-maskable interrupt for REGION[3].WA event + 6 + 6 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + REGION3RA + Enable or disable non-maskable interrupt for REGION[3].RA event + 7 + 7 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION0WA + Enable or disable non-maskable interrupt for PREGION[0].WA event + 24 + 24 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION0RA + Enable or disable non-maskable interrupt for PREGION[0].RA event + 25 + 25 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION1WA + Enable or disable non-maskable interrupt for PREGION[1].WA event + 26 + 26 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + PREGION1RA + Enable or disable non-maskable interrupt for PREGION[1].RA event + 27 + 27 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + NMIENSET + Enable non-maskable interrupt + 0x324 + read-write + + + REGION0WA + Write '1' to Enable non-maskable interrupt for REGION[0].WA event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION0RA + Write '1' to Enable non-maskable interrupt for REGION[0].RA event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION1WA + Write '1' to Enable non-maskable interrupt for REGION[1].WA event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION1RA + Write '1' to Enable non-maskable interrupt for REGION[1].RA event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION2WA + Write '1' to Enable non-maskable interrupt for REGION[2].WA event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION2RA + Write '1' to Enable non-maskable interrupt for REGION[2].RA event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION3WA + Write '1' to Enable non-maskable interrupt for REGION[3].WA event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + REGION3RA + Write '1' to Enable non-maskable interrupt for REGION[3].RA event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION0WA + Write '1' to Enable non-maskable interrupt for PREGION[0].WA event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION0RA + Write '1' to Enable non-maskable interrupt for PREGION[0].RA event + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION1WA + Write '1' to Enable non-maskable interrupt for PREGION[1].WA event + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + PREGION1RA + Write '1' to Enable non-maskable interrupt for PREGION[1].RA event + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + NMIENCLR + Disable non-maskable interrupt + 0x328 + read-write + + + REGION0WA + Write '1' to Disable non-maskable interrupt for REGION[0].WA event + 0 + 0 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION0RA + Write '1' to Disable non-maskable interrupt for REGION[0].RA event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION1WA + Write '1' to Disable non-maskable interrupt for REGION[1].WA event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION1RA + Write '1' to Disable non-maskable interrupt for REGION[1].RA event + 3 + 3 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION2WA + Write '1' to Disable non-maskable interrupt for REGION[2].WA event + 4 + 4 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION2RA + Write '1' to Disable non-maskable interrupt for REGION[2].RA event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION3WA + Write '1' to Disable non-maskable interrupt for REGION[3].WA event + 6 + 6 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + REGION3RA + Write '1' to Disable non-maskable interrupt for REGION[3].RA event + 7 + 7 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION0WA + Write '1' to Disable non-maskable interrupt for PREGION[0].WA event + 24 + 24 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION0RA + Write '1' to Disable non-maskable interrupt for PREGION[0].RA event + 25 + 25 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION1WA + Write '1' to Disable non-maskable interrupt for PREGION[1].WA event + 26 + 26 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + PREGION1RA + Write '1' to Disable non-maskable interrupt for PREGION[1].RA event + 27 + 27 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + 2 + 8 + PERREGION[%s] + Unspecified + 0x400 + + SUBSTATWA + Description cluster[0]: Source of event/interrupt in region 0, write access detected while corresponding subregion was enabled for watching + 0x000 + read-write + oneToClear + + + SR0 + Subregion 0 in region 0 (write '1' to clear) + 0 + 0 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR1 + Subregion 1 in region 0 (write '1' to clear) + 1 + 1 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR2 + Subregion 2 in region 0 (write '1' to clear) + 2 + 2 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR3 + Subregion 3 in region 0 (write '1' to clear) + 3 + 3 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR4 + Subregion 4 in region 0 (write '1' to clear) + 4 + 4 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR5 + Subregion 5 in region 0 (write '1' to clear) + 5 + 5 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR6 + Subregion 6 in region 0 (write '1' to clear) + 6 + 6 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR7 + Subregion 7 in region 0 (write '1' to clear) + 7 + 7 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR8 + Subregion 8 in region 0 (write '1' to clear) + 8 + 8 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR9 + Subregion 9 in region 0 (write '1' to clear) + 9 + 9 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR10 + Subregion 10 in region 0 (write '1' to clear) + 10 + 10 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR11 + Subregion 11 in region 0 (write '1' to clear) + 11 + 11 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR12 + Subregion 12 in region 0 (write '1' to clear) + 12 + 12 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR13 + Subregion 13 in region 0 (write '1' to clear) + 13 + 13 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR14 + Subregion 14 in region 0 (write '1' to clear) + 14 + 14 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR15 + Subregion 15 in region 0 (write '1' to clear) + 15 + 15 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR16 + Subregion 16 in region 0 (write '1' to clear) + 16 + 16 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR17 + Subregion 17 in region 0 (write '1' to clear) + 17 + 17 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR18 + Subregion 18 in region 0 (write '1' to clear) + 18 + 18 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR19 + Subregion 19 in region 0 (write '1' to clear) + 19 + 19 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR20 + Subregion 20 in region 0 (write '1' to clear) + 20 + 20 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR21 + Subregion 21 in region 0 (write '1' to clear) + 21 + 21 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR22 + Subregion 22 in region 0 (write '1' to clear) + 22 + 22 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR23 + Subregion 23 in region 0 (write '1' to clear) + 23 + 23 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR24 + Subregion 24 in region 0 (write '1' to clear) + 24 + 24 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR25 + Subregion 25 in region 0 (write '1' to clear) + 25 + 25 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR26 + Subregion 26 in region 0 (write '1' to clear) + 26 + 26 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR27 + Subregion 27 in region 0 (write '1' to clear) + 27 + 27 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR28 + Subregion 28 in region 0 (write '1' to clear) + 28 + 28 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR29 + Subregion 29 in region 0 (write '1' to clear) + 29 + 29 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR30 + Subregion 30 in region 0 (write '1' to clear) + 30 + 30 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + SR31 + Subregion 31 in region 0 (write '1' to clear) + 31 + 31 + + + NoAccess + No write access occurred in this subregion + 0 + + + Access + Write access(es) occurred in this subregion + 1 + + + + + + + SUBSTATRA + Description cluster[0]: Source of event/interrupt in region 0, read access detected while corresponding subregion was enabled for watching + 0x004 + read-write + oneToClear + + + SR0 + Subregion 0 in region 0 (write '1' to clear) + 0 + 0 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR1 + Subregion 1 in region 0 (write '1' to clear) + 1 + 1 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR2 + Subregion 2 in region 0 (write '1' to clear) + 2 + 2 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR3 + Subregion 3 in region 0 (write '1' to clear) + 3 + 3 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR4 + Subregion 4 in region 0 (write '1' to clear) + 4 + 4 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR5 + Subregion 5 in region 0 (write '1' to clear) + 5 + 5 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR6 + Subregion 6 in region 0 (write '1' to clear) + 6 + 6 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR7 + Subregion 7 in region 0 (write '1' to clear) + 7 + 7 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR8 + Subregion 8 in region 0 (write '1' to clear) + 8 + 8 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR9 + Subregion 9 in region 0 (write '1' to clear) + 9 + 9 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR10 + Subregion 10 in region 0 (write '1' to clear) + 10 + 10 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR11 + Subregion 11 in region 0 (write '1' to clear) + 11 + 11 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR12 + Subregion 12 in region 0 (write '1' to clear) + 12 + 12 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR13 + Subregion 13 in region 0 (write '1' to clear) + 13 + 13 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR14 + Subregion 14 in region 0 (write '1' to clear) + 14 + 14 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR15 + Subregion 15 in region 0 (write '1' to clear) + 15 + 15 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR16 + Subregion 16 in region 0 (write '1' to clear) + 16 + 16 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR17 + Subregion 17 in region 0 (write '1' to clear) + 17 + 17 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR18 + Subregion 18 in region 0 (write '1' to clear) + 18 + 18 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR19 + Subregion 19 in region 0 (write '1' to clear) + 19 + 19 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR20 + Subregion 20 in region 0 (write '1' to clear) + 20 + 20 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR21 + Subregion 21 in region 0 (write '1' to clear) + 21 + 21 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR22 + Subregion 22 in region 0 (write '1' to clear) + 22 + 22 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR23 + Subregion 23 in region 0 (write '1' to clear) + 23 + 23 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR24 + Subregion 24 in region 0 (write '1' to clear) + 24 + 24 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR25 + Subregion 25 in region 0 (write '1' to clear) + 25 + 25 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR26 + Subregion 26 in region 0 (write '1' to clear) + 26 + 26 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR27 + Subregion 27 in region 0 (write '1' to clear) + 27 + 27 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR28 + Subregion 28 in region 0 (write '1' to clear) + 28 + 28 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR29 + Subregion 29 in region 0 (write '1' to clear) + 29 + 29 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR30 + Subregion 30 in region 0 (write '1' to clear) + 30 + 30 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + SR31 + Subregion 31 in region 0 (write '1' to clear) + 31 + 31 + + + NoAccess + No read access occurred in this subregion + 0 + + + Access + Read access(es) occurred in this subregion + 1 + + + + + + + + REGIONEN + Enable/disable regions watch + 0x510 + read-write + + + RGN0WA + Enable/disable write access watch in region[0] + 0 + 0 + + + Disable + Disable write access watch in this region + 0 + + + Enable + Enable write access watch in this region + 1 + + + + + RGN0RA + Enable/disable read access watch in region[0] + 1 + 1 + + + Disable + Disable read access watch in this region + 0 + + + Enable + Enable read access watch in this region + 1 + + + + + RGN1WA + Enable/disable write access watch in region[1] + 2 + 2 + + + Disable + Disable write access watch in this region + 0 + + + Enable + Enable write access watch in this region + 1 + + + + + RGN1RA + Enable/disable read access watch in region[1] + 3 + 3 + + + Disable + Disable read access watch in this region + 0 + + + Enable + Enable read access watch in this region + 1 + + + + + RGN2WA + Enable/disable write access watch in region[2] + 4 + 4 + + + Disable + Disable write access watch in this region + 0 + + + Enable + Enable write access watch in this region + 1 + + + + + RGN2RA + Enable/disable read access watch in region[2] + 5 + 5 + + + Disable + Disable read access watch in this region + 0 + + + Enable + Enable read access watch in this region + 1 + + + + + RGN3WA + Enable/disable write access watch in region[3] + 6 + 6 + + + Disable + Disable write access watch in this region + 0 + + + Enable + Enable write access watch in this region + 1 + + + + + RGN3RA + Enable/disable read access watch in region[3] + 7 + 7 + + + Disable + Disable read access watch in this region + 0 + + + Enable + Enable read access watch in this region + 1 + + + + + PRGN0WA + Enable/disable write access watch in PREGION[0] + 24 + 24 + + + Disable + Disable write access watch in this PREGION + 0 + + + Enable + Enable write access watch in this PREGION + 1 + + + + + PRGN0RA + Enable/disable read access watch in PREGION[0] + 25 + 25 + + + Disable + Disable read access watch in this PREGION + 0 + + + Enable + Enable read access watch in this PREGION + 1 + + + + + PRGN1WA + Enable/disable write access watch in PREGION[1] + 26 + 26 + + + Disable + Disable write access watch in this PREGION + 0 + + + Enable + Enable write access watch in this PREGION + 1 + + + + + PRGN1RA + Enable/disable read access watch in PREGION[1] + 27 + 27 + + + Disable + Disable read access watch in this PREGION + 0 + + + Enable + Enable read access watch in this PREGION + 1 + + + + + + + REGIONENSET + Enable regions watch + 0x514 + read-write + + + RGN0WA + Enable write access watch in region[0] + 0 + 0 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Set + Enable write access watch in this region + 1 + + + + + RGN0RA + Enable read access watch in region[0] + 1 + 1 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Set + Enable read access watch in this region + 1 + + + + + RGN1WA + Enable write access watch in region[1] + 2 + 2 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Set + Enable write access watch in this region + 1 + + + + + RGN1RA + Enable read access watch in region[1] + 3 + 3 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Set + Enable read access watch in this region + 1 + + + + + RGN2WA + Enable write access watch in region[2] + 4 + 4 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Set + Enable write access watch in this region + 1 + + + + + RGN2RA + Enable read access watch in region[2] + 5 + 5 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Set + Enable read access watch in this region + 1 + + + + + RGN3WA + Enable write access watch in region[3] + 6 + 6 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Set + Enable write access watch in this region + 1 + + + + + RGN3RA + Enable read access watch in region[3] + 7 + 7 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Set + Enable read access watch in this region + 1 + + + + + PRGN0WA + Enable write access watch in PREGION[0] + 24 + 24 + + read + + Disabled + Write access watch in this PREGION is disabled + 0 + + + Enabled + Write access watch in this PREGION is enabled + 1 + + + + write + + Set + Enable write access watch in this PREGION + 1 + + + + + PRGN0RA + Enable read access watch in PREGION[0] + 25 + 25 + + read + + Disabled + Read access watch in this PREGION is disabled + 0 + + + Enabled + Read access watch in this PREGION is enabled + 1 + + + + write + + Set + Enable read access watch in this PREGION + 1 + + + + + PRGN1WA + Enable write access watch in PREGION[1] + 26 + 26 + + read + + Disabled + Write access watch in this PREGION is disabled + 0 + + + Enabled + Write access watch in this PREGION is enabled + 1 + + + + write + + Set + Enable write access watch in this PREGION + 1 + + + + + PRGN1RA + Enable read access watch in PREGION[1] + 27 + 27 + + read + + Disabled + Read access watch in this PREGION is disabled + 0 + + + Enabled + Read access watch in this PREGION is enabled + 1 + + + + write + + Set + Enable read access watch in this PREGION + 1 + + + + + + + REGIONENCLR + Disable regions watch + 0x518 + read-write + + + RGN0WA + Disable write access watch in region[0] + 0 + 0 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Clear + Disable write access watch in this region + 1 + + + + + RGN0RA + Disable read access watch in region[0] + 1 + 1 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Clear + Disable read access watch in this region + 1 + + + + + RGN1WA + Disable write access watch in region[1] + 2 + 2 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Clear + Disable write access watch in this region + 1 + + + + + RGN1RA + Disable read access watch in region[1] + 3 + 3 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Clear + Disable read access watch in this region + 1 + + + + + RGN2WA + Disable write access watch in region[2] + 4 + 4 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Clear + Disable write access watch in this region + 1 + + + + + RGN2RA + Disable read access watch in region[2] + 5 + 5 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Clear + Disable read access watch in this region + 1 + + + + + RGN3WA + Disable write access watch in region[3] + 6 + 6 + + read + + Disabled + Write access watch in this region is disabled + 0 + + + Enabled + Write access watch in this region is enabled + 1 + + + + write + + Clear + Disable write access watch in this region + 1 + + + + + RGN3RA + Disable read access watch in region[3] + 7 + 7 + + read + + Disabled + Read access watch in this region is disabled + 0 + + + Enabled + Read access watch in this region is enabled + 1 + + + + write + + Clear + Disable read access watch in this region + 1 + + + + + PRGN0WA + Disable write access watch in PREGION[0] + 24 + 24 + + read + + Disabled + Write access watch in this PREGION is disabled + 0 + + + Enabled + Write access watch in this PREGION is enabled + 1 + + + + write + + Clear + Disable write access watch in this PREGION + 1 + + + + + PRGN0RA + Disable read access watch in PREGION[0] + 25 + 25 + + read + + Disabled + Read access watch in this PREGION is disabled + 0 + + + Enabled + Read access watch in this PREGION is enabled + 1 + + + + write + + Clear + Disable read access watch in this PREGION + 1 + + + + + PRGN1WA + Disable write access watch in PREGION[1] + 26 + 26 + + read + + Disabled + Write access watch in this PREGION is disabled + 0 + + + Enabled + Write access watch in this PREGION is enabled + 1 + + + + write + + Clear + Disable write access watch in this PREGION + 1 + + + + + PRGN1RA + Disable read access watch in PREGION[1] + 27 + 27 + + read + + Disabled + Read access watch in this PREGION is disabled + 0 + + + Enabled + Read access watch in this PREGION is enabled + 1 + + + + write + + Clear + Disable read access watch in this PREGION + 1 + + + + + + + 4 + 16 + REGION[%s] + Unspecified + 0x600 + + START + Description cluster[0]: Start address for region 0 + 0x000 + read-write + 0x00000000 + + + START + Start address for region + 0 + 31 + + + + + END + Description cluster[0]: End address of region 0 + 0x004 + read-write + + + END + End address of region. + 0 + 31 + + + + + + 2 + 16 + PREGION[%s] + Unspecified + 0x6C0 + + START + Description cluster[0]: Reserved for future use + 0x000 + read-only + + + START + Reserved for future use + 0 + 31 + + + + + END + Description cluster[0]: Reserved for future use + 0x004 + read-only + + + END + Reserved for future use + 0 + 31 + + + + + SUBS + Description cluster[0]: Subregions of region 0 + 0x008 + read-write + 0x00000000 + + + SR0 + Include or exclude subregion 0 in region + 0 + 0 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR1 + Include or exclude subregion 1 in region + 1 + 1 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR2 + Include or exclude subregion 2 in region + 2 + 2 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR3 + Include or exclude subregion 3 in region + 3 + 3 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR4 + Include or exclude subregion 4 in region + 4 + 4 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR5 + Include or exclude subregion 5 in region + 5 + 5 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR6 + Include or exclude subregion 6 in region + 6 + 6 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR7 + Include or exclude subregion 7 in region + 7 + 7 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR8 + Include or exclude subregion 8 in region + 8 + 8 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR9 + Include or exclude subregion 9 in region + 9 + 9 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR10 + Include or exclude subregion 10 in region + 10 + 10 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR11 + Include or exclude subregion 11 in region + 11 + 11 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR12 + Include or exclude subregion 12 in region + 12 + 12 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR13 + Include or exclude subregion 13 in region + 13 + 13 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR14 + Include or exclude subregion 14 in region + 14 + 14 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR15 + Include or exclude subregion 15 in region + 15 + 15 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR16 + Include or exclude subregion 16 in region + 16 + 16 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR17 + Include or exclude subregion 17 in region + 17 + 17 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR18 + Include or exclude subregion 18 in region + 18 + 18 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR19 + Include or exclude subregion 19 in region + 19 + 19 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR20 + Include or exclude subregion 20 in region + 20 + 20 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR21 + Include or exclude subregion 21 in region + 21 + 21 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR22 + Include or exclude subregion 22 in region + 22 + 22 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR23 + Include or exclude subregion 23 in region + 23 + 23 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR24 + Include or exclude subregion 24 in region + 24 + 24 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR25 + Include or exclude subregion 25 in region + 25 + 25 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR26 + Include or exclude subregion 26 in region + 26 + 26 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR27 + Include or exclude subregion 27 in region + 27 + 27 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR28 + Include or exclude subregion 28 in region + 28 + 28 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR29 + Include or exclude subregion 29 in region + 29 + 29 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR30 + Include or exclude subregion 30 in region + 30 + 30 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + SR31 + Include or exclude subregion 31 in region + 31 + 31 + + + Exclude + Exclude + 0 + + + Include + Include + 1 + + + + + + + + + + PWM1 + Pulse Width Modulation Unit 1 + 0x40021000 + + PWM1 + 33 + + + + PWM2 + Pulse Width Modulation Unit 2 + 0x40022000 + + PWM2 + 34 + + + + SPIM2 + Serial Peripheral Interface Master with EasyDMA 2 + 0x40023000 + + SPIM2_SPIS2_SPI2 + 35 + + + + SPIS2 + SPI Slave 2 + 0x40023000 + SPIM2 + + SPIM2_SPIS2_SPI2 + 35 + + + + SPI2 + Serial Peripheral Interface 2 + 0x40023000 + SPIM2 + + SPIM2_SPIS2_SPI2 + 35 + + + + RTC2 + Real time counter 2 + 0x40024000 + + RTC2 + 36 + + + + I2S + Inter-IC Sound + I2S + 0x40025000 + 32 + + 0 + 0x1000 + registers + + + I2S + 37 + + + + TASKS_START + Starts continuous I2S transfer. Also starts MCK generator when this is enabled. + 0x000 + write-only + + + TASKS_STOP + Stops I2S transfer. Also stops MCK generator. Triggering this task will cause the {event:STOPPED} event to be generated. + 0x004 + write-only + + + EVENTS_RXPTRUPD + The RXD.PTR register has been copied to internal double-buffers. When the I2S module is started and RX is enabled, this event will be generated for every RXTXD.MAXCNT words that are received on the SDIN pin. + 0x104 + read-write + + + EVENTS_STOPPED + I2S transfer stopped. + 0x108 + read-write + + + EVENTS_TXPTRUPD + The TDX.PTR register has been copied to internal double-buffers. When the I2S module is started and TX is enabled, this event will be generated for every RXTXD.MAXCNT words that are sent on the SDOUT pin. + 0x114 + read-write + + + INTEN + Enable or disable interrupt + 0x300 + read-write + + + RXPTRUPD + Enable or disable interrupt for RXPTRUPD event + 1 + 1 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + STOPPED + Enable or disable interrupt for STOPPED event + 2 + 2 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + TXPTRUPD + Enable or disable interrupt for TXPTRUPD event + 5 + 5 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + INTENSET + Enable interrupt + 0x304 + read-write + + + RXPTRUPD + Write '1' to Enable interrupt for RXPTRUPD event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + STOPPED + Write '1' to Enable interrupt for STOPPED event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + TXPTRUPD + Write '1' to Enable interrupt for TXPTRUPD event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Set + Enable + 1 + + + + + + + INTENCLR + Disable interrupt + 0x308 + read-write + + + RXPTRUPD + Write '1' to Disable interrupt for RXPTRUPD event + 1 + 1 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + STOPPED + Write '1' to Disable interrupt for STOPPED event + 2 + 2 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + TXPTRUPD + Write '1' to Disable interrupt for TXPTRUPD event + 5 + 5 + + read + + Disabled + Read: Disabled + 0 + + + Enabled + Read: Enabled + 1 + + + + write + + Clear + Disable + 1 + + + + + + + ENABLE + Enable I2S module. + 0x500 + read-write + 0x00000000 + + + ENABLE + Enable I2S module. + 0 + 0 + + + Disabled + Disable + 0 + + + Enabled + Enable + 1 + + + + + + + CONFIG + Unspecified + 0x504 + + MODE + I2S mode. + 0x000 + read-write + 0x00000000 + + + MODE + I2S mode. + 0 + 0 + + + Master + Master mode. SCK and LRCK generated from internal master clcok (MCK) and output on pins defined by PSEL.xxx. + 0 + + + Slave + Slave mode. SCK and LRCK generated by external master and received on pins defined by PSEL.xxx + 1 + + + + + + + RXEN + Reception (RX) enable. + 0x004 + read-write + 0x00000000 + + + RXEN + Reception (RX) enable. + 0 + 0 + + + Disabled + Reception disabled and now data will be written to the RXD.PTR address. + 0 + + + Enabled + Reception enabled. + 1 + + + + + + + TXEN + Transmission (TX) enable. + 0x008 + read-write + 0x00000001 + + + TXEN + Transmission (TX) enable. + 0 + 0 + + + Disabled + Transmission disabled and now data will be read from the RXD.TXD address. + 0 + + + Enabled + Transmission enabled. + 1 + + + + + + + MCKEN + Master clock generator enable. + 0x00C + read-write + 0x00000001 + + + MCKEN + Master clock generator enable. + 0 + 0 + + + Disabled + Master clock generator disabled and PSEL.MCK not connected(available as GPIO). + 0 + + + Enabled + Master clock generator running and MCK output on PSEL.MCK. + 1 + + + + + + + MCKFREQ + Master clock generator frequency. + 0x010 + read-write + 0x20000000 + + + MCKFREQ + Master clock generator frequency. + 0 + 31 + + + 32MDIV2 + 32 MHz / 2 = 16.0 MHz + 0x80000000 + + + 32MDIV3 + 32 MHz / 3 = 10.6666667 MHz + 0x50000000 + + + 32MDIV4 + 32 MHz / 4 = 8.0 MHz + 0x40000000 + + + 32MDIV5 + 32 MHz / 5 = 6.4 MHz + 0x30000000 + + + 32MDIV6 + 32 MHz / 6 = 5.3333333 MHz + 0x28000000 + + + 32MDIV8 + 32 MHz / 8 = 4.0 MHz + 0x20000000 + + + 32MDIV10 + 32 MHz / 10 = 3.2 MHz + 0x18000000 + + + 32MDIV11 + 32 MHz / 11 = 2.9090909 MHz + 0x16000000 + + + 32MDIV15 + 32 MHz / 15 = 2.1333333 MHz + 0x11000000 + + + 32MDIV16 + 32 MHz / 16 = 2.0 MHz + 0x10000000 + + + 32MDIV21 + 32 MHz / 21 = 1.5238095 + 0x0C000000 + + + 32MDIV23 + 32 MHz / 23 = 1.3913043 MHz + 0x0B000000 + + + 32MDIV30 + 32 MHz / 30 = 1.0666667 MHz + 0x08800000 + + + 32MDIV31 + 32 MHz / 31 = 1.0322581 MHz + 0x08400000 + + + 32MDIV32 + 32 MHz / 32 = 1.0 MHz + 0x08000000 + + + 32MDIV42 + 32 MHz / 42 = 0.7619048 MHz + 0x06000000 + + + 32MDIV63 + 32 MHz / 63 = 0.5079365 MHz + 0x04100000 + + + 32MDIV125 + 32 MHz / 125 = 0.256 MHz + 0x020C0000 + + + + + + + RATIO + MCK / LRCK ratio. + 0x014 + read-write + 0x00000006 + + + RATIO + MCK / LRCK ratio. + 0 + 3 + + + 32X + LRCK = MCK / 32 + 0 + + + 48X + LRCK = MCK / 48 + 1 + + + 64X + LRCK = MCK / 64 + 2 + + + 96X + LRCK = MCK / 96 + 3 + + + 128X + LRCK = MCK / 128 + 4 + + + 192X + LRCK = MCK / 192 + 5 + + + 256X + LRCK = MCK / 256 + 6 + + + 384X + LRCK = MCK / 384 + 7 + + + 512X + LRCK = MCK / 512 + 8 + + + + + + + SWIDTH + Sample width. + 0x018 + read-write + 0x00000001 + + + SWIDTH + Sample width. + 0 + 1 + + + 8Bit + 8 bit. + 0 + + + 16Bit + 16 bit. + 1 + + + 24Bit + 24 bit. + 2 + + + + + + + ALIGN + Alignment of sample within a frame. + 0x01C + read-write + 0x00000000 + + + ALIGN + Alignment of sample within a frame. + 0 + 0 + + + Left + Left-aligned. + 0 + + + Right + Right-aligned. + 1 + + + + + + + FORMAT + Frame format. + 0x020 + read-write + 0x00000000 + + + FORMAT + Frame format. + 0 + 0 + + + I2S + Original I2S format. + 0 + + + Aligned + Alternate (left- or right-aligned) format. + 1 + + + + + + + CHANNELS + Enable channels. + 0x024 + read-write + 0x00000000 + + + CHANNELS + Enable channels. + 0 + 1 + + + Stereo + Stereo. + 0 + + + Left + Left only. + 1 + + + Right + Right only. + 2 + + + + + + + + RXD + Unspecified + 0x538 + + PTR + Receive buffer RAM start address. + 0x000 + read-write + 0x00000000 + + + PTR + Receive buffer Data RAM start address. When receiving, words containing samples will be written to this address. This address is a word aligned Data RAM address. + 0 + 31 + + + + + + TXD + Unspecified + 0x540 + + PTR + Transmit buffer RAM start address. + 0x000 + read-write + 0x00000000 + + + PTR + Transmit buffer Data RAM start address. When transmitting, words containing samples will be fetched from this address. This address is a word aligned Data RAM address. + 0 + 31 + + + + + + RXTXD + Unspecified + 0x550 + + MAXCNT + Size of RXD and TXD buffers. + 0x000 + read-write + 0x00000000 + + + MAXCNT + Size of RXD and TXD buffers in number of 32 bit words. + 0 + 13 + + + + + + PSEL + Unspecified + 0x560 + + MCK + Pin select for MCK signal. + 0x000 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SCK + Pin select for SCK signal. + 0x004 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + LRCK + Pin select for LRCK signal. + 0x008 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDIN + Pin select for SDIN signal. + 0x00C + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + SDOUT + Pin select for SDOUT signal. + 0x010 + read-write + 0xFFFFFFFF + + + PIN + Pin number + 0 + 4 + + + CONNECT + Connection + 31 + 31 + + + Disconnected + Disconnect + 1 + + + Connected + Connect + 0 + + + + + + + + + + FPU + FPU + FPU + 0x40026000 + 32 + + 0 + 0x1000 + registers + + + FPU + 38 + + + + UNUSED + Unused. + 0x000 + 0x00000000 + read-only + + + + + P0 + GPIO Port 1 + GPIO + 0x50000000 + 32 + GPIO + + 0 + 0x1000 + registers + + + + OUT + Write GPIO port + 0x504 + read-write + + + PIN0 + Pin 0 + 0 + 0 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + + Low + Pin driver is low + 0 + + + High + Pin driver is high + 1 + + + + + + + OUTSET + Set individual bits in GPIO port + 0x508 + read-write + oneToSet + + + PIN0 + Pin 0 + 0 + 0 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Set + Write: writing a '1' sets the pin high; writing a '0' has no effect + 1 + + + + + + + OUTCLR + Clear individual bits in GPIO port + 0x50C + read-write + oneToClear + + + PIN0 + Pin 0 + 0 + 0 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + read + + Low + Read: pin driver is low + 0 + + + High + Read: pin driver is high + 1 + + + + write + + Clear + Write: writing a '1' sets the pin low; writing a '0' has no effect + 1 + + + + + + + IN + Read GPIO port + 0x510 + read-only + + + PIN0 + Pin 0 + 0 + 0 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + + Low + Pin input is low + 0 + + + High + Pin input is high + 1 + + + + + + + DIR + Direction of GPIO pins + 0x514 + read-write + + + PIN0 + Pin 0 + 0 + 0 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN1 + Pin 1 + 1 + 1 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN2 + Pin 2 + 2 + 2 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN3 + Pin 3 + 3 + 3 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN4 + Pin 4 + 4 + 4 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN5 + Pin 5 + 5 + 5 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN6 + Pin 6 + 6 + 6 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN7 + Pin 7 + 7 + 7 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN8 + Pin 8 + 8 + 8 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN9 + Pin 9 + 9 + 9 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN10 + Pin 10 + 10 + 10 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN11 + Pin 11 + 11 + 11 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN12 + Pin 12 + 12 + 12 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN13 + Pin 13 + 13 + 13 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN14 + Pin 14 + 14 + 14 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN15 + Pin 15 + 15 + 15 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN16 + Pin 16 + 16 + 16 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN17 + Pin 17 + 17 + 17 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN18 + Pin 18 + 18 + 18 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN19 + Pin 19 + 19 + 19 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN20 + Pin 20 + 20 + 20 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN21 + Pin 21 + 21 + 21 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN22 + Pin 22 + 22 + 22 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN23 + Pin 23 + 23 + 23 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN24 + Pin 24 + 24 + 24 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN25 + Pin 25 + 25 + 25 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN26 + Pin 26 + 26 + 26 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN27 + Pin 27 + 27 + 27 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN28 + Pin 28 + 28 + 28 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN29 + Pin 29 + 29 + 29 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN30 + Pin 30 + 30 + 30 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + PIN31 + Pin 31 + 31 + 31 + + + Input + Pin set as input + 0 + + + Output + Pin set as output + 1 + + + + + + + DIRSET + DIR set register + 0x518 + read-write + oneToSet + + + PIN0 + Set as output pin 0 + 0 + 0 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN1 + Set as output pin 1 + 1 + 1 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN2 + Set as output pin 2 + 2 + 2 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN3 + Set as output pin 3 + 3 + 3 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN4 + Set as output pin 4 + 4 + 4 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN5 + Set as output pin 5 + 5 + 5 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN6 + Set as output pin 6 + 6 + 6 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN7 + Set as output pin 7 + 7 + 7 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN8 + Set as output pin 8 + 8 + 8 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN9 + Set as output pin 9 + 9 + 9 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN10 + Set as output pin 10 + 10 + 10 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN11 + Set as output pin 11 + 11 + 11 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN12 + Set as output pin 12 + 12 + 12 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN13 + Set as output pin 13 + 13 + 13 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN14 + Set as output pin 14 + 14 + 14 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN15 + Set as output pin 15 + 15 + 15 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN16 + Set as output pin 16 + 16 + 16 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN17 + Set as output pin 17 + 17 + 17 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN18 + Set as output pin 18 + 18 + 18 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN19 + Set as output pin 19 + 19 + 19 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN20 + Set as output pin 20 + 20 + 20 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN21 + Set as output pin 21 + 21 + 21 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN22 + Set as output pin 22 + 22 + 22 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN23 + Set as output pin 23 + 23 + 23 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN24 + Set as output pin 24 + 24 + 24 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN25 + Set as output pin 25 + 25 + 25 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN26 + Set as output pin 26 + 26 + 26 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN27 + Set as output pin 27 + 27 + 27 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN28 + Set as output pin 28 + 28 + 28 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN29 + Set as output pin 29 + 29 + 29 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN30 + Set as output pin 30 + 30 + 30 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + PIN31 + Set as output pin 31 + 31 + 31 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Set + Write: writing a '1' sets pin to output; writing a '0' has no effect + 1 + + + + + + + DIRCLR + DIR clear register + 0x51C + read-write + oneToClear + + + PIN0 + Set as input pin 0 + 0 + 0 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN1 + Set as input pin 1 + 1 + 1 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN2 + Set as input pin 2 + 2 + 2 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN3 + Set as input pin 3 + 3 + 3 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN4 + Set as input pin 4 + 4 + 4 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN5 + Set as input pin 5 + 5 + 5 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN6 + Set as input pin 6 + 6 + 6 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN7 + Set as input pin 7 + 7 + 7 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN8 + Set as input pin 8 + 8 + 8 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN9 + Set as input pin 9 + 9 + 9 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN10 + Set as input pin 10 + 10 + 10 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN11 + Set as input pin 11 + 11 + 11 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN12 + Set as input pin 12 + 12 + 12 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN13 + Set as input pin 13 + 13 + 13 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN14 + Set as input pin 14 + 14 + 14 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN15 + Set as input pin 15 + 15 + 15 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN16 + Set as input pin 16 + 16 + 16 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN17 + Set as input pin 17 + 17 + 17 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN18 + Set as input pin 18 + 18 + 18 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN19 + Set as input pin 19 + 19 + 19 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN20 + Set as input pin 20 + 20 + 20 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN21 + Set as input pin 21 + 21 + 21 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN22 + Set as input pin 22 + 22 + 22 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN23 + Set as input pin 23 + 23 + 23 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN24 + Set as input pin 24 + 24 + 24 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN25 + Set as input pin 25 + 25 + 25 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN26 + Set as input pin 26 + 26 + 26 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN27 + Set as input pin 27 + 27 + 27 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN28 + Set as input pin 28 + 28 + 28 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN29 + Set as input pin 29 + 29 + 29 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN30 + Set as input pin 30 + 30 + 30 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + PIN31 + Set as input pin 31 + 31 + 31 + + read + + Input + Read: pin set as input + 0 + + + Output + Read: pin set as output + 1 + + + + write + + Clear + Write: writing a '1' sets pin to input; writing a '0' has no effect + 1 + + + + + + + LATCH + Latch register indicating what GPIO pins that have met the criteria set in the PIN_CNF[n].SENSE registers + 0x520 + read-write + + + PIN0 + Status on whether PIN0 has met criteria set in PIN_CNF0.SENSE register. Write '1' to clear. + 0 + 0 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN1 + Status on whether PIN1 has met criteria set in PIN_CNF1.SENSE register. Write '1' to clear. + 1 + 1 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN2 + Status on whether PIN2 has met criteria set in PIN_CNF2.SENSE register. Write '1' to clear. + 2 + 2 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN3 + Status on whether PIN3 has met criteria set in PIN_CNF3.SENSE register. Write '1' to clear. + 3 + 3 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN4 + Status on whether PIN4 has met criteria set in PIN_CNF4.SENSE register. Write '1' to clear. + 4 + 4 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN5 + Status on whether PIN5 has met criteria set in PIN_CNF5.SENSE register. Write '1' to clear. + 5 + 5 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN6 + Status on whether PIN6 has met criteria set in PIN_CNF6.SENSE register. Write '1' to clear. + 6 + 6 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN7 + Status on whether PIN7 has met criteria set in PIN_CNF7.SENSE register. Write '1' to clear. + 7 + 7 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN8 + Status on whether PIN8 has met criteria set in PIN_CNF8.SENSE register. Write '1' to clear. + 8 + 8 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN9 + Status on whether PIN9 has met criteria set in PIN_CNF9.SENSE register. Write '1' to clear. + 9 + 9 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN10 + Status on whether PIN10 has met criteria set in PIN_CNF10.SENSE register. Write '1' to clear. + 10 + 10 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN11 + Status on whether PIN11 has met criteria set in PIN_CNF11.SENSE register. Write '1' to clear. + 11 + 11 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN12 + Status on whether PIN12 has met criteria set in PIN_CNF12.SENSE register. Write '1' to clear. + 12 + 12 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN13 + Status on whether PIN13 has met criteria set in PIN_CNF13.SENSE register. Write '1' to clear. + 13 + 13 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN14 + Status on whether PIN14 has met criteria set in PIN_CNF14.SENSE register. Write '1' to clear. + 14 + 14 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN15 + Status on whether PIN15 has met criteria set in PIN_CNF15.SENSE register. Write '1' to clear. + 15 + 15 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN16 + Status on whether PIN16 has met criteria set in PIN_CNF16.SENSE register. Write '1' to clear. + 16 + 16 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN17 + Status on whether PIN17 has met criteria set in PIN_CNF17.SENSE register. Write '1' to clear. + 17 + 17 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN18 + Status on whether PIN18 has met criteria set in PIN_CNF18.SENSE register. Write '1' to clear. + 18 + 18 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN19 + Status on whether PIN19 has met criteria set in PIN_CNF19.SENSE register. Write '1' to clear. + 19 + 19 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN20 + Status on whether PIN20 has met criteria set in PIN_CNF20.SENSE register. Write '1' to clear. + 20 + 20 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN21 + Status on whether PIN21 has met criteria set in PIN_CNF21.SENSE register. Write '1' to clear. + 21 + 21 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN22 + Status on whether PIN22 has met criteria set in PIN_CNF22.SENSE register. Write '1' to clear. + 22 + 22 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN23 + Status on whether PIN23 has met criteria set in PIN_CNF23.SENSE register. Write '1' to clear. + 23 + 23 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN24 + Status on whether PIN24 has met criteria set in PIN_CNF24.SENSE register. Write '1' to clear. + 24 + 24 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN25 + Status on whether PIN25 has met criteria set in PIN_CNF25.SENSE register. Write '1' to clear. + 25 + 25 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN26 + Status on whether PIN26 has met criteria set in PIN_CNF26.SENSE register. Write '1' to clear. + 26 + 26 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN27 + Status on whether PIN27 has met criteria set in PIN_CNF27.SENSE register. Write '1' to clear. + 27 + 27 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN28 + Status on whether PIN28 has met criteria set in PIN_CNF28.SENSE register. Write '1' to clear. + 28 + 28 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN29 + Status on whether PIN29 has met criteria set in PIN_CNF29.SENSE register. Write '1' to clear. + 29 + 29 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN30 + Status on whether PIN30 has met criteria set in PIN_CNF30.SENSE register. Write '1' to clear. + 30 + 30 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + PIN31 + Status on whether PIN31 has met criteria set in PIN_CNF31.SENSE register. Write '1' to clear. + 31 + 31 + + + NotLatched + Criteria has not been met + 0 + + + Latched + Criteria has been met + 1 + + + + + + + DETECTMODE + Select between default DETECT signal behaviour and LDETECT mode + 0x524 + read-write + + + DETECTMODE + Select between default DETECT signal behaviour and LDETECT mode + 0 + 0 + + + Default + DETECT directly connected to PIN DETECT signals + 0 + + + LDETECT + Use the latched LDETECT behaviour + 1 + + + + + + + 32 + 4 + PIN_CNF[%s] + Description collection[0]: Configuration of GPIO pins + 0x700 + read-write + 0x00000002 + + + DIR + Pin direction. Same physical register as DIR register + 0 + 0 + + + Input + Configure pin as an input pin + 0 + + + Output + Configure pin as an output pin + 1 + + + + + INPUT + Connect or disconnect input buffer + 1 + 1 + + + Connect + Connect input buffer + 0 + + + Disconnect + Disconnect input buffer + 1 + + + + + PULL + Pull configuration + 2 + 3 + + + Disabled + No pull + 0 + + + Pulldown + Pull down on pin + 1 + + + Pullup + Pull up on pin + 3 + + + + + DRIVE + Drive configuration + 8 + 10 + + + S0S1 + Standard '0', standard '1' + 0 + + + H0S1 + High drive '0', standard '1' + 1 + + + S0H1 + Standard '0', high drive '1' + 2 + + + H0H1 + High drive '0', high 'drive '1'' + 3 + + + D0S1 + Disconnect '0' standard '1' (normally used for wired-or connections) + 4 + + + D0H1 + Disconnect '0', high drive '1' (normally used for wired-or connections) + 5 + + + S0D1 + Standard '0'. disconnect '1' (normally used for wired-and connections) + 6 + + + H0D1 + High drive '0', disconnect '1' (normally used for wired-and connections) + 7 + + + + + SENSE + Pin sensing mechanism + 16 + 17 + + + Disabled + Disabled + 0 + + + High + Sense for high level + 2 + + + Low + Sense for low level + 3 + + + + + + + + + \ No newline at end of file -- cgit v0.10.2 From 03bb433e04fe74a682c3e595fa6bfd83c8130174 Mon Sep 17 00:00:00 2001 From: Avamander Date: Sat, 3 Oct 2020 18:53:00 +0300 Subject: Added a code style configuration to the repository diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 0000000..b3b93de --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file -- cgit v0.10.2 From e4f0a95af8ce6cfb71602c5f5e437ab68dd582ec Mon Sep 17 00:00:00 2001 From: JF Date: Sun, 4 Oct 2020 12:52:48 +0200 Subject: Add coding conventions in contribute.md diff --git a/doc/contribute.md b/doc/contribute.md index 53c6ac0..40441cd 100644 --- a/doc/contribute.md +++ b/doc/contribute.md @@ -21,4 +21,24 @@ Then, you can submit a pull-request for review. Try to describe your pull reques Other contributors can post comments about the pull request, maybe ask for more info or adjustements in the code. -Once the pull request is reviewed an accepted, it'll be merge in **develop** and will be released in the next release version of the firmware. \ No newline at end of file +Once the pull request is reviewed an accepted, it'll be merge in **develop** and will be released in the next release version of the firmware. + +# Coding convention +## Language +The language of this project is **C++**, and all new code must be written in C++. (Modern) C++ provides a lot of useful tools and functionalities that are beneficial for embedded software development like `constexpr`, `template` and anything that provides zero-cost abstraction. + +It's OK to include C code if this code comes from another library like FreeRTOS, NimBLE, LVGL or the NRF-SDK. + +## Coding style +The most important rule to follow is to try to keep the code as easy to read and maintain as possible. + + - **Identation** : 2 spaces, no tabulation + - **Opening brace** at the end of the line + - **Naming** : Choose self-describing variable name + - **class** : PascalCase + - **namespace** : PascalCase + - **variable** : camelCase, **no** prefix/suffix ('_', 'm_',...) for class members + - **Include guard** : `#pragma once` (no `#ifdef __MODULE__ / #define __MODULE__ / #endif`) + - **Includes** : + - files from the project : `#include "relative/path/to/the/file.h"` + - external files and std : `#include ` \ No newline at end of file -- cgit v0.10.2 From 13da1e38f019ef8989df1423164bd080768a7e04 Mon Sep 17 00:00:00 2001 From: Avamander Date: Sun, 4 Oct 2020 14:53:11 +0300 Subject: Switched from NULL to nullptr diff --git a/src/displayapp/screens/Brightness.cpp b/src/displayapp/screens/Brightness.cpp index 9e3416c..8ea9a77 100644 --- a/src/displayapp/screens/Brightness.cpp +++ b/src/displayapp/screens/Brightness.cpp @@ -11,15 +11,15 @@ void slider_event_cb(lv_obj_t * slider, lv_event_t event) { } Brightness::Brightness(Pinetime::Applications::DisplayApp *app, Controllers::BrightnessController& brightness) : Screen(app), brightness{brightness} { - slider = lv_slider_create(lv_scr_act(), NULL); + slider = lv_slider_create(lv_scr_act(), nullptr); lv_obj_set_user_data(slider, this); lv_obj_set_width(slider, LV_DPI * 2); - lv_obj_align(slider, NULL, LV_ALIGN_CENTER, 0, 0); + lv_obj_align(slider, nullptr, LV_ALIGN_CENTER, 0, 0); lv_obj_set_event_cb(slider, slider_event_cb); lv_slider_set_range(slider, 0, 2); lv_slider_set_value(slider, LevelToInt(brightness.Level()), LV_ANIM_OFF); - slider_label = lv_label_create(lv_scr_act(), NULL); + slider_label = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(slider_label, LevelToString(brightness.Level())); lv_obj_set_auto_realign(slider_label, true); lv_obj_align(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 243d4c0..bb14d52 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -29,28 +29,28 @@ Clock::Clock(DisplayApp* app, displayedChar[3] = 0; displayedChar[4] = 0; - batteryIcon = lv_label_create(lv_scr_act(), NULL); + batteryIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(batteryIcon, Symbols::batteryFull); lv_obj_align(batteryIcon, lv_scr_act(), LV_ALIGN_IN_TOP_RIGHT, -5, 2); - batteryPlug = lv_label_create(lv_scr_act(), NULL); + batteryPlug = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(batteryPlug, Symbols::plug); lv_obj_align(batteryPlug, batteryIcon, LV_ALIGN_OUT_LEFT_MID, -5, 0); - bleIcon = lv_label_create(lv_scr_act(), NULL); + bleIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(bleIcon, Symbols::bluetooth); lv_obj_align(bleIcon, batteryPlug, LV_ALIGN_OUT_LEFT_MID, -5, 0); - label_date = lv_label_create(lv_scr_act(), NULL); + label_date = lv_label_create(lv_scr_act(), nullptr); lv_obj_align(label_date, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 60); - label_time = lv_label_create(lv_scr_act(), NULL); + label_time = lv_label_create(lv_scr_act(), nullptr); lv_label_set_style(label_time, LV_LABEL_STYLE_MAIN, LabelBigStyle); lv_obj_align(label_time, lv_scr_act(), LV_ALIGN_IN_LEFT_MID, 0, 0); - backgroundLabel = lv_label_create(lv_scr_act(), NULL); + backgroundLabel = lv_label_create(lv_scr_act(), nullptr); backgroundLabel->user_data = this; lv_obj_set_click(backgroundLabel, true); lv_obj_set_event_cb(backgroundLabel, event_handler); @@ -60,23 +60,23 @@ Clock::Clock(DisplayApp* app, lv_label_set_text(backgroundLabel, ""); - heartbeatIcon = lv_label_create(lv_scr_act(), NULL); + heartbeatIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(heartbeatIcon, Symbols::heartBeat); lv_obj_align(heartbeatIcon, lv_scr_act(), LV_ALIGN_IN_BOTTOM_LEFT, 5, -2); - heartbeatValue = lv_label_create(lv_scr_act(), NULL); + heartbeatValue = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(heartbeatValue, "0"); lv_obj_align(heartbeatValue, heartbeatIcon, LV_ALIGN_OUT_RIGHT_MID, 5, 0); - heartbeatBpm = lv_label_create(lv_scr_act(), NULL); + heartbeatBpm = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(heartbeatBpm, "BPM"); lv_obj_align(heartbeatBpm, heartbeatValue, LV_ALIGN_OUT_RIGHT_MID, 5, 0); - stepValue = lv_label_create(lv_scr_act(), NULL); + stepValue = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(stepValue, "0"); lv_obj_align(stepValue, lv_scr_act(), LV_ALIGN_IN_BOTTOM_RIGHT, -5, -2); - stepIcon = lv_label_create(lv_scr_act(), NULL); + stepIcon = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(stepIcon, Symbols::shoe); lv_obj_align(stepIcon, stepValue, LV_ALIGN_OUT_LEFT_MID, -5, 0); } diff --git a/src/displayapp/screens/DropDownDemo.cpp b/src/displayapp/screens/DropDownDemo.cpp index 735a0cc..ce3acd5 100644 --- a/src/displayapp/screens/DropDownDemo.cpp +++ b/src/displayapp/screens/DropDownDemo.cpp @@ -9,7 +9,7 @@ extern lv_font_t jetbrains_mono_bold_20; 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(), NULL); + ddlist = lv_ddlist_create(lv_scr_act(), nullptr); lv_ddlist_set_options(ddlist, "Apple\n" "Banana\n" "Orange\n" @@ -24,7 +24,7 @@ DropDownDemo::DropDownDemo(Pinetime::Applications::DisplayApp *app) : Screen(app lv_ddlist_set_fix_width(ddlist, 150); lv_ddlist_set_draw_arrow(ddlist, true); lv_ddlist_set_fix_height(ddlist, 150); - lv_obj_align(ddlist, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); + lv_obj_align(ddlist, nullptr, LV_ALIGN_IN_TOP_MID, 0, 20); } DropDownDemo::~DropDownDemo() { diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp index e831114..778409e 100644 --- a/src/displayapp/screens/FirmwareUpdate.cpp +++ b/src/displayapp/screens/FirmwareUpdate.cpp @@ -10,19 +10,19 @@ extern lv_font_t jetbrains_mono_bold_20; FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::Ble& bleController) : Screen(app), bleController{bleController} { - titleLabel = lv_label_create(lv_scr_act(), NULL); + titleLabel = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(titleLabel, "Firmware update"); lv_obj_set_auto_realign(titleLabel, true); - lv_obj_align(titleLabel, NULL, LV_ALIGN_IN_TOP_MID, 0, 50); + lv_obj_align(titleLabel, nullptr, LV_ALIGN_IN_TOP_MID, 0, 50); - bar1 = lv_bar_create(lv_scr_act(), NULL); + bar1 = lv_bar_create(lv_scr_act(), nullptr); lv_obj_set_size(bar1, 200, 30); - lv_obj_align(bar1, NULL, LV_ALIGN_CENTER, 0, 0); + lv_obj_align(bar1, nullptr, LV_ALIGN_CENTER, 0, 0); lv_bar_set_anim_time(bar1, 10); lv_bar_set_range(bar1, 0, 100); lv_bar_set_value(bar1, 0, LV_ANIM_OFF); - percentLabel = lv_label_create(lv_scr_act(), NULL); + percentLabel = lv_label_create(lv_scr_act(), nullptr); lv_label_set_text(percentLabel, ""); lv_obj_set_auto_realign(percentLabel, true); lv_obj_align(percentLabel, bar1, LV_ALIGN_OUT_TOP_MID, 0, 60); diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp index 2300b41..4ac399f 100644 --- a/src/displayapp/screens/FirmwareValidation.cpp +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -20,20 +20,20 @@ namespace { FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app, Pinetime::Controllers::FirmwareValidator &validator) : Screen{app}, validator{validator} { - labelVersionInfo = lv_label_create(lv_scr_act(), NULL); - lv_obj_align(labelVersionInfo, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0); + 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(), NULL); + 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); sprintf(version, "%ld.%ld.%ld", Version::Major(), Version::Minor(), Version::Patch()); lv_label_set_text(labelVersionValue, version); - labelIsValidated = lv_label_create(lv_scr_act(), NULL); - lv_obj_align(labelIsValidated, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 50); + labelIsValidated = lv_label_create(lv_scr_act(), nullptr); + lv_obj_align(labelIsValidated, nullptr, LV_ALIGN_IN_TOP_LEFT, 0, 50); lv_label_set_recolor(labelIsValidated, true); lv_label_set_long_mode(labelIsValidated, LV_LABEL_LONG_BREAK); lv_obj_set_width(labelIsValidated, 240); @@ -44,21 +44,21 @@ FirmwareValidation::FirmwareValidation(Pinetime::Applications::DisplayApp *app, 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(), NULL); + buttonValidate = lv_btn_create(lv_scr_act(), nullptr); lv_obj_align(buttonValidate, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0); buttonValidate->user_data = this; lv_obj_set_event_cb(buttonValidate, ButtonEventHandler); - labelButtonValidate = lv_label_create(buttonValidate, NULL); + labelButtonValidate = lv_label_create(buttonValidate, nullptr); lv_label_set_recolor(labelButtonValidate, true); lv_label_set_text(labelButtonValidate, "#00ff00 Validate#"); - buttonReset = lv_btn_create(lv_scr_act(), NULL); + buttonReset = lv_btn_create(lv_scr_act(), nullptr); buttonReset->user_data = this; - lv_obj_align(buttonReset, NULL, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); + lv_obj_align(buttonReset, nullptr, LV_ALIGN_IN_BOTTOM_RIGHT, 0, 0); lv_obj_set_event_cb(buttonReset, ButtonEventHandler); - labelButtonReset = lv_label_create(buttonReset, NULL); + labelButtonReset = lv_label_create(buttonReset, nullptr); lv_label_set_recolor(labelButtonReset, true); lv_label_set_text(labelButtonReset, "#ff0000 Reset#"); } diff --git a/src/displayapp/screens/Gauge.cpp b/src/displayapp/screens/Gauge.cpp index fd90523..81c283c 100644 --- a/src/displayapp/screens/Gauge.cpp +++ b/src/displayapp/screens/Gauge.cpp @@ -25,11 +25,11 @@ Gauge::Gauge(Pinetime::Applications::DisplayApp *app) : Screen(app) { needle_colors[0] = LV_COLOR_ORANGE; /*Create a gauge*/ - gauge1 = lv_gauge_create(lv_scr_act(), NULL); + gauge1 = lv_gauge_create(lv_scr_act(), nullptr); lv_gauge_set_style(gauge1, LV_GAUGE_STYLE_MAIN, &style); lv_gauge_set_needle_count(gauge1, 1, needle_colors); lv_obj_set_size(gauge1, 180, 180); - lv_obj_align(gauge1, NULL, LV_ALIGN_CENTER, 0, 0); + lv_obj_align(gauge1, nullptr, LV_ALIGN_CENTER, 0, 0); lv_gauge_set_scale(gauge1, 360, 60, 0); lv_gauge_set_range(gauge1, 0, 59); diff --git a/src/displayapp/screens/Label.cpp b/src/displayapp/screens/Label.cpp index 780ee88..540776c 100644 --- a/src/displayapp/screens/Label.cpp +++ b/src/displayapp/screens/Label.cpp @@ -4,7 +4,7 @@ using namespace Pinetime::Applications::Screens; Label::Label(Pinetime::Applications::DisplayApp *app, const char *text) : Screen(app), text{text} { - label = lv_label_create(lv_scr_act(), NULL); + label = lv_label_create(lv_scr_act(), nullptr); lv_label_set_align(label, LV_LABEL_ALIGN_LEFT); lv_obj_set_size(label, 240, 240); lv_label_set_text(label, text); diff --git a/src/displayapp/screens/Meter.cpp b/src/displayapp/screens/Meter.cpp index c74b8bd..273e111 100644 --- a/src/displayapp/screens/Meter.cpp +++ b/src/displayapp/screens/Meter.cpp @@ -17,14 +17,14 @@ Meter::Meter(Pinetime::Applications::DisplayApp *app) : Screen(app) { style_lmeter.body.padding.left = 16; /*Line length*/ /*Create a line meter */ - lmeter = lv_lmeter_create(lv_scr_act(), NULL); + lmeter = lv_lmeter_create(lv_scr_act(), nullptr); lv_lmeter_set_range(lmeter, 0, 60); /*Set the range*/ lv_lmeter_set_value(lmeter, value); /*Set the current value*/ lv_lmeter_set_angle_offset(lmeter, 180); lv_lmeter_set_scale(lmeter, 360, 60); /*Set the angle and number of lines*/ lv_lmeter_set_style(lmeter, LV_LMETER_STYLE_MAIN, &style_lmeter); /*Apply the new style*/ lv_obj_set_size(lmeter, 150, 150); - lv_obj_align(lmeter, NULL, LV_ALIGN_CENTER, 0, 0); + lv_obj_align(lmeter, nullptr, LV_ALIGN_CENTER, 0, 0); } diff --git a/src/displayapp/screens/Modal.cpp b/src/displayapp/screens/Modal.cpp index 63ae70c..29f7bfa 100644 --- a/src/displayapp/screens/Modal.cpp +++ b/src/displayapp/screens/Modal.cpp @@ -54,7 +54,7 @@ void Modal::Show(const char* msg) { modal_style.body.main_color = modal_style.body.grad_color = LV_COLOR_BLACK; modal_style.body.opa = LV_OPA_50; - obj = lv_obj_create(lv_scr_act(), NULL); + obj = lv_obj_create(lv_scr_act(), nullptr); lv_obj_set_style(obj, &modal_style); lv_obj_set_pos(obj, 0, 0); lv_obj_set_size(obj, LV_HOR_RES, LV_VER_RES); @@ -63,10 +63,10 @@ void Modal::Show(const char* msg) { static const char * btns2[] = {"Ok", ""}; /* Create the message box as a child of the modal background */ - mbox = lv_mbox_create(obj, NULL); + mbox = lv_mbox_create(obj, nullptr); lv_mbox_add_btns(mbox, btns2); lv_mbox_set_text(mbox, msg); - lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0); + lv_obj_align(mbox, nullptr, LV_ALIGN_CENTER, 0, 0); lv_obj_set_event_cb(mbox, Modal::mbox_event_cb); mbox->user_data = this; diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index deb8847..75fa6ef 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -30,7 +30,7 @@ Tile::Tile(DisplayApp* app, std::array& applications) : Screen( } modal.reset(new Modal(app)); - btnm1 = lv_btnm_create(lv_scr_act(), NULL); + btnm1 = lv_btnm_create(lv_scr_act(), nullptr); lv_btnm_set_map(btnm1, btnm_map1); lv_obj_set_size(btnm1, LV_HOR_RES, LV_VER_RES); -- cgit v0.10.2 From e85d1ffc625c73dcbb30c783707bfb6110af6a41 Mon Sep 17 00:00:00 2001 From: Avamander Date: Sun, 4 Oct 2020 15:09:17 +0300 Subject: Replaced NULL with nullptr diff --git a/src/systemtask/SystemMonitor.h b/src/systemtask/SystemMonitor.h index ec1fd81..029a136 100644 --- a/src/systemtask/SystemMonitor.h +++ b/src/systemtask/SystemMonitor.h @@ -27,7 +27,7 @@ namespace Pinetime { void Process() const { if(xTaskGetTickCount() - lastTick > 10000) { NRF_LOG_INFO("---------------------------------------\nFree heap : %d", xPortGetFreeHeapSize()); - auto nb = uxTaskGetSystemState(tasksStatus, 10, NULL); + 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) -- cgit v0.10.2 From 1d96758acd4e3bf03c3e733a3a95d0deb74f6042 Mon Sep 17 00:00:00 2001 From: Avamander Date: Sun, 4 Oct 2020 15:11:21 +0300 Subject: Minor #include improvements diff --git a/src/displayapp/screens/Tab.cpp b/src/displayapp/screens/Tab.cpp index adc3257..44b806c 100644 --- a/src/displayapp/screens/Tab.cpp +++ b/src/displayapp/screens/Tab.cpp @@ -1,13 +1,13 @@ #include #include -#include +#include "components/datetime/DateTimeController.h" #include #include #include #include #include #include "Tab.h" -#include +#include "displayapp/DisplayApp.h" using namespace Pinetime::Applications::Screens; diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 68f8ab5..0ed99f8 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -11,7 +11,7 @@ #include #include #include -#include "../main.h" +#include "main.h" #include "components/ble/NimbleController.h" using namespace Pinetime::System; @@ -36,7 +36,7 @@ SystemTask::SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd, bleController{bleController}, dateTimeController{dateTimeController}, watchdog{}, watchdogView{watchdog}, notificationManager{notificationManager}, nimbleController(*this, bleController,dateTimeController, notificationManager, batteryController, spiNorFlash) { - systemTaksMsgQueue = xQueueCreate(10, 1); + systemTasksMsgQueue = xQueueCreate(10, 1); } void SystemTask::Start() { @@ -102,7 +102,7 @@ void SystemTask::Work() { while(true) { uint8_t msg; - if (xQueueReceive(systemTaksMsgQueue, &msg, isSleeping?2500 : 1000)) { + if (xQueueReceive(systemTasksMsgQueue, &msg, isSleeping ? 2500 : 1000)) { Messages message = static_cast(msg); switch(message) { case Messages::GoToRunning: @@ -191,6 +191,8 @@ void SystemTask::Work() { if(!nrf_gpio_pin_read(pinButton)) watchdog.Kick(); } + // Clear diagnostic suppression + #pragma clang diagnostic pop } void SystemTask::OnButtonPushed() { @@ -228,7 +230,7 @@ void SystemTask::PushMessage(SystemTask::Messages msg) { } BaseType_t xHigherPriorityTaskWoken; xHigherPriorityTaskWoken = pdFALSE; - xQueueSendFromISR(systemTaksMsgQueue, &msg, &xHigherPriorityTaskWoken); + xQueueSendFromISR(systemTasksMsgQueue, &msg, &xHigherPriorityTaskWoken); if (xHigherPriorityTaskWoken) { /* Actual macro used here is port specific. */ // TODO : should I do something here? -- cgit v0.10.2 From 9b7ba7b5b84072e5abbb0c77c7ea5c52cbbb1098 Mon Sep 17 00:00:00 2001 From: Avamander Date: Sun, 4 Oct 2020 15:13:01 +0300 Subject: Fixed a typo in SystemTask diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 68f8ab5..bb3a772 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -36,7 +36,7 @@ SystemTask::SystemTask(Drivers::SpiMaster &spi, Drivers::St7789 &lcd, bleController{bleController}, dateTimeController{dateTimeController}, watchdog{}, watchdogView{watchdog}, notificationManager{notificationManager}, nimbleController(*this, bleController,dateTimeController, notificationManager, batteryController, spiNorFlash) { - systemTaksMsgQueue = xQueueCreate(10, 1); + systemTasksMsgQueue = xQueueCreate(10, 1); } void SystemTask::Start() { @@ -102,7 +102,7 @@ void SystemTask::Work() { while(true) { uint8_t msg; - if (xQueueReceive(systemTaksMsgQueue, &msg, isSleeping?2500 : 1000)) { + if (xQueueReceive(systemTasksMsgQueue, &msg, isSleeping?2500 : 1000)) { Messages message = static_cast(msg); switch(message) { case Messages::GoToRunning: @@ -228,7 +228,7 @@ void SystemTask::PushMessage(SystemTask::Messages msg) { } BaseType_t xHigherPriorityTaskWoken; xHigherPriorityTaskWoken = pdFALSE; - xQueueSendFromISR(systemTaksMsgQueue, &msg, &xHigherPriorityTaskWoken); + xQueueSendFromISR(systemTasksMsgQueue, &msg, &xHigherPriorityTaskWoken); if (xHigherPriorityTaskWoken) { /* Actual macro used here is port specific. */ // TODO : should I do something here? diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 1be28e3..6ef0cfb 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -54,7 +54,7 @@ namespace Pinetime { std::unique_ptr displayApp; Pinetime::Controllers::Ble& bleController; Pinetime::Controllers::DateTime& dateTimeController; - QueueHandle_t systemTaksMsgQueue; + QueueHandle_t systemTasksMsgQueue; std::atomic isSleeping{false}; std::atomic isGoingToSleep{false}; std::atomic isWakingUp{false}; -- cgit v0.10.2 From 77f4d5448bb05287a3802ce3511817fc27a825ab Mon Sep 17 00:00:00 2001 From: Avamander Date: Sun, 4 Oct 2020 15:14:09 +0300 Subject: Fixed a small warning with Screen's constructor diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h index dbf81a4..0a17b4d 100644 --- a/src/displayapp/screens/Screen.h +++ b/src/displayapp/screens/Screen.h @@ -9,7 +9,7 @@ namespace Pinetime { namespace Screens { class Screen { public: - Screen(DisplayApp* app) : app{app} {} + explicit Screen(DisplayApp* app) : app{app} {} virtual ~Screen() = default; // Return false if the app can be closed, true if it must continue to run -- cgit v0.10.2 From cc3a9f3c793b943eb633f7c914e654ae19b77b9b Mon Sep 17 00:00:00 2001 From: Avamander Date: Sun, 4 Oct 2020 18:46:34 +0300 Subject: Removed an incomplete message() call from CMakeLists.txt diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2f38ec5..961dedb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -747,7 +747,6 @@ elseif (USE_OPENOCD) COMMENT "flashing ${EXECUTABLE_NAME}.hex" ) else () - message() add_custom_target(FLASH_ERASE COMMAND ${OPENOCD_BIN_PATH} -f interface/stlink.cfg -c 'transport select hla_swd' -f target/nrf52.cfg -c init -c halt -c 'nrf5 mass_erase' -c reset -c shutdown COMMENT "erasing flashing" -- cgit v0.10.2 From c4599dbf90d10cf140579388a400b2d5ffd9ff58 Mon Sep 17 00:00:00 2001 From: Maarten de Jong <35239587+arteeh@users.noreply.github.com> Date: Tue, 6 Oct 2020 21:10:51 +0200 Subject: Fix typo GCC output file is .out instead of .bin diff --git a/doc/filesInReleaseNotes.md b/doc/filesInReleaseNotes.md index d293051..2fdfadf 100644 --- a/doc/filesInReleaseNotes.md +++ b/doc/filesInReleaseNotes.md @@ -42,7 +42,7 @@ This firmware is intended to be used with our [MCUBoot-based bootloader](../boot The following files are not directly usable by the bootloader: - - **pinetime-mcuboot-app.bin** : Output file of GCC containing debug symbols, useful is you want to debug the firmware using GDB. + - **pinetime-mcuboot-app.out** : Output file of GCC containing debug symbols, useful is you want to debug the firmware using GDB. - **pinetime-mcuboot-app.hex** : Firmware in Intel HEX file format. - **pinetime-mcuboot-app.bin** : Firmware in binary format. - **pinetime-mcuboot-app.map** : Map file containing all the symbols, addresses in memory,... -- cgit v0.10.2 From f68c7b65b31f0bb7ff729740a29d5796b2c04f01 Mon Sep 17 00:00:00 2001 From: Avamander Date: Sun, 4 Oct 2020 15:08:48 +0300 Subject: Minor formatting, diagnostic and documentation changes diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 961dedb..cd37810 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -552,7 +552,7 @@ link_directories( ) -set(COMMON_FLAGS -MP -MD -mthumb -mabi=aapcs -Wall -g3 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wreturn-type -Werror=return-type) +set(COMMON_FLAGS -MP -MD -mthumb -mabi=aapcs -Wall -Wno-unknown-pragmas -g3 -ffunction-sections -fdata-sections -fno-strict-aliasing -fno-builtin --short-enums -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wreturn-type -Werror=return-type) add_definitions(-DCONFIG_GPIO_AS_PINRESET) add_definitions(-DDEBUG) add_definitions(-DNIMBLE_CFG_CONTROLLER) diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp index b340f5d..312bb93 100644 --- a/src/displayapp/screens/InfiniPaint.cpp +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -7,9 +7,9 @@ using namespace Pinetime::Applications::Screens; extern lv_font_t jetbrains_mono_extrabold_compressed; extern lv_font_t jetbrains_mono_bold_20; -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, LV_COLOR_WHITE); + std::fill(b, b + bufferSize, LV_COLOR_WHITE); } InfiniPaint::~InfiniPaint() { @@ -33,10 +33,10 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) { bool InfiniPaint::OnTouchEvent(uint16_t x, uint16_t y) { lv_area_t area; - area.x1 = x-(width/2); - area.y1 = y-(height/2); - area.x2 = x+(width/2)-1; - area.y2 = y+(height/2)-1; + area.x1 = x - (width / 2); + area.y1 = y - (height / 2); + area.x2 = x + (width / 2) - 1; + area.y2 = y + (height / 2) - 1; lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::None); lvgl.FlushDisplay(&area, b); return true; diff --git a/src/displayapp/screens/Screen.h b/src/displayapp/screens/Screen.h index 0a17b4d..6b1d0ee 100644 --- a/src/displayapp/screens/Screen.h +++ b/src/displayapp/screens/Screen.h @@ -12,13 +12,25 @@ namespace Pinetime { explicit Screen(DisplayApp* app) : app{app} {} virtual ~Screen() = default; - // Return false if the app can be closed, true if it must continue to run + /** + * 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 + /** @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 + /** @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; } diff --git a/src/logging/NrfLogger.cpp b/src/logging/NrfLogger.cpp index 7ccacc8..0d95c06 100644 --- a/src/logging/NrfLogger.cpp +++ b/src/logging/NrfLogger.cpp @@ -19,10 +19,15 @@ 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" 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 } void NrfLogger::Resume() { diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index c0552d5..01942da 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -100,6 +100,9 @@ void SystemTask::Work() { idleTimer = xTimerCreate ("idleTimer", idleTime, pdFALSE, this, IdleTimerCallback); xTimerStart(idleTimer, 0); + // Suppress endless loop diagnostic + #pragma clang diagnostic push + #pragma ide diagnostic ignored "EndlessLoop" while(true) { uint8_t msg; if (xQueueReceive(systemTasksMsgQueue, &msg, isSleeping ? 2500 : 1000)) { @@ -231,7 +234,7 @@ void SystemTask::PushMessage(SystemTask::Messages msg) { xQueueSendFromISR(systemTasksMsgQueue, &msg, &xHigherPriorityTaskWoken); if (xHigherPriorityTaskWoken) { /* Actual macro used here is port specific. */ - // TODO : should I do something here? + // TODO: should I do something here? } } -- cgit v0.10.2 From 189c5a83b2599dd843b06d2cccdc1f28a89d404f Mon Sep 17 00:00:00 2001 From: Avamander Date: Sun, 4 Oct 2020 16:24:52 +0300 Subject: Made sure to unsuppress the diagnostic check after the infinite loop declaration diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 01942da..3efe21b 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -194,6 +194,8 @@ void SystemTask::Work() { if(!nrf_gpio_pin_read(pinButton)) watchdog.Kick(); } + // Clear diagnostic suppression + #pragma clang diagnostic pop } void SystemTask::OnButtonPushed() { -- cgit v0.10.2 From 1c645b776a7c13ea03caba5d0547e073ed0faeae Mon Sep 17 00:00:00 2001 From: Avamander Date: Fri, 9 Oct 2020 11:34:28 +0300 Subject: Improved code formatting rules diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index b3b93de..7bdfbcb 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -7,6 +7,10 @@