1、修改pm_core.c 把 添加的外设休眠唤醒函数都放到推荐位置
authorSnickerSun <snickersun@163.com>
Mon, 8 Apr 2024 13:05:32 +0000 (21:05 +0800)
committerSnickerSun <snickersun@163.com>
Mon, 8 Apr 2024 13:05:32 +0000 (21:05 +0800)
2、添加心率、马达、加速计 休眠投票值,备用
3、main.c中备注需要初始化全局配置文件的位置。并取消rotary里无效的引用

code/sdk/application/brandy/brandy_standard/main.c
code/sdk/drivers/peripheral/rotary_encoder/rotary_encoder_drv.c
code/sdk/middleware/chips/brandy/pm/include/pm_definition.h
code/sdk/middleware/chips/brandy/pm/pm_adapt/pm_core.c

index 53f6f28..aaecd65 100755 (executable)
@@ -37,7 +37,12 @@ void app_main(const void *startup_details_table, const uint32_t density)
     board_init(ssb_to_app_table.ssb_to_application_flash_id, ssb_to_app_table.ssb_to_application_flash_unique_id);
 
     service_init();
-
+    /**
+     * TODO: 在此处初始化配置信息,为后面服务启动提供参数信息
+     * 
+     * ConfigModel 初始化
+     * 
+    */
     thread_pri_init();
 
     (void)osKernelStart();
index 206072d..9a28d59 100644 (file)
 #include "soc_osal.h"
 #include "rotary_encoder_def.h"
 #include "input_app.h"
-#if defined(TPTYPE_TMA525B)
-#include "tma525b_drv1.h"
-#include "tma525b_ctrl.h"
-#elif defined(TPTYPE_ZTW523)
-#include "ztw523_drv1.h"
-#include "ztw523_ctrl.h"
-#elif defined(TPTYPE_FT6X46)
-#include "ft6x46_drv1.h"
-#include "ft6x46_ctrl.h"
-#else
-#include "ztw523_drv1.h"
-#include "ztw523_ctrl.h"
-#endif
+// #if defined(TPTYPE_TMA525B)
+// #include "tma525b_drv1.h"
+// #include "tma525b_ctrl.h"
+// #elif defined(TPTYPE_ZTW523)
+// #include "ztw523_drv1.h"
+// #include "ztw523_ctrl.h"
+// #elif defined(TPTYPE_FT6X46)
+// #include "ft6x46_drv1.h"
+// #include "ft6x46_ctrl.h"
+// #else
+// #include "ztw523_drv1.h"
+// #include "ztw523_ctrl.h"
+// #endif
 
 #define ROTARY_ENCODER_DEV_NAME_LEN 16
 #define ROTARY_ENCODER_DEVNAME "input/event"
index ae3dd85..bc2d0d9 100755 (executable)
@@ -39,6 +39,9 @@ typedef enum {
     PM_ID_STORAGE,
     PM_ID_TOUCH,
     PM_ID_JPEG,
+    PM_ID_HEART,//新增,心率芯片
+    PM_ID_MOTOR,//新增,马达
+    PM_ID_GSENSOR,//新增,加速计
     PM_ID_MAX,
 } pm_id_t;
 
index 6f15153..f789842 100755 (executable)
@@ -110,9 +110,24 @@ void pm_core_wait_uart_tx_idle(void)
     }
 }
 #endif
+void pm_sikey_suspend(void) {
+    //心率,马达,加速计外设的I2C通道寄存器保存,关中断
+    
+    //ADD alipay I2C3 suspend, 
+    alipay_suspend();
+}
 
+void pm_sikey_resume(void){
+    //心率,马达,加速计外设的I2C通道寄存器的恢复,关中断,重新配置pinmux,重新初始化。
+    
+    alipay_resume();
+}
 void pm_core_suspend(void)
 {
+
+//.......................................................
+    pm_sikey_suspend(); //其他外设加在这里
+//.......................................................
 #if (ARCH == RISCV70)
     clic_suspend();
     ArchDCacheFlush();
@@ -127,8 +142,6 @@ void pm_core_suspend(void)
         if (g_frs_sleep_flag) { touch_suspend_for_i2c(); }
         g_frs_sleep_flag = 0;
     }
-    //ADD alipay I2C3 suspend, 
-    alipay_suspend();
     display_suspend_power_off();
 #endif
     storage_device_suspend();
@@ -261,7 +274,6 @@ void pm_core_resume(void)
     if (lcd_get_status() != 0) {
         display_resume_tmp();
     }
-    alipay_resume();
 #endif
     dsp_resume_tmp();
     reg16_setbit(0x520003e4, 0x0); // set mcpu_clken_slp in MSUB_SLP_CFG
@@ -272,6 +284,9 @@ void pm_core_resume(void)
     hal_pmu_set_cmu_xo_trim(HAL_PMU_XO_CORE_DS_1_025X);
     pm_misc_regs_resume();
     pm_core_restore_reset_pc();
+//.......................................................
+    pm_sikey_resume(); //其他外设加在这里
+//.......................................................
 }
 
 uint64_t pm_core_get_count(void)