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-dev by
Serial.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_H 00017 #define MBED_SERIAL_H 00018 00019 #include "platform.h" 00020 00021 // for 100F6 not implemented (N.S.) 00022 #undef DEVICE_SERIAL_ASYNCH 00023 00024 00025 #if DEVICE_SERIAL 00026 00027 #include "Stream.h" 00028 #include "SerialBase.h" 00029 #include "serial_api.h" 00030 00031 namespace mbed { 00032 00033 /** A serial port (UART) for communication with other serial devices 00034 * 00035 * Can be used for Full Duplex communication, or Simplex by specifying 00036 * one pin as NC (Not Connected) 00037 * 00038 * Example: 00039 * @code 00040 * // Print "Hello World" to the PC 00041 * 00042 * #include "mbed.h" 00043 * 00044 * Serial pc(USBTX, USBRX); 00045 * 00046 * int main() { 00047 * pc.printf("Hello World\n"); 00048 * } 00049 * @endcode 00050 */ 00051 class Serial : public SerialBase, public Stream { 00052 00053 public: 00054 #if DEVICE_SERIAL_ASYNCH 00055 using SerialBase::read; 00056 using SerialBase::write; 00057 #endif 00058 00059 /** Create a Serial port, connected to the specified transmit and receive pins 00060 * 00061 * @param tx Transmit pin 00062 * @param rx Receive pin 00063 * 00064 * @note 00065 * Either tx or rx may be specified as NC if unused 00066 */ 00067 Serial(PinName tx, PinName rx, const char *name=NULL); 00068 00069 protected: 00070 virtual int _getc(); 00071 virtual int _putc(int c); 00072 }; 00073 00074 } // namespace mbed 00075 00076 #endif 00077 00078 #endif
Generated on Wed Jul 13 2022 04:55:01 by
1.7.2
