拱门主循环回调

⚠️
嗨,...感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程https://www.dialog-seminile.com/support.。我们将在未来几天修复错误/优化搜索和标记。
3个帖子/ 0新
最后一篇
balaji
离线
最后一次露面:1month 2 weeks ago
加入:2019-12-06 06:48
拱门主循环回调

你好,

我创造了两个回调user_callback_config.h.

static const struct arch_main_loop_callbacks user_app_main_loop_callbacks = {.app_on_init = user_app_init,//默认情况下,在系统唤醒时重新加载并恢复监视程序定时器。//用户必须考虑看门狗定时器处理(将其运行,//冻结它,重新加载,恢复IT等),当App_On_ble_Powered()被称为//可能会影响主循环。.app_on_ble_powered = user_ble_task,//默认情况下,在系统唤醒时,重新加载并恢复监视程序定时器。//用户必须考虑看门狗定时器处理(保持运行,//冻结它,重新加载,恢复IT等),当App_On_System_Powered()被调用时,可能会影响主循环。.app_on_system_powered = user_sys_task,.app_before_sleep = null,.app_validate_sleep = null,.app_ging_to_sleep = null,.app_resume_from_sleep = null,};

I defined user_ble_task and user_sys_task as shown below

ARCH_MAIN_LOOP_CALLBACK_RET_T user_sys_task(){// sprintf((char *)flg_buff,“%d \ n”,c);// UART_SEND(UART2,(UINT8_T *)FLG_BUFF,STRLEN(FLG_BUFF),UART_OP_BLOCKING);setword16(0x50003002,256);返回keep_powered;// keep_powered,goto_sleep}

这里的函数返回Keep_Powered并提高GPIO。

arch_main_loop_callback_ret_t user_ble_task() { // sprintf((char *) flg_buff," %d \n",b); // uart_send(UART2, (uint8_t *) flg_buff,strlen(flg_buff), UART_OP_BLOCKING); wdg_reload(WATCHDOG_DEFAULT_PERIOD); SetWord16(0x50003004,256); return GOTO_SLEEP; }

在user_ble_task中,函数返回goto_sleep并使GPIO低。WDG重新加载200毫秒,以顺序方式调用。

很高的时间是18.microseconds & low time of1微秒。(它如何实现所有循环的相同延迟)

I understand these loopbacks areAsughronous执行,如何在这些环回中执行任何硬件定时器/ ble appeasytimer()回调。

随附的逻辑分析仪屏幕截图为时间间隔。项目使用BLE_BAREBONE没有睡眠模式。分享我任何示例代码。

I refered following link as reference.

http://lpccs-docs.dialog-semiconductor.com/Tutorial_SDK6/sdk_architectur...

Br,

BALAJI

附件:
balaji
离线
最后一次露面:1month 2 weeks ago
加入:2019-12-06 06:48
Hi Dialog,

Hi Dialog,

I made user_sys_task toNULL并在User_ble_Task中制作App_easy_Timer(),如下所示,

arch_main_loop_callback_ret_t user_ble_task() { led_app_timer = app_easy_timer(LED_BLNK_TIMER,led_blink_cb); wdg_reload(WATCHDOG_DEFAULT_PERIOD); return KEEP_POWERED; }

在回调时,我正在使用标志和切换LED 1秒

静态孔隙led_blink_cb(){如果(标志= = 0)/ / (GPI)O_GetPinStatus(GPIO_LED_PORT, GPIO_LED_PIN)) { SetWord16(0x50003002,512); // PORT_0 PIN_9 LED ON SetWord16(0x50003002,256); // PORT_0 PIN_8 connected to logic analyser for time interval. flag = 1; } else { SetWord16(0x50003004,512); // PORT_0 PIN_9 LED OFF SetWord16(0x50003004,256); flag = 0; } }

配置计时器和延迟配置,

#define LED_BLNK_TIMER(100)// 100 * 10 = 1秒钟计时器TIMER_HND LED_APP_TIMER __section_zero(“RETENT_MEM_AREA0”);// @保留记忆

when trying to debug in keil i can observe led toggling for 1 sec , but when i connected to ble app throughble scanner延迟减少到一半,即0.5秒,0.5秒关闭,在我断开连接之后,App_easy_timer永远不会重置。当我尝试再次连接调试器时,在app_easy_timer_cancel()中命中assert_warning(0)

空隙app_easy_timer_cancel(常量timer_hnd timer_id){如果APP_EASY_TIMER_HND_IS_VALID(timer_id){如果((timer_callbacks [APP_EASY_TIMER_HND_TO_IDX(timer_id)]!= NULL)&&(timer_callbacks [APP_EASY_TIMER_HND_TO_IDX(timer_id)]!= timer_canceled_handler)){//删除从计时器定时器队列ke_timer_clear(app_easy_timer_hnd_to_msg_id(timer_id),task_app);timer_callbacks [app_easy_timer_hnd_to_idx(timer_id)] = timer_canceled_handler;/ *将消息发送到内核,以清除定时器回调函数并释放定时器回调阵列中的相应位置。app_easy_timer_cancel()函数无法保证计时器是否已输入消息队列。因此,必须将消息发送到内核,并通知其请求的取消操作。* / struct cancel_timer_struct * req = ke_msg_alloc(app_cancel_timer,task_app,task_app,cancel_timer_struct);req-> timer_id = timer_id;KE_MSG_SEND(REQ);} else {assert_warning(0); // this is where the debugger halts. } } else { ASSERT_WARNING(0); } }

我的应用程序调试led_app_timer idis zero I checked withwatch window in keil。我想知道何时取消我的app_easy_timer()以避免此停止。

Correct my code if anything is wrong.

需要知道为什么timer_id为零,是否有竞赛条件前的可能性。

Thanks in advance

Br,

BALAJI.

PM_Dialog
离线
最后一次露面:22 hours 30 min ago
职员
加入:2018-02-08 11:03
Hi Balaji,

Hi Balaji,

Thanks for your post online and for your follow up comment as well. I read your description, but to be host I am not able to understand what you are trying to accomplish. So, could you please describe more clear what is you requirement?

>>>how to execute any hardware timer/ble appEasytimer() callbacks inside these loopbacks.

上述要求是您的要求吗?

在以下评论中,我看到了您正在使用app_easy_tuimer()。请检查aep_easy_timer_cancel()是否调用您的代码?

请提供适当的步骤,以便我可以复制此问题。

Thanks, PM_Dialog