-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add documentation for static events/queue #1147
Merged
AnotherButler
merged 10 commits into
ARMmbed:development
from
maciejbocianski:static_allocation_event
Sep 5, 2019
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
75ef998
Add documentation for static events/queue
maciejbocianski 7fbc125
Edit EventQueue.md
3c7ecd1
Edit events_tutorial.md
b5fe81a
Edit UserAllocatedEvent.md
3570b55
update code-example links
maciejbocianski 9fed598
Add missing word in EventQueue.md
fa00879
Fix link in UserAllocatedEvent.md
6141b03
Fix link in EventQueue.md
e45ff47
Fix link in UserAllocatedEvent.md
76989d6
Fix link in events_tutorial.md
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# UserAllocatedEvent | ||
|
||
The `UserAllocatedEvent` class provides APIs to create and configure static events. The advantage in using `UserAllocatedEvent` instead of `Event` is `UserAllocatedEvent` embeds all underlying event data and doesn't require any memory allocation while posting and dispatching to the EventQueue. | ||
|
||
This class includes the following APIs: | ||
|
||
- `delay` and `period` to configure event timings. | ||
- `call` and `try_call` to post an event to the underlying EventQueue. | ||
- `call_on` and `try_call_on` to bind and post an event to the EventQueue as a function argument. | ||
- `cancel` to cancel the most recently posted event. | ||
|
||
Because the `UserAllocatedEvent` holds event data, you can post only one event object to it at a time. This means that if the event object has to be reused, the previous dispatch has to finish or the event has to be canceled. You can use the `try_call` API to sample the event state. This call tries to post an event and returns false with no action until the previous dispatching finishes. | ||
|
||
The UserAllocatedEvent class is thread safe. The `call`, `try_call` and `cancel` APIs are IRQ safe. | ||
|
||
## UserAllocatedEvent class reference | ||
|
||
[![View code](https://www.mbed.com/embed/?type=library)](https://os.mbed.com/docs/development/mbed-os-api-doxy/_event_8h_source.html) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this link still goes to the |
||
|
||
## Static EventQueue example: posting user allocated events to the queue | ||
|
||
This example demonstrates how you can instantiate, configure and post events: | ||
|
||
[![View code](https://www.mbed.com/embed/?url=https://github.com/ARMmbed/mbed-os-examples-docs_only/blob/master/events/static-event-queue/UserAllocatedEvent_ex_1/)](https://github.com/ARMmbed/mbed-os-examples-docs_only/blob/events/static-event-queue/UserAllocatedEvent_ex_1/main.cpp) | ||
|
||
|
||
## Related content | ||
|
||
- [RTOS configuration](../reference/configuration-rtos.html). | ||
- [EventQueue tutorial](../tutorials/the-eventqueue-api.html). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be
prevent your program from failing
?