Device driver interface for Microchip MCP23x17 I/O expanders. More...
Device driver interface for Microchip MCP23x17 I/O expanders.
Definition in file mcp23x17.h.
#include "periph/gpio.h"
#include "periph/i2c.h"
#include "periph/spi.h"
#include "saul/periph.h"
#include "event.h"
Go to the source code of this file.
Data Structures | |
struct | mcp23x17_i2c_params_t |
MCP23017 I2C parameters. More... | |
struct | mcp23x17_spi_params_t |
MCP23S17 SPI parameters. More... | |
struct | mcp23x17_if_params_t |
MCP23x17 Hardware interface parameters union. More... | |
struct | mcp23x17_params_t |
Struct containing the peripheral configuration. More... | |
struct | mcp23x17_irq_event_t |
IRQ event type. More... | |
struct | mcp23x17_t |
Device descriptor for MCP23x17 I/O expanders. More... | |
struct | mcp23x17_saul_gpio_params_t |
MCP23x17 configuration structure for mapping expander pins to SAUL. More... | |
Macros | |
#define | MCP23X17_BASE_ADDR (0x20) |
MCP23x17 device base address. More... | |
#define | MCP23X17_GPIO_PIN_NUM (16) |
MCP23x17 has 16 I/O pins. | |
#define | MCP23X17_GPIO_PIN(port, pin) ((gpio_t)((port << 3) | pin)) |
Conversion of (port x : pin y) to a pin number. More... | |
Enumerations | |
enum | mcp23x17_error_codes_t { MCP23X17_OK , MCP23X17_ERROR_I2C , MCP23X17_ERROR_SPI , MCP23X17_ERROR_NO_DEV , MCP23X17_ERROR_INV_MODE , MCP23X17_ERROR_INV_FLANK , MCP23X17_ERROR_GPIO , MCP23X17_ERROR_INT_PIN , MCP23X17_ERROR_RESET_PIN } |
Named MCP23x17 driver error codes. More... | |
enum | mcp23x17_if_t { MCP23X17_I2C , MCP23X17_SPI } |
MCP23x17 interface types. More... | |
Functions | |
int | mcp23x17_init (mcp23x17_t *dev, const mcp23x17_params_t *params) |
Initialize the MCP23x17 I/O expander. More... | |
int | mcp23x17_gpio_init (mcp23x17_t *dev, gpio_t pin, gpio_mode_t mode) |
Initialize a MCP23x17 pin. More... | |
int | mcp23x17_gpio_init_int (mcp23x17_t *dev, gpio_t pin, gpio_mode_t mode, gpio_flank_t flank, gpio_cb_t isr, void *arg) |
Initialize a MCP23x17 pin for external interrupt usage. More... | |
int | mcp23x17_gpio_read (mcp23x17_t *dev, gpio_t pin) |
Get the value from MCP23x17 input pin. More... | |
void | mcp23x17_gpio_write (mcp23x17_t *dev, gpio_t pin, int value) |
Write the value to MCP23x17 input pin. More... | |
void | mcp23x17_gpio_clear (mcp23x17_t *dev, gpio_t pin) |
Clear the MCP23x17 output pin. More... | |
void | mcp23x17_gpio_set (mcp23x17_t *dev, gpio_t pin) |
Set the MCP23x17 output pin. More... | |
void | mcp23x17_gpio_toggle (mcp23x17_t *dev, gpio_t pin) |
Toggle the value of the MCP23x17 output pin. More... | |
void | mcp23x17_gpio_irq_enable (mcp23x17_t *dev, gpio_t pin) |
Enable pin interrupt. More... | |
void | mcp23x17_gpio_irq_disable (mcp23x17_t *dev, gpio_t pin) |
Disable pin interrupt. More... | |