diff --git a/docs/src/details/auxiliary-modules/observer/observer.rst b/docs/src/details/auxiliary-modules/observer/observer.rst index 406ea0979f..374714fe85 100644 --- a/docs/src/details/auxiliary-modules/observer/observer.rst +++ b/docs/src/details/auxiliary-modules/observer/observer.rst @@ -11,7 +11,7 @@ Overview .. _observer pattern: https://en.wikipedia.org/wiki/Observer_pattern -The ``lv_observer`` module is an implemention of the `Observer Pattern`_. +The ``lv_observer`` module is an implementation of the `Observer Pattern`_. This implementation consists of: @@ -69,7 +69,7 @@ A typical use case looks like this: * some_module.c *--------------*/ - extern lv_subject_t some_subject; + extern lv_subject_t my_subject; // Will be called when Subject's value changes static void some_observer_cb(lv_observer_t * observer, lv_subject_t * subject) @@ -81,19 +81,19 @@ A typical use case looks like this: void some_module_init(void) { // Subscribe to Subject as an Observer. - lv_subject_add_observer(&some_subject, some_observer_cb, NULL); + lv_subject_add_observer(&my_subject, some_observer_cb, NULL); } /*-------------- * some_system.c *--------------*/ - extern lv_subject_t some_subject; + extern lv_subject_t my_subject; void some_event(void) { // The below call sets Subject's value to 30 and notifies current Observers. - lv_subject_set_int(&some_subject, 30); + lv_subject_set_int(&my_subject, 30); } @@ -228,7 +228,7 @@ both unsubscribes it from the Subject and deletes it from the LVGL heap. Subscribing While Associating Observer with a Widget ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The function below assocates a Widget with an Observer while subscribing to a +The function below associates a Widget with an Observer while subscribing to a Subject. A copy of the pointer to that Widget is saved in the Observer's ``target`` field. This works exactly like the above method except that when the Widget is deleted, the Observer thus created will be automatically unsubscribed from the