px-fwlib 0.10.0
Cross-platform embedded library and documentation for 8/16/32-bit microcontrollers generated with Doxygen 1.9.2
px_uart_cfg_template.h
1#ifndef __PX_UART_CFG_H__
2#define __PX_UART_CFG_H__
3/* =============================================================================
4 ____ ___ ____ ___ _ _ ___ __ __ ___ __ __ TM
5 | _ \ |_ _| / ___| / _ \ | \ | | / _ \ | \/ | |_ _| \ \/ /
6 | |_) | | | | | | | | | | \| | | | | | | |\/| | | | \ /
7 | __/ | | | |___ | |_| | | |\ | | |_| | | | | | | | / \
8 |_| |___| \____| \___/ |_| \_| \___/ |_| |_| |___| /_/\_\
9
10 Copyright (c) 2014 Pieter Conradie <https://piconomix.com>
11
12 License: MIT
13 https://github.com/piconomix/px-fwlib/blob/master/LICENSE.md
14
15 Title: px_uart_cfg.h : UART Peripheral Driver configuration
16 Author(s): Pieter Conradie
17 Creation Date: 2014-01-16
18
19============================================================================= */
20
21/**
22 * @addtogroup AVR_UART
23 *
24 * @{
25 */
26
27/* _____STANDARD INCLUDES____________________________________________________ */
28
29/* _____PROJECT INCLUDES_____________________________________________________ */
30#include "px_defs.h"
31
32/* _____DEFINITIONS__________________________________________________________ */
33/// Enable/disable support for UART0 peripheral
34#define PX_UART_CFG_UART0_EN 1
35
36/// Enable/disable support for UART1 peripheral
37#define PX_UART_CFG_UART1_EN 0
38
39/// Default BAUD rate
40#define PX_UART_CFG_DEFAULT_BAUD 115200ul
41
42/// Default UART configuration (8 data bits, no parity, 1 stop bit)
43#define PX_UART_CFG_DEFAULT_UCSRC ((1 << UCSZ01) | (1 << UCSZ00))
44
45/// Size of transmit buffer (must be a power of two, e.g. 2,4,8,..., 256)
46#define PX_UART_CFG_TX_BUF_SIZE 32
47
48/// Size of receive buffer (must be a power of two, e.g. 2,4,8,..., 256)
49#define PX_UART_CFG_RX_BUF_SIZE 64
50
51/**
52 * Use double rate UART Transmission speed (0 = no; 1 = yes)
53 *
54 * If enabled, it results in a smaller BAUD rate error when using imprecise
55 * clock inputs, e.g. for F_CPU = 16 MHz and desired Baud Rate = 115200:
56 * - U2Xn = 0 : UBBRn = 8 (-3.5% error)
57 * - U2Xn = 1 : UBBRn = 16 (+2.1% error)
58 */
59#define PX_UART_CFG_USE_2X_BAUD_RATE 1
60
61/// @}
62#endif