|
|
@ -53,42 +53,45 @@ void WifiSerial::init(PinName _rx, PinName _tx) { |
|
|
|
WifiSerial::WifiSerial(void *peripheral) { |
|
|
|
// If PIN_SERIALy_RX is not defined assume half-duplex
|
|
|
|
_serial.pin_rx = NC; |
|
|
|
if (false) { |
|
|
|
// for else if / else below...
|
|
|
|
} |
|
|
|
// If Serial is defined in variant set
|
|
|
|
// the Rx/Tx pins for com port if defined
|
|
|
|
#if defined(Serial) && defined(PIN_SERIAL_TX) |
|
|
|
if ((void *)this == (void *)&Serial) { |
|
|
|
else if ((void *)this == (void *)&Serial) { |
|
|
|
#ifdef PIN_SERIAL_RX |
|
|
|
setRx(PIN_SERIAL_RX); |
|
|
|
#endif |
|
|
|
setTx(PIN_SERIAL_TX); |
|
|
|
} else |
|
|
|
} |
|
|
|
#endif |
|
|
|
#if defined(PIN_SERIAL1_TX) && defined(USART1_BASE) |
|
|
|
if (peripheral == USART1) { |
|
|
|
else if (peripheral == USART1) { |
|
|
|
#ifdef PIN_SERIAL1_RX |
|
|
|
setRx(PIN_SERIAL1_RX); |
|
|
|
#endif |
|
|
|
setTx(PIN_SERIAL1_TX); |
|
|
|
} else |
|
|
|
} |
|
|
|
#endif |
|
|
|
#if defined(PIN_SERIAL2_TX) && defined(USART2_BASE) |
|
|
|
if (peripheral == USART2) { |
|
|
|
else if (peripheral == USART2) { |
|
|
|
#ifdef PIN_SERIAL2_RX |
|
|
|
setRx(PIN_SERIAL2_RX); |
|
|
|
#endif |
|
|
|
setTx(PIN_SERIAL2_TX); |
|
|
|
} else |
|
|
|
} |
|
|
|
#endif |
|
|
|
#if defined(PIN_SERIAL3_TX) && defined(USART3_BASE) |
|
|
|
if (peripheral == USART3) { |
|
|
|
else if (peripheral == USART3) { |
|
|
|
#ifdef PIN_SERIAL3_RX |
|
|
|
setRx(PIN_SERIAL3_RX); |
|
|
|
#endif |
|
|
|
setTx(PIN_SERIAL3_TX); |
|
|
|
} else |
|
|
|
} |
|
|
|
#endif |
|
|
|
#ifdef PIN_SERIAL4_TX |
|
|
|
if (false |
|
|
|
else if (false |
|
|
|
#ifdef USART4_BASE |
|
|
|
|| peripheral == USART4 |
|
|
|
#elif defined(UART4_BASE) |
|
|
@ -99,10 +102,10 @@ WifiSerial::WifiSerial(void *peripheral) { |
|
|
|
setRx(PIN_SERIAL4_RX); |
|
|
|
#endif |
|
|
|
setTx(PIN_SERIAL4_TX); |
|
|
|
} else |
|
|
|
} |
|
|
|
#endif |
|
|
|
#ifdef PIN_SERIAL5_TX |
|
|
|
if (false |
|
|
|
else if (false |
|
|
|
#ifdef USART5_BASE |
|
|
|
|| peripheral == USART5 |
|
|
|
#elif defined(UART5_BASE) |
|
|
@ -113,18 +116,18 @@ WifiSerial::WifiSerial(void *peripheral) { |
|
|
|
setRx(PIN_SERIAL5_RX); |
|
|
|
#endif |
|
|
|
setTx(PIN_SERIAL5_TX); |
|
|
|
} else |
|
|
|
} |
|
|
|
#endif |
|
|
|
#if defined(PIN_SERIAL6_TX) && defined(USART6_BASE) |
|
|
|
if (peripheral == USART6) { |
|
|
|
else if (peripheral == USART6) { |
|
|
|
#ifdef PIN_SERIAL6_RX |
|
|
|
setRx(PIN_SERIAL6_RX); |
|
|
|
#endif |
|
|
|
setTx(PIN_SERIAL6_TX); |
|
|
|
} else |
|
|
|
} |
|
|
|
#endif |
|
|
|
#ifdef PIN_SERIAL7_TX |
|
|
|
if (false |
|
|
|
else if (false |
|
|
|
#ifdef USART7_BASE |
|
|
|
|| peripheral == USART7 |
|
|
|
#elif defined(UART7_BASE) |
|
|
@ -135,10 +138,10 @@ WifiSerial::WifiSerial(void *peripheral) { |
|
|
|
setRx(PIN_SERIAL7_RX); |
|
|
|
#endif |
|
|
|
setTx(PIN_SERIAL7_TX); |
|
|
|
} else |
|
|
|
} |
|
|
|
#endif |
|
|
|
#ifdef PIN_SERIAL8_TX |
|
|
|
if (false |
|
|
|
else if (false |
|
|
|
#ifdef USART8_BASE |
|
|
|
|| peripheral == USART8 |
|
|
|
#elif defined(UART8_BASE) |
|
|
@ -149,18 +152,18 @@ WifiSerial::WifiSerial(void *peripheral) { |
|
|
|
setRx(PIN_SERIAL8_RX); |
|
|
|
#endif |
|
|
|
setTx(PIN_SERIAL8_TX); |
|
|
|
} else |
|
|
|
} |
|
|
|
#endif |
|
|
|
#if defined(PIN_SERIAL9_TX) && defined(UART9_BASE) |
|
|
|
if (peripheral == UART9) { |
|
|
|
else if (peripheral == UART9) { |
|
|
|
#ifdef PIN_SERIAL9_RX |
|
|
|
setRx(PIN_SERIAL9_RX); |
|
|
|
#endif |
|
|
|
setTx(PIN_SERIAL9_TX); |
|
|
|
} else |
|
|
|
} |
|
|
|
#endif |
|
|
|
#ifdef PIN_SERIAL10_TX |
|
|
|
if (false |
|
|
|
else if (false |
|
|
|
#ifdef USART10_BASE |
|
|
|
|| peripheral == USART10 |
|
|
|
#elif defined(UART10_BASE) |
|
|
@ -171,18 +174,18 @@ WifiSerial::WifiSerial(void *peripheral) { |
|
|
|
setRx(PIN_SERIAL10_RX); |
|
|
|
#endif |
|
|
|
setTx(PIN_SERIAL10_TX); |
|
|
|
} else |
|
|
|
} |
|
|
|
#endif |
|
|
|
#if defined(PIN_SERIALLP1_TX) && defined(LPUART1_BASE) |
|
|
|
if (peripheral == LPUART1) { |
|
|
|
else if (peripheral == LPUART1) { |
|
|
|
#ifdef PIN_SERIALLP1_RX |
|
|
|
setRx(PIN_SERIALLP1_RX); |
|
|
|
#endif |
|
|
|
setTx(PIN_SERIALLP1_TX); |
|
|
|
} else |
|
|
|
} |
|
|
|
#endif |
|
|
|
// else get the pins of the first peripheral occurrence in PinMap
|
|
|
|
{ |
|
|
|
else { |
|
|
|
_serial.pin_rx = pinmap_pin(peripheral, PinMap_UART_RX); |
|
|
|
_serial.pin_tx = pinmap_pin(peripheral, PinMap_UART_TX); |
|
|
|
} |
|
|
|