NuMaker Transfer data UART to Ethernet
Fork of Serial-to-Ethernet by
BufferSerial/MyUnbufferedSerial.h@9:b300117f3ed7, 20 months ago (annotated)
- Committer:
- cyliang
- Date:
- Mon Mar 06 05:36:05 2023 +0000
- Revision:
- 9:b300117f3ed7
- Parent:
- 6:014b1a469aed
Add M467 serial list
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 1 | /* mbed Microcontroller Library |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 2 | * Copyright (c) 2019 ARM Limited |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 3 | * SPDX-License-Identifier: Apache-2.0 |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 4 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 6 | * you may not use this file except in compliance with the License. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 7 | * You may obtain a copy of the License at |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 8 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 10 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 11 | * Unless required by applicable law or agreed to in writing, software |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 14 | * See the License for the specific language governing permissions and |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 15 | * limitations under the License. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 16 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 17 | #ifndef MBED_MYUNBUFFERED_SERIAL_H |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 18 | #define MBED_MYUNBUFFERED_SERIAL_H |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 19 | #include "mbed.h" |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 20 | #if (MBED_MAJOR_VERSION >= 6) |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 21 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 22 | #include "platform/platform.h" |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 23 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 24 | #if DEVICE_SERIAL || defined(DOXYGEN_ONLY) |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 25 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 26 | #include <cstdarg> |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 27 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 28 | #include "drivers/SerialBase.h" |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 29 | #include "platform/FileHandle.h" |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 30 | #include "platform/mbed_toolchain.h" |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 31 | #include "platform/NonCopyable.h" |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 32 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 33 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 34 | namespace mbed { |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 35 | /** \defgroup drivers-public-api-uart UART |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 36 | * \ingroup drivers-public-api |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 37 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 38 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 39 | /** |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 40 | * \defgroup drivers_MyUnbufferedSerial MyUnbufferedSerial class |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 41 | * \ingroup drivers-public-api-uart |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 42 | * @{ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 43 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 44 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 45 | /** |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 46 | * Class implementation for unbuffered I/O for an interrupt driven application |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 47 | * or one that needs to have more control. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 48 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 49 | class MyUnbufferedSerial: |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 50 | public SerialBase, |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 51 | public FileHandle, |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 52 | private NonCopyable<MyUnbufferedSerial> { |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 53 | public: |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 54 | /** |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 55 | * Create a serial port instance connected to the specified transmit and |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 56 | * receive pins, with the specified baud rate. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 57 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 58 | * @param tx Transmit pin |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 59 | * @param rx Receive pin |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 60 | * @param baud The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 61 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 62 | * @note |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 63 | * Either tx or rx may be specified as NC if unused |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 64 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 65 | MyUnbufferedSerial( |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 66 | PinName tx, |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 67 | PinName rx, |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 68 | int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 69 | ); |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 70 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 71 | /** Create a MyUnbufferedSerial port, connected to the specified transmit and |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 72 | * receive pins, with a particular baud rate. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 73 | * @param static_pinmap reference to structure which holds static pinmap |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 74 | * @param baud The baud rate of the serial port (optional, defaults to |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 75 | * MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 76 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 77 | MyUnbufferedSerial( |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 78 | const serial_pinmap_t &static_pinmap, |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 79 | int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 80 | ); |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 81 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 82 | /** Write the contents of a buffer to a file |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 83 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 84 | * Blocks until all data is written |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 85 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 86 | * @param buffer The buffer to write from |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 87 | * @param size The number of bytes to write |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 88 | * @return The number of bytes written |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 89 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 90 | ssize_t write(const void *buffer, size_t size) override; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 91 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 92 | /** Read the contents of a file into a buffer |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 93 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 94 | * Blocks and reads exactly one character |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 95 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 96 | * @param buffer The buffer to read in to |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 97 | * @param size The number of bytes to read |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 98 | * @return The number of bytes read |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 99 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 100 | ssize_t read(void *buffer, size_t size) override; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 101 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 102 | /** Move the file position to a given offset from from a given location |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 103 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 104 | * Not valid for a device type FileHandle like MyUnbufferedSerial. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 105 | * In case of MyUnbufferedSerial, returns ESPIPE |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 106 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 107 | * @param offset The offset from whence to move to |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 108 | * @param whence The start of where to seek |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 109 | * SEEK_SET to start from beginning of file, |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 110 | * SEEK_CUR to start from current position in file, |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 111 | * SEEK_END to start from end of file |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 112 | * @return The new offset of the file, negative error code on failure |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 113 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 114 | off_t seek(off_t offset, int whence = SEEK_SET) override |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 115 | { |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 116 | return -ESPIPE; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 117 | } |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 118 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 119 | /** Get the size of the file |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 120 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 121 | * @return Size of the file in bytes |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 122 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 123 | off_t size() override |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 124 | { |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 125 | return -EINVAL; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 126 | } |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 127 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 128 | /** Check if the file in an interactive terminal device |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 129 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 130 | * @return True if the file is a terminal |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 131 | * @return False if the file is not a terminal |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 132 | * @return Negative error code on failure |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 133 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 134 | int isatty() override |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 135 | { |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 136 | return true; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 137 | } |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 138 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 139 | /** Close a file |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 140 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 141 | * @return 0 on success, negative error code on failure |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 142 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 143 | int close() override |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 144 | { |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 145 | return 0; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 146 | } |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 147 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 148 | /** Enable or disable input |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 149 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 150 | * Control enabling of device for input. This is primarily intended |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 151 | * for temporary power-saving; the overall ability of the device to operate |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 152 | * for input and/or output may be fixed at creation time, but this call can |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 153 | * allow input to be temporarily disabled to permit power saving without |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 154 | * losing device state. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 155 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 156 | * @param enabled true to enable input, false to disable. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 157 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 158 | * @return 0 on success |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 159 | * @return Negative error code on failure |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 160 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 161 | int enable_input(bool enabled) override; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 162 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 163 | /** Enable or disable output |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 164 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 165 | * Control enabling of device for output. This is primarily intended |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 166 | * for temporary power-saving; the overall ability of the device to operate |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 167 | * for input and/or output may be fixed at creation time, but this call can |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 168 | * allow output to be temporarily disabled to permit power saving without |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 169 | * losing device state. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 170 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 171 | * @param enabled true to enable output, false to disable. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 172 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 173 | * @return 0 on success |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 174 | * @return Negative error code on failure |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 175 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 176 | int enable_output(bool enabled) override; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 177 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 178 | /** Check for poll event flags |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 179 | * Check the events listed in events to see if data can be read or written |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 180 | * without blocking. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 181 | * Call is nonblocking - returns state of events. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 182 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 183 | * @param events bitmask of poll events we're interested in - POLLIN/POLLOUT etc. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 184 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 185 | * @returns bitmask of poll events that have occurred. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 186 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 187 | short poll(short events) const override; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 188 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 189 | using SerialBase::attach; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 190 | using SerialBase::baud; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 191 | using SerialBase::format; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 192 | using SerialBase::readable; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 193 | using SerialBase::writeable; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 194 | using SerialBase::IrqCnt; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 195 | using SerialBase::RxIrq; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 196 | using SerialBase::TxIrq; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 197 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 198 | #if DEVICE_SERIAL_FC |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 199 | // For now use the base enum - but in future we may have extra options |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 200 | // such as XON/XOFF or manual GPIO RTSCTS. |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 201 | using SerialBase::Flow; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 202 | // In C++11, we wouldn't need to also have using directives for each value |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 203 | using SerialBase::Disabled; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 204 | using SerialBase::RTS; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 205 | using SerialBase::CTS; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 206 | using SerialBase::RTSCTS; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 207 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 208 | /** Set the flow control type on the serial port |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 209 | * |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 210 | * @param type the flow control type (Disabled, RTS, CTS, RTSCTS) |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 211 | * @param flow1 the first flow control pin (RTS for RTS or RTSCTS, CTS for CTS) |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 212 | * @param flow2 the second flow control pin (CTS for RTSCTS) |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 213 | */ |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 214 | void set_flow_control(Flow type, PinName flow1 = NC, PinName flow2 = NC); |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 215 | #endif // DEVICE_SERIAL_FC |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 216 | }; |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 217 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 218 | } // namespace mbed |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 219 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 220 | #endif // DEVICE_SERIAL || defined(DOXYGEN_ONLY) |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 221 | |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 222 | #endif // (MBED_MAJOR_VERSION >= 6 ) |
SHLIU1@OANBE02333.nuvoton.com | 6:014b1a469aed | 223 | #endif // MBED_MYUNBUFFERED_SERIAL_H |