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

#include <ND015A.h>

Inheritance diagram for Boardcore::ND015A:
Collaboration diagram for Boardcore::ND015A:

Public Types

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

 ND015A (SPIBusInterface &bus, miosix::GpioPin cs, SPIBusConfig spiConfig, IOWatchdogEnable iow=IOWatchdogEnable::DISABLED, BWLimitFilter bwl=BWLimitFilter::BWL_200, NotchEnable ntc=NotchEnable::ENABLED, uint8_t odr=0x1C)
 Constructor for the ND015A 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 setIOWatchdog (IOWatchdogEnable iow)
 function to enable 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 SPIBusConfig getDefaultSPIConfig ()
 Constructs the default config for the SPI bus.
 

Static Public Attributes

static const char MODEL_NAME [] = "ND015A"
 

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 ND015A.h.

Member Enumeration Documentation

◆ BWLimitFilter

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

Definition at line 45 of file ND015A.h.

◆ IOWatchdogEnable

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

Definition at line 39 of file ND015A.h.

◆ NotchEnable

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

Definition at line 57 of file ND015A.h.

Constructor & Destructor Documentation

◆ ND015A()

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

Constructor for the ND015A sensor.

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

Definition at line 51 of file ND015A.cpp.

Member Function Documentation

◆ checkModelMatch()

bool Boardcore::ND015A::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 72 of file ND015A.cpp.

◆ getDefaultSPIConfig()

SPIBusConfig Boardcore::ND015A::getDefaultSPIConfig ( )
static

Constructs the default config for the SPI bus.

Returns
The default SPIBusConfig object.

Definition at line 35 of file ND015A.cpp.

◆ init()

bool Boardcore::ND015A::init ( )
overridevirtual

Initializes the sensor.

Returns
Always returns true.

Implements Boardcore::AbstractSensor.

Definition at line 58 of file ND015A.cpp.

◆ sampleImpl()

ND015XData Boardcore::ND015A::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 147 of file ND015A.cpp.

◆ selfTest()

bool Boardcore::ND015A::selfTest ( )
overridevirtual

Not implemented.

Returns
Always returns true.

Implements Boardcore::AbstractSensor.

Definition at line 70 of file ND015A.cpp.

◆ setBWLimitFilter()

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

Sets the bandwidth limit filter for the sensor.

Parameters
bwlBandwidth limit filter setting.

Definition at line 125 of file ND015A.cpp.

◆ setIOWatchdog()

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

function to enable the IO watchdog

Parameters
iowsetting

Definition at line 114 of file ND015A.cpp.

◆ setNotch()

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

Enables or disables the notch filter.

Parameters
ntcNotch filter setting.

Definition at line 136 of file ND015A.cpp.

◆ setOutputDataRate()

void Boardcore::ND015A::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 103 of file ND015A.cpp.

Member Data Documentation

◆ bwl

BWLimitFilter Boardcore::ND015A::bwl

Definition at line 155 of file ND015A.h.

◆ fsr

uint8_t Boardcore::ND015A::fsr

Definition at line 153 of file ND015A.h.

◆ iow

IOWatchdogEnable Boardcore::ND015A::iow

Definition at line 154 of file ND015A.h.

◆ MODEL_NAME

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

Definition at line 37 of file ND015A.h.

◆ ntc

NotchEnable Boardcore::ND015A::ntc

Definition at line 156 of file ND015A.h.

◆ odr

uint8_t Boardcore::ND015A::odr

Definition at line 157 of file ND015A.h.


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