fix(msg): make it work with Micropython (#3488)

* fix(msg): fill callback prototype

lv_msg_subscribe_cb_t does not follow the callback conventions.
Remove unused void* argument to fix that.

* fix(msg):  move subs_ll to gc roots

* fix(msg): rename subsribe to subscribe

* fix(msg): update docs

* fix(msg): Add example_1

* fix(msg): fix include paths

* fix(mgs): Fix python example typo and comments

* fix(msg):  LV_EVENT_MSG_RECEIVED event code
This commit is contained in:
Amir Gonnen
2022-07-27 10:42:48 +03:00
committed by GitHub
parent ca8f0ab549
commit cd11476592
9 changed files with 91 additions and 55 deletions

View File

@@ -1,6 +1,6 @@
# Messaging
Messaging (`lv_msg`) is a classic []publisher subscriber](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern) implementation for LVGL.
Messaging (`lv_msg`) is a classic [publisher subscriber](https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern) implementation for LVGL.
## IDs
Both the publishers and the subscribers needs to know the message identifiers.
@@ -33,9 +33,8 @@ lv_msg_send(MSG_USER_NAME_CHANGED, "John Smith");
The callback should look like this:
```c
static void user_name_subscriber_cb(void * s, lv_msg_t * m)
static void user_name_subscriber_cb(lv_msg_t * m)
{
/*s: a subscriber obeject, can be used to unscubscribe*/
/*m: a message object with the msg_id, payload, and user_data (set durung subscription)*/
...do something...