Skip to content

Commit

Permalink
ral1243: thread run handles nmi requests properly
Browse files Browse the repository at this point in the history
  • Loading branch information
royaltm committed Feb 12, 2024
1 parent cf819fa commit fcfe310
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/ral1243/src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,18 @@ impl<C: Cpu + Default, const EXT_HZ: u32, const FRAME_HZ: u32>
self.start();
let frame_duration: Duration = FrameRunner::<EXT_HZ, FRAME_HZ>::frame_duration();

let mut nmi_request = false;

let mut time = Instant::now();

let mut total_ts = 0u64;
let mut duration = Duration::ZERO;
let mut frame_count = 0;
loop {
if nmi_request && self.nmi() {
nmi_request = false;
}

let mtime = Instant::now();
let delta_ts = self.step();
let elapsed = mtime.elapsed();
Expand All @@ -73,7 +79,7 @@ impl<C: Cpu + Default, const EXT_HZ: u32, const FRAME_HZ: u32>
self.reset();
}
Ok(RunnerMsg::Nmi) => {
self.nmi(); // TODO
nmi_request = !self.nmi();
}
Err(TryRecvError::Empty) => {},
Err(TryRecvError::Disconnected) => break,
Expand Down

0 comments on commit fcfe310

Please sign in to comment.