esp32_BNO08x 1.4
C++ BNO08x IMU driver component for esp-idf.
BNO08xRpt Class Referenceabstract

Class to represent and manage reports returned from BNO08x. More...

#include <report/BNO08xRpt.hpp>

Inheritance diagram for BNO08xRpt:
Collaboration diagram for BNO08xRpt:

Public Member Functions

bool disable (sh2_SensorConfig_t sensor_cfg=BNO08xPrivateTypes::default_sensor_cfg)
 Disables a sensor report by setting its period to 0us such that the BNO08x stops sending it. More...
 
bool register_cb (std::function< void(void)> cb_fxn)
 Registers a callback to execute when new data from a specific report is received. More...
 
bool has_new_data ()
 Checks if a new report has been received since the last time this function was called. More...
 
bool flush ()
 Flush all buffered reports for this sensor/report module. More...
 
bool get_sample_counts (bno08x_sample_counts_t &sample_counts)
 Gets sample counts for this sensor (see SH-2 ref manual 6.4.3.1) More...
 
bool clear_sample_counts ()
 Clears BNO08x internal sample counts for this sensor. (see SH-2 ref manual 6.4.3.1) More...
 
bool get_meta_data (bno08x_meta_data_t &meta_data)
 Retrieves meta data for this sensor/report by reading respective record in FRS (flash record system). More...
 
virtual bool enable (uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg=BNO08xPrivateTypes::default_sensor_cfg)=0
 

Protected Member Functions

bool rpt_enable (uint32_t time_between_reports, sh2_SensorConfig_t sensor_cfg=BNO08xPrivateTypes::default_sensor_cfg)
 Enables a sensor report such that the BNO08x begins sending it. More...
 
virtual void update_data (sh2_SensorValue_t *sensor_val)=0
 
 BNO08xRpt (uint8_t ID, EventBits_t rpt_bit, BNO08xPrivateTypes::bno08x_sync_ctx_t *sync_ctx)
 BNO08xRpt report constructor. More...
 
void unlock_sh2_HAL ()
 Unlocks sh2 HAL lib to allow other tasks to call its APIs. More...
 
void lock_sh2_HAL ()
 Locks sh2 HAL lib to only allow the calling task to call its APIs. More...
 
void unlock_user_data ()
 Unlocks user data to allow other tasks to read/modify it. More...
 
void lock_user_data ()
 Locks locks user data to only allow the calling task to read/modify it. More...
 
void signal_data_available ()
 Signals to BNO08x::data_available() that a new report has arrived. More...
 

Protected Attributes

uint8_t ID
 Report ID, ex. SH2_ACCELERATION. More...
 
EventBits_t rpt_bit
 Respective enable and data bit for report in evt_grp_rpt_en and evt_grp_rpt_data. More...
 
uint32_t period_us
 The period/interval of the report in microseconds. More...
 
BNO08xPrivateTypes::bno08x_sync_ctx_tsync_ctx
 

Static Protected Attributes

static const constexpr float RAD_2_DEG
 Constant for radian to degree conversions, sed in quaternion to euler function conversions. More...
 
static const constexpr char * TAG = "BNO08xRpt"
 

Friends

class BNO08x
 

Detailed Description

Class to represent and manage reports returned from BNO08x.

Constructor & Destructor Documentation

◆ BNO08xRpt()

BNO08xRpt::BNO08xRpt ( uint8_t  ID,
EventBits_t  rpt_bit,
BNO08xPrivateTypes::bno08x_sync_ctx_t sync_ctx 
)
inlineprotected

BNO08xRpt report constructor.

Construct a BNO08xRpt object for managing a BNO08x sensor report.

Parameters
imuPointer to BNO08x imu object.
report_IDReport ID, ex. SH2_ACCELERATION.
rpt_bitRespective enable bit for report in BNO08x::evt_grp_report_en.
period_usThe period/interval of the report in microseconds.
Returns
void, nothing to return

Member Function Documentation

◆ clear_sample_counts()

bool BNO08xRpt::clear_sample_counts ( )

Clears BNO08x internal sample counts for this sensor. (see SH-2 ref manual 6.4.3.1)

Returns
True clear counts operation succeeded.
Here is the call graph for this function:

◆ disable()

bool BNO08xRpt::disable ( sh2_SensorConfig_t  sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg)

Disables a sensor report by setting its period to 0us such that the BNO08x stops sending it.

