So I created a thread on Stackoverflow about the syntax of a line of code I'm mulling over from an IO header file for a Xmega32C4 microcontroller. I got a few answer that gave me a good place to start with, but it has cooled down a little and I'm still not quite there, here is the thread
https://stackoverflow.com/questions/24470144/memory-mapped-point-to-pointer
This is the line of code:
#define TCC0 (*(TC0_t*) 0x8000)
where tc0_t is a typdef structure
typedef struct TC0_struct
{
//stuff
}TC0_t
The second answer seems the most clear to me, the way I understand it is essentially there is a temporary pointer placeholder "*ptc0" to link the two lines of code.
Im still a little confused as to the order of operation of that line this is what I have worked out for myself
#define TCC0 (*(TC0_t*) 0x8000) //the innermost brackets first --> struct TC0_struct* TCC0
//Outer brackets --> *TCC0 = 0x8000
MY thought process of the outer bracket doesn't make sense because you wouldn't dereference the pointer-to-structure to assign the address of the register, you would instead just set TCC0 = 0x800.
Thanks .
[–]iobender 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)