From dbcaf1933abeee0356a67687741b2866a20e7d4a Mon Sep 17 00:00:00 2001 From: 9names <60134748+9names@users.noreply.github.com> Date: Sat, 21 Aug 2021 01:47:11 +1000 Subject: [PATCH] Fix limits on acceptable ranges --- rp2040-hal/src/i2c.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rp2040-hal/src/i2c.rs b/rp2040-hal/src/i2c.rs index 8926a1e..a482eeb 100644 --- a/rp2040-hal/src/i2c.rs +++ b/rp2040-hal/src/i2c.rs @@ -130,10 +130,10 @@ macro_rules! hal { let hcnt = period - lcnt; // Check for out-of-range divisors: - assert!(hcnt < 0xffff); - assert!(lcnt < 0xffff); - assert!(hcnt > 8); - assert!(lcnt > 8); + assert!(hcnt <= 0xffff); + assert!(lcnt <= 0xffff); + assert!(hcnt >= 8); + assert!(lcnt >= 8); // Per I2C-bus specification a device in standard or fast mode must // internally provide a hold time of at least 300ns for the SDA signal to