meh

Fork of mbed by mbed official

Committer:
ricardobtez
Date:
Tue Apr 05 23:51:21 2016 +0000
Revision:
118:16969dd821af
Parent:
75:dc225afb6914
Child:
98:8ab26030e058
dgdgr

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 66:9c8f0e3462fb 1 /* mbed Microcontroller Library
bogdanm 66:9c8f0e3462fb 2 * Copyright (c) 2006-2013 ARM Limited
bogdanm 66:9c8f0e3462fb 3 *
bogdanm 66:9c8f0e3462fb 4 * Licensed under the Apache License, Version 2.0 (the "License");
bogdanm 66:9c8f0e3462fb 5 * you may not use this file except in compliance with the License.
bogdanm 66:9c8f0e3462fb 6 * You may obtain a copy of the License at
bogdanm 66:9c8f0e3462fb 7 *
bogdanm 66:9c8f0e3462fb 8 * http://www.apache.org/licenses/LICENSE-2.0
bogdanm 66:9c8f0e3462fb 9 *
bogdanm 66:9c8f0e3462fb 10 * Unless required by applicable law or agreed to in writing, software
bogdanm 66:9c8f0e3462fb 11 * distributed under the License is distributed on an "AS IS" BASIS,
bogdanm 66:9c8f0e3462fb 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bogdanm 66:9c8f0e3462fb 13 * See the License for the specific language governing permissions and
bogdanm 66:9c8f0e3462fb 14 * limitations under the License.
bogdanm 66:9c8f0e3462fb 15 */
bogdanm 66:9c8f0e3462fb 16 #ifndef MBED_SERIAL_API_H
bogdanm 66:9c8f0e3462fb 17 #define MBED_SERIAL_API_H
bogdanm 66:9c8f0e3462fb 18
bogdanm 66:9c8f0e3462fb 19 #include "device.h"
bogdanm 66:9c8f0e3462fb 20
bogdanm 66:9c8f0e3462fb 21 #if DEVICE_SERIAL
bogdanm 66:9c8f0e3462fb 22
bogdanm 66:9c8f0e3462fb 23 #ifdef __cplusplus
bogdanm 66:9c8f0e3462fb 24 extern "C" {
bogdanm 66:9c8f0e3462fb 25 #endif
bogdanm 66:9c8f0e3462fb 26
bogdanm 66:9c8f0e3462fb 27 typedef enum {
bogdanm 66:9c8f0e3462fb 28 ParityNone = 0,
bogdanm 66:9c8f0e3462fb 29 ParityOdd = 1,
bogdanm 66:9c8f0e3462fb 30 ParityEven = 2,
bogdanm 66:9c8f0e3462fb 31 ParityForced1 = 3,
bogdanm 66:9c8f0e3462fb 32 ParityForced0 = 4
bogdanm 66:9c8f0e3462fb 33 } SerialParity;
bogdanm 66:9c8f0e3462fb 34
bogdanm 66:9c8f0e3462fb 35 typedef enum {
bogdanm 66:9c8f0e3462fb 36 RxIrq,
bogdanm 66:9c8f0e3462fb 37 TxIrq
bogdanm 66:9c8f0e3462fb 38 } SerialIrq;
bogdanm 66:9c8f0e3462fb 39
bogdanm 75:dc225afb6914 40 typedef enum {
bogdanm 75:dc225afb6914 41 FlowControlNone,
bogdanm 75:dc225afb6914 42 FlowControlRTS,
bogdanm 75:dc225afb6914 43 FlowControlCTS,
bogdanm 75:dc225afb6914 44 FlowControlRTSCTS
bogdanm 75:dc225afb6914 45 } FlowControl;
bogdanm 75:dc225afb6914 46
bogdanm 66:9c8f0e3462fb 47 typedef void (*uart_irq_handler)(uint32_t id, SerialIrq event);
bogdanm 66:9c8f0e3462fb 48
bogdanm 66:9c8f0e3462fb 49 typedef struct serial_s serial_t;
bogdanm 66:9c8f0e3462fb 50
bogdanm 66:9c8f0e3462fb 51 void serial_init (serial_t *obj, PinName tx, PinName rx);
bogdanm 66:9c8f0e3462fb 52 void serial_free (serial_t *obj);
bogdanm 66:9c8f0e3462fb 53 void serial_baud (serial_t *obj, int baudrate);
bogdanm 66:9c8f0e3462fb 54 void serial_format (serial_t *obj, int data_bits, SerialParity parity, int stop_bits);
bogdanm 66:9c8f0e3462fb 55
bogdanm 66:9c8f0e3462fb 56 void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id);
bogdanm 66:9c8f0e3462fb 57 void serial_irq_set (serial_t *obj, SerialIrq irq, uint32_t enable);
bogdanm 66:9c8f0e3462fb 58
bogdanm 66:9c8f0e3462fb 59 int serial_getc (serial_t *obj);
bogdanm 66:9c8f0e3462fb 60 void serial_putc (serial_t *obj, int c);
bogdanm 66:9c8f0e3462fb 61 int serial_readable (serial_t *obj);
bogdanm 66:9c8f0e3462fb 62 int serial_writable (serial_t *obj);
bogdanm 66:9c8f0e3462fb 63 void serial_clear (serial_t *obj);
bogdanm 66:9c8f0e3462fb 64
bogdanm 66:9c8f0e3462fb 65 void serial_break_set (serial_t *obj);
bogdanm 66:9c8f0e3462fb 66 void serial_break_clear(serial_t *obj);
bogdanm 66:9c8f0e3462fb 67
bogdanm 66:9c8f0e3462fb 68 void serial_pinout_tx(PinName tx);
bogdanm 66:9c8f0e3462fb 69
bogdanm 75:dc225afb6914 70 void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow);
bogdanm 75:dc225afb6914 71
bogdanm 66:9c8f0e3462fb 72 #ifdef __cplusplus
bogdanm 66:9c8f0e3462fb 73 }
bogdanm 66:9c8f0e3462fb 74 #endif
bogdanm 66:9c8f0e3462fb 75
bogdanm 66:9c8f0e3462fb 76 #endif
bogdanm 66:9c8f0e3462fb 77
bogdanm 66:9c8f0e3462fb 78 #endif