/* Set the I2C digital filter. These bits are used to configure the digital noise filter on SDA and SCL input. The digital filter will filter spikes with a length of up to dnf_setting * I2CCLK clocks  */
void i2c_set_digital_filter(uint32_t i2c, uint8_t dnf_setting)
/* Set the I2C digital filter. These bits are used to configure the digital noise filter on SDA and SCL input. The digital filter will filter spikes with a length of up to dnf_setting * I2CCLK clocks  */
void i2c_set_digital_filter(uint32_t i2c, uint8_t dnf_setting)
{
	I2C_CR1(i2c) = (I2C_CR1(i2c) & ~(I2C_CR1_DNF_MASK << I2C_CR1_DNF_SHIFT)) |
		(dnf_setting << I2C_CR1_DNF_SHIFT);
}