arduino-audio-tools
Classes | Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
AudioActions Class Reference

A simple class to assign functions to gpio pins e.g. to implement a simple navigation control or volume control with buttons. More...

#include <AudioActions.h>

Classes

struct  Action
 

Public Types

enum  ActiveLogic : uint8_t { ActiveLow , ActiveHigh , ActiveChange , ActiveTouch }
 

Public Member Functions

 AudioActions (bool useInterrupt=false)
 Default constructor.
 
 ~AudioActions ()
 deletes all actions
 
void add (Action &action)
 Adds an Action.
 
void add (int pin, void(*actionOn)(bool pinStatus, int pin, void *ref), ActiveLogic activeLogic=ActiveLow, void *ref=nullptr)
 Adds an action.
 
void add (int pin, void(*actionOn)(bool pinStatus, int pin, void *ref), void(*actionOff)(bool pinStatus, int pin, void *ref), ActiveLogic activeLogicPar=ActiveLow, void *ref=nullptr)
 Adds an action.
 
void clear ()
 
ActionfindAction (int id)
 Determines the action for the pin/id.
 
int findActionIdx (int id)
 Determines the action for the pin/id.
 
void processActions ()
 Execute all actions if the corresponding pin is low To minimize the runtime: With each call we process a different pin.
 
void processAllActions ()
 Execute all actions.
 
void setDebounceDelay (int value)
 Defines the debounce delay.
 
void setEnabled (int pin, bool enabled)
 enable/disable pin actions
 
void setPinMode (bool active)
 setup pin mode when true
 
void setTouchLimit (int value)
 Defines the touch limit (Default 20)
 
void setUsePinInterrupt (bool active)
 Use interrupts instead of processActions() call in loop.
 

Protected Member Functions

void insertAction (Action &action)
 
void setupPin (int pin, ActiveLogic logic)
 

Static Protected Member Functions

static void audioActionsISR ()
 

Protected Attributes

Vector< Action * > actions {0}
 
int debounceDelayValue = 500
 
int touchLimit = 20
 
bool use_pin_interrupt = false
 
bool use_pin_mode = true
 

Detailed Description

A simple class to assign functions to gpio pins e.g. to implement a simple navigation control or volume control with buttons.


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