forked from boschsensortec/BMI08x_SensorAPI
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdrv_bmi088.h
93 lines (81 loc) · 2.74 KB
/
drv_bmi088.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/**\
* Copyright (c) 2021 Bosch Sensortec GmbH. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
**/
#ifndef _DRV_BMI088_H
#define _DRV_BMI088_H
/*! CPP guard */
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include "bmi08x_defs.h"
/*!
* @brief Function for reading the sensor's registers through SPI bus.
*
* @param[in] reg_addr : Register address.
* @param[out] reg_data : Pointer to the data buffer to store the read data.
* @param[in] length : No of bytes to read.
* @param[in] intf_ptr : Interface pointer
*
* @return Status of execution
* @retval = BMI08X_INTF_RET_SUCCESS -> Success
* @retval != BMI08X_INTF_RET_SUCCESS -> Failure Info
*
*/
BMI08X_INTF_RET_TYPE bmi08x_spi_read(uint8_t reg_addr, uint8_t *reg_data, uint32_t len, void *intf_ptr);
/*!
* @brief Function for writing the sensor's registers through SPI bus.
*
* @param[in] reg_addr : Register address.
* @param[in] reg_data : Pointer to the data buffer whose data has to be written.
* @param[in] length : No of bytes to write.
* @param[in] intf_ptr : Interface pointer
*
* @return Status of execution
* @retval = BMI08X_INTF_RET_SUCCESS -> Success
* @retval != BMI08X_INTF_RET_SUCCESS -> Failure Info
*
*/
BMI08X_INTF_RET_TYPE bmi08x_spi_write(uint8_t reg_addr, const uint8_t *reg_data, uint32_t len, void *intf_ptr);
/*!
* @brief This function provides the delay for required time (Microsecond) as per the input provided in some of the
* APIs.
*
* @param[in] period_us : The required wait time in microsecond.
* @param[in] intf_ptr : Interface pointer
*
* @return void.
*
*/
void bmi08x_delay_us(uint32_t period, void *intf_ptr);
/*!
* @brief Function to select the interface between SPI and I2C.
*
* @param[in] bma : Structure instance of bmi08x_dev
* @param[in] intf : Interface selection parameter
* For I2C : BMI08X_I2C_INTF
* For SPI : BMI08X_SPI_INTF
* @param[in] variant : Sensor variant parameter
* For BMI085 : BMI085_VARIANT
* For BMI088 : BMI088_VARIANT
*
* @return Status of execution
* @retval 0 -> Success
* @retval < 0 -> Failure Info
*/
int8_t bmi08x_interface_init(struct bmi08x_dev *bmi08x, uint8_t intf, enum bmi08x_variant variant);
/*!
* @brief Prints the execution status of the APIs.
*
* @param[in] api_name : Name of the API whose execution status has to be printed.
* @param[in] rslt : Error code returned by the API whose execution status has to be printed.
*
* @return void.
*/
void bmi08x_error_codes_print_result(const char api_name[], int8_t rslt);
#ifdef __cplusplus
}
#endif /* End of CPP guard */
#endif /* COMMON_H */