Skip to content

Class daisy::Mcp23X17

template <typename Transport>

ClassList > daisy > Mcp23X17

Classes

Type Name
struct Config

Public Functions

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

Public Functions Documentation

function GetPin

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

inline uint8_t daisy::Mcp23X17::GetPin (
    uint8_t id
) 

Parameters:

  • id pin ID

Returns:

uint8_t pin state: 0x00 or 0xFF


function Init [½]

inline void daisy::Mcp23X17::Init () 

function Init [2/2]

inline void daisy::Mcp23X17::Init (
    const  Config & config
) 

function PinMode

inline void daisy::Mcp23X17::PinMode (
    uint8_t pin,
    MCPMode mode,
    bool inverted
) 

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".


function PortMode

inline void daisy::Mcp23X17::PortMode (
    MCPPort port,
    uint8_t directions,
    uint8_t pullups=0xFF,
    uint8_t inverted=0x00
) 

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".


function Read

inline uint16_t daisy::Mcp23X17::Read () 

Reads pins state for both ports.

1 = Logic-high 0 = Logic-low

See "3.5.10 Port register".


function ReadPin

inline uint8_t daisy::Mcp23X17::ReadPin (
    uint8_t pin
) 

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".


function ReadPort

inline uint8_t daisy::Mcp23X17::ReadPort (
    MCPPort port
) 

Reads pins state for a whole port.

1 = Logic-high 0 = Logic-low

See "3.5.10 Port register".


function Write

inline void daisy::Mcp23X17::Write (
    uint16_t value
) 

Writes pins state to both ports.

1 = Logic-high 0 = Logic-low

See "3.5.10 Port register".


function WritePin

inline void daisy::Mcp23X17::WritePin (
    uint8_t pin,
    uint8_t state
) 

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".


function WritePort

inline void daisy::Mcp23X17::WritePort (
    MCPPort port,
    uint8_t value
) 

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 external-docs/libDaisy/src/dev/mcp23x17.h