From 2bbc9be47a054e80af3ae215c2b4226b6a056df1 Mon Sep 17 00:00:00 2001 From: Michel Rottleuthner Date: Wed, 24 Oct 2018 13:05:37 +0200 Subject: [PATCH] boards/nucleo-l476rg: add I2C configuration --- boards/nucleo-l476rg/Makefile.features | 1 + boards/nucleo-l476rg/include/periph_conf.h | 23 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/boards/nucleo-l476rg/Makefile.features b/boards/nucleo-l476rg/Makefile.features index 1576991fba..ae9f2f2096 100644 --- a/boards/nucleo-l476rg/Makefile.features +++ b/boards/nucleo-l476rg/Makefile.features @@ -1,6 +1,7 @@ # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_adc FEATURES_PROVIDED += periph_gpio periph_gpio_irq +FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc FEATURES_PROVIDED += periph_rtt diff --git a/boards/nucleo-l476rg/include/periph_conf.h b/boards/nucleo-l476rg/include/periph_conf.h index 1487ced52a..5a28863cc9 100644 --- a/boards/nucleo-l476rg/include/periph_conf.h +++ b/boards/nucleo-l476rg/include/periph_conf.h @@ -243,6 +243,29 @@ static const spi_conf_t spi_config[] = { #define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0])) /** @} */ +/** + * @name I2C configuration + * @{ + */ +static const i2c_conf_t i2c_config[] = { + { + .dev = I2C1, + .speed = I2C_SPEED_NORMAL, + .scl_pin = GPIO_PIN(PORT_B, 8), + .sda_pin = GPIO_PIN(PORT_B, 9), + .scl_af = GPIO_AF4, + .sda_af = GPIO_AF4, + .bus = APB1, + .rcc_mask = RCC_APB1ENR1_I2C1EN, + .irqn = I2C1_ER_IRQn, + } +}; + +#define I2C_0_ISR isr_i2c1_er + +#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) +/** @} */ + /** * @name ADC configuration *