edit the docs

This commit is contained in:
ZennDev1337 2023-10-11 18:41:22 +02:00
parent ffb6d42f10
commit 3d5d8ccf49
65 changed files with 178 additions and 128 deletions

View file

@ -46,19 +46,19 @@ pub struct ButtonSet {
}
impl ButtonSet {
pub unsafe fn pressed(&self) -> bool {
crate::libraries::arduboy2_library::binding::pressed(self.flag_set)
pub fn pressed(&self) -> bool {
unsafe { crate::libraries::arduboy2_library::binding::pressed(self.flag_set) }
}
pub unsafe fn just_pressed(&self) -> bool {
crate::libraries::arduboy2_library::binding::just_pressed(self.flag_set)
pub fn just_pressed(&self) -> bool {
unsafe { crate::libraries::arduboy2_library::binding::just_pressed(self.flag_set) }
}
pub unsafe fn just_released(&self) -> bool {
crate::libraries::arduboy2_library::binding::just_released(self.flag_set)
pub fn just_released(&self) -> bool {
unsafe { crate::libraries::arduboy2_library::binding::just_released(self.flag_set) }
}
pub unsafe fn not_pressed(&self) -> bool {
crate::libraries::arduboy2_library::binding::not_pressed(self.flag_set)
pub fn not_pressed(&self) -> bool {
unsafe { crate::libraries::arduboy2_library::binding::not_pressed(self.flag_set) }
}
}

View file

@ -9,9 +9,9 @@
//! use arduboy_rust::prelude::*;
//! ```
//! ### Disable C++ libraries
//! Inside the root directory is a file named `import_config.h`
//! Inside the project directory is a file named `config.toml`
//!
//! You can disable C++ libraries in the `import_config.h` file.
//! You can disable C++ libraries in the `config.toml` file.
//! Just comment the unused library definition out.
//!
//! Be careful with disabling libraries because:

View file

@ -351,7 +351,7 @@ impl Arduboy2 {
///- ASCII carriage return (\r, 0x0D, musical eighth note). This character will be ignored.
///
///
/// ## Example
/// ### Example
/// ```
/// #![allow(non_upper_case_globals)]
/// use arduboy_rust::prelude::*;

View file

@ -2,7 +2,7 @@ use core::ffi::{c_uchar, c_uint, c_ulong};
///This is the struct to interact in a save way with the ArduboyTones C++ library.
///
/// You will need to uncomment the ArduboyTones_Library in the import_config.h file.
/// You will need to uncomment the ArduboyTones in the config.toml file.
pub struct ArduboyTones {}
impl ArduboyTones {
@ -10,6 +10,7 @@ impl ArduboyTones {
/// ## Example
/// ```
/// use arduboy_rust::prelude::*;
/// #[allow(non_upper_case_globals)]
/// const sound: ArduboyTones = ArduboyTones::new();
/// ```
pub const fn new() -> ArduboyTones {
@ -67,6 +68,7 @@ impl ArduboyTones {
/// Example:
/// ```
/// use arduboy_rust::prelude::*;
/// #[allow(non_upper_case_globals)]
/// const sound: ArduboyTones = ArduboyTones::new();
/// progmem!(
/// static sound1: [u8; _] = [220, 1000, 0, 250, 440, 500, 880, 2000, TONES_END];
@ -105,7 +107,7 @@ impl ArduboyTones {
///
/// ```
/// use arduboy_rust::prelude::*;
/// use arduboy_tones::tones_pitch::*;
/// use tones_pitch::*;
/// let sound2: [u16; 9] = [220, 1000, 0, 250, 440, 500, 880, 2000, TONES_END];
/// ```
/// Using `tones()`, with the data in PROGMEM, is normally a better

View file

@ -1,6 +1,6 @@
//!This is the Module to interact in a save way with the ArduboyTones C++ library.
//!
//! You will need to uncomment the ArduboyTones_Library in the import_config.h file.
//! You will need to uncomment the ArduboyTones in the config.toml file.
#[doc(hidden)]
mod arduboy_tones;
pub mod tones_pitch;

View file

@ -5,10 +5,10 @@
//! use arduboy_rust::prelude::*;
//!
//! fn setup() {
//! FX::begin()
//! fx::begin()
//! }
//! ```
//! You will need to uncomment the ArduboyFX_Library in the import_config.h file.
//! You will need to uncomment the ArduboyFX in the config.toml file.
#![allow(non_upper_case_globals)]
use super::drawable_number::DrawableNumber;
use super::drawable_string::DrawableString;

View file

@ -1,6 +1,6 @@
//! This is the Module to interact in a save way with the ArduboyFX C++ library.
//!
//! You will need to uncomment the ArduboyFX_Library in the import_config.h file.
//! You will need to uncomment the ArduboyFX in the config.toml file.
mod drawable_number;
pub mod fx_consts;
#[doc(hidden)]

View file

@ -18,18 +18,21 @@ extern "C" {
///This is the struct to store and read structs objects to/from eeprom memory.
/// ## Example
/// ```
/// use arduboy_rust::prelude::*;
/// #[allow(non_upper_case_globals)]
/// static e: EEPROM = EEPROM::new(10);
/// struct Scorebord {
/// player1: u16,
/// text: &'static str,
/// }
/// #[allow(non_upper_case_globals)]
/// static mut s: Scorebord = Scorebord {
/// player1: 0,
/// text: "lol\0",
/// };
///
/// // init inside of the setup function
/// e.init(&mut s);
/// unsafe { e.init(&mut s) };
/// ```
pub struct EEPROM {
start_c1: i16,

View file

@ -3,6 +3,7 @@
/// Create a space for Progmem variable
/// ## Example
/// ```
/// use arduboy_rust::prelude::*;
/// //for text
/// progmem!(
/// static text: [u8; _] = *b"I'm a PROGMEM Text\0";
@ -119,6 +120,9 @@ pub(super) use get_string_addr;
/// This automatically saves the given text to the Progmem.
/// ## Example
/// ```
/// use arduboy_rust::prelude::*;
/// #[allow(non_upper_case_globals)]
/// const arduboy: Arduboy2 = Arduboy2::new();
/// arduboy.print(f!(b"Random text to print\0"))
/// ```
#[macro_export]

View file

@ -1,6 +1,6 @@
//! This is the Module to interact in a save way with the Arduino Serial C++ library.
//!
//! You will need to uncomment the Arduino_Serial_Library in the import_config.h file.
//! You will need to uncomment the Serial in the config.toml file.
use crate::arduino_system::progmem::Pstring;
use core::ffi::{c_char, c_int, c_long, c_size_t, c_uchar, c_uint, c_ulong};

View file

@ -1,6 +1,6 @@
//! This is the Module to interact in a save way with the ArdVoice C++ library.
//!
//! You will need to uncomment the ArdVoice_Library in the import_config.h file.
//! You will need to uncomment the ArdVoice in the config.toml file.
use core::ffi::{c_float, c_uchar, c_ulong};

View file

@ -1,5 +1,5 @@
//! This is the Module to interact in a save way with the ArdVoice C++ library.
//!
//! You will need to uncomment the ArdVoice_Library in the import_config.h file.
//! You will need to uncomment the ArdVoice in the config.toml file.
mod ardvoice;
pub use ardvoice::ArdVoice;