VLCB
Loading...
Searching...
No Matches
VLCB::Configuration Class Reference

a class to encapsulate Controller module configuration, events, NVs, EEPROM, etc More...

#include <Configuration.h>

Public Member Functions

 Configuration ()
 ctor
 Configuration (Storage *theStorage)
void begin ()
 initialise and set default values
byte findExistingEvent (unsigned int nn, unsigned int en, byte startIndex=0) const
 lookup an event by node number and event number, using the hash table
byte findEventSpace () const
 find the first empty EEPROM event slot - the hash table entry == 0
byte findExistingEventByEv (byte evnum, byte evval) const
void printEvHashTable (bool raw)
 print the event hash table
byte getEvTableEntry (byte tindex) const
 return a single hash table entry by index
byte numEvents () const
 return the number of stored events
void updateEvHashEntry (byte idx)
 update a single hash table entry – after a learn or unlearn
void clearEvHashTable ()
 clear the hash table
byte getEventEVval (byte idx, byte evnum) const
 return an event variable (EV) value given the event table index and EV number
void writeEventEV (byte idx, byte evnum, byte evval)
 write an event variable
byte readNV (byte idx) const
void writeNV (byte idx, byte val)
bool isEventSlotInUse (byte eventIndex) const
void readEvent (byte idx, byte tarr[EE_HASH_BYTES]) const
 return an existing EEPROM event as a 4-byte array – NN + EN
void writeEvent (byte eventIndex, unsigned int nn, unsigned int en)
 generic EEPROM access methods
void writeEvent (byte index, const byte data[EE_HASH_BYTES])
void cleareventEEPROM (byte index)
 clear an event from the table
void resetModule ()
 reset the module to factory defaults
void commitToEEPROM ()
void setCANID (byte canid)
 store the CANID
void setModuleUninitializedMode ()
void setModuleNormalMode (unsigned int nodeNumber)
void setHeartbeat (bool beat)
void setNodeNum (unsigned int nn)
 store the node number
void setEventAck (bool ea)
void setFcuCompatability (bool fcu)
void setModuleId (byte manu, byte moduleId)
void setVersion (char maj, char min, char beta)
void setResetFlag ()
void clearResetFlag ()
bool isResetFlagSet ()
void setName (const char *mname)
const char * getModuleName () const
byte getNumNodeVariables () const
byte getNumEvents () const
byte getNumEVs () const
void setNumNodeVariables (int n)
void setNumEvents (int n)
void setNumEVs (int n)
bool getFlag (VlcbParamFlags flag)
void setFlag (VlcbParamFlags flag)
void clearFlag (VlcbParamFlags flag)
unsigned char getParam (VlcbParams p)
ParametersgetParams ()
unsigned int freeSRAM ()
 get free RAM
void reboot ()

Static Public Member Functions

static void setTwoBytes (byte *target, unsigned int value)
static unsigned int getTwoBytes (const byte *bytes)
static bool nnenEquals (const byte lhs[EE_HASH_BYTES], const byte rhs[EE_HASH_BYTES])
static const char * modeString (VlcbModeParams mode)

Public Attributes

unsigned int EE_NVS_START = LOCATION_RESERVED_SIZE
unsigned int EE_EVENTS_START = 0
byte EE_BYTES_PER_EVENT
unsigned int EE_FREE_BASE
unsigned int EE_USER_BYTES = 0
bool heartbeat
bool eventAck
bool fcuCompatible
byte CANID
VlcbModeParams currentMode
unsigned int nodeNum

Detailed Description

a class to encapsulate Controller module configuration, events, NVs, EEPROM, etc

Constructor & Destructor Documentation

◆ Configuration() [1/2]

VLCB::Configuration::Configuration ( )

ctor

◆ Configuration() [2/2]

VLCB::Configuration::Configuration ( Storage * theStorage)

Member Function Documentation

◆ begin()

void VLCB::Configuration::begin ( )

initialise and set default values

◆ findExistingEvent()

byte VLCB::Configuration::findExistingEvent ( unsigned int nn,
unsigned int en,
byte startIndex = 0 ) const

lookup an event by node number and event number, using the hash table

◆ findEventSpace()

byte VLCB::Configuration::findEventSpace ( ) const

find the first empty EEPROM event slot - the hash table entry == 0

◆ findExistingEventByEv()

byte VLCB::Configuration::findExistingEventByEv ( byte evnum,
byte evval ) const

◆ printEvHashTable()

void VLCB::Configuration::printEvHashTable ( bool raw)

print the event hash table

◆ getEvTableEntry()

byte VLCB::Configuration::getEvTableEntry ( byte tindex) const

return a single hash table entry by index

◆ numEvents()

byte VLCB::Configuration::numEvents ( ) const

return the number of stored events

◆ updateEvHashEntry()

void VLCB::Configuration::updateEvHashEntry ( byte idx)

update a single hash table entry – after a learn or unlearn

◆ clearEvHashTable()

void VLCB::Configuration::clearEvHashTable ( )

clear the hash table

◆ getEventEVval()

byte VLCB::Configuration::getEventEVval ( byte idx,
byte evnum ) const

return an event variable (EV) value given the event table index and EV number

◆ writeEventEV()

void VLCB::Configuration::writeEventEV ( byte idx,
byte evnum,
byte evval )

write an event variable

◆ readNV()

byte VLCB::Configuration::readNV ( byte idx) const

read an NV value from EEPROM note that NVs number from 1, not 0

