PAS CO2 Sensor  1.0.3
C++ library for Infineon Photoacoustic Spectroscopy (PAS) XENSIV™ CO2 miniaturized sensor
pasco2::PWMSW Class Reference

#include <pas-co2-pwm-sw.hpp>

Inheritance diagram for pasco2::PWMSW:
Collaboration diagram for pasco2::PWMSW:

Public Types

enum  Mode_t { MODE_POLLING, MODE_INTERRUPT }
 Measuring Mode. More...
 

Public Member Functions

 PWMSW (GPIO *const pwmIn, Timer *const timer, Mode_t mode)
 PAS CO2 Software PWM Constructor. More...
 
 ~PWMSW ()
 PAS CO2 Software PWM Destructor. More...
 
Error_t init ()
 Initializes the PWM. More...
 
Error_t deinit ()
 Deinitializes the PWM. More...
 
Error_t getDuty (double &duty)
 Gets the PWM input duty cycle in percentage. More...
 

Protected Member Functions

void callback ()
 

Static Protected Member Functions

static void int0Handler ()
 Interrupt 0 Handler. More...
 
static void int1Handler ()
 Interrupt 1 Handler. More...
 
static void int2Handler ()
 Interrupt 2 Handler. More...
 
static void int3Handler ()
 Interrupt 3 Handler. More...
 
static void * isrRegister (PWMSW *objPtr)
 Register a hardware interrupt for the PWMSW object passed by argument. More...
 

Member Enumeration Documentation

◆ Mode_t

Measuring Mode.

Enumerator
MODE_POLLING 

PWM Polling Mode

MODE_INTERRUPT 

PWM Interrupt Mode

Constructor & Destructor Documentation

◆ PWMSW()

PWMSW::PWMSW ( GPIO *const  pwmIn,
Timer *const  timer,
Mode_t  mode 
)

PAS CO2 Software PWM Constructor.

Parameters
[in]*pwmInInput GPIO instance reading the PWM sensor signal
[in]*timerTimer instance
Precondition
None

◆ ~PWMSW()

PWMSW::~PWMSW ( )

PAS CO2 Software PWM Destructor.

Precondition
None

Member Function Documentation

◆ init()

Error_t PWMSW::init ( void  )
virtual

Initializes the PWM.

Returns
PAS CO2 error code
Return values
OKif success
INTF_ERRORif error

Implements pasco2::PWM.

Here is the call graph for this function:

◆ deinit()

Error_t PWMSW::deinit ( void  )
virtual

Deinitializes the PWM.

Returns
PAS CO2 error code
Return values
OKif success
INTF_ERRORif error

Implements pasco2::PWM.

Here is the call graph for this function:

◆ getDuty()

Error_t PWMSW::getDuty ( double &  duty)
virtual

Gets the PWM input duty cycle in percentage.

The duty will return 0.00 if no duty is read (e.g. polling mode). In case of error, the duty value will be -1.00, and the function will return the corresponding return code for diagnosis.

Note
The read out of PWM pulses needs to be synched with the incoming PWM signals. This synchronization needs to be handled in the PAL.
Parameters
[out]dutyPWM input duty cycle value from PWM single or train pulse average (00.00 % to 100.00 %)
Returns
PAS CO2 error code
Return values
OKif success
INTF_ERRORif error

Implements pasco2::PWM.

Here is the call graph for this function:

◆ callback()

void PWMSW::callback ( )
protected
Here is the call graph for this function:

◆ int0Handler()

void PWMSW::int0Handler ( )
staticprotected

Interrupt 0 Handler.

Here is the call graph for this function:

◆ int1Handler()

void PWMSW::int1Handler ( )
staticprotected

Interrupt 1 Handler.

Here is the call graph for this function:

◆ int2Handler()

void PWMSW::int2Handler ( )
staticprotected

Interrupt 2 Handler.

Here is the call graph for this function:

◆ int3Handler()

void PWMSW::int3Handler ( )
staticprotected

Interrupt 3 Handler.

Here is the call graph for this function:

◆ isrRegister()

void * PWMSW::isrRegister ( PWMSW objPtr)
staticprotected

Register a hardware interrupt for the PWMSW object passed by argument.

Parameters
[in]*objPtrPWMSW object pointer
Returns
Pointer to allocate the interrupt function handler

The documentation for this class was generated from the following files: