agb/examples/beep.rs

32 lines
594 B
Rust
Raw Normal View History

2021-04-16 08:34:12 +10:00
#![no_std]
#![feature(start)]
2021-04-16 09:23:02 +10:00
extern crate agb;
2021-04-16 08:34:12 +10:00
2021-04-16 09:23:02 +10:00
use agb::sound;
2021-04-16 08:34:12 +10:00
#[start]
fn main(_argc: isize, _argv: *const *const u8) -> isize {
2021-04-16 09:23:02 +10:00
let gba = agb::Gba::new();
2021-04-16 08:34:12 +10:00
gba.sound.enable();
2021-04-16 08:49:17 +10:00
2021-04-16 09:09:46 +10:00
let sweep_settings = sound::SweepSettings::default();
gba.sound.channel1().play_sound(
1024,
Some(0),
&sweep_settings,
&sound::EnvelopeSettings::default(),
sound::DutyCycle::Half,
);
2021-04-16 08:34:12 +10:00
2021-04-16 09:21:13 +10:00
gba.sound.channel2().play_sound(
1524,
Some(0),
&sound::EnvelopeSettings::default(),
sound::DutyCycle::Half,
);
2021-04-16 08:34:12 +10:00
loop {}
}