![]() |
Data Gator
Hardware and software documentation for the Data Gator project.
|
Defines a firmware interface for the 74HC40520 multiplexer. More...
#include <74HC40520.hpp>
Public Types | |
enum | Mux_Channel { X , Y } |
Defines the two MUX signal channels X and Y. More... | |
Public Member Functions | |
void | setPins (int mux_inh, int mux_a, int mux_b) |
Sets the output level of the two selector pins (A&B) and the inhibitor pin and stores the pin values. | |
void | select (int channel) |
Select the channels to connect to the X and Y output pins. | |
int | readChannel (int pin) |
Reads the analog value at the channel. | |
void | writeChannel (int pin, int value) |
Writes a channel. | |
Private Attributes | |
uint8_t | mux_inh |
uint8_t | mux_a |
uint8_t | mux_b |
Defines a firmware interface for the 74HC40520 multiplexer.
MUX_INH | B | A | Selected Channels |
---|---|---|---|
L | L | L | 0X, 0Y |
L | L | H | 1X, 1Y |
L | H | L | 2X, 2Y |
L | H | H | 3X, 3Y |
H | X | X | XXXXXX |
Reads the analog value at the channel.
[in] | outputChannel | The output channel, can be enum Mux_Channel |
Select the channels to connect to the X and Y output pins.
[in] | channel | The channel |
Sets the output level of the two selector pins (A&B) and the inhibitor pin and stores the pin values.
[in] | mux_inh | The multiplexer inhibitor pin, if HIGH no channel is connected to X/Y pins. |
[in] | mux_a | The multiplexer a selector pin |
[in] | mux_b | The multiplexer b selector pin |
Writes a channel.
[in] | inputChannel | The input channel |
[in] | value | The integer value to write to the pin, HIGH or LOW. |