I'm trying to write a C++ program for an Atmel Microcontroller.
I need to use some of the functions that were already written in the ASF library, and I'm doing this by copying some of the code into C++ functions.
I get this error on compilation:
'union Pm' has no member named 'PM_CPUMASK'
The Pm
type union looks something like this:
typedef union {
struct {
....
} bf;
struct {
....
RwReg PM_CPUMASK;
....
} reg;
} Pm;`
In the ASF code, the member PM_CPUMASK
is accessed like this:
unsigned int mask = *(&PM->PM_CPUMASK + busId);
But I get an error. I think this is valid in C, but in C++ I would need to access the named struct and then the actual member. Using *(&PM->reg.PM_CPUMASK...)
I get no error, but is there a way to activate this style of member accessing in C++ compiler?
BTW, there's no naming conflicts in the members of the 2 structs. Thanks.