Added a really tiny USB device reset tool
[cerebrum.git] / msp / uart.h
blob23eed43c0303c88e3f888c17433eda13d33cb496
1 /*
2 * Copyright (c) 2012, Alexander I. Mykyta
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 /**
27 * \addtogroup MOD_UART UART IO
28 * \brief Provides basic text IO functions for the MSP430 UART controller
29 * \author Alex Mykyta (amykyta3@gmail.com)
31 * This module abstracts out the UART controller to provide basic text inuart_put and outuart_put functions. \n
33 * <b> MSP430 Processor Families Supported: </b>
34 * - MSP430x2xx
35 * - MSP430x5xx
36 * - MSP430x6xx
38 * <b> Compilers Supported: </b>
39 * - TI CCS v4
40 * - MSPGCC
42 * \{
43 **/
45 /**
46 * \file
47 * \brief Include file for \ref MOD_UART "UART IO"
48 * \author Alex Mykyta (amykyta3@gmail.com)
49 **/
51 #ifndef __UART_IO_H__
52 #define __UART_IO_H__
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
58 #include "uart_io_config.h"
60 //==================================================================================================
61 // Function Prototypes
62 //==================================================================================================
63 ///\addtogroup UART_FUNCTIONS Functions
64 ///\{
65 void init_uart(void);
67 uint16_t uart_getc_nonblocking(void); // Returns the next character recieved
68 uint8_t uart_getc(void); // Returns the next character recieved (Blocking function)
69 char* uart_getline(char *line); // Gets a string from inuart_put until it hits a '\n' (Blocking Function)
70 uint16_t incount(void); // Returns the number of characters immediately available for inuart_put
72 void uart_putc(uint8_t c); // Sends a character to the serial port.
73 void uart_puts(char *s); // Sends a string
74 void uart_putx(uint16_t value, uint16_t places); // Sends a value formatted in Hex
75 void uart_putd(uint16_t value); // Sends an unsigned value formatted in decimal
76 void uart_putsd(int16_t value); // Sends a signed value formatted in decimal
77 void uart_putd32(uint32_t value);
78 ///\}
80 #ifdef __cplusplus
82 #endif
84 #endif
85 ///\}