IoAbstraction
Public Member Functions | List of all members
MPR121AnalogAbstraction Class Reference

#include <IoAbstractionWire.h>

Inheritance diagram for MPR121AnalogAbstraction:
AnalogDevice

Public Member Functions

 MPR121AnalogAbstraction (MPR121IoAbstraction &abs)
 
int getMaximumRange (AnalogDirection direction, pinid_t pin) override
 
int getBitDepth (AnalogDirection direction, pinid_t pin) override
 
void initPin (pinid_t pin, AnalogDirection direction) override
 
unsigned int getCurrentValue (pinid_t pin) override
 
float getCurrentFloat (pinid_t pin) override
 
void setCurrentValue (pinid_t pin, unsigned int newValue) override
 
void setCurrentFloat (pinid_t pin, float newValue) override
 

Detailed Description

A wrapper for the AW9523IoAbstraction that provides the LED control analog functions as an AnalogDevice, this allows you to use this device with anything that already works with AnalogDevice objects for output. Simple construct giving a reference to the actual abstraction.

Member Function Documentation

◆ getMaximumRange()

int MPR121AnalogAbstraction::getMaximumRange ( AnalogDirection  direction,
pinid_t  pin 
)
inlineoverridevirtual
Parameters
dirthe direction required
pinthe pin for which the range is desired
Returns
the maximum range of the analog input or output on this device for the given pin

Implements AnalogDevice.

◆ getBitDepth()

int MPR121AnalogAbstraction::getBitDepth ( AnalogDirection  direction,
pinid_t  pin 
)
inlineoverridevirtual
Parameters
pinthe pin for which the bit depth is required.
directionthe direction in which the depth is queried (DIR_IN, DIR_OUT)
Returns
the number of bits

Implements AnalogDevice.

◆ initPin()

void MPR121AnalogAbstraction::initPin ( pinid_t  pin,
AnalogDirection  direction 
)
overridevirtual

initialises a pin as either an input or output of analog signals. No validation to check if that pin can support input or output is performed.

Parameters
pinthe pin to initialise
directionthe direction required

Implements AnalogDevice.

◆ getCurrentValue()

unsigned int MPR121AnalogAbstraction::getCurrentValue ( pinid_t  pin)
inlineoverridevirtual

Returns the current value on the ADC for the given pin

Parameters
pinthe pin to read from
Returns
the current value on that pin

Implements AnalogDevice.

◆ setCurrentValue()

void MPR121AnalogAbstraction::setCurrentValue ( pinid_t  pin,
unsigned int  newValue 
)
inlineoverridevirtual

Sets the current value on an output capable device to a new value

Parameters
pinthe pin to read from
newValuethe value to be set

Implements AnalogDevice.

◆ setCurrentFloat()

void MPR121AnalogAbstraction::setCurrentFloat ( pinid_t  pin,
float  newValue 
)
inlineoverridevirtual

sets the current value based on a float from 0 to 1, where 0 is minimum and 1 is maximum.

Parameters
pinthe pin for which to set
newValuethe new value which should be between 0 and 1.0

Implements AnalogDevice.


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