1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//! # Boppo WASM Activity API for Rust
//!
//! Activities are compiled to WASM and run on the
//! [Boppo](https://developer.boppo.com) tablet.
//!
//! ## Getting Started
//!
//! To get started developing on Boppo read our
//! [developer documentation](https://developer.boppo.com/) with instructions
//! to clone our template repository.
//!
//! The main entry point is [`init_and_run_async`].
//!
//! ## Lights
//!
//! For setting the color of lights see the set_color and similar functions on
//! [`Button`], [`Buttons`], and [`Lights`].
//!
//! By default all changes are immediately flushed to the hardware. If you want
//! to make multiple changes in a row and performance matters you can use
//! [`Framebuffer`] or modify the auto flush behavior using [`MainFramebuffer`].
//!
//! Each Boppo button has 4 LED lights which are represented by [`LightDir`].
//!
//! For drawing and animating simple shapes treating the entire Boppo surface as
//! a display see [`lights_plane`].
//!
//! ## Button Events
//!
//! You can receive button change events as an async stream using
//! [`ButtonEvents`].
//!
//! You can also query the current state of the buttons using
//! [`Button::is_pressed`] and [`Buttons::currently_pressed`].
//!
//! You can use [`Button::wait_for_press`] and [`Button::wait_for_release`] to
//! wait for a button to be in a specific state.
//!
//! ## Audio
//!
//! Play audio using [`audio::play`] or the `audio::play_*` helper functions.
//!
//! ## Guidelines
//!
//! See Boppo's [Activity
//! Guidelines](https://developer.boppo.com/docs/activity-guidelines) for
//! guidelines on creating great activities.
pub use *;
pub use Error;
/// Initializes the Boppo WASM runtime and runs an async activity function.
///
/// If `activity_fn` returns, it is called again, as most Boppo activities
/// are expected to start fresh after completion. All audio is stopped and the
/// lights are turned off before starting again. The activity is passed in the
/// number of times it has been started (the first time is 1).
///
/// If you would like to return to the main menu, you can call std::process::exit(0).
///
/// ```no_run
/// use boppo_wasm::{Button, color};
///
/// pub fn main() {
/// boppo_wasm::init_and_run_async(activity)
/// }
///
/// pub async fn activity(num_starts: u32) {
/// Button::B0.set_color(color::BLUE);
/// // ...
/// }
/// ```