esp32_BNO08x 1.3
C++ BNO08x IMU driver component for esp-idf.
Loading...
Searching...
No Matches
BNO08xSH2HAL Class Reference

Fully static class containing callback implementations for sh2 HAL lib. More...

#include <BNO08xSH2HAL.hpp>

Collaboration diagram for BNO08xSH2HAL:

Static Public Member Functions

static void set_hal_imu (BNO08x *hal_imu)
 Sets the BNO08x driver object to be used with sh2 HAL lib callbacks.
 
static int spi_open (sh2_Hal_t *self)
 Opens SPI instance by waiting for interrupt.
 
static void spi_close (sh2_Hal_t *self)
 Closes SPI instance (nothing to do here, but required by sh2 HAL lib for cases where other communication protocols are used.)
 
static int spi_read (sh2_Hal_t *self, uint8_t *pBuffer, unsigned len, uint32_t *t_us)
 SPI rx callback for sh2 HAL lib.
 
static int spi_write (sh2_Hal_t *self, uint8_t *pBuffer, unsigned len)
 SPI tx callback for sh2 HAL lib.
 
static uint32_t get_time_us (sh2_Hal_t *self)
 Get time in microseconds callback for sh2 HAL lib.
 
static void hal_cb (void *cookie, sh2_AsyncEvent_t *pEvent)
 General event callback for sh2 HAL lib, used to notify tasks of reset.
 
static void sensor_event_cb (void *cookie, sh2_SensorEvent_t *event)
 Sensor event callback for sh2 HAL lib, sends received reports to data_proc_task().
 

Static Private Member Functions

static void hardware_reset ()
 Hardware reset callback for sh2 HAL lib, toggle RST gpio.
 
static bool spi_wait_for_int ()
 SPI wait for HINT sh2 HAL lib callback.
 
static uint16_t spi_read_sh2_packet_header (uint8_t *pBuffer)
 SPI rx packet header (invoked from SPI rx callback.)
 
static int spi_read_sh2_packet_body (uint8_t *pBuffer, uint16_t packet_sz)
 SPI rx packet body (invoked from SPI rx callback.)
 

Static Private Attributes

static BNO08ximu
 
static const constexpr char * TAG = "BNO08xSH2HAL"
 

Detailed Description

Fully static class containing callback implementations for sh2 HAL lib.

Member Function Documentation

◆ get_time_us()

uint32_t BNO08xSH2HAL::get_time_us ( sh2_Hal_t * self)
static

Get time in microseconds callback for sh2 HAL lib.

Parameters
selfsh2 HAL lib object being used with BNO08x driver instance.
Returns
Time in microseconds.
Here is the caller graph for this function:

◆ hal_cb()

void BNO08xSH2HAL::hal_cb ( void * cookie,
sh2_AsyncEvent_t * pEvent )
static

General event callback for sh2 HAL lib, used to notify tasks of reset.

Parameters
cookieUser set input parameter as void pointer (unused), see sh2_Open().
pEventPointer to asynchronous event.
Returns
void, nothing to return
Here is the caller graph for this function:

◆ hardware_reset()

void BNO08xSH2HAL::hardware_reset ( )
staticprivate

Hardware reset callback for sh2 HAL lib, toggle RST gpio.

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

◆ sensor_event_cb()

void BNO08xSH2HAL::sensor_event_cb ( void * cookie,
sh2_SensorEvent_t * event )
static

Sensor event callback for sh2 HAL lib, sends received reports to data_proc_task().

Parameters
cookieUser set input parameter as void pointer (unused), see sh2_Open().
eventPointer to sensor event.
Returns
void, nothing to return
Here is the caller graph for this function:

◆ set_hal_imu()

void BNO08xSH2HAL::set_hal_imu ( BNO08x * hal_imu)
static

Sets the BNO08x driver object to be used with sh2 HAL lib callbacks.

Parameters
hal_imuPointer to BNO08x driver object to be used with sh2 HAL lib callbacks.
Returns
void, nothing to return
Here is the caller graph for this function:

◆ spi_close()

void BNO08xSH2HAL::spi_close ( sh2_Hal_t * self)
static

Closes SPI instance (nothing to do here, but required by sh2 HAL lib for cases where other communication protocols are used.)

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

◆ spi_open()

int BNO08xSH2HAL::spi_open ( sh2_Hal_t * self)
static

Opens SPI instance by waiting for interrupt.

Returns
Always returns 0.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ spi_read()

int BNO08xSH2HAL::spi_read ( sh2_Hal_t * self,
uint8_t * pBuffer,
unsigned len,
uint32_t * t_us )
static

SPI rx callback for sh2 HAL lib.

Parameters
selfsh2 HAL lib object being used with BNO08x driver instance.
pBufferBuffer to store received packet.
lenLength of bytes to read.
t_usTime in microseconds (unused, forced sh2 HAL lib required function type)
Returns
Size of received packet in bytes, 0 on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ spi_read_sh2_packet_body()

int BNO08xSH2HAL::spi_read_sh2_packet_body ( uint8_t * pBuffer,
uint16_t packet_sz )
staticprivate

SPI rx packet body (invoked from SPI rx callback.)

Parameters
pBufferBuffer to store received packet body.
Returns
Packet size, 0 on failure.
Here is the caller graph for this function:

◆ spi_read_sh2_packet_header()

uint16_t BNO08xSH2HAL::spi_read_sh2_packet_header ( uint8_t * pBuffer)
staticprivate

SPI rx packet header (invoked from SPI rx callback.)

Parameters
pBufferBuffer to store received header.
Returns
Packet size (should always be 4), 0 on failure.
Here is the caller graph for this function:

◆ spi_wait_for_int()

bool BNO08xSH2HAL::spi_wait_for_int ( )
staticprivate

SPI wait for HINT sh2 HAL lib callback.

Returns
True if interrupt was detected before timeout.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ spi_write()

int BNO08xSH2HAL::spi_write ( sh2_Hal_t * self,
uint8_t * pBuffer,
unsigned len )
static

SPI tx callback for sh2 HAL lib.

Parameters
selfsh2 HAL lib object being used with BNO08x driver instance.
pBufferBuffer containing data to write.
lenLength in bytes to write.
Returns
Size of sent data (len param), 0 on failure.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ imu

BNO08x * BNO08xSH2HAL::imu
staticprivate

◆ TAG

const constexpr char* BNO08xSH2HAL::TAG = "BNO08xSH2HAL"
staticconstexprprivate

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