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

#include <L3GD20.h>

Inheritance diagram for Boardcore::L3GD20:
Collaboration diagram for Boardcore::L3GD20:

Public Types

enum class  FullScaleRange { FS_250 = 250 , FS_500 = 500 , FS_2000 = 2000 }
 
enum class  OutPutDataRate { ODR_95 = 95 , ODR_190 = 190 , ODR_380 = 380 , ODR_760 = 760 }
 
- Public Types inherited from Boardcore::Sensor< Data >
using DataType = Data
 

Public Member Functions

 L3GD20 (SPIBusInterface &bus, miosix::GpioPin cs, FullScaleRange range=FullScaleRange::FS_250, OutPutDataRate odr=OutPutDataRate::ODR_95, uint8_t cutoffFreq=0x03)
 Creates an instance of an L3GD20 sensor.
 
 L3GD20 (SPIBusInterface &bus, miosix::GpioPin cs, SPIBusConfig cfg, FullScaleRange range=FullScaleRange::FS_250, OutPutDataRate odr=OutPutDataRate::ODR_95, uint8_t cutoffFreq=0x03)
 Creates an instance of an L3GD20 sensor.
 
void enableFifo (unsigned int fifoWatermark)
 Enables storing samples in a FIFO, must be called before init().
 
bool init ()
 Initialize the sensor.
 
bool selfTest ()
 Check if the sensor is working.
 
L3GD20Data sampleImpl ()
 Read a data sample from the sensor. In case of errors, the method should return the last available correct sample.
 
- Public Member Functions inherited from Boardcore::SensorFIFO< L3GD20Data, L3GD20_FIFO_SIZE >
 SensorFIFO ()
 
 SensorFIFO (SensorFIFO &&other)
 
const std::array< L3GD20Data, FifoSize > getLastFifo (uint16_t &lastFifoSize)
 
virtual void IRQupdateTimestamp (uint64_t ts)
 Called by the interrupt handling routine: provides the timestamp of the last interrupt (if FIFO is disabled) or the last watermark interrupt (if FIFO enabled)
 
- Public Member Functions inherited from Boardcore::Sensor< Data >
 Sensor ()
 
 Sensor (Sensor &&other)
 
virtual ~Sensor ()
 
void sample () override
 Sample the sensor.
 
virtual Data getLastSample ()
 
- Public Member Functions inherited from Boardcore::AbstractSensor
virtual ~AbstractSensor ()
 
SensorErrors getLastError ()
 Get last error for debugging purposes. Avoid silent fails.
 

Additional Inherited Members

- Protected Attributes inherited from Boardcore::SensorFIFO< L3GD20Data, L3GD20_FIFO_SIZE >
std::array< L3GD20Data, FifoSize > lastFifo
 
uint16_t lastFifoLevel
 
uint64_t lastInterruptTimestamp
 
uint64_t interruptTimestampDelta
 
- Protected Attributes inherited from Boardcore::Sensor< Data >
DataType lastSample
 
miosix::FastMutex mutex
 
- Protected Attributes inherited from Boardcore::AbstractSensor
SensorErrors lastError = SensorErrors::NO_ERRORS
 

Detailed Description

Definition at line 41 of file L3GD20.h.

Member Enumeration Documentation

◆ FullScaleRange

Enumerator
FS_250 
FS_500 
FS_2000 

Definition at line 44 of file L3GD20.h.

◆ OutPutDataRate

Enumerator
ODR_95 
ODR_190 
ODR_380 
ODR_760 

Definition at line 51 of file L3GD20.h.

Constructor & Destructor Documentation

◆ L3GD20() [1/2]

Boardcore::L3GD20::L3GD20 ( SPIBusInterface & bus,
miosix::GpioPin cs,
FullScaleRange range = FullScaleRange::FS_250,
OutPutDataRate odr = OutPutDataRate::ODR_95,
uint8_t cutoffFreq = 0x03 )
inline

Creates an instance of an L3GD20 sensor.

Parameters
busSPI bus the sensor is connected to
csChip Select GPIO
rangeFull Scale Range (See datasheet)
odrOutput Data Rate (See datasheet)
cutoffFreqLow pass filter cutoff frequency (See datasheet)

Definition at line 68 of file L3GD20.h.

◆ L3GD20() [2/2]

Boardcore::L3GD20::L3GD20 ( SPIBusInterface & bus,
miosix::GpioPin cs,
SPIBusConfig cfg,
FullScaleRange range = FullScaleRange::FS_250,
OutPutDataRate odr = OutPutDataRate::ODR_95,
uint8_t cutoffFreq = 0x03 )
inline

Creates an instance of an L3GD20 sensor.

Parameters
busSPI bus the sensor is connected to
csChip Select GPIO
cfgCustom SPI bus configuration
rangeFull Scale Range (See datasheet)
odrOutput Data Rate (See datasheet)
cutoffFreqLow pass filter cutoff selector (See datasheet)

Definition at line 88 of file L3GD20.h.

Member Function Documentation

◆ enableFifo()

void Boardcore::L3GD20::enableFifo ( unsigned int fifoWatermark)
inline

Enables storing samples in a FIFO, must be called before init().

Parameters
fifoWatermarkHow many samples in the FIFO when the fifo watermark input is generated on INT2.

Definition at line 114 of file L3GD20.h.

◆ init()

bool Boardcore::L3GD20::init ( )
inlinevirtual

Initialize the sensor.

Returns
boolean value indicating whether the operation succeded or not

Implements Boardcore::AbstractSensor.

Definition at line 120 of file L3GD20.h.

◆ sampleImpl()

L3GD20Data Boardcore::L3GD20::sampleImpl ( )
inlinevirtual

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< Data >.

Definition at line 198 of file L3GD20.h.

◆ selfTest()

bool Boardcore::L3GD20::selfTest ( )
inlinevirtual

Check if the sensor is working.

Returns
boolean indicating whether the sensor is correctly working or not

Implements Boardcore::AbstractSensor.

Definition at line 196 of file L3GD20.h.


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