Default configuration for Microchip MCP23x17 I/O expanders. More...

Detailed Description

Default configuration for Microchip MCP23x17 I/O expanders.

Author
Gunar Schorcht gunar.nosp@m.@sch.nosp@m.orcht.nosp@m..net

Definition in file mcp23x17_params.h.

#include "board.h"
#include "mcp23x17.h"
#include "saul_reg.h"
+ Include dependency graph for mcp23x17_params.h:

Go to the source code of this file.

Variables

static const mcp23x17_params_t mcp23x17_params []
 Allocation of MCP23x17 configuration. More...
 
static const mcp23x17_saul_gpio_params_t mcp23x17_saul_gpio_params []
 Additional meta information to keep in the SAUL registry. More...
 

Set default hardware configuration parameters

#define MCP23X17_PARAM_SPI_ADDR   (0)
 Default hardware address, if the SPI interface is used. More...
 
#define MCP23X17_PARAM_SPI_DEV   (SPI_DEV(0))
 Default SPI device, if the SPI interface is used.
 
#define MCP23X17_PARAM_SPI_CLK   (SPI_CLK_10MHZ)
 Default SPI clock frequency, if the SPI interface is used.
 
#define MCP23X17_PARAM_SPI_CS   (GPIO_PIN(0, 0))
 Default SPI CS signal, if the SPI interface is used.
 
#define MCP23X17_PARAM_SPI_INT   (GPIO_PIN(0, 1))
 Default MCU pin for INTA and INTB signal of the default SPI device.
 
#define MCP23X17_PARAM_I2C_ADDR   (0)
 Default hardware address, if the I2C interface is used.
 
#define MCP23X17_PARAM_I2C_DEV   (I2C_DEV(0))
 Default I2C device, if the I2C interface is used.
 
#define MCP23X17_PARAM_I2C_INT   (GPIO_PIN(0, 2))
 Default MCU pin for INTA and INTB signal of the default I2C device.
 
#define MCP23X17_PARAM_RESET_PIN   (GPIO_UNDEF)
 MCU pin for RESET signal is undefinded by default.
 
#define MCP23X17_SPI_PARAMS
 Default device parameters, if SPI interface is used. More...
 
#define MCP23X17_I2C_PARAMS
 Default device parameters, if I2C interface is used. More...
 
#define MCP23X17_SAUL_GPIO_PARAMS
 Example for mapping expander pins to SAUL. More...
 

Macro Definition Documentation

◆ MCP23X17_I2C_PARAMS

#define MCP23X17_I2C_PARAMS
Value:
{ \
.int_pin = MCP23X17_PARAM_I2C_INT, \
.reset_pin = MCP23X17_PARAM_RESET_PIN, \
.if_params.type = MCP23X17_I2C, \
.if_params.i2c.dev = MCP23X17_PARAM_I2C_DEV, \
}
@ MCP23X17_I2C
I2C interface used.
Definition: mcp23x17.h:419
#define MCP23X17_PARAM_I2C_INT
Default MCU pin for INTA and INTB signal of the default I2C device.
#define MCP23X17_PARAM_I2C_DEV
Default I2C device, if the I2C interface is used.
#define MCP23X17_PARAM_RESET_PIN
MCU pin for RESET signal is undefinded by default.
#define MCP23X17_PARAM_I2C_ADDR
Default hardware address, if the I2C interface is used.

Default device parameters, if I2C interface is used.

Definition at line 109 of file mcp23x17_params.h.

◆ MCP23X17_PARAM_SPI_ADDR

#define MCP23X17_PARAM_SPI_ADDR   (0)

Default hardware address, if the SPI interface is used.

The use of hardware addressing also for SPI devices allows the use of up to eight SPI devices with the same CS signal.

Definition at line 42 of file mcp23x17_params.h.

◆ MCP23X17_SAUL_GPIO_PARAMS

#define MCP23X17_SAUL_GPIO_PARAMS
Value:
{ \
.dev = 0, \
.gpio = { \
.name = "MCP23x17_0 PA0 Input", \
.pin = MCP23X17_GPIO_PIN(0, 0), \
.mode = GPIO_IN, \
.flags = 0, \
} \
}, \
{ \
.dev = 0, \
.gpio = { \
.name = "MCP23x17_0 PB5 Output", \
.pin = MCP23X17_GPIO_PIN(1, 5), \
.mode = GPIO_OUT, \
} \
},
@ GPIO_OUT
select GPIO MASK as output
Definition: periph_cpu.h:164
@ GPIO_IN
select GPIO MASK as input
Definition: periph_cpu.h:163
#define MCP23X17_GPIO_PIN(port, pin)
Conversion of (port x : pin y) to a pin number.
Definition: mcp23x17.h:397
@ SAUL_GPIO_INIT_CLEAR
set pin inactive after init
Definition: periph.h:43

Example for mapping expander pins to SAUL.

Definition at line 123 of file mcp23x17_params.h.

◆ MCP23X17_SPI_PARAMS

#define MCP23X17_SPI_PARAMS
Value:
{ \
.int_pin = MCP23X17_PARAM_SPI_INT, \
.reset_pin = MCP23X17_PARAM_RESET_PIN, \
.if_params.type = MCP23X17_SPI, \
.if_params.spi.dev = MCP23X17_PARAM_SPI_DEV, \
.if_params.spi.cs = MCP23X17_PARAM_SPI_CS, \
.if_params.spi.clk = MCP23X17_PARAM_SPI_CLK, \
}
@ MCP23X17_SPI
SPI interface used.
Definition: mcp23x17.h:422
#define MCP23X17_PARAM_SPI_CS
Default SPI CS signal, if the SPI interface is used.
#define MCP23X17_PARAM_SPI_INT
Default MCU pin for INTA and INTB signal of the default SPI device.
#define MCP23X17_PARAM_SPI_CLK
Default SPI clock frequency, if the SPI interface is used.
#define MCP23X17_PARAM_SPI_DEV
Default SPI device, if the SPI interface is used.
#define MCP23X17_PARAM_SPI_ADDR
Default hardware address, if the SPI interface is used.

Default device parameters, if SPI interface is used.

Definition at line 94 of file mcp23x17_params.h.

Variable Documentation

◆ mcp23x17_params

const mcp23x17_params_t mcp23x17_params[]
static
Initial value:
=
{
}
#define MCP23X17_I2C_PARAMS
Default device parameters, if I2C interface is used.
#define MCP23X17_SPI_PARAMS
Default device parameters, if SPI interface is used.

Allocation of MCP23x17 configuration.

Definition at line 148 of file mcp23x17_params.h.

◆ mcp23x17_saul_gpio_params

const mcp23x17_saul_gpio_params_t mcp23x17_saul_gpio_params[]
static
Initial value:
=
{
}
#define MCP23X17_SAUL_GPIO_PARAMS
Example for mapping expander pins to SAUL.

Additional meta information to keep in the SAUL registry.

Definition at line 162 of file mcp23x17_params.h.