help :(

Dependencies:   FFT

Committer:
annieluo2
Date:
Wed Dec 02 18:02:03 2020 +0000
Revision:
0:d6c9b09b4042
boo

Who changed what in which revision?

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