[−][src]Macro avr_progmem::progmem
Define a static in progmem.
This is a helper macro to simplify the definition of statics that are valid
to be wrapped in the ProgMem
struct thus providing a safe way to work
with data in progmem.
Thus this macro essentially takes a user static definition and emits a
definition that is defined to be stored in the progmem section and then is
wrap in the ProgMem
wrapper for safe access.
Examples
use avr_progmem::progmem; progmem!{ /// Static string stored in progmem! pub static progmem WORDS: [u8; 4] = *b"abcd"; } let data: [u8; 4] = WORDS.load(); assert_eq!(b"abcd", &data);
use avr_progmem::progmem; progmem!{ /// 4kB string stored in progmem! pub static progmem WORDS: [u8; 4096] = [b'X'; 4096]; } let first_bytes: [u8; 16] = WORDS.load_sub_array(0); assert_eq!([b'X'; 16], first_bytes);