merge the latest codes

This commit is contained in:
wlyu
2022-01-24 18:38:03 +08:00
1002 changed files with 317082 additions and 292 deletions
@@ -34,6 +34,11 @@ config SENSOR_AS830
endif
if ADD_NUTTX_FETURES
config SENSOR_DEVICE_AS830_DEV
string "as830 device uart path"
default "/dev/ttyS1"
---help---
If USART1 is selected, then fill in /dev/ttyS1 here.
endif
@@ -0,0 +1,4 @@
############################################################################
# APP_Framework/Framework/sensor/ch4/Make.defs
############################################################################
include $(wildcard $(APPDIR)/../../../APP_Framework/Framework/sensor/ch4/*/Make.defs)
@@ -0,0 +1,6 @@
############################################################################
# APP_Framework/Framework/sensor/ch4/as830/Make.defs
############################################################################
ifneq ($(CONFIG_SENSOR_AS830),)
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Framework/sensor/ch4/as830
endif
@@ -1,3 +1,11 @@
SRC_FILES := as830.c
include $(KERNEL_ROOT)/.config
ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
include $(APPDIR)/Make.defs
CSRCS += as830.c
include $(APPDIR)/Application.mk
endif
include $(KERNEL_ROOT)/compiler.mk
ifeq ($(CONFIG_ADD_XIUOS_FETURES),y)
SRC_FILES := as830.c
include $(KERNEL_ROOT)/compiler.mk
endif
@@ -34,6 +34,18 @@ static struct SensorProductInfo info =
* @param sdev - sensor device pointer
* @return success: 1 , failure: other
*/
#ifdef ADD_NUTTX_FETURES
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
sdev->fd = PrivOpen(SENSOR_DEVICE_AS830_DEV, O_RDWR);
if (sdev->fd < 0) {
printf("open %s error\n", SENSOR_DEVICE_AS830_DEV);
return -1;
}
return sdev->fd;
}
#else
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
int result = 0;
@@ -64,6 +76,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
return result;
}
#endif
/**
* @description: Read sensor device
@@ -34,6 +34,11 @@ config SENSOR_TB600B_WQ_HCHO1OS
endif
if ADD_NUTTX_FETURES
config SENSOR_DEVICE_TB600B_WQ_HCHO1OS_DEV
string "tb600b wq_hcho1os device uart path"
default "/dev/ttyS1"
---help---
If USART1 is selected, then fill in /dev/ttyS1 here.
endif
@@ -0,0 +1,4 @@
############################################################################
# APP_Framework/Framework/sensor/hcho/Make.defs
############################################################################
include $(wildcard $(APPDIR)/../../../APP_Framework/Framework/sensor/hcho/*/Make.defs)
@@ -0,0 +1,6 @@
############################################################################
# APP_Framework/Framework/sensor/hcho/tb600b_wq_hcho1os/Make.defs
############################################################################
ifneq ($(CONFIG_SENSOR_TB600B_WQ_HCHO1OS),)
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Framework/sensor/hcho/tb600b_wq_hcho1os
endif
@@ -1,3 +1,12 @@
SRC_FILES := tb600b_wq_hcho1os.c
include $(KERNEL_ROOT)/.config
include $(KERNEL_ROOT)/compiler.mk
ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
include $(APPDIR)/Make.defs
CSRCS += tb600b_wq_hcho1os.c
include $(APPDIR)/Application.mk
endif
ifeq ($(CONFIG_ADD_XIUOS_FETURES),y)
SRC_FILES := tb600b_wq_hcho1os.c
include $(KERNEL_ROOT)/compiler.mk
endif
@@ -35,6 +35,18 @@ static struct SensorProductInfo info =
* @param sdev - sensor device pointer
* @return success: 1 , failure: other
*/
#ifdef ADD_NUTTX_FETURES
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
sdev->fd = PrivOpen(SENSOR_DEVICE_TB600B_WQ_HCHO1OS_DEV, O_RDWR);
if (sdev->fd < 0) {
printf("open %s error\n", SENSOR_DEVICE_TB600B_WQ_HCHO1OS_DEV);
return -1;
}
return sdev->fd;
}
#else
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
int result = 0;
@@ -65,6 +77,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
return result;
}
#endif
/**
* @description: Read sensor device
@@ -34,6 +34,11 @@ config SENSOR_TB600B_IAQ10
endif
if ADD_NUTTX_FETURES
config SENSOR_DEVICE_TB600B_IAQ10_DEV
string "tb600b iaq10 device uart path"
default "/dev/ttyS1"
---help---
If USART1 is selected, then fill in /dev/ttyS1 here.
endif
@@ -0,0 +1,4 @@
############################################################################
# APP_Framework/Framework/sensor/iaq/Make.defs
############################################################################
include $(wildcard $(APPDIR)/../../../APP_Framework/Framework/sensor/iaq/*/Make.defs)
@@ -0,0 +1,6 @@
############################################################################
# APP_Framework/Framework/sensor/iaq/tb600b_iaq10/Make.defs
############################################################################
ifneq ($(CONFIG_SENSOR_TB600B_IAQ10),)
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Framework/sensor/iaq/tb600b_iaq10
endif
@@ -1,3 +1,12 @@
SRC_FILES := tb600b_iaq10.c
include $(KERNEL_ROOT)/.config
ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
include $(APPDIR)/Make.defs
CSRCS += tb600b_iaq10.c
include $(APPDIR)/Application.mk
endif
include $(KERNEL_ROOT)/compiler.mk
ifeq ($(CONFIG_ADD_XIUOS_FETURES),y)
SRC_FILES := tb600b_iaq10.c
include $(KERNEL_ROOT)/compiler.mk
endif
@@ -43,6 +43,17 @@ static struct SensorProductInfo info =
* @param sdev - sensor device pointer
* @return success: 1 , failure: other
*/
#ifdef ADD_NUTTX_FETURES
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
sdev->fd = PrivOpen(SENSOR_DEVICE_TB600B_IAQ10_DEV, O_RDWR);
if (sdev->fd < 0) {
printf("open %s error\n", SENSOR_DEVICE_TB600B_IAQ10_DEV);
}
return sdev->fd;
}
#else
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
int result = 0;
@@ -73,6 +84,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
return result;
}
#endif
/**
* @description: Read sensor device
@@ -34,6 +34,11 @@ config SENSOR_TB600B_TVOC10
endif
if ADD_NUTTX_FETURES
config SENSOR_DEVICE_TB600B_TVOC10_DEV
string "tb600b tvoc10 device uart path"
default "/dev/ttyS1"
---help---
If USART1 is selected, then fill in /dev/ttyS1 here.
endif
@@ -0,0 +1,4 @@
############################################################################
# APP_Framework/Framework/sensor/tvoc/Make.defs
############################################################################
include $(wildcard $(APPDIR)/../../../APP_Framework/Framework/sensor/tvoc/*/Make.defs)
@@ -0,0 +1,6 @@
############################################################################
# APP_Framework/Framework/sensor/tvoc/tb600b_tvoc10/Make.defs
############################################################################
ifneq ($(CONFIG_SENSOR_TB600B_TVOC10),)
CONFIGURED_APPS += $(APPDIR)/../../../APP_Framework/Framework/sensor/tvoc/tb600b_tvoc10
endif
@@ -1,3 +1,12 @@
SRC_FILES := tb600b_tvoc10.c
include $(KERNEL_ROOT)/.config
include $(KERNEL_ROOT)/compiler.mk
ifeq ($(CONFIG_ADD_NUTTX_FETURES),y)
include $(APPDIR)/Make.defs
CSRCS += tb600b_tvoc10.c
include $(APPDIR)/Application.mk
endif
ifeq ($(CONFIG_ADD_XIUOS_FETURES),y)
SRC_FILES := tb600b_tvoc10.c
include $(KERNEL_ROOT)/compiler.mk
endif
@@ -35,6 +35,18 @@ static struct SensorProductInfo info =
* @param sdev - sensor device pointer
* @return success: 1 , failure: other
*/
#ifdef ADD_NUTTX_FETURES
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
sdev->fd = PrivOpen(SENSOR_DEVICE_TB600B_TVOC10_DEV, O_RDWR);
if (sdev->fd < 0) {
printf("open %s error\n", SENSOR_DEVICE_TB600B_TVOC10_DEV);
return -1;
}
return sdev->fd;
}
#else
static int SensorDeviceOpen(struct SensorDevice *sdev)
{
int result = 0;
@@ -65,6 +77,7 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
return result;
}
#endif
/**
* @description: Read sensor device
@@ -138,6 +138,13 @@ static int PrivPinIoctl(int fd, int cmd, void *args)
return ioctl(fd, cmd, pin_cfg);
}
static int PrivLcdIoctl(int fd, int cmd, void *args)
{
struct DeviceLcdInfo *lcd_cfg = (struct DeviceLcdInfo *)args;
return ioctl(fd, cmd, lcd_cfg);
}
int PrivIoctl(int fd, int cmd, void *args)
{
int ret;
@@ -154,6 +161,13 @@ int PrivIoctl(int fd, int cmd, void *args)
case I2C_TYPE:
ret = ioctl(fd, cmd, ioctl_cfg->args);
break;
case LCD_TYPE:
ret = PrivLcdIoctl(fd, cmd, ioctl_cfg->args);
break;
case ADC_TYPE:
case DAC_TYPE:
ret = ioctl(fd, cmd, ioctl_cfg->args);
break;
default:
break;
}
@@ -138,6 +138,9 @@ enum IoctlDriverType
SPI_TYPE,
I2C_TYPE,
PIN_TYPE,
LCD_TYPE,
ADC_TYPE,
DAC_TYPE,
DEFAULT_TYPE,
};
@@ -147,6 +150,38 @@ struct PrivIoctlCfg
void *args;
};
typedef struct
{
uint16 x_pos;
uint16 y_pos;
uint16 width;
uint16 height;
uint8 font_size;
uint8 *addr;
uint16 font_color;
uint16 back_color;
}LcdStringParam;
typedef struct
{
uint16 x_startpos;
uint16 x_endpos;
uint16 y_startpos;
uint16 y_endpos;
void* pixel_color;
}LcdPixelParam;
typedef struct
{
char type; // 0:write string;1:write dot
LcdPixelParam pixel_info;
LcdStringParam string_info;
}LcdWriteParam;
#define PRIV_SYSTICK_GET (CurrentTicksGain())
#define PRIV_LCD_DEV "/dev/lcd_dev"
#define MY_DISP_HOR_RES BSP_LCD_Y_MAX
#define MY_DISP_VER_RES BSP_LCD_X_MAX
/**********************mutex**************************/
int PrivMutexCreate(pthread_mutex_t *p_mutex, const pthread_mutexattr_t *attr);