Merge branch 'prepare_for_master' of https://gitlink.org.cn/xuos/xiuos into mqtt
This commit is contained in:
@@ -26,6 +26,7 @@ extern int AdapterEthercatInit(void);
|
||||
extern int AdapterZigbeeInit(void);
|
||||
extern int AdapterLoraInit(void);
|
||||
|
||||
extern int Bmp180AltitudeInit(void);
|
||||
extern int D124VoiceInit(void);
|
||||
extern int Hs300xTemperatureInit(void);
|
||||
extern int Hs300xHumidityInit(void);
|
||||
@@ -83,6 +84,10 @@ static struct InitDesc framework[] =
|
||||
|
||||
static struct InitDesc sensor_desc[] =
|
||||
{
|
||||
#ifdef SENSOR_DEVICE_BMP180
|
||||
{ "bmp180_altitude", Bmp180AltitudeInit},
|
||||
#endif
|
||||
|
||||
#ifdef SENSOR_DEVICE_D124
|
||||
{ "d124_voice", D124VoiceInit },
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@ config KPU_DEV_DRIVER
|
||||
|
||||
config CAMERA_DEV_DRIVER
|
||||
string "Set camera dev path for kpu"
|
||||
default "/dev/ov2640"
|
||||
default "/dev/camera_dev"
|
||||
|
||||
config KPU_LCD_DEV_DRIVER
|
||||
string "Set lcd dev path for kpu"
|
||||
|
||||
@@ -69,12 +69,28 @@ static int SensorDeviceRead(struct SensorDevice *sdev, size_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: Write sensor device
|
||||
* @param sdev - sensor device pointer
|
||||
* @param buf - the buffer of write data
|
||||
* @param len - the length of the write data
|
||||
* @return success: 0 , failure: -1
|
||||
*/
|
||||
static int SensorDeviceWrite(struct SensorDevice *sdev, const void *buf, size_t len)
|
||||
{
|
||||
//Read i2c device data from i2c device address
|
||||
if (PrivWrite(sdev->fd, buf, len) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct SensorDone done =
|
||||
{
|
||||
SensorDeviceOpen,
|
||||
NULL,
|
||||
SensorDeviceRead,
|
||||
NULL,
|
||||
SensorDeviceWrite,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -109,7 +125,8 @@ static int32_t ReadHumidity(struct SensorQuantity *quant)
|
||||
float result = 0.0;
|
||||
if (quant->sdev->done->read != NULL) {
|
||||
if (quant->sdev->status == SENSOR_DEVICE_PASSIVE) {
|
||||
quant->sdev->done->read(quant->sdev, 4);
|
||||
quant->sdev->done->write(quant->sdev, NONE, 0);
|
||||
PrivTaskDelay(50);
|
||||
quant->sdev->done->read(quant->sdev, 4); /* It takes two reads to get the data right */
|
||||
result = ((quant->sdev->buffer[0] << 8 | quant->sdev->buffer[1] ) & 0x3fff) * 100.0 / ( (1 << 14) - 1);
|
||||
|
||||
|
||||
@@ -68,12 +68,28 @@ static int SensorDeviceRead(struct SensorDevice *sdev, size_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: Write sensor device
|
||||
* @param sdev - sensor device pointer
|
||||
* @param buf - the buffer of write data
|
||||
* @param len - the length of the write data
|
||||
* @return success: 0 , failure: -1
|
||||
*/
|
||||
static int SensorDeviceWrite(struct SensorDevice *sdev, const void *buf, size_t len)
|
||||
{
|
||||
//Read i2c device data from i2c device address
|
||||
if (PrivWrite(sdev->fd, buf, len) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct SensorDone done =
|
||||
{
|
||||
SensorDeviceOpen,
|
||||
NULL,
|
||||
SensorDeviceRead,
|
||||
NULL,
|
||||
SensorDeviceWrite,
|
||||
NULL,
|
||||
};
|
||||
|
||||
@@ -108,7 +124,7 @@ static int32_t ReadTemperature(struct SensorQuantity *quant)
|
||||
float result;
|
||||
if (quant->sdev->done->read != NULL) {
|
||||
if (quant->sdev->status == SENSOR_DEVICE_PASSIVE) {
|
||||
quant->sdev->done->read(quant->sdev, 4);
|
||||
quant->sdev->done->write(quant->sdev, NONE, 0);
|
||||
PrivTaskDelay(50);
|
||||
quant->sdev->done->read(quant->sdev, 4); /* It takes two reads to get the data right */
|
||||
result = ((quant->sdev->buffer[2] << 8 | quant->sdev->buffer[3]) >> 2) * 165.0 /( (1 << 14) - 1) - 40.0;
|
||||
|
||||
Reference in New Issue
Block a user