arduino-audio-driver
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DriverPins Class Reference

All pins for i2s, spi, i2c and other pins. More...

#include <DriverPins.h>

Inheritance diagram for DriverPins:
DriverTouchClass PinsAudioKitAC101Class PinsAudioKitEs8388v1Class PinsAudioKitEs8388v2Class PinsLyratMiniClass PinsLyrat42Class PinsLyrat43Class

Public Member Functions

 DriverPins ()=default
 
 DriverPins (const DriverPins &)=delete
 
bool addI2C (PinFunction function, GpioPin scl, GpioPin sda, int port=-1, uint32_t frequency=100000, TwoWire &wire=Wire, bool active=true)
 
bool addI2C (PinFunction function, TwoWire &wire, bool setActive=false)
 Just define your initialzed wire object. More...
 
bool addI2C (PinsI2C pin)
 
bool addI2S (PinFunction function, GpioPin mclk, GpioPin bck, GpioPin ws, GpioPin data_out, GpioPin data_in=-1, int port=0)
 
bool addI2S (PinsI2S pin)
 
bool addPin (PinFunction function, GpioPin pinNo, PinLogic logic, int index=0)
 
bool addPin (PinsFunction pin)
 
bool addSPI (PinFunction function, GpioPin clk, GpioPin miso, GpioPin mosi, GpioPin cs, SPIClass &spi=SPI)
 
bool addSPI (PinsSPI pin)
 
virtual bool begin ()
 Sets up all pins e.g. by calling pinMode() More...
 
void end ()
 
audio_driver_local::Optional< PinsI2CgetI2CPins (PinFunction function)
 Finds the I2C pin info with the help of the function. More...
 
audio_driver_local::Optional< PinsI2SgetI2SPins (int port)
 Finds the I2S pin info with the help of the port. More...
 
audio_driver_local::Optional< PinsI2SgetI2SPins (PinFunction function=PinFunction::CODEC)
 Finds the I2S pin info with the help of the function. More...
 
audio_driver_local::Optional< PinsFunctiongetPin (GpioPin pinId)
 Get pin information by pin ID. More...
 
audio_driver_local::Optional< PinsFunctiongetPin (PinFunction function, int pos=0)
 Get pin information by function. More...
 
GpioPin getPinID (PinFunction function, int pos=0)
 
audio_driver_local::Optional< PinsSPIgetSPIPins (PinFunction function)
 Finds the SPI pin info with the help of the function. More...
 
bool hasPins ()
 Returns true if some function pins have been defined. More...
 
virtual bool isKeyPressed (uint8_t key)
 returns true if pressed More...
 
bool isSPIActiveForSD ()
 Check if SPI for SD should be started automatically. More...
 
DriverPinsoperator= (const DriverPins &)=delete
 
bool setI2C (PinsI2C pin)
 Updates the I2C pin information using the function as key. More...
 
bool setI2S (PinsI2S pin)
 Updates the I2S pin information using the function as key. More...
 
bool setSPI (PinsSPI pin)
 Updates the SPI pin information using the function as key. More...
 
void setSPIActiveForSD (bool active)
 Defines if SPI for SD should be started (by default true) More...
 

Protected Member Functions

template<typename T >
T * getPtr (PinFunction function, audio_driver_local::Vector< T > &vect)
 
bool hasConflict (int pin)
 
bool hasI2CConflict (int pin)
 
bool hasSPIConflict (int pin)
 
template<typename T >
bool set (T pin, audio_driver_local::Vector< T > &vect)
 
void setupPinMode ()
 

Protected Attributes

audio_driver_local::Vector< PinsI2Ci2c {0}
 
audio_driver_local::Vector< PinsI2Si2s {0}
 
audio_driver_local::Vector< PinsFunctionpins {0}
 
bool sd_active = true
 
audio_driver_local::Vector< PinsSPIspi {0}
 

Detailed Description

All pins for i2s, spi, i2c and other pins.

Author
Phil Schatzmann

Constructor & Destructor Documentation

◆ DriverPins() [1/2]

DriverPins ( const DriverPins )
delete

◆ DriverPins() [2/2]

DriverPins ( )
default

Member Function Documentation

◆ addI2C() [1/3]

bool addI2C ( PinFunction  function,
GpioPin  scl,
GpioPin  sda,
int  port = -1,
uint32_t  frequency = 100000,
TwoWire &  wire = Wire,
bool  active = true 
)
inline

