aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/libmaple/api/usart.rst
blob: 68f2c37983c48777c0a66ee0ff573cc9b29e9ddb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
.. highlight:: c
.. _libmaple-usart:

``usart.h``
===========

Universal Synchronous/Asynchronous Receiver/Transmitter (USART, or
commonly *serial port*) support.

.. contents:: Contents
   :local:

Types
-----

.. doxygenstruct:: usart_reg_map
.. doxygenstruct:: usart_dev

Devices
-------

.. doxygenvariable:: USART1
.. doxygenvariable:: USART2
.. doxygenvariable:: USART3
.. doxygenvariable:: UART4
.. doxygenvariable:: UART5

Functions
---------

.. doxygenfunction:: usart_init
.. doxygenfunction:: usart_set_baud_rate
.. doxygenfunction:: usart_enable
.. doxygenfunction:: usart_disable
.. doxygenfunction:: usart_disable_all
.. doxygenfunction:: usart_foreach
.. doxygenfunction:: usart_rx
.. doxygenfunction:: usart_tx
.. doxygenfunction:: usart_putudec
.. doxygenfunction:: usart_putc
.. doxygenfunction:: usart_putstr
.. doxygenfunction:: usart_getc
.. doxygenfunction:: usart_data_available
.. doxygenfunction:: usart_reset_rx

Register Map Base Pointers
--------------------------

.. doxygendefine:: USART1_BASE
.. doxygendefine:: USART2_BASE
.. doxygendefine:: USART3_BASE
.. doxygendefine:: UART4_BASE
.. doxygendefine:: UART5_BASE

Register Bit Definitions
------------------------

Status Register
~~~~~~~~~~~~~~~

.. doxygendefine:: USART_SR_CTS_BIT
.. doxygendefine:: USART_SR_LBD_BIT
.. doxygendefine:: USART_SR_TXE_BIT
.. doxygendefine:: USART_SR_TC_BIT
.. doxygendefine:: USART_SR_RXNE_BIT
.. doxygendefine:: USART_SR_IDLE_BIT
.. doxygendefine:: USART_SR_ORE_BIT
.. doxygendefine:: USART_SR_NE_BIT
.. doxygendefine:: USART_SR_FE_BIT
.. doxygendefine:: USART_SR_PE_BIT

.. doxygendefine:: USART_SR_CTS
.. doxygendefine:: USART_SR_LBD
.. doxygendefine:: USART_SR_TXE
.. doxygendefine:: USART_SR_TC
.. doxygendefine:: USART_SR_RXNE
.. doxygendefine:: USART_SR_IDLE
.. doxygendefine:: USART_SR_ORE
.. doxygendefine:: USART_SR_NE
.. doxygendefine:: USART_SR_FE
.. doxygendefine:: USART_SR_PE

Data register
~~~~~~~~~~~~~

.. doxygendefine:: USART_DR_DR

Baud Rate Register
~~~~~~~~~~~~~~~~~~

.. doxygendefine:: USART_BRR_DIV_MANTISSA
.. doxygendefine:: USART_BRR_DIV_FRACTION

Control Register 1
~~~~~~~~~~~~~~~~~~

.. doxygendefine:: USART_CR1_UE_BIT
.. doxygendefine:: USART_CR1_M_BIT
.. doxygendefine:: USART_CR1_WAKE_BIT
.. doxygendefine:: USART_CR1_PCE_BIT
.. doxygendefine:: USART_CR1_PS_BIT
.. doxygendefine:: USART_CR1_PEIE_BIT
.. doxygendefine:: USART_CR1_TXEIE_BIT
.. doxygendefine:: USART_CR1_TCIE_BIT
.. doxygendefine:: USART_CR1_RXNEIE_BIT
.. doxygendefine:: USART_CR1_IDLEIE_BIT
.. doxygendefine:: USART_CR1_TE_BIT
.. doxygendefine:: USART_CR1_RE_BIT
.. doxygendefine:: USART_CR1_RWU_BIT
.. doxygendefine:: USART_CR1_SBK_BIT

