完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,我正在使用CY8C4045 AZI S413进行我的项目。在空闲状态机中,代码只需每500毫秒唤醒一次,并检查邻近控件。有线部分是,如果我关闭睡眠功能,系统状态机将顺利转移到ToucEdEl状态。如果我打开睡眠功能。传输状态机需要很长时间。
静态子状态MeNeIDIDLE状态(空隙){ 子状态子状态= SnNO; CAPIA Outlook编写(1); VDDyLeDyCtRLX编写(0); MeMSET(Word缓冲区,0,WorkBuffell长度); BoOL ISH-BTNYROMPULTE= TRUE; 而(子状态= = sn-无){ *扫描所有小部件*/ 如果(CopsSeNeNothLoad==CAPENSESEIISBYY()); CAPENSESEA SETUP WIDGET(CAPENSESEA OUtiQUITY 0XWDGTZID); CAPENSESEA扫描(); ISSB处理= FALSE; } /*如果唤醒命令从主机接收…*/ 如果(Word缓冲区〔0〕=0x5a){ G.FASTHEXSCALL DELAYY计数器= FASTH扫描延迟; GyAdvEddoxMatCHyValue= WDTTyTimeOutFASTHySCAN; 子状态= S.Mistalay-EVT; 断裂; } 如果(CopsSeNeNothLoad==CAPENSESEIISBYY()); CAPENSESEIUPDATEWIDGETBASIC(CAPENSESEA OULIDITY 0WDGTGYID); CAPSENSEA进程WIGGET(CAPENSESEA近邻0WDGTGID); //If(CopsSeNeISWIDGETAcIcd(CopsSeNeRealthIy00WDGTGYID)){ 如果(CopsSeNeSeNesithEnristor Actu能能能为量(CAPENSESEIONTIONITY 0WDGTGID,0)) *初始化快速扫描延迟计数器** G.FASTHEXSCALL DELAYY计数器= FASTH扫描延迟; GyAdvEddoxMatCHyValue= WDTTyTimeOutFASTHySCAN; CAPIA Outlook编写(0); 子状态= SO TouChyEVT; 断裂; } ISSB处理=真; } *将CPU置于睡眠状态。当WDT中断发生时,CPU将唤醒。 并执行下一次扫描*/ (如果)= 0) 如果(子状态==Sn-无){ //CysYSPMLeSEP(); GoToScript(); } 第二节 } /*同时(子状态= = sn-无)*/ 返回子状态; } E-LoC.CyWrk.CaseV01.Zip 674.4 K 以上来自于百度翻译 以下为原文 Hi, I am using CY8C4045AZI-S413 for my project. In IDLE state machine, the code simply wakes up every 500ms and checks for proximity widget. The wired part is if I turn off the sleep feature, system state machine will transfer smoothly to Touched_State. If I turn sleep function on. It will take a long time to transfer state machine. static SUB_STATE main_idle_state(void){ SUB_STATE sub_state = S_NONE; CAP_OUT_Write(1); VDD_LED_CTRL_Write(0); memset(WORK_BUFFER, 0, WORK_BUFFER_LENGTH); bool is_btn_processed = true; while(sub_state == S_NONE){ /* Scan all widgets */ if(CapSense_NOT_BUSY == CapSense_IsBusy() && is_btn_processed == true){ CapSense_SetupWidget(CapSense_PROXIMITY0_WDGT_ID); CapSense_Scan(); is_btn_processed = false; } /* If a wakeup command received from master... */ if(WORK_BUFFER[0] == 0x5A){ g_fast_scan_delay_counter = FAST_SCAN_DELAY; g_watchdog_match_value = WDT_TIMEOUT_FAST_SCAN; sub_state = S_MASTER_EVT; break; } if(CapSense_NOT_BUSY == CapSense_IsBusy() && is_btn_processed == false){ CapSense_UpdateWidgetBaseline(CapSense_PROXIMITY0_WDGT_ID); CapSense_ProcessWidget(CapSense_PROXIMITY0_WDGT_ID); //if(CapSense_IsWidgetActive(CapSense_PROXIMITY0_WDGT_ID)){ if(CapSense_IsProximitySensorActive(CapSense_PROXIMITY0_WDGT_ID,0)){ /* Initialize fast scan delay counter */ g_fast_scan_delay_counter = FAST_SCAN_DELAY; g_watchdog_match_value = WDT_TIMEOUT_FAST_SCAN; CAP_OUT_Write(0); sub_state = S_TOUCH_EVT; break; } is_btn_processed = true; } /* Put CPU to sleep. When the WDT interrupt occurs, CPU will wakeup and perform the next scan */ #if (POWER_SAVE_MODE != 0) if(sub_state == S_NONE){ //CySysPmSleep(); GotoSleep(); } #endif }/*while(sub_state == S_NONE)*/ return sub_state; }
|
|
相关推荐
4个回答
|
|
我相信当单元处于省电模式(如睡眠或深度睡眠)时,CAPSENSE不会运行。我的猜测是,你正在等待一个触摸感的CAPSENSE是不被激活,直到其他一些事件唤醒芯片后,它很快检测到触摸并触发你的代码。这可能解释了延迟为-500毫秒对应于您的临近窗口唤醒时间?
以上来自于百度翻译 以下为原文 I believe the capsense does not run while the unit is in a power saving mode (like sleep, or deep sleep). My guess would be that the capsense you are waiting for a touch sense from is not being activated until after some other event wakes up the chip, upon which it quickly detects the touch and triggers your code. This might explain the delay being ~500ms corresponding with your proximity widget wakeup time? |
|
|
|
对的。我最初的计划是每500毫秒用WDT定时器唤醒代码。CASESENSE在醒来后开始扫描,在我的配置中,它将花费15ms扫描所有的小部件。所以整个时间应该小于600毫秒,而事实上需要几秒钟的时间来捕捉接近传感器。
以上来自于百度翻译 以下为原文 Correct. My original plan is to wake up code by WDT timer every 500ms. Capsense starts to scan after waking up and in my configuration it will totally take 15ms to scan all widgets. So the whole time should be like less than 600ms. While In fact it takes like a couple of seconds to capture the proximity sensor. |
|
|
|
是不是每次读卡彭斯之后,你都会不经意地把芯片放在睡眠中?因此,获得触摸的时间长了吗?(500毫秒唤醒,读取一个样本的CasSoC,再次入睡,重复)
我将验证您禁用睡眠模式,直到您读完CAPSENSE;或者通过计数或时间限制。否则,如果您将设备设置为休眠电源模式,然后芯片唤醒CAPSENSE读取,它可能只是在没有读完CAPSENSE反跳周期的情况下马上回到睡眠状态。 以上来自于百度翻译 以下为原文 Could it be that you are inadvertently putting the chip to sleep after each read of the capsense? Hence the long time to acquire a touch? (500ms wakeup, reads one sample of capsense, goes to sleep again, repeat) I would verify that you are disabling the sleep mode until you finish reading the capsense; either by a count or time limit. Otherwise, if you are setting the device to a sleep power mode, and then the chip wakes up for the capsense reading, it could just be going right back to sleep without finishing reading the capsense debounce period. |
|
|
|
嗨,普拉特,谢谢你的回复。但你能详细解释一下吗?
“我会验证你正在禁用睡眠模式,直到你读完CAPSENSE,要么通过计数或时间限制。”它可能只是在没有读完CopSoad反跳周期的情况下马上回到睡眠状态。 以上来自于百度翻译 以下为原文 Hi Pratt, Thanks for your response. But can you explain this in detail?
|
|
|
|
只有小组成员才能发言,加入小组>>
754个成员聚集在这个小组
加入小组2105 浏览 1 评论
1851 浏览 1 评论
3669 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1786 浏览 6 评论
1536 浏览 1 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
569浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
423浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
437浏览 2评论
383浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
915浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-23 12:24 , Processed in 0.921727 second(s), Total 50, Slave 44 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号