now use the read_volatile and xor op to flip the bit value

low_level
kirbylife 2022-12-10 00:45:48 -06:00
parent fa6f69cab4
commit 76102d28a4
1 changed files with 3 additions and 3 deletions

View File

@ -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);
}
}