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) };
|
unsafe { write_volatile(DDRB, 0b11111111) };
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
unsafe { write_volatile(PORTB, 0b00000000) };
|
let mut portb_value = unsafe { read_volatile(PORTB) };
|
||||||
sleep(1);
|
portb_value = portb_value ^ (1 << 5);
|
||||||
unsafe { write_volatile(PORTB, 0b00100000) };
|
unsafe { write_volatile(PORTB, portb_value) };
|
||||||
sleep(1);
|
sleep(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue