OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
inputs Namespace Reference

Everything related to hardware inputs and their events. More...

Functions

void addButton (InputGPIO pin, InputNumber inputNumber)
 Add a button attached to a single pin to the hardware inputs.
 
void addRotaryEncoder (InputGPIO clkPin, InputGPIO dtPin, InputNumber cwInputNumber, InputNumber ccwInputNumber, bool useAlternateEncoding=false)
 Add incremental rotary encoder inputs bound to specific input numbers.
 
void addButtonMatrix (const ButtonMatrix &matrix, bool negativeLogic=false)
 Add a button matrix to the hardware inputs.
 
void addAnalogMultiplexerGroup (OutputGPIO selectorPin1, OutputGPIO selectorPin2, OutputGPIO selectorPin3, const AnalogMultiplexerGroup< Mux8Pin > &chips)
 Add a group of 8-channel multiplexers to the hardware inputs.
 
void addAnalogMultiplexerGroup (OutputGPIO selectorPin1, OutputGPIO selectorPin2, OutputGPIO selectorPin3, OutputGPIO selectorPin4, const AnalogMultiplexerGroup< Mux16Pin > &chips)
 Add a group of 16-channel multiplexers to the hardware inputs.
 
void addAnalogMultiplexerGroup (OutputGPIO selectorPin1, OutputGPIO selectorPin2, OutputGPIO selectorPin3, OutputGPIO selectorPin4, OutputGPIO selectorPin5, const AnalogMultiplexerGroup< Mux32Pin > &chips)
 Add a group of 32-channel multiplexers to the hardware inputs.
 
void addMCP23017Expander (const MCP23017Expander &chip, uint8_t address, bool isFullAddress=false, I2CBus bus=I2CBus::PRIMARY)
 Add a MCP23017 GPIO expander to the hardware inputs.
 
void addPCF8574Expander (const PCF8574Expander &chip, uint8_t address, bool isFullAddress=false, I2CBus bus=I2CBus::PRIMARY)
 Add a PCF8574 GPIO expander to the hardware inputs.
 
void add74HC165NChain (OutputGPIO loadPin, OutputGPIO nextPin, InputGPIO inputPin, const ShiftRegisterChain &chain, InputNumber SER_inputNumber=UNSPECIFIED::VALUE, const bool negativeLogic=true)
 Add a chain of 74HC165N PISO shift registers to the hardware inputs.
 
void addRotaryCodedSwitch (const RotaryCodedSwitch &spec, InputGPIO pin0, InputGPIO pin1, InputGPIO pin2, bool complementaryCode=true)
 Add a binary coded rotary switch up to 8 positions.
 
void addRotaryCodedSwitch (const RotaryCodedSwitch &spec, InputGPIO pin0, InputGPIO pin1, InputGPIO pin2, InputGPIO pin3, bool complementaryCode=true)
 Add a binary coded rotary switch up to 16 positions.
 
void addRotaryCodedSwitch (const RotaryCodedSwitch &spec, InputGPIO pin0, InputGPIO pin1, InputGPIO pin2, InputGPIO pin3, InputGPIO pin4, bool complementaryCode=true)
 Add a binary coded rotary switch up to 32 positions.
 
void initializeI2C (GPIO sclPin, GPIO sdaPin, I2CBus bus=I2CBus::PRIMARY, bool enableInternalPullup=true)
 Initialize an I2C bus to certain pins.
 
void setAnalogClutchPaddles (ADC_GPIO leftClutchPin, ADC_GPIO rightClutchPin)
 Set two potentiometers as clutch paddles. Each one will work as an analog axis.
 

Detailed Description

Everything related to hardware inputs and their events.

Function Documentation

◆ add74HC165NChain()

void inputs::add74HC165NChain ( OutputGPIO loadPin,
OutputGPIO nextPin,
InputGPIO inputPin,
const ShiftRegisterChain & chain,
InputNumber SER_inputNumber = UNSPECIFIED::VALUE,
const bool negativeLogic = true )

Add a chain of 74HC165N PISO shift registers to the hardware inputs.

Parameters
loadPinPin attached to LOAD in the fist chip in the chain
nextPinPin attached to NEXT in the first chip in the chain
inputPinPin attached to INPUT in the fist chip in the chain
chainChain of specifications of input numbers
SER_inputNumberInput number for the switch attached to the SER pin in the last chip. Set to UNSPECIFIED::VALUE to ignore.
negativeLogicIf true, all switches must be pulled down (the default), If false, all switches must be pulled up (positive logic).

◆ addAnalogMultiplexerGroup() [1/3]

void inputs::addAnalogMultiplexerGroup ( OutputGPIO selectorPin1,
OutputGPIO selectorPin2,
OutputGPIO selectorPin3,
const AnalogMultiplexerGroup< Mux8Pin > & chips )

Add a group of 8-channel multiplexers to the hardware inputs.

Note
All buttons are assumed to work in negative logic
Parameters
selectorPin1Least-significant selector pin
selectorPin2Second selector pin
selectorPin3Third selector pin
chipsArray of chips sharing the given selector pins

◆ addAnalogMultiplexerGroup() [2/3]

void inputs::addAnalogMultiplexerGroup ( OutputGPIO selectorPin1,
OutputGPIO selectorPin2,
OutputGPIO selectorPin3,
OutputGPIO selectorPin4,
const AnalogMultiplexerGroup< Mux16Pin > & chips )

Add a group of 16-channel multiplexers to the hardware inputs.

Note
All buttons are assumed to work in negative logic
Parameters
selectorPin1Least-significant selector pin
selectorPin2Second selector pin
selectorPin3Third selector pin
selectorPin4Fourth selector pin
chipsArray of chips sharing the given selector pins

◆ addAnalogMultiplexerGroup() [3/3]

void inputs::addAnalogMultiplexerGroup ( OutputGPIO selectorPin1,
OutputGPIO selectorPin2,
OutputGPIO selectorPin3,
OutputGPIO selectorPin4,
OutputGPIO selectorPin5,
const AnalogMultiplexerGroup< Mux32Pin > & chips )

Add a group of 32-channel multiplexers to the hardware inputs.

Note
All buttons are assumed to work in negative logic
Parameters
selectorPin1Least-significant selector pin
selectorPin2Second selector pin
selectorPin3Third selector pin
selectorPin4Fourth selector pin
selectorPin5Fifth selector pin
chipsArray of chips sharing the given selector pins

◆ addButton()

void inputs::addButton ( InputGPIO pin,
InputNumber inputNumber )

Add a button attached to a single pin to the hardware inputs.

Note
The button works in negative logic
Parameters
pinGPIO attached to the button
inputNumberAssigned input number

◆ addButtonMatrix()

void inputs::addButtonMatrix ( const ButtonMatrix & matrix,
bool negativeLogic = false )

Add a button matrix to the hardware inputs.

Parameters
matrixSpecification of input numbers and GPIO pins
negativeLogicIf true, selector pins are enabled on HIGH. If false, selector pins are enabled on LOW.

◆ addMCP23017Expander()

void inputs::addMCP23017Expander ( const MCP23017Expander & chip,
uint8_t address,
bool isFullAddress = false,
I2CBus bus = I2CBus::PRIMARY )

Add a MCP23017 GPIO expander to the hardware inputs.

Note
All buttons are assumed to work in negative logic
Parameters
chipSpecification of input numbers
addressFull (7-bit) or hardware (3-bit) I2C address
isFullAddressIf true, address is a full address, If false, address is a hardware address.
busI2C bus to which the chip is connected. If the secondary bus is used, manual initialization is required using inputs::initializeI2C()

◆ addPCF8574Expander()

void inputs::addPCF8574Expander ( const PCF8574Expander & chip,
uint8_t address,
bool isFullAddress = false,
I2CBus bus = I2CBus::PRIMARY )

Add a PCF8574 GPIO expander to the hardware inputs.

Note
All buttons are assumed to work in negative logic
Parameters
chipSpecification of input numbers
addressFull (7-bit) or hardware (3-bit) I2C address
isFullAddressIf true, address is a full address, If false, address is a hardware address.
busI2C bus to which the chip is connected. If the secondary bus is used, manual initialization is required using inputs::initializeI2C()

◆ addRotaryCodedSwitch() [1/3]

void inputs::addRotaryCodedSwitch ( const RotaryCodedSwitch & spec,
InputGPIO pin0,
InputGPIO pin1,
InputGPIO pin2,
bool complementaryCode = true )

Add a binary coded rotary switch up to 8 positions.

Deprecated
Use inputHub::codedSwitch::add() instead
Parameters
specSpecification of input numbers for each switch position
pin0Input pin for the least-significant bit
pin1Input pin
pin2Input pin for the most-significant bit
complementaryCodeSet to true if your rotary switch uses complementary binary code

◆ addRotaryCodedSwitch() [2/3]

void inputs::addRotaryCodedSwitch ( const RotaryCodedSwitch & spec,
InputGPIO pin0,
InputGPIO pin1,
InputGPIO pin2,
InputGPIO pin3,
bool complementaryCode = true )

Add a binary coded rotary switch up to 16 positions.

Deprecated
Use inputHub::codedSwitch::add() instead
Parameters
specSpecification of input numbers for each switch position
pin0Input pin for the least-significant bit
pin1Input pin
pin2Input pin
pin3Input pin for the most-significant bit
complementaryCodeSet to true if your rotary switch uses complementary binary code

◆ addRotaryCodedSwitch() [3/3]

void inputs::addRotaryCodedSwitch ( const RotaryCodedSwitch & spec,
InputGPIO pin0,
InputGPIO pin1,
InputGPIO pin2,
InputGPIO pin3,
InputGPIO pin4,
bool complementaryCode = true )

Add a binary coded rotary switch up to 32 positions.

Deprecated
Use inputHub::codedSwitch::add() instead
Parameters
specSpecification of input numbers for each switch position
pin0Input pin for the least-significant bit
pin1Input pin
pin2Input pin
pin3Input pin
pin4Input pin for the most-significant bit
complementaryCodeSet to true if your rotary switch uses complementary binary code

◆ addRotaryEncoder()

void inputs::addRotaryEncoder ( InputGPIO clkPin,
InputGPIO dtPin,
InputNumber cwInputNumber,
InputNumber ccwInputNumber,
bool useAlternateEncoding = false )

Add incremental rotary encoder inputs bound to specific input numbers.

Parameters
clkPinGPIO attached to CLK or A
dtPinGPIO attached to DT or B
[in]cwInputNumberA number for the "virtual button" of a clockwise rotation event.
[in]ccwInputNumberA number for the "virtual button" of a counter-clockwise rotation event.
[in]useAlternateEncodingSet to true in order to use the signal encoding of ALPS RKJX series of rotary encoders, and the alike.
Note
Only rotation events are considered for input. Rotary's push button must be added with addButton()

◆ initializeI2C()

void inputs::initializeI2C ( GPIO sclPin,
GPIO sdaPin,
I2CBus bus = I2CBus::PRIMARY,
bool enableInternalPullup = true )

Initialize an I2C bus to certain pins.

Note
When external pull-up resistors are installed, their effective impedance will be reduced because the internal resistors are in parallel (enabled by default). This also reduces the capacitance of the bus.
Parameters
sclPinSCL or SCK pin
sdaPinSDA pin
busI2C bus to initialize
enableInternalPullupIf true (default), the bus is pulled up using internal resistors. If false, external pullup resistors must be in place as the internal ones are not enabled. Otherwise, the bus won't work.

◆ setAnalogClutchPaddles()

void inputs::setAnalogClutchPaddles ( ADC_GPIO leftClutchPin,
ADC_GPIO rightClutchPin )

Set two potentiometers as clutch paddles. Each one will work as an analog axis.

Parameters
leftClutchPinADC pin for the left clutch paddle
rightClutchPinADC pin for the right clutch paddle. Must differ from leftClutchPin.