Skip to content

Commit 770bbfc

Browse files
committed
Allow UART TX or RX to not be configured
1 parent a08fc6a commit 770bbfc

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

cpu/cc26xx-cc13xx/dev/cc26xx-uart.c

+16-6
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,20 @@
6565
static int (*input_handler)(unsigned char c);
6666
/*---------------------------------------------------------------------------*/
6767
static bool
68-
usable(void)
68+
usable_rx(void)
6969
{
7070
if(BOARD_IOID_UART_RX == IOID_UNUSED ||
71-
BOARD_IOID_UART_TX == IOID_UNUSED ||
71+
CC26XX_UART_CONF_ENABLE == 0) {
72+
return false;
73+
}
74+
75+
return true;
76+
}
77+
/*---------------------------------------------------------------------------*/
78+
static bool
79+
usable_tx(void)
80+
{
81+
if(BOARD_IOID_UART_TX == IOID_UNUSED ||
7282
CC26XX_UART_CONF_ENABLE == 0) {
7383
return false;
7484
}
@@ -271,7 +281,7 @@ cc26xx_uart_init()
271281
bool interrupts_disabled;
272282

273283
/* Return early if disabled by user conf or if ports are misconfigured */
274-
if(usable() == false) {
284+
if(!usable_rx() && !usable_tx()) {
275285
return;
276286
}
277287

@@ -299,7 +309,7 @@ void
299309
cc26xx_uart_write_byte(uint8_t c)
300310
{
301311
/* Return early if disabled by user conf or if ports are misconfigured */
302-
if(usable() == false) {
312+
if(usable_tx() == false) {
303313
return;
304314
}
305315

@@ -316,7 +326,7 @@ cc26xx_uart_set_input(int (*input)(unsigned char c))
316326
input_handler = input;
317327

318328
/* Return early if disabled by user conf or if ports are misconfigured */
319-
if(usable() == false) {
329+
if(usable_rx() == false) {
320330
return;
321331
}
322332

@@ -348,7 +358,7 @@ uint8_t
348358
cc26xx_uart_busy(void)
349359
{
350360
/* Return early if disabled by user conf or if ports are misconfigured */
351-
if(usable() == false) {
361+
if(usable_tx() == false) {
352362
return UART_IDLE;
353363
}
354364

0 commit comments

Comments
 (0)