libDaisy
Hardware Library for Daisy
Loading...
Searching...
No Matches
daisy::Mcp23X17< Transport > Class Template Reference

#include <mcp23x17.h>

Classes

struct  Config
 

Public Member Functions

void Init ()
 
void Init (const Config &config)
 
void PortMode (MCPPort port, uint8_t directions, uint8_t pullups=0xFF, uint8_t inverted=0x00)
 
void PinMode (uint8_t pin, MCPMode mode, bool inverted)
 
void WritePin (uint8_t pin, uint8_t state)
 
uint8_t ReadPin (uint8_t pin)
 
void WritePort (MCPPort port, uint8_t value)
 
uint8_t ReadPort (MCPPort port)
 
void Write (uint16_t value)
 
uint16_t Read ()
 
uint8_t GetPin (uint8_t id)
 Fetches pin state from the result of recent Read() call. Useful to preserve unneeded reads.
 

Member Function Documentation

◆ GetPin()

template<typename Transport >
uint8_t daisy::Mcp23X17< Transport >::GetPin ( uint8_t  id)
inline

Fetches pin state from the result of recent Read() call. Useful to preserve unneeded reads.

Parameters
idpin ID
Returns
uint8_t pin state: 0x00 or 0xFF

◆ Init() [1/2]

template<typename Transport >
void daisy::Mcp23X17< Transport >::Init ( )
inline

◆ Init() [2/2]

template<typename Transport >
void daisy::Mcp23X17< Transport >::Init ( const Config config)
inline

◆ PinMode()

template<typename Transport >
void daisy::Mcp23X17< Transport >::PinMode ( uint8_t  pin,
MCPMode  mode,
bool  inverted 
)
inline

Controls a single pin direction. Pin 0-7 for port A, 8-15 fo port B.

1 = Pin is configured as an input. 0 = Pin is configured as an output.

See "3.5.1 I/O Direction register".

◆ PortMode()

template<typename Transport >
void daisy::Mcp23X17< Transport >::PortMode ( MCPPort  port,
uint8_t  directions,
uint8_t  pullups = 0xFF,
uint8_t  inverted = 0x00 
)
inline

Controls the pins direction on a whole port at once.

directions: 0 - output, 1 - input pullups: 0 - disabled, 1 - enabled inverted: 0 - false/normal, 1 - true/inverted

See "3.5.1 I/O Direction register".

◆ Read()

template<typename Transport >
uint16_t daisy::Mcp23X17< Transport >::Read ( )
inline

Reads pins state for both ports.

1 = Logic-high 0 = Logic-low

See "3.5.10 Port register".

◆ ReadPin()

template<typename Transport >
uint8_t daisy::Mcp23X17< Transport >::ReadPin ( uint8_t  pin)
inline

Reads a single pin state. Pin 0-7 for port A, 8-15 for port B.

1 = Logic-high 0 = Logic-low

See "3.5.10 Port register".

◆ ReadPort()

template<typename Transport >
uint8_t daisy::Mcp23X17< Transport >::ReadPort ( MCPPort  port)
inline

Reads pins state for a whole port.

1 = Logic-high 0 = Logic-low

See "3.5.10 Port register".

◆ Write()

template<typename Transport >
void daisy::Mcp23X17< Transport >::Write ( uint16_t  value)
inline

Writes pins state to both ports.

1 = Logic-high 0 = Logic-low

See "3.5.10 Port register".

◆ WritePin()

template<typename Transport >
void daisy::Mcp23X17< Transport >::WritePin ( uint8_t  pin,
uint8_t  state 
)
inline

Writes a single pin state. Pin 0-7 for port A, 8-15 for port B.

1 = Logic-high 0 = Logic-low

See "3.5.10 Port register".

◆ WritePort()

template<typename Transport >
void daisy::Mcp23X17< Transport >::WritePort ( MCPPort  port,
uint8_t  value 
)
inline

Writes pins state to a whole port.

1 = Logic-high 0 = Logic-low

See "3.5.10 Port register".


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