Fix the sensor list issue.
This commit is contained in:
parent
43e4615075
commit
c26b999360
@ -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 <stddef.h>
|
||||||
#include "sensor.h"
|
#include "sensor.h"
|
||||||
|
|
||||||
@ -60,7 +74,7 @@ int SensorManager::RegisterSensor(Sensor *sensor)
|
|||||||
RT_ASSERT(sensor != RT_NULL);
|
RT_ASSERT(sensor != RT_NULL);
|
||||||
|
|
||||||
/* add sensor into the list */
|
/* add sensor into the list */
|
||||||
if (self->sensorList = NULL)
|
if (self->sensorList == NULL)
|
||||||
{
|
{
|
||||||
sensor->prev = sensor->next = sensor;
|
sensor->prev = sensor->next = sensor;
|
||||||
}
|
}
|
||||||
@ -113,8 +127,7 @@ Sensor *SensorManager::GetDefaultSensor(int type)
|
|||||||
if (sensor->GetType() == type) return sensor;
|
if (sensor->GetType() == type) return sensor;
|
||||||
|
|
||||||
sensor = sensor->next;
|
sensor = sensor->next;
|
||||||
}
|
}while (sensor != self->sensorList);
|
||||||
while (sensor != self->sensorList);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -34,10 +34,7 @@
|
|||||||
#define SENSORS_H__
|
#define SENSORS_H__
|
||||||
|
|
||||||
#include <rtdevice.h>
|
#include <rtdevice.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles must be higher than SENSORS_HANDLE_BASE and must be unique.
|
* Handles must be higher than SENSORS_HANDLE_BASE and must be unique.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user