added new demo for progmem and implemented new features for the usage of progmem.

This commit is contained in:
Zenn 2023-08-07 18:17:52 +02:00
parent 5fdfcf88c4
commit d9cb232cef
14 changed files with 148 additions and 117 deletions

View file

@ -7,5 +7,4 @@ edition = "2021"
crate-type = ["staticlib"]
[dependencies]
avr-progmem = "0.3.3"
arduboy-rust = { path = "../../arduboy-rust" }

View file

@ -1,30 +1,21 @@
#![no_std]
#![allow(non_upper_case_globals)]
#![feature(const_trait_impl)]
use core::cell::LazyCell;
//Include the Arduboy Library
//Initialize the arduboy object
#[allow(unused_imports)]
use arduboy_rust::prelude::*;
#[link_section = ".progmem.data"]
static lol2: [u8; 29] = [
0x54, 0x68, 0x61, 0x6E, 0x6B, 0x73, 0x20, 0x61, 0x20, 0x6C, 0x6F, 0x74, 0x0A, 0x79, 0x6F, 0x75,
0x20, 0x61, 0x72, 0x65, 0x20, 0x61, 0x20, 0x0A, 0x48, 0x65, 0x72, 0x6F, 0x00,
];
#[link_section = ".progmem.data"]
static lol1: [u8; 10] = LazyCell::new(|| "hallowelt\0".as_bytes().try_into().unwrap());
// Progmem data
//#[link_section = ".progmem.data"]
// dynamic ram variables
// The setup() function runs once when you turn your Arduboy on
#[no_mangle]
pub unsafe extern "C" fn setup() {
// put your setup code here, to run once:
arduboy.begin();
arduboy.clear();
arduboy.print(get_string_addr!(lol1));
arduboy.display();
}
// The loop() function repeats forever after setup() is done
#[no_mangle]
#[export_name = "loop"]