You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/08/15 07:49:40 UTC

[incubator-nuttx-apps] branch master updated (06754940c -> 79e4c6676)

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

pkarashchenko pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


    from 06754940c dhcpd: fix build warning
     new 491f549d1 fix: sensor: add sensor type of cap
     new 3021b8d11 testing/sensortest: Add FAR for pointer type
     new 79e4c6676 testing/sensortest: Keep g_sensor_info in order

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 testing/sensortest/sensortest.c | 81 ++++++++++++++++++++++++-----------------
 1 file changed, 47 insertions(+), 34 deletions(-)


[incubator-nuttx-apps] 02/03: testing/sensortest: Add FAR for pointer type

Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 3021b8d11e988dccf1d2f4614a352eeeff5a6978
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Aug 14 10:41:46 2022 +0800

    testing/sensortest: Add FAR for pointer type
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 testing/sensortest/sensortest.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/testing/sensortest/sensortest.c b/testing/sensortest/sensortest.c
index 6c9d5979b..e762e9303 100644
--- a/testing/sensortest/sensortest.c
+++ b/testing/sensortest/sensortest.c
@@ -45,6 +45,7 @@
  ****************************************************************************/
 
 typedef void (*data_print)(FAR const char *buffer, FAR const char *name);
+
 struct sensor_info
 {
   data_print     print;
@@ -117,7 +118,7 @@ static const struct sensor_info g_sensor_info[] =
 
 static void print_vec3(const char *buffer, const char *name)
 {
-  struct sensor_accel *event = (struct sensor_accel *)buffer;
+  FAR struct sensor_accel *event = (FAR struct sensor_accel *)buffer;
   printf("%s: timestamp:%" PRIu64 " x:%.2f y:%.2f z:%.2f, "
          "temperature:%.2f\n",
          name, event->timestamp, event->x, event->y,
@@ -126,42 +127,42 @@ static void print_vec3(const char *buffer, const char *name)
 
 static void print_valb(const char *buffer, const char *name)
 {
-  struct sensor_hall *event = (struct sensor_hall *)buffer;
+  FAR struct sensor_hall *event = (FAR struct sensor_hall *)buffer;
   printf("%s: timestamp:%" PRIu64 " value:%d\n",
          name, event->timestamp, event->hall);
 }
 
 static void print_vali2(const char *buffer, const char *name)
 {
-  struct sensor_ots *event = (struct sensor_ots *)buffer;
+  FAR struct sensor_ots *event = (FAR struct sensor_ots *)buffer;
   printf("%s: timestamp:%" PRIu64 " value1:% " PRIi32 " value2:% " PRIi32
          "\n", name, event->timestamp, event->x, event->y);
 }
 
 static void print_valf(const char *buffer, const char *name)
 {
-  struct sensor_prox *event = (struct sensor_prox *)buffer;
+  FAR struct sensor_prox *event = (FAR struct sensor_prox *)buffer;
   printf("%s: timestamp:%" PRIu64 " value:%.2f\n",
          name, event->timestamp, event->proximity);
 }
 
 static void print_valf2(const char *buffer, const char *name)
 {
-  struct sensor_baro *event = (struct sensor_baro *)buffer;
+  FAR struct sensor_baro *event = (FAR struct sensor_baro *)buffer;
   printf("%s: timestamp:%" PRIu64 " value1:%.2f value2:%.2f\n",
          name, event->timestamp, event->pressure, event->temperature);
 }
 
 static void print_valf3(const char *buffer, const char *name)
 {
-  struct sensor_rgb *event = (struct sensor_rgb *)buffer;
+  FAR struct sensor_rgb *event = (FAR struct sensor_rgb *)buffer;
   printf("%s: timestamp:%" PRIu64 " value1:%.2f value2:%.2f, value3:%.2f\n",
          name, event->timestamp, event->r, event->g, event->b);
 }
 
 static void print_ppgd(const char *buffer, const char *name)
 {
-  struct sensor_ppgd *event = (struct sensor_ppgd *)buffer;
+  FAR struct sensor_ppgd *event = (FAR struct sensor_ppgd *)buffer;
   printf("%s: timestamp:%" PRIu64 " ppg1:%" PRIu32 " ppg2:%" PRIu32 " "
          "current:%" PRIu32 " gain1:%" PRIu16 " gain2:%" PRIu16 "\n",
          name, event->timestamp, event->ppg[0], event->ppg[1],
@@ -170,7 +171,7 @@ static void print_ppgd(const char *buffer, const char *name)
 
 static void print_ppgq(const char *buffer, const char *name)
 {
-  struct sensor_ppgq *event = (struct sensor_ppgq *)buffer;
+  FAR struct sensor_ppgq *event = (FAR struct sensor_ppgq *)buffer;
   printf("%s: timestamp:%" PRIu64 " ppg1:%" PRIu32 " ppg2:%" PRIu32 " "
          "ppg3:%" PRIu32 " ppg4:%" PRIu32 " current:%" PRIu32 " "
          "gain1:%" PRIu16 " gain2:%" PRIu16 " gain3:%" PRIu16 " "
@@ -182,7 +183,7 @@ static void print_ppgq(const char *buffer, const char *name)
 
 static void print_cap(FAR const char *buffer, FAR const char *name)
 {
-  struct sensor_cap *event = (struct sensor_cap *)buffer;
+  FAR struct sensor_cap *event = (FAR struct sensor_cap *)buffer;
   printf("%s: timestamp:%" PRIu64 " status:%" PRIu32 " "
          "rawdata0:%" PRIu32 " rawdata1:%" PRIu32 " rawdata2:%" PRIu32 " "
          "rawdata3:%" PRIu32 "\n",
@@ -192,7 +193,7 @@ static void print_cap(FAR const char *buffer, FAR const char *name)
 
 static void print_gps(const char *buffer, const char *name)
 {
-  struct sensor_gps *event = (struct sensor_gps *)buffer;
+  FAR struct sensor_gps *event = (FAR struct sensor_gps *)buffer;
 
   printf("%s: timestamp:%" PRIu64 " time_utc: %" PRIu64 " latitude: %f "
          "longitude: %f altitude: %f altitude_ellipsoid: %f eph: %f epv: %f "
@@ -206,8 +207,8 @@ static void print_gps(const char *buffer, const char *name)
 
 static void print_gps_satellite(FAR const char *buffer, FAR const char *name)
 {
-  FAR struct sensor_gps_satellite *event =
-        (struct sensor_gps_satellite *)buffer;
+  FAR FAR struct sensor_gps_satellite *event =
+        (FAR struct sensor_gps_satellite *)buffer;
 
   printf("%s: timestamp: %" PRIu64 " count: %" PRIu32
          " satellites: %" PRIu32 "\n",


[incubator-nuttx-apps] 01/03: fix: sensor: add sensor type of cap

Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 491f549d1cc4541d4ff80ec448535066d36a993d
Author: xiatian6 <xi...@xiaomi.com>
AuthorDate: Wed Mar 2 16:22:16 2022 +0800

    fix: sensor: add sensor type of cap
    
    Increase the type of cap sensor, including
    raw data and detection status.
    
    Signed-off-by: xiatian6 <xi...@xiaomi.com>
---
 testing/sensortest/sensortest.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/testing/sensortest/sensortest.c b/testing/sensortest/sensortest.c
index 2a99cfb89..6c9d5979b 100644
--- a/testing/sensortest/sensortest.c
+++ b/testing/sensortest/sensortest.c
@@ -64,6 +64,7 @@ static void print_valb(FAR const char *buffer, FAR const char *name);
 static void print_vali2(FAR const char *buffer, FAR const char *name);
 static void print_ppgd(FAR const char *buffer, FAR const char *name);
 static void print_ppgq(FAR const char *buffer, FAR const char *name);
+static void print_cap(FAR const char *buffer, FAR const char *name);
 static void print_gps(FAR const char *buffer, FAR const char *name);
 static void print_gps_satellite(FAR const char *buffer,
                                 FAR const char *name);
@@ -105,6 +106,7 @@ static const struct sensor_info g_sensor_info[] =
   {print_ppgq,  sizeof(struct sensor_ppgq),  "ppgq"},
   {print_valf2, sizeof(struct sensor_impd),  "impd"},
   {print_vali2, sizeof(struct sensor_ots),   "ots"},
+  {print_cap,   sizeof(struct sensor_cap),   "cap"},
   {print_gps_satellite,  sizeof(struct sensor_gps_satellite),
                                               "gps_satellite"}
 };
@@ -178,6 +180,16 @@ static void print_ppgq(const char *buffer, const char *name)
          event->gain[2], event->gain[3]);
 }
 
+static void print_cap(FAR const char *buffer, FAR const char *name)
+{
+  struct sensor_cap *event = (struct sensor_cap *)buffer;
+  printf("%s: timestamp:%" PRIu64 " status:%" PRIu32 " "
+         "rawdata0:%" PRIu32 " rawdata1:%" PRIu32 " rawdata2:%" PRIu32 " "
+         "rawdata3:%" PRIu32 "\n",
+         name, event->timestamp, event->status, event->rawdata[0],
+         event->rawdata[1], event->rawdata[2], event->rawdata[3]);
+}
+
 static void print_gps(const char *buffer, const char *name)
 {
   struct sensor_gps *event = (struct sensor_gps *)buffer;


[incubator-nuttx-apps] 03/03: testing/sensortest: Keep g_sensor_info in order

Posted by pk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git

commit 79e4c667640f04f498fe18c36c68b79dab21c8e7
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Aug 14 10:47:44 2022 +0800

    testing/sensortest: Keep g_sensor_info in order
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 testing/sensortest/sensortest.c | 48 ++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/testing/sensortest/sensortest.c b/testing/sensortest/sensortest.c
index e762e9303..4a4b27f3a 100644
--- a/testing/sensortest/sensortest.c
+++ b/testing/sensortest/sensortest.c
@@ -79,37 +79,37 @@ static bool g_should_exit = false;
 static const struct sensor_info g_sensor_info[] =
 {
   {print_vec3,  sizeof(struct sensor_accel), "accel"},
-  {print_vec3,  sizeof(struct sensor_mag),   "mag"},
-  {print_vec3,  sizeof(struct sensor_gyro),  "gyro"},
   {print_valf2, sizeof(struct sensor_baro),  "baro"},
-  {print_valf,  sizeof(struct sensor_light), "light"},
-  {print_valf,  sizeof(struct sensor_prox),  "prox"},
-  {print_valf,  sizeof(struct sensor_humi),  "humi"},
-  {print_valf,  sizeof(struct sensor_temp),  "temp"},
-  {print_valf3, sizeof(struct sensor_rgb),   "rgb"},
+  {print_cap,   sizeof(struct sensor_cap),   "cap"},
+  {print_valf,  sizeof(struct sensor_co2),   "co2"},
+  {print_valf,  sizeof(struct sensor_dust),  "dust"},
+  {print_valf,  sizeof(struct sensor_ecg),   "ecg"},
+  {print_gps,   sizeof(struct sensor_gps),   "gps"},
+  {print_gps_satellite,
+        sizeof(struct sensor_gps_satellite), "gps_satellite"},
+  {print_vec3,  sizeof(struct sensor_gyro),  "gyro"},
   {print_valb,  sizeof(struct sensor_hall),  "hall"},
+  {print_valf,  sizeof(struct sensor_hbeat), "hbeat"},
+  {print_valf,  sizeof(struct sensor_hcho),  "hcho"},
+  {print_valf,  sizeof(struct sensor_hrate), "hrate"},
+  {print_valf,  sizeof(struct sensor_humi),  "humi"},
+  {print_valf2, sizeof(struct sensor_impd),  "impd"},
   {print_valf,  sizeof(struct sensor_ir),    "ir"},
-  {print_gps,   sizeof(struct sensor_gps),   "gps"},
-  {print_valf,  sizeof(struct sensor_uv),    "uv"},
+  {print_valf,  sizeof(struct sensor_light), "light"},
+  {print_vec3,  sizeof(struct sensor_mag),   "mag"},
   {print_valf,  sizeof(struct sensor_noise), "noise"},
-  {print_valf,  sizeof(struct sensor_pm25),  "pm25"},
-  {print_valf,  sizeof(struct sensor_pm1p0), "pm1p0"},
-  {print_valf,  sizeof(struct sensor_pm10),  "pm10"},
-  {print_valf,  sizeof(struct sensor_co2),   "co2"},
-  {print_valf,  sizeof(struct sensor_hcho),  "hcho"},
-  {print_valf,  sizeof(struct sensor_tvoc),  "tvoc"},
+  {print_vali2, sizeof(struct sensor_ots),   "ots"},
   {print_valf,  sizeof(struct sensor_ph),    "ph"},
-  {print_valf,  sizeof(struct sensor_dust),  "dust"},
-  {print_valf,  sizeof(struct sensor_hrate), "hrate"},
-  {print_valf,  sizeof(struct sensor_hbeat), "hbeat"},
-  {print_valf,  sizeof(struct sensor_ecg),   "ecg"},
+  {print_valf,  sizeof(struct sensor_pm10),  "pm10"},
+  {print_valf,  sizeof(struct sensor_pm1p0), "pm1p0"},
+  {print_valf,  sizeof(struct sensor_pm25),  "pm25"},
   {print_ppgd,  sizeof(struct sensor_ppgd),  "ppgd"},
   {print_ppgq,  sizeof(struct sensor_ppgq),  "ppgq"},
-  {print_valf2, sizeof(struct sensor_impd),  "impd"},
-  {print_vali2, sizeof(struct sensor_ots),   "ots"},
-  {print_cap,   sizeof(struct sensor_cap),   "cap"},
-  {print_gps_satellite,  sizeof(struct sensor_gps_satellite),
-                                              "gps_satellite"}
+  {print_valf,  sizeof(struct sensor_prox),  "prox"},
+  {print_valf3, sizeof(struct sensor_rgb),   "rgb"},
+  {print_valf,  sizeof(struct sensor_temp),  "temp"},
+  {print_valf,  sizeof(struct sensor_tvoc),  "tvoc"},
+  {print_valf,  sizeof(struct sensor_uv),    "uv"}
 };
 
 /****************************************************************************