From 27d2841a606177ecec2a2f8bcc2861e197f9765d Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Thu, 31 May 2018 22:26:40 +0200 Subject: [PATCH] boards/nucleo-f207zg: use new style for i2c config --- boards/nucleo-f207zg/include/periph_conf.h | 40 +++++++++------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/boards/nucleo-f207zg/include/periph_conf.h b/boards/nucleo-f207zg/include/periph_conf.h index 2af6f16da4..e860e7128f 100644 --- a/boards/nucleo-f207zg/include/periph_conf.h +++ b/boards/nucleo-f207zg/include/periph_conf.h @@ -232,30 +232,24 @@ static const spi_conf_t spi_config[] = { * @name I2C configuration * @{ */ -#define I2C_NUMOF (1U) -#define I2C_0_EN 1 -#define I2C_IRQ_PRIO 1 -#define I2C_APBCLK (CLOCK_APB1) +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_APB1ENR_I2C1EN, + .clk = CLOCK_APB1, + .irqn = I2C1_EV_IRQn + } +}; -/* I2C 0 device configuration */ -#define I2C_0_DEV I2C1 -#define I2C_0_CLKEN() (periph_clk_en(APB1, RCC_APB1ENR_I2C1EN)) -#define I2C_0_CLKDIS() (periph_clk_dis(APB1, RCC_APB1ENR_I2C1EN)) -#define I2C_0_EVT_IRQ I2C1_EV_IRQn -#define I2C_0_EVT_ISR isr_i2c1_ev -#define I2C_0_ERR_IRQ I2C1_ER_IRQn -#define I2C_0_ERR_ISR isr_i2c1_er -/* I2C 0 pin configuration */ -#define I2C_0_SCL_PORT GPIOB -#define I2C_0_SCL_PIN 8 -#define I2C_0_SCL_AF 4 -#define I2C_0_SCL_PULLUP 0 -#define I2C_0_SCL_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN)) -#define I2C_0_SDA_PORT GPIOB -#define I2C_0_SDA_PIN 9 -#define I2C_0_SDA_AF 4 -#define I2C_0_SDA_PULLUP 0 -#define I2C_0_SDA_CLKEN() (periph_clk_en(AHB1, RCC_AHB1ENR_GPIOBEN)) +#define I2C_0_ISR isr_i2c1_ev + +#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) /** @} */ /**