Go Down

Topic: What is the 'config_t'? (Read 3160 times) previous topic - next topic

SouthernAtHeart

The code I'm working with:
http://www.arduino.cc/playground/Code/EEPROMWriteAnything

I know it works, but if I can understand HOW, it'll be way better. So...
There's no mention of 'struct' in the reference pages, but I understand that it makes something like a group variable.  What is the 'config_t'?  I couldn't find much googling it.
struct config_t
{
    long alarm;
    int mode;
} configuration;


Coding Badly

It's called a "tag".  It's somewhat like a typedef.  It allows you to create multiple instances of the structure...

struct config_t ConfigLoadedFromStorage;

struct config_t UserModifiableConfig;

SouthernAtHeart


SouthernAtHeart

...no, it doesn't seem to be optional like that webpage says, at least it doesn't compile without it.

Coding Badly

It is optional.  This compiles without error...

Code: [Select]
struct
{
    long alarm;
    int mode;
} configuration;

void setup( void )
{
}

void loop( void )
{
}

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy