mbed-drivers
Serial.h
1 /*
2  * Copyright (c) 2006-2016, ARM Limited, All Rights Reserved
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may
6  * not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 #ifndef MBED_SERIAL_H
18 #define MBED_SERIAL_H
19 
20 #include "platform.h"
21 
22 #if DEVICE_SERIAL
23 
24 #include "Stream.h"
25 #include "SerialBase.h"
26 #include "serial_api.h"
27 
28 namespace mbed {
29 
48 class Serial : public SerialBase, public Stream {
49 
50 public:
51 #if DEVICE_SERIAL_ASYNCH
52  using SerialBase::read;
53  using SerialBase::write;
54 #endif
55 
64  Serial(PinName tx, PinName rx, const char *name=NULL);
65 
66 protected:
67  virtual int _getc();
68  virtual int _putc(int c);
69 };
70 
75 Serial& get_stdio_serial();
76 
77 } // namespace mbed
78 
79 #endif
80 
81 #endif
Definition: Serial.h:48
Definition: Stream.h:26
int write(void *buffer, int length, const event_callback_t &callback, int event=SERIAL_EVENT_TX_COMPLETE)
Definition: SerialBase.cpp:115
Definition: SerialBase.h:39
int read(void *buffer, int length, const event_callback_t &callback, int event=SERIAL_EVENT_RX_COMPLETE, unsigned char char_match=SERIAL_RESERVED_CHAR_MATCH)
Definition: SerialBase.cpp:164
Serial(PinName tx, PinName rx, const char *name=NULL)
Definition: Serial.cpp:24
Definition: BusIn.cpp:19