atMETEO
An ATmega based weather station
Files | Classes | Enumerations

Sensors::Demodulator transforms continuous streams with pulse widths (for example from RF receivers) into bits. More...

Collaboration diagram for Demodulator:

Files

file  demodulator.h
 Sensors::Demodulator transforms continuous streams with pulse widths (for example from RF receivers) into bits.
 

Classes

struct  Sensors::BiphaseMark< TShortMin, TShortMax, TLongMin, TLongMax >
 Configuration parameter for Demodulator that enables Biphase Mark demodulation. More...
 
class  Sensors::DemodulatorBase< Demodulator >
 Demodulator base implementation. More...
 
class  Sensors::Demodulator< TDemodulatorType >
 Transforms continuous streams with pulse widths (for example from RF receivers) into bits. More...
 

Enumerations

enum  Sensors::DemodulatorStatus : uint8_t { Sensors::DemodulatorStatus::Complete = 0, Sensors::DemodulatorStatus::Incomplete, Sensors::DemodulatorStatus::OutOfRangeError }
 Demodulator status returned from DemodulatorBase::addPulseWidth. More...
 

Detailed Description

Sensors::Demodulator transforms continuous streams with pulse widths (for example from RF receivers) into bits.


Class Documentation

◆ Sensors::BiphaseMark

struct Sensors::BiphaseMark

template<uint16_t TShortMin, uint16_t TShortMax, uint16_t TLongMin, uint16_t TLongMax>
struct Sensors::BiphaseMark< TShortMin, TShortMax, TLongMin, TLongMax >

Configuration parameter for Demodulator that enables Biphase Mark demodulation.

Template Parameters
TShortMinThe minimum width of a pulse recognized as a short pulse.
TShortMaxThe maximum width of a pulse recognized as a short pulse. (TShortMin <= TShortMax)
TLongMinThe minimum width of a pulse recognized as a long pulse. (TShortMax <= TLongMin)
TLongMaxThe maximum width of a pulse recognized as a long pulse. (TLongMin <= TLongMax)
See also
https://en.wikipedia.org/wiki/Biphase_mark_code

◆ Sensors::DemodulatorBase

class Sensors::DemodulatorBase

template<typename Demodulator>
class Sensors::DemodulatorBase< Demodulator >

Demodulator base implementation.

Attention
Implementation detail. This class must not be used directly, it only serves as super class for Demodulator.

Public Member Functions

DemodulatorStatus addPulseWidth (uint16_t pulseWidth)
 Adds the pulseWidth value to the Demodulator state. More...
 
bool getData () const
 Returns the converted data. More...
 
void reset ()
 Resets the demodulator state. More...
 

Member Function Documentation

◆ addPulseWidth()

template<typename Demodulator>
DemodulatorStatus Sensors::DemodulatorBase< Demodulator >::addPulseWidth ( uint16_t  pulseWidth)
inline

Adds the pulseWidth value to the Demodulator state.

Parameters
pulseWidthPulse width to add.
Returns
Demodulator state after adding the pulse width.

◆ getData()

template<typename Demodulator>
bool Sensors::DemodulatorBase< Demodulator >::getData ( ) const
inline

Returns the converted data.

Returns
The converted data.

◆ reset()

template<typename Demodulator>
void Sensors::DemodulatorBase< Demodulator >::reset ( )
inline

Resets the demodulator state.

This method typically needs to be called when addPulseWidth() returned the status DemodulatorStatus::OutOfRangeError so that a fresh demodulator run starts.

◆ Sensors::Demodulator

class Sensors::Demodulator

template<typename TDemodulatorType>
class Sensors::Demodulator< TDemodulatorType >

Transforms continuous streams with pulse widths (for example from RF receivers) into bits.

Usage:

using namespace Sensors;
while (...) {
switch (demodulator.addPulseWidth(pulseWidth)) {
break;
handle_complete_bit(demodulator.getData());
break;
default:
demodulator.reset();
break;
}
}
Template Parameters
TDemodulatorTypeThe demodulation algorithm to apply (for example BiphaseMark).
See also
DemodulatorStatus

Additional Inherited Members

- Public Member Functions inherited from Sensors::DemodulatorBase< Demodulator >
DemodulatorStatus addPulseWidth (uint16_t pulseWidth)
 Adds the pulseWidth value to the Demodulator state. More...
 
bool getData () const
 Returns the converted data. More...
 
void reset ()
 Resets the demodulator state. More...
 

Enumeration Type Documentation

◆ DemodulatorStatus

enum Sensors::DemodulatorStatus : uint8_t
strong

Demodulator status returned from DemodulatorBase::addPulseWidth.

Enumerator
Complete 

The Demodulator data is complete. The decoded bit can be accessed using Demodulator::getData().

Incomplete 

The Demodulator data is incomplete. More pulse widths have to be added using Demodulator::addPulseWidth() before the data can be accessed.

OutOfRangeError 

The added pulse width is out of the specified range. This indicates that the received data is erroneous. Typically Demodulator::reset() needs to be called to start a fresh demodulator run.