Data Logger BLE Cellular Board
Loading...
Searching...
No Matches
common.c File Reference

Common utility functions and definitions for the BME68X sensor interface. More...

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <zephyr/drivers/i2c.h>
#include "bme68x.h"
#include "common.h"
#include "jfet_common.h"

Go to the source code of this file.

Macros

#define BME68X_SHUTTLE_ID   0x93
 BME68X shuttle board ID.
 

Functions

BME68X_INTF_RET_TYPE bme68x_i2c_read (uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *intf_ptr)
 Function for reading the sensor's registers through I2C bus.
 
BME68X_INTF_RET_TYPE bme68x_i2c_write (uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, void *intf_ptr)
 Function for writing the sensor's registers through I2C bus.
 
BME68X_INTF_RET_TYPE bme68x_spi_read (uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *intf_ptr)
 Function for reading the sensor's registers through SPI bus.
 
BME68X_INTF_RET_TYPE bme68x_spi_write (uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, void *intf_ptr)
 Function for writing the sensor's registers through SPI bus.
 
void bme68x_delay_us (uint32_t period, void *intf_ptr)
 This function provides the delay for required time (Microsecond) as per the input provided in some of the APIs.
 
void bme68x_check_rslt (const char api_name[], int8_t rslt)
 Log BME68X API result and error details.
 
int8_t bme68x_interface_init (struct bme68x_dev *bme, uint8_t intf)
 Function to select the interface between SPI and I2C.
 

Variables

static uint8_t dev_addr
 

Detailed Description

Common utility functions and definitions for the BME68X sensor interface.

Note
SPDX-License-Identifier: BSD-3-Clause

Definition in file common.c.

Macro Definition Documentation

◆ BME68X_SHUTTLE_ID

#define BME68X_SHUTTLE_ID   0x93

BME68X shuttle board ID.

Macro definitions

Definition at line 23 of file common.c.

Function Documentation

◆ bme68x_check_rslt()

void bme68x_check_rslt ( const char api_name[],
int8_t rslt )

Log BME68X API result and error details.

Parameters
api_nameName of the called BME68X API.
rsltResult code returned by the BME68X function.

Definition at line 361 of file common.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bme68x_delay_us()

void bme68x_delay_us ( uint32_t period,
void * intf_ptr )

This function provides the delay for required time (Microsecond) as per the input provided in some of the APIs.

Parameters
[in]period: The required wait time in microsecond.
[in]intf_ptr: Interface pointer

Definition at line 347 of file common.c.

Here is the caller graph for this function:

◆ bme68x_i2c_read()

BME68X_INTF_RET_TYPE bme68x_i2c_read ( uint8_t reg_addr,
uint8_t * reg_data,
uint32_t len,
void * intf_ptr )

Function for reading the sensor's registers through I2C bus.

Parameters
[in]reg_addr: Register address.
[out]reg_data: Pointer to the data buffer to store the read data.
[in]len: No of bytes to read.
[in]intf_ptr: Interface pointer
Returns
Status of execution
Return values
=BME68X_INTF_RET_SUCCESS -> Success
!=BME68X_INTF_RET_SUCCESS -> Failure Info

Definition at line 228 of file common.c.

Here is the caller graph for this function:

◆ bme68x_i2c_write()

BME68X_INTF_RET_TYPE bme68x_i2c_write ( uint8_t reg_addr,
const uint8_t * reg_data,
uint32_t len,
void * intf_ptr )

Function for writing the sensor's registers through I2C bus.

Parameters
[in]reg_addr: Register address.
[in]reg_data: Pointer to the data buffer whose value is to be written.
[in]len: No of bytes to write.
[in]intf_ptr: Interface pointer
Returns
Status of execution
Return values
=BME68X_INTF_RET_SUCCESS -> Success
!=BME68X_INTF_RET_SUCCESS -> Failure Info

Definition at line 250 of file common.c.

Here is the caller graph for this function:

◆ bme68x_interface_init()

int8_t bme68x_interface_init ( struct bme68x_dev * bme,
uint8_t intf )

Function to select the interface between SPI and I2C.

Parameters
[in]bme: Structure instance of bme68x_dev
[in]intf: Interface selection parameter
Returns
Status of execution
Return values
0-> Success
<0 -> Failure Info

Definition at line 401 of file common.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bme68x_spi_read()

BME68X_INTF_RET_TYPE bme68x_spi_read ( uint8_t reg_addr,
uint8_t * reg_data,
uint32_t len,
void * intf_ptr )

Function for reading the sensor's registers through SPI bus.

Parameters
[in]reg_addr: Register address.
[out]reg_data: Pointer to the data buffer to store the read data.
[in]len: No of bytes to read.
[in]intf_ptr: Interface pointer
Returns
Status of execution
Return values
=BME68X_INTF_RET_SUCCESS -> Success
!=BME68X_INTF_RET_SUCCESS -> Failure Info

Definition at line 271 of file common.c.

Here is the caller graph for this function:

◆ bme68x_spi_write()

BME68X_INTF_RET_TYPE bme68x_spi_write ( uint8_t reg_addr,
const uint8_t * reg_data,
uint32_t len,
void * intf_ptr )

Function for writing the sensor's registers through SPI bus.

Parameters
[in]reg_addr: Register address.
[in]reg_data: Pointer to the data buffer whose data has to be written.
[in]len: No of bytes to write.
[in]intf_ptr: Interface pointer
Returns
Status of execution
Return values
=BME68X_INTF_RET_SUCCESS -> Success
!=BME68X_INTF_RET_SUCCESS -> Failure Info

Definition at line 318 of file common.c.

Here is the caller graph for this function:

Variable Documentation

◆ dev_addr

uint8_t dev_addr
static

Static variable definition

Definition at line 27 of file common.c.