added the f!() macro to the library to make shure that all random text can be written to the progmem to save the important ram
This commit is contained in:
parent
b00ee76ef1
commit
990ae0c03c
11 changed files with 71 additions and 97 deletions
|
@ -63,3 +63,22 @@ macro_rules! get_string_addr {
|
|||
};
|
||||
}
|
||||
pub(super) use get_string_addr;
|
||||
///This is the way to go if you want print some random text
|
||||
///
|
||||
/// This doesn't waste the 2kb ram it saves to progmem (28kb)
|
||||
/// This automatically saves the given text to the Progmem.
|
||||
/// ## Example
|
||||
/// ```
|
||||
/// arduboy.print(f!(b"Random text to print"))
|
||||
/// ```
|
||||
#[macro_export]
|
||||
macro_rules! f {
|
||||
($string_literal:literal) => {{
|
||||
progmem!(
|
||||
static local: [u8; _] = *$string_literal;
|
||||
);
|
||||
|
||||
get_string_addr!(local)
|
||||
}};
|
||||
}
|
||||
pub(super) use f;
|
||||
|
|
|
@ -19,7 +19,7 @@ pub use crate::library::c::*;
|
|||
pub use crate::library::eeprom::EEPROM;
|
||||
pub use crate::library::sprites;
|
||||
pub use crate::print::*;
|
||||
pub use crate::{get_sprite_addr, get_string_addr, get_tones_addr, progmem};
|
||||
pub use crate::{f, get_sprite_addr, get_string_addr, get_tones_addr, progmem};
|
||||
use core::cmp;
|
||||
|
||||
pub fn constrain<T: Ord>(x: T, a: T, b: T) -> T {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue