Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-src by
serial_api.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef MBED_SERIAL_API_H 00017 #define MBED_SERIAL_API_H 00018 00019 #include "device.h" 00020 00021 #if DEVICE_SERIAL 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 typedef enum { 00028 ParityNone = 0, 00029 ParityOdd = 1, 00030 ParityEven = 2, 00031 ParityForced1 = 3, 00032 ParityForced0 = 4 00033 } SerialParity; 00034 00035 typedef enum { 00036 RxIrq, 00037 TxIrq 00038 } SerialIrq; 00039 00040 typedef void (*uart_irq_handler)(uint32_t id, SerialIrq event); 00041 00042 typedef struct serial_s serial_t; 00043 00044 void serial_init (serial_t *obj, PinName tx, PinName rx); 00045 void serial_free (serial_t *obj); 00046 void serial_baud (serial_t *obj, int baudrate); 00047 void serial_format (serial_t *obj, int data_bits, SerialParity parity, int stop_bits); 00048 00049 void serial_irq_handler(serial_t *obj, uart_irq_handler handler, uint32_t id); 00050 void serial_irq_set (serial_t *obj, SerialIrq irq, uint32_t enable); 00051 00052 int serial_getc (serial_t *obj); 00053 void serial_putc (serial_t *obj, int c); 00054 int serial_readable (serial_t *obj); 00055 int serial_writable (serial_t *obj); 00056 void serial_clear (serial_t *obj); 00057 00058 void serial_pinout_tx(PinName tx); 00059 00060 #ifdef __cplusplus 00061 } 00062 #endif 00063 00064 #endif 00065 00066 #endif
Generated on Tue Jul 12 2022 13:47:02 by
1.7.2
