From 81e4084ae3e5fe4d571d3449abdefdab096d84b1 Mon Sep 17 00:00:00 2001
From: Andreas Neuhaus <git@zargony.com>
Date: Wed, 4 Sep 2024 14:15:32 +0200
Subject: [PATCH] Switch to I2C Fast-Mode

---
 firmware/src/main.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/firmware/src/main.rs b/firmware/src/main.rs
index c52c06d..dbe40d5 100644
--- a/firmware/src/main.rs
+++ b/firmware/src/main.rs
@@ -109,12 +109,13 @@ async fn main(_spawner: Spawner) {
     info!("Touch 'n Drink {VERSION_STR} ({GIT_SHA_STR})");
 
     // Initialize I2C controller
-    let i2c = I2C::new_async(
+    let i2c = I2C::new_with_timeout_async(
         peripherals.I2C0,
         io.pins.gpio9,
         io.pins.gpio10,
-        100.kHz(), // Standard-Mode: 100 kHz, Fast-Mode: 400 kHz
+        400.kHz(), // Standard-Mode: 100 kHz, Fast-Mode: 400 kHz
         &clocks,
+        Some(20),
     );
     // Share I2C bus. Since the mcu is single-core and I2C is not used in interrupts, I2C access
     // cannot be preempted and we can safely use a NoopMutex for shared access.