updated
This commit is contained in:
parent
3c1f94ab0a
commit
cca197bf45
8 changed files with 42 additions and 31 deletions
1
.idea/Rust-for-Arduboy.iml
generated
1
.idea/Rust-for-Arduboy.iml
generated
|
@ -32,6 +32,7 @@
|
||||||
<sourceFolder url="file://$MODULE_DIR$/Examples/ArduboyFX/fxloadgamestate/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/Examples/ArduboyFX/fxloadgamestate/src" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/Examples/Arduboy-Tutorials/eeprom_byte/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/Examples/Arduboy-Tutorials/eeprom_byte/src" isTestSource="false" />
|
||||||
<sourceFolder url="file://$MODULE_DIR$/Project/game_pro/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/Project/game_pro/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/Project/test_game/src" isTestSource="false" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
|
|
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -265,6 +265,13 @@ version = "1.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "test_game"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"arduboy-rust",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tone"
|
name = "tone"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
[workspace]
|
[workspace]
|
||||||
members = ["arduboy-rust", "Examples/Arduboy-Tutorials/eeprom", "Examples/Arduboy-Tutorials/eeprom_byte", "Examples/Arduboy-Tutorials/progmem", "Examples/Arduboy-Tutorials/tone", "Examples/Arduboy-Tutorials/serial", "Examples/Arduboy-Tutorials/demo2", "Examples/Arduboy-Tutorials/demo3", "Examples/Arduboy-Tutorials/demo4", "Examples/Arduboy-Tutorials/demo5", "Examples/Arduboy-Tutorials/demo6", "Examples/Arduboy-Tutorials/demo7", "Examples/Arduboy-Tutorials/demo9", "Examples/ArduboyFX/fxbasicexample", "Examples/ArduboyFX/fxchompies", "Examples/ArduboyFX/fxdrawballs", "Examples/ArduboyFX/fxdrawframes", "Examples/ArduboyFX/fxhelloworld", "Examples/ArduboyFX/fxloadgamestate", "Examples/drboy", "Examples/ardvoice", "Examples/rustacean", "Examples/snake", "Project/game"]
|
members = ["arduboy-rust", "Examples/Arduboy-Tutorials/eeprom", "Examples/Arduboy-Tutorials/eeprom_byte", "Examples/Arduboy-Tutorials/progmem", "Examples/Arduboy-Tutorials/tone", "Examples/Arduboy-Tutorials/serial", "Examples/Arduboy-Tutorials/demo2", "Examples/Arduboy-Tutorials/demo3", "Examples/Arduboy-Tutorials/demo4", "Examples/Arduboy-Tutorials/demo5", "Examples/Arduboy-Tutorials/demo6", "Examples/Arduboy-Tutorials/demo7", "Examples/Arduboy-Tutorials/demo9", "Examples/ArduboyFX/fxbasicexample", "Examples/ArduboyFX/fxchompies", "Examples/ArduboyFX/fxdrawballs", "Examples/ArduboyFX/fxdrawframes", "Examples/ArduboyFX/fxhelloworld", "Examples/ArduboyFX/fxloadgamestate", "Examples/drboy", "Examples/ardvoice", "Examples/rustacean", "Examples/snake", "Project/game", "Project/test_game"]
|
||||||
resolver = "2"
|
resolver = "2"
|
|
@ -44,30 +44,3 @@ pub const B_BUTTON: ButtonSet = B;
|
||||||
pub struct ButtonSet {
|
pub struct ButtonSet {
|
||||||
pub flag_set: u8,
|
pub flag_set: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ButtonSet {
|
|
||||||
pub fn pressed(&self) -> bool {
|
|
||||||
unsafe { crate::libraries::arduboy2_library::binding::pressed(self.flag_set) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn just_pressed(&self) -> bool {
|
|
||||||
unsafe { crate::libraries::arduboy2_library::binding::just_pressed(self.flag_set) }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn just_released(&self) -> bool {
|
|
||||||
unsafe { crate::libraries::arduboy2_library::binding::just_released(self.flag_set) }
|
|
||||||
}
|
|
||||||
pub fn not_pressed(&self) -> bool {
|
|
||||||
unsafe { crate::libraries::arduboy2_library::binding::not_pressed(self.flag_set) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl core::ops::BitOr for ButtonSet {
|
|
||||||
type Output = Self;
|
|
||||||
|
|
||||||
fn bitor(self, other: Self) -> Self {
|
|
||||||
Self {
|
|
||||||
flag_set: self.flag_set | other.flag_set,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -27,7 +27,8 @@
|
||||||
|
|
||||||
extern crate panic_halt;
|
extern crate panic_halt;
|
||||||
pub mod hardware;
|
pub mod hardware;
|
||||||
mod libraries;
|
#[doc(hidden)]
|
||||||
|
pub mod libraries;
|
||||||
pub mod prelude;
|
pub mod prelude;
|
||||||
|
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
|
|
|
@ -665,3 +665,30 @@ impl Arduboy2 {
|
||||||
unsafe { arduboy_exit_to_bootloader() }
|
unsafe { arduboy_exit_to_bootloader() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ButtonSet {
|
||||||
|
pub fn pressed(&self) -> bool {
|
||||||
|
unsafe { pressed(self.flag_set) }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn just_pressed(&self) -> bool {
|
||||||
|
unsafe { just_pressed(self.flag_set) }
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn just_released(&self) -> bool {
|
||||||
|
unsafe { just_released(self.flag_set) }
|
||||||
|
}
|
||||||
|
pub fn not_pressed(&self) -> bool {
|
||||||
|
unsafe { not_pressed(self.flag_set) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl core::ops::BitOr for ButtonSet {
|
||||||
|
type Output = Self;
|
||||||
|
|
||||||
|
fn bitor(self, other: Self) -> Self {
|
||||||
|
Self {
|
||||||
|
flag_set: self.flag_set | other.flag_set,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub mod arduboy2;
|
pub mod arduboy2;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub mod binding;
|
mod binding;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub mod print;
|
pub mod print;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ pub use crate::hardware::buttons::*;
|
||||||
#[doc(inline)]
|
#[doc(inline)]
|
||||||
pub use crate::hardware::led::*;
|
pub use crate::hardware::led::*;
|
||||||
pub use crate::heapless::{LinearMap, String, Vec};
|
pub use crate::heapless::{LinearMap, String, Vec};
|
||||||
pub use crate::libraries::arduboy2_library::*;
|
pub use crate::libraries::arduboy2_library::arduboy2::*;
|
||||||
|
pub use crate::libraries::arduboy2_library::{print, sprites};
|
||||||
pub use crate::libraries::arduboy_tones_library::*;
|
pub use crate::libraries::arduboy_tones_library::*;
|
||||||
pub use crate::libraries::arduboyfx_library::*;
|
pub use crate::libraries::arduboyfx_library::*;
|
||||||
pub use crate::libraries::arduino_system::arduino::*;
|
pub use crate::libraries::arduino_system::arduino::*;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue