The official mbed C/C SDK provides the software platform and libraries to build your applications.
Fork of mbed 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 #if DEVICE_SERIAL 00022 00023 #include "Stream.h" 00024 #include "SerialBase.h" 00025 #include "serial_api.h" 00026 00027 namespace mbed { 00028 00029 /** A serial port (UART) for communication with other serial devices 00030 * 00031 * Can be used for Full Duplex communication, or Simplex by specifying 00032 * one pin as NC (Not Connected) 00033 * 00034 * Example: 00035 * @code 00036 * // Print "Hello World" to the PC 00037 * 00038 * #include "mbed.h" 00039 * 00040 * Serial pc(USBTX, USBRX); 00041 * 00042 * int main() { 00043 * pc.printf("Hello World\n"); 00044 * } 00045 * @endcode 00046 */ 00047 class Serial : public SerialBase, public Stream { 00048 00049 public: 00050 /** Create a Serial port, connected to the specified transmit and receive pins 00051 * 00052 * @param tx Transmit pin 00053 * @param rx Receive pin 00054 * 00055 * @note 00056 * Either tx or rx may be specified as NC if unused 00057 */ 00058 Serial(PinName tx, PinName rx, const char *name=NULL); 00059 00060 protected: 00061 virtual int _getc(); 00062 virtual int _putc(int c); 00063 }; 00064 00065 } // namespace mbed 00066 00067 #endif 00068 00069 #endif
Generated on Sat Jul 16 2022 06:59:32 by 1.7.2