µOS++ IIIe Reference  v6.3.15
“Perfekt ist nicht gut genug”
The third edition of µOS++, a POSIX inspired open source system, written in C++.
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 
42 
43 #include <cstdint>
44 #include <cstddef>
45 
46 namespace os
47 {
48  namespace driver
49  {
50  // ----------------------------------------------------------------------
51 
52  namespace serial
53  {
54  using bit_number_t = uint32_t;
55  using config_t = uint32_t;
56  using config_arg_t = uint32_t;
57  using control_t = uint32_t;
58  using control_arg_t = uint32_t;
59 
60  // ****** Serial Control Codes *****
61 
62  constexpr bit_number_t CONFIG_Pos = 0;
63  constexpr config_t CONFIG_Msk (0xFFUL << CONFIG_Pos);
64 
65  // ----- Serial Control Codes: Mode -----
67  constexpr config_t MODE_ASYNCHRONOUS = (0x01UL << CONFIG_Pos);
68 
70  constexpr config_t MODE_SYNCHRONOUS_MASTER = (0x02UL << CONFIG_Pos);
71 
73  constexpr config_t MODE_SYNCHRONOUS_SLAVE = (0x03UL << CONFIG_Pos);
74 
76  constexpr config_t MODE_SINGLE_WIRE = (0x04UL << CONFIG_Pos);
77 
79  constexpr config_t MODE_IRDA = (0x05UL << CONFIG_Pos);
80 
82  constexpr config_t MODE_SMART_CARD = (0x06UL << CONFIG_Pos);
83 
84  // ----- Serial Control Codes: Mode Parameters: Data Bits -----
85  constexpr bit_number_t DATA_BITS_Pos = 8;
86  constexpr config_t DATA_BITS_Msk = (7UL << DATA_BITS_Pos);
87 
89  constexpr config_t DATA_BITS_5 = (5UL << DATA_BITS_Pos);
90 
92  constexpr config_t DATA_BITS_6 = (6UL << DATA_BITS_Pos);
93 
95  constexpr config_t DATA_BITS_7 = (7UL << DATA_BITS_Pos);
96 
98  constexpr config_t DATA_BITS_8 = (0UL << DATA_BITS_Pos);
99 
101  constexpr config_t DATA_BITS_9 = (1UL << DATA_BITS_Pos);
102 
103  // ----- Serial Control Codes: Mode Parameters: Parity -----
104  constexpr bit_number_t PARITY_Pos = 12;
105  constexpr config_t PARITY_Msk = (3UL << PARITY_Pos);
106 
108  constexpr config_t PARITY_NONE = (0UL << PARITY_Pos);
109 
111  constexpr config_t PARITY_EVEN = (1UL << PARITY_Pos);
112 
114  constexpr config_t PARITY_ODD = (2UL << PARITY_Pos);
115 
116  // ----- Serial Control Codes: Mode Parameters: Stop Bits -----
117  constexpr bit_number_t STOP_BITS_Pos = 14;
118  constexpr config_t STOP_BITS_Msk = (3UL << STOP_BITS_Pos);
119 
121  constexpr config_t STOP_BITS_1 = (0UL << STOP_BITS_Pos);
122 
124  constexpr config_t STOP_BITS_2 = (1UL << STOP_BITS_Pos);
125 
127  constexpr config_t STOP_BITS_1_5 = (2UL << STOP_BITS_Pos);
128 
130  constexpr config_t STOP_BITS_0_5 = (3UL << STOP_BITS_Pos);
131 
132  // ----- Serial Control Codes: Mode Parameters: Flow Control -----
135 
138 
141 
144 
147 
148  // ----- Serial Control Codes: Mode Parameters: Clock Polarity = (Synchronous mode); -----
149  constexpr bit_number_t CPOL_Pos = 18;
150  constexpr config_t CPOL_Msk = (1UL << CPOL_Pos);
151 
153  constexpr config_t CPOL0 = (0UL << CPOL_Pos);
154 
156  constexpr config_t CPOL1 = (1UL << CPOL_Pos);
157 
158  // ----- Serial Control Codes: Mode Parameters: Clock Phase = (Synchronous mode); -----
159  constexpr bit_number_t CPHA_Pos = 19;
160  constexpr config_t CPHA_Msk = (1UL << CPHA_Pos);
161 
163  constexpr config_t CPHA0 = (0UL << CPHA_Pos);
164 
166  constexpr config_t CPHA1 = (1UL << CPHA_Pos);
167 
168  // ----- Serial Control Codes: Miscellaneous Controls -----
169 
171  constexpr config_t DEFAULT_TX_VALUE = (0x10UL << CONFIG_Pos);
172 
174  constexpr config_t IRDA_PULSE = (0x11UL << CONFIG_Pos);
175 
177  constexpr config_t SMART_CARD_GUARD_TIME = (0x12UL << CONFIG_Pos);
178 
180  constexpr config_t SMART_CARD_CLOCK = (0x13UL << CONFIG_Pos);
181 
183  constexpr config_t SMART_CARD_NACK = (0x14UL << CONFIG_Pos);
184 
185  // --------------------------------------------------------------------
186  // ----- Commands -----
187 
188  enum Control
189  : control_t
190  {
191  //
193  enable_tx = (0x15UL << CONFIG_Pos),
194 
196  enable_rx = (0x16UL << CONFIG_Pos),
197 
199  enable_break = (0x17UL << CONFIG_Pos),
200 
202  abort_send = (0x18UL << CONFIG_Pos),
203 
205  abort_receive = (0x19UL << CONFIG_Pos),
206 
208  abort_transfer = (0x1AUL << CONFIG_Pos),
209 
211  disable_tx = (0x25UL << CONFIG_Pos),
212 
214  disable_rx = (0x26UL << CONFIG_Pos),
215 
217  disable_break = (0x27UL << CONFIG_Pos)
218  };
219 
220  // --------------------------------------------------------------------
221  // ****** Serial specific error codes *****
222 
225 
228 
231 
234 
237 
240 
243 
246 
247  // ====================================================================
248  // ***** Serial Status *****
249 
250 #pragma GCC diagnostic push
251 #pragma GCC diagnostic ignored "-Wpadded"
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 
295  bool tx_underflow :1;
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 #pragma GCC diagnostic ignored "-Wpadded"
342 
347  {
348  public:
349 
350  bool
351  is_cts_active (void);
352 
353  bool
354  is_dsr_active (void);
355 
356  bool
357  is_dcd_active (void);
358 
359  bool
360  is_ri_active (void);
361 
362  // ------------------------------------------------------------------
363  public:
364 
365  // For compatibility with ARM CMSIS, these bits should be
366  // exactly in this order.
367 
369  bool cts :1;
370 
372  bool dsr :1;
373 
375  bool dcd :1;
376 
378  bool ri :1;
379  };
380 
381 #pragma GCC diagnostic pop
382 
383  // ====================================================================
384  // ****** Serial Events *****
385 
389  enum Event
390  : event_t
391  {
392  //
393 
395  send_complete = (1UL << 0),
396 
398  receive_complete = (1UL << 1),
399 
401  transfer_complete = (1UL << 2),
402 
404  tx_complete = (1UL << 3),
405 
407  tx_underflow = (1UL << 4),
408 
410  rx_overflow = (1UL << 5),
411 
413  rx_timeout = (1UL << 6),
414 
416  rx_break = (1UL << 7),
417 
419  rx_framing_error = (1UL << 8),
420 
422  rx_parity_error = (1UL << 9),
423 
425  cts = (1UL << 10),
426 
428  dsr = (1UL << 11),
429 
431  dcd = (1UL << 12),
432 
434  ri = (1UL << 13),
435  };
436 
437  // ====================================================================
438 
439 #pragma GCC diagnostic push
440 #pragma GCC diagnostic ignored "-Wpadded"
441 
446  {
447  public:
448 
449  // For compatibility with ARM CMSIS, these bits should be
450  // exactly in this order.
451 
453  bool asynchronous :1;
454 
457 
460 
462  bool single_wire :1;
463 
465  bool irda :1;
466 
468  bool smart_card :1;
469 
472 
475 
478 
481 
484 
486  bool rts :1;
487 
489  bool cts :1;
490 
492  bool dtr :1;
493 
495  bool dsr :1;
496 
498  bool dcd :1;
499 
501  bool ri :1;
502 
504  bool event_cts :1;
505 
507  bool event_dsr :1;
508 
510  bool event_dcd :1;
511 
513  bool event_ri :1;
514  };
515 
516 #pragma GCC diagnostic pop
517 
518  } /* namespace serial */
519 
520  // ======================================================================
521 
522 #pragma GCC diagnostic push
523 #pragma GCC diagnostic ignored "-Wpadded"
524 
525  class Serial : public Base
526  {
527 
528  public:
529 
530  // --------------------------------------------------------------------
531 
532  Serial () noexcept;
533 
534  Serial (const Serial&) = delete;
535 
536  Serial (Serial&&) = delete;
537 
538  Serial&
539  operator= (const Serial&) = delete;
540 
541  Serial&
542  operator= (Serial&&) = delete;
543 
544  virtual
545  ~Serial () noexcept;
546 
547  // --------------------------------------------------------------------
548 
555  void
556  register_callback (signal_event_t cb_func,
557  const void* cb_object = nullptr) noexcept;
558 
559  // --------------------------------------------------------------------
560 
565  const serial::Capabilities&
566  get_capabilities (void) noexcept;
567 
574  return_t
575  send (const void* data, std::size_t num) noexcept;
576 
583  return_t
584  receive (void* data, std::size_t num) noexcept;
585 
593  return_t
594  transfer (const void* data_out, void* data_in, std::size_t num) noexcept;
595 
600  std::size_t
601  get_tx_count (void) noexcept;
602 
607  std::size_t
608  get_rx_count (void) noexcept;
609 
616  return_t
617  configure (serial::config_t cfg, serial::config_arg_t arg) noexcept;
618 
624  return_t
625  control (serial::control_t ctrl) noexcept;
626 
632  get_status (void) noexcept;
633 
639  return_t
640  control_modem_line (serial::Modem_control ctrl) noexcept;
641 
647  get_modem_status (void) noexcept;
648 
654  void
655  signal_event (event_t event) noexcept;
656 
657  void
658  clean (void) noexcept;
659 
660  protected:
661 
662  // ----- To be implemented by derived classes -----
663 
664  virtual const serial::Capabilities&
665  do_get_capabilities (void) noexcept = 0;
666 
667  virtual return_t
668  do_send (const void* data, std::size_t num) noexcept = 0;
669 
670  virtual return_t
671  do_receive (void* data, std::size_t num) noexcept = 0;
672 
673  virtual return_t
674  do_transfer (const void* data_out, void* data_in, std::size_t num)
675  noexcept = 0;
676 
677  virtual std::size_t
678  do_get_tx_count (void) noexcept = 0;
679 
680  virtual std::size_t
681  do_get_rx_count (void) noexcept = 0;
682 
683  virtual return_t
684  do_configure (serial::config_t cfg, serial::config_arg_t arg)
685  noexcept = 0;
686 
687  virtual return_t
688  do_control (serial::control_t ctrl) noexcept = 0;
689 
690  virtual serial::Status&
691  do_get_status (void) noexcept = 0;
692 
693  virtual return_t
694  do_control_modem_line (serial::Modem_control ctrl) noexcept = 0;
695 
696  virtual serial::Modem_status&
697  do_get_modem_status (void) noexcept = 0;
698 
699  protected:
700 
703 
705  const void* cb_object_;
706 
709 
710  };
711 
712 #pragma GCC diagnostic pop
713 
714  // ----------------------------------------------------------------------
715  // ----- Definitions -----
716 
717  namespace serial
718  {
719  // --------------------------------------------------------------------
720 
721  inline bool
723  {
724  return tx_busy;
725  }
726 
727  inline bool
729  {
730  return rx_busy;
731  }
732 
733  inline bool
735  {
736  return tx_underflow;
737  }
738 
739  inline bool
741  {
742  return rx_overflow;
743  }
744 
745  inline bool
747  {
748  return rx_break;
749  }
750 
751  inline bool
753  {
754  return rx_framing_error;
755  }
756 
757  inline bool
759  {
760  return rx_parity_error;
761  }
762 
763  // --------------------------------------------------------------------
764 
765  inline bool
767  {
768  return cts;
769  }
770 
771  inline bool
773  {
774  return dsr;
775  }
776 
777  inline bool
779  {
780  return dcd;
781  }
782 
783  inline bool
785  {
786  return ri;
787  }
788  } /* namespace serial */
789 
790  // ----------------------------------------------------------------------
791 
792  inline const serial::Capabilities&
793  Serial::get_capabilities (void) noexcept
794  {
795  return do_get_capabilities ();
796  }
797 
798  inline std::size_t
799  Serial::get_tx_count (void) noexcept
800  {
801  return do_get_tx_count ();
802  }
803 
804  inline std::size_t
805  Serial::get_rx_count (void) noexcept
806  {
807  return do_get_rx_count ();
808  }
809 
810  inline return_t
812  {
813  return do_configure (cfg, arg);
814  }
815 
816  inline return_t
818  {
819  return do_control (ctrl);
820  }
821 
822  inline serial::Status&
823  Serial::get_status (void) noexcept
824  {
825  return do_get_status ();
826  }
827 
828  inline return_t
830  {
831  return do_control_modem_line (ctrl);
832  }
833 
834  inline serial::Modem_status&
835  Serial::get_modem_status (void) noexcept
836  {
837  return do_get_modem_status ();
838  }
839 
840  inline void /* __attribute__((always_inline)) */
841  Serial::signal_event (event_t event) noexcept
842  {
843  if (cb_func_ != nullptr)
844  {
845  // Forward event to registered callback.
846  cb_func_ (cb_object_, event);
847  }
848  }
849 
850  } /* namespace driver */
851 } /* namespace os */
852 
853 #endif /* __cplusplus */
854 
855 // ----------------------------------------------------------------------------
856 
857 #endif /* CMSIS_PLUS_DRIVER_SERIAL_H_ */
Disable Continuous Break transmission;.
Definition: serial.h:214
DCD state changed (optional)
Definition: serial.h:428
Disable Receiver.
Definition: serial.h:211
constexpr bit_number_t PARITY_Pos
Definition: serial.h:104
Disable Transmitter.
Definition: serial.h:208
bool event_rx_timeout
RTS Line: false=not available, true=available.
Definition: serial.h:483
constexpr bit_number_t CONFIG_Pos
Definition: serial.h:62
serial::Status & get_status(void) noexcept
Get serial port status.
Definition: serial.h:823
constexpr config_t MODE_IRDA
UART Smart Card; arg = Baudrate.
Definition: serial.h:79
const void * cb_object_
Pointer to object instance associated with this driver.
Definition: serial.h:705
Transfer completed.
Definition: serial.h:398
constexpr return_t ERROR_CPHA
Definition: serial.h:245
constexpr config_t STOP_BITS_1
2 Stop bits
Definition: serial.h:121
constexpr config_t DATA_BITS_6
7 Data bits
Definition: serial.h:92
bool flow_control_rts
CTS Flow Control available.
Definition: serial.h:474
constexpr config_t SMART_CARD_CLOCK
Smart Card NACK generation; arg: 0=disabled, 1=enabled.
Definition: serial.h:180
bool asynchronous
< supports Asynchronous mode
Definition: serial.h:453
bool synchronous_master
supports Synchronous Slave mode
Definition: serial.h:456
constexpr config_t MODE_ASYNCHRONOUS
< UART = (Asynchronous);; arg = Baudrate
Definition: serial.h:67
constexpr config_t DATA_BITS_5
6 Data bit
Definition: serial.h:89
uint32_t modem_config_t
Definition: serial.h:315
constexpr config_t DATA_BITS_9
Definition: serial.h:101
constexpr config_t MODE_SMART_CARD
Definition: serial.h:82
bool dcd
RI Line: false=not available, true=available.
Definition: serial.h:498
return_t control(serial::control_t ctrl) noexcept
Control the serial interface.
Definition: serial.h:817
constexpr return_t ERROR_DATA_BITS
Specified Parity not supported.
Definition: serial.h:230
Transmit completed (optional)
Definition: serial.h:401
bool event_cts
Signal DSR change event.
Definition: serial.h:504
bool dsr
DCD Line: false=not available, true=available.
Definition: serial.h:495
constexpr config_t CPHA0
CPHA = 1.
Definition: serial.h:163
constexpr config_t STOP_BITS_1_5
0.5 Stop bits
Definition: serial.h:127
ssize_t send(int socket, const void *buffer, size_t length, int flags)
constexpr bit_number_t CPOL_Pos
Definition: serial.h:149
bool is_tx_underflow(void)
Definition: serial.h:734
bool cts
DTR Line: false=not available, true=available.
Definition: serial.h:489
constexpr config_t IRDA_PULSE
Set Smart Card Guard Time; arg = number of bit periods.
Definition: serial.h:174
bool single_wire
supports IrDA mode
Definition: serial.h:462
signal_event_t cb_func_
Pointer to static function that implements the callback.
Definition: serial.h:702
void signal_event(event_t event) noexcept
Signal serial events.
Definition: serial.h:841
bool ri
Signal CTS change event.
Definition: serial.h:501
constexpr config_t STOP_BITS_Msk
1 Stop bit = (default);
Definition: serial.h:118
Abort Serial::receive()
Definition: serial.h:202
bool cts
< CTS state: true=Active, false=Inactive
Definition: serial.h:369
bool smart_card
Smart Card Clock generator available.
Definition: serial.h:468
constexpr config_t PARITY_EVEN
Odd Parity.
Definition: serial.h:111
Transmit data not available (Synchronous Slave)
Definition: serial.h:404
constexpr config_t DEFAULT_TX_VALUE
< Set default Transmit value = (Synchronous Receive only); arg = value
Definition: serial.h:171
bool is_rx_framing_error(void)
Definition: serial.h:752
constexpr return_t ERROR_MODE
< Specified Mode not supported
Definition: serial.h:224
System namespace.
constexpr return_t ERROR_SPECIFIC
Definition: common.h:70
bool flow_control_cts
Transmit completed event.
Definition: serial.h:477
bool tx_busy
< Transmitter busy flag
Definition: serial.h:289
constexpr bit_number_t STOP_BITS_Pos
Definition: serial.h:117
constexpr config_t FLOW_CONTROL_CTS
RTS/CTS Flow Control.
Definition: serial.h:143
uint32_t config_t
Definition: serial.h:55
bool dtr
DSR Line: false=not available, true=available.
Definition: serial.h:492
Serial device driver capabilities.
Definition: serial.h:445
constexpr config_t FLOW_CONTROL_NONE
RTS Flow Control.
Definition: serial.h:137
bool is_rx_parity_error(void)
Definition: serial.h:758
constexpr config_t SMART_CARD_GUARD_TIME
Set Smart Card Clock in Hz; arg: 0=Clock not generated.
Definition: serial.h:177
constexpr config_t FLOW_CONTROL_RTS_CTS
Definition: serial.h:146
constexpr config_t PARITY_ODD
Definition: serial.h:114
uint32_t event_t
Definition: common.h:50
constexpr config_t CONFIG_Msk(0xFFUL<< CONFIG_Pos)
constexpr config_t CPOL1
Definition: serial.h:156
constexpr bit_number_t DATA_BITS_Pos
Definition: serial.h:85
constexpr config_t CPOL0
CPOL = 1.
Definition: serial.h:153
constexpr config_t DATA_BITS_7
8 Data bits = (default);
Definition: serial.h:95
return_t control_modem_line(serial::Modem_control ctrl) noexcept
Configure serial modem lines.
Definition: serial.h:829
constexpr config_t SMART_CARD_NACK
Definition: serial.h:183
bool rx_busy
Transmit data underflow detected (cleared on start of next send operation)
Definition: serial.h:292
constexpr return_t ERROR_BAUDRATE
Specified number of Data bits not supported.
Definition: serial.h:227
Abort Serial::transfer()
Definition: serial.h:205
bool rx_overflow
Break detected on receive (cleared on start of next receive operation)
Definition: serial.h:298
uint32_t config_arg_t
Definition: serial.h:56
bool event_tx_complete
Signal receive character timeout event.
Definition: serial.h:480
constexpr config_t FLOW_CONTROL_RTS
CTS Flow Control.
Definition: serial.h:140
constexpr config_t PARITY_Msk
No Parity = (default);.
Definition: serial.h:105
bool tx_underflow
Receive data overflow detected (cleared on start of next receive operation)
Definition: serial.h:295
constexpr return_t ERROR_FLOW_CONTROL
Specified Clock Polarity not supported.
Definition: serial.h:239
uint32_t bit_number_t
Definition: serial.h:54
constexpr config_t CPOL_Msk
CPOL = 0 = (default);.
Definition: serial.h:150
bool is_rx_break(void)
Definition: serial.h:746
constexpr return_t ERROR_CPOL
Specified Clock Phase not supported.
Definition: serial.h:242
bool rx_framing_error
Parity error detected on receive (cleared on start of next receive operation)
Definition: serial.h:304
constexpr config_t DATA_BITS_8
9 Data bits
Definition: serial.h:98
Abort Serial::send()
Definition: serial.h:199
constexpr return_t ERROR_PARITY
Specified number of Stop bits not supported.
Definition: serial.h:233
constexpr config_t CPHA_Msk
CPHA = 0 = (default);.
Definition: serial.h:160
Event
Serial Events.
Definition: serial.h:389
bool synchronous_slave
supports Single-wire mode
Definition: serial.h:459
bool rts
CTS Line: false=not available, true=available.
Definition: serial.h:486
constexpr config_t MODE_SYNCHRONOUS_MASTER
Synchronous Slave = (external clock signal);.
Definition: serial.h:70
bool rx_break
Framing error detected on receive (cleared on start of next receive operation)
Definition: serial.h:301
constexpr config_t FLOW_CONTROL_Msk
No Flow Control = (default);.
Definition: serial.h:134
return_t configure(serial::config_t cfg, serial::config_arg_t arg) noexcept
Configure the serial interface.
Definition: serial.h:811
bool irda
supports Smart Card mode
Definition: serial.h:465
serial::Modem_status & get_modem_status(void) noexcept
Get serial modem lines state.
Definition: serial.h:835
constexpr config_t CPHA1
Definition: serial.h:166
Enable Continuous Break transmission.
Definition: serial.h:196
constexpr config_t MODE_SINGLE_WIRE
UART IrDA; arg = Baudrate.
Definition: serial.h:76
serial::Modem_status modem_status_
Definition: serial.h:708
void(* signal_event_t)(const void *object, event_t event)
Definition: common.h:73
Modem_control
Configuration to change the serial modem lines.
Definition: serial.h:320
constexpr config_t STOP_BITS_0_5
Definition: serial.h:130
constexpr config_t PARITY_NONE
Even Parity.
Definition: serial.h:108
bool is_rx_overflow(void)
Definition: serial.h:740
serial::Status status_
Definition: serial.h:707
constexpr bit_number_t FLOW_CONFIG_Pos
Definition: serial.h:133
constexpr return_t ERROR_STOP_BITS
Specified Flow Control not supported.
Definition: serial.h:236
std::size_t get_tx_count(void) noexcept
Get transmitted bytes count.
Definition: serial.h:799
Break detected on receive.
Definition: serial.h:413
const serial::Capabilities & get_capabilities(void) noexcept
Get driver capabilities.
Definition: serial.h:793
constexpr config_t DATA_BITS_Msk
5 Data bits
Definition: serial.h:86
bool event_dsr
Signal DCD change event.
Definition: serial.h:507
Serial modem status
Definition: serial.h:346
bool event_dcd
Signal RI change event.
Definition: serial.h:510
Serial port status
Definition: serial.h:256
int32_t return_t
Definition: common.h:51
uint32_t control_t
Definition: serial.h:57
Enable Transmitter.
Definition: serial.h:193
Send completed; however USART may still transmit data.
Definition: serial.h:395
constexpr bit_number_t CPHA_Pos
Definition: serial.h:159
bool smart_card_clock
RTS Flow Control available.
Definition: serial.h:471
RI state changed (optional)
Definition: serial.h:431
bool dsr
DCD state: true=Active, false=Inactive.
Definition: serial.h:372
bool dcd
RI state: true=Active, false=Inactive.
Definition: serial.h:375
std::size_t get_rx_count(void) noexcept
Get received bytes count.
Definition: serial.h:805
uint32_t control_arg_t
Definition: serial.h:58
DSR state changed (optional)
Definition: serial.h:425
constexpr config_t MODE_SYNCHRONOUS_SLAVE
UART Single-wire = (half-duplex);; arg = Baudrate.
Definition: serial.h:73
constexpr config_t STOP_BITS_2
1.5 Stop bits
Definition: serial.h:124