NewAskSin
 All Classes Files Functions Variables Groups Pages
Classes | Macros | Functions | Variables
EEprom.h File Reference
#include "HAL.h"

Go to the source code of this file.

Classes

class  EE
 Helper class for providing access to non-volatile data in the EEprom. More...
 
struct  EE::s_cnlTbl
 Channel Table Entry. More...
 
struct  EE::s_peerTbl
 Peer Device Table Entry. More...
 
struct  EE::s_devDef
 Device Definition. More...
 

Macros

#define maxMsgLen   16
 

Functions

void everyTimeStart (void)
 Callback for actions after bootup. More...
 
void firstTimeStart (void)
 Callback for actions after EEprom deletion. More...
 
uint16_t crc16 (uint16_t crc, uint8_t a)
 
uint8_t compArray (void *p1, void *p2, uint8_t len)
 
uint8_t isEmpty (void *p1, uint8_t len)
 

Variables

EE::s_cnlTbl cnlTbl []
 Global device register channel table definition. Must be declared in user space.
 
EE::s_peerTbl peerTbl []
 Global peer table definition. Must be declared in user space. More...
 
EE::s_devDef devDef
 Global device definition. Must be declared in user space. More...
 
uint8_t MAID []
 Global definition of master HM-ID (paired central). More...
 
uint8_t HMID []
 Global definition of device HM-ID. Must be declared in user space. More...
 
uint8_t HMSR []
 Global definition of device serial number. Must be declared in user space. More...
 

Detailed Description

Ínclude file with EE class definiton and forward declaration of external helper functions

Function Documentation

void everyTimeStart ( void  )

Callback for actions after bootup.

This function is called when AS has started and before the main loop runs.

void firstTimeStart ( void  )

Callback for actions after EEprom deletion.

This function needs to be defined in the user code space. It can be used to set the data of complete Lists with EE::setList() or single registers using EE::setListArray()

Variable Documentation

EE::s_devDef devDef

Global device definition. Must be declared in user space.

Todo:
Insert description and example for devDef
uint8_t HMID[]

Global definition of device HM-ID. Must be declared in user space.

The HM-ID is a network-wide unique ID that is preassigned to each individual device along with its serial number HMSR (See Device Address for details).

The following example demonstrates how the HM-ID is declared in a way that allows to override the default during compile time with a compiler switch:

// Defaults for HMID and HMSR (serial number)
//
// Fallback values are defined below; to override these, use
// compiler switches
// -DEF_HMID=0xFAFBFC
// -DEF_HMSR='\"ABC6543210\"'
#ifndef EF_HMID
#define EF_HMID 0xF1F2F3
#endif
#ifndef EF_HMSR
#define EF_HMSR "ABC0123456"
#endif
unsigned char HMID[3] = { (EF_HMID>>16)&0xFF , (EF_HMID>>8)&0xFF , (EF_HMID>>0)&0xFF };
unsigned char HMSR[11] = EF_HMSR;
uint8_t HMSR[]

Global definition of device serial number. Must be declared in user space.

The following example demonstrates how the serial number is declared in a way that allows to override the default during compile time with a compiler switch:

// Defaults for HMID and HMSR (serial number)
//
// Fallback values are defined below; to override these, use
// compiler switches
// -DEF_HMID=0xFAFBFC
// -DEF_HMSR='\"ABC6543210\"'
#ifndef EF_HMID
#define EF_HMID 0xF1F2F3
#endif
#ifndef EF_HMSR
#define EF_HMSR "ABC0123456"
#endif
unsigned char HMID[3] = { (EF_HMID>>16)&0xFF , (EF_HMID>>8)&0xFF , (EF_HMID>>0)&0xFF };
unsigned char HMSR[11] = EF_HMSR;
uint8_t MAID[]

Global definition of master HM-ID (paired central).

MAID is valid after initialization of AS with AS::init(). While not paired to a central, MAID equals the broadcast address 000000. This is the case after first upload of a firmware when an unconfigured EEprom is encountered (EEprom magic number does not match) or after a reset of the device (RESET command sent by paired central or initiated by means of the config button).

The following example shows how HMID can be used for debugging purposes in user space:

Serial << F("HMID: ") << _HEX(HMID,3) << F(", MAID: ") << _HEX(MAID,3) << F("\n\n");
EE::s_peerTbl peerTbl[]

Global peer table definition. Must be declared in user space.

Todo:
Insert description and example for peerTbl