From 3ee9710f359d5cdac69a24b29087aa23ddfc2667 Mon Sep 17 00:00:00 2001 From: Chuck McManis Date: Sun, 12 Apr 2020 21:25:08 -0700 Subject: [PATCH] STM32F4: I2C Noise Filter Register --- include/libopencm3/stm32/f4/i2c.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/include/libopencm3/stm32/f4/i2c.h b/include/libopencm3/stm32/f4/i2c.h index e2a65e16..a6b8de28 100644 --- a/include/libopencm3/stm32/f4/i2c.h +++ b/include/libopencm3/stm32/f4/i2c.h @@ -31,9 +31,33 @@ LGPL License Terms @ref lgpl_license #ifndef LIBOPENCM3_I2C_H #define LIBOPENCM3_I2C_H +#include #include -/**@{*/ +/** +@addtogroup i2c_defines +@{*/ + +/** FLTR register (I2Cx_FLTR) (noise filter) */ +#define I2C_FLTR(i2c_base) MMIO32((i2c_base) + 0x24) +#define I2C1_FLTR I2C_FLTR(I2C1) +#define I2C2_FLTR I2C_FLTR(I2C2) +#define I2C3_FLTR I2C_FLTR(I2C3) + +/** + * Bits [3:0] DNF - Digital noise filter + * These bits configure a digital noise filter on SDA and SCL pins. + * Value sets minimum pulse width needed to trigger i2c operations. + * 0 disables, 1 - 15 set minimum width to 'n' * TPCLK1 + */ +#define I2C_FLTR_DNF_MASK 0xF +#define I2C_FLTR_DNF_SHIFT 0 + +/** + * Bit 4 - Analog Noise filter disable + * Turns off the built in analog noise filter. + */ +#define I2C_FLTR_ANOFF (1<<4) /**@}*/