gba 0.15.0

A crate for 'raw' style GBA development. If you want a 'managed' experience, try the `agb` crate instead.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use critical_section::{set_impl, Impl, RawRestoreState};

use crate::mmio::IME;

struct GbaCriticalSection;
set_impl!(GbaCriticalSection);

unsafe impl Impl for GbaCriticalSection {
  unsafe fn acquire() -> RawRestoreState {
    let restore = IME.read();
    IME.write(false);
    restore
  }

  unsafe fn release(restore: RawRestoreState) {
    IME.write(restore);
  }
}