From 236a2d4503582f1d462293940b8c41bea4cde460 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Sat, 1 Jun 2019 11:01:21 -0500 Subject: [PATCH] config: rename PBIO_CONFIG_DISABLE_UARTDEV This renames PBIO_CONFIG_DISABLE_UARTDEV to PBIO_CONFIG_UARTDEV. This way, we have a positive option that is easier to grok at a glance. --- bricks/HUB4/pbioconfig.h | 1 + bricks/MOVEHUB/pbioconfig.h | 1 + bricks/debug/pbioconfig.h | 1 + lib/pbio/include/pbio/config.h | 4 ++-- lib/pbio/include/pbio/uartdev.h | 6 ++++-- lib/pbio/src/main.c | 2 +- lib/pbio/src/uartdev.c | 6 ++++-- 7 files changed, 14 insertions(+), 7 deletions(-) diff --git a/bricks/HUB4/pbioconfig.h b/bricks/HUB4/pbioconfig.h index e1d51d1d2..69916e7c9 100644 --- a/bricks/HUB4/pbioconfig.h +++ b/bricks/HUB4/pbioconfig.h @@ -1,5 +1,6 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2019 David Lechner +#define PBIO_CONFIG_UARTDEV (1) #define PBIO_CONFIG_ENABLE_DEINIT (0) #define PBIO_CONFIG_ENABLE_SYS (1) diff --git a/bricks/MOVEHUB/pbioconfig.h b/bricks/MOVEHUB/pbioconfig.h index e1d51d1d2..69916e7c9 100644 --- a/bricks/MOVEHUB/pbioconfig.h +++ b/bricks/MOVEHUB/pbioconfig.h @@ -1,5 +1,6 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2019 David Lechner +#define PBIO_CONFIG_UARTDEV (1) #define PBIO_CONFIG_ENABLE_DEINIT (0) #define PBIO_CONFIG_ENABLE_SYS (1) diff --git a/bricks/debug/pbioconfig.h b/bricks/debug/pbioconfig.h index 1e96cf570..5ee28b537 100644 --- a/bricks/debug/pbioconfig.h +++ b/bricks/debug/pbioconfig.h @@ -1,4 +1,5 @@ // SPDX-License-Identifier: MIT // Copyright (c) 2019 David Lechner +#define PBIO_CONFIG_UARTDEV (1) #define PBIO_CONFIG_ENABLE_SYS (1) diff --git a/lib/pbio/include/pbio/config.h b/lib/pbio/include/pbio/config.h index b8519011e..c4d575cf3 100644 --- a/lib/pbio/include/pbio/config.h +++ b/lib/pbio/include/pbio/config.h @@ -15,8 +15,8 @@ #define PBIO_CONFIG_ENABLE_DEINIT (1) #endif -#ifndef PBIO_CONFIG_DISABLE_UARTDEV -#define PBIO_CONFIG_DISABLE_UARTDEV (0) +#ifndef PBIO_CONFIG_UARTDEV +#define PBIO_CONFIG_UARTDEV (0) #endif #endif // _PBIO_CONFIG_H_ diff --git a/lib/pbio/include/pbio/uartdev.h b/lib/pbio/include/pbio/uartdev.h index b19ed5c05..4e2d1eb25 100644 --- a/lib/pbio/include/pbio/uartdev.h +++ b/lib/pbio/include/pbio/uartdev.h @@ -4,7 +4,9 @@ #ifndef _PBIO_UARTDEV_H_ #define _PBIO_UARTDEV_H_ -#ifndef PBIO_CONFIG_DISABLE_UARTDEV +#include + +#if PBIO_CONFIG_UARTDEV #include "sys/process.h" @@ -14,6 +16,6 @@ PROCESS_NAME(pbio_uartdev_process); /** @endcond */ -#endif // PBIO_CONFIG_DISABLE_UARTDEV +#endif // PBIO_CONFIG_UARTDEV #endif // _PBIO_UARTDEV_H_ diff --git a/lib/pbio/src/main.c b/lib/pbio/src/main.c index e91e1303f..ff4dc8357 100644 --- a/lib/pbio/src/main.c +++ b/lib/pbio/src/main.c @@ -47,7 +47,7 @@ AUTOSTART_PROCESSES( #if PBDRV_CONFIG_UART ,&pbdrv_uart_process #endif -#ifndef PBIO_CONFIG_DISABLE_UARTDEV +#if PBIO_CONFIG_UARTDEV ,&pbio_uartdev_process #endif #if PBIO_CONFIG_ENABLE_SYS diff --git a/lib/pbio/src/uartdev.c b/lib/pbio/src/uartdev.c index a8d069fde..d86d76031 100644 --- a/lib/pbio/src/uartdev.c +++ b/lib/pbio/src/uartdev.c @@ -19,6 +19,10 @@ * This file may be redistributed under either or both licenses. */ +#include + +#if PBIO_CONFIG_UARTDEV + #define DEBUG 0 #if DEBUG #define debug_pr(fmt, ...) printf((fmt), __VA_ARGS__) @@ -43,8 +47,6 @@ #include "sys/etimer.h" #include "sys/process.h" -#ifndef PBIO_CONFIG_DISABLE_UARTDEV - #define EV3_UART_MAX_MESSAGE_SIZE (PBIO_IODEV_MAX_DATA_SIZE + 2) #define EV3_UART_MSG_TYPE_MASK 0xC0