Crates.io | pebble-sys |
lib.rs | pebble-sys |
version | 0.0.1 |
source | src |
created_at | 2020-10-31 11:22:01.156289 |
updated_at | 2020-10-31 11:22:01.156289 |
description | Low-level FFI bindings for Pebble (watch) SDK 4.3 |
homepage | https://github.com/Tamschi/pebble-sys/tree/v0.0.1 |
repository | https://github.com/Tamschi/pebble-sys |
max_upload_size | |
id | 307222 |
size | 36,934 |
Low-level FFI bindings for Pebble (watch) SDK 4.3.
I recommend using the high-level wrapper in pebble-skip
instead, since it provides almost the same functionality with full memory safety and with very little overhead.
This crate is still heavily work in progress, so expect frequent breaking changes and missing functionality before 0.1. If you'd like me to prioritise a specific API, please file a feature request on GitHub.
Please use cargo-edit to always add the latest version of this library:
cargo add pebble-sys
#![no_std]
use pebble_sys::{
foundation::app::app_event_loop,
standard_c::memory::{c_str, void},
user_interface::{
window::number_window::{
number_window_create, number_window_get_window_mut, number_window_set_value,
NumberWindowCallbacks,
},
window_stack::window_stack_push,
},
};
#[no_mangle]
pub extern "C" fn main() -> i32 {
static mut CONTEXT: () = ();
unsafe {
let label = &*("miles to see you\0" as *const _ as *const c_str);
let number_window = number_window_create(
label,
NumberWindowCallbacks {
incremented: None,
decremented: None,
selected: None,
},
&mut *(&mut CONTEXT as *mut _ as *mut void),
)
.unwrap();
number_window_set_value(number_window, 10_000);
let window = number_window_get_window_mut(number_window);
window_stack_push(window, true);
app_event_loop();
0
}
}
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
pebble-sys
strictly follows Semantic Versioning 2.0.0 with the following exceptions:
This includes the Rust version requirement specified above.
Earlier Rust versions may be compatible, but this can change with minor or patch releases.
Which versions are affected by features and patches can be determined from the respective headings in CHANGELOG.md.