Open FFBoard
Open source force feedback firmware
ButtonSource Class Referenceabstract

#include <ButtonSource.h>

Inheritance diagram for ButtonSource:
ChoosableClass PersistentStorage CanButtons LocalButtons PCF8574Buttons SPI_Buttons ShifterAnalog SPI_Buttons_1 SPI_Buttons_2

Public Member Functions

 ButtonSource ()
 
virtual ~ButtonSource ()
 
virtual uint8_t readButtons (uint64_t *buf)=0
 
virtual uint16_t getBtnNum ()
 
virtual const ClassIdentifier getInfo ()=0
 
virtual const ClassType getClassType ()
 returns the used classchooser selection id of this instance More...
 
- Public Member Functions inherited from ChoosableClass
virtual ~ChoosableClass ()
 
uint16_t getSelectionID ()
 
- Public Member Functions inherited from PersistentStorage
 PersistentStorage ()
 
virtual ~PersistentStorage ()
 
virtual void saveFlash ()
 
virtual void restoreFlash ()
 
void restoreFlashDelayed ()
 

Static Public Member Functions

static bool isCreatable ()
 
- Static Public Member Functions inherited from ChoosableClass
static bool isCreatable ()
 
- Static Public Member Functions inherited from PersistentStorage
static std::vector< PersistentStorage * > & getFlashHandlers ()
 
static void restoreFlashStartupCb ()
 

Static Public Attributes

static ClassIdentifier info
 
static const std::vector< class_entry< ButtonSource > > all_buttonsources
 
- Static Public Attributes inherited from ChoosableClass
static ClassIdentifier info
 

Protected Attributes

uint16_t btnnum = 0
 
- Protected Attributes inherited from ChoosableClass
uint16_t selectionId
 Should only be written by ClassChooser during creation. More...
 
- Protected Attributes inherited from PersistentStorage
bool restoreDelayedFlag = false
 

Additional Inherited Members

- Static Protected Attributes inherited from PersistentStorage
static bool startupComplete = false
 

Detailed Description

A button source can return up to 64 buttons

Definition at line 19 of file ButtonSource.h.

Constructor & Destructor Documentation

◆ ButtonSource()

ButtonSource::ButtonSource ( )

Definition at line 17 of file ButtonSource.cpp.

◆ ~ButtonSource()

ButtonSource::~ButtonSource ( )
virtual

Definition at line 21 of file ButtonSource.cpp.

Member Function Documentation

◆ getBtnNum()

uint16_t ButtonSource::getBtnNum ( )
virtual

Reimplemented in PCF8574Buttons, and ShifterAnalog.

Definition at line 26 of file ButtonSource.cpp.

◆ getClassType()

virtual const ClassType ButtonSource::getClassType ( )
inlinevirtual

returns the used classchooser selection id of this instance

Type of this class. Mainclass, motordriver... Should be implemented by the parent class so it is not in the info struct

Reimplemented from ChoosableClass.

Reimplemented in LocalButtons, PCF8574Buttons, ShifterAnalog, and SPI_Buttons.

Definition at line 33 of file ButtonSource.h.

◆ getInfo()

virtual const ClassIdentifier ButtonSource::getInfo ( )
pure virtual

◆ isCreatable()

static bool ButtonSource::isCreatable ( )
inlinestatic

Definition at line 32 of file ButtonSource.h.

◆ readButtons()

virtual uint8_t ButtonSource::readButtons ( uint64_t *  buf)
pure virtual

Return a bit field without offset of pressed buttons in the supplied buffer. Returns amount of button read.

Implemented in CanButtons, LocalButtons, PCF8574Buttons, SPI_Buttons, and ShifterAnalog.

Member Data Documentation

◆ all_buttonsources

const std::vector< class_entry< ButtonSource > > ButtonSource::all_buttonsources
static
Initial value:
=
{
#ifdef LOCALBUTTONS
add_class<LocalButtons,ButtonSource>(0),
#endif
#ifdef SPIBUTTONS
add_class<SPI_Buttons_1,ButtonSource>(1),
#endif
#ifdef SPIBUTTONS2
add_class<SPI_Buttons_2,ButtonSource>(2),
#endif
#ifdef SHIFTERBUTTONS
add_class<ShifterAnalog,ButtonSource>(3),
#endif
#ifdef PCF8574BUTTONS
add_class<PCF8574Buttons,ButtonSource>(4),
#endif
#ifdef CANBUTTONS
add_class<CanButtons,ButtonSource>(5),
#endif
}

Definition at line 35 of file ButtonSource.h.

◆ btnnum

uint16_t ButtonSource::btnnum = 0
protected

Definition at line 38 of file ButtonSource.h.

◆ info

ClassIdentifier ButtonSource::info
static
Initial value:
= {
.name = "NONE" ,
.id = 0,
}

Definition at line 31 of file ButtonSource.h.


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