modify sensor framework kconfig function

it  is  OK
This commit is contained in:
xuedongliang 2021-09-09 16:26:48 +08:00
commit 55dc35f2de
23 changed files with 85 additions and 111 deletions

View File

@ -49,7 +49,7 @@ static int AppInitDesc(struct InitDesc sub_desc[])
static struct InitDesc framework[] =
{
#ifdef SUPPORT_SENSOR_FRAMEWORK
{ "perception_framework", SensorFrameworkInit },
{ "sensor_framework", SensorFrameworkInit },
#endif
#ifdef SUPPORT_CONNECTION_FRAMEWORK
@ -59,13 +59,13 @@ static struct InitDesc framework[] =
{ "NULL", NULL },
};
static struct InitDesc perception_desc[] =
static struct InitDesc sensor_desc[] =
{
#ifdef PERCEPTION_D124
#ifdef SENSOR_DEVICE_ZG09
{ "d124_voice", D124VoiceInit },
#endif
#ifdef PERCEPTION_HS300X
#ifdef SENSOR_DEVICE_HS300X
#ifdef SENSOR_QUANTITY_HS300X_TEMPERATURE
{ "hs300x_temperature", Hs300xTemperatureInit },
#endif
@ -74,13 +74,13 @@ static struct InitDesc perception_desc[] =
#endif
#endif
#ifdef PERCEPTION_PS5308
#ifdef SENSOR_PS5308
#ifdef SENSOR_QUANTITY_PS5308_PM1_0
{ "ps5308_pm1_0", Ps5308Pm1_0Init },
#endif
#endif
#ifdef PERCEPTION_ZG09
#ifdef SENSOR_ZG09
{ "zg09_co2", Zg09Co2Init },
#endif
@ -99,24 +99,24 @@ static struct InitDesc connection_desc[] =
};
/**
* This function will init perception framework and all sub perception sensors
* This function will init sensor framework and all sub sensors
* @param sub_desc framework
*
*/
static int PerceptionFrameworkInit(struct InitDesc sub_desc[])
static int SensorDeviceFrameworkInit(struct InitDesc sub_desc[])
{
int i = 0;
int ret = 0;
for ( i = 0; sub_desc[i].fn != NULL; i++ ) {
if (0 == strncmp(sub_desc[i].fn_name, "perception_framework", strlen("perception_framework"))) {
if (0 == strncmp(sub_desc[i].fn_name, "sensor_framework", strlen("sensor_framework"))) {
ret = sub_desc[i].fn();
break;
}
}
if (0 == ret) {
printf("initialize perception_framework success.\n");
AppInitDesc(perception_desc);
printf("initialize sensor_framework success.\n");
AppInitDesc(sensor_desc);
}
return ret;
@ -127,7 +127,7 @@ static int PerceptionFrameworkInit(struct InitDesc sub_desc[])
* @param sub_desc framework
*
*/
static int ConnectionFrameworkInit(struct InitDesc sub_desc[])
static int ConnectionDeviceFrameworkInit(struct InitDesc sub_desc[])
{
int i = 0;
int ret = 0;
@ -153,11 +153,11 @@ static int ConnectionFrameworkInit(struct InitDesc sub_desc[])
int FrameworkInit()
{
#ifdef SUPPORT_SENSOR_FRAMEWORK
PerceptionFrameworkInit(framework);
SensorDeviceFrameworkInit(framework);
#endif
#ifdef SUPPORT_CONNECTION_FRAMEWORK
ConnectionFrameworkInit(framework);
ConnectionDeviceFrameworkInit(framework);
#endif
return 0;

View File

@ -3,67 +3,56 @@ menu "sensor app"
menuconfig APPLICATION_SENSOR
bool "Using sensor apps"
default n
select PERCEPTION_SENSORDEVICE
if APPLICATION_SENSOR
menuconfig APPLICATION_SENSOR_CO2
bool "Using sensor CO2 apps"
default n
select PERCEPTION_CO2
if APPLICATION_SENSOR_CO2
config APPLICATION_SENSOR_CO2_ZG09
bool "Using sensor ZG09 apps"
default n
select PERCEPTION_ZG09
endif
menuconfig APPLICATION_SENSOR_PM1_0
bool "Using sensor PM1.0 apps"
default n
select PERCEPTION_PM
if APPLICATION_SENSOR_PM1_0
config APPLICATION_SENSOR_PM1_0_PS5308
bool "Using sensor PS5308 apps"
default n
select PERCEPTION_PS5308
endif
menuconfig APPLICATION_SENSOR_VOICE
bool "Using sensor voice apps"
default n
select PERCEPTION_VOICE
if APPLICATION_SENSOR_VOICE
config APPLICATION_SENSOR_VOICE_D124
bool "Using sensor D124 apps"
default n
select PERCEPTION_D124
endif
menuconfig APPLICATION_SENSOR_HUMIDITY
bool "Using sensor humidity apps"
default n
select PERCEPTION_HUMIDITY
if APPLICATION_SENSOR_HUMIDITY
config APPLICATION_SENSOR_HUMIDITY_HS300X
bool "Using sensor HS300x apps"
default n
select PERCEPTION_HS300X
endif
menuconfig APPLICATION_SENSOR_TEMPERATURE
bool "Using sensor temperature apps"
default n
select PERCEPTION_TEMPERATURE
if APPLICATION_SENSOR_TEMPERATURE
config APPLICATION_SENSOR_TEMPERATURE_HS300X
bool "Using sensor HS300x apps"
default n
select PERCEPTION_HS300X
endif
endif

View File

@ -13,14 +13,25 @@ config SENSOR_ZG09
default "co2_1"
if ADD_XIUOS_FETURES
config SENSOR_ZG09_DRIVER_EXTUART
bool "Using extra uart to support zg09"
default y
config SENSOR_DEVICE_ZG09_DEV
string "zg09 device name"
string "zg09 device uart path"
default "/dev/uart2_dev2"
depends on !SENSOR_ZG09_DRIVER_EXTUART
if SENSOR_ZG09_DRIVER_EXTUART
config SENSOR_DEVICE_ZG09_DEV
string "zg09 device extra uart path"
default "/dev/extuart_dev4"
config SENSOR_DEVICE_ZG09_DEV_EXT_PORT
int "if ZG09 device using extuart, choose port"
default "4"
endif
endif
if ADD_NUTTX_FETURES

View File

@ -12,7 +12,7 @@
/**
* @file zg09.c
* @brief ZG09 CO2 driver base perception
* @brief ZG09 CO2 driver base sensor
* @version 1.0
* @author AIIT XUOS Lab
* @date 2021.04.22
@ -40,7 +40,7 @@ static struct SensorProductInfo info =
*/
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
int result = 1;
int result = 0;
sdev->fd = PrivOpen(SENSOR_DEVICE_ZG09_DEV, O_RDWR);
@ -52,8 +52,10 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
cfg.serial_parity_mode = PARITY_NONE;
cfg.serial_bit_order = 0;
cfg.serial_invert_mode = 0;
#ifdef SENSOR_ZG09_DRIVER_EXTUART
cfg.ext_uart_no = SENSOR_DEVICE_ZG09_DEV_EXT_PORT;
cfg.port_configure = PORT_CFG_INIT;
#endif
struct PrivIoctlCfg ioctl_cfg;
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
@ -115,7 +117,7 @@ static int SensorDeviceIoctl(struct SensorDevice *sdev, int cmd)
sdev->done->read(sdev, 8);
if (memcmp(sdev->buffer, zg09_set_passive, 8) == 0) {
sdev->status = SENSOR_DEVICE_PASSIVE;
return 1;
return 0;
}
break;
@ -124,7 +126,7 @@ static int SensorDeviceIoctl(struct SensorDevice *sdev, int cmd)
sdev->done->read(sdev, 8);
if (memcmp(sdev->buffer, zg09_set_active, 8) == 0) {
sdev->status = SENSOR_DEVICE_ACTIVE;
return 1;
return 0;
}
break;

View File

@ -1,9 +1,9 @@
config PERCEPTION_HS300X
config SENSOR_HS300X
bool "Using HS300x"
default n
if PERCEPTION_HS300X
if SENSOR_HS300X
config SENSOR_DEVICE_HS300X
string "HS300x sensor name"
default "hs300x_1"

View File

@ -12,7 +12,7 @@
/**
* @file hs300x_humi.c
* @brief HS300x humidity driver base perception
* @brief HS300x humidity driver base sensor
* @version 1.0
* @author AIIT XUOS Lab
* @date 2021.04.22
@ -38,7 +38,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
{
sdev->fd = PrivOpen(SENSOR_DEVICE_HS300X_DEV, O_RDWR);
return 1;
return 0;
}
/**
@ -57,7 +57,7 @@ static int SensorDeviceRead(struct SensorDevice *sdev, size_t len)
if (PrivRead(sdev->fd, sdev->buffer, len) != 1)
return -1;
return 1;
return 0;
}
static struct SensorDone done =

View File

@ -21,14 +21,25 @@ config SENSOR_PS5308
default "pm10_1"
if ADD_XIUOS_FETURES
config SENSOR_PS5308_DRIVER_EXTUART
bool "Using extra uart to support PS5308"
default y
config SENSOR_DEVICE_PS5308_DEV
string "PS5308 device name"
default "/dev/uart2_dev2"
depends on !SENSOR_PS5308_DRIVER_EXTUART
if SENSOR_PS5308_DRIVER_EXTUART
config SENSOR_DEVICE_PS5308_DEV
string "PS5308 device extra uart path"
default "/dev/extuart_dev4"
config SENSOR_DEVICE_PS5308_DEV_EXT_PORT
int "if PS5308 device using extuart, choose port"
default "4"
endif
endif
if ADD_NUTTX_FETURES

View File

@ -12,7 +12,7 @@
/**
* @file ps5308.c
* @brief PS5308 PM1.0, PM2.5, PM10, driver base perception
* @brief PS5308 PM1.0, PM2.5, PM10, driver base sensor
* @version 1.0
* @author AIIT XUOS Lab
* @date 2021.04.22
@ -52,7 +52,7 @@ static void ReadTask(struct SensorDevice *sdev)
*/
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
int result = 1;
int result = 0;
buff_lock = UserMutexCreate();
@ -66,8 +66,10 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
cfg.serial_parity_mode = PARITY_NONE;
cfg.serial_bit_order = 0;
cfg.serial_invert_mode = 0;
#ifdef SENSOR_PS5308_DRIVER_EXTUART
cfg.ext_uart_no = SENSOR_DEVICE_PS5308_DEV_EXT_PORT;
cfg.port_configure = PORT_CFG_INIT;
#endif
result = ioctl(sdev->fd, OPE_INT, &cfg);
@ -95,7 +97,7 @@ static int SensorDeviceClose(struct SensorDevice *sdev)
{
UserTaskDelete(active_task_id);
UserMutexDelete(buff_lock);
return 1;
return 0;
}
/**

View File

@ -33,7 +33,7 @@ static pthread_mutex_t quant_table_lock;
static pthread_mutex_t sensor_device_list_lock;
/**
* @description: Init perception framework
* @description: Init sensor framework
* @return 0
*/
int SensorFrameworkInit(void)

View File

@ -12,7 +12,7 @@
/**
* @file hs300x_temp.c
* @brief HS300x temperature driver base perception
* @brief HS300x temperature driver base sensor
* @version 1.0
* @author AIIT XUOS Lab
* @date 2021.04.22
@ -38,7 +38,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
{
sdev->fd = PrivOpen(SENSOR_DEVICE_HS300X_DEV, O_RDWR);
return 1;
return 0;
}
/**
@ -57,7 +57,7 @@ static int SensorDeviceRead(struct SensorDevice *sdev, size_t len)
if (PrivRead(sdev->fd, sdev->buffer, len) != 1)
return -1;
return 1;
return 0;
}
static struct SensorDone done =

View File

@ -13,14 +13,25 @@ config SENSOR_D124
default "voice_1"
if ADD_XIUOS_FETURES
config SENSOR_D124_DRIVER_EXTUART
bool "Using extra uart to support D124"
default y
config SENSOR_DEVICE_D124_DEV
string "D124 device name"
default "/dev/uart2_dev2"
depends on !SENSOR_D124_DRIVER_EXTUART
if SENSOR_D124_DRIVER_EXTUART
config SENSOR_DEVICE_D124_DEV
string "D124 device extra uart path"
default "/dev/extuart_dev4"
config SENSOR_DEVICE_D124_DEV_EXT_PORT
int "if D124 device using extuart, choose port"
default "4"
endif
endif
if ADD_NUTTX_FETURES

View File

@ -12,7 +12,7 @@
/**
* @file d124.c
* @brief D124 voice driver base perception
* @brief D124 voice driver base sensor
* @version 1.0
* @author AIIT XUOS Lab
* @date 2021.04.22
@ -52,7 +52,7 @@ static void ReadTask(struct SensorDevice *sdev)
*/
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
int result = 1;
int result = 0;
buff_lock = UserMutexCreate();
@ -66,8 +66,10 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
cfg.serial_parity_mode = PARITY_NONE;
cfg.serial_bit_order = 0;
cfg.serial_invert_mode = 0;
#ifdef SENSOR_D124_DRIVER_EXTUART
cfg.ext_uart_no = SENSOR_DEVICE_D124_DEV_EXT_PORT;
cfg.port_configure = PORT_CFG_INIT;
#endif
struct PrivIoctlCfg ioctl_cfg;
ioctl_cfg.ioctl_driver_type = SERIAL_TYPE;
@ -98,7 +100,7 @@ static int SensorDeviceClose(struct SensorDevice *sdev)
{
UserTaskDelete(active_task_id);
UserMutexDelete(buff_lock);
return 1;
return 0;
}
/**

View File

@ -187,11 +187,6 @@ CONFIG_FS_VFS_DEVFS=y
# APP Framework
#
#
# Perception
#
# CONFIG_PERCEPTION_SENSORDEVICE is not set
#
# connection
#

View File

@ -235,11 +235,6 @@ CONFIG_FS_VFS_DEVFS=y
# APP Framework
#
#
# Perception
#
# CONFIG_PERCEPTION_SENSORDEVICE is not set
#
# connection
#

View File

@ -210,11 +210,6 @@ CONFIG_FS_DFS=n
# APP Framework
#
#
# Perception
#
# CONFIG_PERCEPTION_SENSORDEVICE is not set
#
# connection
#

View File

@ -208,11 +208,6 @@ CONFIG_FS_DFS=n
# APP Framework
#
#
# Perception
#
# CONFIG_PERCEPTION_SENSORDEVICE is not set
#
# connection
#

View File

@ -208,11 +208,6 @@ CONFIG_FS_DFS=n
# APP Framework
#
#
# Perception
#
# CONFIG_PERCEPTION_SENSORDEVICE is not set
#
# connection
#

View File

@ -200,11 +200,6 @@ CONFIG_FS_VFS_DEVFS=y
# APP Framework
#
#
# Perception
#
# CONFIG_PERCEPTION_SENSORDEVICE is not set
#
# connection
#

View File

@ -200,11 +200,6 @@ CONFIG_FS_VFS_DEVFS=y
# APP Framework
#
#
# Perception
#
# CONFIG_PERCEPTION_SENSORDEVICE is not set
#
# connection
#

View File

@ -201,11 +201,6 @@ CONFIG_FS_VFS_DEVFS=y
# APP Framework
#
#
# Perception
#
# CONFIG_PERCEPTION_SENSORDEVICE is not set
#
# connection
#

View File

@ -185,11 +185,6 @@ CONFIG_FS_VFS_DEVFS=y
# APP Framework
#
#
# Perception
#
# CONFIG_PERCEPTION_SENSORDEVICE is not set
#
# connection
#

View File

@ -186,11 +186,6 @@ CONFIG_FS_VFS_DEVFS=y
# APP Framework
#
#
# Perception
#
# CONFIG_PERCEPTION_SENSORDEVICE is not set
#
# connection
#

View File

@ -164,10 +164,6 @@ ifeq ($(CONFIG_FS_CH376), y)
KERNELPATHS +=-I$(KERNEL_ROOT)/fs/compatibility_ch376 #
endif
# ifeq ($(CONFIG_PERCEPTION_SENSORDEVICE), y)
# KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/sensor #
# endif
KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/transform_layer/xiuos/user_api/posix_support/include #
KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/sensor #
KERNELPATHS += -I$(KERNEL_ROOT)/../../APP_Framework/Framework/transform_layer/xiuos #