Fraise  2.1
FRAmework for Interfacing Software and Electronics
EEPROM parameters module

Save parameters values into EEPROM, and load them at setup. More...

Save parameters values into EEPROM, and load them at setup.


example :

#include "fruit.h"
int i;
void setup() {
EEreadMain(); // at boot time restore the value of "i" from EEPROM
}
void loop() { fruitService(); }
void fraiseReceive() // if we received a "raw bytes" message
{
unsigned char c = fraiseGetChar(); // get the first byte of the message
switch(c) {
PARAM_INT(1, i); // if the first byte was 1 then set "i"
EEwriteMain() ;// to the value of the next 16 bit integer and save EEPROM.
break;
}
}
void EEdeclareMain() {
EEdeclareInt(&i); // declare "i" as an 16 bit integer into EEPROM storage.
}

Read and write functions

void EEreadMain ()
 Load all the parameters values from EEPROM ; you may call it at setup()
 
void EEwriteMain ()
 Save all the parameters values to EEPROM.
 

Parameters declaration functions

void EEdeclareMain ()
 User may define this function, with a list of char/int/long declarations.
 
void EEdeclareChar (unsigned char *data)
 Declare a 8 bit integer in EEdeclareMain(). More...
 
void EEdeclareInt (unsigned int *data)
 Declare a 16 bit integer in EEdeclareMain(). More...
 
void EEdeclareLong (unsigned long *data)
 Declare a 32 bit integer in EEdeclareMain(). More...
 

Function Documentation

◆ EEdeclareChar()

void EEdeclareChar ( unsigned char *  data)

Declare a 8 bit integer in EEdeclareMain().

Parameters
dataAddress of the parameter.

◆ EEdeclareInt()

void EEdeclareInt ( unsigned int *  data)

Declare a 16 bit integer in EEdeclareMain().

Parameters
dataAddress of the parameter.

◆ EEdeclareLong()

void EEdeclareLong ( unsigned long *  data)

Declare a 32 bit integer in EEdeclareMain().

Parameters
dataAddress of the parameter.
EEwriteMain
void EEwriteMain()
Save all the parameters values to EEPROM.
fruitService
#define fruitService()
Fruit module service routine, to be called by main loop().
Definition: fruit.h:55
PARAM_INT
#define PARAM_INT(n, p)
in case n, assign next 16 bit integer in the message to p
Definition: fraisedevice.h:123
loop
void loop()
User defined forever loop.
EEdeclareMain
void EEdeclareMain()
User may define this function, with a list of char/int/long declarations.
fruit.h
fraiseReceive
void fraiseReceive()
Raw message to this device.
EEreadMain
void EEreadMain()
Load all the parameters values from EEPROM ; you may call it at setup()
EEdeclareInt
void EEdeclareInt(unsigned int *data)
Declare a 16 bit integer in EEdeclareMain().
setup
void setup()
User defined initialization.
fraiseGetChar
unsigned char fraiseGetChar()
Get next char from receive buffer.