The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Wed Feb 20 20:53:29 2019 +0000
Revision:
172:65be27845400
Parent:
171:3a7713b1edbc
mbed library release version 165

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 171:3a7713b1edbc 1 /**
AnnaBridge 171:3a7713b1edbc 2 ******************************************************************************
AnnaBridge 171:3a7713b1edbc 3 * @file uart.h
AnnaBridge 171:3a7713b1edbc 4 * @brief Defines common properties of any UART driver.
AnnaBridge 171:3a7713b1edbc 5 * @internal
AnnaBridge 171:3a7713b1edbc 6 * @author ON Semiconductor
AnnaBridge 171:3a7713b1edbc 7 * $Rev: 2074 $
AnnaBridge 171:3a7713b1edbc 8 * $Date: 2013-07-10 18:06:15 +0530 (Wed, 10 Jul 2013) $
AnnaBridge 171:3a7713b1edbc 9 ******************************************************************************
AnnaBridge 171:3a7713b1edbc 10 * Copyright 2016 Semiconductor Components Industries LLC (d/b/a “ON Semiconductor”).
AnnaBridge 171:3a7713b1edbc 11 * All rights reserved. This software and/or documentation is licensed by ON Semiconductor
AnnaBridge 171:3a7713b1edbc 12 * under limited terms and conditions. The terms and conditions pertaining to the software
AnnaBridge 171:3a7713b1edbc 13 * and/or documentation are available at http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf
AnnaBridge 171:3a7713b1edbc 14 * (“ON Semiconductor Standard Terms and Conditions of Sale, Section 8 Software”) and
AnnaBridge 171:3a7713b1edbc 15 * if applicable the software license agreement. Do not use this software and/or
AnnaBridge 171:3a7713b1edbc 16 * documentation unless you have carefully read and you agree to the limited terms and
AnnaBridge 171:3a7713b1edbc 17 * conditions. By using this software and/or documentation, you agree to the limited
AnnaBridge 171:3a7713b1edbc 18 * terms and conditions.
AnnaBridge 171:3a7713b1edbc 19 *
AnnaBridge 171:3a7713b1edbc 20 * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
AnnaBridge 171:3a7713b1edbc 21 * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
AnnaBridge 171:3a7713b1edbc 22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
AnnaBridge 171:3a7713b1edbc 23 * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL,
AnnaBridge 171:3a7713b1edbc 24 * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
AnnaBridge 171:3a7713b1edbc 25 * @endinternal
AnnaBridge 171:3a7713b1edbc 26 *
AnnaBridge 171:3a7713b1edbc 27 * @details
AnnaBridge 171:3a7713b1edbc 28 * A UART driver must comply to the generic driver template (see driver.h), and
AnnaBridge 171:3a7713b1edbc 29 * more specifically to the character driver template (see char_driver.h). All
AnnaBridge 171:3a7713b1edbc 30 * UART drivers share some properties; defining these is the purpose of this file.
AnnaBridge 171:3a7713b1edbc 31 *
AnnaBridge 171:3a7713b1edbc 32 * The options passed when opening a UART device should at least include the
AnnaBridge 171:3a7713b1edbc 33 * flow control type and the baud rate. These are included in the uart_options_t
AnnaBridge 171:3a7713b1edbc 34 * data type. The type can be extended by a UART driver implementation.
AnnaBridge 171:3a7713b1edbc 35 *
AnnaBridge 171:3a7713b1edbc 36 * The UART driver implementation must make its driver publicly available with
AnnaBridge 171:3a7713b1edbc 37 * an external global variable.
AnnaBridge 171:3a7713b1edbc 38 *
AnnaBridge 171:3a7713b1edbc 39 * @ingroup uart
AnnaBridge 171:3a7713b1edbc 40 */
AnnaBridge 171:3a7713b1edbc 41
AnnaBridge 171:3a7713b1edbc 42 #ifndef UART_H_
AnnaBridge 171:3a7713b1edbc 43 #define UART_H_
AnnaBridge 171:3a7713b1edbc 44
AnnaBridge 171:3a7713b1edbc 45 //#include "char_driver.h"
AnnaBridge 171:3a7713b1edbc 46
AnnaBridge 171:3a7713b1edbc 47 /** Type listing the supported kinds of flow control. */
AnnaBridge 171:3a7713b1edbc 48 typedef enum {
AnnaBridge 171:3a7713b1edbc 49 /** No flow control */
AnnaBridge 171:3a7713b1edbc 50 none,
AnnaBridge 171:3a7713b1edbc 51 /** use hardware CTS (External CPU indicates it is ok for the modem to transmit)
AnnaBridge 171:3a7713b1edbc 52 * and RTS (modem requests to sent to external CPU) flow control.
AnnaBridge 171:3a7713b1edbc 53 */
AnnaBridge 171:3a7713b1edbc 54 rtscts,
AnnaBridge 171:3a7713b1edbc 55 /** use hardware CTS/RTS flow control, but CTS is no response to RTS,
AnnaBridge 171:3a7713b1edbc 56 * RTS and CTS are used to indicate intent to transmit.
AnnaBridge 171:3a7713b1edbc 57 */
AnnaBridge 171:3a7713b1edbc 58 rtscts_e
AnnaBridge 171:3a7713b1edbc 59 } flow_control_t;
AnnaBridge 171:3a7713b1edbc 60
AnnaBridge 171:3a7713b1edbc 61 /** A set of options to be passed when creating a uart device instance. */
AnnaBridge 171:3a7713b1edbc 62 typedef struct uart_options {
AnnaBridge 171:3a7713b1edbc 63 uint32_t baudrate; /**< The expected baud rate. */
AnnaBridge 171:3a7713b1edbc 64 flow_control_t control;/**< Defines type of flow control, none or rtscts */
AnnaBridge 171:3a7713b1edbc 65 } uart_options_t, *uart_options_pt;
AnnaBridge 171:3a7713b1edbc 66
AnnaBridge 171:3a7713b1edbc 67 #endif /* UART_H_ */