Skip to content

Commit

Permalink
Merge pull request contiki-os#2259 from arurke/cc26xxcc13xx_uart_opti…
Browse files Browse the repository at this point in the history
…onal_txrx_support

CC26xx/CC13xx: Support uni-directional UART
  • Loading branch information
g-oikonomou authored Jul 23, 2017
2 parents a08fc6a + 770bbfc commit 719f712
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions cpu/cc26xx-cc13xx/dev/cc26xx-uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,20 @@
static int (*input_handler)(unsigned char c);
/*---------------------------------------------------------------------------*/
static bool
usable(void)
usable_rx(void)
{
if(BOARD_IOID_UART_RX == IOID_UNUSED ||
BOARD_IOID_UART_TX == IOID_UNUSED ||
CC26XX_UART_CONF_ENABLE == 0) {
return false;
}

return true;
}
/*---------------------------------------------------------------------------*/
static bool
usable_tx(void)
{
if(BOARD_IOID_UART_TX == IOID_UNUSED ||
CC26XX_UART_CONF_ENABLE == 0) {
return false;
}
Expand Down Expand Up @@ -271,7 +281,7 @@ cc26xx_uart_init()
bool interrupts_disabled;

/* Return early if disabled by user conf or if ports are misconfigured */
if(usable() == false) {
if(!usable_rx() && !usable_tx()) {
return;
}

Expand Down Expand Up @@ -299,7 +309,7 @@ void
cc26xx_uart_write_byte(uint8_t c)
{
/* Return early if disabled by user conf or if ports are misconfigured */
if(usable() == false) {
if(usable_tx() == false) {
return;
}

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

/* Return early if disabled by user conf or if ports are misconfigured */
if(usable() == false) {
if(usable_rx() == false) {
return;
}

Expand Down Expand Up @@ -348,7 +358,7 @@ uint8_t
cc26xx_uart_busy(void)
{
/* Return early if disabled by user conf or if ports are misconfigured */
if(usable() == false) {
if(usable_tx() == false) {
return UART_IDLE;
}

Expand Down

0 comments on commit 719f712

Please sign in to comment.