From 33c7e93ef6a2deca05f0154087de16825268faf7 Mon Sep 17 00:00:00 2001 From: Frits Kuipers Date: Sat, 6 Feb 2016 19:05:46 +0100 Subject: [PATCH] boards/nucleo-f401: I2C Feature for nucleo-f401 board board/nucleo-f401: Closed comment group Removed double features --- boards/nucleo-f401/Makefile.features | 1 + boards/nucleo-f401/include/periph_conf.h | 29 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/boards/nucleo-f401/Makefile.features b/boards/nucleo-f401/Makefile.features index 5a6a4e7cae..9b23f31e52 100644 --- a/boards/nucleo-f401/Makefile.features +++ b/boards/nucleo-f401/Makefile.features @@ -1,5 +1,6 @@ # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_cpuid +FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_spi FEATURES_PROVIDED += periph_timer diff --git a/boards/nucleo-f401/include/periph_conf.h b/boards/nucleo-f401/include/periph_conf.h index 9864839bc2..7464475841 100644 --- a/boards/nucleo-f401/include/periph_conf.h +++ b/boards/nucleo-f401/include/periph_conf.h @@ -133,6 +133,35 @@ static const uart_conf_t uart_config[] = { /** @} */ +/** + * @name I2C configuration + * @{ + */ +#define I2C_NUMOF (1U) +#define I2C_0_EN 1 +#define I2C_IRQ_PRIO 1 +#define I2C_APBCLK (42000000U) + +/* I2C 0 device configuration */ +#define I2C_0_DEV I2C1 +#define I2C_0_CLKEN() (RCC->APB1ENR |= RCC_APB1ENR_I2C1EN) +#define I2C_0_CLKDIS() (RCC->APB1ENR &= ~(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_CLKEN() (RCC->AHB1ENR |= 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_CLKEN() (RCC->AHB1ENR |= RCC_AHB1ENR_GPIOBEN) +/** @} */ + + #ifdef __cplusplus } #endif