The BIT macro is widely used in NuttX,
and to achieve a unified strategy,
we have placed the implementation of the BIT macro
in bits.h to simplify code implementation.
Signed-off-by: hujun5 <hujun5@xiaomi.com>
==2787216==ERROR: AddressSanitizer: heap-use-after-free on address 0xf4702448 at pc 0x0136c544 bp 0x9f54d358 sp 0x9f54d348
READ of size 4 at 0xf4702448 thread T0
0 0x136c543 in rpmsg_destroy_ept open-amp/lib/rpmsg/rpmsg.c:357
1 0x1252b29 in sensor_rpmsg_ns_unbind_cb sensors/sensor_rpmsg.c:1216
2 0x1371de5 in rpmsg_virtio_ns_callback open-amp/lib/rpmsg/rpmsg_virtio.c:663
3 0x1371026 in rpmsg_virtio_rx_callback open-amp/lib/rpmsg/rpmsg_virtio.c:583
4 0x137c105 in virtqueue_notification open-amp/lib/virtio/virtqueue.c:711
5 0x1368604 in rproc_virtio_notified open-amp/lib/remoteproc/remoteproc_virtio.c:433
6 0x1363abe in remoteproc_get_notification open-amp/lib/remoteproc/remoteproc.c:10
Signed-off-by: yintao <yintao@xiaomi.com>
convert from body coordinate system to right-hand
coordinate system.
Example:
Compared to the standard coordinate system,
the x-axis and y-axis are interchanged and have opposite directions,
the z-axis remains normal.
body coordinate ----> right-hand coordinate
+x +y
| |
| |
| |
| |
-y<-------. .------>+x
/ /
/ /
/ /
/ /
+z +z
So for the above conversion, using "P3" to represent transformation relationships
The front is 1 0 2, which represents the y x z axis.
The standard order is 0 1 2, so y and x are interchanged.
The following -1 1 1 indicates the direction of the axis.
The standard is 1 1 1. Because the current y-axis is opposite to
the standard x-axis, it is -1.
static const struct sensor_axis_map_s g_remap_tbl[] =
{
{ 0, 1, 2, 1, 1, 1 }, /* P0 */
{ 1, 0, 2, 1, -1, 1 }, /* P1 */
{ 0, 1, 2, -1, -1, 1 }, /* P2 */
{ 1, 0, 2, -1, 1, 1 }, /* P3 */
{ 0, 1, 2, -1, 1, -1 }, /* P4 */
{ 1, 0, 2, -1, -1, -1 }, /* P5 */
{ 0, 1, 2, 1, -1, -1 }, /* P6 */
{ 1, 0, 2, 1, 1, -1 }, /* P7 */
};
you can call the function sensor_remap_vector_raw16 and pass P3 parameters
to perform the conversion.
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Solve the problem that when a user modifies the sampling rate,
the difference between the generation and the mainline generation
may be greater than the own sampling interval.
After this problem occurs, sensor_is_update() will continue to
return true, resulting in a busy loop in the upper-layer application,
so, need update user generation according to mainline generation.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
In sensor_rpmsg_ioctl, when rpmsg_get_tx_payload_buffer is block,
The rptun thread will continue to process rx_buffers from other cores,
So the proxy may be released in sensor_unadv_handler, then if using
the proxy, It causes a crash.
backtrace:
0 0x06007c2e in is_rpmsg_ept_ready (ept=0x5a5a5a5a) at nuttx/include/openamp/rpmsg.h:172
1 0x06013354 in rpmsg_send_nocopy (len=<optimized out>,
data=<optimized out>, ept=<optimized out>) at nuttx/include/openamp/rpmsg.h:521
2 rpmsg_send_nocopy (ept=0x5a5a5a5a, data=data@entry=0x201facf0,
len=len@entry=40) at nuttx/include/openamp/rpmsg.h:512
3 0x06013b34 in sensor_rpmsg_ioctl (dev=dev@entry=0x201b7388,
cmd=538701816, cmd@entry=2690, arg=0, len=len@entry=0,
wait=<error reading variable: dwarf2_find_location_expression:
Corrupted DWARF expression.>) at ../../../drivers/sensors/sensor_rpmsg.c:395
4 0x06013cce in sensor_rpmsg_alloc_proxy (dev=dev@entry=0x201b7388,
ept=ept@entry=0x202073d0, msg=msg@entry=0x201684f0) at ../../../drivers/sensors/sensor_rpmsg.c:498
5 0x06013d12 in sensor_rpmsg_adv_handler (ept=0x202073d0,
data=0x201684f0, len=49, src=<optimized out>, priv=0x202073c8) at ../../../drivers/sensors/sensor_rpmsg.c:905
6 0x0600d45e in sensor_rpmsg_ept_cb (ept=<optimized out>,
data=<optimized out>, len=<optimized out>, src=<optimized out>,
priv=0x202073c8) at ../../../drivers/sensors/sensor_rpmsg.c:1168
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
Create bmi160_base.h, bmi160_base.c bmi160_uorb.c files, the bmi160_base file stores
public function interfaces, and the bmi160_uorb file stores functions related to the
uorb framework. Switch the character interface and UORB interface through the
macro CONFIG_SENSORS_BMI160_UORB.
Signed-off-by: likun17 <likun17@xiaomi.com>
A sensor of this type measures the force on it, and additionally
compares the force with one or more specified thresholds. The sensor
can output the force value directly. Moreover, it's usually applied
as a press key. In that case, when it detects a force greater than
some given threshold, a corresponding event is reported.
Signed-off-by: jinxudong <jinxudong@xiaomi.com>
boards/arm/cxd56xx/drivers/sensors/bmi160_scu.c: fix incorrect comments to the Right of Statements.
drivers/sensors/ak09912.c: fix incorrect function description ak09912_putreg8 and ak09912_getreg8
drivers/sensors/bme680.c: The bme680 driver
sensor.h: Added new type of sensor (Gas) to be used for retrieving the bme680 data
esp32/common/src/esp32_bme680.c: bme680 support on esp32
esp32/esp32-sparrow_kit/esp32_bringup.c: added support for the bme680
esp32/esp32-sparrow-kit/configs/nsh/defconfig: fixed defconfig ci problem
Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>
esp32-sparrow-kit: Fixed defconfig
Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>
Code is now C89 compatible
Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>
Reused already defined sensor data structs by registering every sub-sensor separately
Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>
Implemented suggestions
Signed-off-by: simonatoaca <simona.alexandra2000@gmail.com>
nuttx/drivers/sensors/wtgahrs2.c: In function ‘wtgahrs2_initialize’:
nuttx/drivers/sensors/wtgahrs2.c:545:22: warning: ‘%lx’ directive output may be truncated writing between 1 and 16 bytes into a region of size 14 [-Wformat-truncation=]
545 | snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)rtdata);
| ^~~~~
nuttx/drivers/sensors/wtgahrs2.c:545:25: note: format string is defined here
545 | snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)rtdata);
nuttx/drivers/sensors/wtgahrs2.c:545:22: note: directive argument in the range [1, 18446744073709551615]
545 | snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)rtdata);
| ^~~~~
nuttx/drivers/sensors/wtgahrs2.c:545:3: note: ‘snprintf’ output between 4 and 19 bytes into a destination of size 16
545 | snprintf(arg1, 16, "0x%" PRIxPTR, (uintptr_t)rtdata);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: chao an <anchao@xiaomi.com>