agb/examples/beep.rs

32 lines
594 B
Rust
Raw Normal View History

2021-04-15 23:34:12 +01:00
#![no_std]
#![feature(start)]
extern crate gba;
2021-04-15 23:49:17 +01:00
use gba::sound;
2021-04-15 23:34:12 +01:00
#[start]
fn main(_argc: isize, _argv: *const *const u8) -> isize {
2021-04-16 00:09:46 +01:00
let gba = gba::Gba::new();
2021-04-15 23:34:12 +01:00
gba.sound.enable();
2021-04-15 23:49:17 +01:00
2021-04-16 00:09:46 +01: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-15 23:34:12 +01:00
2021-04-16 00:21:13 +01:00
gba.sound.channel2().play_sound(
1524,
Some(0),
&sound::EnvelopeSettings::default(),
sound::DutyCycle::Half,
);
2021-04-15 23:34:12 +01:00
loop {}
}