attempt to deglitch lights. dubious.
This commit is contained in:
parent
e745c55b51
commit
ca70b50e49
1 changed files with 68 additions and 26 deletions
|
@ -63,6 +63,47 @@ where
|
|||
{
|
||||
#[inline]
|
||||
pub fn write(&mut self, bit: bool) {
|
||||
if bit {
|
||||
unsafe {
|
||||
compiler_fence(Ordering::SeqCst);
|
||||
self.high_out.set_high().unwrap();
|
||||
compiler_fence(Ordering::SeqCst);
|
||||
asm!(
|
||||
// 15 nops
|
||||
"nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;",
|
||||
"nop;", "nop;", "nop;", "nop;", "nop;",
|
||||
);
|
||||
compiler_fence(Ordering::SeqCst);
|
||||
self.high_out.set_low().unwrap();
|
||||
compiler_fence(Ordering::SeqCst);
|
||||
asm!(
|
||||
// 8 nops
|
||||
"nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;",
|
||||
);
|
||||
compiler_fence(Ordering::SeqCst);
|
||||
}
|
||||
} else {
|
||||
unsafe {
|
||||
compiler_fence(Ordering::SeqCst);
|
||||
self.high_out.set_high().unwrap();
|
||||
compiler_fence(Ordering::SeqCst);
|
||||
asm!(
|
||||
// 8 nops
|
||||
"nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;",
|
||||
);
|
||||
compiler_fence(Ordering::SeqCst);
|
||||
self.high_out.set_low().unwrap();
|
||||
compiler_fence(Ordering::SeqCst);
|
||||
asm!(
|
||||
// 15 nops
|
||||
"nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;",
|
||||
"nop;", "nop;", "nop;", "nop;", "nop;",
|
||||
);
|
||||
compiler_fence(Ordering::SeqCst);
|
||||
}
|
||||
}
|
||||
|
||||
if false {
|
||||
// go high
|
||||
self.high_out.set_high().unwrap();
|
||||
|
||||
|
@ -82,8 +123,8 @@ where
|
|||
compiler_fence(Ordering::SeqCst);
|
||||
asm!(
|
||||
// 14 nops
|
||||
"nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;",
|
||||
"nop;", "nop;", "nop;", "nop;",
|
||||
"nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;", "nop;",
|
||||
"nop;", "nop;", "nop;", "nop;", "nop;",
|
||||
);
|
||||
compiler_fence(Ordering::SeqCst);
|
||||
}
|
||||
|
@ -102,6 +143,7 @@ where
|
|||
compiler_fence(Ordering::SeqCst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn byte(&mut self, byte: u8) {
|
||||
|
|
Loading…
Reference in a new issue