TCode Library
A library to aid in decoding/using of Toy Code ("T-Code") data.
Loading...
Searching...
No Matches
TCode Class Reference

Public Member Functions

 TCode ()
 default constructor for the TCode Class
 
 TCode (const char *firmware)
 constructor for the TCode class
 
 TCode (const char *firmware, const char *tcodeVersion)
 constructor for the TCode class
 
 TCode (const char *firmware, const char *tcodeVersion, const char *filepath)
 constructor for the TCode class
 
void inputByte (const byte input)
 function to input a byte into the input buffer
 
void inputChar (const char input)
 function to input a char into the input buffer
 
void inputString (const String &input)
 function to input a string into the input buffer
 
void inputCString (const char *&input)
 function to input a c-string into the input buffer
 
void clearBuffer ()
 function to clear the input buffer
 
bool registerAxis (TCodeAxis *axis)
 function to register a TCodeAxis with the TCode class
 
void axisWrite (const TCode_ChannelID &id, const int targetValue, const TCode_Axis_Extention_Type extentionValue=TCode_Axis_Extention_Type::Time, const long extMagnitude=0, const TCode_Axis_Ramp_Type rampType=TCode_Axis_Ramp_Type::Linear)
 function to write to a specified axis
 
void axisWrite (const char *name, const int targetValue, const TCode_Axis_Extention_Type extentionValue=TCode_Axis_Extention_Type::Time, const long extMagnitude=0, const TCode_Axis_Ramp_Type rampType=TCode_Axis_Ramp_Type::Linear)
 function to write to a specified axis
 
int axisRead (const TCode_ChannelID &channel_id)
 function to read the position of a specified axis
 
int axisRead (const char *name)
 function to read the position of a specified axis
 
void stop ()
 stops all axis movement at its current position (sets vibration channels to 0)
 
size_t available ()
 returns current available bytes in output buffer
 
char getChar ()
 returns next byte in output buffer (returns '\0' if no bytes present)
 
size_t getChar (char *buffer, const size_t length)
 returns bytes in output buffer to an external buffer
 
SettingsgetSettingManager ()
 gets the current instance of the settings manager
 

Detailed Description

Definition at line 24 of file TCode.h.

Constructor & Destructor Documentation

◆ TCode() [1/4]

TCode::TCode ( )

default constructor for the TCode Class

Definition at line 7 of file TCode.cpp.

◆ TCode() [2/4]

TCode::TCode ( const char *  firmware)

constructor for the TCode class

Parameters
firmwarethe name of firmware

Definition at line 14 of file TCode.cpp.

◆ TCode() [3/4]

TCode::TCode ( const char *  firmware,
const char *  tcodeVersion 
)

constructor for the TCode class

Parameters
firmwarethe name of firmware represented as a c-string
tcodeVersionthe name of tcode version represented as a c-string

Definition at line 21 of file TCode.cpp.

◆ TCode() [4/4]

TCode::TCode ( const char *  firmware,
const char *  tcodeVersion,
const char *  filepath 
)

constructor for the TCode class

Parameters
firmwarethe name of firmware represented as a c-string
tcodeVersionthe name of tcode version represented as a c-string
filepaththe filepath used by the settings file in SPIFFS represented by a c-string

Definition at line 28 of file TCode.cpp.

Member Function Documentation

◆ available()

size_t TCode::available ( )

returns current available bytes in output buffer

Definition at line 145 of file TCode.cpp.

◆ axisRead() [1/2]

int TCode::axisRead ( const char *  name)

function to read the position of a specified axis

Parameters
namename of the channel to read the current position from
Returns
current position or -1 if position could not be read

Definition at line 124 of file TCode.cpp.

◆ axisRead() [2/2]

int TCode::axisRead ( const TCode_ChannelID channel_id)

function to read the position of a specified axis

Parameters
idchannel ID to read the current position from
Returns
current position or -1 if position could not be read

Definition at line 114 of file TCode.cpp.

◆ axisWrite() [1/2]

void TCode::axisWrite ( const char *  name,
const int  targetValue,
const TCode_Axis_Extention_Type  extentionValue = TCode_Axis_Extention_Type::Time,
const long  extMagnitude = 0,
const TCode_Axis_Ramp_Type  rampType = TCode_Axis_Ramp_Type::Linear 
)

function to write to a specified axis

Parameters
namename of the channel to write to
targetValuethe target value for this axis
extentionValuethe extention type for the axis e.g. Time,Speed
extMagnitudethe value for the extention type
rampTypethe ramp type

Definition at line 105 of file TCode.cpp.

◆ axisWrite() [2/2]

void TCode::axisWrite ( const TCode_ChannelID id,
const int  targetValue,
const TCode_Axis_Extention_Type  extentionValue = TCode_Axis_Extention_Type::Time,
const long  extMagnitude = 0,
const TCode_Axis_Ramp_Type  rampType = TCode_Axis_Ramp_Type::Linear 
)

function to write to a specified axis

Parameters
idchannel ID to write to
targetValuethe target value for this axis
extentionValuethe extention type for the axis e.g. Time,Speed
extMagnitudethe value for the extention type
rampTypethe ramp type

Definition at line 96 of file TCode.cpp.

◆ clearBuffer()

void TCode::clearBuffer ( )

function to clear the input buffer

Definition at line 75 of file TCode.cpp.

◆ getChar() [1/2]

char TCode::getChar ( )

returns next byte in output buffer (returns '\0' if no bytes present)

Definition at line 150 of file TCode.cpp.

◆ getChar() [2/2]

size_t TCode::getChar ( char *  buffer,
const size_t  length 
)

returns bytes in output buffer to an external buffer

Returns
returns length of bytes put into the provided buffer

Definition at line 157 of file TCode.cpp.

◆ getSettingManager()

Settings * TCode::getSettingManager ( )

gets the current instance of the settings manager

Returns
returns the current Settings manager

Definition at line 168 of file TCode.cpp.

◆ inputByte()

void TCode::inputByte ( const byte  input)

function to input a byte into the input buffer

Parameters
inputbyte to be inputted

Definition at line 36 of file TCode.cpp.

◆ inputChar()

void TCode::inputChar ( const char  input)

function to input a char into the input buffer

Parameters
inputchar to be inputted

Definition at line 41 of file TCode.cpp.

◆ inputCString()

void TCode::inputCString ( const char *&  input)

function to input a c-string into the input buffer

Parameters
inputc-string to be inputted

Definition at line 66 of file TCode.cpp.

◆ inputString()

void TCode::inputString ( const String &  input)

function to input a string into the input buffer

Parameters
inputstring to be inputted

Definition at line 58 of file TCode.cpp.

◆ registerAxis()

bool TCode::registerAxis ( TCodeAxis axis)

function to register a TCodeAxis with the TCode class

Parameters
axisTCodeAxis pointer to be added to the TCode class to be processed
Returns
returns false if axis could not be registered

Definition at line 80 of file TCode.cpp.

◆ stop()

void TCode::stop ( )

stops all axis movement at its current position (sets vibration channels to 0)

Definition at line 134 of file TCode.cpp.


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