.. doxygendefine:: USART_CR1_UE
.. doxygendefine:: USART_CR1_M
.. doxygendefine:: USART_CR1_WAKE
.. doxygendefine:: USART_CR1_WAKE_IDLE
.. doxygendefine:: USART_CR1_WAKE_ADDR
.. doxygendefine:: USART_CR1_PCE
.. doxygendefine:: USART_CR1_PS
.. doxygendefine:: USART_CR1_PS_EVEN
.. doxygendefine:: USART_CR1_PS_ODD
.. doxygendefine:: USART_CR1_PEIE
.. doxygendefine:: USART_CR1_TXEIE
.. doxygendefine:: USART_CR1_TCIE
.. doxygendefine:: USART_CR1_RXNEIE
.. doxygendefine:: USART_CR1_IDLEIE
.. doxygendefine:: USART_CR1_TE
.. doxygendefine:: USART_CR1_RE
.. doxygendefine:: USART_CR1_RWU
.. doxygendefine:: USART_CR1_RWU_ACTIVE
.. doxygendefine:: USART_CR1_RWU_MUTE
.. doxygendefine:: USART_CR1_SBK

Control Register 2
~~~~~~~~~~~~~~~~~~

.. doxygendefine:: USART_CR2_LINEN_BIT
.. doxygendefine:: USART_CR2_CLKEN_BIT
.. doxygendefine:: USART_CR2_CPOL_BIT
.. doxygendefine:: USART_CR2_CPHA_BIT
.. doxygendefine:: USART_CR2_LBCL_BIT
.. doxygendefine:: USART_CR2_LBDIE_BIT
.. doxygendefine:: USART_CR2_LBDL_BIT

.. doxygendefine:: USART_CR2_LINEN
.. doxygendefine:: USART_CR2_STOP
.. doxygendefine:: USART_CR2_STOP_BITS_1
.. doxygendefine:: USART_CR2_STOP_BITS_POINT_5
.. doxygendefine:: USART_CR2_STOP_BITS_1_POINT_5
.. doxygendefine:: USART_CR2_STOP_BITS_2
.. doxygendefine:: USART_CR2_CLKEN
.. doxygendefine:: USART_CR2_CPOL
.. doxygendefine:: USART_CR2_CPOL_LOW
.. doxygendefine:: USART_CR2_CPOL_HIGH
.. doxygendefine:: USART_CR2_CPHA
.. doxygendefine:: USART_CR2_CPHA_FIRST
.. doxygendefine:: USART_CR2_CPHA_SECOND
.. doxygendefine:: USART_CR2_LBCL
.. doxygendefine:: USART_CR2_LBDIE
.. doxygendefine:: USART_CR2_LBDL
.. doxygendefine:: USART_CR2_LBDL_10_BIT
.. doxygendefine:: USART_CR2_LBDL_11_BIT
.. doxygendefine:: USART_CR2_ADD

Control Register 3
~~~~~~~~~~~~~~~~~~

.. doxygendefine:: USART_CR3_CTSIE_BIT
.. doxygendefine:: USART_CR3_CTSE_BIT
.. doxygendefine:: USART_CR3_RTSE_BIT
.. doxygendefine:: USART_CR3_DMAT_BIT
.. doxygendefine:: USART_CR3_DMAR_BIT
.. doxygendefine:: USART_CR3_SCEN_BIT
.. doxygendefine:: USART_CR3_NACK_BIT
.. doxygendefine:: USART_CR3_HDSEL_BIT
.. doxygendefine:: USART_CR3_IRLP_BIT
.. doxygendefine:: USART_CR3_IREN_BIT
.. doxygendefine:: USART_CR3_EIE_BIT

.. doxygendefine:: USART_CR3_CTSIE
.. doxygendefine:: USART_CR3_CTSE
.. doxygendefine:: USART_CR3_RTSE
.. doxygendefine:: USART_CR3_DMAT
.. doxygendefine:: USART_CR3_DMAR
.. doxygendefine:: USART_CR3_SCEN
.. doxygendefine:: USART_CR3_NACK
.. doxygendefine:: USART_CR3_HDSEL
.. doxygendefine:: USART_CR3_IRLP
.. doxygendefine:: USART_CR3_IRLP_NORMAL
.. doxygendefine:: USART_CR3_IRLP_LOW_POWER
.. doxygendefine:: USART_CR3_IREN
.. doxygendefine:: USART_CR3_EIE

Guard Time and Prescaler Register
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. doxygendefine:: USART_GTPR_GT
.. doxygendefine:: USART_GTPR_PSC