Right now I’m reading a beginner-level book called ‘Programming Embedded Systems’. It has one section explaining how to manipulate registers on a peripheral device using C.
It has an example at the beginning I just don’t get.
uint32_t *pGpio0Set = (uint32_t *)(0x40E00018);
I think this is declaring a pointer to a 32-bit unsigned integer. What I can also guess is that the register in question controls a GPIO and that the register lives at address 0x40E00018.
What I don’t understand is what the (uint32_t *) preceding (0x40E00018) means and what effect it has.
Andrew
It’s called a type cast. It generally converts a type to another. In this case it converts a hex number to an address. The parentheses around that hex number are superfluous.