Commit Graph

586 Commits

Author SHA1 Message Date
likun17
068c7176bb usensor.c:fix container_of member error.
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-10-11 00:52:00 +08:00
likun17
57f84aaca8 sensor: Added 6dof motion and gesture related types. For details, see: https://developer.android.com/reference/android/hardware/SensorEvent#values
Signed-off-by: likun17 <likun17@xiaomi.com>
2024-10-03 09:06:59 +08:00
dongjiuzhu1
eb0732a183 nuttx/uorb.h: align sensor_type value with aosp refs:0e67aa0cae:include_all/hardware/sensors-base.h
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-10-03 09:06:59 +08:00
likun17
09ab135d2f sensor: Fixed the problem of user information lag in cross-core communication "stublist".
When its remote core publishes a message, all subscribed cores will receive the message,
but the local core "stublist" does not update the user's "generation" and "bufferpos" parameters.

Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-21 23:09:48 +08:00
likun17
bdac8c116a sensor_rpmsg.c: Fix that "stub" will be created when local core only has subscribers.
After the ap core subscribes to the 25hz batch 120ms data of the sensor core, it switches
to the cp core and subscribes to the 50hz batch 120ms sensor core data. At this time,
the data subscribed by the AP will be abnormally lost (12.5hz). Mainly because ap
subscribes to sensor core data earlier than cp. The subscription of cp will be broadcast
to the ap core at the same time, and the corresponding "path" already exists
under "/dev/uorb" of ap. Thus the ap will create a "stub".

There are some restrictions on the creation of "stub" to avoid this situation.

Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-20 22:05:58 +08:00
wangjianyu3
bdddc76997 nuttx/uorb: Fix incompatible type error
Related: b17c074a18

Log:
  Error: sensors/ms56xx_uorb.c:145:20: error: initialization of 'int (*)(struct sensor_lowerhalf_s *, struct file *, uint32_t *)' {aka 'int (*)(struct sensor_lowerhalf_s *, struct file *, unsigned int *)'} from incompatible pointer type 'int (*)(struct sensor_lowerhalf_s *, struct file *, long unsigned int *)' [-Werror=incompatible-pointer-types]
    145 |   .set_interval  = ms56xx_set_interval,
        |                    ^~~~~~~~~~~~~~~~~~~
  sensors/ms56xx_uorb.c:145:20: note: (near initialization for 'g_sensor_ops.set_interval')
  cc1: all warnings being treated as errors

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 19:54:38 +08:00
wangjianyu3
3ab62370cb nuttx/uorb: Fix initialization error of variable of type struct sensor_ops_s
Related change:
  .flush    : 403469336f
  .get_info : 703bb7e7b3

Error Log:
  1153  Building NuttX...
  1154Error: sensors/bme680_uorb.c:428:3: error: initialization of 'int (*)(struct sensor_lowerhalf_s *, struct file *, long unsigned int)' from incompatible pointer type 'int (*)(struct sensor_lowerhalf_s *, struct file *, int,  long unsigned int)' [-Werror=incompatible-pointer-types]
  1155  428 |   bme680_control    /* control */
  1156      |   ^~~~~~~~~~~~~~

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 19:54:38 +08:00
wangjianyu3
d2b58a520e sensor.c: Rename container_of to list_container_of
https://github.com/apache/nuttx/pull/11805

