Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
UART9BIT.h@6:64f5dad70ee2, 2019-08-21 (annotated)
- Committer:
- mark.chen@ebn.com.tw
- Date:
- Wed Aug 21 16:27:30 2019 +0800
- Revision:
- 6:64f5dad70ee2
- Parent:
- 5:b97a733f6ed8
- Child:
- 7:af4ceb878eee
Uplaod code 2019/08/21
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| MarkChen | 0:f0f0961f1727 | 1 | /* mbed Microcontroller Library |
| MarkChen | 0:f0f0961f1727 | 2 | * Copyright (c) 2015-2016 Nuvoton |
| MarkChen | 0:f0f0961f1727 | 3 | * |
| MarkChen | 0:f0f0961f1727 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| MarkChen | 0:f0f0961f1727 | 5 | * you may not use this file except in compliance with the License. |
| MarkChen | 0:f0f0961f1727 | 6 | * You may obtain a copy of the License at |
| MarkChen | 0:f0f0961f1727 | 7 | * |
| MarkChen | 0:f0f0961f1727 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| MarkChen | 0:f0f0961f1727 | 9 | * |
| MarkChen | 0:f0f0961f1727 | 10 | * Unless required by applicable law or agreed to in writing, software |
| MarkChen | 0:f0f0961f1727 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| MarkChen | 0:f0f0961f1727 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| MarkChen | 0:f0f0961f1727 | 13 | * See the License for the specific language governing permissions and |
| MarkChen | 0:f0f0961f1727 | 14 | * limitations under the License. |
| MarkChen | 0:f0f0961f1727 | 15 | */ |
| MarkChen | 0:f0f0961f1727 | 16 | |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 17 | #include "mbed.h" |
| MarkChen | 0:f0f0961f1727 | 18 | #ifndef __NU_UART9BIT_H__ |
| MarkChen | 0:f0f0961f1727 | 19 | #define __NU_UART9BIT_H__ |
| MarkChen | 0:f0f0961f1727 | 20 | #if TARGET_NUVOTON |
| MarkChen | 0:f0f0961f1727 | 21 | |
| MarkChen | 0:f0f0961f1727 | 22 | |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 23 | namespace mbed { |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 24 | |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 25 | class UART9BIT : public SerialBase |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 26 | { |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 27 | |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 28 | public: |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 29 | |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 30 | UART9BIT(PinName tx, PinName rx, int baud,bool en9bit); |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 31 | |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 32 | void format(int bits = 9, Parity parity = UART9BIT::None, int stop_bits = 1); |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 33 | void GetUartName(void); |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 34 | int write(const uint16_t *buffer, int length, const event_callback_t &callback, int event = SERIAL_EVENT_TX_COMPLETE); |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 35 | int read(uint16_t *buffer, int length, const event_callback_t &callback, int event = SERIAL_EVENT_RX_COMPLETE, unsigned char char_match = SERIAL_RESERVED_CHAR_MATCH); |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 36 | |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 37 | |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 38 | protected: |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 39 | bool Enable9Bit; |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 40 | void start_read(void *buffer, int buffer_size, char buffer_width, const event_callback_t &callback, int event, unsigned char char_match); |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 41 | void start_write(const void *buffer, int buffer_size, char buffer_width, const event_callback_t &callback, int event); |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 42 | |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 43 | void interrupt_handler_asynch(void); |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 44 | CThunk<UART9BIT> _thunk9_irq; |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 45 | }; |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 46 | |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 47 | } |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 48 | |
| MarkChen | 0:f0f0961f1727 | 49 | |
| MarkChen | 0:f0f0961f1727 | 50 | |
| MarkChen | 0:f0f0961f1727 | 51 | |
| MarkChen | 0:f0f0961f1727 | 52 | #endif /* TARGET_NUVOTON */ |
| MarkChen | 0:f0f0961f1727 | 53 | #endif /* __NU_UART9BIT_H__ */ |