From edc8283572d4f7648146b05d49dc446e169d4534 Mon Sep 17 00:00:00 2001 From: Mikkel Jeppesen <2756925+Duckle29@users.noreply.github.com> Date: Sat, 31 Aug 2019 02:47:11 +0200 Subject: [PATCH] Removed prescaler define from avr i2c, as it was impossible to use (#6617) --- docs/i2c_driver.md | 1 - drivers/avr/i2c_master.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/i2c_driver.md b/docs/i2c_driver.md index 317307e1bf..856ca0a9b2 100644 --- a/docs/i2c_driver.md +++ b/docs/i2c_driver.md @@ -34,7 +34,6 @@ The following defines can be used to configure the I2C master driver. |Variable |Description |Default| |------------------|---------------------------------------------------|-------| |`F_SCL` |Clock frequency in Hz |400KHz | -|`Prescaler` |Divides master clock to aid in I2C clock selection |1 | AVRs usually have set GPIO which turn into I2C pins, therefore no further configuration is required. diff --git a/drivers/avr/i2c_master.c b/drivers/avr/i2c_master.c index 52924437e0..c084d5754f 100644 --- a/drivers/avr/i2c_master.c +++ b/drivers/avr/i2c_master.c @@ -27,8 +27,8 @@ #ifndef F_SCL # define F_SCL 400000UL // SCL frequency #endif -#define Prescaler 1 -#define TWBR_val ((((F_CPU / F_SCL) / Prescaler) - 16) / 2) + +#define TWBR_val (((F_CPU / F_SCL) - 16) / 2) void i2c_init(void) { TWSR = 0; /* no prescaler */