]>
git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/mbed/hal/serial_api.h
1 /* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef MBED_SERIAL_API_H
17 #define MBED_SERIAL_API_H
47 typedef void (*uart_irq_handler
)(uint32_t id
, SerialIrq event
);
49 typedef struct serial_s serial_t
;
51 void serial_init (serial_t
*obj
, PinName tx
, PinName rx
);
52 void serial_free (serial_t
*obj
);
53 void serial_baud (serial_t
*obj
, int baudrate
);
54 void serial_format (serial_t
*obj
, int data_bits
, SerialParity parity
, int stop_bits
);
56 void serial_irq_handler(serial_t
*obj
, uart_irq_handler handler
, uint32_t id
);
57 void serial_irq_set (serial_t
*obj
, SerialIrq irq
, uint32_t enable
);
59 int serial_getc (serial_t
*obj
);
60 void serial_putc (serial_t
*obj
, int c
);
61 int serial_readable (serial_t
*obj
);
62 int serial_writable (serial_t
*obj
);
63 void serial_clear (serial_t
*obj
);
65 void serial_break_set (serial_t
*obj
);
66 void serial_break_clear(serial_t
*obj
);
68 void serial_pinout_tx(PinName tx
);
70 void serial_set_flow_control(serial_t
*obj
, FlowControl type
, PinName rxflow
, PinName txflow
);