From: SnickerSun Date: Tue, 26 Mar 2024 11:49:42 +0000 (+0800) Subject: cywee 更新位p3版本 此次添加了翻腕功能 X-Git-Tag: release_V1.2.70_20241020_135402~1257^2~8 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=41a3acc30d777674682d973429c5136756fe2353;p=mirrors%2FFD230.git cywee 更新位p3版本 此次添加了翻腕功能 --- diff --git a/code/sdk/drivers/peripheral/cywee/CMakeLists.txt b/code/sdk/drivers/peripheral/cywee/CMakeLists.txt index bde9d556c..568a75f9a 100644 --- a/code/sdk/drivers/peripheral/cywee/CMakeLists.txt +++ b/code/sdk/drivers/peripheral/cywee/CMakeLists.txt @@ -49,7 +49,7 @@ set(MAIN_COMPONENT if("SUPPORT_AT_CYWEE" IN_LIST DEFINES) find_library(LIB_PATH_CWM_LIB_DML Lib/CWM_LIB_DML_clang_riscv.a ${CMAKE_CURRENT_SOURCE_DIR}) - find_library(LIB_PATH_CWM_LIB Lib/CWM_LIB_clang_riscv.p813.a ${CMAKE_CURRENT_SOURCE_DIR}) + find_library(LIB_PATH_CWM_LIB Lib/CWM_LIB_clang_riscv.p3.a ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(${TARGET_NAME} PRIVATE -Wl,--whole-archive ${LIB_PATH_CWM_LIB_DML} ${LIB_PATH_CWM_LIB} PRIVATE -Wl,--whole-archive) endif() diff --git a/code/sdk/drivers/peripheral/cywee/Inc/OsApi.h b/code/sdk/drivers/peripheral/cywee/Inc/OsApi.h index 753b23057..4ae3003ed 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/OsApi.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/OsApi.h @@ -25,8 +25,7 @@ typedef struct{ int (*spiRead)(uint16_t reg, int regLength, uint8_t *readData, int readDataSize, int busIndex); int (*spiWrite)(uint16_t reg, int regLength, uint8_t *writeData, int writeDataSize, int busIndex); } OsAPI, *pOsAPI; - - +#if USE_P813 typedef struct{ int (*dbgOutput)(const char*); uint64_t (*GetTimeNs)(void); @@ -38,7 +37,7 @@ typedef struct{ int (*spiRead)(uint16_t reg, int regLength, uint8_t *readData, int readDataSize, int busIndex); int (*spiWrite)(uint16_t reg, int regLength, uint8_t *writeData, int writeDataSize, int busIndex); } os_api; - -// typedef OsAPI os_api; - +#else +typedef OsAPI os_api; +#endif #endif /* __OS_API_H__ */ diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cwm_lib.h b/code/sdk/drivers/peripheral/cywee/Inc/cwm_lib.h index 266e87656..bf3cc3145 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cwm_lib.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cwm_lib.h @@ -27,6 +27,17 @@ #define SCL_SWIM_CONFIG 13 #define SCL_BIKING_CONFIG 14 #define SCL_ACTIVITY_PAUSE 15 +/** + * int[0] = 1 +int[1] = up_range (抬手反應範圍)(default: 5) +(0: default, 3: 範圍大, 4, 5, 6: 範圍小) +int[2] = down_range (放手反應範圍)(default: 5) +(0: default, 3: 範圍大, 4, 5, 6: 範圍小) +int[3] = sensitivity (反應速度)(default: 5) +(0: default, 3: 反應速度快, 4, 5, 6: 反應速度慢) +int[4] = horizontal_range (亮屏手肘傾斜範圍)(default: 5) +(0: default, 1: 範圍大, 2, 3, 4, 5, 6, 7, 8, 9: 範圍小) +*/ #define SCL_HAND_UPDOWN_CONFIG 16 #define SCL_CHIP_VENDOR_CONFIG 17 #define SCL_SLEEP_CONFIG 18 diff --git a/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv.p3.a b/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv.p3.a index 4275ca2fb..c42a47d7b 100644 Binary files a/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv.p3.a and b/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv.p3.a differ diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c index 2f2adf086..1f61faeb6 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c @@ -148,7 +148,7 @@ errcode_t uapi_cywee_service_init(void) taskcfg.attr.priority = TASK_PRIORITY_APP; taskcfg.attr.stack_size = CYWEE_APP_BOARD_TASK_SIZE; taskcfg.func = cywee_service_check_task; - taskcfg.use_mem = USE_EXTEND_MEM; + taskcfg.use_mem = USE_DTCM_MEM; errcode_t ret=uapi_create_osThread_custom(&taskcfg); if(ret != ERRCODE_SUCC) diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 4cad5fe6c..5922f390c 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -189,6 +189,7 @@ int cywee_main_dml(void) { CWM_SettingControl(SCL_GET_LIB_INFO, &scl); CWM_OS_dbgPrintf("version:%d.%d.%d.%d product:%d model:%d\n", scl.iData[1], scl.iData[2], scl.iData[3], scl.iData[4], scl.iData[5], scl.iData[6]); CWM_OS_dbgPrintf("[DBG] ach: %d\n", scl.iData[7]); +#if USE_P813 os_api api = { .GetTimeNs = CWM_OS_GetTimeNs, .dbgOutput = CWM_OS_dbgOutput, @@ -200,6 +201,9 @@ int cywee_main_dml(void) { .spiRead = NULL, .spiWrite = NULL, }; + CWM_LibPreInit(&api); + +#else OsAPI apiOS = { .GetTimeNs = CWM_OS_GetTimeNs, .dbgOutput = CWM_OS_dbgOutput, @@ -218,7 +222,8 @@ int cywee_main_dml(void) { .enableGpioIRQ = NULL, .disableGpioIRQ = NULL, }; - CWM_LibPreInit(&api); + CWM_LibPreInit(&apiOS); +#endif //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); //set mcu_chip information, must call this before CWM_LibPostInit() @@ -276,7 +281,8 @@ int cywee_main_dml(void) { memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; scl.iData[3] = 2; - scl.iData[4] = 2; + scl.iData[4] = 1; //anytime + scl.iData[6] = 5; //先設定5 scl.iData[7] = 5; scl.iData[8] = 25; // for st sensor(52Hz) CWM_SettingControl(SCL_DML_DRV_AG_CONFIG, &scl); @@ -307,6 +313,15 @@ int cywee_main_dml(void) { CWM_OS_dbgPrintf("DML device[%d]: hw_id=%d hw_attr=%d\n", i, scl.iData[6 + i * 2], scl.iData[7 + i * 2]); } + memset(&scl, 0, sizeof(scl)); + scl.iData[0] = 1; + scl.iData[1] = 5; + scl.iData[2] = 5; + scl.iData[3] = 5; + scl.iData[4] = 5; + CWM_SettingControl(SCL_HAND_UPDOWN_CONFIG, &scl); + + memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1; scl.iData[1] = 1; @@ -336,6 +351,7 @@ int cywee_main_dml(void) { // CWM_Sensor_Enable(IDX_ALGO_ANY_MOTIOIN); CWM_Sensor_Enable(IDX_ALGO_ABSOLUTE_STATIC); //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); + CWM_Sensor_Enable(IDX_ALGO_WATCH_HANDUP); memset(&scl, 0, sizeof(scl)); scl.iData[0] = 1;