added support for printing out of progmem

This commit is contained in:
ZennCode 2023-08-07 16:28:11 +02:00
parent 25e7d3272c
commit 5fdfcf88c4
10 changed files with 157 additions and 4 deletions

View file

@ -1,5 +1,18 @@
use core::ffi::c_int;
#[macro_export]
macro_rules! get_string_addr {
( $s:expr ) => {
Pstring {
pointer: addr_of!($s) as *const i8,
}
};
}
#[allow(unused_imports)]
pub(super) use get_string_addr;
use crate::Pstring;
#[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
pub enum Base {
Bin = 2,
@ -101,3 +114,15 @@ impl Printable for &str {
fn default_parameters() -> Self::Parameters {}
}
impl Printable for Pstring {
type Parameters = ();
fn print_2(self, _params: Self::Parameters) {
unsafe {
crate::library::arduboy::print_chars_progmem(self.pointer);
}
}
fn default_parameters() -> Self::Parameters {}
}