3 ms·
What does this line of code mean? *(volatile uint32_t *)0x40021018 = 0x00000004; Why is a pointer being created and dereferenced at the same time?
by sansnomme 7y ago
What does this line of code mean?
*(volatile uint32_t *)0x40021018 = 0x00000004;
Why is a pointer being created and dereferenced at the same time?
- prudhvis 7y agoThats memory mapped IO. Registers, and control registers are mapped onto certain regions of memory on ARM Coretx-M processors.
- chli 7y agoIt's how you access memory mapped registers in C. It's writing the value 0x04 at that address using a 32-bit memory write. There is a peripheral register at that location.
- ahaferburg 7y agoYou could split up the definition of the pointer and the dereferencing+assignment: volatile uint32_t* p = (volatile uint32_t *)0x40021018; *p = 0x00000004;
- deleted 7y ago[deleted]