DCCpp
This is the library version of a program for Arduino to control railroading DCC devices.
FunctionsState Class Reference

#include "DCCpp.hpp"

Public Member Functions

 FunctionsState ()
 
void clear ()
 
void activate (byte inFunctionNumber)
 
void inactivate (byte inFunctionNumber)
 
bool isActivated (byte inFunctionNumber)
 
void statesSent ()
 
bool isActivationChanged (byte inFunctionNumber)
 

Detailed Description

This is a class to handle decoder functions. An instance of this class handle the status of the functions of one decoder. A function can be active or not.

Definition at line 13 of file DCCpp.hpp.

Constructor & Destructor Documentation

FunctionsState ( )

Initialize the instance.

Definition at line 24 of file DCCpp.cpp.

Member Function Documentation

void clear ( )

Reset all functions to inactive.

Definition at line 29 of file DCCpp.cpp.

void activate ( byte  inFunctionNumber)

Activate one function. The allowed number goes from 0 to 28, maximum for DCC.

Parameters
inFunctionNumberNumber of the function to activate.

Definition at line 40 of file DCCpp.cpp.

void inactivate ( byte  inFunctionNumber)

Inactivate one function. The allowed number goes from 0 to 28, maximum for DCC.

Parameters
inFunctionNumberNumber of the function to inactivate.

Definition at line 45 of file DCCpp.cpp.

bool isActivated ( byte  inFunctionNumber)

Check if the given function is activated. The allowed number goes from 0 to 28, maximum for DCC.

Parameters
inFunctionNumberNumber of the function to activate.
Returns
True if the given function is activated.

Definition at line 50 of file DCCpp.cpp.

void statesSent ( )

Copy the current active flags into 'sent' active flags.

Definition at line 60 of file DCCpp.cpp.

bool isActivationChanged ( byte  inFunctionNumber)

Check if the given function had its activation flag changed when sent to the decoder last time. The allowed number goes from 0 to 28, maximum for DCC.

Parameters
inFunctionNumberNumber of the function to check.
Returns
True if the given function activation flag is different between activFlags and sentActiveFlags.

Definition at line 55 of file DCCpp.cpp.