Browse Source

Fix the sensor list issue.

bernard 10 years ago
parent
commit
c26b999360
2 changed files with 16 additions and 6 deletions
  1. 16 3
      components/drivers/sensors/sensor.cpp
  2. 0 3
      components/drivers/sensors/sensor.h

+ 16 - 3
components/drivers/sensors/sensor.cpp

@@ -1,3 +1,17 @@
+/*
+ * File      : sensors.cpp
+ * This file is part of RT-Thread RTOS
+ * COPYRIGHT (C) 2014, RT-Thread Development Team
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rt-thread.org/license/LICENSE
+ *
+ * Change Logs:
+ * Date           Author       Notes
+ * 2014-08-03     Bernard      the first version
+ */
+
 #include <stddef.h>
 #include "sensor.h"
 
@@ -60,7 +74,7 @@ int SensorManager::RegisterSensor(Sensor *sensor)
     RT_ASSERT(sensor != RT_NULL);
 
     /* add sensor into the list */
-    if (self->sensorList = NULL)
+    if (self->sensorList == NULL)
     {
         sensor->prev = sensor->next = sensor;
     }
@@ -113,8 +127,7 @@ Sensor *SensorManager::GetDefaultSensor(int type)
         if (sensor->GetType() == type) return sensor;
 
         sensor = sensor->next;
-    }
-    while (sensor != self->sensorList);
+    }while (sensor != self->sensorList);
 
     return NULL;
 }

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

@@ -34,10 +34,7 @@
 #define SENSORS_H__
 
 #include <rtdevice.h>
-
 #include <stdint.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
 
 /**
  * Handles must be higher than SENSORS_HANDLE_BASE and must be unique.