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 2021/02/24 07:42:21 UTC

[GitHub] [incubator-nuttx] Donny9 opened a new pull request #2907: sensor driver model update

Donny9 opened a new pull request #2907:
URL: https://github.com/apache/incubator-nuttx/pull/2907


   ## Summary
   Sensor Driver model update.
   Key modification points:
   1. replace lower->buffer_size with lower->buffer_number.
   2. add sanity checks for fetch(with O_NONBLOCK), it will directly return when sensor is disable.
   3. gets the capacity of the hardware fifo, set it to lower->batch_number. And app can get this number by IOCTL cmd:SNIOC_GET_NEVENTBUF
   ## Impact
   
   ## Testing
   daily test.
   


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] acassis commented on pull request #2907: sensor driver model update

Posted by GitBox <gi...@apache.org>.
acassis commented on pull request #2907:
URL: https://github.com/apache/incubator-nuttx/pull/2907#issuecomment-785042462


   Thank you @Donny9 ! I didn't see this wtgahrs2.c before, this is exactly what we were looking for!


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] acassis merged pull request #2907: sensor driver model update

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


   


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] Donny9 edited a comment on pull request #2907: sensor driver model update

Posted by GitBox <gi...@apache.org>.
Donny9 edited a comment on pull request #2907:
URL: https://github.com/apache/incubator-nuttx/pull/2907#issuecomment-785023389


   > Hi @Donny9 yesterday @phfbertoleti asked me about the idea of modifying the bmp180 driver to return pressure and temperature, but I noticed that the register function only will register a single sensor type. Is it possible to use this new sensor subsystem for composite devices like the bmp180?
   
   Yes, we can register composite sensors currently by new sensor driver model, you can refer to the wtgahrs2 driver https://github.com/apache/incubator-nuttx/blob/master/drivers/sensors/wtgahrs2.c.
   
   The following code register accel and gyro in a sensor driver.
     /* Accelerometer register */
   
     tmp = &rtdata->dev[WTGAHRS2_ACCEL_IDX];
     tmp->lower.ops = &g_wtgahrs2_ops;
     tmp->lower.type = SENSOR_TYPE_ACCELEROMETER;
     tmp->lower.buffer_size = sizeof(struct sensor_event_accel);
     ret = sensor_register(&tmp->lower, devno);
     if (ret < 0)
       {
         goto accel_err;
       }
   
     /* Gyroscope register */
   
     tmp = &rtdata->dev[WTGAHRS2_GYRO_IDX];
     tmp->lower.ops = &g_wtgahrs2_ops;
     tmp->lower.type = SENSOR_TYPE_GYROSCOPE;
     tmp->lower.buffer_size = sizeof(struct sensor_event_gyro);
     ret = sensor_register(&tmp->lower, devno);
     if (ret < 0)
       {
         goto gyro_err;
       }


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] acassis commented on pull request #2907: sensor driver model update

Posted by GitBox <gi...@apache.org>.
acassis commented on pull request #2907:
URL: https://github.com/apache/incubator-nuttx/pull/2907#issuecomment-785016819


   Hi @Donny9 yesterday @phfbertoleti asked me about the idea of modifying the bmp180 driver to return pressure and temperature, but I noticed that the register function only will register a single sensor type. Is it possible to use this new sensor subsystem for composite devices like the bmp180?


----------------------------------------------------------------
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.

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



[GitHub] [incubator-nuttx] Donny9 commented on pull request #2907: sensor driver model update

Posted by GitBox <gi...@apache.org>.
Donny9 commented on pull request #2907:
URL: https://github.com/apache/incubator-nuttx/pull/2907#issuecomment-785023389


   > Hi @Donny9 yesterday @phfbertoleti asked me about the idea of modifying the bmp180 driver to return pressure and temperature, but I noticed that the register function only will register a single sensor type. Is it possible to use this new sensor subsystem for composite devices like the bmp180?
   
   Yes, we can register composite sensors currently by new sensor driver model, you can refer to the wtgahrs2 driver https://github.com/apache/incubator-nuttx/blob/master/drivers/sensors/wtgahrs2.c.


----------------------------------------------------------------
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.

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