forked from xuos/xiuos
repair ch4 test
This commit is contained in:
parent
e366c8817c
commit
4a8ac7c02b
|
@ -29,6 +29,7 @@ extern int Hs300xTemperatureInit(void);
|
||||||
extern int Hs300xHumidityInit(void);
|
extern int Hs300xHumidityInit(void);
|
||||||
extern int Ps5308Pm1_0Init(void);
|
extern int Ps5308Pm1_0Init(void);
|
||||||
extern int Zg09Co2Init(void);
|
extern int Zg09Co2Init(void);
|
||||||
|
extern int As830Ch4Init(void);
|
||||||
|
|
||||||
typedef int (*InitFunc)(void);
|
typedef int (*InitFunc)(void);
|
||||||
struct InitDesc
|
struct InitDesc
|
||||||
|
@ -89,6 +90,10 @@ static struct InitDesc sensor_desc[] =
|
||||||
{ "zg09_co2", Zg09Co2Init },
|
{ "zg09_co2", Zg09Co2Init },
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SENSOR_AS830
|
||||||
|
{ "ch4_as830", As830Ch4Init },
|
||||||
|
#endif
|
||||||
|
|
||||||
{ "NULL", NULL },
|
{ "NULL", NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -17,16 +17,13 @@
|
||||||
|
|
||||||
extern int FrameworkInit();
|
extern int FrameworkInit();
|
||||||
extern void ApplicationOtaTaskInit(void);
|
extern void ApplicationOtaTaskInit(void);
|
||||||
extern void ShowMemory(void);
|
|
||||||
extern long ShowTask(void);
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
printf("Hello, world! Running on gapuino board.\n");
|
printf("Hello, world! \n");
|
||||||
FrameworkInit();
|
FrameworkInit();
|
||||||
#ifdef APPLICATION_OTA
|
#ifdef APPLICATION_OTA
|
||||||
ApplicationOtaTaskInit();
|
ApplicationOtaTaskInit();
|
||||||
#endif
|
#endif
|
||||||
Ch4As830();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// int cppmain(void);
|
// int cppmain(void);
|
||||||
|
|
|
@ -25,11 +25,11 @@ config SENSOR_AS830
|
||||||
if SENSOR_AS830_DRIVER_EXTUART
|
if SENSOR_AS830_DRIVER_EXTUART
|
||||||
config SENSOR_DEVICE_AS830_DEV
|
config SENSOR_DEVICE_AS830_DEV
|
||||||
string "as830 device extra uart path"
|
string "as830 device extra uart path"
|
||||||
default "/dev/extuart_dev4"
|
default "/dev/extuart_dev1"
|
||||||
|
|
||||||
config SENSOR_DEVICE_AS830_DEV_EXT_PORT
|
config SENSOR_DEVICE_AS830_DEV_EXT_PORT
|
||||||
int "if AS830 device using extuart, choose port"
|
int "if AS830 device using extuart, choose port"
|
||||||
default "4"
|
default "1"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,10 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
sdev->fd = PrivOpen(SENSOR_DEVICE_AS830_DEV, O_RDWR);
|
sdev->fd = PrivOpen(SENSOR_DEVICE_AS830_DEV, O_RDWR);
|
||||||
|
if (sdev->fd < 0) {
|
||||||
|
printf("open %s error\n", SENSOR_DEVICE_AS830_DEV);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
struct SerialDataCfg cfg;
|
struct SerialDataCfg cfg;
|
||||||
cfg.serial_baud_rate = BAUD_RATE_9600;
|
cfg.serial_baud_rate = BAUD_RATE_9600;
|
||||||
|
@ -58,8 +62,6 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
|
||||||
ioctl_cfg.args = &cfg;
|
ioctl_cfg.args = &cfg;
|
||||||
result = PrivIoctl(sdev->fd, OPE_INT, &ioctl_cfg);
|
result = PrivIoctl(sdev->fd, OPE_INT, &ioctl_cfg);
|
||||||
|
|
||||||
sdev->done->ioctl(sdev, SENSOR_DEVICE_PASSIVE);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue