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