fix: whitespaces

This commit is contained in:
iceman1001 2019-02-21 16:09:27 +01:00
commit 44392c6afc

View file

@ -73,8 +73,7 @@ struct timeval timeout = {
.tv_usec = 30000 // 30 000 micro seconds .tv_usec = 30000 // 30 000 micro seconds
}; };
serial_port uart_open(const char* pcPortName) serial_port uart_open(const char* pcPortName) {
{
serial_port_unix* sp = calloc(sizeof(serial_port_unix), sizeof(uint8_t)); serial_port_unix* sp = calloc(sizeof(serial_port_unix), sizeof(uint8_t));
if (sp == 0) return INVALID_SERIAL_PORT; if (sp == 0) return INVALID_SERIAL_PORT;
@ -87,12 +86,10 @@ serial_port uart_open(const char* pcPortName)
return INVALID_SERIAL_PORT; return INVALID_SERIAL_PORT;
} }
timeout.tv_usec = 300000 // 300 000 micro seconds
char *colon = strrchr(addrstr, ':'); char *colon = strrchr(addrstr, ':');
char *portstr; char *portstr;
// Set time-out to 300 miliseconds only for TCP port
timeout.tv_usec = 300000;
if (colon) { if (colon) {
portstr = colon + 1; portstr = colon + 1;
*colon = '\0'; *colon = '\0';
@ -373,7 +370,10 @@ uint32_t uart_get_speed(const serial_port sp) {
struct termios ti; struct termios ti;
uint32_t uiPortSpeed; uint32_t uiPortSpeed;
const serial_port_unix* spu = (serial_port_unix*)sp; const serial_port_unix* spu = (serial_port_unix*)sp;
if (tcgetattr(spu->fd, &ti) == -1) return 0;
if (tcgetattr(spu->fd, &ti) == -1)
return 0;
// Set port speed (Input) // Set port speed (Input)
speed_t stPortSpeed = cfgetispeed(&ti); speed_t stPortSpeed = cfgetispeed(&ti);
switch (stPortSpeed) { switch (stPortSpeed) {
@ -411,5 +411,4 @@ uint32_t uart_get_speed(const serial_port sp) {
}; };
return uiPortSpeed; return uiPortSpeed;
} }
#endif #endif