[En-Nut-Discussion] FIX in I2C

Krzysztof Sawicki krzysztof.sawicki at mlabs.pl
Wed Jan 18 09:55:12 CET 2017


Hope coding style is ok :)

Index: nut/arch/cm3/dev/stm/stm32_i2cbus_v1.c
===================================================================
--- nut/arch/cm3/dev/stm/stm32_i2cbus_v1.c      (revision 6581)
+++ nut/arch/cm3/dev/stm/stm32_i2cbus_v1.c      (working copy)
@@ -21,7 +21,7 @@
   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
   * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DsdAMAGES (INCLUDING,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
   * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
   * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
   * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
@@ -232,7 +232,8 @@
      I2Cx->CR1 &= ~I2C_CR1_STOP;
      I2Cx->CR1 |= I2C_CR1_START;
      rc = NutEventWait(&icb->icb_queue, slave->slave_timeout);
-    I2Cx->CR2 &= ~I2C_CR2_ITEVTEN|I2C_CR2_ITBUFEN |I2C_CR2_ITERREN;
+    I2Cx->CR2 &= ~(I2C_CR2_ITEVTEN|I2C_CR2_ITBUFEN|I2C_CR2_ITERREN);
+
      if(icb->errors)
      {
          I2Cx->CR1 |= I2C_CR1_STOP;


-- 
Krzysztof Sawicki
MLabs sp. z o.o.
ul. Kaliska 21
61-131 Poznań

tel. 61 646 84 27

KRS: 0000390306
NIP: 7822533401


More information about the En-Nut-Discussion mailing list