@@ -160,8 +160,8 @@ By setting individual bits, we can selectively set specific pins to a desired
160160mode. For example, this snippet sets pin A3 to output mode:
161161
162162``` c
163- * (volatile uint32_t *) (0x40020000 + 0 ) &= ~(3 << 6 ); // CLear bits 6-7
164- * (volatile uint32_t *) (0x40020000 + 0 ) |= 1 << 6 ; // Set bits 6-7 to 1
163+ * (volatile uint32_t *) (0x40020000 + 0 ) &= ~(3 << 6 ); // CLear bit range 6-7
164+ * (volatile uint32_t *) (0x40020000 + 0 ) |= 1 << 6 ; // Set bit range 6-7 to 1
165165```
166166
167167Let me explain those bit operations. Our goal is to set bits 6-7, which are
@@ -209,8 +209,8 @@ Now, it should be clear to you, dear reader, the meaning of these two lines,
209209which set bits 6-7 of the GPIOA MODER register to the value of 1 (output).
210210
211211``` c
212- * (volatile uint32_t *) (0x40020000 + 0 ) &= ~(3 << 6 ); // CLear bits 6-7
213- * (volatile uint32_t *) (0x40020000 + 0 ) |= 1 << 6 ; // Set bits 6-7 to 1
212+ * (volatile uint32_t *) (0x40020000 + 0 ) &= ~(3 << 6 ); // CLear bit range 6-7
213+ * (volatile uint32_t *) (0x40020000 + 0 ) |= 1 << 6 ; // Set bit range 6-7 to 1
214214```
215215
216216Some registers are not mapped to the MCU peripherals, but they are mapped to
@@ -225,8 +225,8 @@ register by direct accessing certain memory addresses. Let's look at the
225225snippet that sets pin A3 to output mode:
226226
227227``` c
228- * (volatile uint32_t *) (0x40020000 + 0 ) &= ~(3 << 6 ); // CLear bits 6-7
229- * (volatile uint32_t *) (0x40020000 + 0 ) |= 1 << 6 ; // Set bits 6-7 to 1
228+ * (volatile uint32_t *) (0x40020000 + 0 ) &= ~(3 << 6 ); // CLear bit range 6-7
229+ * (volatile uint32_t *) (0x40020000 + 0 ) |= 1 << 6 ; // Set bit range 6-7 to 1
230230```
231231
232232That is pretty cryptic. Without extensive comments, such code would be quite
0 commit comments