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_RAW_SERIAL_H
MACRUM 6:40e873bbc5f7 17 #define MBED_RAW_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 "drivers/SerialBase.h"
MACRUM 6:40e873bbc5f7 24 #include "hal/serial_api.h"
MACRUM 6:40e873bbc5f7 25
MACRUM 6:40e873bbc5f7 26 namespace mbed {
MACRUM 6:40e873bbc5f7 27 /** \addtogroup drivers */
MACRUM 6:40e873bbc5f7 28 /** @{*/
MACRUM 6:40e873bbc5f7 29
MACRUM 6:40e873bbc5f7 30 /** A serial port (UART) for communication with other serial devices
MACRUM 6:40e873bbc5f7 31 * This is a variation of the Serial class that doesn't use streams,
MACRUM 6:40e873bbc5f7 32 * thus making it safe to use in interrupt handlers with the RTOS.
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: Not protected
MACRUM 6:40e873bbc5f7 38 *
MACRUM 6:40e873bbc5f7 39 * Example:
MACRUM 6:40e873bbc5f7 40 * @code
MACRUM 6:40e873bbc5f7 41 * // Send a char to the PC
MACRUM 6:40e873bbc5f7 42 *
MACRUM 6:40e873bbc5f7 43 * #include "mbed.h"
MACRUM 6:40e873bbc5f7 44 *
MACRUM 6:40e873bbc5f7 45 * RawSerial pc(USBTX, USBRX);
MACRUM 6:40e873bbc5f7 46 *
MACRUM 6:40e873bbc5f7 47 * int main() {
MACRUM 6:40e873bbc5f7 48 * pc.putc('A');
MACRUM 6:40e873bbc5f7 49 * }
MACRUM 6:40e873bbc5f7 50 * @endcode
MACRUM 6:40e873bbc5f7 51 */
MACRUM 6:40e873bbc5f7 52 class RawSerial: public SerialBase {
MACRUM 6:40e873bbc5f7 53
MACRUM 6:40e873bbc5f7 54 public:
MACRUM 6:40e873bbc5f7 55 /** Create a RawSerial port, connected to the specified transmit and receive pins, with the specified baud.
MACRUM 6:40e873bbc5f7 56 *
MACRUM 6:40e873bbc5f7 57 * @param tx Transmit pin
MACRUM 6:40e873bbc5f7 58 * @param rx Receive pin
MACRUM 6:40e873bbc5f7 59 * @param baud The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE)
MACRUM 6:40e873bbc5f7 60 *
MACRUM 6:40e873bbc5f7 61 * @note
MACRUM 6:40e873bbc5f7 62 * Either tx or rx may be specified as NC if unused
MACRUM 6:40e873bbc5f7 63 */
MACRUM 6:40e873bbc5f7 64 RawSerial(PinName tx, PinName rx, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
MACRUM 6:40e873bbc5f7 65
MACRUM 6:40e873bbc5f7 66 /** Write a char to the serial port
MACRUM 6:40e873bbc5f7 67 *
MACRUM 6:40e873bbc5f7 68 * @param c The char to write
MACRUM 6:40e873bbc5f7 69 *
MACRUM 6:40e873bbc5f7 70 * @returns The written char or -1 if an error occured
MACRUM 6:40e873bbc5f7 71 */
MACRUM 6:40e873bbc5f7 72 int putc(int c);
MACRUM 6:40e873bbc5f7 73
MACRUM 6:40e873bbc5f7 74 /** Read a char from the serial port
MACRUM 6:40e873bbc5f7 75 *
MACRUM 6:40e873bbc5f7 76 * @returns The char read from the serial port
MACRUM 6:40e873bbc5f7 77 */
MACRUM 6:40e873bbc5f7 78 int getc();
MACRUM 6:40e873bbc5f7 79
MACRUM 6:40e873bbc5f7 80 /** Write a string to the serial port
MACRUM 6:40e873bbc5f7 81 *
MACRUM 6:40e873bbc5f7 82 * @param str The string to write
MACRUM 6:40e873bbc5f7 83 *
MACRUM 6:40e873bbc5f7 84 * @returns 0 if the write succeeds, EOF for error
MACRUM 6:40e873bbc5f7 85 */
MACRUM 6:40e873bbc5f7 86 int puts(const char *str);
MACRUM 6:40e873bbc5f7 87
MACRUM 6:40e873bbc5f7 88 int printf(const char *format, ...);
MACRUM 6:40e873bbc5f7 89
MACRUM 6:40e873bbc5f7 90 protected:
MACRUM 6:40e873bbc5f7 91
MACRUM 6:40e873bbc5f7 92 /** Acquire exclusive access to this serial port
MACRUM 6:40e873bbc5f7 93 */
MACRUM 6:40e873bbc5f7 94 virtual void lock(void);
MACRUM 6:40e873bbc5f7 95
MACRUM 6:40e873bbc5f7 96 /** Release exclusive access to this serial port
MACRUM 6:40e873bbc5f7 97 */
MACRUM 6:40e873bbc5f7 98 virtual void unlock(void);
MACRUM 6:40e873bbc5f7 99 };
MACRUM 6:40e873bbc5f7 100
MACRUM 6:40e873bbc5f7 101 } // namespace mbed
MACRUM 6:40e873bbc5f7 102
MACRUM 6:40e873bbc5f7 103 #endif
MACRUM 6:40e873bbc5f7 104
MACRUM 6:40e873bbc5f7 105 #endif
MACRUM 6:40e873bbc5f7 106
MACRUM 6:40e873bbc5f7 107 /** @}*/