You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/06/18 11:52:05 UTC

[GitHub] [incubator-nuttx] AuroraRAS opened a new pull request, #6468: Add I2C_M_NOSTART and I2C_M_NOSTOP support in esp32c3_i2c

AuroraRAS opened a new pull request, #6468:
URL: https://github.com/apache/incubator-nuttx/pull/6468

   ## Summary
   Add I2C_M_NOSTART and I2C_M_NOSTOP support in esp32c3_i2c.c
   
   ## Impact
   we can write specific register on device with I2C now.
   
   ## Testing
   passed with mpu6050.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6468: Add I2C_M_NOSTART and I2C_M_NOSTOP support in esp32c3_i2c

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #6468:
URL: https://github.com/apache/incubator-nuttx/pull/6468#discussion_r900861463


##########
arch/risc-v/src/esp32c3/esp32c3_i2c.c:
##########
@@ -1037,14 +1037,32 @@ static int esp32c3_i2c_transfer(struct i2c_master_s *dev,
 
       esp32c3_i2c_init_clock(priv, msgs[i].frequency);
 
-      /* Reset I2C trace logic */
+      if (msgs[i].flags&I2C_M_NOSTART)

Review Comment:
   add space before and after &



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] AuroraRAS commented on pull request #6468: Add I2C_M_NOSTART and I2C_M_NOSTOP support in esp32c3_i2c

Posted by GitBox <gi...@apache.org>.
AuroraRAS commented on PR #6468:
URL: https://github.com/apache/incubator-nuttx/pull/6468#issuecomment-1159763547

   > Requesting some changes to prevent build break when `CONFIG_I2C_POLLED=y`
   
   I just put `#ifndef CONFIG_I2C_POLLED` there, but not only around `I2CSTATE_FINISH`. I'm not found out a way to make it work when `CONFIG_I2C_POLLED=y`, it's will working like before.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] gustavonihei commented on a diff in pull request #6468: Add I2C_M_NOSTART and I2C_M_NOSTOP support in esp32c3_i2c

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on code in PR #6468:
URL: https://github.com/apache/incubator-nuttx/pull/6468#discussion_r901034958


##########
arch/risc-v/src/esp32c3/esp32c3_i2c.c:
##########
@@ -1454,6 +1472,10 @@ static inline void esp32c3_i2c_process(struct esp32c3_i2c_priv_s *priv,
               if (priv->bytes == msg->length)
                 {
                   priv->i2cstate = I2CSTATE_STOP;
+                  if ((msg->flags & I2C_M_NOSTOP) != 0)
+                    {
+                      priv->i2cstate = I2CSTATE_FINISH;
+                    }

Review Comment:
   ```suggestion
                     if ((msg->flags & I2C_M_NOSTOP) == 0)
                       {
                         priv->i2cstate = I2CSTATE_STOP;
                       }
   #ifndef CONFIG_I2C_POLLED
                     else
                       {
                         priv->i2cstate = I2CSTATE_FINISH;
                       }
   #endif
   ```
   `I2CSTATE_FINISH` does not apply for Polled I2C.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] gustavonihei commented on a diff in pull request #6468: Add I2C_M_NOSTART and I2C_M_NOSTOP support in esp32c3_i2c

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on code in PR #6468:
URL: https://github.com/apache/incubator-nuttx/pull/6468#discussion_r901034916


##########
arch/risc-v/src/esp32c3/esp32c3_i2c.c:
##########
@@ -1037,14 +1037,32 @@ static int esp32c3_i2c_transfer(struct i2c_master_s *dev,
 
       esp32c3_i2c_init_clock(priv, msgs[i].frequency);
 
-      /* Reset I2C trace logic */
+      if ((msgs[i].flags & I2C_M_NOSTART) != 0)
+        {
+          esp32c3_i2c_traceevent(priv, I2CEVENT_SENDBYTE, priv->bytes,
+                                 getreg32(I2C_SR_REG(priv->id)));
+          esp32c3_i2c_senddata(priv);
+
+          if (priv->bytes == msgs[i].length)
+            {
+              priv->i2cstate = I2CSTATE_STOP;
+              if ((msgs[i].flags & I2C_M_NOSTOP) != 0)
+                {
+                  priv->i2cstate = I2CSTATE_FINISH;
+                }

Review Comment:
   ```suggestion
                 if ((msgs[i].flags & I2C_M_NOSTOP) == 0)
                   {
                     priv->i2cstate = I2CSTATE_STOP;
                   }
   #ifndef CONFIG_I2C_POLLED
                 else
                   {
                     priv->i2cstate = I2CSTATE_FINISH;
                   }
   #endif
   ```
   `I2CSTATE_FINISH` does not apply for Polled I2C.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] acassis merged pull request #6468: Add I2C_M_NOSTART and I2C_M_NOSTOP support in esp32c3_i2c

Posted by GitBox <gi...@apache.org>.
acassis merged PR #6468:
URL: https://github.com/apache/incubator-nuttx/pull/6468


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx] pkarashchenko commented on a diff in pull request #6468: Add I2C_M_NOSTART and I2C_M_NOSTOP support in esp32c3_i2c

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #6468:
URL: https://github.com/apache/incubator-nuttx/pull/6468#discussion_r900892553


##########
arch/risc-v/src/esp32c3/esp32c3_i2c.c:
##########
@@ -1037,14 +1037,30 @@ static int esp32c3_i2c_transfer(struct i2c_master_s *dev,
 
       esp32c3_i2c_init_clock(priv, msgs[i].frequency);
 
-      /* Reset I2C trace logic */
+      if (msgs[i].flags & I2C_M_NOSTART)

Review Comment:
   Optional
   ```suggestion
         if ((msgs[i].flags & I2C_M_NOSTART) != 0)
   ```



##########
arch/risc-v/src/esp32c3/esp32c3_i2c.c:
##########
@@ -1037,14 +1037,30 @@ static int esp32c3_i2c_transfer(struct i2c_master_s *dev,
 
       esp32c3_i2c_init_clock(priv, msgs[i].frequency);
 
-      /* Reset I2C trace logic */
+      if (msgs[i].flags & I2C_M_NOSTART)
+        {
+          esp32c3_i2c_traceevent(priv, I2CEVENT_SENDBYTE, priv->bytes,
+                                 getreg32(I2C_SR_REG(priv->id)));
+          esp32c3_i2c_senddata(priv);
 
-      esp32c3_i2c_tracereset(priv);
+          if (priv->bytes == msgs[i].length)
+            {
+              priv->i2cstate = I2CSTATE_STOP;
+              if (msgs[i].flags & I2C_M_NOSTOP)
+                priv->i2cstate = I2CSTATE_FINISH;

Review Comment:
   Optionnal
   ```suggestion
                 if ((msgs[i].flags & I2C_M_NOSTOP) != 0)
                   {
                     priv->i2cstate = I2CSTATE_FINISH;
                   }
   ```
   adding `{}` not optional



##########
arch/risc-v/src/esp32c3/esp32c3_i2c.c:
##########
@@ -1454,6 +1470,8 @@ static inline void esp32c3_i2c_process(struct esp32c3_i2c_priv_s *priv,
               if (priv->bytes == msg->length)
                 {
                   priv->i2cstate = I2CSTATE_STOP;
+                  if (msg->flags & I2C_M_NOSTOP)
+                    priv->i2cstate = I2CSTATE_FINISH;

Review Comment:
   ```suggestion
                     if (msg->flags & I2C_M_NOSTOP)
                       {
                         priv->i2cstate = I2CSTATE_FINISH;
                       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org