From: SnickerSun Date: Wed, 20 Mar 2024 12:32:18 +0000 (+0800) Subject: 添加cywee算法库,解决PROGRAM空间不足问题 X-Git-Tag: release_V1.2.70_20241020_135402~1285 X-Git-Url: http://git.snicker.com.cn/Users/apple/Desktop/static/gitweb.css?a=commitdiff_plain;h=2f36b630538f76fd14b3b4dde1598a64fe892b19;p=mirrors%2FFD230.git 添加cywee算法库,解决PROGRAM空间不足问题 --- diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index 8b8bf0cd3..a98ae4a44 100755 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -118,9 +118,9 @@ target = { 'ENABLE_ECC', 'FT_SINGLE_UART', 'PPG_HX3695', - 'ACC_LIS2DOC', - # 'ENABLE_CYWEE', - # 'SUPPORT_AT_CYWEE', + # 'ACC_LIS2DOC', + 'ENABLE_CYWEE', + 'SUPPORT_AT_CYWEE', 'MAG_MMC5603', 'ENABLE_VIBRATOR', 'ENABLE_SLIP', @@ -147,9 +147,9 @@ target = { 'graphic_at_service', 'app_at_service', 'ohosfwk_at_service', - 'audio_at_service', - 'media_at_service', - 'bt_manager_at_service', + # 'audio_at_service', + # 'media_at_service', + # 'bt_manager_at_service', "audio_proc", "audio_dump", "audio_probe", "power_manager", "gpu_proc", 'bts_header', "ppg_sensor", "mag_sensor", @@ -164,8 +164,8 @@ target = { #"nativelauncher", "fd230launcher", "ppg_service", - "acc_sensor", - # "cywee", + # "acc_sensor", + "cywee", "batterry_service", "ble_service", "hid_service" @@ -173,6 +173,7 @@ target = { 'ram_component_set': ['bgh', 'media', 'gpu', 'graphic_uikit', 'bgh_audio', 'dfx_set', 'ohos_set', 'wearable_set', 'alipay_set'], 'dsp_version': 'max', 'packet': True, + 'image_analysis': False, # 'fs_image_path':'evb4', 'fs_image_path':'fd230', 'fs_image': True diff --git a/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h b/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h index 2189c377a..c7ffb81a6 100755 --- a/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h +++ b/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h @@ -233,7 +233,7 @@ const hal_pio_config_t g_pio_function_config[PIN_MAX_NUMBER] = { */ -#define DEFAULT_POWERON_CAT1 1 +#define DEFAULT_POWERON_CAT1 0 //需要配置默认输出的,以及需要配置默认输入中断函数的。 const hal_gpio_config_t g_gpio_function_config[PIN_MAX_NUMBER] = { diff --git a/code/sdk/drivers/peripheral/cywee/CMakeLists.txt b/code/sdk/drivers/peripheral/cywee/CMakeLists.txt index f2beb18d2..72d1eb933 100644 --- a/code/sdk/drivers/peripheral/cywee/CMakeLists.txt +++ b/code/sdk/drivers/peripheral/cywee/CMakeLists.txt @@ -5,7 +5,7 @@ set(COMPONENT_NAME "cywee") set(SOURCES ${SOURCES} - # ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c + ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c ${CMAKE_CURRENT_SOURCE_DIR}/src/main_dml.c ${CMAKE_CURRENT_SOURCE_DIR}/src/test_api.c ${CMAKE_CURRENT_SOURCE_DIR}/src/board_yh601s.c diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cwm_lib.bk.h b/code/sdk/drivers/peripheral/cywee/Inc/cwm_lib.bk.h new file mode 100644 index 000000000..173a4775f --- /dev/null +++ b/code/sdk/drivers/peripheral/cywee/Inc/cwm_lib.bk.h @@ -0,0 +1,264 @@ +#ifndef __CWM_LIB_H__ +#define __CWM_LIB_H__ + +#include "CWM_EventStructure.h" +#include "OsApi.h" +#include "CWM_CustomDataStruct.h" + +/** + * @brief Setting Control control ID + * @api CWM_SettingControl + * @param CtrId + */ +#define SCL_LOG 0 +#define SCL_USER_INFO 1 +#define SCL_DATE_TIME 2 +#define SCL_SEDENTARY 3 +#define SCL_PEDO_RESET 4 // old +#define SCL_RESET_DAILY_INFO 4 // new +#define SCL_REQ_SLEEPING_DATA 5 +#define SCL_LOW_POWER_MODE 6 +#define SCL_SET_ACTIVITY_MODE 7 +#define SCL_GET_CHIP_INFO 8 +#define SCL_ACTIVITY_CONFIG 9 +#define SCL_LIB_DEBUG 10 +#define SCL_PEDO_CONFIG 11 +#define SCL_GET_LIB_INFO 12 +#define SCL_SWIM_CONFIG 13 +#define SCL_BIKING_CONFIG 14 +#define SCL_ACTIVITY_PAUSE 15 +#define SCL_HAND_UPDOWN_CONFIG 16 +#define SCL_CHIP_VENDOR_CONFIG 17 +#define SCL_SLEEP_CONFIG 18 +#define SCL_ABS_STATIC_CONFIG 19 +#define SCL_HEART_RATE_CONFIG 20 +#define SCL_REQ_SWIM_EXIT 21 +#define SCL_WATCH_FALL_CONFIG 22 +#define SCL_AR_ALERT_CONFIG 23 +#define SCL_WM_CONFIG 25 +#define SCL_INACTIVITY_CONFIG 26 +#define SCL_SET_INACTIVITY_MODE 27 +#define SCL_STAND_CONFIG 28 +#define SCL_SS_CONFIG 29 +#define SCL_ACT_INFO_CONFIG 30 +#define SCL_REQ_ACTIVITY_EXIT 31 +#define SCL_ACT_PAI_INFO 33 +#define SCL_ACT_INTSY_INFO 35 +#define SCL_DUMP_WI_INFO 36 +#define SCL_ACT_ZONE_TIME 37 +#define SCL_ACT_TRAINING_INFO 38 +#define SCL_WATCH_INTF_RESET 40 +#define SCL_PEDO_CONFIG2 42 +#define SCL_HG_INTF_CONFIG 43 +#define SCL_ACT_AUTO_PAUSE_CFG 44 +#define SCL_AR_ALERT2_CONFIG 45 +#define SCL_WI_SENS_REQ_CFG 46 +#define SCL_ACT_SA_METR_INFO 47 +#define SCL_SLEEP_ALARM_CFG 48 +#define SCL_FITNESS_INFO 49 +#define SCL_SZ_BREACH_CONFIG 50 +#define SCL_ACT_PAI_INFO2 51 + +#define SCL_ALGO_PROC_CONFIG 100 +#define SCL_INPUT_SENSOR_CONFIG 101 +#define SCL_INPUT_DT_CONFIG 102 +#define SCL_SENS_RANGE_DETECT_CONFIG 103 +#define SCL_SENS_CALI_CONFIG 110 +#define SCL_SENS_CALI_CTRL_MAG 111 +#define SCL_SENS_CALI_CTRL_A 112 +#define SCL_SPV_CONFIG 113 +#define SCL_SPV_MODE 114 +#define SCL_SENS_CALI_SET_MAG 115 +#define SCL_SENS_CALI_SET_A 116 + +#define SCL_SIN_HR_EXT 200 + +/** + * @brief Custom Sensor Input sensorId + * @api CWM_CustomSensorInput + * @param CustomSensorData.sensorType extSensorId + * @ + * @api CWM_CustomSensorInput_Fifo_Start CWM_CustomSensorInput_Fifo_End + * @param extSensorId + */ +#define CUSTOM_ACC 0 +#define CUSTOM_GYRO 1 +#define CUSTOM_MAG 2 +#define CUSTOM_BARO 3 +#define CUSTOM_TEMP 4 +#define CUSTOM_HEARTRATE 5 +#define CUSTOM_GNSS 6 +#define CUSTOM_OFFBODY_DETECT 7 +#define CUSTOM_ON_CHARGING 8 +#define CUSTOM_ACC_ANY_MOTION 9 +#define CUSTOM_SENS1 10 + + +/** + * @brief sensor enable/disable + * @api CWM_Sensor_Enable CWM_Sensor_Disable + * @param sensorId + */ +#define IDX_ACCEL 0 +#define IDX_GYRO 1 +#define IDX_MAG 2 +#define IDX_BARO 3 +#define IDX_TEMP 4 +#define IDX_HEARTRATE 5 +#define IDX_GNSS 6 +#define IDX_OFFBODY_DETECT 7 +#define IDX_ALGO_SEDENTARY 8 +#define IDX_ALGO_WATCH_HANDUP 9 +#define IDX_ALGO_SLEEP 10 +#define IDX_REQUEST_SENSOR 11 +#define IDX_ALGO_SHAKE 13 +#define IDX_ALGO_ACTIVITY_OUTPUT 14 +#define IDX_ALGO_ANY_MOTION 15 +#define IDX_ALGO_NO_MOTION 16 +#define IDX_ALGO_FALLING 17 +#define IDX_ONCHARGING_DETECT 18 +#define IDX_ALGO_ABSOLUTE_STATIC 19 +#define IDX_ALGO_SPV 20 +#define IDX_ALGO_SENS_CALIBRATION 21 +#define IDX_ALGO_INACTIVITY_OUTPUT 22 +#define IDX_ALGO_STAND 23 +#define IDX_ALGO_SENS_RANGE_DETECT 24 + +/** + * @brief activity mode setting + * @api CWM_SettingControl + * @param SCL_SET_ACTIVITY_MODE + */ +#define ACTIVITY_MODE_NORMAL 1001 + +typedef struct { + int iData[16]; +} SettingControl_t; + +typedef void (*FN_SENSOR_LISTEN)(pSensorEVT_t); + + +#define LOS_DATA_TYPE_INT 0 +#define LOS_DATA_TYPE_STR 1 + +/** + * @brief + * @param dataType: cmd data type indicater + * 0 (LOS_DATA_TYPE_INT): int type data, dataInt accessible + * 1 (LOS_DATA_TYPE_STR): string type data, *dataStr and dataStr_length accessible + */ +typedef struct { + const char *optionString; + const char *sectionName; + const char *apiName; + int cmdId; + int dataType; + int dataInt[16]; + const char *dataStr; + int dataStr_length; +} los_cmd_data_t; + +typedef void (*FN_LOS_CMD_EXECUTE)(los_cmd_data_t *); + +/** + * @brief CyweeMotion internal process Initial + */ +void CWM_LibPreInit(OsAPI *api); + +/** + * @brief Sensor Event register callback, when sensor event is triggered, + * this function will be called to notify + */ +void CWM_LibPostInit(FN_SENSOR_LISTEN pfn); + +/** + * @brief lib deinit for special case. Not any situation can be used normally + */ +void CWM_LibDeinit(void); + +/** + * @brief Sensor enable based on sensor index provided + * @param sensorId: sensor register handle, if not setup this handle don't care + * @retval 0 is success, otherwise is failed + */ +int CWM_Sensor_Enable(uint32_t sensorId); + +/** + * @brief Sensor disable based on sensor index provided + * @param sensorId: sensor register handle, if not setup this handle don't care + * @retval 0 is success, otherwise is failed + */ +int CWM_Sensor_Disable(uint32_t sensorId); + +/** + * @brief Read sensor data and output through sensor call-back function + * @retval 0 is no data to process, mcu can enter low power mode, + otherwise has some data needs process this function again. + */ +int CWM_process(void); + +/** + * @brief Read sensor data and output through sensor call-back function + */ +int CWM_process2(int dt_us); + +/** + * @brief Get how many event in CyweeMotion Library to be processed + * @retval 0 is no data to process, mcu can enter low power mode, + otherwise has some data + */ +int CWM_IsReadyForProcess(void); + +/** + * @brief Put custom sensor data. + * @param SensorDataInput: sensor data input handle, input format as below: + * sensorType= CustomSensorDataIndex + * fData = sensor raw data + * @retval 0 is success, otherwise is failed + */ +int CWM_CustomSensorInput(CustomSensorData *SensorDataInput); + +/** + * @brief Get the duration time of the next event + * @retval the duration time (unit nanosecond) + */ +int64_t CWM_GetNextActionDuration_ns(void); + +/** + * @brief set lib config + * @param Control ID + * @param Setting control array + * @retval 0 is success, otherwise is failed + */ +int CWM_SettingControl(int CtrId, SettingControl_t *pData); + +/** + * @brief Fifo initial + * @param max recored number of acc fifo + */ +void CWM_CustomSensorInput_Fifo_Init(int maxRecords_Acc); + +/** + * @brief setting lib can start input fifo + * @param sensor ID + * @param timestamp that interrupt trigger to read hw fifo data + * @param fifo delta_time + * @retval 0 is success, otherwise is failed + */ +int CWM_CustomSensorInput_Fifo_Start(uint32_t extSensorId, uint64_t triggerFifoRead_timeStamp_ns, uint64_t dt_ns); + +/** + * @brief setting lib to stop input fifo + * @param sensor ID + */ +void CWM_CustomSensorInput_Fifo_End(uint32_t extSensorId); + +/** + * @brief Execute option string + * @param optionString + * @param sectionString section execute order + * @param custCallbackFunc custom option string execute function + * @param skipExeDefault don't execute default command + */ +void CWM_LoadOptionString(const char *optionString, const char *sectionString, FN_LOS_CMD_EXECUTE custCallbackFunc, int skipExeDefault); +#endif diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cwm_lib.h b/code/sdk/drivers/peripheral/cywee/Inc/cwm_lib.h index 173a4775f..14a6137bf 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cwm_lib.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cwm_lib.h @@ -1,21 +1,16 @@ -#ifndef __CWM_LIB_H__ -#define __CWM_LIB_H__ +#ifndef ___CWM_LIB__H_ +#define ___CWM_LIB__H_ +#include +#include "os_api.h" #include "CWM_EventStructure.h" -#include "OsApi.h" #include "CWM_CustomDataStruct.h" -/** - * @brief Setting Control control ID - * @api CWM_SettingControl - * @param CtrId - */ #define SCL_LOG 0 #define SCL_USER_INFO 1 #define SCL_DATE_TIME 2 #define SCL_SEDENTARY 3 -#define SCL_PEDO_RESET 4 // old -#define SCL_RESET_DAILY_INFO 4 // new +#define SCL_PEDO_RESET 4 #define SCL_REQ_SLEEPING_DATA 5 #define SCL_LOW_POWER_MODE 6 #define SCL_SET_ACTIVITY_MODE 7 @@ -35,6 +30,7 @@ #define SCL_REQ_SWIM_EXIT 21 #define SCL_WATCH_FALL_CONFIG 22 #define SCL_AR_ALERT_CONFIG 23 +#define SCL_ACT_PAUSE_DETECT 24 #define SCL_WM_CONFIG 25 #define SCL_INACTIVITY_CONFIG 26 #define SCL_SET_INACTIVITY_MODE 27 @@ -42,12 +38,16 @@ #define SCL_SS_CONFIG 29 #define SCL_ACT_INFO_CONFIG 30 #define SCL_REQ_ACTIVITY_EXIT 31 +#define SCL_TAP_CONFIG 32 #define SCL_ACT_PAI_INFO 33 +#define SCL_HAND_WRIST_CONFIG 34 #define SCL_ACT_INTSY_INFO 35 #define SCL_DUMP_WI_INFO 36 #define SCL_ACT_ZONE_TIME 37 #define SCL_ACT_TRAINING_INFO 38 +#define SCL_HAND_SHAKE_CONFIG 39 #define SCL_WATCH_INTF_RESET 40 +#define SCL_HAND_RUB_CONFIG 41 #define SCL_PEDO_CONFIG2 42 #define SCL_HG_INTF_CONFIG 43 #define SCL_ACT_AUTO_PAUSE_CFG 44 @@ -62,24 +62,52 @@ #define SCL_ALGO_PROC_CONFIG 100 #define SCL_INPUT_SENSOR_CONFIG 101 #define SCL_INPUT_DT_CONFIG 102 -#define SCL_SENS_RANGE_DETECT_CONFIG 103 +#define SCL_SENS_RANGE_DETECT_CONFIG 103 #define SCL_SENS_CALI_CONFIG 110 #define SCL_SENS_CALI_CTRL_MAG 111 #define SCL_SENS_CALI_CTRL_A 112 #define SCL_SPV_CONFIG 113 +#define SCL_FACTORY_CALI_CONFIG 113 #define SCL_SPV_MODE 114 +#define SCL_FACTORY_CALI_MODE 114 #define SCL_SENS_CALI_SET_MAG 115 #define SCL_SENS_CALI_SET_A 116 +#define SCL_SENS_CALI_CTRL_A2 117 + +#define SCL_GET_HEAP_INFO 120 +#define SCL_SEC_VERIFY_CLIENT 150 +#define SCL_SEC_VERIFY_SERVER 151 #define SCL_SIN_HR_EXT 200 +#define SCL_HS_ORIEN_CONFIG 300 +#define SCL_HS_ORIEN_CTRL_EXC 301 +#define SCL_HS_ORIEN_RESET 302 +#define SCL_HS_PHONE_CONFIG 303 +#define SCL_EAR_FALL_CONFIG 304 +#define SCL_HS_PHONE_CONFIG2 305 +#define SCL_HS_RUN_INIT_ANGLE 306 +#define SCL_HS_INTF_CONFIG 307 +#define SCL_HS_INTF_RESTART 308 +#define SCL_HS_GESTURE_CONFIG 309 +#define SCL_HS_NECK_HT_CONFIG 310 +#define SCL_HS_ORIEN_CTRL_SYNC 311 + +#define SCL_FUSION_MOUSE_CONFIG 501 +#define SCL_PEDO_POD_CONFIG 502 +#define SCL_PEDO_POD_TR_CALI 503 +#define SCL_PEDO_POD_RUN_CMD 504 + +#define SCL_GLASSES_MOT_CONFIG 510 +#define SCL_GLASSES_MOT_LEVEL 511 +#define SCL_GLASSES_MOT_CALI_CTRL 512 +#define SCL_GLASSES_MOT_CMD 513 + /** * @brief Custom Sensor Input sensorId * @api CWM_CustomSensorInput * @param CustomSensorData.sensorType extSensorId * @ - * @api CWM_CustomSensorInput_Fifo_Start CWM_CustomSensorInput_Fifo_End - * @param extSensorId */ #define CUSTOM_ACC 0 #define CUSTOM_GYRO 1 @@ -107,34 +135,21 @@ #define IDX_HEARTRATE 5 #define IDX_GNSS 6 #define IDX_OFFBODY_DETECT 7 -#define IDX_ALGO_SEDENTARY 8 -#define IDX_ALGO_WATCH_HANDUP 9 -#define IDX_ALGO_SLEEP 10 #define IDX_REQUEST_SENSOR 11 -#define IDX_ALGO_SHAKE 13 -#define IDX_ALGO_ACTIVITY_OUTPUT 14 #define IDX_ALGO_ANY_MOTION 15 #define IDX_ALGO_NO_MOTION 16 -#define IDX_ALGO_FALLING 17 #define IDX_ONCHARGING_DETECT 18 #define IDX_ALGO_ABSOLUTE_STATIC 19 #define IDX_ALGO_SPV 20 +#define IDX_ALGO_FACTORY_CALI 20 #define IDX_ALGO_SENS_CALIBRATION 21 -#define IDX_ALGO_INACTIVITY_OUTPUT 22 -#define IDX_ALGO_STAND 23 #define IDX_ALGO_SENS_RANGE_DETECT 24 -/** - * @brief activity mode setting - * @api CWM_SettingControl - * @param SCL_SET_ACTIVITY_MODE - */ -#define ACTIVITY_MODE_NORMAL 1001 - typedef struct { int iData[16]; } SettingControl_t; + typedef void (*FN_SENSOR_LISTEN)(pSensorEVT_t); @@ -160,22 +175,18 @@ typedef struct { typedef void (*FN_LOS_CMD_EXECUTE)(los_cmd_data_t *); + /** * @brief CyweeMotion internal process Initial */ -void CWM_LibPreInit(OsAPI *api); +void CWM_LibPreInit(os_api *api); /** - * @brief Sensor Event register callback, when sensor event is triggered, + * @brief Sensor Event register callback, when sensor event is triggered, * this function will be called to notify */ void CWM_LibPostInit(FN_SENSOR_LISTEN pfn); -/** - * @brief lib deinit for special case. Not any situation can be used normally - */ -void CWM_LibDeinit(void); - /** * @brief Sensor enable based on sensor index provided * @param sensorId: sensor register handle, if not setup this handle don't care @@ -190,25 +201,11 @@ int CWM_Sensor_Enable(uint32_t sensorId); */ int CWM_Sensor_Disable(uint32_t sensorId); -/** - * @brief Read sensor data and output through sensor call-back function - * @retval 0 is no data to process, mcu can enter low power mode, - otherwise has some data needs process this function again. - */ -int CWM_process(void); - /** * @brief Read sensor data and output through sensor call-back function */ int CWM_process2(int dt_us); -/** - * @brief Get how many event in CyweeMotion Library to be processed - * @retval 0 is no data to process, mcu can enter low power mode, - otherwise has some data - */ -int CWM_IsReadyForProcess(void); - /** * @brief Put custom sensor data. * @param SensorDataInput: sensor data input handle, input format as below: @@ -219,40 +216,13 @@ int CWM_IsReadyForProcess(void); int CWM_CustomSensorInput(CustomSensorData *SensorDataInput); /** - * @brief Get the duration time of the next event - * @retval the duration time (unit nanosecond) - */ -int64_t CWM_GetNextActionDuration_ns(void); - -/** - * @brief set lib config + * @brief Switch log output by input parameters * @param Control ID * @param Setting control array * @retval 0 is success, otherwise is failed */ int CWM_SettingControl(int CtrId, SettingControl_t *pData); -/** - * @brief Fifo initial - * @param max recored number of acc fifo - */ -void CWM_CustomSensorInput_Fifo_Init(int maxRecords_Acc); - -/** - * @brief setting lib can start input fifo - * @param sensor ID - * @param timestamp that interrupt trigger to read hw fifo data - * @param fifo delta_time - * @retval 0 is success, otherwise is failed - */ -int CWM_CustomSensorInput_Fifo_Start(uint32_t extSensorId, uint64_t triggerFifoRead_timeStamp_ns, uint64_t dt_ns); - -/** - * @brief setting lib to stop input fifo - * @param sensor ID - */ -void CWM_CustomSensorInput_Fifo_End(uint32_t extSensorId); - /** * @brief Execute option string * @param optionString @@ -260,5 +230,9 @@ void CWM_CustomSensorInput_Fifo_End(uint32_t extSensorId); * @param custCallbackFunc custom option string execute function * @param skipExeDefault don't execute default command */ -void CWM_LoadOptionString(const char *optionString, const char *sectionString, FN_LOS_CMD_EXECUTE custCallbackFunc, int skipExeDefault); -#endif +void CWM_LoadOptionString(const char *optionString, \ + const char *sectionString, \ + FN_LOS_CMD_EXECUTE custCallbackFunc, \ + int skipExeDefault); + +#endif //___CWM_LIB__H_ diff --git a/code/sdk/drivers/peripheral/cywee/Inc/os_api.h b/code/sdk/drivers/peripheral/cywee/Inc/os_api.h new file mode 100644 index 000000000..8bdd926e7 --- /dev/null +++ b/code/sdk/drivers/peripheral/cywee/Inc/os_api.h @@ -0,0 +1,18 @@ +#ifndef __OS_API_H__ +#define __OS_API_H__ + +typedef struct{ + int (*dbgOutput)(const char*); + uint64_t (*GetTimeNs)(void); + void (*uSleep)(uint32_t); + int (*i2cRead)(uint16_t slaveAddr, uint16_t reg, int regLength, uint8_t *readData, int readDataSize, int busIndex); + int (*i2cWrite)(uint16_t slaveAddr, uint16_t reg, int regLength, uint8_t *writeData, int writeDataSize, int busIndex); + void *(*malloc)(int size); + void (*free)(void* ptr); + 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 os_api OsAPI; + +#endif /* __OS_API_H__ */ diff --git a/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv.a b/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv.a index 689b04914..afbcedcbc 100644 Binary files a/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv.a and b/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv.a differ diff --git a/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv.bk.a b/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv.bk.a new file mode 100644 index 000000000..689b04914 Binary files /dev/null and b/code/sdk/drivers/peripheral/cywee/Lib/CWM_LIB_clang_riscv.bk.a differ diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_at_cmd.c b/code/sdk/drivers/peripheral/cywee/service/cywee_at_cmd.c index bbfb9ac26..2c92dfbc9 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_at_cmd.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_at_cmd.c @@ -48,19 +48,22 @@ static uint32_t cywee_do_test(uint8_t *para, uint32_t paraLen, char *strCommonCm int ret = ConvertCmdToParam(para, paraLen, argv, &argc); if (ret != ERRCODE_SUCC) { - PRINT_ERR("CYWEETEST ATCMD Convert Command Failed\n"); + PRINT("CYWEETEST ATCMD Convert Command Failed\n"); return ERRCODE_FAIL; } if (argc < 1) { - PRINT_ERR("CYWEETEST ATCMD Set Parameter Failed\n"); + PRINT("CYWEETEST ATCMD Set Parameter Failed\n"); return ERRCODE_FAIL; } char *mode = (char*)argv[0]; if (strcmp(mode, "start") == 0) { + PRINT("cywee start\n"); do_cywee_service_check_msg(CYWEE_SERVICE_CMD_START_CHECK); } else if (strcmp(mode, "stop") == 0) { + PRINT("cywee stop\n"); do_cywee_service_check_msg(CYWEE_SERVICE_CMD_STOP_CHECK); } else if (strcmp(mode, "test") == 0) { + PRINT("cywee test\n"); do_cywee_service_check_msg(CYWEE_SERVICE_CMD_TEST); } return ERRCODE_SUCC; diff --git a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c index dc1b5a095..cc5f976b8 100644 --- a/code/sdk/drivers/peripheral/cywee/service/cywee_service.c +++ b/code/sdk/drivers/peripheral/cywee/service/cywee_service.c @@ -96,13 +96,6 @@ void do_cywee_service_check_msg(int cmd) } } -// #define TEST_CYWEE_LIB -#ifdef TEST_CYWEE_LIB -typedef struct { - int iData[16]; -} SettingControl_t; -#define SCL_GET_LIB_INFO 12 -#endif static void cywee_service_check_task(void const *arg) { @@ -121,19 +114,11 @@ static void cywee_service_check_task(void const *arg) if (mail.cmd == CYWEE_SERVICE_CMD_TIMER_CHECK) { cywee_int_handler(); // lis2doc_read_data(); - // printf("CYWEE_SERVICE_CMD_TIMER_CHECK\r\n"); + printf("CYWEE_SERVICE_CMD_TIMER_CHECK\r\n"); }else if (mail.cmd == CYWEE_SERVICE_CMD_TEST){ test_api(); }else if (mail.cmd == CYWEE_SERVICE_CMD_START_CHECK){ cywee_service_running_stat = true; - #ifdef TEST_CYWEE_LIB - // SettingControl_t scl; - // memset(&scl, 0, sizeof(scl)); - // scl.iData[0] = 1; - // CWM_SettingControl(SCL_GET_LIB_INFO, &scl); - printf("CYWEE_SERVICE_CMD_START_CHECK \r\n"); - // CWM_lib_init(); - #endif cywee_main_dml(); cywee_service_timer_start_check(CYWEE_CHECK_MS); }else if (mail.cmd == CYWEE_SERVICE_CMD_STOP_CHECK){ diff --git a/code/sdk/drivers/peripheral/cywee/src/board_yh601s.c b/code/sdk/drivers/peripheral/cywee/src/board_yh601s.c index 164e25631..e2802261a 100644 --- a/code/sdk/drivers/peripheral/cywee/src/board_yh601s.c +++ b/code/sdk/drivers/peripheral/cywee/src/board_yh601s.c @@ -285,14 +285,14 @@ void CWM_OS_free(void *ptr) int CWM_OS_dbgOutput(const char * format) { - printf("%s", format); + PRINT("%s", format); return 0; } int CWM_OS_dbgOutput_checkLog(const char * format) { static int s_sn = 0; - printf("#_#|%d|%s", s_sn, format); + PRINT("#_#|%d|%s", s_sn, format); s_sn ++; return 0; } diff --git a/code/sdk/drivers/peripheral/cywee/src/main.c b/code/sdk/drivers/peripheral/cywee/src/main.c index 9fe398c2f..f465b6cf7 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main.c +++ b/code/sdk/drivers/peripheral/cywee/src/main.c @@ -30,45 +30,7 @@ extern int CWM_OS_dbgOutput(const char * format); extern int CWM_OS_dbgPrintf(const char * format,...); #define IDX_ALGO_ACTIVITY_OUTPUT 14 -void CWM_AP_SensorListen(SensorEVT_t *sensorEVT) { - - switch (sensorEVT->sensorType) { - case 0: - // printf("IDX[%d]: %.3f, %.3f, %.3f, %.3f, %.3f, %.3f, %.3f, %.3f\n", sensorEVT->sensorType, - // sensorEVT->fData[0], - // sensorEVT->fData[1], - // sensorEVT->fData[2], - // sensorEVT->fData[3], - // sensorEVT->fData[4], - // sensorEVT->fData[5], - // sensorEVT->fData[6], - // sensorEVT->fData[7]); - break; - - case 1: - // printf("IDX[%d]: %.3f, %.3f, %.3f, %.3f, %.3f, %.3f, %.3f, %.3f\n", sensorEVT->sensorType, - // sensorEVT->fData[0], - // sensorEVT->fData[1], - // sensorEVT->fData[2], - // sensorEVT->fData[3], - // sensorEVT->fData[4], - // sensorEVT->fData[5], - // sensorEVT->fData[6], - // sensorEVT->fData[7]); - break; - - default: - printf("IDX[%d]: %.3f, %.3f, %.3f, %.3f, %.3f, %.3f, %.3f, %.3f\n", sensorEVT->sensorType, - sensorEVT->fData[0], - sensorEVT->fData[1], - sensorEVT->fData[2], - sensorEVT->fData[3], - sensorEVT->fData[4], - sensorEVT->fData[5], - sensorEVT->fData[6], - sensorEVT->fData[7]); - } -} +extern void CWM_AP_SensorListen(SensorEVT_t *sensorEVT) ; void CWM_lib_init(void) { os_api api = { diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 462b35a66..e71c3e729 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -64,7 +64,11 @@ static int cywee_installized = 0 ; int cywee_main_dml(void) { if (cywee_installized==1) + { + CWM_OS_dbgPrintf("cywee_installized skip install\n"); return 0; + + } cywee_installized = 1; int i; SettingControl_t scl;