From 4db40e08394fdc6742f9117f3098d23a5de2bd95 Mon Sep 17 00:00:00 2001 From: Ross Schlaikjer Date: Thu, 4 Apr 2019 11:06:03 -0400 Subject: [PATCH] stm32f7: Include i2c_common_v2 With the addition of a define for I2C4, the existing common i2c functions seem to work out of the box on the F7 (tested on an STM32F750). --- .../libopencm3/stm32/common/i2c_common_v2.h | 3 ++ include/libopencm3/stm32/f7/i2c.h | 36 +++++++++++++++++++ lib/stm32/f7/Makefile | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 include/libopencm3/stm32/f7/i2c.h diff --git a/include/libopencm3/stm32/common/i2c_common_v2.h b/include/libopencm3/stm32/common/i2c_common_v2.h index cd311064..ad4846b9 100644 --- a/include/libopencm3/stm32/common/i2c_common_v2.h +++ b/include/libopencm3/stm32/common/i2c_common_v2.h @@ -46,6 +46,9 @@ specific memorymap.h header before including this header file.*/ #ifdef I2C3_BASE #define I2C3 I2C3_BASE #endif +#ifdef I2C4_BASE +#define I2C4 I2C4_BASE +#endif /**@}*/ /* --- I2C registers ------------------------------------------------------- */ diff --git a/include/libopencm3/stm32/f7/i2c.h b/include/libopencm3/stm32/f7/i2c.h new file mode 100644 index 00000000..23b7d6bf --- /dev/null +++ b/include/libopencm3/stm32/f7/i2c.h @@ -0,0 +1,36 @@ +/** @defgroup i2c_defines I2C Defines + * + * @brief Defined Constants and Types for the STM32F7xx I2C + * + * @ingroup STM32F7xx_defines + * + * @version 1.0.0 + * + * @date 04 April 2019 + * + * LGPL License Terms @ref lgpl_license + */ +/* + * This file is part of the libopencm3 project. + * + * This library is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see . + */ + +#ifndef LIBOPENCM3_I2C_H +#define LIBOPENCM3_I2C_H + +#include + +#endif + diff --git a/lib/stm32/f7/Makefile b/lib/stm32/f7/Makefile index bbd1e400..be9739c4 100644 --- a/lib/stm32/f7/Makefile +++ b/lib/stm32/f7/Makefile @@ -46,8 +46,8 @@ OBJS = desig.o OBJS += dma_common_f24.o OBJS += flash_common_all.o flash_common_f.o flash_common_f24.o flash.o OBJS += gpio.o gpio_common_all.o gpio_common_f0234.o +OBJS += i2c_common_v2.o OBJS += pwr.o rcc.o - OBJS += rcc_common_all.o OBJS += rng_common_v1.o OBJS += spi_common_all.o spi_common_v2.o