MSP430 DriverLib for MSP430FR2xx_4xx Devices  2.91.13.01
eusci_a_uart.h
1 //*****************************************************************************
2 //
3 // eusci_a_uart.h - Driver for the EUSCI_A_UART Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_EUSCI_A_UART_H__
8 #define __MSP430WARE_EUSCI_A_UART_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_EUSCI_Ax__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 #include "inc/hw_memmap.h"
26 //*****************************************************************************
27 //
28 // The following values are the sync characters possible.
29 //
30 //*****************************************************************************
31 #define DEFAULT_SYNC 0x00
32 #define EUSCI_A_UART_AUTOMATICBAUDRATE_SYNC 0x55
33 
34 //*****************************************************************************
35 //
36 //! \brief Used in the EUSCI_A_UART_init() function as the param parameter.
37 //
38 //*****************************************************************************
39 typedef struct EUSCI_A_UART_initParam {
40  //! Selects Clock source. Refer to device specific datasheet for available
41  //! options.
42  //! \n Valid values are:
43  //! - \b EUSCI_A_UART_CLOCKSOURCE_UCLK
44  //! - \b EUSCI_A_UART_CLOCKSOURCE_SMCLK
45  //! - \b EUSCI_A_UART_CLOCKSOURCE_ACLK
46  //! - \b EUSCI_A_UART_CLOCKSOURCE_MODCLK
48  //! Is the value to be written into UCBRx bits
49  uint16_t clockPrescalar;
50  //! Is First modulation stage register setting. This value is a pre-
51  //! calculated value which can be obtained from the Device Users Guide.
52  //! This value is written into UCBRFx bits of UCAxMCTLW.
53  uint8_t firstModReg;
54  //! Is Second modulation stage register setting. This value is a pre-
55  //! calculated value which can be obtained from the Device Users Guide.
56  //! This value is written into UCBRSx bits of UCAxMCTLW.
57  uint8_t secondModReg;
58  //! Is the desired parity.
59  //! \n Valid values are:
60  //! - \b EUSCI_A_UART_NO_PARITY [Default]
61  //! - \b EUSCI_A_UART_ODD_PARITY
62  //! - \b EUSCI_A_UART_EVEN_PARITY
63  uint8_t parity;
64  //! Controls direction of receive and transmit shift register.
65  //! \n Valid values are:
66  //! - \b EUSCI_A_UART_MSB_FIRST
67  //! - \b EUSCI_A_UART_LSB_FIRST [Default]
68  uint16_t msborLsbFirst;
69  //! Indicates one/two STOP bits
70  //! \n Valid values are:
71  //! - \b EUSCI_A_UART_ONE_STOP_BIT [Default]
72  //! - \b EUSCI_A_UART_TWO_STOP_BITS
73  uint16_t numberofStopBits;
74  //! Selects the mode of operation
75  //! \n Valid values are:
76  //! - \b EUSCI_A_UART_MODE [Default]
77  //! - \b EUSCI_A_UART_IDLE_LINE_MULTI_PROCESSOR_MODE
78  //! - \b EUSCI_A_UART_ADDRESS_BIT_MULTI_PROCESSOR_MODE
79  //! - \b EUSCI_A_UART_AUTOMATIC_BAUDRATE_DETECTION_MODE
80  uint16_t uartMode;
81  //! Indicates low frequency or oversampling baud generation
82  //! \n Valid values are:
83  //! - \b EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION
84  //! - \b EUSCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION
85  uint8_t overSampling;
87 
88 
89 //*****************************************************************************
90 //
91 // The following are values that can be passed to the param parameter for
92 // functions: EUSCI_A_UART_init().
93 //
94 //*****************************************************************************
95 #define EUSCI_A_UART_NO_PARITY 0x00
96 #define EUSCI_A_UART_ODD_PARITY 0x01
97 #define EUSCI_A_UART_EVEN_PARITY 0x02
98 
99 //*****************************************************************************
100 //
101 // The following are values that can be passed to the param parameter for
102 // functions: EUSCI_A_UART_init().
103 //
104 //*****************************************************************************
105 #define EUSCI_A_UART_MSB_FIRST UCMSB
106 #define EUSCI_A_UART_LSB_FIRST 0x00
107 
108 //*****************************************************************************
109 //
110 // The following are values that can be passed to the param parameter for
111 // functions: EUSCI_A_UART_init().
112 //
113 //*****************************************************************************
114 #define EUSCI_A_UART_MODE UCMODE_0
115 #define EUSCI_A_UART_IDLE_LINE_MULTI_PROCESSOR_MODE UCMODE_1
116 #define EUSCI_A_UART_ADDRESS_BIT_MULTI_PROCESSOR_MODE UCMODE_2
117 #define EUSCI_A_UART_AUTOMATIC_BAUDRATE_DETECTION_MODE UCMODE_3
118 
119 //*****************************************************************************
120 //
121 // The following are values that can be passed to the param parameter for
122 // functions: EUSCI_A_UART_init().
123 //
124 //*****************************************************************************
125 #define EUSCI_A_UART_CLOCKSOURCE_UCLK UCSSEL__UCLK
126 #define EUSCI_A_UART_CLOCKSOURCE_SMCLK UCSSEL__SMCLK
127 #define EUSCI_A_UART_CLOCKSOURCE_ACLK 0x40
128 #define EUSCI_A_UART_CLOCKSOURCE_MODCLK 0x40
129 
130 //*****************************************************************************
131 //
132 // The following are values that can be passed to the param parameter for
133 // functions: EUSCI_A_UART_init().
134 //
135 //*****************************************************************************
136 #define EUSCI_A_UART_ONE_STOP_BIT 0x00
137 #define EUSCI_A_UART_TWO_STOP_BITS UCSPB
138 
139 //*****************************************************************************
140 //
141 // The following are values that can be passed to the param parameter for
142 // functions: EUSCI_A_UART_init().
143 //
144 //*****************************************************************************
145 #define EUSCI_A_UART_OVERSAMPLING_BAUDRATE_GENERATION 0x01
146 #define EUSCI_A_UART_LOW_FREQUENCY_BAUDRATE_GENERATION 0x00
147 
148 //*****************************************************************************
149 //
150 // The following are values that can be passed to the mask parameter for
151 // functions: EUSCI_A_UART_enableInterrupt(), and
152 // EUSCI_A_UART_disableInterrupt().
153 //
154 //*****************************************************************************
155 #define EUSCI_A_UART_RECEIVE_INTERRUPT UCRXIE
156 #define EUSCI_A_UART_TRANSMIT_INTERRUPT UCTXIE
157 #define EUSCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT UCRXEIE
158 #define EUSCI_A_UART_BREAKCHAR_INTERRUPT UCBRKIE
159 #define EUSCI_A_UART_STARTBIT_INTERRUPT UCSTTIE
160 #define EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT UCTXCPTIE
161 
162 //*****************************************************************************
163 //
164 // The following are values that can be passed to the mask parameter for
165 // functions: EUSCI_A_UART_getInterruptStatus(), and
166 // EUSCI_A_UART_clearInterrupt() as well as returned by the
167 // EUSCI_A_UART_getInterruptStatus() function.
168 //
169 //*****************************************************************************
170 #define EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG UCRXIFG
171 #define EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG UCTXIFG
172 #define EUSCI_A_UART_STARTBIT_INTERRUPT_FLAG UCSTTIFG
173 #define EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT_FLAG UCTXCPTIFG
174 
175 //*****************************************************************************
176 //
177 // The following are values that can be passed to the mask parameter for
178 // functions: EUSCI_A_UART_queryStatusFlags() as well as returned by the
179 // EUSCI_A_UART_queryStatusFlags() function.
180 //
181 //*****************************************************************************
182 #define EUSCI_A_UART_LISTEN_ENABLE UCLISTEN
183 #define EUSCI_A_UART_FRAMING_ERROR UCFE
184 #define EUSCI_A_UART_OVERRUN_ERROR UCOE
185 #define EUSCI_A_UART_PARITY_ERROR UCPE
186 #define EUSCI_A_UART_BREAK_DETECT UCBRK
187 #define EUSCI_A_UART_RECEIVE_ERROR UCRXERR
188 #define EUSCI_A_UART_ADDRESS_RECEIVED UCADDR
189 #define EUSCI_A_UART_IDLELINE UCIDLE
190 #define EUSCI_A_UART_BUSY UCBUSY
191 
192 //*****************************************************************************
193 //
194 // The following are values that can be passed to the deglitchTime parameter
195 // for functions: EUSCI_A_UART_selectDeglitchTime().
196 //
197 //*****************************************************************************
198 #define EUSCI_A_UART_DEGLITCH_TIME_2ns 0x00
199 #define EUSCI_A_UART_DEGLITCH_TIME_50ns UCGLIT0
200 #define EUSCI_A_UART_DEGLITCH_TIME_100ns UCGLIT1
201 #define EUSCI_A_UART_DEGLITCH_TIME_200ns (UCGLIT0 + UCGLIT1)
202 
203 //*****************************************************************************
204 //
205 // The following are values that can be passed to the pinsSelect parameter for
206 // functions: EUSCI_A_UART_remapPins().
207 //
208 //*****************************************************************************
209 #define EUSCI_A_UART_REMAP_PINS_FALSE (0x0000)
210 #define EUSCI_A_UART_REMAP_PINS_TRUE (USCIARMP)
211 
212 //*****************************************************************************
213 //
214 // Prototypes for the APIs.
215 //
216 //*****************************************************************************
217 
218 //*****************************************************************************
219 //
220 //! \brief Advanced initialization routine for the UART block. The values to be
221 //! written into the clockPrescalar, firstModReg, secondModReg and overSampling
222 //! parameters should be pre-computed and passed into the initialization
223 //! function.
224 //!
225 //! Upon successful initialization of the UART block, this function will have
226 //! initialized the module, but the UART block still remains disabled and must
227 //! be enabled with EUSCI_A_UART_enable(). To calculate values for
228 //! clockPrescalar, firstModReg, secondModReg and overSampling please use the
229 //! link below.
230 //!
231 //! http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSP430BaudRateConverter/index.html
232 //!
233 //! \param baseAddress is the base address of the EUSCI_A_UART module.
234 //! \param param is the pointer to struct for initialization.
235 //!
236 //! Modified bits are \b UCPEN, \b UCPAR, \b UCMSB, \b UC7BIT, \b UCSPB, \b
237 //! UCMODEx and \b UCSYNC of \b UCAxCTL0 register; bits \b UCSSELx and \b
238 //! UCSWRST of \b UCAxCTL1 register.
239 //!
240 //! \return STATUS_SUCCESS or STATUS_FAIL of the initialization process
241 //
242 //*****************************************************************************
243 extern bool EUSCI_A_UART_init(uint16_t baseAddress,
244  EUSCI_A_UART_initParam *param);
245 
246 //*****************************************************************************
247 //
248 //! \brief Transmits a byte from the UART Module.Please note that if TX
249 //! interrupt is disabled, this function manually polls the TX IFG flag waiting
250 //! for an indication that it is safe to write to the transmit buffer and does
251 //! not time-out
252 //!
253 //! This function will place the supplied data into UART transmit data register
254 //! to start transmission
255 //!
256 //! \param baseAddress is the base address of the EUSCI_A_UART module.
257 //! \param transmitData data to be transmitted from the UART module
258 //!
259 //! Modified bits of \b UCAxTXBUF register.
260 //!
261 //! \return None
262 //
263 //*****************************************************************************
264 extern void EUSCI_A_UART_transmitData(uint16_t baseAddress,
265  uint8_t transmitData);
266 
267 //*****************************************************************************
268 //
269 //! \brief Receives a byte that has been sent to the UART Module.
270 //!
271 //! This function reads a byte of data from the UART receive data Register.
272 //!
273 //! \param baseAddress is the base address of the EUSCI_A_UART module.
274 //!
275 //! Modified bits of \b UCAxRXBUF register.
276 //!
277 //! \return Returns the byte received from by the UART module, cast as an
278 //! uint8_t.
279 //
280 //*****************************************************************************
281 extern uint8_t EUSCI_A_UART_receiveData(uint16_t baseAddress);
282 
283 //*****************************************************************************
284 //
285 //! \brief Enables individual UART interrupt sources.
286 //!
287 //! Enables the indicated UART interrupt sources. The interrupt flag is first
288 //! and then the corresponding interrupt is enabled. Only the sources that are
289 //! enabled can be reflected to the processor interrupt; disabled sources have
290 //! no effect on the processor. Does not clear interrupt flags.
291 //!
292 //! \param baseAddress is the base address of the EUSCI_A_UART module.
293 //! \param mask is the bit mask of the interrupt sources to be enabled.
294 //! Mask value is the logical OR of any of the following:
295 //! - \b EUSCI_A_UART_RECEIVE_INTERRUPT - Receive interrupt
296 //! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT - Transmit interrupt
297 //! - \b EUSCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT - Receive
298 //! erroneous-character interrupt enable
299 //! - \b EUSCI_A_UART_BREAKCHAR_INTERRUPT - Receive break character
300 //! interrupt enable
301 //! - \b EUSCI_A_UART_STARTBIT_INTERRUPT - Start bit received interrupt
302 //! enable
303 //! - \b EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT - Transmit complete
304 //! interrupt enable
305 //!
306 //! Modified bits of \b UCAxCTL1 register and bits of \b UCAxIE register.
307 //!
308 //! \return None
309 //
310 //*****************************************************************************
311 extern void EUSCI_A_UART_enableInterrupt(uint16_t baseAddress,
312  uint8_t mask);
313 
314 //*****************************************************************************
315 //
316 //! \brief Disables individual UART interrupt sources.
317 //!
318 //! Disables the indicated UART interrupt sources. Only the sources that are
319 //! enabled can be reflected to the processor interrupt; disabled sources have
320 //! no effect on the processor.
321 //!
322 //! \param baseAddress is the base address of the EUSCI_A_UART module.
323 //! \param mask is the bit mask of the interrupt sources to be disabled.
324 //! Mask value is the logical OR of any of the following:
325 //! - \b EUSCI_A_UART_RECEIVE_INTERRUPT - Receive interrupt
326 //! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT - Transmit interrupt
327 //! - \b EUSCI_A_UART_RECEIVE_ERRONEOUSCHAR_INTERRUPT - Receive
328 //! erroneous-character interrupt enable
329 //! - \b EUSCI_A_UART_BREAKCHAR_INTERRUPT - Receive break character
330 //! interrupt enable
331 //! - \b EUSCI_A_UART_STARTBIT_INTERRUPT - Start bit received interrupt
332 //! enable
333 //! - \b EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT - Transmit complete
334 //! interrupt enable
335 //!
336 //! Modified bits of \b UCAxCTL1 register and bits of \b UCAxIE register.
337 //!
338 //! \return None
339 //
340 //*****************************************************************************
341 extern void EUSCI_A_UART_disableInterrupt(uint16_t baseAddress,
342  uint8_t mask);
343 
344 //*****************************************************************************
345 //
346 //! \brief Gets the current UART interrupt status.
347 //!
348 //! This returns the interrupt status for the UART module based on which flag
349 //! is passed.
350 //!
351 //! \param baseAddress is the base address of the EUSCI_A_UART module.
352 //! \param mask is the masked interrupt flag status to be returned.
353 //! Mask value is the logical OR of any of the following:
354 //! - \b EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG
355 //! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG
356 //! - \b EUSCI_A_UART_STARTBIT_INTERRUPT_FLAG
357 //! - \b EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT_FLAG
358 //!
359 //! Modified bits of \b UCAxIFG register.
360 //!
361 //! \return Logical OR of any of the following:
362 //! - \b EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG
363 //! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG
364 //! - \b EUSCI_A_UART_STARTBIT_INTERRUPT_FLAG
365 //! - \b EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT_FLAG
366 //! \n indicating the status of the masked flags
367 //
368 //*****************************************************************************
369 extern uint8_t EUSCI_A_UART_getInterruptStatus(uint16_t baseAddress,
370  uint8_t mask);
371 
372 //*****************************************************************************
373 //
374 //! \brief Clears UART interrupt sources.
375 //!
376 //! The UART interrupt source is cleared, so that it no longer asserts. The
377 //! highest interrupt flag is automatically cleared when an interrupt vector
378 //! generator is used.
379 //!
380 //! \param baseAddress is the base address of the EUSCI_A_UART module.
381 //! \param mask is a bit mask of the interrupt sources to be cleared.
382 //! Mask value is the logical OR of any of the following:
383 //! - \b EUSCI_A_UART_RECEIVE_INTERRUPT_FLAG
384 //! - \b EUSCI_A_UART_TRANSMIT_INTERRUPT_FLAG
385 //! - \b EUSCI_A_UART_STARTBIT_INTERRUPT_FLAG
386 //! - \b EUSCI_A_UART_TRANSMIT_COMPLETE_INTERRUPT_FLAG
387 //!
388 //! Modified bits of \b UCAxIFG register.
389 //!
390 //! \return None
391 //
392 //*****************************************************************************
393 extern void EUSCI_A_UART_clearInterrupt(uint16_t baseAddress,
394  uint16_t mask);
395 
396 //*****************************************************************************
397 //
398 //! \brief Enables the UART block.
399 //!
400 //! This will enable operation of the UART block.
401 //!
402 //! \param baseAddress is the base address of the EUSCI_A_UART module.
403 //!
404 //! Modified bits are \b UCSWRST of \b UCAxCTL1 register.
405 //!
406 //! \return None
407 //
408 //*****************************************************************************
409 extern void EUSCI_A_UART_enable(uint16_t baseAddress);
410 
411 //*****************************************************************************
412 //
413 //! \brief Disables the UART block.
414 //!
415 //! This will disable operation of the UART block.
416 //!
417 //! \param baseAddress is the base address of the EUSCI_A_UART module.
418 //!
419 //! Modified bits are \b UCSWRST of \b UCAxCTL1 register.
420 //!
421 //! \return None
422 //
423 //*****************************************************************************
424 extern void EUSCI_A_UART_disable(uint16_t baseAddress);
425 
426 //*****************************************************************************
427 //
428 //! \brief Gets the current UART status flags.
429 //!
430 //! This returns the status for the UART module based on which flag is passed.
431 //!
432 //! \param baseAddress is the base address of the EUSCI_A_UART module.
433 //! \param mask is the masked interrupt flag status to be returned.
434 //! Mask value is the logical OR of any of the following:
435 //! - \b EUSCI_A_UART_LISTEN_ENABLE
436 //! - \b EUSCI_A_UART_FRAMING_ERROR
437 //! - \b EUSCI_A_UART_OVERRUN_ERROR
438 //! - \b EUSCI_A_UART_PARITY_ERROR
439 //! - \b EUSCI_A_UART_BREAK_DETECT
440 //! - \b EUSCI_A_UART_RECEIVE_ERROR
441 //! - \b EUSCI_A_UART_ADDRESS_RECEIVED
442 //! - \b EUSCI_A_UART_IDLELINE
443 //! - \b EUSCI_A_UART_BUSY
444 //!
445 //! Modified bits of \b UCAxSTAT register.
446 //!
447 //! \return Logical OR of any of the following:
448 //! - \b EUSCI_A_UART_LISTEN_ENABLE
449 //! - \b EUSCI_A_UART_FRAMING_ERROR
450 //! - \b EUSCI_A_UART_OVERRUN_ERROR
451 //! - \b EUSCI_A_UART_PARITY_ERROR
452 //! - \b EUSCI_A_UART_BREAK_DETECT
453 //! - \b EUSCI_A_UART_RECEIVE_ERROR
454 //! - \b EUSCI_A_UART_ADDRESS_RECEIVED
455 //! - \b EUSCI_A_UART_IDLELINE
456 //! - \b EUSCI_A_UART_BUSY
457 //! \n indicating the status of the masked interrupt flags
458 //
459 //*****************************************************************************
460 extern uint8_t EUSCI_A_UART_queryStatusFlags(uint16_t baseAddress,
461  uint8_t mask);
462 
463 //*****************************************************************************
464 //
465 //! \brief Sets the UART module in dormant mode
466 //!
467 //! Puts USCI in sleep mode Only characters that are preceded by an idle-line
468 //! or with address bit set UCRXIFG. In UART mode with automatic baud-rate
469 //! detection, only the combination of a break and sync field sets UCRXIFG.
470 //!
471 //! \param baseAddress is the base address of the EUSCI_A_UART module.
472 //!
473 //! Modified bits of \b UCAxCTL1 register.
474 //!
475 //! \return None
476 //
477 //*****************************************************************************
478 extern void EUSCI_A_UART_setDormant(uint16_t baseAddress);
479 
480 //*****************************************************************************
481 //
482 //! \brief Re-enables UART module from dormant mode
483 //!
484 //! Not dormant. All received characters set UCRXIFG.
485 //!
486 //! \param baseAddress is the base address of the EUSCI_A_UART module.
487 //!
488 //! Modified bits are \b UCDORM of \b UCAxCTL1 register.
489 //!
490 //! \return None
491 //
492 //*****************************************************************************
493 extern void EUSCI_A_UART_resetDormant(uint16_t baseAddress);
494 
495 //*****************************************************************************
496 //
497 //! \brief Transmits the next byte to be transmitted marked as address
498 //! depending on selected multiprocessor mode
499 //!
500 //! \param baseAddress is the base address of the EUSCI_A_UART module.
501 //! \param transmitAddress is the next byte to be transmitted
502 //!
503 //! Modified bits of \b UCAxTXBUF register and bits of \b UCAxCTL1 register.
504 //!
505 //! \return None
506 //
507 //*****************************************************************************
508 extern void EUSCI_A_UART_transmitAddress(uint16_t baseAddress,
509  uint8_t transmitAddress);
510 
511 //*****************************************************************************
512 //
513 //! \brief Transmit break.
514 //!
515 //! Transmits a break with the next write to the transmit buffer. In UART mode
516 //! with automatic baud-rate detection,
517 //! EUSCI_A_UART_AUTOMATICBAUDRATE_SYNC(0x55) must be written into UCAxTXBUF to
518 //! generate the required break/sync fields. Otherwise, DEFAULT_SYNC(0x00) must
519 //! be written into the transmit buffer. Also ensures module is ready for
520 //! transmitting the next data.
521 //!
522 //! \param baseAddress is the base address of the EUSCI_A_UART module.
523 //!
524 //! Modified bits of \b UCAxTXBUF register and bits of \b UCAxCTL1 register.
525 //!
526 //! \return None
527 //
528 //*****************************************************************************
529 extern void EUSCI_A_UART_transmitBreak(uint16_t baseAddress);
530 
531 //*****************************************************************************
532 //
533 //! \brief Returns the address of the RX Buffer of the UART for the DMA module.
534 //!
535 //! Returns the address of the UART RX Buffer. This can be used in conjunction
536 //! with the DMA to store the received data directly to memory.
537 //!
538 //! \param baseAddress is the base address of the EUSCI_A_UART module.
539 //!
540 //! \return Address of RX Buffer
541 //
542 //*****************************************************************************
543 extern uint32_t EUSCI_A_UART_getReceiveBufferAddress(uint16_t baseAddress);
544 
545 //*****************************************************************************
546 //
547 //! \brief Returns the address of the TX Buffer of the UART for the DMA module.
548 //!
549 //! Returns the address of the UART TX Buffer. This can be used in conjunction
550 //! with the DMA to obtain transmitted data directly from memory.
551 //!
552 //! \param baseAddress is the base address of the EUSCI_A_UART module.
553 //!
554 //! \return Address of TX Buffer
555 //
556 //*****************************************************************************
557 extern uint32_t EUSCI_A_UART_getTransmitBufferAddress(uint16_t baseAddress);
558 
559 //*****************************************************************************
560 //
561 //! \brief Sets the deglitch time
562 //!
563 //! \param baseAddress is the base address of the EUSCI_A_UART module.
564 //! \param deglitchTime is the selected deglitch time
565 //! Valid values are:
566 //! - \b EUSCI_A_UART_DEGLITCH_TIME_2ns
567 //! - \b EUSCI_A_UART_DEGLITCH_TIME_50ns
568 //! - \b EUSCI_A_UART_DEGLITCH_TIME_100ns
569 //! - \b EUSCI_A_UART_DEGLITCH_TIME_200ns
570 //!
571 //! \return None
572 //
573 //*****************************************************************************
574 extern void EUSCI_A_UART_selectDeglitchTime(uint16_t baseAddress,
575  uint16_t deglitchTime);
576 
577 //*****************************************************************************
578 //
579 //! \brief Remaps eUSCI_A GPIO pins.
580 //!
581 //! Remaps eUSCI_A GPIO pins. After calling this function,
582 //! GPIO_setAsPeripheralModuleFunctionInputPin() or
583 //! GPIO_setAsPeripheralModuleFunctionInputPin() still needs to be invoked to
584 //! set peripheral functions. Caution: this will also remap eusci_a_spi GPIO
585 //! pins.
586 //!
587 //! \param baseAddress is the base address of the EUSCI_A_UART module.
588 //! \param pinsSelect remapping pins to select. Please refer to device specific
589 //! datasheet for remapping pins details.
590 //! Valid values are:
591 //! - \b EUSCI_A_UART_REMAP_PINS_FALSE [Default]
592 //! - \b EUSCI_A_UART_REMAP_PINS_TRUE
593 //!
594 //! \return None
595 //
596 //*****************************************************************************
597 extern void EUSCI_A_UART_remapPins(uint16_t baseAddress,
598  uint8_t pinsSelect);
599 
600 //*****************************************************************************
601 //
602 // The following are deprecated #defines.
603 //
604 //*****************************************************************************
605 #define EUSCI_A_UART_REMAP_PINS_1 EUSCI_A_UART_REMAP_PINS_FALSE
606 #define EUSCI_A_UART_REMAP_PINS_2 EUSCI_A_UART_REMAP_PINS_TRUE
607 
608 //*****************************************************************************
609 //
610 // Mark the end of the C bindings section for C++ compilers.
611 //
612 //*****************************************************************************
613 #ifdef __cplusplus
614 }
615 #endif
616 
617 #endif
618 #endif // __MSP430WARE_EUSCI_A_UART_H__
uint8_t overSampling
Definition: eusci_a_uart.h:85
uint8_t EUSCI_A_UART_receiveData(uint16_t baseAddress)
Receives a byte that has been sent to the UART Module.
Definition: eusci_a_uart.c:93
uint32_t EUSCI_A_UART_getReceiveBufferAddress(uint16_t baseAddress)
Returns the address of the RX Buffer of the UART for the DMA module.
Definition: eusci_a_uart.c:210
uint8_t firstModReg
Definition: eusci_a_uart.h:53
void EUSCI_A_UART_transmitAddress(uint16_t baseAddress, uint8_t transmitAddress)
Transmits the next byte to be transmitted marked as address depending on selected multiprocessor mode...
Definition: eusci_a_uart.c:179
void EUSCI_A_UART_transmitBreak(uint16_t baseAddress)
Transmit break.
Definition: eusci_a_uart.c:189
uint8_t parity
Definition: eusci_a_uart.h:63
uint8_t secondModReg
Definition: eusci_a_uart.h:57
uint16_t clockPrescalar
Is the value to be written into UCBRx bits.
Definition: eusci_a_uart.h:49
bool EUSCI_A_UART_init(uint16_t baseAddress, EUSCI_A_UART_initParam *param)
Advanced initialization routine for the UART block. The values to be written into the clockPrescalar...
Definition: eusci_a_uart.c:21
uint16_t numberofStopBits
Definition: eusci_a_uart.h:73
void EUSCI_A_UART_setDormant(uint16_t baseAddress)
Sets the UART module in dormant mode.
Definition: eusci_a_uart.c:169
void EUSCI_A_UART_transmitData(uint16_t baseAddress, uint8_t transmitData)
Transmits a byte from the UART Module.Please note that if TX interrupt is disabled, this function manually polls the TX IFG flag waiting for an indication that it is safe to write to the transmit buffer and does not time-out.
Definition: eusci_a_uart.c:80
void EUSCI_A_UART_disableInterrupt(uint16_t baseAddress, uint8_t mask)
Disables individual UART interrupt sources.
Definition: eusci_a_uart.c:122
uint16_t msborLsbFirst
Definition: eusci_a_uart.h:68
uint8_t EUSCI_A_UART_getInterruptStatus(uint16_t baseAddress, uint8_t mask)
Gets the current UART interrupt status.
Definition: eusci_a_uart.c:139
void EUSCI_A_UART_clearInterrupt(uint16_t baseAddress, uint16_t mask)
Clears UART interrupt sources.
Definition: eusci_a_uart.c:145
uint32_t EUSCI_A_UART_getTransmitBufferAddress(uint16_t baseAddress)
Returns the address of the TX Buffer of the UART for the DMA module.
Definition: eusci_a_uart.c:215
void EUSCI_A_UART_resetDormant(uint16_t baseAddress)
Re-enables UART module from dormant mode.
Definition: eusci_a_uart.c:174
void EUSCI_A_UART_selectDeglitchTime(uint16_t baseAddress, uint16_t deglitchTime)
Sets the deglitch time.
Definition: eusci_a_uart.c:220
void EUSCI_A_UART_disable(uint16_t baseAddress)
Disables the UART block.
Definition: eusci_a_uart.c:157
void EUSCI_A_UART_enableInterrupt(uint16_t baseAddress, uint8_t mask)
Enables individual UART interrupt sources.
Definition: eusci_a_uart.c:104
uint16_t uartMode
Definition: eusci_a_uart.h:80
Used in the EUSCI_A_UART_init() function as the param parameter.
Definition: eusci_a_uart.h:39
uint8_t selectClockSource
Definition: eusci_a_uart.h:47
void EUSCI_A_UART_remapPins(uint16_t baseAddress, uint8_t pinsSelect)
Remaps eUSCI_A GPIO pins.
Definition: eusci_a_uart.c:229
uint8_t EUSCI_A_UART_queryStatusFlags(uint16_t baseAddress, uint8_t mask)
Gets the current UART status flags.
Definition: eusci_a_uart.c:163
void EUSCI_A_UART_enable(uint16_t baseAddress)
Enables the UART block.
Definition: eusci_a_uart.c:151

Copyright 2020, Texas Instruments Incorporated