Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Thu Mar 16 21:58:09 2017 +0900
Revision:
6:40e873bbc5f7
Add licence header info

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 6:40e873bbc5f7 1 /* mbed Microcontroller Library
MACRUM 6:40e873bbc5f7 2 * Copyright (c) 2006-2013 ARM Limited
MACRUM 6:40e873bbc5f7 3 *
MACRUM 6:40e873bbc5f7 4 * Licensed under the Apache License, Version 2.0 (the "License");
MACRUM 6:40e873bbc5f7 5 * you may not use this file except in compliance with the License.
MACRUM 6:40e873bbc5f7 6 * You may obtain a copy of the License at
MACRUM 6:40e873bbc5f7 7 *
MACRUM 6:40e873bbc5f7 8 * http://www.apache.org/licenses/LICENSE-2.0
MACRUM 6:40e873bbc5f7 9 *
MACRUM 6:40e873bbc5f7 10 * Unless required by applicable law or agreed to in writing, software
MACRUM 6:40e873bbc5f7 11 * distributed under the License is distributed on an "AS IS" BASIS,
MACRUM 6:40e873bbc5f7 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MACRUM 6:40e873bbc5f7 13 * See the License for the specific language governing permissions and
MACRUM 6:40e873bbc5f7 14 * limitations under the License.
MACRUM 6:40e873bbc5f7 15 */
MACRUM 6:40e873bbc5f7 16 #ifndef MBED_SERIAL_H
MACRUM 6:40e873bbc5f7 17 #define MBED_SERIAL_H
MACRUM 6:40e873bbc5f7 18
MACRUM 6:40e873bbc5f7 19 #include "platform/platform.h"
MACRUM 6:40e873bbc5f7 20
MACRUM 6:40e873bbc5f7 21 #if DEVICE_SERIAL
MACRUM 6:40e873bbc5f7 22
MACRUM 6:40e873bbc5f7 23 #include "Stream.h"
MACRUM 6:40e873bbc5f7 24 #include "SerialBase.h"
MACRUM 6:40e873bbc5f7 25 #include "PlatformMutex.h"
MACRUM 6:40e873bbc5f7 26 #include "serial_api.h"
MACRUM 6:40e873bbc5f7 27
MACRUM 6:40e873bbc5f7 28 namespace mbed {
MACRUM 6:40e873bbc5f7 29 /** \addtogroup drivers */
MACRUM 6:40e873bbc5f7 30 /** @{*/
MACRUM 6:40e873bbc5f7 31
MACRUM 6:40e873bbc5f7 32 /** A serial port (UART) for communication with other serial devices
MACRUM 6:40e873bbc5f7 33 *
MACRUM 6:40e873bbc5f7 34 * Can be used for Full Duplex communication, or Simplex by specifying
MACRUM 6:40e873bbc5f7 35 * one pin as NC (Not Connected)
MACRUM 6:40e873bbc5f7 36 *
MACRUM 6:40e873bbc5f7 37 * @Note Synchronization level: Thread safe
MACRUM 6:40e873bbc5f7 38 *
MACRUM 6:40e873bbc5f7 39 * Example:
MACRUM 6:40e873bbc5f7 40 * @code
MACRUM 6:40e873bbc5f7 41 * // Print "Hello World" to the PC
MACRUM 6:40e873bbc5f7 42 *
MACRUM 6:40e873bbc5f7 43 * #include "mbed.h"
MACRUM 6:40e873bbc5f7 44 *
MACRUM 6:40e873bbc5f7 45 * Serial pc(USBTX, USBRX);
MACRUM 6:40e873bbc5f7 46 *
MACRUM 6:40e873bbc5f7 47 * int main() {
MACRUM 6:40e873bbc5f7 48 * pc.printf("Hello World\n");
MACRUM 6:40e873bbc5f7 49 * }
MACRUM 6:40e873bbc5f7 50 * @endcode
MACRUM 6:40e873bbc5f7 51 */
MACRUM 6:40e873bbc5f7 52 class Serial : public SerialBase, public Stream {
MACRUM 6:40e873bbc5f7 53
MACRUM 6:40e873bbc5f7 54 public:
MACRUM 6:40e873bbc5f7 55 #if DEVICE_SERIAL_ASYNCH
MACRUM 6:40e873bbc5f7 56 using SerialBase::read;
MACRUM 6:40e873bbc5f7 57 using SerialBase::write;
MACRUM 6:40e873bbc5f7 58 #endif
MACRUM 6:40e873bbc5f7 59
MACRUM 6:40e873bbc5f7 60 /** Create a Serial port, connected to the specified transmit and receive pins
MACRUM 6:40e873bbc5f7 61 *
MACRUM 6:40e873bbc5f7 62 * @param tx Transmit pin
MACRUM 6:40e873bbc5f7 63 * @param rx Receive pin
MACRUM 6:40e873bbc5f7 64 * @param name The name of the stream associated with this serial port (optional)
MACRUM 6:40e873bbc5f7 65 * @param baud The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE)
MACRUM 6:40e873bbc5f7 66 *
MACRUM 6:40e873bbc5f7 67 * @note
MACRUM 6:40e873bbc5f7 68 * Either tx or rx may be specified as NC if unused
MACRUM 6:40e873bbc5f7 69 */
MACRUM 6:40e873bbc5f7 70 Serial(PinName tx, PinName rx, const char *name=NULL, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
MACRUM 6:40e873bbc5f7 71
MACRUM 6:40e873bbc5f7 72
MACRUM 6:40e873bbc5f7 73 /** Create a Serial port, connected to the specified transmit and receive pins, with the specified baud
MACRUM 6:40e873bbc5f7 74 *
MACRUM 6:40e873bbc5f7 75 * @param tx Transmit pin
MACRUM 6:40e873bbc5f7 76 * @param rx Receive pin
MACRUM 6:40e873bbc5f7 77 * @param baud The baud rate of the serial port
MACRUM 6:40e873bbc5f7 78 *
MACRUM 6:40e873bbc5f7 79 * @note
MACRUM 6:40e873bbc5f7 80 * Either tx or rx may be specified as NC if unused
MACRUM 6:40e873bbc5f7 81 */
MACRUM 6:40e873bbc5f7 82 Serial(PinName tx, PinName rx, int baud);
MACRUM 6:40e873bbc5f7 83
MACRUM 6:40e873bbc5f7 84 protected:
MACRUM 6:40e873bbc5f7 85 virtual int _getc();
MACRUM 6:40e873bbc5f7 86 virtual int _putc(int c);
MACRUM 6:40e873bbc5f7 87 virtual void lock();
MACRUM 6:40e873bbc5f7 88 virtual void unlock();
MACRUM 6:40e873bbc5f7 89
MACRUM 6:40e873bbc5f7 90 PlatformMutex _mutex;
MACRUM 6:40e873bbc5f7 91 };
MACRUM 6:40e873bbc5f7 92
MACRUM 6:40e873bbc5f7 93 } // namespace mbed
MACRUM 6:40e873bbc5f7 94
MACRUM 6:40e873bbc5f7 95 #endif
MACRUM 6:40e873bbc5f7 96
MACRUM 6:40e873bbc5f7 97 #endif
MACRUM 6:40e873bbc5f7 98
MACRUM 6:40e873bbc5f7 99 /** @}*/