Log:
    /github/workspace/sources/nuttx/drivers/sensors/usensor.c: In function 'usensor_get_info':
    Warning: /github/workspace/sources/nuttx/drivers/sensors/usensor.c:228:44: warning: implicit declaration of function 'container_of'; did you mean 'list_container_of'? [-Wimplicit-function-declaration]
      228 |   FAR struct usensor_lowerhalf_s *ulower = container_of(lower,
          |                                            ^~~~~~~~~~~~
          |                                            list_container_of
    Error: /github/workspace/sources/nuttx/drivers/sensors/usensor.c:229:44: error: expected expression before 'struct'
      229 |                                            struct usensor_lowerhalf_s,
          |                                            ^~~~~~
    /github/workspace/sources/nuttx/drivers/sensors/usensor.c: In function 'usensor_control':
    Error: /github/workspace/sources/nuttx/drivers/sensors/usensor.c:241:44: error: expected expression before 'struct'
      241 |                                            struct usensor_lowerhalf_s,
          |                                            ^~~~~~

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 11:45:11 +08:00
wangjianyu3
607b8effe9 driver/sensors: Let gnss geofence follow the existing naming rules
ORB_ID(sensor_gnss_geofence_event)

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
wangjianyu3
ffac2a314b driver/sensors: Support GNSS Geofence
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
wangjianyu3
bf83b3fafc driver/sensors: Support GNSS Measurement & Clock
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
wangjianyu3
e830db0316 driver/sensors: Add constellation for GNSS
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
wangjianyu3
c652f41c87 nuttx/uorb: Rename GPS to GNSS
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-19 03:44:49 +08:00
dongjiuzhu1
b17c074a18 nuttx/uorb: change unsigned long to uint32 to fix size issue
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-19 03:44:49 +08:00
dongjiuzhu1
abbd9c7da9 drivers/sensors: Limit notification events to user
1. notify POLLIN to reader.
2. notify POLLPRI to writer,
in addition, notify POLLPRI to the user who completed the flush .

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-19 03:44:49 +08:00
dongjiuzhu1
403469336f driver/sensors: support sensor flush operation
Supports the flush operation of the sensor.

The application can initiate a flush action through ioctl SNIOC_FLUSH
to trigger flush, and the call will be returned immediately.
Using SNIOC_GET_EVENTS to clear flush event,

However, the flush implementation is asynchronous, when all the flush
data is push to upper circbuffer, the POLLPRI event(FLUSH_COMPLETED)
will be reported.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-19 03:44:49 +08:00
likun17
703bb7e7b3 sensor.c: Added new interface for obtaining and setting sensor device information.
When there is an actual physical sensor, the driver must implement the get info interface. The upper layer can obtain the actual physical sensor information through SNIOC_GET_INFO.
SNIOC_SET_INFO can only set the information of the local virtual sensor, which means it is bound to the local advertisement. Remote subscribers cannot set the information.

Usage:
  struct sensor_device_info dev_info;
  orb_ioctl(fd, SNIOC_GET_INFO, (unsigned long)(uintptr_t)&dev_info);

  or:
  ret = orb_set_info(fd, &dev_info);
  ret = orb_get_info(fd, &dev_info);

Signed-off-by: likun17 <likun17@xiaomi.com>
2024-09-19 03:44:49 +08:00
dongjiuzhu1
c0674b34d6 sensors/gps: using config to adjust gps recv size
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-09-19 03:44:49 +08:00
simbit18
583f025422 Fix Kconfig style
Remove spaces from Kconfig files
Add TABs
Replace help => ---help---
2024-09-17 22:16:41 +08:00
xuxin19
a3e7fee595 cmake:add missing libc regex CMake support
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-09-15 10:29:21 +08:00
Luchian Mihai
eadc2f5690 feat: add basic driver for amg88xx sensor
Basic amg88xx sensor handling (open, close, read, ioctl).
No interrupts supported. I intend to add support for this feature when I
gain more know-how on nuttx/posix.
2024-09-07 12:03:38 +08:00
Petro Karashchenko
1528b8dcca nuttx: resolve various 'FAR' and 'CODE' issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-26 10:21:03 +08:00
Petro Karashchenko
d499ac9d58 nuttx: fix multiple 'FAR', 'CODE' and style issues
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2024-08-25 19:22:15 +08:00
chenxiaoyi
538582ede1 convert pointer string to number in base 16
Co-authored-by: chenxiaoyi <chenxiaoyi@xiaomi.com>
Co-authored-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 22:36:57 +08:00
Rodrigo Sim
208b8e084f arm/stm32f401rc-rs485: Add support to BMP280 sensor
Signed-off-by: Rodrigo Sim <rcsim10@gmail.com>
2024-08-11 03:09:14 +08:00
Matteo Golin
1fba2ec0df Add support for the Sensirion SHT4x temperature and humidity sensor family.
This driver implements `read`, `write`, `open`, `close` and `ioctl`
interfaces to the SHT4X temperature and humidity sensor on an I2C bus.
The read implementation is that of a character driver for easy
debugging, while `ioctl` provides an interface to the sensor's raw data
collection and heating functionality.
2024-07-22 14:24:20 -03:00
Richard Tucker
02cce1ec71 sensors/bmi270: fix bmi270_uorb build 2024-06-17 18:29:18 +08:00
Richard Tucker
6d4356662d sensors/bmi270: fix typo 2024-06-17 16:22:15 +08:00
raiden00pl
697e30e615 sensors/bmm150: configure I2C frequency 2024-05-20 10:13:42 +08:00
raiden00pl
c9bf7a841e sensors/bh1749nuc: configure I2C frequency 2024-05-20 10:13:42 +08:00
raiden00pl
147b5762f0 sensors/bh1749nuc_uorb.c: don't wait for VALID flag in fetch interface
otherwise the sensor freezes when we read RBG and IR data one after another
2024-05-20 10:13:42 +08:00
raiden00pl
9d768498ce sensors/bh1749nuc_uorb.c: add sensor reset 2024-05-20 10:13:42 +08:00
Rodrigo Sim
29775f824b drivers/sensors/Kconfig: Fix HC-SR04 configuration
Signed-off-by: Rodrigo Sim rcsim10@gmail.com
2024-05-19 10:21:23 -03:00
simbit18
792b99473c fix nxstyle
corrected comments in C89 style
2024-05-09 23:44:40 +08:00
simbit18
7e30d38558 drivers/sensors/Kconfig: Added if SENSORS_BME680 for common dependency
sensor BME680: Added if SENSORS_BME680
2024-04-30 01:48:53 +08:00
raiden00pl
6621748fe8 sensors/bmi270_uorb.c: move init sequence to register function
otherwise default accel and gyro scale configured during registration is cleared
2024-04-28 21:31:39 +08:00
raiden00pl
322551b13b sensors/adxl372_uorb: wait for data ready in thread 2024-04-28 13:21:54 +08:00
raiden00pl
a34007b81f sensors/bmi270_uorb.c: fix condition for sensor stop 2024-04-28 13:21:54 +08:00
raiden00pl
1985dcd192 drivers/adxl362_uorb: various fixes
- fix compilation for fetch interface
- for data ready in thread
- add soft reset
2024-04-28 13:21:54 +08:00
raiden00pl
7a789d0775 sensors/bmm150_uorb.c: fix compilation for poll interface 2024-04-28 13:21:54 +08:00
raiden00pl
0f56d1df16 sensors/bh1749nuc_uorb.c: fix compilation when poll interface is disabled 2024-04-28 13:21:54 +08:00
raiden00pl
41803a0c20 sensors/bh1749nuc: add support for the new sensor framework
bh1749nuc can be used with the new sensor framework
2024-04-21 14:48:28 -03:00
raiden00pl
5af805b2ef sensors/bmi270: add support for the new sensor framework
bmi270 can be used with the new sensor framework
2024-04-21 19:06:18 +08:00
raiden00pl
3d765616ea sensors/adxl372: add support for the new sensor framework
adxl372 can be used with the new sensor framework
2024-04-21 18:57:33 +08:00
raiden00pl
db7c8be61f sensors: add support for bmm150 magnetometer
add support for Bosch BMM150 Magnetometer
2024-04-20 16:20:43 -03:00
raiden00pl
ebcf25b2f6 sensors: add support for adxl362 accelerometer
add support for Analog Devices ADXL362 accelerometer
2024-04-20 11:47:50 -03:00
raiden00pl
8bf6b17cc0 sensors/bmi270: fix accel and gyro data position
accel registers are DATA_8 to DATA_13
gyro registers are DATA_14 to DATA_19
2024-03-14 21:16:46 -03:00
raiden00pl
79e8aa5e21 sensors: add uorb support for lsm9ds1 2024-03-09 11:53:57 +08:00
chao an
0902231deb drivers/sensors: fix comments typo
Signed-off-by: chao an <anchao@lixiang.com>
2024-03-05 22:25:28 +08:00
chao an
6d50274ebe nuttx/list: rename container_of to list_container_of from public header
Use private naming to avoid conflicts with user applications

In file included from libuv/src/unix/internal.h:25,
                 from libuv/src/unix/udp.c:23:
libuv/src/uv-common.h:57: warning: "container_of" redefined
   57 | #define container_of(ptr, type, member) \
      |
In file included from nuttx/include/nuttx/list.h:47,
                 from nuttx/include/nuttx/tls.h:40,
                 from nuttx/include/nuttx/sched.h:48,
                 from nuttx/include/nuttx/arch.h:87,
                 from nuttx/include/nuttx/userspace.h:35,
                 from nuttx/include/nuttx/mm/mm.h:30,
                 from nuttx/include/nuttx/kmalloc.h:34,
                 from nuttx/include/nuttx/lib/lib.h:31,
                 from nuttx/include/stdio.h:35,
                 from apps/system/libuv/libuv/include/uv.h:59,
                 from libuv/src/unix/udp.c:22:
nuttx/include/nuttx/nuttx.h:48: note: this is the location of the previous definition
   48 | #define container_of(ptr, type, member) \
      |

Signed-off-by: chao an <anchao@lixiang.com>
2024-02-29 19:44:54 +08:00