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@8:716d4274f7b7, 2019-08-26 (annotated)
- Committer:
- mark.chen@ebn.com.tw
- Date:
- Mon Aug 26 13:33:10 2019 +0800
- Revision:
- 8:716d4274f7b7
- Parent:
- 7:af4ceb878eee
- Child:
- 9:bd6af3d4c651
Update 20190826
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 | 8:716d4274f7b7 | 25 | class UART9BIT : public Serial | 
| 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 | 7:af4ceb878eee | 34 | int GitRxDataLen(void); | 
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 35 | 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 | 36 | 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 | 7:af4ceb878eee | 37 | void SetRxDataLen(size_t len); | 
| mark.chen@ebn.com.tw | 8:716d4274f7b7 | 38 | uint16_t getu16(void); | 
| mark.chen@ebn.com.tw | 8:716d4274f7b7 | 39 | |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 40 | |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 41 | protected: | 
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 42 | bool Enable9Bit; | 
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 43 | 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 | 44 | 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 | 45 | |
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 46 | void interrupt_handler_asynch(void); | 
| mark.chen@ebn.com.tw | 6:64f5dad70ee2 | 47 | CThunk<UART9BIT> _thunk9_irq; | 
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 48 | }; | 
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 49 | |
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 50 | } | 
| mark.chen@ebn.com.tw | 1:9d4632d0b16f | 51 | |
| MarkChen | 0:f0f0961f1727 | 52 | |
| MarkChen | 0:f0f0961f1727 | 53 | |
| MarkChen | 0:f0f0961f1727 | 54 | |
| MarkChen | 0:f0f0961f1727 | 55 | #endif /* TARGET_NUVOTON */ | 
| MarkChen | 0:f0f0961f1727 | 56 | #endif /* __NU_UART9BIT_H__ */ |