Browse Source

[Sensor] Add two concentration unit ppm & ppb

luhuadong 4 years ago
parent
commit
f2070beb54
2 changed files with 8 additions and 0 deletions
  1. 2 0
      components/drivers/sensors/sensor.h
  2. 6 0
      components/drivers/sensors/sensor_cmd.c

+ 2 - 0
components/drivers/sensors/sensor.h

@@ -82,6 +82,8 @@ extern "C" {
 #define  RT_SENSOR_UNIT_BPM            (11) /* Heart rate              unit: bpm        */
 #define  RT_SENSOR_UNIT_MM             (12) /* Distance                unit: mm         */
 #define  RT_SENSOR_UNIT_MN             (13) /* Force                   unit: mN         */
+#define  RT_SENSOR_UNIT_PPM            (14) /* Concentration           unit: ppm        */
+#define  RT_SENSOR_UNIT_PPB            (15) /* Concentration           unit: ppb        */
 
 /* Sensor communication interface types */
 

+ 6 - 0
components/drivers/sensors/sensor_cmd.c

@@ -384,6 +384,12 @@ static void sensor(int argc, char **argv)
             case RT_SENSOR_UNIT_MN:
                 rt_kprintf("unit      :mN\n");
                 break;
+            case RT_SENSOR_UNIT_PPM:
+                rt_kprintf("unit      :ppm\n");
+                break;
+            case RT_SENSOR_UNIT_PPB:
+                rt_kprintf("unit      :ppb\n");
+                break;
         }
         rt_kprintf("range_max :%d\n", info.range_max);
         rt_kprintf("range_min :%d\n", info.range_min);