Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::ND015D Class Reference

#include <ND015D.h>

Inheritance diagram for Boardcore::ND015D:
Collaboration diagram for Boardcore::ND015D:

Public Types

enum class  FullScaleRange : uint8_t {
  FS_1 = 0x02 , FS_2 = 0x03 , FS_4 = 0x04 , FS_5 = 0x05 ,
  FS_10 = 0x06 , FS_15 = 0x07
}
 
enum class  IOWatchdogEnable : uint8_t { DISABLED = 0x00 , ENABLED = 0x01 }
 
enum class  BWLimitFilter : uint8_t {
  BWL_1 = 0x00 , BWL_2 = 0x01 , BWL_5 = 0x02 , BWL_10 = 0x03 ,
  BWL_20 = 0x04 , BWL_50 = 0x05 , BWL_100 = 0x06 , BWL_200 = 0x07
}
 
enum class  NotchEnable : uint8_t { DISABLED = 0x00 , ENABLED = 0x01 }
 
- Public Types inherited from Boardcore::Sensor< ND015XData >
using DataType
 

Public Member Functions

 ND015D (SPIBusInterface &bus, miosix::GpioPin cs, SPIBusConfig spiConfig, FullScaleRange fsr=FullScaleRange::FS_2, IOWatchdogEnable iow=IOWatchdogEnable::DISABLED, BWLimitFilter bwl=BWLimitFilter::BWL_200, NotchEnable ntc=NotchEnable::ENABLED, uint8_t odr=0x1C)
 Constructor for the ND015D sensor.
 
bool init () override
 Initializes the sensor.
 
bool selfTest () override
 Not implemented.
 
void setOutputDataRate (uint8_t odr)
 function to set the output data rate
 
void setFullScaleRange (FullScaleRange fsr)
 Sets the full-scale range for the sensor.
 
void setIOWatchdog (IOWatchdogEnable iow)
 Enables or disables the IO watchdog.
 
void setBWLimitFilter (BWLimitFilter bwl)
 Sets the bandwidth limit filter for the sensor.
 
void setNotch (NotchEnable ntc)
 Enables or disables the notch filter.
 
bool checkModelMatch ()
 Checks if the sensor model matches the expected model.
 
- Public Member Functions inherited from Boardcore::Sensor< ND015XData >
 Sensor ()
 
 Sensor (Sensor &&other)
 
virtual ~Sensor ()
 
void sample () override
 Sample the sensor.
 
virtual ND015XData getLastSample ()
 
- Public Member Functions inherited from Boardcore::AbstractSensor
virtual ~AbstractSensor ()
 
SensorErrors getLastError ()
 Get last error for debugging purposes. Avoid silent fails.
 

Static Public Member Functions

static float rangeToPressure (FullScaleRange fsr)
 Converts the FullScale value to its corresponding range.
 
static SPIBusConfig getDefaultSPIConfig ()
 Constructs the default config for the SPI bus.
 

Static Public Attributes

static const char MODEL_NAME [] = "ND015D"
 

Protected Member Functions

ND015XData sampleImpl () override
 Read a data sample from the sensor. In case of errors, the method should return the last available correct sample.
 

Additional Inherited Members

- Protected Attributes inherited from Boardcore::Sensor< ND015XData >
DataType lastSample
 
miosix::FastMutex mutex
 
- Protected Attributes inherited from Boardcore::AbstractSensor
SensorErrors lastError = SensorErrors::NO_ERRORS
 

Detailed Description

Definition at line 34 of file ND015D.h.

Member Enumeration Documentation

◆ BWLimitFilter

enum class Boardcore::ND015D::BWLimitFilter : uint8_t
strong
Enumerator
BWL_1 
BWL_2 
BWL_5 
BWL_10 
BWL_20 
BWL_50 
BWL_100 
BWL_200 

Definition at line 67 of file ND015D.h.

◆ FullScaleRange

enum class Boardcore::ND015D::FullScaleRange : uint8_t
strong

The datasheet is unclear about the unit of measure, it could be either psi or inH2O but I believe it's the latter

Enumerator
FS_1 
FS_2 
FS_4 
FS_5 
FS_10 
FS_15 

Definition at line 43 of file ND015D.h.

◆ IOWatchdogEnable

enum class Boardcore::ND015D::IOWatchdogEnable : uint8_t
strong
Enumerator
DISABLED 
ENABLED 

Definition at line 61 of file ND015D.h.

◆ NotchEnable

enum class Boardcore::ND015D::NotchEnable : uint8_t
strong
Enumerator
DISABLED 
ENABLED 

Definition at line 79 of file ND015D.h.

