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