From 22ff7d7af290f027bedf03806cec026c060b812a Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Sat, 26 May 2018 19:21:17 +0200 Subject: [PATCH] boards/nucleo-f070: add i2c configuration for i2c --- boards/nucleo-f030r8/Makefile.features | 1 + boards/nucleo-f070rb/include/periph_conf.h | 24 ++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/boards/nucleo-f030r8/Makefile.features b/boards/nucleo-f030r8/Makefile.features index a5ae6b5961..784fb12492 100644 --- a/boards/nucleo-f030r8/Makefile.features +++ b/boards/nucleo-f030r8/Makefile.features @@ -1,6 +1,7 @@ # Put defined MCU peripherals here (in alphabetical order) FEATURES_PROVIDED += periph_adc FEATURES_PROVIDED += periph_gpio +FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_pwm FEATURES_PROVIDED += periph_rtc FEATURES_PROVIDED += periph_timer diff --git a/boards/nucleo-f070rb/include/periph_conf.h b/boards/nucleo-f070rb/include/periph_conf.h index 7dd6a68504..0289d32e17 100644 --- a/boards/nucleo-f070rb/include/periph_conf.h +++ b/boards/nucleo-f070rb/include/periph_conf.h @@ -151,6 +151,30 @@ static const pwm_conf_t pwm_config[] = { #define PWM_NUMOF (sizeof(pwm_config) / sizeof(pwm_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_AF1, + .sda_af = GPIO_AF1, + .bus = APB1, + .rcc_mask = RCC_APB1ENR_I2C1EN, + .rcc_sw_mask = RCC_CFGR3_I2C1SW, + .irqn = I2C1_IRQn, + } +}; + +#define I2C_0_ISR isr_i2c1 + +#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) +/** @} */ + /** * @name ADC configuration * @{