Constructor & Destructor Documentation

◆ ND015D()

Boardcore::ND015D::ND015D ( SPIBusInterface & bus,
miosix::GpioPin cs,
SPIBusConfig spiConfig,
FullScaleRange fsr = FullScaleRange::FS_2,
IOWatchdogEnable iow = IOWatchdogEnable::DISABLED,
BWLimitFilter bwl = BWLimitFilter::BWL_200,
NotchEnable ntc = NotchEnable::ENABLED,
uint8_t odr = 0x1C )

Constructor for the ND015D sensor.

Parameters
busSPI bus interface.
csChip select GPIO pin.
spiConfigSPI bus configuration.

Definition at line 51 of file ND015D.cpp.

Member Function Documentation

◆ checkModelMatch()

bool Boardcore::ND015D::checkModelMatch ( )

Checks if the sensor model matches the expected model.

Returns
True if the model matches, false otherwise.
Warning
The function might return false even when it should not as the SPI transaction sometimes ads some zeroes when it should not. This is because the sensore requires a clock cycle greater than the one we can provide

Definition at line 73 of file ND015D.cpp.

◆ getDefaultSPIConfig()

SPIBusConfig Boardcore::ND015D::getDefaultSPIConfig ( )
static

Constructs the default config for the SPI bus.

Returns
The default SPIBusConfig object.

Definition at line 35 of file ND015D.cpp.

◆ init()

bool Boardcore::ND015D::init ( )
overridevirtual

Initializes the sensor.

Returns
Always returns true.

Implements Boardcore::AbstractSensor.

Definition at line 59 of file ND015D.cpp.

◆ rangeToPressure()

float Boardcore::ND015D::rangeToPressure ( FullScaleRange fsr)
static

Converts the FullScale value to its corresponding range.

Parameters
fsrFullScale value.
Returns
Pressure range.

Definition at line 128 of file ND015D.cpp.

◆ sampleImpl()

ND015XData Boardcore::ND015D::sampleImpl ( )
overrideprotectedvirtual

Read a data sample from the sensor. In case of errors, the method should return the last available correct sample.

Returns
sensor data sample

Implements Boardcore::Sensor< ND015XData >.

Definition at line 182 of file ND015D.cpp.

◆ selfTest()

bool Boardcore::ND015D::selfTest ( )
overridevirtual

Not implemented.

Returns
Always returns true.

Implements Boardcore::AbstractSensor.

Definition at line 71 of file ND015D.cpp.

◆ setBWLimitFilter()

void Boardcore::ND015D::setBWLimitFilter ( BWLimitFilter bwl)

Sets the bandwidth limit filter for the sensor.

Parameters
bwlBandwidth limit filter setting.

Definition at line 160 of file ND015D.cpp.

◆ setFullScaleRange()

void Boardcore::ND015D::setFullScaleRange ( FullScaleRange fsr)

Sets the full-scale range for the sensor.

Parameters
fsFull-scale range.

Definition at line 115 of file ND015D.cpp.

◆ setIOWatchdog()

void Boardcore::ND015D::setIOWatchdog ( IOWatchdogEnable iow)

Enables or disables the IO watchdog.

Parameters
iowIO watchdog setting.

Definition at line 149 of file ND015D.cpp.

◆ setNotch()

void Boardcore::ND015D::setNotch ( NotchEnable ntc)

Enables or disables the notch filter.

Parameters
ntcNotch filter setting.

Definition at line 171 of file ND015D.cpp.

◆ setOutputDataRate()

void Boardcore::ND015D::setOutputDataRate ( uint8_t odr)

function to set the output data rate

Parameters
odroutput data rate for the sensor, the actual odr is calculated as 444Hz / odr. Allowed values are 0x00 to 0xFF, 0x00 will select the auto-select rate mode

Definition at line 104 of file ND015D.cpp.

Member Data Documentation

◆ bwl

BWLimitFilter Boardcore::ND015D::bwl

Definition at line 187 of file ND015D.h.

◆ fsr

FullScaleRange Boardcore::ND015D::fsr

Definition at line 185 of file ND015D.h.

◆ iow

IOWatchdogEnable Boardcore::ND015D::iow

Definition at line 186 of file ND015D.h.

◆ MODEL_NAME

const char Boardcore::ND015D::MODEL_NAME = "ND015D"
static

Definition at line 37 of file ND015D.h.

◆ ntc

NotchEnable Boardcore::ND015D::ntc

Definition at line 188 of file ND015D.h.

◆ odr

uint8_t Boardcore::ND015D::odr

Definition at line 189 of file ND015D.h.


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