# esp32_BNO08x: BNO08xSH2HAL Class Reference

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:
[legend]

## 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 BNO08x * | imu
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

  self | sh2 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

  cookie | User set input parameter as void pointer (unused), see sh2_Open().
  pEvent | Pointer 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

  cookie | User set input parameter as void pointer (unused), see sh2_Open().
  event | Pointer 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_imu | Pointer 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

  self | sh2 HAL lib object being used with BNO08x driver instance.
  pBuffer | Buffer to store received packet.
  len | Length of bytes to read.
  t_us | Time 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

  pBuffer | Buffer 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

  pBuffer | Buffer 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

  self | sh2 HAL lib object being used with BNO08x driver instance.
  pBuffer | Buffer containing data to write.
  len | Length 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:

- include/BNO08xSH2HAL.hpp
- source/BNO08xSH2HAL.cpp