added prescaler for 16 bit pwm in LPC1347 target

Fork of mbed-dev by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Serial.h Source File

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 "PlatformMutex.h"
00026 #include "serial_api.h"
00027 
00028 namespace mbed {
00029 
00030 /** A serial port (UART) for communication with other serial devices
00031  *
00032  * Can be used for Full Duplex communication, or Simplex by specifying
00033  * one pin as NC (Not Connected)
00034  *
00035  * @Note Synchronization level: Thread safe
00036  *
00037  * Example:
00038  * @code
00039  * // Print "Hello World" to the PC
00040  *
00041  * #include "mbed.h"
00042  *
00043  * Serial pc(USBTX, USBRX);
00044  *
00045  * int main() {
00046  *     pc.printf("Hello World\n");
00047  * }
00048  * @endcode
00049  */
00050 class Serial : public SerialBase, public Stream {
00051 
00052 public:
00053 #if DEVICE_SERIAL_ASYNCH
00054     using SerialBase::read;
00055     using SerialBase::write;
00056 #endif
00057 
00058     /** Create a Serial port, connected to the specified transmit and receive pins
00059      *
00060      *  @param tx Transmit pin
00061      *  @param rx Receive pin
00062      *
00063      *  @note
00064      *    Either tx or rx may be specified as NC if unused
00065      */
00066     Serial(PinName tx, PinName rx, const char *name=NULL);
00067 
00068 protected:
00069     virtual int _getc();
00070     virtual int _putc(int c);
00071     virtual void lock();
00072     virtual void unlock();
00073 
00074     PlatformMutex _mutex;
00075 };
00076 
00077 } // namespace mbed
00078 
00079 #endif
00080 
00081 #endif