Skip to content

Commit

Permalink
Allow users to set buffer size inside compiler options
Browse files Browse the repository at this point in the history
  • Loading branch information
andygock committed May 19, 2013
1 parent 22a0069 commit b76d8ef
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,31 @@ Date Description

/* Set size of receive and transmit buffers */

#define UART_RX0_BUFFER_SIZE 128 /**< Size of the circular receive buffer, must be power of 2 */
#define UART_RX1_BUFFER_SIZE 128 /**< Size of the circular receive buffer, must be power of 2 */
#define UART_RX2_BUFFER_SIZE 128 /**< Size of the circular receive buffer, must be power of 2 */
#define UART_RX3_BUFFER_SIZE 128 /**< Size of the circular receive buffer, must be power of 2 */

#define UART_TX0_BUFFER_SIZE 128 /**< Size of the circular transmit buffer, must be power of 2 */
#define UART_TX1_BUFFER_SIZE 128 /**< Size of the circular transmit buffer, must be power of 2 */
#define UART_TX2_BUFFER_SIZE 128 /**< Size of the circular transmit buffer, must be power of 2 */
#define UART_TX3_BUFFER_SIZE 128 /**< Size of the circular transmit buffer, must be power of 2 */
#if !defined(UART_RX0_BUFFER_SIZE)
#define UART_RX0_BUFFER_SIZE 128 /**< Size of the circular receive buffer, must be power of 2 */
#endif
#if !defined(UART_RX1_BUFFER_SIZE)
#define UART_RX1_BUFFER_SIZE 128 /**< Size of the circular receive buffer, must be power of 2 */
#endif
#if !defined(UART_RX2_BUFFER_SIZE)
#define UART_RX2_BUFFER_SIZE 128 /**< Size of the circular receive buffer, must be power of 2 */
#endif
#if !defined(UART_RX3_BUFFER_SIZE)
#define UART_RX3_BUFFER_SIZE 128 /**< Size of the circular receive buffer, must be power of 2 */
#endif

#if !defined(UART_TX0_BUFFER_SIZE)
#define UART_TX0_BUFFER_SIZE 128 /**< Size of the circular transmit buffer, must be power of 2 */
#endif
#if !defined(UART_TX1_BUFFER_SIZE)
#define UART_TX1_BUFFER_SIZE 128 /**< Size of the circular transmit buffer, must be power of 2 */
#endif
#if !defined(UART_TX2_BUFFER_SIZE)
#define UART_TX2_BUFFER_SIZE 128 /**< Size of the circular transmit buffer, must be power of 2 */
#endif
#if !defined(UART_TX3_BUFFER_SIZE)
#define UART_TX3_BUFFER_SIZE 128 /**< Size of the circular transmit buffer, must be power of 2 */
#endif

#if (UART_RX0_BUFFER_SIZE > 256 & !defined(USART0_LARGE_BUFFER))
#error "Buffer too large, please use -DUSART0_LARGE_BUFFER switch in compiler options"
Expand Down

0 comments on commit b76d8ef

Please sign in to comment.