Skip to content

Commit 95f585d

Browse files
committed
Bit ops
1 parent 34ade6d commit 95f585d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,15 @@ we don't want to change settings in other bit ranges. So in general, if we want
203203
to clear N bits at position X:
204204

205205
```c
206-
PERIPHERAL->REGISTER &= ~((2^N - 1) << X);
206+
REGISTER &= ~((2^N - 1) << X);
207207
```
208208

209209
And, finally, we want to set a given bit range to the value we want. We
210210
shift that value X positions left, and OR with the current value of the whole
211211
register:
212212

213213
```c
214-
PERIPHERAL->REGISTER |= VALUE << X;
214+
REGISTER |= VALUE << X;
215215
```
216216

217217
## Human-readable peripherals programming

0 commit comments

Comments
 (0)