update docs and added support to print String from heapless
This commit is contained in:
parent
2c47c3ad9a
commit
b6cf7e43c7
23 changed files with 161 additions and 122 deletions
|
@ -346,6 +346,7 @@ impl Arduboy2 {
|
|||
///
|
||||
/// arduboy.print(b"Hello World\n\0"[..]); // Prints "Hello World" and then sets the
|
||||
/// // text cursor to the start of the next line
|
||||
/// arduboy.print(f!(b"Hello World\n")); // Prints "Hello World" but does not use the 2kb ram
|
||||
/// arduboy.print(value); // Prints "42"
|
||||
/// arduboy.print("\n\0"); // Sets the text cursor to the start of the next line
|
||||
/// arduboy.print("hello world") // Prints normal [&str]
|
||||
|
|
|
@ -110,7 +110,7 @@ pub(super) use get_string_addr;
|
|||
/// This automatically saves the given text to the Progmem.
|
||||
/// ## Example
|
||||
/// ```
|
||||
/// arduboy.print(f!(b"Random text to print"))
|
||||
/// arduboy.print(f!(b"Random text to print\0"))
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! f {
|
||||
|
|
|
@ -102,6 +102,17 @@ impl Printable for &str {
|
|||
|
||||
fn default_parameters() -> Self::Parameters {}
|
||||
}
|
||||
impl<const N: usize> Printable for crate::heapless::String<N> {
|
||||
type Parameters = ();
|
||||
|
||||
fn print_2(self, _params: Self::Parameters) {
|
||||
unsafe {
|
||||
crate::library::arduboy2::print_chars(self.as_bytes() as *const [u8] as *const i8);
|
||||
}
|
||||
}
|
||||
|
||||
fn default_parameters() -> Self::Parameters {}
|
||||
}
|
||||
|
||||
impl Printable for Pstring {
|
||||
type Parameters = ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue