add is_ext_uart in serial_cfg for framework for nuttx

This commit is contained in:
wgz-code
2022-09-05 14:08:12 +08:00
parent 5f42111c38
commit 5759661e8c
29 changed files with 397 additions and 359 deletions

View File

@@ -34,18 +34,6 @@ 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;
@@ -57,17 +45,18 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
}
struct SerialDataCfg cfg;
cfg.serial_baud_rate = BAUD_RATE_9600;
cfg.serial_data_bits = DATA_BITS_8;
cfg.serial_stop_bits = STOP_BITS_1;
cfg.serial_buffer_size = 128;
cfg.serial_parity_mode = PARITY_NONE;
cfg.serial_bit_order = 0;
cfg.serial_invert_mode = 0;
cfg.serial_baud_rate = BAUD_RATE_9600;
cfg.serial_data_bits = DATA_BITS_8;
cfg.serial_stop_bits = STOP_BITS_1;
cfg.serial_buffer_size = 128;
cfg.serial_parity_mode = PARITY_NONE;
cfg.serial_bit_order = 0;
cfg.serial_invert_mode = 0;
cfg.is_ext_uart = 0;
#ifdef SENSOR_AS830_DRIVER_EXTUART
cfg.is_ext_uart = 1;
cfg.ext_uart_no = SENSOR_DEVICE_AS830_DEV_EXT_PORT;
cfg.port_configure = PORT_CFG_INIT;
cfg.is_ext_uart = 1;
cfg.ext_uart_no = SENSOR_DEVICE_AS830_DEV_EXT_PORT;
cfg.port_configure = PORT_CFG_INIT;
#endif
struct PrivIoctlCfg ioctl_cfg;
@@ -77,7 +66,6 @@ static int SensorDeviceOpen(struct SensorDevice *sdev)
return result;
}
#endif
/**
* @description: Read sensor device