takashi kadono
/
Nucleo_446
Color Oled(SSD1331) connect to STMicroelectronics Nucleo-F466
mbed-os/drivers/UARTSerial.h@0:8fdf9a60065b, 2018-10-10 (annotated)
- Committer:
- kadonotakashi
- Date:
- Wed Oct 10 00:33:53 2018 +0000
- Revision:
- 0:8fdf9a60065b
how to make mbed librry
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kadonotakashi | 0:8fdf9a60065b | 1 | /* mbed Microcontroller Library |
kadonotakashi | 0:8fdf9a60065b | 2 | * Copyright (c) 2006-2017 ARM Limited |
kadonotakashi | 0:8fdf9a60065b | 3 | * |
kadonotakashi | 0:8fdf9a60065b | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
kadonotakashi | 0:8fdf9a60065b | 5 | * you may not use this file except in compliance with the License. |
kadonotakashi | 0:8fdf9a60065b | 6 | * You may obtain a copy of the License at |
kadonotakashi | 0:8fdf9a60065b | 7 | * |
kadonotakashi | 0:8fdf9a60065b | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
kadonotakashi | 0:8fdf9a60065b | 9 | * |
kadonotakashi | 0:8fdf9a60065b | 10 | * Unless required by applicable law or agreed to in writing, software |
kadonotakashi | 0:8fdf9a60065b | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
kadonotakashi | 0:8fdf9a60065b | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
kadonotakashi | 0:8fdf9a60065b | 13 | * See the License for the specific language governing permissions and |
kadonotakashi | 0:8fdf9a60065b | 14 | * limitations under the License. |
kadonotakashi | 0:8fdf9a60065b | 15 | */ |
kadonotakashi | 0:8fdf9a60065b | 16 | |
kadonotakashi | 0:8fdf9a60065b | 17 | #ifndef MBED_UARTSERIAL_H |
kadonotakashi | 0:8fdf9a60065b | 18 | #define MBED_UARTSERIAL_H |
kadonotakashi | 0:8fdf9a60065b | 19 | |
kadonotakashi | 0:8fdf9a60065b | 20 | #include "platform/platform.h" |
kadonotakashi | 0:8fdf9a60065b | 21 | |
kadonotakashi | 0:8fdf9a60065b | 22 | #if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY) |
kadonotakashi | 0:8fdf9a60065b | 23 | |
kadonotakashi | 0:8fdf9a60065b | 24 | #include "platform/FileHandle.h" |
kadonotakashi | 0:8fdf9a60065b | 25 | #include "SerialBase.h" |
kadonotakashi | 0:8fdf9a60065b | 26 | #include "InterruptIn.h" |
kadonotakashi | 0:8fdf9a60065b | 27 | #include "platform/PlatformMutex.h" |
kadonotakashi | 0:8fdf9a60065b | 28 | #include "hal/serial_api.h" |
kadonotakashi | 0:8fdf9a60065b | 29 | #include "platform/CircularBuffer.h" |
kadonotakashi | 0:8fdf9a60065b | 30 | #include "platform/NonCopyable.h" |
kadonotakashi | 0:8fdf9a60065b | 31 | |
kadonotakashi | 0:8fdf9a60065b | 32 | #ifndef MBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE |
kadonotakashi | 0:8fdf9a60065b | 33 | #define MBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE 256 |
kadonotakashi | 0:8fdf9a60065b | 34 | #endif |
kadonotakashi | 0:8fdf9a60065b | 35 | |
kadonotakashi | 0:8fdf9a60065b | 36 | #ifndef MBED_CONF_DRIVERS_UART_SERIAL_TXBUF_SIZE |
kadonotakashi | 0:8fdf9a60065b | 37 | #define MBED_CONF_DRIVERS_UART_SERIAL_TXBUF_SIZE 256 |
kadonotakashi | 0:8fdf9a60065b | 38 | #endif |
kadonotakashi | 0:8fdf9a60065b | 39 | |
kadonotakashi | 0:8fdf9a60065b | 40 | namespace mbed { |
kadonotakashi | 0:8fdf9a60065b | 41 | |
kadonotakashi | 0:8fdf9a60065b | 42 | /** \addtogroup drivers */ |
kadonotakashi | 0:8fdf9a60065b | 43 | |
kadonotakashi | 0:8fdf9a60065b | 44 | /** Class providing buffered UART communication functionality using separate circular buffer for send and receive channels |
kadonotakashi | 0:8fdf9a60065b | 45 | * |
kadonotakashi | 0:8fdf9a60065b | 46 | * @ingroup drivers |
kadonotakashi | 0:8fdf9a60065b | 47 | */ |
kadonotakashi | 0:8fdf9a60065b | 48 | |
kadonotakashi | 0:8fdf9a60065b | 49 | class UARTSerial : private SerialBase, public FileHandle, private NonCopyable<UARTSerial> { |
kadonotakashi | 0:8fdf9a60065b | 50 | |
kadonotakashi | 0:8fdf9a60065b | 51 | public: |
kadonotakashi | 0:8fdf9a60065b | 52 | |
kadonotakashi | 0:8fdf9a60065b | 53 | /** Create a UARTSerial port, connected to the specified transmit and receive pins, with a particular baud rate. |
kadonotakashi | 0:8fdf9a60065b | 54 | * @param tx Transmit pin |
kadonotakashi | 0:8fdf9a60065b | 55 | * @param rx Receive pin |
kadonotakashi | 0:8fdf9a60065b | 56 | * @param baud The baud rate of the serial port (optional, defaults to MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE) |
kadonotakashi | 0:8fdf9a60065b | 57 | */ |
kadonotakashi | 0:8fdf9a60065b | 58 | UARTSerial(PinName tx, PinName rx, int baud = MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE); |
kadonotakashi | 0:8fdf9a60065b | 59 | virtual ~UARTSerial(); |
kadonotakashi | 0:8fdf9a60065b | 60 | |
kadonotakashi | 0:8fdf9a60065b | 61 | /** Equivalent to POSIX poll(). Derived from FileHandle. |
kadonotakashi | 0:8fdf9a60065b | 62 | * Provides a mechanism to multiplex input/output over a set of file handles. |
kadonotakashi | 0:8fdf9a60065b | 63 | */ |
kadonotakashi | 0:8fdf9a60065b | 64 | virtual short poll(short events) const; |
kadonotakashi | 0:8fdf9a60065b | 65 | |
kadonotakashi | 0:8fdf9a60065b | 66 | /* Resolve ambiguities versus our private SerialBase |
kadonotakashi | 0:8fdf9a60065b | 67 | * (for writable, spelling differs, but just in case) |
kadonotakashi | 0:8fdf9a60065b | 68 | */ |
kadonotakashi | 0:8fdf9a60065b | 69 | using FileHandle::readable; |
kadonotakashi | 0:8fdf9a60065b | 70 | using FileHandle::writable; |
kadonotakashi | 0:8fdf9a60065b | 71 | |
kadonotakashi | 0:8fdf9a60065b | 72 | /** Write the contents of a buffer to a file |
kadonotakashi | 0:8fdf9a60065b | 73 | * |
kadonotakashi | 0:8fdf9a60065b | 74 | * Follows POSIX semantics: |
kadonotakashi | 0:8fdf9a60065b | 75 | * |
kadonotakashi | 0:8fdf9a60065b | 76 | * * if blocking, block until all data is written |
kadonotakashi | 0:8fdf9a60065b | 77 | * * if no data can be written, and non-blocking set, return -EAGAIN |
kadonotakashi | 0:8fdf9a60065b | 78 | * * if some data can be written, and non-blocking set, write partial |
kadonotakashi | 0:8fdf9a60065b | 79 | * |
kadonotakashi | 0:8fdf9a60065b | 80 | * @param buffer The buffer to write from |
kadonotakashi | 0:8fdf9a60065b | 81 | * @param length The number of bytes to write |
kadonotakashi | 0:8fdf9a60065b | 82 | * @return The number of bytes written, negative error on failure |
kadonotakashi | 0:8fdf9a60065b | 83 | */ |
kadonotakashi | 0:8fdf9a60065b | 84 | virtual ssize_t write(const void *buffer, size_t length); |
kadonotakashi | 0:8fdf9a60065b | 85 | |
kadonotakashi | 0:8fdf9a60065b | 86 | /** Read the contents of a file into a buffer |
kadonotakashi | 0:8fdf9a60065b | 87 | * |
kadonotakashi | 0:8fdf9a60065b | 88 | * Follows POSIX semantics: |
kadonotakashi | 0:8fdf9a60065b | 89 | * |
kadonotakashi | 0:8fdf9a60065b | 90 | * * if no data is available, and non-blocking set return -EAGAIN |
kadonotakashi | 0:8fdf9a60065b | 91 | * * if no data is available, and blocking set, wait until data is available |
kadonotakashi | 0:8fdf9a60065b | 92 | * * If any data is available, call returns immediately |
kadonotakashi | 0:8fdf9a60065b | 93 | * |
kadonotakashi | 0:8fdf9a60065b | 94 | * @param buffer The buffer to read in to |
kadonotakashi | 0:8fdf9a60065b | 95 | * @param length The number of bytes to read |
kadonotakashi | 0:8fdf9a60065b | 96 | * @return The number of bytes read, 0 at end of file, negative error on failure |
kadonotakashi | 0:8fdf9a60065b | 97 | */ |
kadonotakashi | 0:8fdf9a60065b | 98 | virtual ssize_t read(void *buffer, size_t length); |
kadonotakashi | 0:8fdf9a60065b | 99 | |
kadonotakashi | 0:8fdf9a60065b | 100 | /** Close a file |
kadonotakashi | 0:8fdf9a60065b | 101 | * |
kadonotakashi | 0:8fdf9a60065b | 102 | * @return 0 on success, negative error code on failure |
kadonotakashi | 0:8fdf9a60065b | 103 | */ |
kadonotakashi | 0:8fdf9a60065b | 104 | virtual int close(); |
kadonotakashi | 0:8fdf9a60065b | 105 | |
kadonotakashi | 0:8fdf9a60065b | 106 | /** Check if the file in an interactive terminal device |
kadonotakashi | 0:8fdf9a60065b | 107 | * |
kadonotakashi | 0:8fdf9a60065b | 108 | * @return True if the file is a terminal |
kadonotakashi | 0:8fdf9a60065b | 109 | * @return False if the file is not a terminal |
kadonotakashi | 0:8fdf9a60065b | 110 | * @return Negative error code on failure |
kadonotakashi | 0:8fdf9a60065b | 111 | */ |
kadonotakashi | 0:8fdf9a60065b | 112 | virtual int isatty(); |
kadonotakashi | 0:8fdf9a60065b | 113 | |
kadonotakashi | 0:8fdf9a60065b | 114 | /** Move the file position to a given offset from from a given location |
kadonotakashi | 0:8fdf9a60065b | 115 | * |
kadonotakashi | 0:8fdf9a60065b | 116 | * Not valid for a device type FileHandle like UARTSerial. |
kadonotakashi | 0:8fdf9a60065b | 117 | * In case of UARTSerial, returns ESPIPE |
kadonotakashi | 0:8fdf9a60065b | 118 | * |
kadonotakashi | 0:8fdf9a60065b | 119 | * @param offset The offset from whence to move to |
kadonotakashi | 0:8fdf9a60065b | 120 | * @param whence The start of where to seek |
kadonotakashi | 0:8fdf9a60065b | 121 | * SEEK_SET to start from beginning of file, |
kadonotakashi | 0:8fdf9a60065b | 122 | * SEEK_CUR to start from current position in file, |
kadonotakashi | 0:8fdf9a60065b | 123 | * SEEK_END to start from end of file |
kadonotakashi | 0:8fdf9a60065b | 124 | * @return The new offset of the file, negative error code on failure |
kadonotakashi | 0:8fdf9a60065b | 125 | */ |
kadonotakashi | 0:8fdf9a60065b | 126 | virtual off_t seek(off_t offset, int whence); |
kadonotakashi | 0:8fdf9a60065b | 127 | |
kadonotakashi | 0:8fdf9a60065b | 128 | /** Flush any buffers associated with the file |
kadonotakashi | 0:8fdf9a60065b | 129 | * |
kadonotakashi | 0:8fdf9a60065b | 130 | * @return 0 on success, negative error code on failure |
kadonotakashi | 0:8fdf9a60065b | 131 | */ |
kadonotakashi | 0:8fdf9a60065b | 132 | virtual int sync(); |
kadonotakashi | 0:8fdf9a60065b | 133 | |
kadonotakashi | 0:8fdf9a60065b | 134 | /** Set blocking or non-blocking mode |
kadonotakashi | 0:8fdf9a60065b | 135 | * The default is blocking. |
kadonotakashi | 0:8fdf9a60065b | 136 | * |
kadonotakashi | 0:8fdf9a60065b | 137 | * @param blocking true for blocking mode, false for non-blocking mode. |
kadonotakashi | 0:8fdf9a60065b | 138 | */ |
kadonotakashi | 0:8fdf9a60065b | 139 | virtual int set_blocking(bool blocking) |
kadonotakashi | 0:8fdf9a60065b | 140 | { |
kadonotakashi | 0:8fdf9a60065b | 141 | _blocking = blocking; |
kadonotakashi | 0:8fdf9a60065b | 142 | return 0; |
kadonotakashi | 0:8fdf9a60065b | 143 | } |
kadonotakashi | 0:8fdf9a60065b | 144 | |
kadonotakashi | 0:8fdf9a60065b | 145 | /** Check current blocking or non-blocking mode for file operations. |
kadonotakashi | 0:8fdf9a60065b | 146 | * |
kadonotakashi | 0:8fdf9a60065b | 147 | * @return true for blocking mode, false for non-blocking mode. |
kadonotakashi | 0:8fdf9a60065b | 148 | */ |
kadonotakashi | 0:8fdf9a60065b | 149 | virtual bool is_blocking() const |
kadonotakashi | 0:8fdf9a60065b | 150 | { |
kadonotakashi | 0:8fdf9a60065b | 151 | return _blocking; |
kadonotakashi | 0:8fdf9a60065b | 152 | } |
kadonotakashi | 0:8fdf9a60065b | 153 | |
kadonotakashi | 0:8fdf9a60065b | 154 | /** Register a callback on state change of the file. |
kadonotakashi | 0:8fdf9a60065b | 155 | * |
kadonotakashi | 0:8fdf9a60065b | 156 | * The specified callback will be called on state changes such as when |
kadonotakashi | 0:8fdf9a60065b | 157 | * the file can be written to or read from. |
kadonotakashi | 0:8fdf9a60065b | 158 | * |
kadonotakashi | 0:8fdf9a60065b | 159 | * The callback may be called in an interrupt context and should not |
kadonotakashi | 0:8fdf9a60065b | 160 | * perform expensive operations. |
kadonotakashi | 0:8fdf9a60065b | 161 | * |
kadonotakashi | 0:8fdf9a60065b | 162 | * Note! This is not intended as an attach-like asynchronous api, but rather |
kadonotakashi | 0:8fdf9a60065b | 163 | * as a building block for constructing such functionality. |
kadonotakashi | 0:8fdf9a60065b | 164 | * |
kadonotakashi | 0:8fdf9a60065b | 165 | * The exact timing of when the registered function |
kadonotakashi | 0:8fdf9a60065b | 166 | * is called is not guaranteed and susceptible to change. It should be used |
kadonotakashi | 0:8fdf9a60065b | 167 | * as a cue to make read/write/poll calls to find the current state. |
kadonotakashi | 0:8fdf9a60065b | 168 | * |
kadonotakashi | 0:8fdf9a60065b | 169 | * @param func Function to call on state change |
kadonotakashi | 0:8fdf9a60065b | 170 | */ |
kadonotakashi | 0:8fdf9a60065b | 171 | virtual void sigio(Callback<void()> func); |
kadonotakashi | 0:8fdf9a60065b | 172 | |
kadonotakashi | 0:8fdf9a60065b | 173 | /** Setup interrupt handler for DCD line |
kadonotakashi | 0:8fdf9a60065b | 174 | * |
kadonotakashi | 0:8fdf9a60065b | 175 | * If DCD line is connected, an IRQ handler will be setup. |
kadonotakashi | 0:8fdf9a60065b | 176 | * Does nothing if DCD is NC, i.e., not connected. |
kadonotakashi | 0:8fdf9a60065b | 177 | * |
kadonotakashi | 0:8fdf9a60065b | 178 | * @param dcd_pin Pin-name for DCD |
kadonotakashi | 0:8fdf9a60065b | 179 | * @param active_high a boolean set to true if DCD polarity is active low |
kadonotakashi | 0:8fdf9a60065b | 180 | */ |
kadonotakashi | 0:8fdf9a60065b | 181 | void set_data_carrier_detect(PinName dcd_pin, bool active_high = false); |
kadonotakashi | 0:8fdf9a60065b | 182 | |
kadonotakashi | 0:8fdf9a60065b | 183 | /** Set the baud rate |
kadonotakashi | 0:8fdf9a60065b | 184 | * |
kadonotakashi | 0:8fdf9a60065b | 185 | * @param baud The baud rate |
kadonotakashi | 0:8fdf9a60065b | 186 | */ |
kadonotakashi | 0:8fdf9a60065b | 187 | void set_baud(int baud); |
kadonotakashi | 0:8fdf9a60065b | 188 | |
kadonotakashi | 0:8fdf9a60065b | 189 | // Expose private SerialBase::Parity as UARTSerial::Parity |
kadonotakashi | 0:8fdf9a60065b | 190 | using SerialBase::Parity; |
kadonotakashi | 0:8fdf9a60065b | 191 | // In C++11, we wouldn't need to also have using directives for each value |
kadonotakashi | 0:8fdf9a60065b | 192 | using SerialBase::None; |
kadonotakashi | 0:8fdf9a60065b | 193 | using SerialBase::Odd; |
kadonotakashi | 0:8fdf9a60065b | 194 | using SerialBase::Even; |
kadonotakashi | 0:8fdf9a60065b | 195 | using SerialBase::Forced1; |
kadonotakashi | 0:8fdf9a60065b | 196 | using SerialBase::Forced0; |
kadonotakashi | 0:8fdf9a60065b | 197 | |
kadonotakashi | 0:8fdf9a60065b | 198 | /** Set the transmission format used by the serial port |
kadonotakashi | 0:8fdf9a60065b | 199 | * |
kadonotakashi | 0:8fdf9a60065b | 200 | * @param bits The number of bits in a word (5-8; default = 8) |
kadonotakashi | 0:8fdf9a60065b | 201 | * @param parity The parity used (None, Odd, Even, Forced1, Forced0; default = None) |
kadonotakashi | 0:8fdf9a60065b | 202 | * @param stop_bits The number of stop bits (1 or 2; default = 1) |
kadonotakashi | 0:8fdf9a60065b | 203 | */ |
kadonotakashi | 0:8fdf9a60065b | 204 | void set_format(int bits = 8, Parity parity = UARTSerial::None, int stop_bits = 1); |
kadonotakashi | 0:8fdf9a60065b | 205 | |
kadonotakashi | 0:8fdf9a60065b | 206 | #if DEVICE_SERIAL_FC |
kadonotakashi | 0:8fdf9a60065b | 207 | // For now use the base enum - but in future we may have extra options |
kadonotakashi | 0:8fdf9a60065b | 208 | // such as XON/XOFF or manual GPIO RTSCTS. |
kadonotakashi | 0:8fdf9a60065b | 209 | using SerialBase::Flow; |
kadonotakashi | 0:8fdf9a60065b | 210 | // In C++11, we wouldn't need to also have using directives for each value |
kadonotakashi | 0:8fdf9a60065b | 211 | using SerialBase::Disabled; |
kadonotakashi | 0:8fdf9a60065b | 212 | using SerialBase::RTS; |
kadonotakashi | 0:8fdf9a60065b | 213 | using SerialBase::CTS; |
kadonotakashi | 0:8fdf9a60065b | 214 | using SerialBase::RTSCTS; |
kadonotakashi | 0:8fdf9a60065b | 215 | |
kadonotakashi | 0:8fdf9a60065b | 216 | /** Set the flow control type on the serial port |
kadonotakashi | 0:8fdf9a60065b | 217 | * |
kadonotakashi | 0:8fdf9a60065b | 218 | * @param type the flow control type (Disabled, RTS, CTS, RTSCTS) |
kadonotakashi | 0:8fdf9a60065b | 219 | * @param flow1 the first flow control pin (RTS for RTS or RTSCTS, CTS for CTS) |
kadonotakashi | 0:8fdf9a60065b | 220 | * @param flow2 the second flow control pin (CTS for RTSCTS) |
kadonotakashi | 0:8fdf9a60065b | 221 | */ |
kadonotakashi | 0:8fdf9a60065b | 222 | void set_flow_control(Flow type, PinName flow1 = NC, PinName flow2 = NC); |
kadonotakashi | 0:8fdf9a60065b | 223 | #endif |
kadonotakashi | 0:8fdf9a60065b | 224 | |
kadonotakashi | 0:8fdf9a60065b | 225 | private: |
kadonotakashi | 0:8fdf9a60065b | 226 | |
kadonotakashi | 0:8fdf9a60065b | 227 | void wait_ms(uint32_t millisec); |
kadonotakashi | 0:8fdf9a60065b | 228 | |
kadonotakashi | 0:8fdf9a60065b | 229 | /** SerialBase lock override */ |
kadonotakashi | 0:8fdf9a60065b | 230 | virtual void lock(void); |
kadonotakashi | 0:8fdf9a60065b | 231 | |
kadonotakashi | 0:8fdf9a60065b | 232 | /** SerialBase unlock override */ |
kadonotakashi | 0:8fdf9a60065b | 233 | virtual void unlock(void); |
kadonotakashi | 0:8fdf9a60065b | 234 | |
kadonotakashi | 0:8fdf9a60065b | 235 | /** Acquire mutex */ |
kadonotakashi | 0:8fdf9a60065b | 236 | virtual void api_lock(void); |
kadonotakashi | 0:8fdf9a60065b | 237 | |
kadonotakashi | 0:8fdf9a60065b | 238 | /** Release mutex */ |
kadonotakashi | 0:8fdf9a60065b | 239 | virtual void api_unlock(void); |
kadonotakashi | 0:8fdf9a60065b | 240 | |
kadonotakashi | 0:8fdf9a60065b | 241 | /** Software serial buffers |
kadonotakashi | 0:8fdf9a60065b | 242 | * By default buffer size is 256 for TX and 256 for RX. Configurable through mbed_app.json |
kadonotakashi | 0:8fdf9a60065b | 243 | */ |
kadonotakashi | 0:8fdf9a60065b | 244 | CircularBuffer<char, MBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE> _rxbuf; |
kadonotakashi | 0:8fdf9a60065b | 245 | CircularBuffer<char, MBED_CONF_DRIVERS_UART_SERIAL_TXBUF_SIZE> _txbuf; |
kadonotakashi | 0:8fdf9a60065b | 246 | |
kadonotakashi | 0:8fdf9a60065b | 247 | PlatformMutex _mutex; |
kadonotakashi | 0:8fdf9a60065b | 248 | |
kadonotakashi | 0:8fdf9a60065b | 249 | Callback<void()> _sigio_cb; |
kadonotakashi | 0:8fdf9a60065b | 250 | |
kadonotakashi | 0:8fdf9a60065b | 251 | bool _blocking; |
kadonotakashi | 0:8fdf9a60065b | 252 | bool _tx_irq_enabled; |
kadonotakashi | 0:8fdf9a60065b | 253 | bool _rx_irq_enabled; |
kadonotakashi | 0:8fdf9a60065b | 254 | InterruptIn *_dcd_irq; |
kadonotakashi | 0:8fdf9a60065b | 255 | |
kadonotakashi | 0:8fdf9a60065b | 256 | /** Device Hanged up |
kadonotakashi | 0:8fdf9a60065b | 257 | * Determines if the device hanged up on us. |
kadonotakashi | 0:8fdf9a60065b | 258 | * |
kadonotakashi | 0:8fdf9a60065b | 259 | * @return True, if hanged up |
kadonotakashi | 0:8fdf9a60065b | 260 | */ |
kadonotakashi | 0:8fdf9a60065b | 261 | bool hup() const; |
kadonotakashi | 0:8fdf9a60065b | 262 | |
kadonotakashi | 0:8fdf9a60065b | 263 | /** ISRs for serial |
kadonotakashi | 0:8fdf9a60065b | 264 | * Routines to handle interrupts on serial pins. |
kadonotakashi | 0:8fdf9a60065b | 265 | * Copies data into Circular Buffer. |
kadonotakashi | 0:8fdf9a60065b | 266 | * Reports the state change to File handle. |
kadonotakashi | 0:8fdf9a60065b | 267 | */ |
kadonotakashi | 0:8fdf9a60065b | 268 | void tx_irq(void); |
kadonotakashi | 0:8fdf9a60065b | 269 | void rx_irq(void); |
kadonotakashi | 0:8fdf9a60065b | 270 | |
kadonotakashi | 0:8fdf9a60065b | 271 | void wake(void); |
kadonotakashi | 0:8fdf9a60065b | 272 | |
kadonotakashi | 0:8fdf9a60065b | 273 | void dcd_irq(void); |
kadonotakashi | 0:8fdf9a60065b | 274 | |
kadonotakashi | 0:8fdf9a60065b | 275 | }; |
kadonotakashi | 0:8fdf9a60065b | 276 | } //namespace mbed |
kadonotakashi | 0:8fdf9a60065b | 277 | |
kadonotakashi | 0:8fdf9a60065b | 278 | #endif //(DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY) |
kadonotakashi | 0:8fdf9a60065b | 279 | #endif //MBED_UARTSERIAL_H |