Learn MoreFAQsTutorials

2 posts / 0 new
Last post
mkelwood
Offline
Last seen:4 months 2 weeks ago
Joined:2017-05-19 18:27
app_easy_msg API

I would like to use the app_easy_msg API to send a message from an ISR to the application task (to trigger execution of code that is too long to include in an ISR). The app_easy_msg_utils files show how to register a callback and get the message identifier, but there is no function to send the message. I did not see this API used in any of the example projects. Is there an example somewhere of how to use app_easy_msg to actually send the message?

Also, it would be nice if the callback could take a pointer to parameters (which would be sent with the message). I don't see any way to do this without hacking the app_easy_msg_utils.c file, so it's probably easier to just use global variables to pass information to the callback, but certainly not the preferred method.

If there is a better way to send a message from an ISR to the TASK_APP task (possibly to be handled in the user_catch_rest_hndl() function) then please explain. Thanks!

Device:
MT_dialog
Offline
Last seen:6 days 2 hours ago
Staff
Joined:2015-06-08 11:34
Hi mkelwood,

Hi mkelwood,

从app_e app_easy_msg实用程序使用asy_wakeup implementation, so in order to set a custom message you should do the following:

  • You can set a custom message by using the app_easy_msg_set(your_callback) in order to set the callback that should be executed upon sending the message, the function will place the message into the availble pool of messages and return an identifier of type ke_msg_id_t your_identifier.
  • You should store that identifier, and in order to trigger the message you will invoke the ke_msg_send_basic(your_identifier, TASK_APP, 0);
  • How the msg utilities are made, no you cannot pass parameters to the callback.

If you are using the app_easy_msg_utilities() in order to send custom messages, then the app_msg_utils_api_process_handler() will handle the messages and serve the corresponding callbacks. What you can also try is to declare a custom message in your profile for example in the custom profile and just use the ke_msg_send_basic() function in order to send it, that way you will be able to catch it, in the catch_rest handler.

Thanks MT_Dialog