◆ addI2C() [2/3]

bool addI2C ( PinFunction  function,
TwoWire &  wire,
bool  setActive = false 
)
inline

Just define your initialzed wire object.

◆ addI2C() [3/3]

bool addI2C ( PinsI2C  pin)
inline

◆ addI2S() [1/2]

bool addI2S ( PinFunction  function,
GpioPin  mclk,
GpioPin  bck,
GpioPin  ws,
GpioPin  data_out,
GpioPin  data_in = -1,
int  port = 0 
)
inline

◆ addI2S() [2/2]

bool addI2S ( PinsI2S  pin)
inline

◆ addPin() [1/2]

bool addPin ( PinFunction  function,
GpioPin  pinNo,
PinLogic  logic,
int  index = 0 
)
inline

◆ addPin() [2/2]

bool addPin ( PinsFunction  pin)
inline

◆ addSPI() [1/2]

bool addSPI ( PinFunction  function,
GpioPin  clk,
GpioPin  miso,
GpioPin  mosi,
GpioPin  cs,
SPIClass &  spi = SPI 
)
inline

◆ addSPI() [2/2]

bool addSPI ( PinsSPI  pin)
inline

◆ begin()

virtual bool begin ( )
inlinevirtual

Sets up all pins e.g. by calling pinMode()

◆ end()

void end ( )
inline

◆ getI2CPins()

audio_driver_local::Optional<PinsI2C> getI2CPins ( PinFunction  function)
inline

Finds the I2C pin info with the help of the function.

◆ getI2SPins() [1/2]

audio_driver_local::Optional<PinsI2S> getI2SPins ( int  port)
inline

Finds the I2S pin info with the help of the port.

◆ getI2SPins() [2/2]

Finds the I2S pin info with the help of the function.

◆ getPin() [1/2]

Get pin information by pin ID.

◆ getPin() [2/2]

audio_driver_local::Optional<PinsFunction> getPin ( PinFunction  function,
int  pos = 0 
)
inline

Get pin information by function.

◆ getPinID()

GpioPin getPinID ( PinFunction  function,
int  pos = 0 
)
inline

◆ getPtr()

T* getPtr ( PinFunction  function,
audio_driver_local::Vector< T > &  vect 
)
inlineprotected

◆ getSPIPins()

audio_driver_local::Optional<PinsSPI> getSPIPins ( PinFunction  function)
inline

Finds the SPI pin info with the help of the function.

◆ hasConflict()

bool hasConflict ( int  pin)
inlineprotected

◆ hasI2CConflict()

bool hasI2CConflict ( int  pin)
inlineprotected

◆ hasPins()

bool hasPins ( )
inline

Returns true if some function pins have been defined.

◆ hasSPIConflict()

bool hasSPIConflict ( int  pin)
inlineprotected

◆ isKeyPressed()

virtual bool isKeyPressed ( uint8_t  key)
inlinevirtual

returns true if pressed

Reimplemented in PinsLyratMiniClass.

◆ isSPIActiveForSD()

bool isSPIActiveForSD ( )
inline

Check if SPI for SD should be started automatically.

◆ operator=()

DriverPins& operator= ( const DriverPins )
delete

◆ set()

bool set ( pin,
audio_driver_local::Vector< T > &  vect 
)
inlineprotected

◆ setI2C()

bool setI2C ( PinsI2C  pin)
inline

Updates the I2C pin information using the function as key.

◆ setI2S()

bool setI2S ( PinsI2S  pin)
inline

Updates the I2S pin information using the function as key.

◆ setSPI()

bool setSPI ( PinsSPI  pin)
inline

Updates the SPI pin information using the function as key.

◆ setSPIActiveForSD()

void setSPIActiveForSD ( bool  active)
inline

Defines if SPI for SD should be started (by default true)

◆ setupPinMode()

void setupPinMode ( )
inlineprotected

Member Data Documentation

◆ i2c

audio_driver_local::Vector<PinsI2C> i2c {0}
protected

◆ i2s

audio_driver_local::Vector<PinsI2S> i2s {0}
protected

◆ pins

◆ sd_active

bool sd_active = true
protected

◆ spi

audio_driver_local::Vector<PinsSPI> spi {0}
protected

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