This is an automated email from the ASF dual-hosted git repository.

ligd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 21c19b78242 drivers/analog/mcp47x6: fix configuration command
21c19b78242 is described below

commit 21c19b78242e4ac08c2df8f11926fe260cf12bad
Author: Lars Kruse <[email protected]>
AuthorDate: Wed Jan 21 12:16:15 2026 +0100

    drivers/analog/mcp47x6: fix configuration command
    
    Previously the ioctl-based configuration was not encoded properly.
    It lacked the three command bits selecting the "set volatile
    configuration" mode.
    Thus, configuration the reference, power-down or gain resulted in no
    change.
    
    Now the configuration is properly applied.
    
    The DAC value to be send is now combined with the proper command prefix
    bits, too.
    But this operation was already working, since the command prefix is zero.
    
    Signed-off-by: Lars Kruse <[email protected]>
---
 drivers/analog/mcp47x6.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/analog/mcp47x6.c b/drivers/analog/mcp47x6.c
index 3c9bbee54d2..1aad4da6273 100644
--- a/drivers/analog/mcp47x6.c
+++ b/drivers/analog/mcp47x6.c
@@ -305,7 +305,7 @@ static int mcp47x6_send(FAR struct dac_dev_s *dev, FAR 
struct dac_msg_s *msg)
   uint32_t data;
   data = msg->am_data & MCP47X6_DATA_MASK;
   data <<= MCP47X6_DATA_SHIFT;
-  buffer[0] = (uint8_t)(data >> 8);
+  buffer[0] = (uint8_t)(data >> 8) | MCP47X6_COMMAND_WRITE_DAC;
   buffer[1] = (uint8_t)(data);
 
   ret = mcp47x6_i2c_write(priv, buffer, sizeof(buffer));
@@ -396,7 +396,8 @@ static int mcp47x6_ioctl(FAR struct dac_dev_s *dev, int cmd,
 
   if (command_prepared)
     {
-      ret = mcp47x6_i2c_write(priv, &priv->cmd, sizeof(priv->cmd));
+      uint8_t raw_cmd = MCP47X6_COMMAND_WRITE_CONFIG | priv->cmd;
+      ret = mcp47x6_i2c_write(priv, &raw_cmd, sizeof(raw_cmd));
     }
 
   return ret;

Reply via email to