Accessories
Arduino for motors and lights library.
AccessoryLight Class Reference

#include "AccessoryLight.hpp"

Inheritance diagram for AccessoryLight:
Accessory

Public Member Functions

 AccessoryLight ()
 
void begin (Port *inpPort, unsigned long inId, unsigned long inBlinkDuration = 0, int inIntensity = 255)
 
void SetFading (uint8_t inStep, uint8_t inDelay)
 
bool IsOn () const
 
bool IsBlinking () const
 
bool IsFading () const
 
void Event (unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID, int inData = 0)
 
void SetState (ACC_STATE inState)
 
ACC_STATE Toggle ()
 
void LightOn ()
 
void LightOff ()
 
void Blink ()
 
int EEPROMLoad (int inPos)
 
- Public Member Functions inherited from Accessory
 Accessory ()
 
void begin (ACC_STATE inStartingState = STATE_NONE)
 
PortGetPort () const
 
ACC_STATE GetState () const
 
ACC_STATE GetPreviousState () const
 
bool IsNone () const
 
bool IsFirst () const
 
bool IsSecond () const
 
uint8_t AddMovingPosition (unsigned long inId, int inPosition)
 
unsigned int GetDebounceDelay () const
 
unsigned long GetLastMoveTime () const
 
unsigned long GetDuration () const
 
bool loop ()
 
virtual int EEPROMSave (int inPos, bool inSimulate = false)
 
void AdjustMovingPositionsSize (uint8_t inNewSize)
 
bool IsEmpty () const
 
uint8_t IndexOfMovingPosition (unsigned long inId) const
 
int GetMovingPosition (unsigned long inId) const
 
int GetMovingPositionByIndex (int inIndex) const
 
unsigned long GetMovingPositionIdByIndex (int inIndex) const
 
const uint8_t GetLastMovingPosition () const
 
const uint8_t GetMovingPositionSize () const
 
void SetLastMovingPosition (uint8_t inLastPositionIndex)
 
void SetDebounceDelay (unsigned int inDebounceDelay)
 
void SetLastMoveTime ()
 
void SetDuration (unsigned long inDuration)
 
void SetNextAccessory (Accessory *inAccessory)
 
Accessory * GetNextAccessory () const
 
unsigned long GetActionStartingMillis () const
 
virtual void StartAction (ACC_STATE inState)
 
bool IsActionDelayPending () const
 
virtual bool IsGroupActionPending () const
 
virtual bool CanBePositional () const
 
virtual void MovePosition (int inPosition)
 
void SetStateRaw (ACC_STATE inNewState)
 
void SetStartingMillis ()
 
void ResetStartingMillis ()
 

Additional Inherited Members

- Static Public Member Functions inherited from Accessory
static void ExecuteEvent (unsigned long inId, ACCESSORIES_EVENT_TYPE inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID, int inData = 0)
 
static uint8_t GetCount ()
 
static bool IsActionPending ()
 
static Accessory * GetFirstAccessory ()
 
- Protected Attributes inherited from Accessory
PortpPort
 
ACC_STATE prevState
 

Detailed Description

This class describes a single light accessory.

Definition at line 15 of file AccessoryLight.hpp.

Constructor & Destructor Documentation

AccessoryLight::AccessoryLight ( )

Default constructor.

Definition at line 12 of file AccessoryLight.cpp.

Member Function Documentation

void AccessoryLight::begin ( Port inpPort,
unsigned long  inId,
unsigned long  inBlinkDuration = 0,
int  inIntensity = 255 
)

Initialize the instance.

Parameters
inpPortPort driven this light.
inIdId of this accessory.
inBlinkDurationBlink duration, 0 for fix light. Default is 0.
inIntensityIntensity of this light. Default is maximum, 255.

Definition at line 16 of file AccessoryLight.cpp.

void AccessoryLight::Blink ( )
inline

Turn the light on and blink.

Definition at line 71 of file AccessoryLight.hpp.

int AccessoryLight::EEPROMLoad ( int  inPos)
virtual

Reload all data from the EEPROM.

Remarks
Only for internal usage.

Reimplemented from Accessory.

void AccessoryLight::Event ( unsigned long  inId,
ACCESSORIES_EVENT_TYPE  inEvent = ACCESSORIES_EVENT_MOVEPOSITIONID,
int  inData = 0 
)
virtual

Execute a new event.

Parameters
inIdId of an accessory or an accessory item.
inEventType of the new event. Default is ACCESSORIES_EVENT_MOVEPOSITIONID.
inDataAssociated data to the event type. Default is 0.

Reimplemented from Accessory.

Definition at line 41 of file AccessoryLight.cpp.

bool AccessoryLight::IsBlinking ( ) const
inline

Checks if the light is blinking.

Returns
true if the light is blinking.

Definition at line 44 of file AccessoryLight.hpp.

bool AccessoryLight::IsFading ( ) const
inline

Checks if the light is fading.

Returns
true if the light is fading.
Remarks
A light can dim only with an analog pin.

Definition at line 49 of file AccessoryLight.hpp.

bool AccessoryLight::IsOn ( ) const
inline

Checks if the light is on.

Returns
true if the light is on.

Definition at line 40 of file AccessoryLight.hpp.

void AccessoryLight::LightOff ( )
inline

Turn the light off.

Definition at line 69 of file AccessoryLight.hpp.

void AccessoryLight::LightOn ( )
inline

Turn the light on.

Definition at line 67 of file AccessoryLight.hpp.

void AccessoryLight::SetFading ( uint8_t  inStep,
uint8_t  inDelay 
)
inline

Set the fading mode, defining its speed.

Parameters
inStepNumber of steps between light on and light off.
inDelayDuration of each step.

Definition at line 35 of file AccessoryLight.hpp.

void AccessoryLight::SetState ( ACC_STATE  inState)
inlinevirtual

Sets the internal state.

Parameters
inStatenew state LIGHTON, LIGHTOFF or LIGHTBLINKING.

Reimplemented from Accessory.

Definition at line 61 of file AccessoryLight.hpp.

ACC_STATE AccessoryLight::Toggle ( )
inlinevirtual

Change the state from ON to OFF or OFF to ON.

Returns
The new state.

Implements Accessory.

Definition at line 65 of file AccessoryLight.hpp.


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