EEPROMBYTECHECKLESS

This commit is contained in:
PrimmR 2023-09-09 18:04:08 +01:00
parent 959d112b90
commit 7da07df0f7
2 changed files with 26 additions and 1 deletions

View file

@ -138,3 +138,28 @@ impl EEPROMBYTE {
unsafe { arduboy_eeprom_write_raw(self.idx, val) }
}
}
pub struct EEPROMBYTECHECKLESS {
idx: i16,
}
impl EEPROMBYTECHECKLESS {
pub const fn new(mut idx: i16) -> EEPROMBYTECHECKLESS {
if idx > 1010 {
idx = 0
}
EEPROMBYTECHECKLESS {
idx: EEPROM_STORAGE_SPACE_START + idx,
}
}
pub fn init(&self) {
}
pub fn read(&self) -> u8 {
unsafe { arduboy_eeprom_read_raw(self.idx) }
}
pub fn update(&self, val: u8) {
unsafe { arduboy_eeprom_update_raw(self.idx, val) }
}
pub fn write(&self, val: u8) {
unsafe { arduboy_eeprom_write_raw(self.idx, val) }
}
}

View file

@ -13,7 +13,7 @@ pub use crate::library::arduboy2::{self, *};
pub use crate::library::arduboy_tone::{self, ArduboyTones};
pub use crate::library::arduino::*;
pub use crate::library::c::*;
pub use crate::library::eeprom::{EEPROM, EEPROMBYTE};
pub use crate::library::eeprom::{EEPROM, EEPROMBYTE, EEPROMBYTECHECKLESS};
#[doc(hidden)]
pub use crate::library::progmem::Pstring;
pub use crate::library::sprites;