mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
add a note on callback implementations
This commit is contained in:
parent
46f1f60cda
commit
846fea1c0f
1 changed files with 3 additions and 0 deletions
3
API.md
3
API.md
|
|
@ -150,6 +150,9 @@ impl MyServer {
|
|||
}
|
||||
|
||||
/// an example of registering for a callback
|
||||
/// Note: since Xous 0.9 we support `std` threads and closures. See the Net crate
|
||||
/// for an example of how to implement callbacks using `std` primitives.
|
||||
/// The below implementation is how closures are done in a `no-std` fashion.
|
||||
static mut MYSERVER_CB: Option<fn(BattStats)> = None; // this actually goes outside the object decl
|
||||
pub fn hook_callback(&mut self, cb: fn(u32)) -> Result<(), xous::Error> {
|
||||
if unsafe{MYSERVER_CB}.is_some() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue