OpenSourceSimWheelESP32
Open-source wireless steering wheel/button box for ESP32 boards
Loading...
Searching...
No Matches
InputSpecification.hpp File Reference

Configure input hardware and specify input numbers. More...

#include "SimWheelTypes.hpp"
#include <cstdint>
#include <stdexcept>
#include <vector>
#include <map>
#include <cstring>
#include <array>

Go to the source code of this file.

Classes

struct  AnalogMultiplexerChip< PinTags >
 Generic analog multiplexer chip. More...
 

Typedefs

typedef std::map< OutputGPIO, std::map< InputGPIO, InputNumber > > ButtonMatrix
 Button matrix specification.
 
typedef AnalogMultiplexerChip< Mux8PinAnalogMultiplexerChip8
 8-channel analog multiplexer chip
 
typedef AnalogMultiplexerChip< Mux16PinAnalogMultiplexerChip16
 16-channel analog multiplexer chip
 
typedef AnalogMultiplexerChip< Mux32PinAnalogMultiplexerChip32
 32-channel analog multiplexer chip
 
template<typename PinTags >
using AnalogMultiplexerGroup = std::vector<AnalogMultiplexerChip<PinTags>>
 Group of analog multiplexer chips sharing the same selector pins.
 
template<typename PinTags >
using GPIOExpanderChip = std::map<PinTags, InputNumber>
 Generic GPIO expander chip.
 
typedef GPIOExpanderChip< MCP23017PinMCP23017Expander
 MCP23017 GPIO Expander for switches.
 
typedef GPIOExpanderChip< PCF8574PinPCF8574Expander
 PCF8574 GPIO Expander for switches.
 
typedef std::map< SR8Pin, InputNumberShiftRegisterChip
 PISO shift register chip.
 
typedef std::vector< ShiftRegisterChipShiftRegisterChain
 Chain of PISO shift registers for switches.
 
typedef std::map< uint8_t, InputNumberRotaryCodedSwitch
 Rotary coded switch.
 
typedef std::array< InputNumber, 8 > CodedSwitch8
 Rotary coded switch up to 8 positions.
 
typedef std::array< InputNumber, 16 > CodedSwitch16
 Rotary coded switch up to 16 positions.
 
typedef std::array< InputNumber, 32 > CodedSwitch32
 Rotary coded switch up to 32 positions.
 

Enumerations

enum class  Mux8Pin {
  A0 = 0 , A1 , A2 , A3 ,
  A4 , A5 , A6 , A7
}
 74HC4051N pin tags for switches or any other 8-channel multiplexer More...
 
enum class  Mux16Pin {
  I0 = 0 , I1 , I2 , I3 ,
  I4 , I5 , I6 , I7 ,
  I8 , I9 , I10 , I11 ,
  I12 , I13 , I14 , I15
}
 CD74HCx4067 pin tags for switches or any other 16-channel multiplexer. More...
 
enum class  Mux32Pin {
  S1 = 0 , S2 , S3 , S4 ,
  S5 , S6 , S7 , S8 ,
  S9 , S10 , S11 , S12 ,
  S13 , S14 , S15 , S16 ,
  S17 , S18 , S19 , S20 ,
  S21 , S22 , S23 , S24 ,
  S25 , S26 , S27 , S28 ,
  S29 , S30 , S31 , S32
}
 ADG732 pin tags for switches or any other 32-channel multiplexer. More...
 
enum class  MCP23017Pin {
  GPA0 = 0 , GPA1 , GPA2 , GPA3 ,
  GPA4 , GPA5 , GPA6 , GPA7 ,
  GPB0 , GPB1 , GPB2 , GPB3 ,
  GPB4 , GPB5 , GPB6 , GPB7
}
 MCP23017 pin tags for switches. More...
 
enum class  PCF8574Pin {
  P0 = 0 , P1 , P2 , P3 ,
  P4 , P5 , P6 , P7
}
 MCP23017 pin tags for switches. More...
 
enum class  SR8Pin {
  H = 0 , G , F , E ,
  D , C , B , A
}
 74HC165N pin tags for switches More...
 

Functions

void populateButtonMatrix (ButtonMatrix &matrix, const OutputGPIOCollection selectors, const InputGPIOCollection inputs, const InputNumber first)
 Populate a button matrix with sequential input numbers.
 

Detailed Description

Configure input hardware and specify input numbers.

Author
Ángel Fernández Pineda. Madrid. Spain.
Date
2025-02-02
Note
All input numbers are initialized to UNSPECIFIED::VALUE.

Definition in file InputSpecification.hpp.

Typedef Documentation

◆ AnalogMultiplexerChip16

16-channel analog multiplexer chip

Definition at line 195 of file InputSpecification.hpp.

◆ AnalogMultiplexerChip32

32-channel analog multiplexer chip

Definition at line 201 of file InputSpecification.hpp.

◆ AnalogMultiplexerChip8

8-channel analog multiplexer chip

Definition at line 189 of file InputSpecification.hpp.

◆ AnalogMultiplexerGroup

template<typename PinTags >
using AnalogMultiplexerGroup = std::vector<AnalogMultiplexerChip<PinTags>>

Group of analog multiplexer chips sharing the same selector pins.

Template Parameters
PinTagsPin tags

Definition at line 209 of file InputSpecification.hpp.

◆ ButtonMatrix

typedef std::map<OutputGPIO, std::map<InputGPIO, InputNumber> > ButtonMatrix

Button matrix specification.

Definition at line 36 of file InputSpecification.hpp.

◆ CodedSwitch16

typedef std::array<InputNumber, 16> CodedSwitch16

Rotary coded switch up to 16 positions.

Definition at line 333 of file InputSpecification.hpp.

◆ CodedSwitch32

typedef std::array<InputNumber, 32> CodedSwitch32

Rotary coded switch up to 32 positions.

Definition at line 339 of file InputSpecification.hpp.

◆ CodedSwitch8

typedef std::array<InputNumber, 8> CodedSwitch8

Rotary coded switch up to 8 positions.

Definition at line 327 of file InputSpecification.hpp.

◆ GPIOExpanderChip

template<typename PinTags >
using GPIOExpanderChip = std::map<PinTags, InputNumber>

Generic GPIO expander chip.

Template Parameters
PinTags

Definition at line 261 of file InputSpecification.hpp.

◆ MCP23017Expander

MCP23017 GPIO Expander for switches.

Definition at line 267 of file InputSpecification.hpp.

◆ PCF8574Expander

PCF8574 GPIO Expander for switches.

Definition at line 273 of file InputSpecification.hpp.

◆ RotaryCodedSwitch

typedef std::map<uint8_t, InputNumber> RotaryCodedSwitch

Rotary coded switch.

Deprecated
Use CodedSwitch8, CodedSwitch16 or CodedSwitch32

Definition at line 321 of file InputSpecification.hpp.

◆ ShiftRegisterChain

typedef std::vector<ShiftRegisterChip> ShiftRegisterChain

Chain of PISO shift registers for switches.

Note
The left-most chip is the first in the chain, attached to the input pin at the DevKit board. The right-most chip is the last in the chain. This one can have another switch attached to the SER pin.

Definition at line 310 of file InputSpecification.hpp.

◆ ShiftRegisterChip

typedef std::map<SR8Pin, InputNumber> ShiftRegisterChip

PISO shift register chip.

Definition at line 299 of file InputSpecification.hpp.

Enumeration Type Documentation

◆ MCP23017Pin

enum class MCP23017Pin
strong

MCP23017 pin tags for switches.

Definition at line 219 of file InputSpecification.hpp.

◆ Mux16Pin

enum class Mux16Pin
strong

CD74HCx4067 pin tags for switches or any other 16-channel multiplexer.

Definition at line 84 of file InputSpecification.hpp.

◆ Mux32Pin

enum class Mux32Pin
strong

ADG732 pin tags for switches or any other 32-channel multiplexer.

Definition at line 109 of file InputSpecification.hpp.

◆ Mux8Pin

enum class Mux8Pin
strong

74HC4051N pin tags for switches or any other 8-channel multiplexer

Definition at line 67 of file InputSpecification.hpp.

◆ PCF8574Pin

enum class PCF8574Pin
strong

MCP23017 pin tags for switches.

Definition at line 243 of file InputSpecification.hpp.

◆ SR8Pin

enum class SR8Pin
strong

74HC165N pin tags for switches

Definition at line 283 of file InputSpecification.hpp.

Function Documentation

◆ populateButtonMatrix()

void populateButtonMatrix ( ButtonMatrix & matrix,
const OutputGPIOCollection selectors,
const InputGPIOCollection inputs,
const InputNumber first )
inline

Populate a button matrix with sequential input numbers.

Parameters
matrixButton matrix
selectorsCollection of selector pins
inputsCollection of input pins
firstFirst input number to be assigned

Definition at line 46 of file InputSpecification.hpp.