µ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-2023 Liviu Ionescu. All rights reserved.
5 * Copyright (c) 2013-2014 ARM Ltd.
6 *
7 * Permission to use, copy, modify, and/or distribute this software
8 * for any purpose is hereby granted, under the terms of the MIT license.
9 *
10 * If a copy of the license was not distributed with this file, it can
11 * be obtained from https://opensource.org/licenses/mit/.
12 */
13
14/*
15 * The code is inspired by ARM CMSIS Driver_USART.h file, v2.02,
16 * and tries to remain functionally close to the CMSIS specifications.
17 */
18
19#ifndef CMSIS_PLUS_DRIVER_SERIAL_H_
20#define CMSIS_PLUS_DRIVER_SERIAL_H_
21
22// ----------------------------------------------------------------------------
23
24#ifdef __cplusplus
25
26// ----------------------------------------------------------------------------
27
29
30#include <cstdint>
31#include <cstddef>
32
33// ----------------------------------------------------------------------------
34
35#pragma GCC diagnostic push
36#if defined(__clang__)
37#pragma clang diagnostic ignored "-Wc++98-compat"
38#endif
39
40// ----------------------------------------------------------------------------
41
42namespace os
43{
44 namespace driver
45 {
46 // ----------------------------------------------------------------------
47
48 namespace serial
49 {
50 using bit_number_t = uint32_t;
51 using config_t = uint32_t;
52 using config_arg_t = uint32_t;
53 using control_t = uint32_t;
54 using control_arg_t = uint32_t;
55
56 // ****** Serial Control Codes *****
57
58 constexpr bit_number_t CONFIG_Pos = 0;
59 constexpr config_t CONFIG_Msk (0xFFUL << CONFIG_Pos);
60
61 // ----- Serial Control Codes: Mode -----
63 constexpr config_t MODE_ASYNCHRONOUS = (0x01UL << CONFIG_Pos);
64
67
70
72 constexpr config_t MODE_SINGLE_WIRE = (0x04UL << CONFIG_Pos);
73
75 constexpr config_t MODE_IRDA = (0x05UL << CONFIG_Pos);
76
78 constexpr config_t MODE_SMART_CARD = (0x06UL << CONFIG_Pos);
79
80 // ----- Serial Control Codes: Mode Parameters: Data Bits -----
82 constexpr config_t DATA_BITS_Msk = (7UL << DATA_BITS_Pos);
83
85 constexpr config_t DATA_BITS_5 = (5UL << DATA_BITS_Pos);
86
88 constexpr config_t DATA_BITS_6 = (6UL << DATA_BITS_Pos);
89
91 constexpr config_t DATA_BITS_7 = (7UL << DATA_BITS_Pos);
92
94 constexpr config_t DATA_BITS_8 = (0UL << DATA_BITS_Pos);
95
97 constexpr config_t DATA_BITS_9 = (1UL << DATA_BITS_Pos);
98
99 // ----- Serial Control Codes: Mode Parameters: Parity -----
100 constexpr bit_number_t PARITY_Pos = 12;
101 constexpr config_t PARITY_Msk = (3UL << PARITY_Pos);
102
104 constexpr config_t PARITY_NONE = (0UL << PARITY_Pos);
105
107 constexpr config_t PARITY_EVEN = (1UL << PARITY_Pos);
108
110 constexpr config_t PARITY_ODD = (2UL << PARITY_Pos);
111
112 // ----- Serial Control Codes: Mode Parameters: Stop Bits -----
115
117 constexpr config_t STOP_BITS_1 = (0UL << STOP_BITS_Pos);
118
120 constexpr config_t STOP_BITS_2 = (1UL << STOP_BITS_Pos);
121
124
127
128 // ----- Serial Control Codes: Mode Parameters: Flow Control -----
131
134
137
140
143
144 // ----- Serial Control Codes: Mode Parameters: Clock Polarity = (Synchronous mode); -----
145 constexpr bit_number_t CPOL_Pos = 18;
146 constexpr config_t CPOL_Msk = (1UL << CPOL_Pos);
147
149 constexpr config_t CPOL0 = (0UL << CPOL_Pos);
150
152 constexpr config_t CPOL1 = (1UL << CPOL_Pos);
153
154 // ----- Serial Control Codes: Mode Parameters: Clock Phase = (Synchronous mode); -----
155 constexpr bit_number_t CPHA_Pos = 19;
156 constexpr config_t CPHA_Msk = (1UL << CPHA_Pos);
157
159 constexpr config_t CPHA0 = (0UL << CPHA_Pos);
160
162 constexpr config_t CPHA1 = (1UL << CPHA_Pos);
163
164 // ----- Serial Control Codes: Miscellaneous Controls -----
165
167 constexpr config_t DEFAULT_TX_VALUE = (0x10UL << CONFIG_Pos);
168
170 constexpr config_t IRDA_PULSE = (0x11UL << CONFIG_Pos);
171
174
176 constexpr config_t SMART_CARD_CLOCK = (0x13UL << CONFIG_Pos);
177
179 constexpr config_t SMART_CARD_NACK = (0x14UL << CONFIG_Pos);
180
181 // --------------------------------------------------------------------
182 // ----- Commands -----
183
185 : control_t
186 {
187 //
189 enable_tx = (0x15UL << CONFIG_Pos),
190
192 enable_rx = (0x16UL << CONFIG_Pos),
193
195 enable_break = (0x17UL << CONFIG_Pos),
196
198 abort_send = (0x18UL << CONFIG_Pos),
199
201 abort_receive = (0x19UL << CONFIG_Pos),
202
204 abort_transfer = (0x1AUL << CONFIG_Pos),
205
207 disable_tx = (0x25UL << CONFIG_Pos),
208
210 disable_rx = (0x26UL << CONFIG_Pos),
211
213 disable_break = (0x27UL << CONFIG_Pos)
214 };
215
216 // --------------------------------------------------------------------
217 // ****** Serial specific error codes *****
218
221
224
227
230
233
236
239
242
243 // ====================================================================
244 // ***** Serial Status *****
245
246#pragma GCC diagnostic push
247#if defined(__clang__)
248#pragma clang diagnostic ignored "-Wpadded"
249#elif defined(__GNUC__)
250#pragma GCC diagnostic ignored "-Wpadded"
251#endif
252
256 class Status
257 {
258 public:
259
260 bool
261 is_tx_busy (void);
262
263 bool
264 is_rx_busy (void);
265
266 bool
267 is_tx_underflow (void);
268
269 bool
270 is_rx_overflow (void);
271
272 bool
273 is_rx_break (void);
274
275 bool
276 is_rx_framing_error (void);
277
278 bool
279 is_rx_parity_error (void);
280
281 // ------------------------------------------------------------------
282
283 public:
284
285 // For compatibility with ARM CMSIS, these bits should be
286 // exactly in this order.
287
289 bool tx_busy :1;
290
292 bool rx_busy :1;
293
296
298 bool rx_overflow :1;
299
301 bool rx_break :1;
302
305
308 };
309
310#pragma GCC diagnostic pop
311
312 // ====================================================================
313 // ***** Serial Modem Control *****
314
315 using modem_config_t = uint32_t;
316
320 enum class Modem_control
322 {
323 //
324
326 clear_rts,
327
329 set_rts,
330
332 clear_dtr,
333
335 set_dtr
336 };
337
338 // ====================================================================
339
340#pragma GCC diagnostic push
341#if defined(__clang__)
342#pragma clang diagnostic ignored "-Wpadded"
343#elif defined(__GNUC__)
344#pragma GCC diagnostic ignored "-Wpadded"
345#endif
346
351 {
352 public:
353
354 bool
355 is_cts_active (void);
356
357 bool
358 is_dsr_active (void);
359
360 bool
361 is_dcd_active (void);
362
363 bool
364 is_ri_active (void);
365
366 // ------------------------------------------------------------------
367 public:
368
369 // For compatibility with ARM CMSIS, these bits should be
370 // exactly in this order.
371
373 bool cts :1;
374
376 bool dsr :1;
377
379 bool dcd :1;
380
382 bool ri :1;
383 };
384
385#pragma GCC diagnostic pop
386
387 // ====================================================================
388 // ****** Serial Events *****
389
393 enum Event
394 : event_t
395 {
396 //
397
399 send_complete = (1UL << 0),
400
402 receive_complete = (1UL << 1),
403
405 transfer_complete = (1UL << 2),
406
408 tx_complete = (1UL << 3),
409
411 tx_underflow = (1UL << 4),
412
414 rx_overflow = (1UL << 5),
415
417 rx_timeout = (1UL << 6),
418
420 rx_break = (1UL << 7),
421
423 rx_framing_error = (1UL << 8),
424
426 rx_parity_error = (1UL << 9),
427
429 cts = (1UL << 10),
430
432 dsr = (1UL << 11),
433
435 dcd = (1UL << 12),
436
438 ri = (1UL << 13)
439 };
440
441 // ====================================================================
442
443#pragma GCC diagnostic push
444#if defined(__clang__)
445#pragma clang diagnostic ignored "-Wpadded"
446#elif defined(__GNUC__)
447#pragma GCC diagnostic ignored "-Wpadded"
448#endif
449
454 {
455 public:
456
457 // For compatibility with ARM CMSIS, these bits should be
458 // exactly in this order.
459
462
465
468
470 bool single_wire :1;
471
473 bool irda :1;
474
476 bool smart_card :1;
477
480
483
486
489
492
494 bool rts :1;
495
497 bool cts :1;
498
500 bool dtr :1;
501
503 bool dsr :1;
504
506 bool dcd :1;
507
509 bool ri :1;
510
512 bool event_cts :1;
513
515 bool event_dsr :1;
516
518 bool event_dcd :1;
519
521 bool event_ri :1;
522 };
523
524#pragma GCC diagnostic pop
525
526 } /* namespace serial */
527
528 // ======================================================================
529
530#pragma GCC diagnostic push
531#if defined(__clang__)
532#pragma clang diagnostic ignored "-Wpadded"
533#elif defined(__GNUC__)
534#pragma GCC diagnostic ignored "-Wpadded"
535#endif
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:38
Serial & operator=(const Serial &)=delete
virtual return_t do_control(serial::control_t ctrl) noexcept=0
void clean(void) noexcept
Definition serial.cpp:56
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:93
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:48
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:82
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:104
void register_callback(signal_event_t cb_func, const void *cb_object=nullptr) noexcept
Register event callback.
Definition serial.cpp:75
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:454
bool event_dcd
Signal RI change event.
Definition serial.h:518
bool synchronous_slave
supports Single-wire mode
Definition serial.h:467
bool dtr
DSR Line: false=not available, true=available.
Definition serial.h:500
bool dsr
DCD Line: false=not available, true=available.
Definition serial.h:503
bool rts
CTS Line: false=not available, true=available.
Definition serial.h:494
bool event_cts
Signal DSR change event.
Definition serial.h:512
bool event_dsr
Signal DCD change event.
Definition serial.h:515
bool event_rx_timeout
RTS Line: false=not available, true=available.
Definition serial.h:491
bool flow_control_cts
Transmit completed event.
Definition serial.h:485
bool single_wire
supports IrDA mode
Definition serial.h:470
bool smart_card_clock
RTS Flow Control available.
Definition serial.h:479
bool synchronous_master
supports Synchronous Slave mode
Definition serial.h:464
bool irda
supports Smart Card mode
Definition serial.h:473
bool ri
Signal CTS change event.
Definition serial.h:509
bool cts
DTR Line: false=not available, true=available.
Definition serial.h:497
bool asynchronous
< supports Asynchronous mode
Definition serial.h:461
bool smart_card
Smart Card Clock generator available.
Definition serial.h:476
bool event_tx_complete
Signal receive character timeout event.
Definition serial.h:488
bool dcd
RI Line: false=not available, true=available.
Definition serial.h:506
bool flow_control_rts
CTS Flow Control available.
Definition serial.h:482
Serial modem status
Definition serial.h:351
bool dsr
DCD state: true=Active, false=Inactive.
Definition serial.h:376
bool dcd
RI state: true=Active, false=Inactive.
Definition serial.h:379
bool cts
< CTS state: true=Active, false=Inactive
Definition serial.h:373
Serial port status
Definition serial.h:257
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:298
bool tx_busy
< Transmitter busy flag
Definition serial.h:289
bool tx_underflow
Receive data overflow detected (cleared on start of next receive operation)
Definition serial.h:295
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:292
bool rx_framing_error
Parity error detected on receive (cleared on start of next receive operation)
Definition serial.h:304
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:301
uint32_t config_arg_t
Definition serial.h:52
constexpr config_t PARITY_Msk
No Parity = (default);.
Definition serial.h:101
constexpr bit_number_t DATA_BITS_Pos
Definition serial.h:81
constexpr config_t CPHA0
CPHA = 1.
Definition serial.h:159
constexpr config_t FLOW_CONTROL_RTS
CTS Flow Control.
Definition serial.h:136
uint32_t config_t
Definition serial.h:51
constexpr config_t STOP_BITS_2
1.5 Stop bits
Definition serial.h:120
constexpr config_t PARITY_NONE
Even Parity.
Definition serial.h:104
constexpr config_t DATA_BITS_8
9 Data bits
Definition serial.h:94
constexpr config_t DEFAULT_TX_VALUE
< Set default Transmit value = (Synchronous Receive only); arg = value
Definition serial.h:167
constexpr config_t SMART_CARD_NACK
Definition serial.h:179
constexpr config_t DATA_BITS_6
7 Data bits
Definition serial.h:88
constexpr config_t DATA_BITS_9
Definition serial.h:97
constexpr return_t ERROR_MODE
< Specified Mode not supported
Definition serial.h:220
constexpr config_t MODE_IRDA
UART Smart Card; arg = Baudrate.
Definition serial.h:75
constexpr bit_number_t PARITY_Pos
Definition serial.h:100
constexpr config_t CPHA_Msk
CPHA = 0 = (default);.
Definition serial.h:156
constexpr config_t IRDA_PULSE
Set Smart Card Guard Time; arg = number of bit periods.
Definition serial.h:170
constexpr config_t STOP_BITS_1
2 Stop bits
Definition serial.h:117
constexpr config_t DATA_BITS_Msk
5 Data bits
Definition serial.h:82
constexpr config_t MODE_SYNCHRONOUS_MASTER
Synchronous Slave = (external clock signal);.
Definition serial.h:66
constexpr config_t CPOL1
Definition serial.h:152
constexpr config_t DATA_BITS_7
8 Data bits = (default);
Definition serial.h:91
constexpr config_t CPOL_Msk
CPOL = 0 = (default);.
Definition serial.h:146
constexpr config_t FLOW_CONTROL_RTS_CTS
Definition serial.h:142
constexpr config_t FLOW_CONTROL_CTS
RTS/CTS Flow Control.
Definition serial.h:139
constexpr config_t PARITY_EVEN
Odd Parity.
Definition serial.h:107
constexpr config_t DATA_BITS_5
6 Data bit
Definition serial.h:85
constexpr config_t FLOW_CONTROL_Msk
No Flow Control = (default);.
Definition serial.h:130
constexpr config_t CPHA1
Definition serial.h:162
constexpr config_t MODE_ASYNCHRONOUS
< UART = (Asynchronous);; arg = Baudrate
Definition serial.h:63
constexpr config_t SMART_CARD_CLOCK
Smart Card NACK generation; arg: 0=disabled, 1=enabled.
Definition serial.h:176
constexpr config_t MODE_SYNCHRONOUS_SLAVE
UART Single-wire = (half-duplex);; arg = Baudrate.
Definition serial.h:69
constexpr bit_number_t CPHA_Pos
Definition serial.h:155
constexpr return_t ERROR_DATA_BITS
Specified Parity not supported.
Definition serial.h:226
uint32_t modem_config_t
Definition serial.h:315
constexpr config_t MODE_SMART_CARD
Definition serial.h:78
uint32_t control_arg_t
Definition serial.h:54
constexpr bit_number_t CONFIG_Pos
Definition serial.h:58
constexpr config_t CONFIG_Msk(0xFFUL<< CONFIG_Pos)
constexpr config_t FLOW_CONTROL_NONE
RTS Flow Control.
Definition serial.h:133
constexpr return_t ERROR_CPHA
Definition serial.h:241
@ abort_receive
Abort Serial::transfer()
Definition serial.h:201
@ abort_send
Abort Serial::receive()
Definition serial.h:198
@ enable_break
Abort Serial::send()
Definition serial.h:195
@ disable_tx
Disable Receiver.
Definition serial.h:207
@ abort_transfer
Disable Transmitter.
Definition serial.h:204
@ enable_tx
Enable Transmitter.
Definition serial.h:189
@ enable_rx
Enable Continuous Break transmission.
Definition serial.h:192
@ disable_rx
Disable Continuous Break transmission;.
Definition serial.h:210
constexpr bit_number_t STOP_BITS_Pos
Definition serial.h:113
Event
Serial Events.
Definition serial.h:395
@ cts
DSR state changed (optional)
Definition serial.h:429
@ rx_framing_error
Parity error detected on receive.
Definition serial.h:423
@ transfer_complete
Transmit completed (optional)
Definition serial.h:405
@ dsr
DCD state changed (optional)
Definition serial.h:432
@ rx_parity_error
CTS state changed (optional)
Definition serial.h:426
@ rx_break
Framing error detected on receive.
Definition serial.h:420
@ tx_underflow
Receive data overflow.
Definition serial.h:411
@ dcd
RI state changed (optional)
Definition serial.h:435
@ rx_timeout
Break detected on receive.
Definition serial.h:417
@ receive_complete
Transfer completed.
Definition serial.h:402
@ rx_overflow
Receive character timeout (optional)
Definition serial.h:414
@ tx_complete
Transmit data not available (Synchronous Slave)
Definition serial.h:408
@ send_complete
Send completed; however USART may still transmit data.
Definition serial.h:399
constexpr config_t SMART_CARD_GUARD_TIME
Set Smart Card Clock in Hz; arg: 0=Clock not generated.
Definition serial.h:173
constexpr return_t ERROR_BAUDRATE
Specified number of Data bits not supported.
Definition serial.h:223
uint32_t control_t
Definition serial.h:53
constexpr config_t MODE_SINGLE_WIRE
UART IrDA; arg = Baudrate.
Definition serial.h:72
constexpr return_t ERROR_FLOW_CONTROL
Specified Clock Polarity not supported.
Definition serial.h:235
constexpr config_t PARITY_ODD
Definition serial.h:110
constexpr config_t STOP_BITS_Msk
1 Stop bit = (default);
Definition serial.h:114
constexpr return_t ERROR_STOP_BITS
Specified Flow Control not supported.
Definition serial.h:232
constexpr bit_number_t FLOW_CONFIG_Pos
Definition serial.h:129
constexpr config_t STOP_BITS_0_5
Definition serial.h:126
uint32_t bit_number_t
Definition serial.h:50
constexpr config_t STOP_BITS_1_5
0.5 Stop bits
Definition serial.h:123
Modem_control
Configuration to change the serial modem lines.
Definition serial.h:322
constexpr return_t ERROR_CPOL
Specified Clock Phase not supported.
Definition serial.h:238
constexpr return_t ERROR_PARITY
Specified number of Stop bits not supported.
Definition serial.h:229
constexpr config_t CPOL0
CPOL = 1.
Definition serial.h:149
constexpr bit_number_t CPOL_Pos
Definition serial.h:145
constexpr return_t ERROR_SPECIFIC
Definition common.h:66
int32_t return_t
Definition common.h:47
uint32_t event_t
Definition common.h:46
void(* signal_event_t)(const void *object, event_t event)
Definition common.h:69
System namespace.
Standard std namespace.