PAS CO2 Sensor  1.0.3
C++ library for Infineon Photoacoustic Spectroscopy (PAS) XENSIV™ CO2 miniaturized sensor
pas-co2-pal-uart.hpp
Go to the documentation of this file.
1 
10 #ifndef PAS_CO2_PAL_UART_HPP_
11 #define PAS_CO2_PAL_UART_HPP_
12 
13 #include "pas-co2-conf.hpp"
14 
15 #if IS_INTF(PAS_CO2_INTF_UART)
16 
17 #include <stdint.h>
18 #include "pas-co2-types.hpp"
19 
20 #undef UART_PARITY_NONE
21 #undef UART_PARITY_ODD
22 #undef UART_PARITY_EVEN
23 
24 namespace pasco2
25 {
26 
32 class UARTPAL
33 {
34  public:
35 
41  {
42  UART_5BITS = 5,
47  };
54  enum Parity_t
55  {
59  };
67  {
70  };
79  virtual Error_t init () = 0;
80 
87  virtual Error_t deinit () = 0;
88 
100  virtual Error_t config (const uint32_t baudrate,
101  const DataBits_t dataBits,
102  const Parity_t parity,
103  const StopBits_t stopBits) = 0;
104 
114  virtual Error_t write (const uint8_t * data,
115  uint16_t & length) = 0;
116 
127  virtual Error_t read ( uint8_t * data,
128  uint16_t & length) = 0;
138  virtual Error_t waitReceive ( uint16_t bytesRcvd,
139  uint32_t timeoutMs) = 0;
140 
141 };
142 
145 }
146 
147 #endif /* PAS_CO2_UART_ENABLED */
148 #endif
Definition: pas-co2-pal-uart.hpp:44
virtual Error_t write(const uint8_t *data, uint16_t &length)=0
Writes in the UART interface.
virtual Error_t init()=0
Initializes the UART interface.
StopBits_t
Definition: pas-co2-pal-uart.hpp:66
virtual Error_t read(uint8_t *data, uint16_t &length)=0
Reads from the UART interface.
Parity_t
Definition: pas-co2-pal-uart.hpp:54
Definition: pas-co2-pal-uart.hpp:57
Definition: pas-co2-i2c.hpp:21
Error_t
Definition: pas-co2-types.hpp:24
Definition: pas-co2-pal-uart.hpp:43
Definition: pas-co2-pal-uart.hpp:32
virtual Error_t waitReceive(uint16_t bytesRcvd, uint32_t timeoutMs)=0
Waits for a maximum timeout for the specified amount of bytes to be received.
Definition: pas-co2-pal-uart.hpp:69
DataBits_t
Definition: pas-co2-pal-uart.hpp:40
Definition: pas-co2-pal-uart.hpp:45
Definition: pas-co2-pal-uart.hpp:56
virtual Error_t deinit()=0
Deinitializes the UART interface.
Definition: pas-co2-pal-uart.hpp:42
virtual Error_t config(const uint32_t baudrate, const DataBits_t dataBits, const Parity_t parity, const StopBits_t stopBits)=0
Configures the UART interface settings.
PAS CO2 Types.
PAS CO2 Library Configuration.
Definition: pas-co2-pal-uart.hpp:46
Definition: pas-co2-pal-uart.hpp:68
Definition: pas-co2-pal-uart.hpp:58