Changed serial pin_mode with brackets and for all targets

pull/530/head
Sissors 2014-10-06 12:15:24 +02:00
parent 86e71216fa
commit 1b833cbd67
24 changed files with 126 additions and 52 deletions

View File

@ -98,10 +98,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
pinmap_pinout(rx, PinMap_UART_RX);
// set rx/tx pins in PullUp mode
if (tx != NC)
if (tx != NC) {
pin_mode(tx, PullUp);
if (rx != NC)
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
obj->uart->C2 |= (UART_C2_RE_MASK | UART_C2_TE_MASK);

View File

@ -96,10 +96,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
pinmap_pinout(rx, PinMap_UART_RX);
// set rx/tx pins in PullUp mode
if (tx != NC)
if (tx != NC) {
pin_mode(tx, PullUp);
if (rx != NC)
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
obj->uart->C2 |= (UARTLP_C2_RE_MASK | UARTLP_C2_TE_MASK);

View File

@ -68,10 +68,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
if (tx != NC)
if (tx != NC) {
pin_mode(tx, PullUp);
if (rx != NC)
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
if (obj->index == STDIO_UART) {
stdio_uart_inited = 1;

View File

@ -85,8 +85,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
obj->index = 0;
// set rx/tx pins in PullUp mode
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
if (uart == STDIO_UART) {
stdio_uart_inited = 1;

View File

@ -142,10 +142,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
pinmap_pinout(rx, PinMap_UART_RX);
// set rx/tx pins in PullUp mode
if (tx != NC)
if (tx != NC) {
pin_mode(tx, PullUp);
if (rx != NC)
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
is_stdio_uart = (uart == STDIO_UART) ? (1) : (0);

View File

@ -73,10 +73,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
pinmap_pinout(rx, PinMap_UART_RX);
// set rx/tx pins in PullUp mode
if (tx != NC)
if (tx != NC) {
pin_mode(tx, PullUp);
if (rx != NC)
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
switch (uart) {
case UART_0: obj->index = 0; break;

View File

@ -82,10 +82,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
pinmap_pinout(rx, PinMap_UART_RX);
// set rx/tx pins in PullUp mode
if (tx != NC)
if (tx != NC) {
pin_mode(tx, PullUp);
if (rx != NC)
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
switch (uart) {
case UART_0: obj->index = 0; break;

View File

@ -85,10 +85,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
pinmap_pinout(rx, PinMap_UART_RX);
// set rx/tx pins in PullUp mode
if (tx != NC)
if (tx != NC) {
pin_mode(tx, PullUp);
if (rx != NC)
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
switch (uart) {
case UART_0: obj->index = 0; break;

View File

@ -120,10 +120,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
pinmap_pinout(rx, PinMap_UART_RX);
// set rx/tx pins in PullUp mode
if (tx != NC)
if (tx != NC) {
pin_mode(tx, PullUp);
if (rx != NC)
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
switch (uart) {
case UART_0: obj->index = 0; break;

View File

@ -96,10 +96,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
pinmap_pinout(rx, PinMap_UART_RX);
// set rx/tx pins in PullUp mode
if (tx != NC)
if (tx != NC) {
pin_mode(tx, PullUp);
if (rx != NC)
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
switch (uart) {
case UART_0: obj->index = 0; break;

View File

@ -104,10 +104,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
pinmap_pinout(rx, PinMap_UART_RX);
// set rx/tx pins in PullUp mode
if (tx != NC)
if (tx != NC) {
pin_mode(tx, PullUp);
if (rx != NC)
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
switch (uart) {
case UART_0: obj->index = 0; break;

View File

@ -139,14 +139,16 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
serial_format(obj, 8, ParityNone, 1);
// pinout the chosen uart
if (tx != NC)
pin_mode(tx, PullUp);
if (rx != NC)
pin_mode(rx, PullUp);
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
// set rx/tx pins in PullUp mode
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
switch (uart) {
case UART_0: obj->index = 0; break;

View File

@ -99,8 +99,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;

View File

@ -114,8 +114,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;

View File

@ -107,8 +107,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;

View File

@ -128,8 +128,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;

View File

@ -122,8 +122,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;

View File

@ -125,8 +125,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx)
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;

View File

@ -111,8 +111,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;

View File

@ -115,8 +115,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx)
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;

View File

@ -126,8 +126,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;

View File

@ -126,8 +126,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;

View File

@ -108,8 +108,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;

View File

@ -104,8 +104,12 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) {
// Configure the UART pins
pinmap_pinout(tx, PinMap_UART_TX);
pinmap_pinout(rx, PinMap_UART_RX);
pin_mode(tx, PullUp);
pin_mode(rx, PullUp);
if (tx != NC) {
pin_mode(tx, PullUp);
}
if (rx != NC) {
pin_mode(rx, PullUp);
}
// Configure UART
obj->baudrate = 9600;