tcMenu
Classes | Functions | Variables
tcUtil.h File Reference

A series of utilities that used throughout tcMenu. More...

Go to the source code of this file.

Classes

struct  ConnectorLocalInfo
 

Functions

uint32_t getBoardSerialNumber ()
 
void showVersionDialog (const ConnectorLocalInfo *localInfo)
 
AnyMenuInfonewAnyMenuInfoP (const char *name, menuid_t id, uint16_t eeprom, MenuCallbackFn cb, uint16_t max=0)
 
AnyMenuInfonewAnyMenuInfo (const char *name, menuid_t id, uint16_t eeprom, MenuCallbackFn cb, uint16_t max=0)
 
AnalogMenuInfonewAnalogMenuInfoP (const char *name, menuid_t id, uint16_t eeprom, MenuCallbackFn cb, uint16_t max, uint16_t offset, uint16_t divisor, const char *unit)
 
AnalogMenuInfonewAnalogMenuInfo (const char *name, menuid_t id, uint16_t eeprom, MenuCallbackFn cb, uint16_t max, uint16_t offset, uint16_t divisor, const char *unit)
 
BooleanMenuInfonewBooleanMenuInfoP (const char *name, menuid_t id, uint16_t eeprom, MenuCallbackFn cb, BooleanNaming naming)
 
BooleanMenuInfonewBooleanMenuInfo (const char *name, menuid_t id, uint16_t eeprom, MenuCallbackFn cb, BooleanNaming naming)
 
FloatMenuInfonewFloatMenuInfoP (const char *name, menuid_t id, uint16_t eeprom, MenuCallbackFn cb, int decimalPlaces)
 
FloatMenuInfonewFloatMenuInfo (const char *name, menuid_t id, uint16_t eeprom, MenuCallbackFn cb, int decimalPlaces)
 
uint8_t safeProgCpy (char *dst, const char *pgmSrc, uint8_t size)
 
char * potentialProgramMemory (const char *x)
 

Variables

char szGlobalBuffer []
 

Detailed Description

A series of utilities that used throughout tcMenu.


Class Documentation

◆ ConnectorLocalInfo

struct ConnectorLocalInfo

This structure is created in program memory and passed to all RemoteConnector instances. It contains the name that this device should be identified by and it's UUID.

Class Members
char name[30]
char uuid[38]

Function Documentation

◆ getBoardSerialNumber()

uint32_t getBoardSerialNumber ( )

Provides the serial number for the board, it can be displayed and also used in remote JOIN messages to identify the board uniquiely by UUID and serial number.

If you want to use the default implementation you can define flag TC_BOARD_SERIAL_NO to a long int value that will be stored as a constant in memory.

If you want to have a custom implementation, define TC_MANUAL_SERIAL_NO_IMPL and then you must implement this method yourself instead. This function should not take undue time if implemented by you as it could block networking.

Returns
the serial number

◆ showVersionDialog()

void showVersionDialog ( const ConnectorLocalInfo localInfo)

Show the TcMenu version in a dialog that can be dismissed

Parameters
localInfothe local app information

◆ newAnyMenuInfoP()

AnyMenuInfo* newAnyMenuInfoP ( const char *  name,
menuid_t  id,
uint16_t  eeprom,
MenuCallbackFn  cb,
uint16_t  max = 0 
)

Create a menu info structure using the new operator for the given parameters, max value is optional

Parameters
namethe name to copy from RAM not PGM
idthe ID to give the info block
eepromthe eerprom position or -1
cbthe callback to apply or nullptr
maxoptional the max value

◆ newAnyMenuInfo()

AnyMenuInfo* newAnyMenuInfo ( const char *  name,
menuid_t  id,
uint16_t  eeprom,
MenuCallbackFn  cb,
uint16_t  max = 0 
)

Create a menu info structure using the new operator for the given parameters, max value is optional

Parameters
namethe name to copy from RAM
idthe ID to give the info block
eepromthe eerprom position or -1
cbthe callback to apply or nullptr
maxoptional the max value

◆ newAnalogMenuInfoP()

AnalogMenuInfo* newAnalogMenuInfoP ( const char *  name,
menuid_t  id,
uint16_t  eeprom,
MenuCallbackFn  cb,
uint16_t  max,
uint16_t  offset,
uint16_t  divisor,
const char *  unit 
)

Create a menu info structure using the new operator for the given parameters, it populates all the fields for an analog item dynamically

Parameters
namethe name to copy from PGM
idthe ID to give the info block
eepromthe eerprom position or -1
cbthe callback to apply or nullptr
maxoptional the max value
offsetthe offset to apply
divisorthe divisor to apply
unitthe unit to copy from PGM

◆ newAnalogMenuInfo()

AnalogMenuInfo* newAnalogMenuInfo ( const char *  name,
menuid_t  id,
uint16_t  eeprom,
MenuCallbackFn  cb,
uint16_t  max,
uint16_t  offset,
uint16_t  divisor,
const char *  unit 
)

Create a menu info structure using the new operator for the given parameters, it populates all the fields for an analog item dynamically

Parameters
namethe name to copy from RAM
idthe ID to give the info block
eepromthe eerprom position or -1
cbthe callback to apply or nullptr
maxoptional the max value
offsetthe offset to apply
divisorthe divisor to apply
unitthe unit to copy from RAM

◆ newBooleanMenuInfoP()

BooleanMenuInfo* newBooleanMenuInfoP ( const char *  name,
menuid_t  id,
uint16_t  eeprom,
MenuCallbackFn  cb,
BooleanNaming  naming 
)

Create a menu info structure using the new operator for the given parameters, it populates all the fields for a boolean item dynamically

Parameters
namethe name to copy from PGM
idthe ID to give the info block
eepromthe eerprom position or -1
cbthe callback to apply or nullptr
namingthe naming type to use

◆ newBooleanMenuInfo()

BooleanMenuInfo* newBooleanMenuInfo ( const char *  name,
menuid_t  id,
uint16_t  eeprom,
MenuCallbackFn  cb,
BooleanNaming  naming 
)

Create a menu info structure using the new operator for the given parameters, it populates all the fields for a boolean item dynamically

Parameters
namethe name to copy from RAM
idthe ID to give the info block
eepromthe eerprom position or -1
cbthe callback to apply or nullptr
namingthe naming type to use

◆ newFloatMenuInfoP()

FloatMenuInfo* newFloatMenuInfoP ( const char *  name,
menuid_t  id,
uint16_t  eeprom,
MenuCallbackFn  cb,
int  decimalPlaces 
)

Create a menu info structure using the new operator for the given parameters, it populates all the fields for a float item dynamically

Parameters
namethe name to copy from PGM
idthe ID to give the info block
eepromthe eerprom position or -1
cbthe callback to apply or nullptr
decimalPlacesthe number of DP to display

◆ newFloatMenuInfo()

FloatMenuInfo* newFloatMenuInfo ( const char *  name,
menuid_t  id,
uint16_t  eeprom,
MenuCallbackFn  cb,
int  decimalPlaces 
)

Create a menu info structure using the new operator for the given parameters, it populates all the fields for a float item dynamically

Parameters
namethe name to copy from RAM
idthe ID to give the info block
eepromthe eerprom position or -1
cbthe callback to apply or nullptr
decimalPlacesthe number of DP to display

◆ safeProgCpy()

uint8_t safeProgCpy ( char *  dst,
const char *  pgmSrc,
uint8_t  size 
)

This is always safe to call, if there's a string that's in program mem on AVR but not on other boards, this always does the right thing.

Parameters
dstthe destination buffer
pgmSrcthe source to be copied (program mem on AVR)
sizethe size of dst.