int ret;
ret = peripheral_uart_close(uart_hndl);
- if (ret < 0 ) {
+ if (ret < 0) {
_E("GPS Uart Port Close failed !!");
return FALSE;
}
int ret;
ret = peripheral_uart_open(GPS_UART_PORT, &uart_hndl);
- if (ret < 0 ) {
+ if (ret < 0) {
_E("GPS Uart Port Open failed !!");
return FALSE;
}
_D("GPS Uart Port Open Successful !!");
- ret = peripheral_uart_set_baudrate(uart_hndl, PERIPHERAL_UART_BAUDRATE_9600);
+ ret = peripheral_uart_set_baud_rate(uart_hndl, PERIPHERAL_UART_BAUD_RATE_9600);
if (ret < 0) {
_E("GPS Uart Port Open failed !!");
goto ERROR;
}
- ret = peripheral_uart_set_mode(uart_hndl,
- PERIPHERAL_UART_BYTESIZE_8BIT,
- PERIPHERAL_UART_PARITY_NONE,
- PERIPHERAL_UART_STOPBITS_1BIT);
+ ret = peripheral_uart_set_byte_size(uart_hndl, PERIPHERAL_UART_BYTE_SIZE_8BIT);
if (ret < 0) {
_E("GPS Uart Set Mode failed !!");
goto ERROR;
}
- ret = peripheral_uart_set_flowcontrol(uart_hndl, true, false);
+ ret = peripheral_uart_set_parity(uart_hndl, PERIPHERAL_UART_PARITY_NONE);
if (ret < 0) {
- _E("GPS Uart Set Flow Control Open failed !!");
+ _E("GPS Uart Set Mode failed !!");
+ goto ERROR;
+ }
+ ret = peripheral_uart_set_stop_bits(uart_hndl, PERIPHERAL_UART_STOP_BITS_1BIT);
+ if (ret < 0) {
+ _E("GPS Uart Set Mode failed !!");
goto ERROR;
}
- ret = peripheral_uart_flush(uart_hndl);
+ ret = peripheral_uart_set_flow_control(uart_hndl,
+ PERIPHERAL_UART_HARDWARE_FLOW_CONTROL_AUTO_RTSCTS,
+ PERIPHERAL_UART_SOFTWARE_FLOW_CONTROL_NONE);
if (ret < 0) {
- _E("GPS Uart Flush failed !!");
+ _E("GPS Uart Set Flow Control Open failed !!");
goto ERROR;
}
return TRUE;
break;
} else {
strncpy(nmea_data + strlen(nmea_data), buf, strlen(buf) - 1);
- }
+ }
}
timer->nmea_data->len = strlen(buf);
timer->nmea_data->data = buf;