mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-26 19:29:24 +00:00
Allow UART TX or RX to not be configured
This commit is contained in:
parent
a08fc6a381
commit
770bbfc6f6
@ -65,10 +65,20 @@
|
|||||||
static int (*input_handler)(unsigned char c);
|
static int (*input_handler)(unsigned char c);
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static bool
|
static bool
|
||||||
usable(void)
|
usable_rx(void)
|
||||||
{
|
{
|
||||||
if(BOARD_IOID_UART_RX == IOID_UNUSED ||
|
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) {
|
CC26XX_UART_CONF_ENABLE == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -271,7 +281,7 @@ cc26xx_uart_init()
|
|||||||
bool interrupts_disabled;
|
bool interrupts_disabled;
|
||||||
|
|
||||||
/* Return early if disabled by user conf or if ports are misconfigured */
|
/* Return early if disabled by user conf or if ports are misconfigured */
|
||||||
if(usable() == false) {
|
if(!usable_rx() && !usable_tx()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,7 +309,7 @@ void
|
|||||||
cc26xx_uart_write_byte(uint8_t c)
|
cc26xx_uart_write_byte(uint8_t c)
|
||||||
{
|
{
|
||||||
/* Return early if disabled by user conf or if ports are misconfigured */
|
/* Return early if disabled by user conf or if ports are misconfigured */
|
||||||
if(usable() == false) {
|
if(usable_tx() == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,7 +326,7 @@ cc26xx_uart_set_input(int (*input)(unsigned char c))
|
|||||||
input_handler = input;
|
input_handler = input;
|
||||||
|
|
||||||
/* Return early if disabled by user conf or if ports are misconfigured */
|
/* Return early if disabled by user conf or if ports are misconfigured */
|
||||||
if(usable() == false) {
|
if(usable_rx() == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,7 +358,7 @@ uint8_t
|
|||||||
cc26xx_uart_busy(void)
|
cc26xx_uart_busy(void)
|
||||||
{
|
{
|
||||||
/* Return early if disabled by user conf or if ports are misconfigured */
|
/* Return early if disabled by user conf or if ports are misconfigured */
|
||||||
if(usable() == false) {
|
if(usable_tx() == false) {
|
||||||
return UART_IDLE;
|
return UART_IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user