µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
serial.h
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ distribution.
3 * (https://github.com/micro-os-plus)
4 * Copyright (c) 2015 Liviu Ionescu.
5 * Copyright (c) 2013-2014 ARM Ltd.
6 *
7 * Permission is hereby granted, free of charge, to any person
8 * obtaining a copy of this software and associated documentation
9 * files (the "Software"), to deal in the Software without
10 * restriction, including without limitation the rights to use,
11 * copy, modify, merge, publish, distribute, sublicense, and/or
12 * sell copies of the Software, and to permit persons to whom
13 * the Software is furnished to do so, subject to the following
14 * conditions:
15 *
16 * The above copyright notice and this permission notice shall be
17 * included in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 * OTHER DEALINGS IN THE SOFTWARE.
27 */
28
29/*
30 * The code is inspired by ARM CMSIS Driver_USART.h file, v2.02,
31 * and tries to remain functionally close to the CMSIS specifications.
32 */
33
34#ifndef CMSIS_PLUS_DRIVER_SERIAL_H_
35#define CMSIS_PLUS_DRIVER_SERIAL_H_
36
37// ----------------------------------------------------------------------------
38
39#ifdef __cplusplus
40
41// ----------------------------------------------------------------------------
42
44
45#include <cstdint>
46#include <cstddef>
47
48// ----------------------------------------------------------------------------
49
50#pragma GCC diagnostic push
51
52#if defined(__clang__)
53#pragma clang diagnostic ignored "-Wc++98-compat"
54#endif
55
56// ----------------------------------------------------------------------------
57
58namespace os
59{
60 namespace driver
61 {
62 // ----------------------------------------------------------------------
63
64 namespace serial
65 {
66 using bit_number_t = uint32_t;
67 using config_t = uint32_t;
68 using config_arg_t = uint32_t;
69 using control_t = uint32_t;
70 using control_arg_t = uint32_t;
71
72 // ****** Serial Control Codes *****
73
74 constexpr bit_number_t CONFIG_Pos = 0;
75 constexpr config_t CONFIG_Msk (0xFFUL << CONFIG_Pos);
76
77 // ----- Serial Control Codes: Mode -----
79 constexpr config_t MODE_ASYNCHRONOUS = (0x01UL << CONFIG_Pos);
80
83
86
88 constexpr config_t MODE_SINGLE_WIRE = (0x04UL << CONFIG_Pos);
89
91 constexpr config_t MODE_IRDA = (0x05UL << CONFIG_Pos);
92
94 constexpr config_t MODE_SMART_CARD = (0x06UL << CONFIG_Pos);
95
96 // ----- Serial Control Codes: Mode Parameters: Data Bits -----
98 constexpr config_t DATA_BITS_Msk = (7UL << DATA_BITS_Pos);
99
101 constexpr config_t DATA_BITS_5 = (5UL << DATA_BITS_Pos);
102
104 constexpr config_t DATA_BITS_6 = (6UL << DATA_BITS_Pos);
105
107 constexpr config_t DATA_BITS_7 = (7UL << DATA_BITS_Pos);
108
110 constexpr config_t DATA_BITS_8 = (0UL << DATA_BITS_Pos);
111
113 constexpr config_t DATA_BITS_9 = (1UL << DATA_BITS_Pos);
114
115 // ----- Serial Control Codes: Mode Parameters: Parity -----
116 constexpr bit_number_t PARITY_Pos = 12;
117 constexpr config_t PARITY_Msk = (3UL << PARITY_Pos);
118
120 constexpr config_t PARITY_NONE = (0UL << PARITY_Pos);
121
123 constexpr config_t PARITY_EVEN = (1UL << PARITY_Pos);
124
126 constexpr config_t PARITY_ODD = (2UL << PARITY_Pos);
127
128 // ----- Serial Control Codes: Mode Parameters: Stop Bits -----
131
133 constexpr config_t STOP_BITS_1 = (0UL << STOP_BITS_Pos);
134
136 constexpr config_t STOP_BITS_2 = (1UL << STOP_BITS_Pos);
137
140
143
144 // ----- Serial Control Codes: Mode Parameters: Flow Control -----
147
150
153
156
159
160 // ----- Serial Control Codes: Mode Parameters: Clock Polarity = (Synchronous mode); -----
161 constexpr bit_number_t CPOL_Pos = 18;
162 constexpr config_t CPOL_Msk = (1UL << CPOL_Pos);
163
165 constexpr config_t CPOL0 = (0UL << CPOL_Pos);
166
168 constexpr config_t CPOL1 = (1UL << CPOL_Pos);
169
170 // ----- Serial Control Codes: Mode Parameters: Clock Phase = (Synchronous mode); -----
171 constexpr bit_number_t CPHA_Pos = 19;
172 constexpr config_t CPHA_Msk = (1UL << CPHA_Pos);
173
175 constexpr config_t CPHA0 = (0UL << CPHA_Pos);
176
178 constexpr config_t CPHA1 = (1UL << CPHA_Pos);
179
180 // ----- Serial Control Codes: Miscellaneous Controls -----
181
183 constexpr config_t DEFAULT_TX_VALUE = (0x10UL << CONFIG_Pos);
184
186 constexpr config_t IRDA_PULSE = (0x11UL << CONFIG_Pos);
187
190
192 constexpr config_t SMART_CARD_CLOCK = (0x13UL << CONFIG_Pos);
193
195 constexpr config_t SMART_CARD_NACK = (0x14UL << CONFIG_Pos);
196
197 // --------------------------------------------------------------------
198 // ----- Commands -----
199
201 : control_t
202 {
203 //
205 enable_tx = (0x15UL << CONFIG_Pos),
206
208 enable_rx = (0x16UL << CONFIG_Pos),
209
211 enable_break = (0x17UL << CONFIG_Pos),
212
214 abort_send = (0x18UL << CONFIG_Pos),
215
217 abort_receive = (0x19UL << CONFIG_Pos),
218
220 abort_transfer = (0x1AUL << CONFIG_Pos),
221
223 disable_tx = (0x25UL << CONFIG_Pos),
224
226 disable_rx = (0x26UL << CONFIG_Pos),
227
229 disable_break = (0x27UL << CONFIG_Pos)
230 };
231
232 // --------------------------------------------------------------------
233 // ****** Serial specific error codes *****
234
237
240
243
246
249
252
255
258
259 // ====================================================================
260 // ***** Serial Status *****
261
262#pragma GCC diagnostic push
263#pragma GCC diagnostic ignored "-Wpadded"
264
268 class Status
269 {
270 public:
271
272 bool
273 is_tx_busy (void);
274
275 bool
276 is_rx_busy (void);
277
278 bool
279 is_tx_underflow (void);
280
281 bool
282 is_rx_overflow (void);
283
284 bool
285 is_rx_break (void);
286
287 bool
288 is_rx_framing_error (void);
289
290 bool
291 is_rx_parity_error (void);
292
293 // ------------------------------------------------------------------
294
295 public:
296
297 // For compatibility with ARM CMSIS, these bits should be
298 // exactly in this order.
299
301 bool tx_busy :1;
302
304 bool rx_busy :1;
305
308
310 bool rx_overflow :1;
311
313 bool rx_break :1;
314
317
320 };
321
322#pragma GCC diagnostic pop
323
324 // ====================================================================
325 // ***** Serial Modem Control *****
326
327 using modem_config_t = uint32_t;
328
332 enum class Modem_control
334 {
335 //
336
338 clear_rts,
339
341 set_rts,
342
344 clear_dtr,
345
347 set_dtr
348 };
349
350 // ====================================================================
351
352#pragma GCC diagnostic push
353#pragma GCC diagnostic ignored "-Wpadded"
354
359 {
360 public:
361
362 bool
363 is_cts_active (void);
364
365 bool
366 is_dsr_active (void);
367
368 bool
369 is_dcd_active (void);
370
371 bool
372 is_ri_active (void);
373
374 // ------------------------------------------------------------------
375 public:
376
377 // For compatibility with ARM CMSIS, these bits should be
378 // exactly in this order.
379
381 bool cts :1;
382
384 bool dsr :1;
385
387 bool dcd :1;
388
390 bool ri :1;
391 };
392
393#pragma GCC diagnostic pop
394
395 // ====================================================================
396 // ****** Serial Events *****
397
401 enum Event
402 : event_t
403 {
404 //
405
407 send_complete = (1UL << 0),
408
410 receive_complete = (1UL << 1),
411
413 transfer_complete = (1UL << 2),
414
416 tx_complete = (1UL << 3),
417
419 tx_underflow = (1UL << 4),
420
422 rx_overflow = (1UL << 5),
423
425 rx_timeout = (1UL << 6),
426
428 rx_break = (1UL << 7),
429
431 rx_framing_error = (1UL << 8),
432
434 rx_parity_error = (1UL << 9),
435
437 cts = (1UL << 10),
438
440 dsr = (1UL << 11),
441
443 dcd = (1UL << 12),
444
446 ri = (1UL << 13)
447 };
448
449 // ====================================================================
450
451#pragma GCC diagnostic push
452#pragma GCC diagnostic ignored "-Wpadded"
453
458 {
459 public:
460
461 // For compatibility with ARM CMSIS, these bits should be
462 // exactly in this order.
463
466
469
472
474 bool single_wire :1;
475
477 bool irda :1;
478
480 bool smart_card :1;
481
484
487
490
493
496
498 bool rts :1;
499
501 bool cts :1;
502
504 bool dtr :1;
505
507 bool dsr :1;
508
510 bool dcd :1;
511
513 bool ri :1;
514
516 bool event_cts :1;
517
519 bool event_dsr :1;
520
522 bool event_dcd :1;
523
525 bool event_ri :1;
526 };
527
528#pragma GCC diagnostic pop
529
530 } /* namespace serial */
531
532 // ======================================================================
533
534#pragma GCC diagnostic push
535#pragma GCC diagnostic ignored "-Wpadded"
536
537 class Serial : public Base
538 {
539
540 public:
541
542 // --------------------------------------------------------------------
543
544 Serial () noexcept;
545
546 Serial (const Serial&) = delete;
547
548 Serial (Serial&&) = delete;
549
550 Serial&
551 operator= (const Serial&) = delete;
552
553 Serial&
554 operator= (Serial&&) = delete;
555
556 virtual
557 ~Serial () noexcept override;
558
559 // --------------------------------------------------------------------
560
568 void
570 const void* cb_object = nullptr) noexcept;
571
572 // --------------------------------------------------------------------
573
578 const serial::Capabilities&
579 get_capabilities (void) noexcept;
580
588 send (const void* data, std::size_t num) noexcept;
589
597 receive (void* data, std::size_t num) noexcept;
598
607 transfer (const void* data_out, void* data_in, std::size_t num) noexcept;
608
613 std::size_t
614 get_tx_count (void) noexcept;
615
620 std::size_t
621 get_rx_count (void) noexcept;
622
630 configure (serial::config_t cfg, serial::config_arg_t arg) noexcept;
631
638 control (serial::control_t ctrl) noexcept;
639
644 serial::Status&
645 get_status (void) noexcept;
646
653 control_modem_line (serial::Modem_control ctrl) noexcept;
654
659 serial::Modem_status&
660 get_modem_status (void) noexcept;
661
668 void
669 signal_event (event_t event) noexcept;
670
671 void
672 clean (void) noexcept;
673
674 protected:
675
676 // ----- To be implemented by derived classes -----
677
678 virtual const serial::Capabilities&
679 do_get_capabilities (void) noexcept = 0;
680
681 virtual return_t
682 do_send (const void* data, std::size_t num) noexcept = 0;
683
684 virtual return_t
685 do_receive (void* data, std::size_t num) noexcept = 0;
686
687 virtual return_t
688 do_transfer (const void* data_out, void* data_in, std::size_t num)
689 noexcept = 0;
690
691 virtual std::size_t
692 do_get_tx_count (void) noexcept = 0;
693
694 virtual std::size_t
695 do_get_rx_count (void) noexcept = 0;
696
697 virtual return_t
698 do_configure (serial::config_t cfg, serial::config_arg_t arg)
699 noexcept = 0;
700
701 virtual return_t
702 do_control (serial::control_t ctrl) noexcept = 0;
703
704 virtual serial::Status&
705 do_get_status (void) noexcept = 0;
706
707 virtual return_t
708 do_control_modem_line (serial::Modem_control ctrl) noexcept = 0;
709
710 virtual serial::Modem_status&
711 do_get_modem_status (void) noexcept = 0;
712
713 protected:
714
717
719 const void* cb_object_;
720
721 serial::Status status_;
722 serial::Modem_status modem_status_;
723
724 };
725
726#pragma GCC diagnostic pop
727
728 // ----------------------------------------------------------------------
729 // ----- Definitions -----
730
731 namespace serial
732 {
733 // --------------------------------------------------------------------
734
735 inline bool
736 Status::is_tx_busy (void)
737 {
738 return tx_busy;
739 }
740
741 inline bool
742 Status::is_rx_busy (void)
743 {
744 return rx_busy;
745 }
746
747 inline bool
748 Status::is_tx_underflow (void)
749 {
750 return tx_underflow;
751 }
752
753 inline bool
754 Status::is_rx_overflow (void)
755 {
756 return rx_overflow;
757 }
758
759 inline bool
760 Status::is_rx_break (void)
761 {
762 return rx_break;
763 }
764
765 inline bool
766 Status::is_rx_framing_error (void)
767 {
768 return rx_framing_error;
769 }
770
771 inline bool
772 Status::is_rx_parity_error (void)
773 {
774 return rx_parity_error;
775 }
776
777 // --------------------------------------------------------------------
778
779 inline bool
780 Modem_status::is_cts_active (void)
781 {
782 return cts;
783 }
784
785 inline bool
786 Modem_status::is_dsr_active (void)
787 {
788 return dsr;
789 }
790
791 inline bool
792 Modem_status::is_dcd_active (void)
793 {
794 return dcd;
795 }
796
797 inline bool
798 Modem_status::is_ri_active (void)
799 {
800 return ri;
801 }
802 } /* namespace serial */
803
804 // ----------------------------------------------------------------------
805
806 inline const serial::Capabilities&
808 {
809 return do_get_capabilities ();
810 }
811
812 inline std::size_t
813 Serial::get_tx_count (void) noexcept
814 {
815 return do_get_tx_count ();
816 }
817
818 inline std::size_t
819 Serial::get_rx_count (void) noexcept
820 {
821 return do_get_rx_count ();
822 }
823
824 inline return_t
826 {
827 return do_configure (cfg, arg);
828 }
829
830 inline return_t
832 {
833 return do_control (ctrl);
834 }
835
836 inline serial::Status&
837 Serial::get_status (void) noexcept
838 {
839 return do_get_status ();
840 }
841
842 inline return_t
844 {
845 return do_control_modem_line (ctrl);
846 }
847
850 {
851 return do_get_modem_status ();
852 }
853
854 inline void /* __attribute__((always_inline)) */
856 {
857 if (cb_func_ != nullptr)
858 {
859 // Forward event to registered callback.
860 cb_func_ (cb_object_, event);
861 }
862 }
863
864 } /* namespace driver */
865} /* namespace os */
866
867
868#pragma GCC diagnostic pop
869
870// ----------------------------------------------------------------------------
871
872#endif /* __cplusplus */
873
874// ----------------------------------------------------------------------------
875
876#endif /* CMSIS_PLUS_DRIVER_SERIAL_H_ */
void signal_event(event_t event) noexcept
Signal serial events.
Definition serial.h:855
serial::Status & get_status(void) noexcept
Get serial port status.
Definition serial.h:837
return_t control(serial::control_t ctrl) noexcept
Control the serial interface.
Definition serial.h:831
serial::Modem_status modem_status_
Definition serial.h:722
virtual serial::Status & do_get_status(void) noexcept=0
Serial() noexcept
Definition serial.cpp:53
Serial & operator=(const Serial &)=delete
virtual return_t do_control(serial::control_t ctrl) noexcept=0
void clean(void) noexcept
Definition serial.cpp:71
return_t control_modem_line(serial::Modem_control ctrl) noexcept
Configure serial modem lines.
Definition serial.h:843
virtual serial::Modem_status & do_get_modem_status(void) noexcept=0
Serial(const Serial &)=delete
const void * cb_object_
Pointer to object instance associated with this driver.
Definition serial.h:719
return_t receive(void *data, std::size_t num) noexcept
Start the serial receiver.
Definition serial.cpp:108
virtual std::size_t do_get_rx_count(void) noexcept=0
virtual return_t do_receive(void *data, std::size_t num) noexcept=0
Serial(Serial &&)=delete
virtual return_t do_configure(serial::config_t cfg, serial::config_arg_t arg) noexcept=0
virtual std::size_t do_get_tx_count(void) noexcept=0
std::size_t get_rx_count(void) noexcept
Get received bytes count.
Definition serial.h:819
return_t configure(serial::config_t cfg, serial::config_arg_t arg) noexcept
Configure the serial interface.
Definition serial.h:825
signal_event_t cb_func_
Pointer to static function that implements the callback.
Definition serial.h:716
virtual ~Serial() noexcept override
Definition serial.cpp:63
virtual return_t do_control_modem_line(serial::Modem_control ctrl) noexcept=0
virtual return_t do_send(const void *data, std::size_t num) noexcept=0
serial::Modem_status & get_modem_status(void) noexcept
Get serial modem lines state.
Definition serial.h:849
std::size_t get_tx_count(void) noexcept
Get transmitted bytes count.
Definition serial.h:813
serial::Status status_
Definition serial.h:721
const serial::Capabilities & get_capabilities(void) noexcept
Get driver capabilities.
Definition serial.h:807
virtual const serial::Capabilities & do_get_capabilities(void) noexcept=0
return_t send(const void *data, std::size_t num) noexcept
Start the serial transmitter.
Definition serial.cpp:97
return_t transfer(const void *data_out, void *data_in, std::size_t num) noexcept
Start sending/receiving data to/from the serial transmitter/receiver.
Definition serial.cpp:119
void register_callback(signal_event_t cb_func, const void *cb_object=nullptr) noexcept
Register event callback.
Definition serial.cpp:90
virtual return_t do_transfer(const void *data_out, void *data_in, std::size_t num) noexcept=0
Serial device driver capabilities.
Definition serial.h:458
bool event_dcd
Signal RI change event.
Definition serial.h:522
bool synchronous_slave
supports Single-wire mode
Definition serial.h:471
bool dtr
DSR Line: false=not available, true=available.
Definition serial.h:504
bool dsr
DCD Line: false=not available, true=available.
Definition serial.h:507
bool rts
CTS Line: false=not available, true=available.
Definition serial.h:498
bool event_cts
Signal DSR change event.
Definition serial.h:516
bool event_dsr
Signal DCD change event.
Definition serial.h:519
bool event_rx_timeout
RTS Line: false=not available, true=available.
Definition serial.h:495
bool flow_control_cts
Transmit completed event.
Definition serial.h:489
bool single_wire
supports IrDA mode
Definition serial.h:474
bool smart_card_clock
RTS Flow Control available.
Definition serial.h:483
bool synchronous_master
supports Synchronous Slave mode
Definition serial.h:468
bool irda
supports Smart Card mode
Definition serial.h:477
bool ri
Signal CTS change event.
Definition serial.h:513
bool cts
DTR Line: false=not available, true=available.
Definition serial.h:501
bool asynchronous
< supports Asynchronous mode
Definition serial.h:465
bool smart_card
Smart Card Clock generator available.
Definition serial.h:480
bool event_tx_complete
Signal receive character timeout event.
Definition serial.h:492
bool dcd
RI Line: false=not available, true=available.
Definition serial.h:510
bool flow_control_rts
CTS Flow Control available.
Definition serial.h:486
Serial modem status
Definition serial.h:359
bool dsr
DCD state: true=Active, false=Inactive.
Definition serial.h:384
bool dcd
RI state: true=Active, false=Inactive.
Definition serial.h:387
bool cts
< CTS state: true=Active, false=Inactive
Definition serial.h:381
Serial port status
Definition serial.h:269
bool is_rx_overflow(void)
Definition serial.h:754
bool rx_overflow
Break detected on receive (cleared on start of next receive operation)
Definition serial.h:310
bool tx_busy
< Transmitter busy flag
Definition serial.h:301
bool tx_underflow
Receive data overflow detected (cleared on start of next receive operation)
Definition serial.h:307
bool is_rx_parity_error(void)
Definition serial.h:772
bool rx_busy
Transmit data underflow detected (cleared on start of next send operation)
Definition serial.h:304
bool rx_framing_error
Parity error detected on receive (cleared on start of next receive operation)
Definition serial.h:316
bool is_rx_framing_error(void)
Definition serial.h:766
bool is_tx_underflow(void)
Definition serial.h:748
bool rx_break
Framing error detected on receive (cleared on start of next receive operation)
Definition serial.h:313
uint32_t config_arg_t
Definition serial.h:68
constexpr config_t PARITY_Msk
No Parity = (default);.
Definition serial.h:117
constexpr bit_number_t DATA_BITS_Pos
Definition serial.h:97
constexpr config_t CPHA0
CPHA = 1.
Definition serial.h:175
constexpr config_t FLOW_CONTROL_RTS
CTS Flow Control.
Definition serial.h:152
uint32_t config_t
Definition serial.h:67
constexpr config_t STOP_BITS_2
1.5 Stop bits
Definition serial.h:136
constexpr config_t PARITY_NONE
Even Parity.
Definition serial.h:120
constexpr config_t DATA_BITS_8
9 Data bits
Definition serial.h:110
constexpr config_t DEFAULT_TX_VALUE
< Set default Transmit value = (Synchronous Receive only); arg = value
Definition serial.h:183
constexpr config_t SMART_CARD_NACK
Definition serial.h:195
constexpr config_t DATA_BITS_6
7 Data bits
Definition serial.h:104
constexpr config_t DATA_BITS_9
Definition serial.h:113
constexpr return_t ERROR_MODE
< Specified Mode not supported
Definition serial.h:236
constexpr config_t MODE_IRDA
UART Smart Card; arg = Baudrate.
Definition serial.h:91
constexpr bit_number_t PARITY_Pos
Definition serial.h:116
constexpr config_t CPHA_Msk
CPHA = 0 = (default);.
Definition serial.h:172
constexpr config_t IRDA_PULSE
Set Smart Card Guard Time; arg = number of bit periods.
Definition serial.h:186
constexpr config_t STOP_BITS_1
2 Stop bits
Definition serial.h:133
constexpr config_t DATA_BITS_Msk
5 Data bits
Definition serial.h:98
constexpr config_t MODE_SYNCHRONOUS_MASTER
Synchronous Slave = (external clock signal);.
Definition serial.h:82
constexpr config_t CPOL1
Definition serial.h:168
constexpr config_t DATA_BITS_7
8 Data bits = (default);
Definition serial.h:107
constexpr config_t CPOL_Msk
CPOL = 0 = (default);.
Definition serial.h:162
constexpr config_t FLOW_CONTROL_RTS_CTS
Definition serial.h:158
constexpr config_t FLOW_CONTROL_CTS
RTS/CTS Flow Control.
Definition serial.h:155
constexpr config_t PARITY_EVEN
Odd Parity.
Definition serial.h:123
constexpr config_t DATA_BITS_5
6 Data bit
Definition serial.h:101
constexpr config_t FLOW_CONTROL_Msk
No Flow Control = (default);.
Definition serial.h:146
constexpr config_t CPHA1
Definition serial.h:178
constexpr config_t MODE_ASYNCHRONOUS
< UART = (Asynchronous);; arg = Baudrate
Definition serial.h:79
constexpr config_t SMART_CARD_CLOCK
Smart Card NACK generation; arg: 0=disabled, 1=enabled.
Definition serial.h:192
constexpr config_t MODE_SYNCHRONOUS_SLAVE
UART Single-wire = (half-duplex);; arg = Baudrate.
Definition serial.h:85
constexpr bit_number_t CPHA_Pos
Definition serial.h:171
constexpr return_t ERROR_DATA_BITS
Specified Parity not supported.
Definition serial.h:242
uint32_t modem_config_t
Definition serial.h:327
constexpr config_t MODE_SMART_CARD
Definition serial.h:94
uint32_t control_arg_t
Definition serial.h:70
constexpr bit_number_t CONFIG_Pos
Definition serial.h:74
constexpr config_t CONFIG_Msk(0xFFUL<< CONFIG_Pos)
constexpr config_t FLOW_CONTROL_NONE
RTS Flow Control.
Definition serial.h:149
constexpr return_t ERROR_CPHA
Definition serial.h:257
@ abort_receive
Abort Serial::transfer()
Definition serial.h:217
@ abort_send
Abort Serial::receive()
Definition serial.h:214
@ enable_break
Abort Serial::send()
Definition serial.h:211
@ disable_tx
Disable Receiver.
Definition serial.h:223
@ abort_transfer
Disable Transmitter.
Definition serial.h:220
@ enable_tx
Enable Transmitter.
Definition serial.h:205
@ enable_rx
Enable Continuous Break transmission.
Definition serial.h:208
@ disable_rx
Disable Continuous Break transmission;.
Definition serial.h:226
constexpr bit_number_t STOP_BITS_Pos
Definition serial.h:129
Event
Serial Events.
Definition serial.h:403
@ cts
DSR state changed (optional)
Definition serial.h:437
@ rx_framing_error
Parity error detected on receive.
Definition serial.h:431
@ transfer_complete
Transmit completed (optional)
Definition serial.h:413
@ dsr
DCD state changed (optional)
Definition serial.h:440
@ rx_parity_error
CTS state changed (optional)
Definition serial.h:434
@ rx_break
Framing error detected on receive.
Definition serial.h:428
@ tx_underflow
Receive data overflow.
Definition serial.h:419
@ dcd
RI state changed (optional)
Definition serial.h:443
@ rx_timeout
Break detected on receive.
Definition serial.h:425
@ receive_complete
Transfer completed.
Definition serial.h:410
@ rx_overflow
Receive character timeout (optional)
Definition serial.h:422
@ tx_complete
Transmit data not available (Synchronous Slave)
Definition serial.h:416
@ send_complete
Send completed; however USART may still transmit data.
Definition serial.h:407
constexpr config_t SMART_CARD_GUARD_TIME
Set Smart Card Clock in Hz; arg: 0=Clock not generated.
Definition serial.h:189
constexpr return_t ERROR_BAUDRATE
Specified number of Data bits not supported.
Definition serial.h:239
uint32_t control_t
Definition serial.h:69
constexpr config_t MODE_SINGLE_WIRE
UART IrDA; arg = Baudrate.
Definition serial.h:88
constexpr return_t ERROR_FLOW_CONTROL
Specified Clock Polarity not supported.
Definition serial.h:251
constexpr config_t PARITY_ODD
Definition serial.h:126
constexpr config_t STOP_BITS_Msk
1 Stop bit = (default);
Definition serial.h:130
constexpr return_t ERROR_STOP_BITS
Specified Flow Control not supported.
Definition serial.h:248
constexpr bit_number_t FLOW_CONFIG_Pos
Definition serial.h:145
constexpr config_t STOP_BITS_0_5
Definition serial.h:142
uint32_t bit_number_t
Definition serial.h:66
constexpr config_t STOP_BITS_1_5
0.5 Stop bits
Definition serial.h:139
Modem_control
Configuration to change the serial modem lines.
Definition serial.h:334
constexpr return_t ERROR_CPOL
Specified Clock Phase not supported.
Definition serial.h:254
constexpr return_t ERROR_PARITY
Specified number of Stop bits not supported.
Definition serial.h:245
constexpr config_t CPOL0
CPOL = 1.
Definition serial.h:165
constexpr bit_number_t CPOL_Pos
Definition serial.h:161
constexpr return_t ERROR_SPECIFIC
Definition common.h:82
int32_t return_t
Definition common.h:63
uint32_t event_t
Definition common.h:62
void(* signal_event_t)(const void *object, event_t event)
Definition common.h:85
System namespace.
Standard std namespace.