◆ writeNV()

void VLCB::Configuration::writeNV ( byte idx,
byte val )

write an NV value to EEPROM note that NVs number from 1, not 0

◆ isEventSlotInUse()

bool VLCB::Configuration::isEventSlotInUse ( byte eventIndex) const

◆ readEvent()

void VLCB::Configuration::readEvent ( byte idx,
byte tarr[EE_HASH_BYTES] ) const

return an existing EEPROM event as a 4-byte array – NN + EN

◆ writeEvent() [1/2]

void VLCB::Configuration::writeEvent ( byte eventIndex,
unsigned int nn,
unsigned int en )

generic EEPROM access methods

write (or clear) an event to EEPROM just the first four bytes – NN and EN

◆ writeEvent() [2/2]

void VLCB::Configuration::writeEvent ( byte index,
const byte data[EE_HASH_BYTES] )

◆ cleareventEEPROM()

void VLCB::Configuration::cleareventEEPROM ( byte index)

clear an event from the table

◆ resetModule()

void VLCB::Configuration::resetModule ( )

reset the module to factory defaults

◆ commitToEEPROM()

void VLCB::Configuration::commitToEEPROM ( )

◆ setCANID()

void VLCB::Configuration::setCANID ( byte canid)

store the CANID

◆ setModuleUninitializedMode()

void VLCB::Configuration::setModuleUninitializedMode ( )

◆ setModuleNormalMode()

void VLCB::Configuration::setModuleNormalMode ( unsigned int nodeNumber)

◆ setHeartbeat()

void VLCB::Configuration::setHeartbeat ( bool beat)

◆ setNodeNum()

void VLCB::Configuration::setNodeNum ( unsigned int nn)

store the node number

◆ setEventAck()

void VLCB::Configuration::setEventAck ( bool ea)

◆ setFcuCompatability()

void VLCB::Configuration::setFcuCompatability ( bool fcu)

◆ setModuleId()

void VLCB::Configuration::setModuleId ( byte manu,
byte moduleId )

◆ setVersion()

void VLCB::Configuration::setVersion ( char maj,
char min,
char beta )

◆ setResetFlag()

void VLCB::Configuration::setResetFlag ( )

a group of methods to get and set the reset flag the resetModule method writes the value 99 to EEPROM address 5 when a module reset has been performed this can be tested at module startup for e.g. setting default NVs or creating producer events

◆ clearResetFlag()

void VLCB::Configuration::clearResetFlag ( )

◆ isResetFlagSet()

bool VLCB::Configuration::isResetFlagSet ( )

◆ setName()

void VLCB::Configuration::setName ( const char * mname)

◆ getModuleName()

const char * VLCB::Configuration::getModuleName ( ) const
inline

◆ getNumNodeVariables()

byte VLCB::Configuration::getNumNodeVariables ( ) const

◆ getNumEvents()

byte VLCB::Configuration::getNumEvents ( ) const

◆ getNumEVs()

byte VLCB::Configuration::getNumEVs ( ) const

◆ setNumNodeVariables()

void VLCB::Configuration::setNumNodeVariables ( int n)

◆ setNumEvents()

void VLCB::Configuration::setNumEvents ( int n)

◆ setNumEVs()

void VLCB::Configuration::setNumEVs ( int n)

◆ getFlag()

bool VLCB::Configuration::getFlag ( VlcbParamFlags flag)

◆ setFlag()

void VLCB::Configuration::setFlag ( VlcbParamFlags flag)

◆ clearFlag()

void VLCB::Configuration::clearFlag ( VlcbParamFlags flag)

◆ getParam()

unsigned char VLCB::Configuration::getParam ( VlcbParams p)

◆ getParams()

Parameters & VLCB::Configuration::getParams ( )

◆ freeSRAM()

unsigned int VLCB::Configuration::freeSRAM ( )

get free RAM

◆ reboot()

void VLCB::Configuration::reboot ( )

◆ setTwoBytes()

void VLCB::Configuration::setTwoBytes ( byte * target,
unsigned int value )
static

◆ getTwoBytes()

unsigned int VLCB::Configuration::getTwoBytes ( const byte * bytes)
static

◆ nnenEquals()

bool VLCB::Configuration::nnenEquals ( const byte lhs[EE_HASH_BYTES],
const byte rhs[EE_HASH_BYTES] )
static

◆ modeString()

const char * VLCB::Configuration::modeString ( VlcbModeParams mode)
static

Member Data Documentation

◆ EE_NVS_START

unsigned int VLCB::Configuration::EE_NVS_START = LOCATION_RESERVED_SIZE

◆ EE_EVENTS_START

unsigned int VLCB::Configuration::EE_EVENTS_START = 0

◆ EE_BYTES_PER_EVENT

byte VLCB::Configuration::EE_BYTES_PER_EVENT

◆ EE_FREE_BASE

unsigned int VLCB::Configuration::EE_FREE_BASE

◆ EE_USER_BYTES

unsigned int VLCB::Configuration::EE_USER_BYTES = 0

◆ heartbeat

bool VLCB::Configuration::heartbeat

◆ eventAck

bool VLCB::Configuration::eventAck

◆ fcuCompatible

bool VLCB::Configuration::fcuCompatible

◆ CANID

byte VLCB::Configuration::CANID

◆ currentMode

VlcbModeParams VLCB::Configuration::currentMode

◆ nodeNum

unsigned int VLCB::Configuration::nodeNum

The documentation for this class was generated from the following files: