diff --git a/examples/rtic_bare4.rs b/examples/rtic_bare4.rs index 1d53d13715b0afe372d3ab430e5fe1c301fb740a..6b4284b613942ff9c8274b09e4444bb2fabb01cd 100644 --- a/examples/rtic_bare4.rs +++ b/examples/rtic_bare4.rs @@ -58,22 +58,22 @@ const APP: () = { fn init(_cx: init::Context) { // power on GPIOA let r = read_u32(RCC_AHB1ENR); // read - write_u32(RCC_AHB1ENR, r | 1); // set enable + write_u32(RCC_AHB1ENR, r | 1); // set enable GPIOAEN, IOPort A clock // configure PA5 as output - let r = read_u32(GPIOA_MODER) & !(0b11 << (5 * 2)); // read and mask - write_u32(GPIOA_MODER, r | 0b01 << (5 * 2)); // set output mode + let r = read_u32(GPIOA_MODER) & !(0b11 << (5 * 2)); // read and mask, keep all values except MODER5, MODER5 = 00. + write_u32(GPIOA_MODER, r | 0b01 << (5 * 2)); // set output mode, set MODER5 to 01 = general purpose output mode. // and alter the data output through the BSRR register // this is more efficient as the read register is not needed. loop { // set PA5 high - write_u32(GPIOA_BSRR, 1 << 5); // set bit, output hight (turn on led) + write_u32(GPIOA_BSRR, 1 << 5); // set bit, output hight (turn on led), sets the 5:th ODRx bit wait(10_000); // set PA5 low - write_u32(GPIOA_BSRR, 1 << (5 + 16)); // clear bit, output low (turn off led) + write_u32(GPIOA_BSRR, 1 << (5 + 16)); // clear bit, output low (turn off led), resets the 5:th ODRx bit wait(10_000); } } @@ -83,7 +83,7 @@ const APP: () = { // // 1. Did you enjoy the blinking? // -// ** your answer here ** +// Yes, it is very nice. // // Now lookup the data-sheets, and read each section referred, // 6.3.11, 8.4.1, 8.4.7