From 4e6830d9c0c190f57e3fed5947ecaa57b6197388 Mon Sep 17 00:00:00 2001 From: Caisking <3449750381@qq.com> Date: Wed, 2 Oct 2024 16:34:02 +0800 Subject: [PATCH] =?utf8?q?=E7=B3=BB=E7=BB=9F=EF=BC=9A=E5=A2=9E=E5=8A=A0?= =?utf8?q?=E8=AF=BB=E5=86=99=E9=94=81=E7=8A=B6=E6=80=81=EF=BC=88=E7=94=B1?= =?utf8?q?=E5=90=84=E6=A8=A1=E5=9D=97=E5=AD=98=E5=82=A8=E5=86=B3=E5=AE=9A?= =?utf8?q?=E7=8A=B6=E6=80=81=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../drivers/peripheral/utils/custom_runtime.c | 63 +++++++++++++++++++ .../drivers/peripheral/utils/custom_runtime.h | 33 ++++++++++ 2 files changed, 96 insertions(+) diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.c b/code/sdk/drivers/peripheral/utils/custom_runtime.c index 914c784e4..5d10349ce 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.c +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.c @@ -1,5 +1,6 @@ #include "custom_runtime.h" #include "chip_system_time.h" +#include @@ -86,6 +87,12 @@ typedef struct uint8_t repair_download_status;//升级下载状态 uint8_t hrs_passivity_status;//获取被动心率检测状态 uint8_t mmc_status; //是否为指南针页面 + //读写锁 + uint8_t rwlock_status;//手表状态(存储) + uint8_t lock_flag_training;//训练 + uint8_t lock_flag_heartrate;//心率 + uint8_t lock_flag_blood;//血氧 + } runtime_status_t; @@ -440,6 +447,62 @@ uint8_t uapi_dev_runtime_get_safemode_flag(void) return g_runtime.enter_safemode; } +//读写锁状态 +void uapi_dev_runtime_set_rwlock_status(uint8_t status) +{ + // 不能有set + // g_runtime.rwlock_status = status; +} +uint8_t uapi_dev_runtime_get_rwlock_status(void) +{ + //读写状态取决与所有的模块存储状态 + g_runtime.rwlock_status = 0; + if(g_runtime.lock_flag_training) + { + //运动存储 + g_runtime.rwlock_status = 1; + } + if(g_runtime.lock_flag_heartrate) + { + //心率存储 + g_runtime.rwlock_status = 1; + } + if(g_runtime.lock_flag_blood) + { + //血氧存储 + g_runtime.rwlock_status = 1; + } + return g_runtime.rwlock_status; +} +//设置运动存储 +void uapi_dev_runtime_set_train_storage_status(uint8_t status) +{ + g_runtime.lock_flag_training = status; +} +uint8_t uapi_dev_runtime_get_train_storage_status(void) +{ + return g_runtime.lock_flag_training; +} +//设置心率存储 +void uapi_dev_runtime_set_heartrate_storage_status(uint8_t status) +{ + g_runtime.lock_flag_heartrate = status; +} +uint8_t uapi_dev_runtime_get_heartrate_storage_status(void) +{ + return g_runtime.lock_flag_heartrate; +} +//设置血氧存储 +void uapi_dev_runtime_set_blood_storage_status(uint8_t status) +{ + g_runtime.lock_flag_blood = status; +} +uint8_t uapi_dev_runtime_get_blood_storage_status(void) +{ + return g_runtime.lock_flag_blood; +} +//后续还需要补充。。。 + // 设置被动心率检测状态 void uapi_dev_runtime_set_hrs_passivity(uint8_t status) { diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.h b/code/sdk/drivers/peripheral/utils/custom_runtime.h index 763edd629..358c2d3f7 100644 --- a/code/sdk/drivers/peripheral/utils/custom_runtime.h +++ b/code/sdk/drivers/peripheral/utils/custom_runtime.h @@ -109,6 +109,39 @@ uint8_t uapi_dev_runtime_get_checkres_status(void); void uapi_dev_runtime_set_repair_download_status(uint8_t status); uint8_t uapi_dev_runtime_get_repair_download_status(void); +/* + 读写锁状态 + 0 未锁定 + 1 锁定 +*/ +void uapi_dev_runtime_set_rwlock_status(uint8_t status); +uint8_t uapi_dev_runtime_get_rwlock_status(void); + +/* + 训练存储 + 0 未存储 + 1 正在存储 +*/ +void uapi_dev_runtime_set_train_storage_status(uint8_t status); +uint8_t uapi_dev_runtime_get_train_storage_status(void); + +/* + 心率存储 + 0 未存储 + 1 正在存储 +*/ +void uapi_dev_runtime_set_heartrate_storage_status(uint8_t status); +uint8_t uapi_dev_runtime_get_heartrate_storage_status(void); + +/* + 血氧存储 + 0 未存储 + 1 正在存储 +*/ +void uapi_dev_runtime_set_bloodoxygen_storage_status(uint8_t status); +uint8_t uapi_dev_runtime_get_bloodoxygen_storage_status(void); + + /*运动识别*/ void uapi_dev_runtime_set_motion_recognition_status(uint8_t status); uint8_t uapi_dev_runtime_get_motion_recognition_status(void); -- 2.17.1