laoniaokkk opened a new pull request, #10864:
URL: https://github.com/apache/nuttx/pull/10864

   ## Summary
   A digital converter for rtd
   ## Impact
   NuttShell (NSH) NuttX-12.2.1
   nsh> 
   nsh> ls /dev
   /dev:
    console
    null
    ram0
    temp0
    ttyS0
   ## Testing
   #define MAX31865_PATH "/dev/temp0"
   
   int main(int argc, FAR char *argv[])
   {
     int ret = 0;
     int fd = 0;
     float temp = 0.0f;
   
     fd = open(MAX31865_PATH, O_RDONLY);
     if (fd < 0)
     {
       perror("open max31865 fail");
       return -1;
     }
   
     while (1)
     {
       sleep(1);
       ret = read(fd, (float *)&temp, sizeof(temp));
       if (ret < 0)
         printf("read max31865 fail: %d\n", ret);
       else
         printf("temp: %.1f\n", temp);
     }
   
     return 0;
   }
   


-- 
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-unsubscr...@nuttx.apache.org

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

Reply via email to