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