#include <ND015D.h>
|
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
} |
|
using | DataType = ND015XData |
|
|
| ND015D (SPIBusInterface &bus, miosix::GpioPin cs, SPIBusConfig spiConfig, DMAStreamGuard *streamRx, DMAStreamGuard *streamTx, std::chrono::nanoseconds timeoutDma, 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.
|
|
| 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.
|
|
void | setOffset (float offset) |
| Set the offset of this sensor. The offset is stored as a int16_t and can be both postive or negative.
|
|
void | updateOffset (float offset) |
| Modify the offset of this sensor. The offset is stored as a int16_t and can be both postive or negative.
|
|
float | getOffset () |
| Get the current offset of this sensor. The offset is stored as a int16_t and can be both postive or negative.
|
|
| Sensor () |
|
| Sensor (Sensor &&other) |
|
virtual | ~Sensor () |
|
void | sample () override |
| Sample the sensor.
|
|
virtual ND015XData | getLastSample () |
|
virtual | ~AbstractSensor () |
|
SensorErrors | getLastError () |
| Get last error for debugging purposes. Avoid silent fails.
|
|
|
ND015XData | sampleImpl () override |
| Read a data sample from the sensor. In case of errors, the method should return the last available correct sample.
|
|
Definition at line 35 of file ND015D.h.
◆ BWLimitFilter
Enumerator |
---|
BWL_1 | |
BWL_2 | |
BWL_5 | |
BWL_10 | |
BWL_20 | |
BWL_50 | |
BWL_100 | |
BWL_200 | |
Definition at line 68 of file ND015D.h.
◆ FullScaleRange
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 44 of file ND015D.h.
◆ IOWatchdogEnable
Enumerator |
---|
DISABLED | |
ENABLED | |
Definition at line 62 of file ND015D.h.
◆ NotchEnable
Enumerator |
---|
DISABLED | |
ENABLED | |
Definition at line 80 of file ND015D.h.
◆ ND015D() [1/2]
Boardcore::ND015D::ND015D |
( |
SPIBusInterface & |
bus, |
|
|
miosix::GpioPin |
cs, |
|
|
SPIBusConfig |
spiConfig, |
|
|
DMAStreamGuard * |
streamRx, |
|
|
DMAStreamGuard * |
streamTx, |
|
|
std::chrono::nanoseconds |
timeoutDma, |
|
|
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
-
bus | SPI bus interface. |
cs | Chip select GPIO pin. |
spiConfig | SPI bus configuration. |
streamRx | Dma receiving stream for the spi bus. |
streamTx | Dma transmitting stream for the spi bus. |
timeoutDma | Timeout for the dma transactions. |
Definition at line 53 of file ND015D.cpp.
◆ ND015D() [2/2]
Constructor for the ND015D sensor.
- Parameters
-
bus | SPI bus interface. |
cs | Chip select GPIO pin. |
spiConfig | SPI bus configuration. |
Definition at line 64 of file ND015D.cpp.
◆ 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 93 of file ND015D.cpp.
◆ getDefaultSPIConfig()
◆ getOffset()
float Boardcore::ND015D::getOffset |
( |
| ) |
|
Get the current offset of this sensor. The offset is stored as a int16_t and can be both postive or negative.
Definition at line 204 of file ND015D.cpp.
◆ init()
bool Boardcore::ND015D::init |
( |
| ) |
|
|
overridevirtual |
◆ rangeToPressure()
Converts the FullScale value to its corresponding range.
- Parameters
-
- Returns
- Pressure range.
Definition at line 148 of file ND015D.cpp.
◆ sampleImpl()
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 206 of file ND015D.cpp.
◆ selfTest()
bool Boardcore::ND015D::selfTest |
( |
| ) |
|
|
overridevirtual |
◆ setBWLimitFilter()
Sets the bandwidth limit filter for the sensor.
- Parameters
-
bwl | Bandwidth limit filter setting. |
Definition at line 180 of file ND015D.cpp.
◆ setFullScaleRange()
Sets the full-scale range for the sensor.
- Parameters
-
Definition at line 135 of file ND015D.cpp.
◆ setIOWatchdog()
Enables or disables the IO watchdog.
- Parameters
-
Definition at line 169 of file ND015D.cpp.
◆ setNotch()
Enables or disables the notch filter.
- Parameters
-
Definition at line 191 of file ND015D.cpp.
◆ setOffset()
void Boardcore::ND015D::setOffset |
( |
float |
offset | ) |
|
Set the offset of this sensor. The offset is stored as a int16_t and can be both postive or negative.
- Parameters
-
The | value the offset should be set to |
Definition at line 202 of file ND015D.cpp.
◆ setOutputDataRate()
void Boardcore::ND015D::setOutputDataRate |
( |
uint8_t |
odr | ) |
|
function to set the output data rate
- Parameters
-
odr | output 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 124 of file ND015D.cpp.
◆ updateOffset()
void Boardcore::ND015D::updateOffset |
( |
float |
offset | ) |
|
Modify the offset of this sensor. The offset is stored as a int16_t and can be both postive or negative.
- Parameters
-
The | value to be added to the current offset |
Definition at line 203 of file ND015D.cpp.
◆ bwl
◆ fsr
◆ iow
◆ MODEL_NAME
const char Boardcore::ND015D::MODEL_NAME = "ND015D" |
|
static |
◆ ntc
◆ odr
uint8_t Boardcore::ND015D::odr |
The documentation for this class was generated from the following files: