pebble-sys

Crates.iopebble-sys
lib.rspebble-sys
version0.0.1
sourcesrc
created_at2020-10-31 11:22:01.156289
updated_at2020-10-31 11:22:01.156289
descriptionLow-level FFI bindings for Pebble (watch) SDK 4.3
homepagehttps://github.com/Tamschi/pebble-sys/tree/v0.0.1
repositoryhttps://github.com/Tamschi/pebble-sys
max_upload_size
id307222
size36,934
Tamme Schichler (Tamschi)

documentation

https://docs.rs/pebble-sys/0.0.1

README

pebble-sys

Lib.rs Crates.io Docs.rs

Rust nightly-2020-10-30 Build Status Crates.io - License

GitHub open issues open pull requests crev reviews

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.

Installation

Please use cargo-edit to always add the latest version of this library:

cargo add pebble-sys

Example

Aplite emulator screenshot: 'miles to see you' and 10000 in a number picker window
#![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
  }
}

License

Licensed under either of

at your option.

Contribution

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.

Code of Conduct

Changelog

Versioning

pebble-sys strictly follows Semantic Versioning 2.0.0 with the following exceptions:

  • The minor version will not reset to 0 on major version changes (except for v1).
    Consider it the global feature level.
  • The patch version will not reset to 0 on major or minor version changes (except for v0.1 and v1).
    Consider it the global patch level.

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.

Commit count: 27

cargo fmt