Parameters
sensor_IDThe ID of the sensor for the respective report to be disabled.
sensor_cfgSensor special configuration.
Returns
ESP_OK if report was successfully disabled.
Here is the call graph for this function:

◆ enable()

◆ flush()

bool BNO08xRpt::flush ( )

Flush all buffered reports for this sensor/report module.

Returns
True if flush operation succeeded.
Here is the call graph for this function:

◆ get_meta_data()

bool BNO08xRpt::get_meta_data ( bno08x_meta_data_t meta_data)

Retrieves meta data for this sensor/report by reading respective record in FRS (flash record system).

Can be used to retrieve the minimum period, maximum period, actual Q points, resolution, and other info for a given sensor.

Returns
True clear get meta data operation succeeded.
Here is the call graph for this function:

◆ get_sample_counts()

bool BNO08xRpt::get_sample_counts ( bno08x_sample_counts_t sample_counts)

Gets sample counts for this sensor (see SH-2 ref manual 6.4.3.1)

Parameters
Structto store requested data.
Returns
True get counts operation succeeded.
Here is the call graph for this function:

◆ has_new_data()

bool BNO08xRpt::has_new_data ( )

Checks if a new report has been received since the last time this function was called.

Returns
True if a new report was received since the last time this function was called.
Here is the caller graph for this function:

◆ lock_sh2_HAL()

void BNO08xRpt::lock_sh2_HAL ( )
protected

Locks sh2 HAL lib to only allow the calling task to call its APIs.

Returns
void, nothing to return
Here is the caller graph for this function:

◆ lock_user_data()

void BNO08xRpt::lock_user_data ( )
protected

Locks locks user data to only allow the calling task to read/modify it.

Returns
void, nothing to return
Here is the caller graph for this function:

◆ register_cb()

bool BNO08xRpt::register_cb ( std::function< void(void)>  cb_fxn)

Registers a callback to execute when new data from a specific report is received.

Parameters
cb_fxnPointer to the call-back function should be of void return type void input param.
Returns
void, nothing to return

◆ rpt_enable()

bool BNO08xRpt::rpt_enable ( uint32_t  time_between_reports,
sh2_SensorConfig_t  sensor_cfg = BNO08xPrivateTypes::default_sensor_cfg 
)
protected

Enables a sensor report such that the BNO08x begins sending it.

Parameters
report_period_usThe period/interval of the report in microseconds.
sensor_cfgSensor special configuration (optional, see BNO08xPrivateTypes::default_sensor_cfg for defaults).
Returns
True if report was successfully enabled.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ signal_data_available()

void BNO08xRpt::signal_data_available ( )
protected

Signals to BNO08x::data_available() that a new report has arrived.

Returns
void, nothing to return

◆ unlock_sh2_HAL()

void BNO08xRpt::unlock_sh2_HAL ( )
protected

Unlocks sh2 HAL lib to allow other tasks to call its APIs.

Returns
void, nothing to return
Here is the caller graph for this function:

◆ unlock_user_data()

void BNO08xRpt::unlock_user_data ( )
protected

Unlocks user data to allow other tasks to read/modify it.

Returns
void, nothing to return
Here is the caller graph for this function:

◆ update_data()

virtual void BNO08xRpt::update_data ( sh2_SensorValue_t *  sensor_val)
protectedpure virtual

Friends And Related Function Documentation

◆ BNO08x

friend class BNO08x
friend

Member Data Documentation

◆ ID

uint8_t BNO08xRpt::ID
protected

Report ID, ex. SH2_ACCELERATION.

◆ period_us

uint32_t BNO08xRpt::period_us
protected

The period/interval of the report in microseconds.

◆ RAD_2_DEG

const constexpr float BNO08xRpt::RAD_2_DEG
staticconstexprprotected
Initial value:
=
(180.0f / M_PI)

Constant for radian to degree conversions, sed in quaternion to euler function conversions.

◆ rpt_bit

EventBits_t BNO08xRpt::rpt_bit
protected

Respective enable and data bit for report in evt_grp_rpt_en and evt_grp_rpt_data.

◆ sync_ctx

BNO08xPrivateTypes::bno08x_sync_ctx_t* BNO08xRpt::sync_ctx
protected

◆ TAG

const constexpr char* BNO08xRpt::TAG = "BNO08xRpt"
staticconstexprprotected

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