uMuxOutputLib
https://github.com/Naguissa/uMuxOutputLib
|
Really tiny library to control multiplexed outputs. More...
Public Member Functions | |
uMuxOutputLib (uint8_t, uint8_t, int *, int *, unsigned int=70) | |
Constructor. | |
void | setPinAbsolute (uint16_t, bool) |
Sets a pin in linear method. | |
void | setPinMuxPin (uint8_t, uint8_t, bool) |
Sets a pin by its pin and mux number. | |
bool | getPinAbsolute (uint16_t) |
Gets stored status in linear method. | |
bool | getPinMuxPin (uint8_t, uint8_t) |
Gets stored status by its pin and mux number. | |
void | attachInterrupt () |
Attach Timer interrupt. | |
Static Public Member Functions | |
static void | interrupt (void) |
Main public interrupt loop. | |
Public Attributes | |
bool | activeMuxValue = false |
Static Public Attributes | |
static uMuxOutputLib * | _instance = NULL |
Really tiny library to control multiplexed outputs.
It cycles among multiplexed outputs using a timer to control all pins.
Library depends on uTimerLib library, https://github.com/Naguissa/uTimerLib
uMuxOutputLib::uMuxOutputLib | ( | uint8_t | npins, |
uint8_t | nmuxes, | ||
int * | pins, | ||
int * | muxes, | ||
unsigned int | freq = 70 |
||
) |
Constructor.
npins | Number of pins |
nmuxes | Number of muxes |
pins | array of pins for outputs |
muxes | array of pins for muxes |
freq | Optional. Refresh frequency (for all pins, will be multiplied by nmuxes to calculate end result) |
void uMuxOutputLib::attachInterrupt | ( | ) |
Attach Timer interrupt.
Needed for usual operation, but you can call loop manually instead
bool uMuxOutputLib::getPinAbsolute | ( | uint16_t | position | ) |
Gets stored status in linear method.
Absolute position is calculated as: mux * npins + pin
position | Position of the bit on linear fashion |
bool uMuxOutputLib::getPinMuxPin | ( | uint8_t | pin, |
uint8_t | mux | ||
) |
Gets stored status by its pin and mux number.
Note that positions starts at 0.
pin | Pin position on passed pins array (starting at 0) |
mux | Mux position on passed muxes array (starting at 0) |
|
static |
Main public interrupt loop.
Calls private loop
void uMuxOutputLib::setPinAbsolute | ( | uint16_t | position, |
bool | value | ||
) |
Sets a pin in linear method.
Absolute position is calculated as: mux * npins + pin
position | Position of the bit on linear fashion |
value | Value to be set |
void uMuxOutputLib::setPinMuxPin | ( | uint8_t | pin, |
uint8_t | mux, | ||
bool | value | ||
) |
Sets a pin by its pin and mux number.
Note that positions starts at 0.
pin | Pin position on passed pins array (starting at 0) |
mux | Mux position on passed muxes array (starting at 0) |
value | Value to be set |