now use the read_volatile and xor op to flip the bit value
parent
fa6f69cab4
commit
76102d28a4
|
@ -15,9 +15,9 @@ pub extern "C" fn main() -> ! {
|
|||
unsafe { write_volatile(DDRB, 0b11111111) };
|
||||
|
||||
loop {
|
||||
unsafe { write_volatile(PORTB, 0b00000000) };
|
||||
sleep(1);
|
||||
unsafe { write_volatile(PORTB, 0b00100000) };
|
||||
let mut portb_value = unsafe { read_volatile(PORTB) };
|
||||
portb_value = portb_value ^ (1 << 5);
|
||||
unsafe { write_volatile(PORTB, portb_value) };
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue