I have the following problem: I'm trying to define some basic struct, that helps me map a part of the controller memory to use it in more efficient way. Let me present you an example:
typedef struct
{
ICR1_t ICR1_dByte; /* 0x46 - 0x47 */
OCR1B_t OCR1B_dByte; /* 0x4A - 0x4B */
OCR1A_t OCR1A_dByte; /* 0x48 - 0x49 */
TCNT1_t TCNT1_dByte; /* 0x4C - 0x4D */
TCCR1B_t TCCR1B_Byte; /* 0x4E */
TCCR1A_t TCCR1A_Byte; /* 0x4F */
uint8_t Filler[8]; /* 0x50-0x57 */
TIFR1_t TIFR1_Byte; /* 0x58 */
TIMSK1_t TIMSK1_Byte; /* 0x59 */
}Timer1_str;
Usage define:
#define TIMER1str (*(volatile Timer1_str *)(TIMER1_START_ADDRESS))
Where the TIMER1_START_ADDRESS is defined as
(uint8_t *)&ICR1
(ICR1 is a part of basic definitions, some address, that's never mind)
So, my particular question is how to fill the gap in memory, located under 0x50-0x57 address? In current solution, the variable "Filler" is visible under all auto complement tools, so it is possible to invoke field:
TIMER1str.Filler[0] = 0xAA;
I wish to hide implementation of that filler. My first thought was to implement this filler as anonymous union, like this:
...
TCCR1A_t TCCR1A_Byte; /* 0x4F */
union { Filler[8]; }; /* 0x50-0x57 as anonymous */
TIFR1_t TIFR1_Byte; /* 0x58 */
....
But this solution is not working...
How to hide structure a member? It should set the memory but should not be accessible.