From: lse8cob Date: Mon, 14 Mar 2016 09:24:03 +0000 (+0530) Subject: Magic numbers replaced with meaningful macros X-Git-Tag: f1~3 X-Git-Url: http://git.ece.ufrgs.br/?a=commitdiff_plain;h=707c0e4b16db7f2c7074647a279d0425c813687b;p=BNO055_driver.git Magic numbers replaced with meaningful macros --- diff --git a/README.md b/README.md index a6624d3..4bfe723 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ INTRODUCTION VERSION ========= - Version of bno055 sensor driver is: - * bno055.c - V2.0.2 - * bno055.h - V2.0.2 - * bno055_support.c - V1.0.3 + * bno055.c - V2.0.3 + * bno055.h - V2.0.3 + * bno055_support.c - V1.0.4 INTEGRATION DETAILS ===================== @@ -56,6 +56,6 @@ SUPPORTED SENSOR INTERFACE COPYRIGHT =========== - - Copyright (C) 2013 - 2014 Bosch Sensortec GmbH + - Copyright (C) 2015 - 2016 Bosch Sensortec GmbH diff --git a/bno055.c b/bno055.c index 495048d..ce006b5 100644 --- a/bno055.c +++ b/bno055.c @@ -1,13 +1,13 @@ /* * **************************************************************************** -* Copyright (C) 2013 - 2014 Bosch Sensortec GmbH +* Copyright (C) 2015 - 2016 Bosch Sensortec GmbH * * File : bno055.c * -* Date : 2014/12/12 +* Date : 2016/03/14 * -* Revision : 2.0.2 $ +* Revision : 2.0.3 $ * * Usage: Sensor Driver file for BNO055 sensor * @@ -64,7 +64,7 @@ static struct bno055_t *p_bno055; /* LOCAL FUNCTIONS */ /*! * @brief - * This function is used for initialize + * This API is used for initialize * bus read, bus write function pointers,device * address,accel revision id, gyro revision id * mag revision id, software revision id, boot loader @@ -74,8 +74,8 @@ static struct bno055_t *p_bno055; * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While changing the parameter of the bno055_t * consider the following point: @@ -89,65 +89,65 @@ BNO055_RETURN_FUNCTION_TYPE bno055_init(struct bno055_t *bno055) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8 = BNO055_ZERO_U8X; - u8 v_page_zero_u8 = PAGE_ZERO; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8 = BNO055_INIT_VALUE; + u8 bno055_page_zero_u8 = BNO055_PAGE_ZERO; /* Array holding the Software revision id */ - u8 a_SW_ID_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; + u8 a_SW_ID_u8[BNO055_REV_ID_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; /* stuct parameters are assign to bno055*/ p_bno055 = bno055; /* Write the default page as zero*/ com_rslt = p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_PAGE_ID__REG, &v_page_zero_u8, BNO055_ONE_U8X); + BNO055_PAGE_ID_REG, &bno055_page_zero_u8, BNO055_GEN_READ_WRITE_LENGTH); /* Read the chip id of the sensor from page zero 0x00 register*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_CHIP_ID__REG, &v_data_u8, BNO055_ONE_U8X); - p_bno055->chip_id = v_data_u8; + BNO055_CHIP_ID_REG, &data_u8, BNO055_GEN_READ_WRITE_LENGTH); + p_bno055->chip_id = data_u8; /* Read the accel revision id from page zero 0x01 register*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_REV_ID__REG, &v_data_u8, BNO055_ONE_U8X); - p_bno055->accel_rev_id = v_data_u8; + BNO055_ACCEL_REV_ID_REG, &data_u8, BNO055_GEN_READ_WRITE_LENGTH); + p_bno055->accel_rev_id = data_u8; /* Read the mag revision id from page zero 0x02 register*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_REV_ID__REG, &v_data_u8, BNO055_ONE_U8X); - p_bno055->mag_rev_id = v_data_u8; + BNO055_MAG_REV_ID_REG, &data_u8, BNO055_GEN_READ_WRITE_LENGTH); + p_bno055->mag_rev_id = data_u8; /* Read the gyro revision id from page zero 0x02 register*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_REV_ID__REG, &v_data_u8, BNO055_ONE_U8X); - p_bno055->gyro_rev_id = v_data_u8; + BNO055_GYRO_REV_ID_REG, &data_u8, BNO055_GEN_READ_WRITE_LENGTH); + p_bno055->gyro_rev_id = data_u8; /* Read the boot loader revision from page zero 0x06 register*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_BL_REV_ID__REG, &v_data_u8, BNO055_ONE_U8X); - p_bno055->bl_rev_id = v_data_u8; + BNO055_BL_REV_ID_REG, &data_u8, BNO055_GEN_READ_WRITE_LENGTH); + p_bno055->bl_rev_id = data_u8; /* Read the software revision id from page zero 0x04 and 0x05 register( 2 bytes of data)*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC(p_bno055->dev_addr, - BNO055_SW_REV_ID_LSB__REG, - a_SW_ID_u8, BNO055_TWO_U8X); - a_SW_ID_u8[INDEX_ZERO] = BNO055_GET_BITSLICE( - a_SW_ID_u8[INDEX_ZERO], + BNO055_SW_REV_ID_LSB_REG, + a_SW_ID_u8, BNO055_LSB_MSB_READ_LENGTH); + a_SW_ID_u8[BNO055_SW_ID_LSB] = BNO055_GET_BITSLICE( + a_SW_ID_u8[BNO055_SW_ID_LSB], BNO055_SW_REV_ID_LSB); p_bno055->sw_rev_id = (u16) - ((((u32)((u8)a_SW_ID_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | (a_SW_ID_u8[INDEX_ZERO])); + ((((u32)((u8)a_SW_ID_u8[BNO055_SW_ID_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | (a_SW_ID_u8[BNO055_SW_ID_LSB])); /* Read the page id from the register 0x07*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_PAGE_ID__REG, &v_data_u8, BNO055_ONE_U8X); - p_bno055->page_id = v_data_u8; + BNO055_PAGE_ID_REG, &data_u8, BNO055_GEN_READ_WRITE_LENGTH); + p_bno055->page_id = data_u8; return com_rslt; } @@ -156,29 +156,29 @@ BNO055_RETURN_FUNCTION_TYPE bno055_init(struct bno055_t *bno055) * This API gives data to the given register and * the data is written in the corresponding register address * - * @param v_addr_u8 : Address of the register - * @param p_data_u8 : Data to be written to the register - * @param v_len_u8 : Length of the Data + * @param addr_u8 : Address of the register + * @param data_u8 : Data to be written to the register + * @param len_u8 : Length of the Data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_write_register(u8 v_addr_u8, -u8 *p_data_u8, u8 v_len_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_write_register(u8 addr_u8, +u8 *data_u8, u8 len_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* Write the values of respective given register */ com_rslt = p_bno055->BNO055_BUS_WRITE_FUNC - (p_bno055->dev_addr, v_addr_u8, p_data_u8, v_len_u8); + (p_bno055->dev_addr, addr_u8, data_u8, len_u8); } return com_rslt; } @@ -186,30 +186,30 @@ u8 *p_data_u8, u8 v_len_u8) * @brief This API reads the data from * the given register address * - * @param v_addr_u8 : Address of the register - * @param p_data_u8 : address of the variable, + * @param addr_u8 : Address of the register + * @param data_u8 : address of the variable, * read value will be kept - * @param v_len_u8 : Length of the data + * @param len_u8 : Length of the data * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_register(u8 v_addr_u8, -u8 *p_data_u8, u8 v_len_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_read_register(u8 addr_u8, +u8 *data_u8, u8 len_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* Read the value from given register*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC - (p_bno055->dev_addr, v_addr_u8, p_data_u8, v_len_u8); + (p_bno055->dev_addr, addr_u8, data_u8, len_u8); } return com_rslt; } @@ -218,37 +218,38 @@ u8 *p_data_u8, u8 v_len_u8) * from register 0x00 it is a byte of data * * - * @param v_chip_id_u8 : The chip id value 0xA0 + * @param chip_id_u8 : The chip id value 0xA0 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_chip_id(u8 *v_chip_id_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_read_chip_id(u8 *chip_id_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8 = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8 = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the chip id*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_CHIP_ID__REG, &v_data_u8, BNO055_ONE_U8X); - *v_chip_id_u8 = v_data_u8; + BNO055_CHIP_ID_REG, &data_u8, + BNO055_GEN_READ_WRITE_LENGTH); + *chip_id_u8 = data_u8; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -257,50 +258,51 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_chip_id(u8 *v_chip_id_u8) * @brief This API reads software revision id * from register 0x04 and 0x05 it is a two byte of data * - * @param v_sw_id_u8 : The SW revision id + * @param sw_id_u8 : The SW revision id * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_sw_rev_id(u16 *v_sw_id_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_read_sw_rev_id(u16 *sw_id_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* array having the software revision id - v_data_u8[0] - LSB - v_data_u8[1] - MSB*/ - u8 v_data_u8[ARRAY_SIZE_TWO] = {BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + data_u8[0] - LSB + data_u8[1] - MSB*/ + u8 data_u8[BNO055_REV_ID_SIZE] = {BNO055_INIT_VALUE, + BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty*/ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the two byte value of software revision id*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SW_REV_ID_LSB__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_SW_REV_ID_LSB_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SW_ID_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SW_ID_LSB], BNO055_SW_REV_ID_LSB); - *v_sw_id_u8 = (u16) - ((((u32)((u8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *sw_id_u8 = (u16) + ((((u32)((u8)data_u8[BNO055_SW_ID_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SW_ID_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -310,38 +312,38 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_sw_rev_id(u16 *v_sw_id_u8) * from register 0x07 it is a byte of data * * - * @param v_page_id_u8 : The value of page id + * @param page_id_u8 : The value of page id * - * PAGE_ZERO -> 0x00 - * PAGE_ONE -> 0x01 + * BNO055_PAGE_ZERO -> 0x00 + * BNO055_PAGE_ONE -> 0x01 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_page_id(u8 *v_page_id_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_read_page_id(u8 *page_id_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8 = BNO055_INIT_VALUE; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* Read the page id form 0x07*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_PAGE_ID__REG, &v_data_u8, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8 = BNO055_GET_BITSLICE(v_data_u8, + BNO055_PAGE_ID_REG, &data_u8, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8 = BNO055_GET_BITSLICE(data_u8, BNO055_PAGE_ID); - *v_page_id_u8 = v_data_u8; - p_bno055->page_id = v_data_u8; + *page_id_u8 = data_u8; + p_bno055->page_id = data_u8; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -350,44 +352,45 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_page_id(u8 *v_page_id_u8) * @brief This API used to write * the page id register 0x07 * - * @param v_page_id_u8 : The value of page id + * @param page_id_u8 : The value of page id * - * PAGE_ZERO -> 0x00 - * PAGE_ONE -> 0x01 + * BNO055_PAGE_ZERO -> 0x00 + * BNO055_PAGE_ONE -> 0x01 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_write_page_id(u8 v_page_id_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_write_page_id(u8 page_id_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* Read the current page*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_PAGE_ID__REG, &v_data_u8r, BNO055_ONE_U8X); - /* Check condition for communication success*/ - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE(v_data_u8r, - BNO055_PAGE_ID, v_page_id_u8); + BNO055_PAGE_ID_REG, &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + /* Check condition for communication BNO055_SUCCESS*/ + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE(data_u8r, + BNO055_PAGE_ID, page_id_u8); /* Write the page id*/ com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_PAGE_ID__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) - p_bno055->page_id = v_page_id_u8; + BNO055_PAGE_ID_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) + p_bno055->page_id = page_id_u8; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -396,41 +399,41 @@ BNO055_RETURN_FUNCTION_TYPE bno055_write_page_id(u8 v_page_id_u8) * @brief This API reads accel revision id * from register 0x01 it is a byte of value * - * @param v_accel_rev_id_u8 : The accel revision id 0xFB + * @param accel_rev_id_u8 : The accel revision id 0xFB * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_rev_id( -u8 *v_accel_rev_id_u8) +u8 *accel_rev_id_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8 = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8 = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the accel revision id */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_REV_ID__REG, - &v_data_u8, BNO055_ONE_U8X); - *v_accel_rev_id_u8 = v_data_u8; + BNO055_ACCEL_REV_ID_REG, + &data_u8, BNO055_GEN_READ_WRITE_LENGTH); + *accel_rev_id_u8 = data_u8; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -439,41 +442,41 @@ u8 *v_accel_rev_id_u8) * @brief This API reads mag revision id * from register 0x02 it is a byte of value * - * @param v_mag_rev_id_u8 : The mag revision id 0x32 + * @param mag_rev_id_u8 : The mag revision id 0x32 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_rev_id( -u8 *v_mag_rev_id_u8) +u8 *mag_rev_id_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8 = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8 = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the mag revision id */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_REV_ID__REG, - &v_data_u8, BNO055_ONE_U8X); - *v_mag_rev_id_u8 = v_data_u8; + BNO055_MAG_REV_ID_REG, + &data_u8, BNO055_GEN_READ_WRITE_LENGTH); + *mag_rev_id_u8 = data_u8; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -482,43 +485,43 @@ u8 *v_mag_rev_id_u8) * @brief This API reads gyro revision id * from register 0x03 it is a byte of value * - * @param v_gyro_rev_id_u8 : The gyro revision id 0xF0 + * @param gyro_rev_id_u8 : The gyro revision id 0xF0 * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_rev_id( -u8 *v_gyro_rev_id_u8) +u8 *gyro_rev_id_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8 = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8 = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the gyro revision id */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_REV_ID__REG, - &v_data_u8, BNO055_ONE_U8X); - *v_gyro_rev_id_u8 = v_data_u8; + BNO055_GYRO_REV_ID_REG, + &data_u8, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_rev_id_u8 = data_u8; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -527,42 +530,42 @@ u8 *v_gyro_rev_id_u8) * @brief This API used to read boot loader revision id * from register 0x06 it is a byte of value * - * @param v_bl_rev_id_u8 : The boot loader revision id + * @param bl_rev_id_u8 : The boot loader revision id * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_bl_rev_id( -u8 *v_bl_rev_id_u8) +u8 *bl_rev_id_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8 = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8 = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the boot loader revision id */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_BL_REV_ID__REG, - &v_data_u8, BNO055_ONE_U8X); - *v_bl_rev_id_u8 = v_data_u8; + BNO055_BL_REV_ID_REG, + &data_u8, BNO055_GEN_READ_WRITE_LENGTH); + *bl_rev_id_u8 = data_u8; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -574,53 +577,54 @@ u8 *v_bl_rev_id_u8) * * * - * @param v_accel_x_s16 : The X raw data + * @param accel_x_s16 : The X raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_x(s16 *v_accel_x_s16) +BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_x(s16 *accel_x_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the accel x value - v_data_u8[INDEX_ZERO] - LSB - v_data_u8[INDEX_ONE] - MSB + data_u8[BNO055_SENSOR_DATA_LSB] - x-LSB + data_u8[BNO055_SENSOR_DATA_MSB] - x-MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = {BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_ACCEL_DATA_SIZE] = {BNO055_INIT_VALUE, + BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the accel x axis two byte value*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_DATA_X_LSB_VALUEX__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_ACCEL_DATA_X_LSB_VALUEX_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_ACCEL_DATA_X_LSB_VALUEX); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_ACCEL_DATA_X_MSB_VALUEX); - *v_accel_x_s16 = (s16)((((s32) - (s8)(v_data_u8[INDEX_ONE])) << - (BNO055_SHIFT_8_POSITION)) - | (v_data_u8[INDEX_ZERO])); + *accel_x_s16 = (s16)((((s32) + (s8)(data_u8[BNO055_SENSOR_DATA_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) + | (data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -632,55 +636,56 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_x(s16 *v_accel_x_s16) * * * - * @param v_accel_y_s16 : The Y raw data + * @param accel_y_s16 : The Y raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_y(s16 *v_accel_y_s16) +BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_y(s16 *accel_y_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the accel y value - v_data_u8[INDEX_ZERO] - LSB - v_data_u8[INDEX_ONE] - MSB + data_u8[BNO055_SENSOR_DATA_LSB] - y-LSB + data_u8[BNO055_SENSOR_DATA_MSB] - y-MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = {BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_ACCEL_DATA_SIZE] = {BNO055_INIT_VALUE, + BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the accel y axis two byte value*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_DATA_Y_LSB_VALUEY__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_ACCEL_DATA_Y_LSB_VALUEY_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_ACCEL_DATA_Y_LSB_VALUEY); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_ACCEL_DATA_Y_MSB_VALUEY); - *v_accel_y_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_ZERO])); + *accel_y_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -692,55 +697,56 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_y(s16 *v_accel_y_s16) * * * - * @param v_accel_z_s16 : The z raw data + * @param accel_z_s16 : The z raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_z(s16 *v_accel_z_s16) +BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_z(s16 *accel_z_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the accel z value - v_data_u8[INDEX_ZERO] - LSB - v_data_u8[INDEX_ONE] - MSB + data_u8[BNO055_SENSOR_DATA_LSB] - z-LSB + data_u8[BNO055_SENSOR_DATA_MSB] - z-MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = {BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_ACCEL_DATA_SIZE] = {BNO055_INIT_VALUE, + BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the accel z axis two byte value*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_DATA_Z_LSB_VALUEZ__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_ACCEL_DATA_Z_LSB_VALUEZ_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_ACCEL_DATA_Z_LSB_VALUEZ); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_ACCEL_DATA_Z_MSB_VALUEZ); - *v_accel_z_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_ZERO])); + *accel_z_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -761,8 +767,8 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_z(s16 *v_accel_z_s16) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_xyz( @@ -770,70 +776,76 @@ struct bno055_accel_t *accel) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the accel xyz value - v_data_u8[INDEX_ZERO] - x->LSB - v_data_u8[INDEX_ONE] - x->MSB - v_data_u8[2] - y->MSB - v_data_u8[3] - y->MSB - v_data_u8[4] - z->MSB - v_data_u8[5] - z->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB] - x->LSB + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB] - x->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB] - y->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB] - y->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB] - z->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB] - z->MSB */ - u8 v_data_u8[ARRAY_SIZE_SIX] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_ACCEL_XYZ_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_DATA_X_LSB_VALUEX__REG, - v_data_u8, BNO055_SIX_U8X); + BNO055_ACCEL_DATA_X_LSB_VALUEX_REG, + data_u8, BNO055_ACCEL_XYZ_DATA_SIZE); /* Data X*/ - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB], BNO055_ACCEL_DATA_X_LSB_VALUEX); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB], BNO055_ACCEL_DATA_X_MSB_VALUEX); accel->x = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB])); /* Data Y*/ - v_data_u8[INDEX_TWO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TWO], + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB], BNO055_ACCEL_DATA_Y_LSB_VALUEY); - v_data_u8[INDEX_THREE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_THREE], + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB], BNO055_ACCEL_DATA_Y_MSB_VALUEY); accel->y = (s16)((((s32) - ((s8)v_data_u8[INDEX_THREE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_TWO])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB])); /* Data Z*/ - v_data_u8[INDEX_FOUR] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FOUR], + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB], BNO055_ACCEL_DATA_Z_LSB_VALUEZ); - v_data_u8[INDEX_FIVE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FIVE], + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB], BNO055_ACCEL_DATA_Z_MSB_VALUEZ); accel->z = (s16)((((s32) - ((s8)v_data_u8[INDEX_FIVE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_FOUR])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -845,55 +857,57 @@ struct bno055_accel_t *accel) * * * - * @param v_mag_x_s16 : The x raw data + * @param mag_x_s16 : The x raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_x(s16 *v_mag_x_s16) +BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_x(s16 *mag_x_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the mag x value - v_data_u8[INDEX_ZERO] - x->LSB - v_data_u8[INDEX_ONE] - x->MSB + data_u8[BNO055_SENSOR_DATA_LSB] - x->LSB + data_u8[BNO055_SENSOR_DATA_MSB] - x->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = {BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_MAG_DATA_SIZE] = {BNO055_INIT_VALUE, + BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /*Read the mag x two bytes of data */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_DATA_X_LSB_VALUEX__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_MAG_DATA_X_LSB_VALUEX_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_MAG_DATA_X_LSB_VALUEX); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_MAG_DATA_X_MSB_VALUEX); - *v_mag_x_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | (v_data_u8[INDEX_ZERO])); + *mag_x_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | ( + data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -905,56 +919,56 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_x(s16 *v_mag_x_s16) * * * - * @param v_mag_y_s16 : The y raw data + * @param mag_y_s16 : The y raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_y(s16 *v_mag_y_s16) +BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_y(s16 *mag_y_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - /* Array holding the mag x value - v_data_u8[INDEX_ZERO] - y->LSB - v_data_u8[INDEX_ONE] - y->MSB + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + /* Array holding the mag y value + data_u8[BNO055_SENSOR_DATA_LSB] - y->LSB + data_u8[BNO055_SENSOR_DATA_MSB] - y->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_MAG_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /*Read the mag y two bytes of data */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_DATA_Y_LSB_VALUEY__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_MAG_DATA_Y_LSB_VALUEY_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_MAG_DATA_Y_LSB_VALUEY); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_MAG_DATA_Y_MSB_VALUEY); - *v_mag_y_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_ZERO])); + *mag_y_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -966,57 +980,57 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_y(s16 *v_mag_y_s16) * * * - * @param v_mag_z_s16 : The z raw data + * @param mag_z_s16 : The z raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_z(s16 *v_mag_z_s16) +BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_z(s16 *mag_z_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - /* Array holding the mag x value - v_data_u8[INDEX_ZERO] - z->LSB - v_data_u8[INDEX_ONE] - z->MSB + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + /* Array holding the mag z value + data_u8[BNO055_SENSOR_DATA_LSB] - z->LSB + data_u8[BNO055_SENSOR_DATA_MSB] - z->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_MAG_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_DATA_Z_LSB_VALUEZ__REG, - v_data_u8, BNO055_TWO_U8X); + BNO055_MAG_DATA_Z_LSB_VALUEZ_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); /*Read the mag z two bytes of data */ - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_MAG_DATA_Z_LSB_VALUEZ); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_MAG_DATA_Z_MSB_VALUEZ); - *v_mag_z_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *mag_z_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1037,79 +1051,85 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_z(s16 *v_mag_z_s16) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_xyz(struct bno055_mag_t *mag) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the mag xyz value - v_data_u8[INDEX_ZERO] - x->LSB - v_data_u8[INDEX_ONE] - x->MSB - v_data_u8[INDEX_TWO] - y->MSB - v_data_u8[INDEX_THREE] - y->MSB - v_data_u8[INDEX_FOUR] - z->MSB - v_data_u8[INDEX_FIVE] - z->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB] - x->LSB + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB] - x->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB] - y->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB] - y->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB] - z->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB] - z->MSB */ - u8 v_data_u8[ARRAY_SIZE_SIX] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_MAG_XYZ_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /*Read the six byte value of mag xyz*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_DATA_X_LSB_VALUEX__REG, - v_data_u8, BNO055_SIX_U8X); + BNO055_MAG_DATA_X_LSB_VALUEX_REG, + data_u8, BNO055_MAG_XYZ_DATA_SIZE); /* Data X*/ - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB], BNO055_MAG_DATA_X_LSB_VALUEX); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB], BNO055_MAG_DATA_X_MSB_VALUEX); mag->x = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_ZERO])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB])); /* Data Y*/ - v_data_u8[INDEX_TWO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TWO], + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB], BNO055_MAG_DATA_Y_LSB_VALUEY); - v_data_u8[INDEX_THREE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_THREE], + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB], BNO055_MAG_DATA_Y_MSB_VALUEY); mag->y = (s16)((((s32) - ((s8)v_data_u8[INDEX_THREE])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_TWO])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB])); /* Data Z*/ - v_data_u8[INDEX_FOUR] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FOUR], + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB], BNO055_MAG_DATA_Z_LSB_VALUEZ); - v_data_u8[INDEX_FIVE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FIVE], + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB], BNO055_MAG_DATA_Z_MSB_VALUEZ); mag->z = (s16)((((s32) - ((s8)v_data_u8[INDEX_FIVE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_FOUR])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1121,52 +1141,52 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_xyz(struct bno055_mag_t *mag) * * * - * @param v_gyro_x_s16 : The x raw data + * @param gyro_x_s16 : The x raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_x(s16 *v_gyro_x_s16) +BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_x(s16 *gyro_x_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8[BNO055_GYRO_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the gyro 16 bit x value*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_DATA_X_LSB_VALUEX__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_GYRO_DATA_X_LSB_VALUEX_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_GYRO_DATA_X_LSB_VALUEX); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_GYRO_DATA_X_MSB_VALUEX); - *v_gyro_x_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_ZERO])); + *gyro_x_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1178,52 +1198,52 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_x(s16 *v_gyro_x_s16) * * * - * @param v_gyro_y_s16 : The y raw data + * @param gyro_y_s16 : The y raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_y(s16 *v_gyro_y_s16) +BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_y(s16 *gyro_y_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8[BNO055_GYRO_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the value of gyro y */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_DATA_Y_LSB_VALUEY__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_GYRO_DATA_Y_LSB_VALUEY_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_GYRO_DATA_Y_LSB_VALUEY); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_GYRO_DATA_Y_MSB_VALUEY); - *v_gyro_y_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *gyro_y_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1232,50 +1252,50 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_y(s16 *v_gyro_y_s16) * @brief This API reads gyro data z values * from register 0x18 and 0x19 it is a two byte data * - * @param v_gyro_z_s16 : The z raw data + * @param gyro_z_s16 : The z raw data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_z(s16 *v_gyro_z_s16) +BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_z(s16 *gyro_z_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8[BNO055_GYRO_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the gyro z 16 bit value*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_DATA_Z_LSB_VALUEZ__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_GYRO_DATA_Z_LSB_VALUEZ_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_GYRO_DATA_Z_LSB_VALUEZ); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_GYRO_DATA_Z_MSB_VALUEZ); - *v_gyro_z_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *gyro_z_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1296,79 +1316,85 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_z(s16 *v_gyro_z_s16) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_xyz(struct bno055_gyro_t *gyro) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - /* Array holding the accel xyz value - v_data_u8[INDEX_ZERO] - x->LSB - v_data_u8[INDEX_ONE] - x->MSB - v_data_u8[INDEX_TWO] - y->MSB - v_data_u8[INDEX_THREE] - y->MSB - v_data_u8[INDEX_FOUR] - z->MSB - v_data_u8[INDEX_FIVE] - z->MSB + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + /* Array holding the gyro xyz value + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB] - x->LSB + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB] - x->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB] - y->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB] - y->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB] - z->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB] - z->MSB */ - u8 v_data_u8[ARRAY_SIZE_SIX] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_GYRO_XYZ_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the six bytes data of gyro xyz*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_DATA_X_LSB_VALUEX__REG, - v_data_u8, BNO055_SIX_U8X); + BNO055_GYRO_DATA_X_LSB_VALUEX_REG, + data_u8, BNO055_GYRO_XYZ_DATA_SIZE); /* Data x*/ - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB], BNO055_GYRO_DATA_X_LSB_VALUEX); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB], BNO055_GYRO_DATA_X_MSB_VALUEX); gyro->x = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_ZERO])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB])); /* Data y*/ - v_data_u8[INDEX_TWO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TWO], + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB], BNO055_GYRO_DATA_Y_LSB_VALUEY); - v_data_u8[INDEX_THREE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_THREE], + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB], BNO055_GYRO_DATA_Y_MSB_VALUEY); gyro->y = (s16)((((s32) - ((s8)v_data_u8[INDEX_THREE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_TWO])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB])); /* Data z*/ - v_data_u8[INDEX_FOUR] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FOUR], + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB], BNO055_GYRO_DATA_Z_LSB_VALUEZ); - v_data_u8[INDEX_FIVE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FIVE], + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB], BNO055_GYRO_DATA_Z_MSB_VALUEZ); gyro->z = (s16)((((s32) - ((s8)v_data_u8[INDEX_FIVE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_FOUR])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1377,53 +1403,55 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_xyz(struct bno055_gyro_t *gyro) * @brief This API reads gyro data z values * from register 0x1A and 0x1B it is a two byte data * - * @param v_euler_h_s16 : The raw h data + * @param euler_h_s16 : The raw h data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_h(s16 *v_euler_h_s16) +BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_h(s16 *euler_h_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the Euler h value - v_data_u8[INDEX_ZERO] - h->LSB - v_data_u8[INDEX_ONE] - h->MSB + data_u8[BNO055_SENSOR_DATA_EULER_LSB] - h->LSB + data_u8[BNO055_SENSOR_DATA_EULER_MSB] - h->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_EULER_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the eulre heading data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_EULER_H_LSB_VALUEH__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = BNO055_GET_BITSLICE - (v_data_u8[INDEX_ZERO], + BNO055_EULER_H_LSB_VALUEH_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_EULER_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_EULER_LSB], BNO055_EULER_H_LSB_VALUEH); - v_data_u8[INDEX_ONE] = BNO055_GET_BITSLICE - (v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_EULER_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_EULER_MSB], BNO055_EULER_H_MSB_VALUEH); - *v_euler_h_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_ZERO])); + *euler_h_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_EULER_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_EULER_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1432,53 +1460,55 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_h(s16 *v_euler_h_s16) * @brief This API reads Euler data r values * from register 0x1C and 0x1D it is a two byte data * - * @param v_euler_r_s16 : The raw r data + * @param euler_r_s16 : The raw r data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_r(s16 *v_euler_r_s16) +BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_r(s16 *euler_r_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - /* Array holding the Euler h value - v_data_u8[INDEX_ZERO] - r->LSB - v_data_u8[INDEX_ONE] - r->MSB + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + /* Array holding the Euler r value + data_u8[BNO055_SENSOR_DATA_EULER_LSB] - r->LSB + data_u8[BNO055_SENSOR_DATA_EULER_MSB] - r->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_EULER_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the Euler roll data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_EULER_R_LSB_VALUER__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_EULER_R_LSB_VALUER_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_EULER_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_EULER_LSB], BNO055_EULER_R_LSB_VALUER); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_EULER_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_EULER_MSB], BNO055_EULER_R_MSB_VALUER); - *v_euler_r_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *euler_r_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_EULER_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_EULER_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1487,54 +1517,56 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_r(s16 *v_euler_r_s16) * @brief This API reads Euler data p values * from register 0x1E and 0x1F it is a two byte data * - * @param v_euler_p_s16 : The raw p data + * @param euler_p_s16 : The raw p data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_p(s16 *v_euler_p_s16) +BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_p(s16 *euler_p_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the Euler p value - v_data_u8[INDEX_ZERO] - p->LSB - v_data_u8[INDEX_ONE] - p->MSB + data_u8[BNO055_SENSOR_DATA_EULER_LSB] - p->LSB + data_u8[BNO055_SENSOR_DATA_EULER_MSB] - p->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_EULER_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the Euler p data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_EULER_P_LSB_VALUEP__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_EULER_P_LSB_VALUEP_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_EULER_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_EULER_LSB], BNO055_EULER_P_LSB_VALUEP); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_EULER_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_EULER_MSB], BNO055_EULER_P_MSB_VALUEP); - *v_euler_p_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *euler_p_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_EULER_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_EULER_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1554,8 +1586,8 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_p(s16 *v_euler_p_s16) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_hrp( @@ -1563,71 +1595,77 @@ struct bno055_euler_t *euler) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the Euler hrp value - v_data_u8[INDEX_ZERO] - h->LSB - v_data_u8[INDEX_ONE] - h->MSB - v_data_u8[INDEX_TWO] - r->MSB - v_data_u8[INDEX_THREE] - r->MSB - v_data_u8[INDEX_FOUR] - p->MSB - v_data_u8[INDEX_FIVE] - p->MSB + data_u8[BNO055_SENSOR_DATA_EULER_HRP_H_LSB] - h->LSB + data_u8[BNO055_SENSOR_DATA_EULER_HRP_H_MSB] - h->MSB + data_u8[BNO055_SENSOR_DATA_EULER_HRP_R_LSB] - r->MSB + data_u8[BNO055_SENSOR_DATA_EULER_HRP_R_MSB] - r->MSB + data_u8[BNO055_SENSOR_DATA_EULER_HRP_P_LSB] - p->MSB + data_u8[BNO055_SENSOR_DATA_EULER_HRP_P_MSB] - p->MSB */ - u8 v_data_u8[ARRAY_SIZE_SIX] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_EULER_HRP_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the six byte of Euler hrp data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_EULER_H_LSB_VALUEH__REG, - v_data_u8, BNO055_SIX_U8X); + BNO055_EULER_H_LSB_VALUEH_REG, + data_u8, BNO055_EULER_HRP_DATA_SIZE); /* Data h*/ - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + data_u8[BNO055_SENSOR_DATA_EULER_HRP_H_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_EULER_HRP_H_LSB], BNO055_EULER_H_LSB_VALUEH); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_EULER_HRP_H_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_EULER_HRP_H_MSB], BNO055_EULER_H_MSB_VALUEH); euler->h = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_ZERO])); + ((s8)data_u8[BNO055_SENSOR_DATA_EULER_HRP_H_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_EULER_HRP_H_LSB])); /* Data r*/ - v_data_u8[INDEX_TWO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TWO], + data_u8[BNO055_SENSOR_DATA_EULER_HRP_R_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_EULER_HRP_R_LSB], BNO055_EULER_R_LSB_VALUER); - v_data_u8[INDEX_THREE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_THREE], + data_u8[BNO055_SENSOR_DATA_EULER_HRP_R_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_EULER_HRP_R_MSB], BNO055_EULER_R_MSB_VALUER); euler->r = (s16)((((s32) - ((s8)v_data_u8[INDEX_THREE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_TWO])); + ((s8)data_u8[BNO055_SENSOR_DATA_EULER_HRP_R_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_EULER_HRP_R_LSB])); /* Data p*/ - v_data_u8[INDEX_FOUR] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FOUR], + data_u8[BNO055_SENSOR_DATA_EULER_HRP_P_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_EULER_HRP_P_LSB], BNO055_EULER_P_LSB_VALUEP); - v_data_u8[INDEX_FIVE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FIVE], + data_u8[BNO055_SENSOR_DATA_EULER_HRP_P_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_EULER_HRP_P_MSB], BNO055_EULER_P_MSB_VALUEP); euler->p = (s16)((((s32) - ((s8)v_data_u8[INDEX_FIVE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_FOUR])); + ((s8)data_u8[BNO055_SENSOR_DATA_EULER_HRP_P_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_EULER_HRP_P_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1636,56 +1674,58 @@ struct bno055_euler_t *euler) * @brief This API reads quaternion data w values * from register 0x20 and 0x21 it is a two byte data * - * @param v_quaternion_w_s16 : The raw w data + * @param quaternion_w_s16 : The raw w data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_quaternion_w( -s16 *v_quaternion_w_s16) +s16 *quaternion_w_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the Quaternion w value - v_data_u8[INDEX_ZERO] - w->LSB - v_data_u8[INDEX_ONE] - w->MSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB] - w->LSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB] - w->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_QUATERNION_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the two byte value of quaternion w data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_QUATERNION_DATA_W_LSB_VALUEW__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_QUATERNION_DATA_W_LSB_VALUEW_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB], BNO055_QUATERNION_DATA_W_LSB_VALUEW); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB], BNO055_QUATERNION_DATA_W_MSB_VALUEW); - *v_quaternion_w_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *quaternion_w_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1694,54 +1734,58 @@ s16 *v_quaternion_w_s16) * @brief This API reads quaternion data x values * from register 0x22 and 0x23 it is a two byte data * - * @param v_quaternion_x_s16 : The raw x data + * @param quaternion_x_s16 : The raw x data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_quaternion_x( -s16 *v_quaternion_x_s16) +s16 *quaternion_x_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the quaternion x value - v_data_u8[INDEX_ZERO] - x->LSB - v_data_u8[INDEX_ONE] - x->MSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB] - x->LSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB] - x->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = {BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_QUATERNION_DATA_SIZE] = {BNO055_INIT_VALUE, + BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the two byte value of quaternion x data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_QUATERNION_DATA_X_LSB_VALUEX__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_QUATERNION_DATA_X_LSB_VALUEX_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB], BNO055_QUATERNION_DATA_X_LSB_VALUEX); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB], BNO055_QUATERNION_DATA_X_MSB_VALUEX); - *v_quaternion_x_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | (v_data_u8[INDEX_ZERO])); + *quaternion_x_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1750,55 +1794,58 @@ s16 *v_quaternion_x_s16) * @brief This API reads quaternion data y values * from register 0x24 and 0x25 it is a two byte data * - * @param v_quaternion_y_s16 : The raw y data + * @param quaternion_y_s16 : The raw y data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_quaternion_y( -s16 *v_quaternion_y_s16) +s16 *quaternion_y_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the quaternion y value - v_data_u8[INDEX_ZERO] - y->LSB - v_data_u8[INDEX_ONE] - y->MSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB] - y->LSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB] - y->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = {BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_QUATERNION_DATA_SIZE] = {BNO055_INIT_VALUE, + BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the two byte value of quaternion y data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_QUATERNION_DATA_Y_LSB_VALUEY__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = BNO055_GET_BITSLICE - (v_data_u8[INDEX_ZERO], + BNO055_QUATERNION_DATA_Y_LSB_VALUEY_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB], BNO055_QUATERNION_DATA_Y_LSB_VALUEY); - v_data_u8[INDEX_ONE] = BNO055_GET_BITSLICE - (v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB] = + BNO055_GET_BITSLICE + (data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB], BNO055_QUATERNION_DATA_Y_MSB_VALUEY); - *v_quaternion_y_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *quaternion_y_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1807,56 +1854,58 @@ s16 *v_quaternion_y_s16) * @brief This API reads quaternion data z values * from register 0x26 and 0x27 it is a two byte data * - * @param v_quaternion_z_s16 : The raw z data + * @param quaternion_z_s16 : The raw z data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_quaternion_z( -s16 *v_quaternion_z_s16) +s16 *quaternion_z_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the quaternion z value - v_data_u8[INDEX_ZERO] - z->LSB - v_data_u8[INDEX_ONE] - z->MSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB] - z->LSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB] - z->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_QUATERNION_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the two byte value of quaternion z data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_QUATERNION_DATA_Z_LSB_VALUEZ__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_QUATERNION_DATA_Z_LSB_VALUEZ_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB], BNO055_QUATERNION_DATA_Z_LSB_VALUEZ); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB], BNO055_QUATERNION_DATA_Z_MSB_VALUEZ); - *v_quaternion_z_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *quaternion_z_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_QUATERNION_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_QUATERNION_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1878,8 +1927,8 @@ s16 *v_quaternion_z_s16) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_quaternion_wxyz( @@ -1887,86 +1936,94 @@ struct bno055_quaternion_t *quaternion) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the quaternion wxyz value - v_data_u8[INDEX_ZERO] - w->LSB - v_data_u8[INDEX_ONE] - w->MSB - v_data_u8[INDEX_TWO] - x->LSB - v_data_u8[INDEX_THREE] - x->MSB - v_data_u8[INDEX_FOUR] - y->MSB - v_data_u8[INDEX_FIVE] - y->MSB - v_data_u8[6] - z->MSB - v_data_u8[7] - z->MSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_W_LSB] - w->LSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_W_MSB] - w->MSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_X_LSB] - x->LSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_X_MSB] - x->MSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Y_LSB] - y->MSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Y_MSB] - y->MSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Z_LSB] - z->MSB + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Z_MSB] - z->MSB */ - u8 v_data_u8[ARRAY_SIZE_EIGHT] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_QUATERNION_WXYZ_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the eight byte value of quaternion wxyz data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_QUATERNION_DATA_W_LSB_VALUEW__REG, - v_data_u8, BNO055_EIGHT_U8X); + BNO055_QUATERNION_DATA_W_LSB_VALUEW_REG, + data_u8, BNO055_QUATERNION_WXYZ_DATA_SIZE); /* Data W*/ - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_W_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_W_LSB], BNO055_QUATERNION_DATA_W_LSB_VALUEW); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_W_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_W_MSB], BNO055_QUATERNION_DATA_W_MSB_VALUEW); - quaternion->w = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_ZERO])); + quaternion->w = (s16)((((s32)((s8) + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_W_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_W_LSB])); /* Data X*/ - v_data_u8[INDEX_TWO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TWO], + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_X_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_X_LSB], BNO055_QUATERNION_DATA_X_LSB_VALUEX); - v_data_u8[INDEX_THREE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_THREE], + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_X_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_X_MSB], BNO055_QUATERNION_DATA_X_MSB_VALUEX); - quaternion->x = (s16)((((s32) - ((s8)v_data_u8[INDEX_THREE])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_TWO])); + quaternion->x = (s16)((((s32)((s8) + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_X_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_X_LSB])); /* Data Y*/ - v_data_u8[INDEX_FOUR] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FOUR], + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Y_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Y_LSB], BNO055_QUATERNION_DATA_Y_LSB_VALUEY); - v_data_u8[INDEX_FIVE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FIVE], + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Y_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Y_MSB], BNO055_QUATERNION_DATA_Y_MSB_VALUEY); - quaternion->y = (s16)((((s32) - ((s8)v_data_u8[INDEX_FIVE])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_FOUR])); + quaternion->y = (s16)((((s32)((s8) + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Y_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Y_LSB])); /* Data Z*/ - v_data_u8[INDEX_SIX] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_SIX], + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Z_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Z_LSB], BNO055_QUATERNION_DATA_Z_LSB_VALUEZ); - v_data_u8[INDEX_SEVEN] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_SEVEN], + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Z_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Z_MSB], BNO055_QUATERNION_DATA_Z_MSB_VALUEZ); - quaternion->z = (s16)((((s32) - ((s8)v_data_u8[INDEX_SEVEN])) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_SIX])); + quaternion->z = (s16)((((s32)((s8) + data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Z_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_QUATERNION_WXYZ_Z_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -1975,56 +2032,56 @@ struct bno055_quaternion_t *quaternion) * @brief This API reads Linear accel data x values * from register 0x29 and 0x2A it is a two byte data * - * @param v_linear_accel_x_s16 : The raw x data + * @param linear_accel_x_s16 : The raw x data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_linear_accel_x( -s16 *v_linear_accel_x_s16) +s16 *linear_accel_x_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the linear accel x value - v_data_u8[INDEX_ZERO] - x->LSB - v_data_u8[INDEX_ONE] - x->MSB + data_u8[BNO055_SENSOR_DATA_LSB] - x->LSB + data_u8[BNO055_SENSOR_DATA_MSB] - x->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_ACCEL_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the two byte value of linear accel x data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_LINEAR_ACCEL_DATA_X_MSB_VALUEX); - *v_linear_accel_x_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *linear_accel_x_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -2033,55 +2090,56 @@ s16 *v_linear_accel_x_s16) * @brief This API reads Linear accel data x values * from register 0x2B and 0x2C it is a two byte data * - * @param v_linear_accel_y_s16 : The raw y data + * @param linear_accel_y_s16 : The raw y data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_linear_accel_y( -s16 *v_linear_accel_y_s16) +s16 *linear_accel_y_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the linear accel y value - v_data_u8[INDEX_ZERO] - y->LSB - v_data_u8[INDEX_ONE] - y->MSB + data_u8[BNO055_SENSOR_DATA_LSB] - y->LSB + data_u8[BNO055_SENSOR_DATA_MSB] - y->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_ACCEL_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the two byte value of linear accel y data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_LINEAR_ACCEL_DATA_Y_LSB_VALUEY__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_LINEAR_ACCEL_DATA_Y_LSB_VALUEY_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_LINEAR_ACCEL_DATA_Y_LSB_VALUEY); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_LINEAR_ACCEL_DATA_Y_MSB_VALUEY); - *v_linear_accel_y_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | (v_data_u8[INDEX_ZERO])); + *linear_accel_y_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | ( + data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -2090,55 +2148,56 @@ s16 *v_linear_accel_y_s16) * @brief This API reads Linear accel data x values * from register 0x2C and 0x2D it is a two byte data * - * @param v_linear_accel_z_s16 : The raw z data + * @param linear_accel_z_s16 : The raw z data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_linear_accel_z( -s16 *v_linear_accel_z_s16) +s16 *linear_accel_z_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the linear accel z value - v_data_u8[INDEX_ZERO] - z->LSB - v_data_u8[INDEX_ONE] - z->MSB + data_u8[BNO055_SENSOR_DATA_LSB] - z->LSB + data_u8[BNO055_SENSOR_DATA_MSB] - z->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_ACCEL_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the two byte value of linear accel z data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_LINEAR_ACCEL_DATA_Z_LSB_VALUEZ__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_LINEAR_ACCEL_DATA_Z_LSB_VALUEZ_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_LINEAR_ACCEL_DATA_Z_LSB_VALUEZ); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_LINEAR_ACCEL_DATA_Z_MSB_VALUEZ); - *v_linear_accel_z_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) | (v_data_u8[INDEX_ZERO])); + *linear_accel_z_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | ( + data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -2158,80 +2217,86 @@ s16 *v_linear_accel_z_s16) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR */ BNO055_RETURN_FUNCTION_TYPE bno055_read_linear_accel_xyz( struct bno055_linear_accel_t *linear_accel) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the linear accel xyz value - v_data_u8[INDEX_ZERO] - x->LSB - v_data_u8[INDEX_ONE] - x->MSB - v_data_u8[INDEX_TWO] - y->MSB - v_data_u8[INDEX_THREE] - y->MSB - v_data_u8[INDEX_FOUR] - z->MSB - v_data_u8[INDEX_FIVE] - z->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB] - x->LSB + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB] - x->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB] - y->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB] - y->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB] - z->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB] - z->MSB */ - u8 v_data_u8[ARRAY_SIZE_SIX] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_ACCEL_XYZ_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the six byte value of linear accel xyz data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX__REG, - v_data_u8, BNO055_SIX_U8X); + BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX_REG, + data_u8, BNO055_ACCEL_XYZ_DATA_SIZE); /* Data x*/ - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB], BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB], BNO055_LINEAR_ACCEL_DATA_X_MSB_VALUEX); linear_accel->x = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB])); /* Data y*/ - v_data_u8[INDEX_TWO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TWO], + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB], BNO055_LINEAR_ACCEL_DATA_Y_LSB_VALUEY); - v_data_u8[INDEX_THREE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_THREE], + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB], BNO055_LINEAR_ACCEL_DATA_Y_MSB_VALUEY); linear_accel->y = (s16)((((s32) - ((s8)v_data_u8[INDEX_THREE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_TWO])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB])); /* Data z*/ - v_data_u8[INDEX_FOUR] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FOUR], + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB], BNO055_LINEAR_ACCEL_DATA_Z_LSB_VALUEZ); - v_data_u8[INDEX_FIVE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FIVE], + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB], BNO055_LINEAR_ACCEL_DATA_Z_MSB_VALUEZ); linear_accel->z = (s16)((((s32) - ((s8)v_data_u8[INDEX_FIVE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_FOUR])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -2240,56 +2305,56 @@ struct bno055_linear_accel_t *linear_accel) * @brief This API reads gravity data x values * from register 0x2E and 0x2F it is a two byte data * - * @param v_gravity_x_s16 : The raw x data + * @param gravity_x_s16 : The raw x data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gravity_x( -s16 *v_gravity_x_s16) +s16 *gravity_x_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the gravity x value - v_data_u8[INDEX_ZERO] - x->LSB - v_data_u8[INDEX_ONE] - x->MSB + data_u8[BNO055_SENSOR_DATA_LSB] - x->LSB + data_u8[BNO055_SENSOR_DATA_MSB] - x->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_GRAVITY_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the two byte value of gravity x data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GRAVITY_DATA_X_LSB_VALUEX__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_GRAVITY_DATA_X_LSB_VALUEX_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_GRAVITY_DATA_X_LSB_VALUEX); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_GRAVITY_DATA_X_MSB_VALUEX); - *v_gravity_x_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *gravity_x_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -2298,56 +2363,56 @@ s16 *v_gravity_x_s16) * @brief This API reads gravity data y values * from register 0x30 and 0x31 it is a two byte data * - * @param v_gravity_y_s16 : The raw y data + * @param gravity_y_s16 : The raw y data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gravity_y( -s16 *v_gravity_y_s16) +s16 *gravity_y_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the gravity y value - v_data_u8[INDEX_ZERO] - y->LSB - v_data_u8[INDEX_ONE] - y->MSB + data_u8[BNO055_SENSOR_DATA_LSB] - y->LSB + data_u8[BNO055_SENSOR_DATA_MSB] - y->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_GRAVITY_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the two byte value of gravity y data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GRAVITY_DATA_Y_LSB_VALUEY__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_GRAVITY_DATA_Y_LSB_VALUEY_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_GRAVITY_DATA_Y_LSB_VALUEY); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_GRAVITY_DATA_Y_MSB_VALUEY); - *v_gravity_y_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *gravity_y_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -2356,56 +2421,56 @@ s16 *v_gravity_y_s16) * @brief This API reads gravity data z values * from register 0x32 and 0x33 it is a two byte data * - * @param v_gravity_z_s16 : The raw z data + * @param gravity_z_s16 : The raw z data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gravity_z( -s16 *v_gravity_z_s16) +s16 *gravity_z_s16) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the gravity z value - v_data_u8[INDEX_ZERO] - z->LSB - v_data_u8[INDEX_ONE] - z->MSB + data_u8[BNO055_SENSOR_DATA_LSB] - z->LSB + data_u8[BNO055_SENSOR_DATA_MSB] - z->MSB */ - u8 v_data_u8[ARRAY_SIZE_TWO] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_GRAVITY_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the two byte value of gravity z data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GRAVITY_DATA_Z_LSB_VALUEZ__REG, - v_data_u8, BNO055_TWO_U8X); - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + BNO055_GRAVITY_DATA_Z_LSB_VALUEZ_REG, + data_u8, BNO055_LSB_MSB_READ_LENGTH); + data_u8[BNO055_SENSOR_DATA_LSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_LSB], BNO055_GRAVITY_DATA_Z_LSB_VALUEZ); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_MSB] = + BNO055_GET_BITSLICE(data_u8[BNO055_SENSOR_DATA_MSB], BNO055_GRAVITY_DATA_Z_MSB_VALUEZ); - *v_gravity_z_s16 = (s16)((((s32) - ((s8)v_data_u8[INDEX_ONE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_ZERO])); + *gravity_z_s16 = (s16)((((s32) + ((s8)data_u8[BNO055_SENSOR_DATA_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -2425,8 +2490,8 @@ s16 *v_gravity_z_s16) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gravity_xyz( @@ -2434,71 +2499,78 @@ struct bno055_gravity_t *gravity) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the gravity xyz value - v_data_u8[INDEX_ZERO] - x->LSB - v_data_u8[INDEX_ONE] - x->MSB - v_data_u8[INDEX_TWO] - y->MSB - v_data_u8[INDEX_THREE] - y->MSB - v_data_u8[INDEX_FOUR] - z->MSB - v_data_u8[INDEX_FIVE] - z->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB] - x->LSB + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB] - x->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB] - y->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB] - y->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB] - z->MSB + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB] - z->MSB */ - u8 v_data_u8[ARRAY_SIZE_SIX] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_GRAVITY_XYZ_DATA_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the six byte value of gravity xyz data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GRAVITY_DATA_X_LSB_VALUEX__REG, - v_data_u8, BNO055_SIX_U8X); + BNO055_GRAVITY_DATA_X_LSB_VALUEX_REG, + data_u8, BNO055_GRAVITY_XYZ_DATA_SIZE); /* Data x*/ - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB], BNO055_GRAVITY_DATA_X_LSB_VALUEX); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB], BNO055_GRAVITY_DATA_X_MSB_VALUEX); gravity->x = (s16)(((s32) - ((s8)v_data_u8[INDEX_ONE]) << - BNO055_SHIFT_8_POSITION) | - (v_data_u8[INDEX_ZERO])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_X_MSB]) << + BNO055_SHIFT_EIGHT_BITS) | + (data_u8[BNO055_SENSOR_DATA_XYZ_X_LSB])); /* Data y*/ - v_data_u8[INDEX_TWO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TWO], + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB], BNO055_GRAVITY_DATA_Y_LSB_VALUEY); - v_data_u8[INDEX_THREE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_THREE], + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB], BNO055_GRAVITY_DATA_Y_MSB_VALUEY); gravity->y = (s16)((((s32) - ((s8)v_data_u8[INDEX_THREE])) << - BNO055_SHIFT_8_POSITION) | (v_data_u8[INDEX_TWO])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_Y_MSB])) << + BNO055_SHIFT_EIGHT_BITS) | ( + data_u8[BNO055_SENSOR_DATA_XYZ_Y_LSB])); /* Data z*/ - v_data_u8[INDEX_FOUR] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FOUR], + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB], BNO055_GRAVITY_DATA_Z_LSB_VALUEZ); - v_data_u8[INDEX_FIVE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FIVE], + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB], BNO055_GRAVITY_DATA_Z_MSB_VALUEZ); gravity->z = (s16)((((s32) - ((s8)v_data_u8[INDEX_FIVE])) << - BNO055_SHIFT_8_POSITION) - | (v_data_u8[INDEX_FOUR])); + ((s8)data_u8[BNO055_SENSOR_DATA_XYZ_Z_MSB])) << + BNO055_SHIFT_EIGHT_BITS) + | (data_u8[BNO055_SENSOR_DATA_XYZ_Z_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -2507,39 +2579,40 @@ struct bno055_gravity_t *gravity) * @brief This API reads temperature values * from register 0x33 it is a byte data * - * @param v_temp_s8 : The raw temperature data + * @param temp_s8 : The raw temperature data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_temp_data(s8 *v_temp_s8) +BNO055_RETURN_FUNCTION_TYPE bno055_read_temp_data(s8 *temp_s8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8 = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8 = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the raw temperature data */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_TEMP__REG, &v_data_u8, BNO055_ONE_U8X); - *v_temp_s8 = v_data_u8; + BNO055_TEMP_REG, &data_u8, + BNO055_GEN_READ_WRITE_LENGTH); + *temp_s8 = data_u8; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -2549,44 +2622,44 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_temp_data(s8 *v_temp_s8) * @brief This API is used to convert the accel x raw data * to meterpersecseq output as float * - * @param v_accel_x_f : The accel x meterpersecseq data + * @param accel_x_f : The accel x meterpersecseq data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_accel_x_msq( -float *v_accel_x_f) +float *accel_x_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_accel_x_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_accel_x_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as m/s2 if the unit is in mg*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MSQ) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MSQ); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MSQ) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MSQ); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw x data*/ - com_rslt += bno055_read_accel_x(&v_reg_accel_x_s16); - p_bno055->delay_msec(BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_accel_x(®_accel_x_s16); + p_bno055->delay_msec(BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw accel x to m/s2*/ - v_data_f = - (float)(v_reg_accel_x_s16/ACCEL_DIV_MSQ); - *v_accel_x_f = v_data_f; + data_f = + (float)(reg_accel_x_s16/BNO055_ACCEL_DIV_MSQ); + *accel_x_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -2594,44 +2667,44 @@ float *v_accel_x_f) * @brief This API is used to convert the accel x raw data * to millig output as float * - * @param v_accel_x_f : The accel x millig data + * @param accel_x_f : The accel x millig data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_accel_x_mg( -float *v_accel_x_f) +float *accel_x_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_accel_x_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_accel_x_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as mg if the unit is in m/s2*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MG) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MG) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MG); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw x data*/ - com_rslt += bno055_read_accel_x(&v_reg_accel_x_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_accel_x(®_accel_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw accel x to m/s2*/ - v_data_f = - (float)(v_reg_accel_x_s16/ACCEL_DIV_MG); - *v_accel_x_f = v_data_f; + data_f = + (float)(reg_accel_x_s16/BNO055_ACCEL_DIV_MG); + *accel_x_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -2639,43 +2712,43 @@ float *v_accel_x_f) * @brief This API is used to convert the accel x raw data * to meterpersecseq output as float * - * @param v_accel_y_f : The accel y meterpersecseq data + * @param accel_y_f : The accel y meterpersecseq data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_accel_y_msq( -float *v_accel_y_f) +float *accel_y_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_accel_y_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_accel_y_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as m/s2 if the unit is in mg*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MSQ) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MSQ); - if (com_rslt == SUCCESS) { - com_rslt += bno055_read_accel_y(&v_reg_accel_y_s16); - p_bno055->delay_msec(BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MSQ) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MSQ); + if (com_rslt == BNO055_SUCCESS) { + com_rslt += bno055_read_accel_y(®_accel_y_s16); + p_bno055->delay_msec(BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw accel y to m/s2*/ - v_data_f = - (float)(v_reg_accel_y_s16/ACCEL_DIV_MSQ); - *v_accel_y_f = v_data_f; + data_f = + (float)(reg_accel_y_s16/BNO055_ACCEL_DIV_MSQ); + *accel_y_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -2683,41 +2756,42 @@ float *v_accel_y_f) * @brief This API is used to convert the accel y raw data * to millig output as float * - * @param v_accel_y_f : The accel y millig data + * @param accel_y_f : The accel y millig data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_accel_y_mg( -float *v_accel_y_f) +float *accel_y_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_accel_y_s16 = BNO055_ZERO_U8X; - float data = BNO055_ZERO_U8X; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_accel_y_s16 = BNO055_INIT_VALUE; + float data = BNO055_INIT_VALUE; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as mg if the unit is in m/s2*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MG) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MG) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MG); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw z data*/ - com_rslt += bno055_read_accel_y(&v_reg_accel_y_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_accel_y(®_accel_y_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw accel z to mg*/ - data = (float)(v_reg_accel_y_s16/ACCEL_DIV_MG); - *v_accel_y_f = data; + data = (float)( + reg_accel_y_s16/BNO055_ACCEL_DIV_MG); + *accel_y_f = data; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -2725,44 +2799,44 @@ float *v_accel_y_f) * @brief This API is used to convert the accel z raw data * to meterpersecseq output as float * - * @param v_accel_z_f : The accel z meterpersecseq data + * @param accel_z_f : The accel z meterpersecseq data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_accel_z_msq( -float *v_accel_z_f) +float *accel_z_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_accel_z_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_accel_z_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as m/s2 if the unit is in mg*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MSQ) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MSQ); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MSQ) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MSQ); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw z data*/ - com_rslt += bno055_read_accel_z(&v_reg_accel_z_s16); - p_bno055->delay_msec(BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_accel_z(®_accel_z_s16); + p_bno055->delay_msec(BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw accel z to m/s2*/ - v_data_f = - (float)(v_reg_accel_z_s16/ACCEL_DIV_MSQ); - *v_accel_z_f = v_data_f; + data_f = + (float)(reg_accel_z_s16/BNO055_ACCEL_DIV_MSQ); + *accel_z_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -2770,43 +2844,43 @@ float *v_accel_z_f) * @brief This API is used to convert the accel z raw data * to millig output as float * - * @param v_accel_z_f : The accel z millig data + * @param accel_z_f : The accel z millig data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_accel_z_mg( -float *v_accel_z_f) +float *accel_z_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_accel_z_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_accel_z_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as mg if the unit is in m/s2 */ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MG) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MG) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MG); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw z data*/ - com_rslt += bno055_read_accel_z(&v_reg_accel_z_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_accel_z(®_accel_z_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw accel x to mg*/ - v_data_f = - (float)(v_reg_accel_z_s16/ACCEL_DIV_MG); - *v_accel_z_f = v_data_f; + data_f = + (float)(reg_accel_z_s16/BNO055_ACCEL_DIV_MG); + *accel_z_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -2823,8 +2897,8 @@ float *v_accel_z_f) * z | meterpersecseq data of accel * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -2833,31 +2907,31 @@ struct bno055_accel_float_t *accel_xyz) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_accel_t reg_accel_xyz = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as m/s2 if the unit is in mg*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MSQ) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MSQ); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MSQ) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MSQ); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw xyz data*/ com_rslt += bno055_read_accel_xyz(®_accel_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert the accel raw xyz to meterpersecseq*/ accel_xyz->x = - (float)(reg_accel_xyz.x/ACCEL_DIV_MSQ); + (float)(reg_accel_xyz.x/BNO055_ACCEL_DIV_MSQ); accel_xyz->y = - (float)(reg_accel_xyz.y/ACCEL_DIV_MSQ); + (float)(reg_accel_xyz.y/BNO055_ACCEL_DIV_MSQ); accel_xyz->z = - (float)(reg_accel_xyz.z/ACCEL_DIV_MSQ); + (float)(reg_accel_xyz.z/BNO055_ACCEL_DIV_MSQ); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -2875,8 +2949,8 @@ struct bno055_accel_float_t *accel_xyz) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -2885,31 +2959,31 @@ struct bno055_accel_float_t *accel_xyz) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_accel_t reg_accel_xyz = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as mg if the unit is in m/s2*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MG) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MG) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MG); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw y data*/ com_rslt += bno055_read_accel_xyz(®_accel_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /*Convert the accel raw xyz to millig */ accel_xyz->x = - (float)(reg_accel_xyz.x/ACCEL_DIV_MG); + (float)(reg_accel_xyz.x/BNO055_ACCEL_DIV_MG); accel_xyz->y = - (float)(reg_accel_xyz.y/ACCEL_DIV_MG); + (float)(reg_accel_xyz.y/BNO055_ACCEL_DIV_MG); accel_xyz->z = - (float)(reg_accel_xyz.z/ACCEL_DIV_MG); + (float)(reg_accel_xyz.z/BNO055_ACCEL_DIV_MG); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -2917,32 +2991,32 @@ struct bno055_accel_float_t *accel_xyz) * @brief This API is used to convert the mag x raw data * to microTesla output as float * - * @param v_mag_x_f : The mag x microTesla data + * @param mag_x_f : The mag x microTesla data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_mag_x_uT( -float *v_mag_x_f) +float *mag_x_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_mag_x_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_mag_x_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; /* Read raw mag x data */ - com_rslt = bno055_read_mag_x(&v_reg_mag_x_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_mag_x(®_mag_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw mag x to microTesla*/ - v_data_f = (float)(v_reg_mag_x_s16/MAG_DIV_UT); - *v_mag_x_f = v_data_f; + data_f = (float)(reg_mag_x_s16/BNO055_MAG_DIV_UT); + *mag_x_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -2950,31 +3024,31 @@ float *v_mag_x_f) * @brief This API is used to convert the mag y raw data * to microTesla output as float * - * @param v_mag_y_f : The mag y microTesla data + * @param mag_y_f : The mag y microTesla data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_mag_y_uT( -float *v_mag_y_f) +float *mag_y_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_mag_y_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_mag_y_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; /* Read raw mag y data */ - com_rslt = bno055_read_mag_y(&v_reg_mag_y_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_mag_y(®_mag_y_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw mag y to microTesla*/ - v_data_f = (float)(v_reg_mag_y_s16/MAG_DIV_UT); - *v_mag_y_f = v_data_f; + data_f = (float)(reg_mag_y_s16/BNO055_MAG_DIV_UT); + *mag_y_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -2982,31 +3056,31 @@ float *v_mag_y_f) * @brief This API is used to convert the mag z raw data * to microTesla output as float * - * @param v_mag_z_f : The mag z microTesla data + * @param mag_z_f : The mag z microTesla data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_mag_z_uT( -float *v_mag_z_f) +float *mag_z_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_mag_z_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_mag_z_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; /* Read raw mag z data */ - com_rslt = bno055_read_mag_z(&v_reg_mag_z_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_mag_z(®_mag_z_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw mag z to microTesla*/ - v_data_f = (float)(v_reg_mag_z_s16/MAG_DIV_UT); - *v_mag_z_f = v_data_f; + data_f = (float)(reg_mag_z_s16/BNO055_MAG_DIV_UT); + *mag_z_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3024,8 +3098,8 @@ float *v_mag_z_f) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_mag_xyz_uT( @@ -3033,18 +3107,18 @@ struct bno055_mag_float_t *mag_xyz_data) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_mag_t mag_xyz = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; /* Read raw mag x data */ com_rslt = bno055_read_mag_xyz(&mag_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert mag raw xyz to microTesla*/ - mag_xyz_data->x = (float)(mag_xyz.x/MAG_DIV_UT); - mag_xyz_data->y = (float)(mag_xyz.y/MAG_DIV_UT); - mag_xyz_data->z = (float)(mag_xyz.z/MAG_DIV_UT); + mag_xyz_data->x = (float)(mag_xyz.x/BNO055_MAG_DIV_UT); + mag_xyz_data->y = (float)(mag_xyz.y/BNO055_MAG_DIV_UT); + mag_xyz_data->z = (float)(mag_xyz.z/BNO055_MAG_DIV_UT); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; @@ -3053,41 +3127,41 @@ struct bno055_mag_float_t *mag_xyz_data) * @brief This API is used to convert the gyro x raw data * to dps output as float * - * @param v_gyro_x_f : The gyro x dps float data + * @param gyro_x_f : The gyro x dps float data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_gyro_x_dps( -float *v_gyro_x_f) +float *gyro_x_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gyro_x_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gyro_x_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as dps if the unit is in rps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_DPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_DPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_DPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_DPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw x data */ - com_rslt += bno055_read_gyro_x(&v_reg_gyro_x_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_gyro_x(®_gyro_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw gyro x to dps*/ - v_data_f = - (float)(v_reg_gyro_x_s16/GYRO_DIV_DPS); - *v_gyro_x_f = v_data_f; + data_f = + (float)(reg_gyro_x_s16/BNO055_GYRO_DIV_DPS); + *gyro_x_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3095,42 +3169,42 @@ float *v_gyro_x_f) * @brief This API is used to convert the gyro x raw data * to rps output as float * - * @param v_gyro_x_f : The gyro x dps float data + * @param gyro_x_f : The gyro x dps float data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_gyro_x_rps( -float *v_gyro_x_f) +float *gyro_x_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gyro_x_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gyro_x_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as rps if the unit is in dps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_RPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_RPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_RPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_RPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw x data */ - com_rslt += bno055_read_gyro_x(&v_reg_gyro_x_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_gyro_x(®_gyro_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw gyro x to rps*/ - v_data_f = - (float)(v_reg_gyro_x_s16/GYRO_DIV_RPS); - *v_gyro_x_f = v_data_f; + data_f = + (float)(reg_gyro_x_s16/BNO055_GYRO_DIV_RPS); + *gyro_x_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3138,42 +3212,42 @@ float *v_gyro_x_f) * @brief This API is used to convert the gyro y raw data * to dps output as float * - * @param v_gyro_y_f : The gyro y dps float data + * @param gyro_y_f : The gyro y dps float data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_gyro_y_dps( -float *v_gyro_y_f) +float *gyro_y_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gyro_y_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gyro_y_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as dps if the unit is in rps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_DPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_DPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_DPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_DPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw y data */ - com_rslt += bno055_read_gyro_y(&v_reg_gyro_y_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_gyro_y(®_gyro_y_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw gyro x to dps*/ - v_data_f = - (float)(v_reg_gyro_y_s16/GYRO_DIV_DPS); - *v_gyro_y_f = v_data_f; + data_f = + (float)(reg_gyro_y_s16/BNO055_GYRO_DIV_DPS); + *gyro_y_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3181,43 +3255,43 @@ float *v_gyro_y_f) * @brief This API is used to convert the gyro y raw data * to rps output as float * - * @param v_gyro_y_f : The gyro y dps float data + * @param gyro_y_f : The gyro y dps float data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_gyro_y_rps( -float *v_gyro_y_f) +float *gyro_y_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gyro_y_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gyro_y_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as rps if the unit is in dps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_RPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_RPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_RPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_RPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw y data */ - com_rslt += bno055_read_gyro_y(&v_reg_gyro_y_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_gyro_y(®_gyro_y_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw gyro x to rps*/ - v_data_f = - (float)(v_reg_gyro_y_s16/GYRO_DIV_RPS); - *v_gyro_y_f = v_data_f; + data_f = + (float)(reg_gyro_y_s16/BNO055_GYRO_DIV_RPS); + *gyro_y_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3225,42 +3299,42 @@ float *v_gyro_y_f) * @brief This API is used to convert the gyro z raw data * to dps output as float * - * @param v_gyro_z_f : The gyro z dps float data + * @param gyro_z_f : The gyro z dps float data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_gyro_z_dps( -float *v_gyro_z_f) +float *gyro_z_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gyro_z_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gyro_z_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as dps if the unit is in rps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_DPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_DPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_DPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_DPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw z data */ - com_rslt += bno055_read_gyro_z(&v_reg_gyro_z_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_gyro_z(®_gyro_z_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw gyro x to dps*/ - v_data_f = - (float)(v_reg_gyro_z_s16/GYRO_DIV_DPS); - *v_gyro_z_f = v_data_f; + data_f = + (float)(reg_gyro_z_s16/BNO055_GYRO_DIV_DPS); + *gyro_z_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3268,42 +3342,42 @@ float *v_gyro_z_f) * @brief This API is used to convert the gyro z raw data * to rps output as float * - * @param v_gyro_z_f : The gyro z rps float data + * @param gyro_z_f : The gyro z rps float data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_gyro_z_rps( -float *v_gyro_z_f) +float *gyro_z_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gyro_z_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gyro_z_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as rps if the unit is in dps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_RPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_RPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_RPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_RPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw x data */ - com_rslt += bno055_read_gyro_z(&v_reg_gyro_z_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_gyro_z(®_gyro_z_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw gyro x to rps*/ - v_data_f = - (float)(v_reg_gyro_z_s16/GYRO_DIV_RPS); - *v_gyro_z_f = v_data_f; + data_f = + (float)(reg_gyro_z_s16/BNO055_GYRO_DIV_RPS); + *gyro_z_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3321,8 +3395,8 @@ float *v_gyro_z_f) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -3331,31 +3405,31 @@ struct bno055_gyro_float_t *gyro_xyz_data) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_gyro_t gyro_xyz = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as dps if the unit is in rps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_DPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_DPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_DPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_DPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw xyz data */ com_rslt += bno055_read_gyro_xyz(&gyro_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert gyro raw xyz to dps*/ gyro_xyz_data->x = - (float)(gyro_xyz.x/GYRO_DIV_DPS); + (float)(gyro_xyz.x/BNO055_GYRO_DIV_DPS); gyro_xyz_data->y = - (float)(gyro_xyz.y/GYRO_DIV_DPS); + (float)(gyro_xyz.y/BNO055_GYRO_DIV_DPS); gyro_xyz_data->z = - (float)(gyro_xyz.z/GYRO_DIV_DPS); + (float)(gyro_xyz.z/BNO055_GYRO_DIV_DPS); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3373,8 +3447,8 @@ struct bno055_gyro_float_t *gyro_xyz_data) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -3383,31 +3457,31 @@ struct bno055_gyro_float_t *gyro_xyz_data) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - struct bno055_gyro_t gyro_xyz = {BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + struct bno055_gyro_t gyro_xyz = {BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as rps if the unit is in dps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_RPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_RPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_RPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_RPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw xyz data */ com_rslt += bno055_read_gyro_xyz(&gyro_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert gyro raw xyz to rps*/ gyro_xyz_data->x = - (float)(gyro_xyz.x/GYRO_DIV_RPS); + (float)(gyro_xyz.x/BNO055_GYRO_DIV_RPS); gyro_xyz_data->y = - (float)(gyro_xyz.y/GYRO_DIV_RPS); + (float)(gyro_xyz.y/BNO055_GYRO_DIV_RPS); gyro_xyz_data->z = - (float)(gyro_xyz.z/GYRO_DIV_RPS); + (float)(gyro_xyz.z/BNO055_GYRO_DIV_RPS); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3415,41 +3489,41 @@ struct bno055_gyro_float_t *gyro_xyz_data) * @brief This API is used to convert the Euler h raw data * to degree output as float * - * @param v_euler_h_f : The float value of Euler h degree + * @param euler_h_f : The float value of Euler h degree * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_h_deg( -float *v_euler_h_f) +float *euler_h_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_euler_h_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_euler_h_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as degree if the unit is in radians */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_DEG) - com_rslt += bno055_set_euler_unit(EULER_UNIT_DEG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_DEG) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_DEG); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw h data*/ - com_rslt += bno055_read_euler_h(&v_reg_euler_h_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_euler_h(®_euler_h_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler h data to degree*/ - v_data_f = - (float)(v_reg_euler_h_s16/EULER_DIV_DEG); - *v_euler_h_f = v_data_f; + data_f = + (float)(reg_euler_h_s16/BNO055_EULER_DIV_DEG); + *euler_h_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3457,39 +3531,40 @@ float *v_euler_h_f) * @brief This API is used to convert the Euler h raw data * to radians output as float * - * @param v_euler_h_f : The float value of Euler h radians + * @param euler_h_f : The float value of Euler h radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_h_rad( -float *v_euler_h_f) -{ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_euler_h_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_RAD) +float *euler_h_f) +{ + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_euler_h_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 euler_unit_u8 = BNO055_INIT_VALUE; + + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_RAD) /* Read the current Euler unit and set the unit as radians if the unit is in degree */ - com_rslt += bno055_set_euler_unit(EULER_UNIT_RAD); - if (com_rslt == SUCCESS) { + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_RAD); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw h data*/ - com_rslt += bno055_read_euler_h(&v_reg_euler_h_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_euler_h(®_euler_h_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler h data to degree*/ - v_data_f = - (float)(v_reg_euler_h_s16/EULER_DIV_RAD); - *v_euler_h_f = v_data_f; + data_f = + (float)(reg_euler_h_s16/BNO055_EULER_DIV_RAD); + *euler_h_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3497,37 +3572,38 @@ float *v_euler_h_f) * @brief This API is used to convert the Euler r raw data * to degree output as float * - * @param v_euler_r_f : The float value of Euler r degree + * @param euler_r_f : The float value of Euler r degree * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_r_deg( -float *v_euler_r_f) +float *euler_r_f) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 reg_euler_r = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_euler_r = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as degree if the unit is in radians */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_DEG) - com_rslt += bno055_set_euler_unit(EULER_UNIT_DEG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_DEG) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_DEG); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw r data*/ com_rslt += bno055_read_euler_r(®_euler_r); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler r data to degree*/ - v_data_f = (float)(reg_euler_r/EULER_DIV_DEG); - *v_euler_r_f = v_data_f; + data_f = (float)( + reg_euler_r/BNO055_EULER_DIV_DEG); + *euler_r_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3535,38 +3611,38 @@ float *v_euler_r_f) * @brief This API is used to convert the Euler r raw data * to radians output as float * - * @param v_euler_r_f : The float value of Euler r radians + * @param euler_r_f : The float value of Euler r radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_r_rad( -float *v_euler_r_f) +float *euler_r_f) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 reg_v_euler_r_f = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_euler_r_f = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as radians if the unit is in degree */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_RAD) - com_rslt += bno055_set_euler_unit(EULER_UNIT_RAD); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_RAD) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_RAD); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw r data*/ - com_rslt += bno055_read_euler_r(®_v_euler_r_f); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_euler_r(®_euler_r_f); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler r data to radians*/ - v_data_f = - (float)(reg_v_euler_r_f/EULER_DIV_RAD); - *v_euler_r_f = v_data_f; + data_f = + (float)(reg_euler_r_f/BNO055_EULER_DIV_RAD); + *euler_r_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3574,38 +3650,38 @@ float *v_euler_r_f) * @brief This API is used to convert the Euler p raw data * to degree output as float * - * @param v_euler_p_f : The float value of Euler p degree + * @param euler_p_f : The float value of Euler p degree * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_p_deg( -float *v_euler_p_f) +float *euler_p_f) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 reg_v_euler_p_f = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_euler_p_f = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as degree if the unit is in radians */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_DEG) - com_rslt += bno055_set_euler_unit(EULER_UNIT_DEG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_DEG) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_DEG); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw p data*/ - com_rslt += bno055_read_euler_p(®_v_euler_p_f); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_euler_p(®_euler_p_f); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler p data to degree*/ - v_data_f = - (float)(reg_v_euler_p_f/EULER_DIV_DEG); - *v_euler_p_f = v_data_f; + data_f = + (float)(reg_euler_p_f/BNO055_EULER_DIV_DEG); + *euler_p_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3613,39 +3689,39 @@ float *v_euler_p_f) * @brief This API is used to convert the Euler p raw data * to radians output as float * - * @param v_euler_p_f : The float value of Euler p radians + * @param euler_p_f : The float value of Euler p radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_p_rad( -float *v_euler_p_f) +float *euler_p_f) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 reg_v_euler_p_f = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_euler_p_f = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as radians if the unit is in degree */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_RAD) - com_rslt += bno055_set_euler_unit(EULER_UNIT_RAD); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_RAD) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_RAD); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw r data*/ - com_rslt += bno055_read_euler_p(®_v_euler_p_f); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_euler_p(®_euler_p_f); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler r data to radians*/ - v_data_f = - (float)(reg_v_euler_p_f/EULER_DIV_RAD); - *v_euler_p_f = v_data_f; + data_f = + (float)(reg_euler_p_f/BNO055_EULER_DIV_RAD); + *euler_p_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3663,8 +3739,8 @@ float *v_euler_p_f) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_hpr_deg( @@ -3672,31 +3748,31 @@ struct bno055_euler_float_t *euler_hpr) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - struct bno055_euler_t reg_euler = {BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + struct bno055_euler_t reg_euler = {BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as degree if the unit is in radians */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_DEG) - com_rslt += bno055_set_euler_unit(EULER_UNIT_DEG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_DEG) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_DEG); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw hrp data*/ com_rslt += bno055_read_euler_hrp(®_euler); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler hrp to degree*/ euler_hpr->h = - (float)(reg_euler.h/EULER_DIV_DEG); + (float)(reg_euler.h/BNO055_EULER_DIV_DEG); euler_hpr->p = - (float)(reg_euler.p/EULER_DIV_DEG); + (float)(reg_euler.p/BNO055_EULER_DIV_DEG); euler_hpr->r = - (float)(reg_euler.r/EULER_DIV_DEG); + (float)(reg_euler.r/BNO055_EULER_DIV_DEG); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3714,8 +3790,8 @@ struct bno055_euler_float_t *euler_hpr) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_hpr_rad( @@ -3723,31 +3799,31 @@ struct bno055_euler_float_t *euler_hpr) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - struct bno055_euler_t reg_euler = {BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + struct bno055_euler_t reg_euler = {BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as radians if the unit is in degree */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_RAD) - com_rslt += bno055_set_euler_unit(EULER_UNIT_RAD); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_RAD) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_RAD); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw hrp data*/ com_rslt += bno055_read_euler_hrp(®_euler); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert raw hrp to radians */ euler_hpr->h = - (float)(reg_euler.h/EULER_DIV_RAD); + (float)(reg_euler.h/BNO055_EULER_DIV_RAD); euler_hpr->p = - (float)(reg_euler.p/EULER_DIV_RAD); + (float)(reg_euler.p/BNO055_EULER_DIV_RAD); euler_hpr->r = - (float)(reg_euler.r/EULER_DIV_RAD); + (float)(reg_euler.r/BNO055_EULER_DIV_RAD); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3755,29 +3831,29 @@ struct bno055_euler_float_t *euler_hpr) * @brief This API is used to convert the linear * accel x raw data to meterpersecseq output as float * - * @param v_linear_accel_x_f : The float value of linear accel x meterpersecseq + * @param linear_accel_x_f : The float value of linear accel x meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_linear_accel_x_msq( -float *v_linear_accel_x_f) +float *linear_accel_x_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_linear_accel_x_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_linear_accel_x_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; /* Read the raw x of linear accel */ - com_rslt = bno055_read_linear_accel_x(&v_reg_linear_accel_x_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_linear_accel_x(®_linear_accel_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw linear accel x to m/s2*/ - v_data_f = - (float)(v_reg_linear_accel_x_s16/LINEAR_ACCEL_DIV_MSQ); - *v_linear_accel_x_f = v_data_f; + data_f = + (float)(reg_linear_accel_x_s16/BNO055_LINEAR_ACCEL_DIV_MSQ); + *linear_accel_x_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3785,27 +3861,27 @@ float *v_linear_accel_x_f) * @brief This API is used to convert the linear * accel y raw data to meterpersecseq output as float * - * @param v_linear_accel_y_f : The float value of linear accel y meterpersecseq + * @param linear_accel_y_f : The float value of linear accel y meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_linear_accel_y_msq( -float *v_linear_accel_y_f) +float *linear_accel_y_f) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 reg_linear_accel_y = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_linear_accel_y = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; /* Read the raw y of linear accel */ com_rslt = bno055_read_linear_accel_y(®_linear_accel_y); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw linear accel x to m/s2*/ - v_data_f = (float) - (reg_linear_accel_y/LINEAR_ACCEL_DIV_MSQ); - *v_linear_accel_y_f = v_data_f; + data_f = (float) + (reg_linear_accel_y/BNO055_LINEAR_ACCEL_DIV_MSQ); + *linear_accel_y_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3813,28 +3889,28 @@ float *v_linear_accel_y_f) * @brief This API is used to convert the linear * accel z raw data to meterpersecseq output as float * - * @param v_linear_accel_z_f : The float value of linear accel z meterpersecseq + * @param linear_accel_z_f : The float value of linear accel z meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_linear_accel_z_msq( -float *v_linear_accel_z_f) +float *linear_accel_z_f) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 reg_linear_accel_z = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_linear_accel_z = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; /* Read the raw x of linear accel */ com_rslt = bno055_read_linear_accel_z(®_linear_accel_z); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw linear accel z to m/s2*/ - v_data_f = (float) - (reg_linear_accel_z/LINEAR_ACCEL_DIV_MSQ); - *v_linear_accel_z_f = v_data_f; + data_f = (float) + (reg_linear_accel_z/BNO055_LINEAR_ACCEL_DIV_MSQ); + *linear_accel_z_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3852,8 +3928,8 @@ float *v_linear_accel_z_f) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -3862,20 +3938,20 @@ struct bno055_linear_accel_float_t *linear_accel_xyz) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_linear_accel_t reg_linear_accel = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; /* Read the raw x of linear accel */ com_rslt = bno055_read_linear_accel_xyz(®_linear_accel); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { linear_accel_xyz->x = - (float)(reg_linear_accel.x/LINEAR_ACCEL_DIV_MSQ); + (float)(reg_linear_accel.x/BNO055_LINEAR_ACCEL_DIV_MSQ); linear_accel_xyz->y = - (float)(reg_linear_accel.y/LINEAR_ACCEL_DIV_MSQ); + (float)(reg_linear_accel.y/BNO055_LINEAR_ACCEL_DIV_MSQ); linear_accel_xyz->z = - (float)(reg_linear_accel.z/LINEAR_ACCEL_DIV_MSQ); + (float)(reg_linear_accel.z/BNO055_LINEAR_ACCEL_DIV_MSQ); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3883,28 +3959,28 @@ struct bno055_linear_accel_float_t *linear_accel_xyz) * @brief This API is used to convert the gravity * x raw data to meterpersecseq output as float * - * @param v_gravity_x_f : The float value of gravity x meterpersecseq + * @param gravity_x_f : The float value of gravity x meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_gravity_float_x_msq( -float *v_gravity_x_f) +float *gravity_x_f) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gravity_x_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gravity_x_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; /* Read raw gravity of x*/ - com_rslt = bno055_read_gravity_x(&v_reg_gravity_x_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_gravity_x(®_gravity_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw gravity x to m/s2*/ - v_data_f = (float)(v_reg_gravity_x_s16/GRAVITY_DIV_MSQ); - *v_gravity_x_f = v_data_f; + data_f = (float)(reg_gravity_x_s16/BNO055_GRAVITY_DIV_MSQ); + *gravity_x_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3912,28 +3988,28 @@ float *v_gravity_x_f) * @brief This API is used to convert the gravity * y raw data to meterpersecseq output as float * - * @param v_gravity_y_f : The float value of gravity y meterpersecseq + * @param gravity_y_f : The float value of gravity y meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_gravity_float_y_msq( -float *v_gravity_y_f) +float *gravity_y_f) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gravity_y_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gravity_y_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; /* Read raw gravity of y*/ - com_rslt = bno055_read_gravity_y(&v_reg_gravity_y_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_gravity_y(®_gravity_y_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw gravity y to m/s2*/ - v_data_f = (float)(v_reg_gravity_y_s16/GRAVITY_DIV_MSQ); - *v_gravity_y_f = v_data_f; + data_f = (float)(reg_gravity_y_s16/BNO055_GRAVITY_DIV_MSQ); + *gravity_y_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3941,27 +4017,27 @@ float *v_gravity_y_f) * @brief This API is used to convert the gravity * z raw data to meterpersecseq output as float * - * @param v_gravity_z_f : The float value of gravity z meterpersecseq + * @param gravity_z_f : The float value of gravity z meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_gravity_float_z_msq( -float *v_gravity_z_f) +float *gravity_z_f) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gravity_z_s16 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gravity_z_s16 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; /* Read raw gravity of z */ - com_rslt = bno055_read_gravity_z(&v_reg_gravity_z_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_gravity_z(®_gravity_z_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw gravity z to m/s2*/ - v_data_f = (float)(v_reg_gravity_z_s16/GRAVITY_DIV_MSQ); - *v_gravity_z_f = v_data_f; + data_f = (float)(reg_gravity_z_s16/BNO055_GRAVITY_DIV_MSQ); + *gravity_z_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -3979,8 +4055,8 @@ float *v_gravity_z_f) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -3989,21 +4065,21 @@ struct bno055_gravity_float_t *gravity_xyz) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_gravity_t reg_gravity_xyz = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; /* Read raw gravity of xyz */ com_rslt = bno055_read_gravity_xyz(®_gravity_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert raw gravity xyz to meterpersecseq */ gravity_xyz->x = - (float)(reg_gravity_xyz.x/GRAVITY_DIV_MSQ); + (float)(reg_gravity_xyz.x/BNO055_GRAVITY_DIV_MSQ); gravity_xyz->y = - (float)(reg_gravity_xyz.y/GRAVITY_DIV_MSQ); + (float)(reg_gravity_xyz.y/BNO055_GRAVITY_DIV_MSQ); gravity_xyz->z = - (float)(reg_gravity_xyz.z/GRAVITY_DIV_MSQ); + (float)(reg_gravity_xyz.z/BNO055_GRAVITY_DIV_MSQ); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4011,41 +4087,41 @@ struct bno055_gravity_float_t *gravity_xyz) * @brief This API is used to convert the temperature * data to Fahrenheit output as float * - * @param v_temp_f : The float value of temperature Fahrenheit + * @param temp_f : The float value of temperature Fahrenheit * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_temp_fahrenheit( -float *v_temp_f) +float *temp_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s8 v_reg_temp_s8 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_temp_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s8 reg_temp_s8 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 temp_unit_u8 = BNO055_INIT_VALUE; /* Read the current temperature unit and set the unit as Fahrenheit if the unit is in Celsius */ - com_rslt = bno055_get_temp_unit(&v_temp_unit_u8); - if (v_temp_unit_u8 != TEMP_UNIT_FAHRENHEIT) - com_rslt += bno055_set_temp_unit(TEMP_UNIT_FAHRENHEIT); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_temp_unit(&temp_unit_u8); + if (temp_unit_u8 != BNO055_TEMP_UNIT_FAHRENHEIT) + com_rslt += bno055_set_temp_unit(BNO055_TEMP_UNIT_FAHRENHEIT); + if (com_rslt == BNO055_SUCCESS) { /* Read the raw temperature data */ - com_rslt += bno055_read_temp_data(&v_reg_temp_s8); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_temp_data(®_temp_s8); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw temperature data to Fahrenheit*/ - v_data_f = (float) - (v_reg_temp_s8/TEMP_DIV_FAHRENHEIT); - *v_temp_f = v_data_f; + data_f = (float) + (reg_temp_s8/BNO055_TEMP_DIV_FAHRENHEIT); + *temp_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4053,42 +4129,42 @@ float *v_temp_f) * @brief This API is used to convert the temperature * data to Celsius output as float * - * @param v_temp_f : The float value of temperature Celsius + * @param temp_f : The float value of temperature Celsius * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_temp_celsius( -float *v_temp_f) +float *temp_f) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s8 v_reg_temp_s8 = BNO055_ZERO_U8X; - float v_data_f = BNO055_ZERO_U8X; - u8 v_temp_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s8 reg_temp_s8 = BNO055_INIT_VALUE; + float data_f = BNO055_INIT_VALUE; + u8 temp_unit_u8 = BNO055_INIT_VALUE; /* Read the current temperature unit and set the unit as Fahrenheit if the unit is in Celsius */ - com_rslt = bno055_get_temp_unit(&v_temp_unit_u8); - if (v_temp_unit_u8 != TEMP_UNIT_CELSIUS) - com_rslt += bno055_set_temp_unit(TEMP_UNIT_CELSIUS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_temp_unit(&temp_unit_u8); + if (temp_unit_u8 != BNO055_TEMP_UNIT_CELSIUS) + com_rslt += bno055_set_temp_unit(BNO055_TEMP_UNIT_CELSIUS); + if (com_rslt == BNO055_SUCCESS) { /* Read the raw temperature data */ - com_rslt += bno055_read_temp_data(&v_reg_temp_s8); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_temp_data(®_temp_s8); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw temperature data to Fahrenheit*/ - v_data_f = - (float)(v_reg_temp_s8/TEMP_DIV_CELSIUS); - *v_temp_f = v_data_f; + data_f = + (float)(reg_temp_s8/BNO055_TEMP_DIV_CELSIUS); + *temp_f = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4098,43 +4174,43 @@ float *v_temp_f) * @brief This API is used to convert the accel x raw data * to meterpersecseq output as double * - * @param v_accel_x_d : The accel x meterpersecseq data + * @param accel_x_d : The accel x meterpersecseq data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_x_msq( -double *v_accel_x_d) +double *accel_x_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_accel_x_s16 = BNO055_ZERO_U8X; - double v_data_f = BNO055_ZERO_U8X; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_accel_x_s16 = BNO055_INIT_VALUE; + double data_f = BNO055_INIT_VALUE; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as m/s2 if the unit is in mg*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MSQ) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MSQ); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MSQ) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MSQ); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw y data*/ - com_rslt += bno055_read_accel_x(&v_reg_accel_x_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_accel_x(®_accel_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw x to m/s2 */ - v_data_f = - (double)(v_reg_accel_x_s16/ACCEL_DIV_MSQ); - *v_accel_x_d = v_data_f; + data_f = + (double)(reg_accel_x_s16/BNO055_ACCEL_DIV_MSQ); + *accel_x_d = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4142,44 +4218,44 @@ double *v_accel_x_d) * @brief This API is used to convert the accel x raw data * to millig output as double * - * @param v_accel_x_d : The accel x millig data + * @param accel_x_d : The accel x millig data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_x_mg( -double *v_accel_x_d) +double *accel_x_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_accel_x_s16 = BNO055_ZERO_U8X; - double v_data_f = BNO055_ZERO_U8X; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_accel_x_s16 = BNO055_INIT_VALUE; + double data_f = BNO055_INIT_VALUE; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as mg if the unit is in m/s2*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MG) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MG) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MG); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw y data*/ - com_rslt += bno055_read_accel_x(&v_reg_accel_x_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_accel_x(®_accel_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw x to mg */ - v_data_f = - (double)(v_reg_accel_x_s16/ACCEL_DIV_MG); - *v_accel_x_d = v_data_f; + data_f = + (double)(reg_accel_x_s16/BNO055_ACCEL_DIV_MG); + *accel_x_d = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4187,44 +4263,44 @@ double *v_accel_x_d) * @brief This API is used to convert the accel y raw data * to meterpersecseq output as double * - * @param v_accel_y_d : The accel y meterpersecseq data + * @param accel_y_d : The accel y meterpersecseq data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_y_msq( -double *v_accel_y_d) +double *accel_y_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_accel_y_s16 = BNO055_ZERO_U8X; - double v_data_f = BNO055_ZERO_U8X; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_accel_y_s16 = BNO055_INIT_VALUE; + double data_f = BNO055_INIT_VALUE; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as m/s2 if the unit is in mg*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MSQ) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MSQ); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MSQ) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MSQ); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw y data*/ - com_rslt += bno055_read_accel_y(&v_reg_accel_y_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_accel_y(®_accel_y_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw x to m/s2 */ - v_data_f = - (double)(v_reg_accel_y_s16/ACCEL_DIV_MSQ); - *v_accel_y_d = v_data_f; + data_f = + (double)(reg_accel_y_s16/BNO055_ACCEL_DIV_MSQ); + *accel_y_d = data_f; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4232,43 +4308,43 @@ double *v_accel_y_d) * @brief This API is used to convert the accel y raw data * to millig output as double * - * @param v_accel_y_d : The accel y millig data + * @param accel_y_d : The accel y millig data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_y_mg( -double *v_accel_y_d) +double *accel_y_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_accel_y_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_accel_y_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as mg if the unit is in m/s2*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MG) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MG) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MG); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw y data*/ - com_rslt += bno055_read_accel_y(&v_reg_accel_y_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_accel_y(®_accel_y_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw y to mg */ - v_data_d = - (double)(v_reg_accel_y_s16/ACCEL_DIV_MG); - *v_accel_y_d = v_data_d; + data_d = + (double)(reg_accel_y_s16/BNO055_ACCEL_DIV_MG); + *accel_y_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4276,41 +4352,41 @@ double *v_accel_y_d) * @brief This API is used to convert the accel z raw data * to meterpersecseq output as double * - * @param v_accel_z_d : The accel z meterpersecseq data + * @param accel_z_d : The accel z meterpersecseq data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_z_msq( -double *v_accel_z_d) +double *accel_z_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_accel_z_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_accel_z_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as m/s2 if the unit is in mg*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MSQ) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MSQ); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MSQ) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MSQ); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw z data*/ - com_rslt += bno055_read_accel_z(&v_reg_accel_z_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_accel_z(®_accel_z_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw z to m/s2 */ - v_data_d = - (double)(v_reg_accel_z_s16/ACCEL_DIV_MSQ); - *v_accel_z_d = v_data_d; + data_d = + (double)(reg_accel_z_s16/BNO055_ACCEL_DIV_MSQ); + *accel_z_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4318,42 +4394,42 @@ double *v_accel_z_d) * @brief This API is used to convert the accel z raw data * to millig output as double * - * @param v_accel_z_d : The accel z millig data + * @param accel_z_d : The accel z millig data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_z_mg( -double *v_accel_z_d) +double *accel_z_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_accel_z_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_accel_z_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as mg if the unit is in m/s2*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MG) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MG) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MG); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw z data*/ - com_rslt += bno055_read_accel_z(&v_reg_accel_z_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_accel_z(®_accel_z_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw z to mg */ - v_data_d = - (double)(v_reg_accel_z_s16/ACCEL_DIV_MG); - *v_accel_z_d = v_data_d; + data_d = + (double)(reg_accel_z_s16/BNO055_ACCEL_DIV_MG); + *accel_z_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4371,8 +4447,8 @@ double *v_accel_z_d) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -4381,31 +4457,31 @@ struct bno055_accel_double_t *accel_xyz) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_accel_t reg_accel_xyz = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as m/s2 if the unit is in mg*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MSQ) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MSQ); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MSQ) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MSQ); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw xyz data*/ com_rslt += bno055_read_accel_xyz(®_accel_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert raw xyz to m/s2*/ accel_xyz->x = - (double)(reg_accel_xyz.x/ACCEL_DIV_MSQ); + (double)(reg_accel_xyz.x/BNO055_ACCEL_DIV_MSQ); accel_xyz->y = - (double)(reg_accel_xyz.y/ACCEL_DIV_MSQ); + (double)(reg_accel_xyz.y/BNO055_ACCEL_DIV_MSQ); accel_xyz->z = - (double)(reg_accel_xyz.z/ACCEL_DIV_MSQ); + (double)(reg_accel_xyz.z/BNO055_ACCEL_DIV_MSQ); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4423,8 +4499,8 @@ struct bno055_accel_double_t *accel_xyz) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_xyz_mg( @@ -4432,31 +4508,31 @@ struct bno055_accel_double_t *accel_xyz) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_accel_t reg_accel_xyz = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - u8 v_accel_unit_u8 = BNO055_ZERO_U8X; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + u8 accel_unit_u8 = BNO055_INIT_VALUE; /* Read the current accel unit and set the unit as m/s2 if the unit is in mg*/ - com_rslt = bno055_get_accel_unit(&v_accel_unit_u8); - if (v_accel_unit_u8 != ACCEL_UNIT_MG) - com_rslt += bno055_set_accel_unit(ACCEL_UNIT_MG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_accel_unit(&accel_unit_u8); + if (accel_unit_u8 != BNO055_ACCEL_UNIT_MG) + com_rslt += bno055_set_accel_unit(BNO055_ACCEL_UNIT_MG); + if (com_rslt == BNO055_SUCCESS) { /* Read the accel raw xyz data*/ com_rslt += bno055_read_accel_xyz(®_accel_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert raw xyz to mg*/ accel_xyz->x = - (double)(reg_accel_xyz.x/ACCEL_DIV_MG); + (double)(reg_accel_xyz.x/BNO055_ACCEL_DIV_MG); accel_xyz->y = - (double)(reg_accel_xyz.y/ACCEL_DIV_MG); + (double)(reg_accel_xyz.y/BNO055_ACCEL_DIV_MG); accel_xyz->z = - (double)(reg_accel_xyz.z/ACCEL_DIV_MG); + (double)(reg_accel_xyz.z/BNO055_ACCEL_DIV_MG); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4464,33 +4540,33 @@ struct bno055_accel_double_t *accel_xyz) * @brief This API is used to convert the mag x raw data * to microTesla output as double * - * @param v_mag_x_d : The mag x microTesla data + * @param mag_x_d : The mag x microTesla data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_mag_x_uT( -double *v_mag_x_d) +double *mag_x_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_v_mag_x_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_mag_x_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; /* Read raw mag x data */ - com_rslt = bno055_read_mag_x(&v_reg_v_mag_x_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_mag_x(®_mag_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw mag x to microTesla */ - v_data_d = (double)(v_reg_v_mag_x_s16/MAG_DIV_UT); - *v_mag_x_d = v_data_d; + data_d = (double)(reg_mag_x_s16/BNO055_MAG_DIV_UT); + *mag_x_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4498,32 +4574,32 @@ double *v_mag_x_d) * @brief This API is used to convert the mag y raw data * to microTesla output as double * - * @param v_mag_y_d : The mag y microTesla data + * @param mag_y_d : The mag y microTesla data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_mag_y_uT( -double *v_mag_y_d) +double *mag_y_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_mag_y_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_mag_y_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; /* Read raw mag y data */ - com_rslt = bno055_read_mag_y(&v_reg_mag_y_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_mag_y(®_mag_y_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw mag y to microTesla */ - v_data_d = (double)(v_reg_mag_y_s16/MAG_DIV_UT); - *v_mag_y_d = v_data_d; + data_d = (double)(reg_mag_y_s16/BNO055_MAG_DIV_UT); + *mag_y_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4531,32 +4607,32 @@ double *v_mag_y_d) * @brief This API is used to convert the mag z raw data * to microTesla output as double * - * @param v_mag_z_d : The mag z microTesla data + * @param mag_z_d : The mag z microTesla data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_mag_z_uT( -double *v_mag_z_d) +double *mag_z_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_mag_z_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_mag_z_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; /* Read raw mag x */ - com_rslt = bno055_read_mag_z(&v_reg_mag_z_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_mag_z(®_mag_z_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw mag x to microTesla */ - v_data_d = (double)(v_reg_mag_z_s16/MAG_DIV_UT); - *v_mag_z_d = v_data_d; + data_d = (double)(reg_mag_z_s16/BNO055_MAG_DIV_UT); + *mag_z_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4574,8 +4650,8 @@ double *v_mag_z_d) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_mag_xyz_uT( @@ -4583,21 +4659,21 @@ struct bno055_mag_double_t *mag_xyz) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_mag_t reg_mag_xyz = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; /* Read raw mag xyz data */ com_rslt = bno055_read_mag_xyz(®_mag_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert raw mag xyz to microTesla*/ mag_xyz->x = - (double)(reg_mag_xyz.x/MAG_DIV_UT); + (double)(reg_mag_xyz.x/BNO055_MAG_DIV_UT); mag_xyz->y = - (double)(reg_mag_xyz.y/MAG_DIV_UT); + (double)(reg_mag_xyz.y/BNO055_MAG_DIV_UT); mag_xyz->z = - (double)(reg_mag_xyz.z/MAG_DIV_UT); + (double)(reg_mag_xyz.z/BNO055_MAG_DIV_UT); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; @@ -4606,43 +4682,43 @@ struct bno055_mag_double_t *mag_xyz) * @brief This API is used to convert the gyro x raw data * to dps output as double * - * @param v_gyro_x_d : The gyro x dps double data + * @param gyro_x_d : The gyro x dps double data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_x_dps( -double *v_gyro_x_d) +double *gyro_x_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gyro_x_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gyro_x_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as dps if the unit is in rps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_DPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_DPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_DPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_DPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw x data */ - com_rslt += bno055_read_gyro_x(&v_reg_gyro_x_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_gyro_x(®_gyro_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw gyro x to dps */ - v_data_d = - (double)(v_reg_gyro_x_s16/GYRO_DIV_DPS); - *v_gyro_x_d = v_data_d; + data_d = + (double)(reg_gyro_x_s16/BNO055_GYRO_DIV_DPS); + *gyro_x_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4650,43 +4726,43 @@ double *v_gyro_x_d) * @brief This API is used to convert the gyro x raw data * to rps output as double * - * @param v_gyro_x_d : The gyro x dps double data + * @param gyro_x_d : The gyro x dps double data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_x_rps( -double *v_gyro_x_d) +double *gyro_x_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gyro_x_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gyro_x_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as rps if the unit is in dps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_RPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_RPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_RPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_RPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw x data */ - com_rslt += bno055_read_gyro_x(&v_reg_gyro_x_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_gyro_x(®_gyro_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw gyro x to rps */ - v_data_d = - (double)(v_reg_gyro_x_s16/GYRO_DIV_RPS); - *v_gyro_x_d = v_data_d; + data_d = + (double)(reg_gyro_x_s16/BNO055_GYRO_DIV_RPS); + *gyro_x_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4694,43 +4770,43 @@ double *v_gyro_x_d) * @brief This API is used to convert the gyro y raw data * to dps output as double * - * @param v_gyro_y_d : The gyro y dps double data + * @param gyro_y_d : The gyro y dps double data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_y_dps( -double *v_gyro_y_d) +double *gyro_y_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gyro_y_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gyro_y_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as dps if the unit is in rps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_DPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_DPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_DPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_DPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw y data */ - com_rslt += bno055_read_gyro_y(&v_reg_gyro_y_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_gyro_y(®_gyro_y_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw gyro y to dps */ - v_data_d = - (double)(v_reg_gyro_y_s16/GYRO_DIV_DPS); - *v_gyro_y_d = v_data_d; + data_d = + (double)(reg_gyro_y_s16/BNO055_GYRO_DIV_DPS); + *gyro_y_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4738,43 +4814,43 @@ double *v_gyro_y_d) * @brief This API is used to convert the gyro y raw data * to rps output as double * - * @param v_gyro_y_d : The gyro y dps double data + * @param gyro_y_d : The gyro y dps double data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_y_rps( -double *v_gyro_y_d) +double *gyro_y_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gyro_y_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gyro_y_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as rps if the unit is in dps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_RPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_RPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_RPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_RPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw y data */ - com_rslt += bno055_read_gyro_y(&v_reg_gyro_y_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_gyro_y(®_gyro_y_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw gyro y to rps */ - v_data_d = - (double)(v_reg_gyro_y_s16/GYRO_DIV_RPS); - *v_gyro_y_d = v_data_d; + data_d = + (double)(reg_gyro_y_s16/BNO055_GYRO_DIV_RPS); + *gyro_y_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4782,43 +4858,43 @@ double *v_gyro_y_d) * @brief This API is used to convert the gyro z raw data * to dps output as double * - * @param v_gyro_z_d : The gyro z dps double data + * @param gyro_z_d : The gyro z dps double data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_z_dps( -double *v_gyro_z_d) +double *gyro_z_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gyro_z_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gyro_z_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as dps if the unit is in rps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_DPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_DPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_DPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_DPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw z data */ - com_rslt += bno055_read_gyro_z(&v_reg_gyro_z_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_gyro_z(®_gyro_z_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw gyro z to dps */ - v_data_d = - (double)(v_reg_gyro_z_s16/GYRO_DIV_DPS); - *v_gyro_z_d = v_data_d; + data_d = + (double)(reg_gyro_z_s16/BNO055_GYRO_DIV_DPS); + *gyro_z_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4826,43 +4902,43 @@ double *v_gyro_z_d) * @brief This API is used to convert the gyro z raw data * to rps output as double * - * @param v_gyro_z_d : The gyro z rps double data + * @param gyro_z_d : The gyro z rps double data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_z_rps( -double *v_gyro_z_d) +double *gyro_z_d) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gyro_z_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gyro_z_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as rps if the unit is in dps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_RPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_RPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_RPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_RPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw x data */ - com_rslt += bno055_read_gyro_z(&v_reg_gyro_z_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_gyro_z(®_gyro_z_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw gyro x to rps */ - v_data_d = - (double)(v_reg_gyro_z_s16/GYRO_DIV_RPS); - *v_gyro_z_d = v_data_d; + data_d = + (double)(reg_gyro_z_s16/BNO055_GYRO_DIV_RPS); + *gyro_z_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4880,8 +4956,8 @@ double *v_gyro_z_d) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_xyz_dps( @@ -4889,31 +4965,31 @@ struct bno055_gyro_double_t *gyro_xyz) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_gyro_t reg_gyro_xyz = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as dps if the unit is in rps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_DPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_DPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_DPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_DPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw xyz data */ com_rslt += bno055_read_gyro_xyz(®_gyro_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert gyro raw xyz to dps*/ gyro_xyz->x = - (double)(reg_gyro_xyz.x/GYRO_DIV_DPS); + (double)(reg_gyro_xyz.x/BNO055_GYRO_DIV_DPS); gyro_xyz->y = - (double)(reg_gyro_xyz.y/GYRO_DIV_DPS); + (double)(reg_gyro_xyz.y/BNO055_GYRO_DIV_DPS); gyro_xyz->z = - (double)(reg_gyro_xyz.z/GYRO_DIV_DPS); + (double)(reg_gyro_xyz.z/BNO055_GYRO_DIV_DPS); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4931,8 +5007,8 @@ struct bno055_gyro_double_t *gyro_xyz) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_xyz_rps( @@ -4940,31 +5016,31 @@ struct bno055_gyro_double_t *gyro_xyz) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_gyro_t reg_gyro_xyz = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - u8 v_gyro_unit_u8 = BNO055_ZERO_U8X; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + u8 gyro_unit_u8 = BNO055_INIT_VALUE; /* Read the current gyro unit and set the unit as rps if the unit is in dps */ - com_rslt = bno055_get_gyro_unit(&v_gyro_unit_u8); - if (v_gyro_unit_u8 != GYRO_UNIT_RPS) - com_rslt += bno055_set_gyro_unit(GYRO_UNIT_RPS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_gyro_unit(&gyro_unit_u8); + if (gyro_unit_u8 != BNO055_GYRO_UNIT_RPS) + com_rslt += bno055_set_gyro_unit(BNO055_GYRO_UNIT_RPS); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro raw x data */ com_rslt += bno055_read_gyro_xyz(®_gyro_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw gyro xyz to rps*/ gyro_xyz->x = - (double)(reg_gyro_xyz.x/GYRO_DIV_RPS); + (double)(reg_gyro_xyz.x/BNO055_GYRO_DIV_RPS); gyro_xyz->y = - (double)(reg_gyro_xyz.y/GYRO_DIV_RPS); + (double)(reg_gyro_xyz.y/BNO055_GYRO_DIV_RPS); gyro_xyz->z = - (double)(reg_gyro_xyz.z/GYRO_DIV_RPS); + (double)(reg_gyro_xyz.z/BNO055_GYRO_DIV_RPS); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -4972,39 +5048,39 @@ struct bno055_gyro_double_t *gyro_xyz) * @brief This API is used to convert the Euler h raw data * to degree output as double * - * @param v_euler_h_d : The double value of Euler h degree + * @param euler_h_d : The double value of Euler h degree * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_h_deg( -double *v_euler_h_d) +double *euler_h_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_euler_h_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_euler_h_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as degree if the unit is in radians */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_DEG) - com_rslt += bno055_set_euler_unit(EULER_UNIT_DEG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_DEG) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_DEG); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw h data*/ - com_rslt += bno055_read_euler_h(&v_reg_euler_h_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_euler_h(®_euler_h_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler h to degree */ - v_data_d = - (double)(v_reg_euler_h_s16/EULER_DIV_DEG); - *v_euler_h_d = v_data_d; + data_d = + (double)(reg_euler_h_s16/BNO055_EULER_DIV_DEG); + *euler_h_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5012,39 +5088,39 @@ double *v_euler_h_d) * @brief This API is used to convert the Euler h raw data * to radians output as double * - * @param v_euler_h_d : The double value of Euler h radians + * @param euler_h_d : The double value of Euler h radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_h_rad( -double *v_euler_h_d) +double *euler_h_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_euler_h_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_euler_h_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as radians if the unit is in degree */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_RAD) - com_rslt += bno055_set_euler_unit(EULER_UNIT_RAD); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_RAD) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_RAD); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw h data*/ - com_rslt += bno055_read_euler_h(&v_reg_euler_h_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_euler_h(®_euler_h_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler h to radians */ - v_data_d = - (double)(v_reg_euler_h_s16/EULER_DIV_RAD); - *v_euler_h_d = v_data_d; + data_d = + (double)(reg_euler_h_s16/BNO055_EULER_DIV_RAD); + *euler_h_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5052,39 +5128,39 @@ double *v_euler_h_d) * @brief This API is used to convert the Euler r raw data * to degree output as double * - * @param v_euler_r_d : The double value of Euler r degree + * @param euler_r_d : The double value of Euler r degree * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_r_deg( -double *v_euler_r_d) +double *euler_r_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_euler_r_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_euler_r_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as degree if the unit is in radians */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_DEG) - com_rslt += bno055_set_euler_unit(EULER_UNIT_DEG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_DEG) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_DEG); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw r data*/ - com_rslt += bno055_read_euler_r(&v_reg_euler_r_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_euler_r(®_euler_r_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler r to degree */ - v_data_d = - (double)(v_reg_euler_r_s16/EULER_DIV_DEG); - *v_euler_r_d = v_data_d; + data_d = + (double)(reg_euler_r_s16/BNO055_EULER_DIV_DEG); + *euler_r_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5092,39 +5168,39 @@ double *v_euler_r_d) * @brief This API is used to convert the Euler r raw data * to radians output as double * - * @param v_euler_r_d : The double value of Euler r radians + * @param euler_r_d : The double value of Euler r radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_r_rad( -double *v_euler_r_d) +double *euler_r_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_euler_r_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_euler_r_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as radians if the unit is in degree */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_RAD) - com_rslt += bno055_set_euler_unit(EULER_UNIT_RAD); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_RAD) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_RAD); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw r data*/ - com_rslt += bno055_read_euler_r(&v_reg_euler_r_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_euler_r(®_euler_r_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler r to radians */ - v_data_d = - (double)(v_reg_euler_r_s16/EULER_DIV_RAD); - *v_euler_r_d = v_data_d; + data_d = + (double)(reg_euler_r_s16/BNO055_EULER_DIV_RAD); + *euler_r_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5132,39 +5208,39 @@ double *v_euler_r_d) * @brief This API is used to convert the Euler p raw data * to degree output as double * - * @param v_euler_p_d : The double value of Euler p degree + * @param euler_p_d : The double value of Euler p degree * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_p_deg( -double *v_euler_p_d) +double *euler_p_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_euler_p_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_euler_p_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as degree if the unit is in radians */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_DEG) - com_rslt += bno055_set_euler_unit(EULER_UNIT_DEG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_DEG) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_DEG); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw p data*/ - com_rslt += bno055_read_euler_p(&v_reg_euler_p_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_euler_p(®_euler_p_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler p to degree*/ - v_data_d = - (double)(v_reg_euler_p_s16/EULER_DIV_DEG); - *v_euler_p_d = v_data_d; + data_d = + (double)(reg_euler_p_s16/BNO055_EULER_DIV_DEG); + *euler_p_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5172,40 +5248,40 @@ double *v_euler_p_d) * @brief This API is used to convert the Euler p raw data * to radians output as double * - * @param v_euler_p_d : The double value of Euler p radians + * @param euler_p_d : The double value of Euler p radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_p_rad( -double *v_euler_p_d) +double *euler_p_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_euler_p_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_euler_p_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as radians if the unit is in degree */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_RAD) - com_rslt += bno055_set_euler_unit(EULER_UNIT_RAD); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_RAD) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_RAD); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw p data*/ - com_rslt += bno055_read_euler_p(&v_reg_euler_p_s16); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_euler_p(®_euler_p_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw p to radians*/ - v_data_d = - (double)(v_reg_euler_p_s16/EULER_DIV_RAD); - *v_euler_p_d = v_data_d; + data_d = + (double)(reg_euler_p_s16/BNO055_EULER_DIV_RAD); + *euler_p_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5223,8 +5299,8 @@ double *v_euler_p_d) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ @@ -5233,31 +5309,31 @@ struct bno055_euler_double_t *euler_hpr) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - struct bno055_euler_t reg_euler = {BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + struct bno055_euler_t reg_euler = {BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as degree if the unit is in radians */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_DEG) - com_rslt += bno055_set_euler_unit(EULER_UNIT_DEG); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_DEG) + com_rslt += bno055_set_euler_unit(BNO055_EULER_UNIT_DEG); + if (com_rslt == BNO055_SUCCESS) { /* Read Euler raw h data*/ com_rslt += bno055_read_euler_hrp(®_euler); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler hrp to degree*/ euler_hpr->h = - (double)(reg_euler.h/EULER_DIV_DEG); + (double)(reg_euler.h/BNO055_EULER_DIV_DEG); euler_hpr->p = - (double)(reg_euler.p/EULER_DIV_DEG); + (double)(reg_euler.p/BNO055_EULER_DIV_DEG); euler_hpr->r = - (double)(reg_euler.r/EULER_DIV_DEG); + (double)(reg_euler.r/BNO055_EULER_DIV_DEG); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5275,8 +5351,8 @@ struct bno055_euler_double_t *euler_hpr) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ @@ -5285,31 +5361,31 @@ struct bno055_euler_double_t *euler_hpr) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - struct bno055_euler_t reg_euler = {BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - u8 v_euler_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + struct bno055_euler_t reg_euler = {BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + u8 euler_unit_u8 = BNO055_INIT_VALUE; /* Read the current Euler unit and set the unit as radians if the unit is in degree */ - com_rslt = bno055_get_euler_unit(&v_euler_unit_u8); - if (v_euler_unit_u8 != EULER_UNIT_RAD) - com_rslt = bno055_set_euler_unit(EULER_UNIT_RAD); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_euler_unit(&euler_unit_u8); + if (euler_unit_u8 != BNO055_EULER_UNIT_RAD) + com_rslt = bno055_set_euler_unit(BNO055_EULER_UNIT_RAD); + if (com_rslt == BNO055_SUCCESS) { /* Read the raw hrp */ com_rslt = bno055_read_euler_hrp(®_euler); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert raw Euler hrp to radians*/ euler_hpr->h = - (double)(reg_euler.h/EULER_DIV_RAD); + (double)(reg_euler.h/BNO055_EULER_DIV_RAD); euler_hpr->p = - (double)(reg_euler.p/EULER_DIV_RAD); + (double)(reg_euler.p/BNO055_EULER_DIV_RAD); euler_hpr->r = - (double)(reg_euler.r/EULER_DIV_RAD); + (double)(reg_euler.r/BNO055_EULER_DIV_RAD); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5317,31 +5393,31 @@ struct bno055_euler_double_t *euler_hpr) * @brief This API is used to convert the linear * accel x raw data to meterpersecseq output as double * - * @param v_linear_accel_x_d : The double value of + * @param linear_accel_x_d : The double value of * linear accel x meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_linear_accel_x_msq( -double *v_linear_accel_x_d) +double *linear_accel_x_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_linear_accel_x_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_linear_accel_x_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; /* Read the raw x of linear accel */ - com_rslt = bno055_read_linear_accel_x(&v_reg_linear_accel_x_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_linear_accel_x(®_linear_accel_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw x to m/s2 */ - v_data_d = (double) - (v_reg_linear_accel_x_s16/LINEAR_ACCEL_DIV_MSQ); - *v_linear_accel_x_d = v_data_d; + data_d = (double) + (reg_linear_accel_x_s16/BNO055_LINEAR_ACCEL_DIV_MSQ); + *linear_accel_x_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5349,31 +5425,31 @@ double *v_linear_accel_x_d) * @brief This API is used to convert the linear * accel y raw data to meterpersecseq output as double * - * @param v_linear_accel_y_d : The double value of + * @param linear_accel_y_d : The double value of * linear accel y meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_linear_accel_y_msq( -double *v_linear_accel_y_d) +double *linear_accel_y_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_linear_accel_y_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_linear_accel_y_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; /* Read the raw x of linear accel */ - com_rslt = bno055_read_linear_accel_y(&v_reg_linear_accel_y_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_linear_accel_y(®_linear_accel_y_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw y to m/s2 */ - v_data_d = (double) - (v_reg_linear_accel_y_s16/LINEAR_ACCEL_DIV_MSQ); - *v_linear_accel_y_d = v_data_d; + data_d = (double) + (reg_linear_accel_y_s16/BNO055_LINEAR_ACCEL_DIV_MSQ); + *linear_accel_y_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5381,31 +5457,31 @@ double *v_linear_accel_y_d) * @brief This API is used to convert the linear * accel z raw data to meterpersecseq output as double * - * @param v_linear_accel_z_d : The double value of + * @param linear_accel_z_d : The double value of * linear accel z meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_linear_accel_z_msq( -double *v_linear_accel_z_d) +double *linear_accel_z_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_linear_accel_z_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_linear_accel_z_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; /* Read the raw x of linear accel */ - com_rslt = bno055_read_linear_accel_z(&v_reg_linear_accel_z_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_linear_accel_z(®_linear_accel_z_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw z to m/s2 */ - v_data_d = - (double)(v_reg_linear_accel_z_s16/LINEAR_ACCEL_DIV_MSQ); - *v_linear_accel_z_d = v_data_d; + data_d = + (double)(reg_linear_accel_z_s16/BNO055_LINEAR_ACCEL_DIV_MSQ); + *linear_accel_z_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5423,8 +5499,8 @@ double *v_linear_accel_z_d) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ @@ -5433,21 +5509,21 @@ struct bno055_linear_accel_double_t *linear_accel_xyz) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_linear_accel_t reg_linear_accel_xyz = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; /* Read the raw xyz of linear accel */ com_rslt = bno055_read_linear_accel_xyz(®_linear_accel_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert the raw xyz of linear accel to m/s2 */ linear_accel_xyz->x = - (double)(reg_linear_accel_xyz.x/LINEAR_ACCEL_DIV_MSQ); + (double)(reg_linear_accel_xyz.x/BNO055_LINEAR_ACCEL_DIV_MSQ); linear_accel_xyz->y = - (double)(reg_linear_accel_xyz.y/LINEAR_ACCEL_DIV_MSQ); + (double)(reg_linear_accel_xyz.y/BNO055_LINEAR_ACCEL_DIV_MSQ); linear_accel_xyz->z = - (double)(reg_linear_accel_xyz.z/LINEAR_ACCEL_DIV_MSQ); + (double)(reg_linear_accel_xyz.z/BNO055_LINEAR_ACCEL_DIV_MSQ); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5455,29 +5531,29 @@ struct bno055_linear_accel_double_t *linear_accel_xyz) * @brief This API is used to convert the gravity * x raw data to meterpersecseq output as double * - * @param v_gravity_x_d : The double value of gravity x meterpersecseq + * @param gravity_x_d : The double value of gravity x meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_gravity_double_x_msq( -double *v_gravity_x_d) +double *gravity_x_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gravity_x_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gravity_x_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; /* Read raw gravity of x*/ - com_rslt = bno055_read_gravity_x(&v_reg_gravity_x_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_gravity_x(®_gravity_x_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw gravity of x to m/s2 */ - v_data_d = - (double)(v_reg_gravity_x_s16/GRAVITY_DIV_MSQ); - *v_gravity_x_d = v_data_d; + data_d = + (double)(reg_gravity_x_s16/BNO055_GRAVITY_DIV_MSQ); + *gravity_x_d = data_d; } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } return com_rslt; } @@ -5485,29 +5561,29 @@ double *v_gravity_x_d) * @brief This API is used to convert the gravity * y raw data to meterpersecseq output as double * - * @param v_gravity_y_d : The double value of gravity y meterpersecseq + * @param gravity_y_d : The double value of gravity y meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_gravity_double_y_msq( -double *v_gravity_y_d) +double *gravity_y_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gravity_y_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gravity_y_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; /* Read raw gravity of y */ - com_rslt = bno055_read_gravity_y(&v_reg_gravity_y_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_gravity_y(®_gravity_y_s16); + if (com_rslt == BNO055_SUCCESS) { /* convert raw gravity of y to m/s2 */ - v_data_d = - (double)(v_reg_gravity_y_s16/GRAVITY_DIV_MSQ); - *v_gravity_y_d = v_data_d; + data_d = + (double)(reg_gravity_y_s16/BNO055_GRAVITY_DIV_MSQ); + *gravity_y_d = data_d; } else { - com_rslt += ERROR; + com_rslt += BNO055_ERROR; } return com_rslt; } @@ -5515,29 +5591,29 @@ double *v_gravity_y_d) * @brief This API is used to convert the gravity * z raw data to meterpersecseq output as double * - * @param v_gravity_z_d : The double value of gravity z meterpersecseq + * @param gravity_z_d : The double value of gravity z meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_gravity_double_z_msq( -double *v_gravity_z_d) +double *gravity_z_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s16 v_reg_gravity_z_s16 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s16 reg_gravity_z_s16 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; /* Read raw gravity of z */ - com_rslt = bno055_read_gravity_z(&v_reg_gravity_z_s16); - if (com_rslt == SUCCESS) { + com_rslt = bno055_read_gravity_z(®_gravity_z_s16); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw gravity of z to m/s2 */ - v_data_d = - (double)(v_reg_gravity_z_s16/GRAVITY_DIV_MSQ); - *v_gravity_z_d = v_data_d; + data_d = + (double)(reg_gravity_z_s16/BNO055_GRAVITY_DIV_MSQ); + *gravity_z_d = data_d; } else { - com_rslt += ERROR; + com_rslt += BNO055_ERROR; } return com_rslt; } @@ -5555,8 +5631,8 @@ double *v_gravity_z_d) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gravity_xyz_msq( @@ -5564,21 +5640,21 @@ struct bno055_gravity_double_t *gravity_xyz) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; struct bno055_gravity_t reg_gravity_xyz = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, BNO055_ZERO_U8X}; + BNO055_INIT_VALUE, BNO055_INIT_VALUE, BNO055_INIT_VALUE}; /* Read raw gravity of xyz */ com_rslt = bno055_read_gravity_xyz(®_gravity_xyz); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { /* Convert raw gravity of xyz to m/s2 */ gravity_xyz->x = - (double)(reg_gravity_xyz.x/GRAVITY_DIV_MSQ); + (double)(reg_gravity_xyz.x/BNO055_GRAVITY_DIV_MSQ); gravity_xyz->y = - (double)(reg_gravity_xyz.y/GRAVITY_DIV_MSQ); + (double)(reg_gravity_xyz.y/BNO055_GRAVITY_DIV_MSQ); gravity_xyz->z = - (double)(reg_gravity_xyz.z/GRAVITY_DIV_MSQ); + (double)(reg_gravity_xyz.z/BNO055_GRAVITY_DIV_MSQ); } else { - com_rslt += ERROR; + com_rslt += BNO055_ERROR; } return com_rslt; } @@ -5586,39 +5662,39 @@ struct bno055_gravity_double_t *gravity_xyz) * @brief This API is used to convert the temperature * data to Fahrenheit output as double * - * @param v_temp_d : The double value of temperature Fahrenheit + * @param temp_d : The double value of temperature Fahrenheit * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_temp_fahrenheit( -double *v_temp_d) +double *temp_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s8 v_reg_temp_s8 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_temp_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s8 reg_temp_s8 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 temp_unit_u8 = BNO055_INIT_VALUE; /* Read the current temperature unit and set the unit as Fahrenheit if the unit is in Celsius */ - com_rslt = bno055_get_temp_unit(&v_temp_unit_u8); - if (v_temp_unit_u8 != TEMP_UNIT_FAHRENHEIT) - com_rslt += bno055_set_temp_unit(TEMP_UNIT_FAHRENHEIT); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_temp_unit(&temp_unit_u8); + if (temp_unit_u8 != BNO055_TEMP_UNIT_FAHRENHEIT) + com_rslt += bno055_set_temp_unit(BNO055_TEMP_UNIT_FAHRENHEIT); + if (com_rslt == BNO055_SUCCESS) { /* Read the raw temperature data */ - com_rslt += bno055_read_temp_data(&v_reg_temp_s8); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_temp_data(®_temp_s8); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw temperature data to Fahrenheit*/ - v_data_d = - (double)(v_reg_temp_s8/TEMP_DIV_FAHRENHEIT); - *v_temp_d = v_data_d; + data_d = (double)(reg_temp_s8/ + BNO055_TEMP_DIV_FAHRENHEIT); + *temp_d = data_d; } else { - com_rslt += ERROR; + com_rslt += BNO055_ERROR; } } else { - com_rslt += ERROR; + com_rslt += BNO055_ERROR; } return com_rslt; } @@ -5626,39 +5702,39 @@ double *v_temp_d) * @brief This API is used to convert the temperature * data to Celsius output as double * - * @param v_temp_d : The double value of temperature Celsius + * @param temp_d : The double value of temperature Celsius * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_temp_celsius( -double *v_temp_d) +double *temp_d) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - s8 v_reg_temp_s8 = BNO055_ZERO_U8X; - double v_data_d = BNO055_ZERO_U8X; - u8 v_temp_unit_u8 = BNO055_ZERO_U8X; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + s8 reg_temp_s8 = BNO055_INIT_VALUE; + double data_d = BNO055_INIT_VALUE; + u8 temp_unit_u8 = BNO055_INIT_VALUE; /* Read the current temperature unit and set the unit as Fahrenheit if the unit is in Celsius */ - com_rslt = bno055_get_temp_unit(&v_temp_unit_u8); - if (v_temp_unit_u8 != TEMP_UNIT_CELSIUS) - com_rslt += bno055_set_temp_unit(TEMP_UNIT_CELSIUS); - if (com_rslt == SUCCESS) { + com_rslt = bno055_get_temp_unit(&temp_unit_u8); + if (temp_unit_u8 != BNO055_TEMP_UNIT_CELSIUS) + com_rslt += bno055_set_temp_unit(BNO055_TEMP_UNIT_CELSIUS); + if (com_rslt == BNO055_SUCCESS) { /* Read the raw temperature data */ - com_rslt += bno055_read_temp_data(&v_reg_temp_s8); - if (com_rslt == SUCCESS) { + com_rslt += bno055_read_temp_data(®_temp_s8); + if (com_rslt == BNO055_SUCCESS) { /* Convert raw temperature data to Fahrenheit*/ - v_data_d = - (double)(v_reg_temp_s8/TEMP_DIV_CELSIUS); - *v_temp_d = v_data_d; + data_d = + (double)(reg_temp_s8/BNO055_TEMP_DIV_CELSIUS); + *temp_d = data_d; } else { - com_rslt += ERROR; + com_rslt += BNO055_ERROR; } } else { - com_rslt += ERROR; + com_rslt += BNO055_ERROR; } return com_rslt; } @@ -5667,43 +5743,43 @@ double *v_temp_d) * @brief This API used to read * mag calibration status from register from 0x35 bit 0 and 1 * - * @param v_mag_calib_u8 : The value of mag calib status + * @param mag_calib_u8 : The value of mag calib status * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_mag_calib_stat( -u8 *v_mag_calib_u8) +u8 *mag_calib_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, mag calib available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { - /* Read the mag calib v_stat_s8 */ + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { + /* Read the mag calib stat_s8 */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_CALIB_STAT__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_mag_calib_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_MAG_CALIB_STAT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *mag_calib_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_MAG_CALIB_STAT); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -5712,43 +5788,43 @@ u8 *v_mag_calib_u8) * @brief This API used to read * accel calibration status from register from 0x35 bit 2 and 3 * - * @param v_accel_calib_u8 : The value of accel calib status + * @param accel_calib_u8 : The value of accel calib status * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_calib_stat( -u8 *v_accel_calib_u8) +u8 *accel_calib_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty*/ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel calib available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { - /* Read the accel calib v_stat_s8 */ + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { + /* Read the accel calib stat_s8 */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_CALIB_STAT__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_calib_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_CALIB_STAT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_calib_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_CALIB_STAT); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -5757,43 +5833,43 @@ u8 *v_accel_calib_u8) * @brief This API used to read * gyro calibration status from register from 0x35 bit 4 and 5 * - * @param v_gyro_calib_u8 : The value of gyro calib status + * @param gyro_calib_u8 : The value of gyro calib status * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_calib_stat( -u8 *v_gyro_calib_u8) +u8 *gyro_calib_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro calib available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the gyro calib status */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_CALIB_STAT__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_calib_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_CALIB_STAT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_calib_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_CALIB_STAT); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -5802,42 +5878,42 @@ u8 *v_gyro_calib_u8) * @brief This API used to read * system calibration status from register from 0x35 bit 6 and 7 * - * @param v_sys_calib_u8 : The value of system calib status + * @param sys_calib_u8 : The value of system calib status * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_sys_calib_stat( -u8 *v_sys_calib_u8) +u8 *sys_calib_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty*/ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page,system calib available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the system calib */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SYS_CALIB_STAT__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_sys_calib_u8 = - BNO055_GET_BITSLICE(v_data_u8r, BNO055_SYS_CALIB_STAT); + BNO055_SYS_CALIB_STAT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *sys_calib_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_SYS_CALIB_STAT); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -5846,47 +5922,47 @@ u8 *v_sys_calib_u8) * @brief This API used to read * self test of accel from register from 0x36 bit 0 * - * @param v_selftest_accel_u8 : The value of self test of accel + * @param selftest_accel_u8 : The value of self test of accel * - * v_selftest_accel_u8 | result + * selftest_accel_u8 | result * -------------------- | --------------------- * 0x00 | indicates test failed * 0x01 | indicated test passed * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_selftest_accel( -u8 *v_selftest_accel_u8) +u8 *selftest_accel_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel self test is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the accel self test */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SELFTEST_ACCEL__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_selftest_accel_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_SELFTEST_ACCEL_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *selftest_accel_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_SELFTEST_ACCEL); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -5895,45 +5971,46 @@ u8 *v_selftest_accel_u8) * @brief This API used to read * self test of mag from register from 0x36 bit 1 * - * @param v_selftest_mag_u8 : The value of self test of mag + * @param selftest_mag_u8 : The value of self test of mag * - * v_selftest_mag_u8 | result + * selftest_mag_u8 | result * -------------------- | --------------------- * 0x00 | indicates test failed * 0x01 | indicated test passed * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_selftest_mag( -u8 *v_selftest_mag_u8) +u8 *selftest_mag_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, self test of mag is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the mag self test */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SELFTEST_MAG__REG, &v_data_u8r, BNO055_ONE_U8X); - *v_selftest_mag_u8 = - BNO055_GET_BITSLICE(v_data_u8r, BNO055_SELFTEST_MAG); + BNO055_SELFTEST_MAG_REG, &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + *selftest_mag_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_SELFTEST_MAG); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -5942,45 +6019,46 @@ u8 *v_selftest_mag_u8) * @brief This API used to read * self test of gyro from register from 0x36 bit 2 * - * @param v_selftest_gyro_u8 : The value of self test of gyro + * @param selftest_gyro_u8 : The value of self test of gyro * - * v_selftest_gyro_u8 | result + * selftest_gyro_u8 | result * -------------------- | --------------------- * 0x00 | indicates test failed * 0x01 | indicated test passed * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_selftest_gyro( -u8 *v_selftest_gyro_u8) +u8 *selftest_gyro_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page self test of gyro is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the gyro self test */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SELFTEST_GYRO__REG, &v_data_u8r, BNO055_ONE_U8X); - *v_selftest_gyro_u8 = - BNO055_GET_BITSLICE(v_data_u8r, BNO055_SELFTEST_GYRO); + BNO055_SELFTEST_GYRO_REG, &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + *selftest_gyro_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_SELFTEST_GYRO); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -5989,65 +6067,66 @@ u8 *v_selftest_gyro_u8) * @brief This API used to read * self test of micro controller from register from 0x36 bit 3 * - * @param v_selftest_mcu_u8 : The value of self test of micro controller + * @param selftest_mcu_u8 : The value of self test of micro controller * - * v_selftest_mcu_u8 | result + * selftest_mcu_u8 | result * -------------------- | --------------------- * 0x00 | indicates test failed * 0x01 | indicated test passed * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_selftest_mcu( -u8 *v_selftest_mcu_u8) +u8 *selftest_mcu_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page self test of micro controller is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the self test of micro controller*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SELFTEST_MCU__REG, &v_data_u8r, BNO055_ONE_U8X); - *v_selftest_mcu_u8 = - BNO055_GET_BITSLICE(v_data_u8r, BNO055_SELFTEST_MCU); + BNO055_SELFTEST_MCU_REG, &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + *selftest_mcu_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_SELFTEST_MCU); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; } /*! - * @brief This API used to read the v_stat_s8 of + * @brief This API used to read the stat_s8 of * gyro anymotion interrupt from register from 0x37 bit 2 * - * @param v_gyro_any_motion_u8 : The value of gyro anymotion interrupt + * @param gyro_any_motion_u8 : The value of gyro anymotion interrupt * - * v_gyro_any_motion_u8 | result + * gyro_any_motion_u8 | result * -------------------- | --------------------- * 0x00 | indicates no interrupt triggered * 0x01 | indicates interrupt triggered * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * - * @note Gyro anymotion interrupt can be enabled + * @note Gyro anymotion interrupt can be BNO055_BIT_ENABLE * by the following APIs * * bno055_set_intr_mask_gyro_any_motion() @@ -6056,52 +6135,52 @@ u8 *v_selftest_mcu_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_stat_gyro_any_motion( -u8 *v_gyro_any_motion_u8) +u8 *gyro_any_motion_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro anymotion interrupt status is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { - /* Read the gyro anymotion interrupt v_stat_s8*/ + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { + /* Read the gyro anymotion interrupt stat_s8*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_INTR_STAT_GYRO_ANY_MOTION__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_any_motion_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_INTR_STAT_GYRO_ANY_MOTION_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_any_motion_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_INTR_STAT_GYRO_ANY_MOTION); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; } /*! - * @brief This API used to read the v_stat_s8 of + * @brief This API used to read the stat_s8 of * gyro highrate interrupt from register from 0x37 bit 3 * - * @param v_gyro_highrate_u8 : The value of gyro highrate interrupt + * @param gyro_highrate_u8 : The value of gyro highrate interrupt * - * v_gyro_highrate_u8 | result + * gyro_highrate_u8 | result * ------------------- | --------------------- * 0x00 | indicates no interrupt triggered * 0x01 | indicates interrupt triggered * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate interrupt can be configured * by the following APIs @@ -6111,52 +6190,52 @@ u8 *v_gyro_any_motion_u8) * bno055_set_intr_gyro_highrate() */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_stat_gyro_highrate( -u8 *v_gyro_highrate_u8) +u8 *gyro_highrate_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { - /* Read the gyro highrate interrupt v_stat_s8*/ + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { + /* Read the gyro highrate interrupt stat_s8*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_INTR_STAT_GYRO_HIGHRATE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_INTR_STAT_GYRO_HIGHRATE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_INTR_STAT_GYRO_HIGHRATE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; } /*! - * @brief This API used to read the v_stat_s8 of + * @brief This API used to read the stat_s8 of * accel highg interrupt from register from 0x37 bit 5 * - * @param v_accel_high_g_u8 : The value of accel highg interrupt + * @param accel_high_g_u8 : The value of accel highg interrupt * - * v_accel_high_g_u8 | result + * accel_high_g_u8 | result * ------------------- | --------------------- * 0x00 | indicates no interrupt triggered * 0x01 | indicates interrupt triggered * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel highg interrupt can be configured * by the following APIs @@ -6167,52 +6246,52 @@ u8 *v_gyro_highrate_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_stat_accel_high_g( -u8 *v_accel_high_g_u8) +u8 *accel_high_g_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel highg is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { - /* Read the accel highg interrupt v_stat_s8 */ + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { + /* Read the accel highg interrupt stat_s8 */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_INTR_STAT_ACCEL_HIGH_G__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_high_g_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_INTR_STAT_ACCEL_HIGH_G_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_high_g_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_INTR_STAT_ACCEL_HIGH_G); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; } /*! - * @brief This API used to read the v_stat_s8 of + * @brief This API used to read the stat_s8 of * accel anymotion interrupt from register from 0x37 bit 6 * - * @param v_accel_any_motion_u8 : The value of accel anymotion interrupt + * @param accel_any_motion_u8 : The value of accel anymotion interrupt * - * v_accel_any_motion_u8 | result + * accel_any_motion_u8 | result * ------------------- | --------------------- * 0x00 | indicates no interrupt triggered * 0x01 | indicates interrupt triggered * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel anymotion interrupt can be configured * by the following APIs @@ -6222,53 +6301,53 @@ u8 *v_accel_high_g_u8) * bno055_set_intr_accel_any_motion() */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_stat_accel_any_motion( -u8 *v_accel_any_motion_u8) +u8 *accel_any_motion_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel anymotion is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { - /* Read the accel anymotion interrupt v_stat_s8 */ + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { + /* Read the accel anymotion interrupt stat_s8 */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_INTR_STAT_ACCEL_ANY_MOTION__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_any_motion_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_INTR_STAT_ACCEL_ANY_MOTION_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_any_motion_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_INTR_STAT_ACCEL_ANY_MOTION); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; } /*! - * @brief This API used to read the v_stat_s8 of + * @brief This API used to read the stat_s8 of * accel nomotion/slowmotion interrupt from register from 0x37 bit 6 * - * @param v_accel_no_motion_u8 : The value of accel + * @param accel_no_motion_u8 : The value of accel * nomotion/slowmotion interrupt * - * v_accel_no_motion_u8 | result + * accel_no_motion_u8 | result * ------------------- | --------------------- * 0x00 | indicates no interrupt triggered * 0x01 | indicates interrupt triggered * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel nomotion/slowmotion interrupt can be configured * by the following APIs @@ -6278,36 +6357,36 @@ u8 *v_accel_any_motion_u8) * bno055_set_intr_accel_nomotion() */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_stat_accel_no_motion( -u8 *v_accel_no_motion_u8) +u8 *accel_no_motion_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel nomotion/slowmotion interrupt is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { - /* Read the v_stat_s8 of accel + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { + /* Read the stat_s8 of accel nomotion/slowmotion interrupt*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_INTR_STAT_ACCEL_NO_MOTION__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_no_motion_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_INTR_STAT_ACCEL_NO_MOTION_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_no_motion_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_INTR_STAT_ACCEL_NO_MOTION); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -6316,42 +6395,42 @@ u8 *v_accel_no_motion_u8) * @brief This API is used to read status of main clock * from the register 0x38 bit 0 * - * @param v_stat_main_clk_u8 : the status of main clock + * @param stat_main_clk_u8 : the status of main clock * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_stat_main_clk( -u8 *v_stat_main_clk_u8) +u8 *stat_main_clk_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, status of main clk is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the status of main clk */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SYS_MAIN_CLK__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_stat_main_clk_u8 = - BNO055_GET_BITSLICE(v_data_u8r, BNO055_SYS_MAIN_CLK); + BNO055_SYS_MAIN_CLK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *stat_main_clk_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_SYS_MAIN_CLK); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -6360,89 +6439,89 @@ u8 *v_stat_main_clk_u8) * @brief This API is used to read system status * code from the register 0x39 it is a byte of data * - * @param v_sys_stat_u8 : the status of system + * @param sys_stat_u8 : the status of system * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_sys_stat_code( -u8 *v_sys_stat_u8) +u8 *sys_stat_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, the status of system is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the the status of system*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SYS_STAT_CODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_sys_stat_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_SYS_STAT_CODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *sys_stat_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_SYS_STAT_CODE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; } /*! - * @brief This API is used to read system error + * @brief This API is used to read system BNO055_ERROR * code from the register 0x3A it is a byte of data * - * @param v_sys_error_u8 : The value of system error code + * @param sys_error_u8 : The value of system BNO055_ERROR code * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_sys_error_code( -u8 *v_sys_error_u8) +u8 *sys_error_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { - /*condition check for page, system error code is + /*condition check for page, system BNO055_ERROR code is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { - /* Read the system error code*/ + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { + /* Read the system BNO055_ERROR code*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SYS_ERROR_CODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_sys_error_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_SYS_ERROR_CODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *sys_error_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_SYS_ERROR_CODE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -6451,46 +6530,46 @@ u8 *v_sys_error_u8) * @brief This API used to read the accel unit * from register from 0x3B bit 0 * - * @param v_accel_unit_u8 : The value of accel unit + * @param accel_unit_u8 : The value of accel unit * - * v_accel_unit_u8 | result + * accel_unit_u8 | result * ------------- | --------------- - * 0x00 | ACCEL_UNIT_MSQ - * 0x01 | ACCEL_UNIT_MG + * 0x00 | BNO055_ACCEL_UNIT_MSQ + * 0x01 | BNO055_ACCEL_UNIT_MG * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_unit( -u8 *v_accel_unit_u8) +u8 *accel_unit_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel unit is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the accel unit */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_unit_u8 = - BNO055_GET_BITSLICE(v_data_u8r, BNO055_ACCEL_UNIT); + BNO055_ACCEL_UNIT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_unit_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_UNIT); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -6499,113 +6578,114 @@ u8 *v_accel_unit_u8) * @brief This API used to write the accel unit * from register from 0x3B bit 0 * - * @param v_accel_unit_u8 : The value of accel unit + * @param accel_unit_u8 : The value of accel unit * - * v_accel_unit_u8 | result + * accel_unit_u8 | result * ------------- | --------------- - * 0x00 | ACCEL_UNIT_MSQ - * 0x01 | ACCEL_UNIT_MG + * 0x00 | BNO055_ACCEL_UNIT_MSQ + * 0x01 | BNO055_ACCEL_UNIT_MG * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_unit( -u8 v_accel_unit_u8) +u8 accel_unit_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write the accel unit */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, - BNO055_ACCEL_UNIT, v_accel_unit_u8); + BNO055_ACCEL_UNIT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, + BNO055_ACCEL_UNIT, accel_unit_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_UNIT_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the gyro unit * from register from 0x3B bit 1 * - * @param v_gyro_unit_u8 : The value of accel unit + * @param gyro_unit_u8 : The value of accel unit * - * v_gyro_unit_u8 | result + * gyro_unit_u8 | result * ------------- | ----------- - * 0x00 | GYRO_UNIT_DPS - * 0x01 | GYRO_UNIT_RPS + * 0x00 | BNO055_GYRO_UNIT_DPS + * 0x01 | BNO055_GYRO_UNIT_RPS * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_unit( -u8 *v_gyro_unit_u8) +u8 *gyro_unit_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro unit is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the gyro unit */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_unit_u8 = - BNO055_GET_BITSLICE(v_data_u8r, BNO055_GYRO_UNIT); + BNO055_GYRO_UNIT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_unit_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_UNIT); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -6614,113 +6694,114 @@ u8 *v_gyro_unit_u8) * @brief This API used to write the gyro unit * from register from 0x3B bit 1 * - * @param v_gyro_unit_u8 : The value of accel unit + * @param gyro_unit_u8 : The value of accel unit * - * v_gyro_unit_u8 | result + * gyro_unit_u8 | result * ------------- | ----------- - * 0x00 | GYRO_UNIT_DPS - * 0x01 | GYRO_UNIT_RPS + * 0x00 | BNO055_GYRO_UNIT_DPS + * 0x01 | BNO055_GYRO_UNIT_RPS * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_unit(u8 v_gyro_unit_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_unit(u8 gyro_unit_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write the gyro unit */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, - BNO055_GYRO_UNIT, v_gyro_unit_u8); + BNO055_GYRO_UNIT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, + BNO055_GYRO_UNIT, gyro_unit_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_UNIT_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the Euler unit * from register from 0x3B bit 2 * - * @param v_euler_unit_u8 : The value of accel unit + * @param euler_unit_u8 : The value of accel unit * - * v_euler_unit_u8 | result + * euler_unit_u8 | result * -------------- | ----------- - * 0x00 | EULER_UNIT_DEG - * 0x01 | EULER_UNIT_RAD + * 0x00 | BNO055_EULER_UNIT_DEG + * 0x01 | BNO055_EULER_UNIT_RAD * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_euler_unit( -u8 *v_euler_unit_u8) +u8 *euler_unit_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, Euler unit is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the Euler unit */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_EULER_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_euler_unit_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_EULER_UNIT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *euler_unit_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_EULER_UNIT); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -6729,111 +6810,112 @@ u8 *v_euler_unit_u8) * @brief This API used to write the Euler unit * from register from 0x3B bit 2 * - * @param v_euler_unit_u8 : The value of Euler unit + * @param euler_unit_u8 : The value of Euler unit * - * v_euler_unit_u8 | result + * euler_unit_u8 | result * -------------- | ----------- - * 0x00 | EULER_UNIT_DEG - * 0x01 | EULER_UNIT_RAD + * 0x00 | BNO055_EULER_UNIT_DEG + * 0x01 | BNO055_EULER_UNIT_RAD * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_euler_unit(u8 v_euler_unit_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_set_euler_unit(u8 euler_unit_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write the Euler unit*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_EULER_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, - BNO055_EULER_UNIT, v_euler_unit_u8); + BNO055_EULER_UNIT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, + BNO055_EULER_UNIT, euler_unit_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_EULER_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_EULER_UNIT_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to write the tilt unit * from register from 0x3B bit 3 * - * @param v_tilt_unit_u8 : The value of tilt unit + * @param tilt_unit_u8 : The value of tilt unit * - * v_tilt_unit_u8 | result + * tilt_unit_u8 | result * --------------- | --------- * 0x00 | degrees * 0x01 | radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_tilt_unit( -u8 *v_tilt_unit_u8) +u8 *tilt_unit_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, chip id is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_TILT_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_tilt_unit_u8 = - BNO055_GET_BITSLICE(v_data_u8r, BNO055_TILT_UNIT); + BNO055_TILT_UNIT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *tilt_unit_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_TILT_UNIT); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -6842,16 +6924,16 @@ u8 *v_tilt_unit_u8) * @brief This API used to write the tilt unit * from register from 0x3B bit 3 * - * @param v_tilt_unit_u8 : The value of tilt unit + * @param tilt_unit_u8 : The value of tilt unit * - * v_tilt_unit_u8 | result + * tilt_unit_u8 | result * --------------- | --------- * 0x00 | degrees * 0x01 | radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * @@ -6859,98 +6941,99 @@ u8 *v_tilt_unit_u8) * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_tilt_unit(u8 v_tilt_unit_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_set_tilt_unit(u8 tilt_unit_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_TILT_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, - BNO055_TILT_UNIT, v_tilt_unit_u8); + BNO055_TILT_UNIT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, + BNO055_TILT_UNIT, tilt_unit_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_TILT_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_TILT_UNIT_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the temperature unit * from register from 0x3B bit 4 * - * @param v_temp_unit_u8 : The value of temperature unit + * @param temp_unit_u8 : The value of temperature unit * - * v_temp_unit_u8 | result + * temp_unit_u8 | result * ----------- | -------------- - * 0x00 | TEMP_UNIT_CELCIUS - * 0x01 | TEMP_UNIT_FAHRENHEIT + * 0x00 | BNO055_TEMP_UNIT_CELSIUS + * 0x01 | BNO055_TEMP_UNIT_FAHRENHEIT * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_temp_unit( -u8 *v_temp_unit_u8) +u8 *temp_unit_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, temperature unit is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the temperature unit */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_TEMP_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_temp_unit_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_TEMP_UNIT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *temp_unit_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_TEMP_UNIT); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -6959,114 +7042,115 @@ u8 *v_temp_unit_u8) * @brief This API used to write the temperature unit * from register from 0x3B bit 4 * - * @param v_temp_unit_u8 : The value of temperature unit + * @param temp_unit_u8 : The value of temperature unit * - * v_temp_unit_u8 | result + * temp_unit_u8 | result * ----------- | -------------- - * 0x00 | TEMP_UNIT_CELCIUS - * 0x01 | TEMP_UNIT_FAHRENHEIT + * 0x00 | BNO055_TEMP_UNIT_CELSIUS + * 0x01 | BNO055_TEMP_UNIT_FAHRENHEIT * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_temp_unit( -u8 v_temp_unit_u8) +u8 temp_unit_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write the temperature unit */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_TEMP_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_TEMP_UNIT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_TEMP_UNIT, - v_temp_unit_u8); + temp_unit_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_TEMP_UNIT__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_TEMP_UNIT_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the current selected orientation mode * from register from 0x3B bit 7 * - * @param v_data_output_format_u8 : The value of data output format + * @param data_output_format_u8 : The value of data output format * - * v_data_output_format_u8 | result + * data_output_format_u8 | result * -------------------- | -------- * 0x00 | Windows * 0x01 | Android * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_data_output_format( -u8 *v_data_output_format_u8) +u8 *data_output_format_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, data output format is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the data output format */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_DATA_OUTPUT_FORMAT__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_output_format_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_DATA_OUTPUT_FORMAT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_output_format_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_DATA_OUTPUT_FORMAT); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -7075,101 +7159,102 @@ u8 *v_data_output_format_u8) * @brief This API used to write the current selected orientation mode * from register from 0x3B bit 7 * - * @param v_data_output_format_u8 : The value of data output format + * @param data_output_format_u8 : The value of data output format * - * v_data_output_format_u8 | result + * data_output_format_u8 | result * -------------------- | -------- * 0x00 | Windows * 0x01 | Android * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_data_output_format( -u8 v_data_output_format_u8) +u8 data_output_format_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write the data output format */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_DATA_OUTPUT_FORMAT__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_DATA_OUTPUT_FORMAT_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_DATA_OUTPUT_FORMAT, - v_data_output_format_u8); + data_output_format_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_DATA_OUTPUT_FORMAT__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_DATA_OUTPUT_FORMAT_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! @brief This API used to read the operation mode * from register from 0x3D bit 0 to 3 * - * @param v_operation_mode_u8 : The value of operation mode + * @param operation_mode_u8 : The value of operation mode * - * v_operation_mode_u8 | result | comments + * operation_mode_u8 | result | comments * ----------|----------------------------|---------------------------- - * 0x00 | OPERATION_MODE_CONFIG | Configuration mode - * 0x01 | OPERATION_MODE_ACCONLY | Reads accel data alone - * 0x02 | OPERATION_MODE_MAGONLY | Reads mag data alone - * 0x03 | OPERATION_MODE_GYRONLY | Reads gyro data alone - * 0x04 | OPERATION_MODE_ACCMAG | Reads accel and mag data - * 0x05 | OPERATION_MODE_ACCGYRO | Reads accel and gyro data - * 0x06 | OPERATION_MODE_MAGGYRO | Reads accel and mag data + * 0x00 | BNO055_OPERATION_MODE_CONFIG | Configuration mode + * 0x01 | BNO055_OPERATION_MODE_ACCONLY | Reads accel data alone + * 0x02 | BNO055_OPERATION_MODE_MAGONLY | Reads mag data alone + * 0x03 | BNO055_OPERATION_MODE_GYRONLY | Reads gyro data alone + * 0x04 | BNO055_OPERATION_MODE_ACCMAG | Reads accel and mag data + * 0x05 | BNO055_OPERATION_MODE_ACCGYRO | Reads accel and gyro data + * 0x06 | BNO055_OPERATION_MODE_MAGGYRO | Reads accel and mag data * 0x07 | OPERATION_MODE_ANY_MOTION | Reads accel mag and gyro data - * 0x08 | OPERATION_MODE_IMUPLUS | Inertial measurement unit + * 0x08 | BNO055_OPERATION_MODE_IMUPLUS | Inertial measurement unit * - | - | Reads accel,gyro and fusion data - * 0x09 | OPERATION_MODE_COMPASS | Reads accel, mag data + * 0x09 | BNO055_OPERATION_MODE_COMPASS | Reads accel, mag data * - | - | and fusion data - * 0x0A | OPERATION_MODE_M4G | Reads accel, mag data + * 0x0A | BNO055_OPERATION_MODE_M4G | Reads accel, mag data * - | - | and fusion data - * 0x0B | OPERATION_MODE_NDOF_FMC_OFF| Nine degrees of freedom with + * 0x0B | BNO055_OPERATION_MODE_NDOF_FMC_OFF| Nine degrees of freedom with * - | - | fast magnetic calibration * - | - | Reads accel,mag, gyro * - | - | and fusion data - * 0x0C | OPERATION_MODE_NDOF | Nine degrees of freedom + * 0x0C | BNO055_OPERATION_MODE_NDOF | Nine degrees of freedom * - | - | Reads accel,mag, gyro * - | - | and fusion data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note In the config mode, all sensor and fusion data * becomes zero and it is mainly derived @@ -7177,34 +7262,34 @@ if (p_bno055 == BNO055_ZERO_U8X) { * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_operation_mode( -u8 *v_operation_mode_u8) +u8 *operation_mode_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, operation mode is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the value of operation mode*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_OPERATION_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_operation_mode_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_OPERATION_MODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *operation_mode_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_OPERATION_MODE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -7212,78 +7297,81 @@ u8 *v_operation_mode_u8) /*! @brief This API used to write the operation mode * from register from 0x3D bit 0 to 3 * - * @param v_operation_mode_u8 : The value of operation mode - * - * v_operation_mode_u8 | result | comments - * ----------|----------------------------|---------------------------- - * 0x00 | OPERATION_MODE_CONFIG | Configuration mode - * 0x01 | OPERATION_MODE_ACCONLY | Reads accel data alone - * 0x02 | OPERATION_MODE_MAGONLY | Reads mag data alone - * 0x03 | OPERATION_MODE_GYRONLY | Reads gyro data alone - * 0x04 | OPERATION_MODE_ACCMAG | Reads accel and mag data - * 0x05 | OPERATION_MODE_ACCGYRO | Reads accel and gyro data - * 0x06 | OPERATION_MODE_MAGGYRO | Reads accel and mag data - * 0x07 | OPERATION_MODE_ANY_MOTION | Reads accel mag and gyro data - * 0x08 | OPERATION_MODE_IMUPLUS | Inertial measurement unit - * - | - | Reads accel,gyro and fusion data - * 0x09 | OPERATION_MODE_COMPASS | Reads accel, mag data - * - | - | and fusion data - * 0x0A | OPERATION_MODE_M4G | Reads accel, mag data - * - | - | and fusion data - * 0x0B | OPERATION_MODE_NDOF_FMC_OFF| Nine degrees of freedom with - * - | - | fast magnetic calibration - * - | - | Reads accel,mag, gyro - * - | - | and fusion data - * 0x0C | OPERATION_MODE_NDOF | Nine degrees of freedom - * - | - | Reads accel,mag, gyro - * - | - | and fusion data - * - * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @param operation_mode_u8 : The value of operation mode + * + * operation_mode_u8 | result | comments + * ---------|-----------------------------------|-------------------------- + * 0x00 | BNO055_OPERATION_MODE_CONFIG | Configuration mode + * 0x01 | BNO055_OPERATION_MODE_ACCONLY | Reads accel data alone + * 0x02 | BNO055_OPERATION_MODE_MAGONLY | Reads mag data alone + * 0x03 | BNO055_OPERATION_MODE_GYRONLY | Reads gyro data alone + * 0x04 | BNO055_OPERATION_MODE_ACCMAG | Reads accel and mag data + * 0x05 | BNO055_OPERATION_MODE_ACCGYRO | Reads accel and gyro data + * 0x06 | BNO055_OPERATION_MODE_MAGGYRO | Reads accel and mag data + * 0x07 | OPERATION_MODE_ANY_MOTION | Reads accel mag and + * | - | gyro data + * 0x08 | BNO055_OPERATION_MODE_IMUPLUS | Inertial measurement unit + * - | | Reads accel,gyro and + * | - | fusion data + * 0x09 | BNO055_OPERATION_MODE_COMPASS | Reads accel, mag data + * - | - | and fusion data + * 0x0A | BNO055_OPERATION_MODE_M4G | Reads accel, mag data + * - | - | and fusion data + * 0x0B | BNO055_OPERATION_MODE_NDOF_FMC_OFF| Nine degrees of freedom with + * - | - | fast magnetic calibration + * - | - | Reads accel,mag, gyro + * - | - | and fusion data + * 0x0C | BNO055_OPERATION_MODE_NDOF | Nine degrees of freedom + * - | - | Reads accel,mag, gyro + * - | - | and fusion data + * + * @return results of bus communication function + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note In the config mode, all sensor and fusion data * becomes zero and it is mainly derived * to configure the various settings of the BNO * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_operation_mode(u8 v_operation_mode_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_set_operation_mode(u8 operation_mode_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { /* If the previous operation mode is config it is directly write the operation mode */ - if (v_prev_opmode_u8 == OPERATION_MODE_CONFIG) { + if (prev_opmode_u8 == BNO055_OPERATION_MODE_CONFIG) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_OPERATION_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_OPERATION_MODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_OPERATION_MODE, - v_operation_mode_u8); + operation_mode_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_OPERATION_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_OPERATION_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); /* Config mode to other operation mode switching required delay of 600ms*/ p_bno055->delay_msec( - BNO055_SIX_HUNDRES_U8X); + BNO055_MODE_SWITCHING_DELAY); } } else { /* If the previous operation @@ -7291,48 +7379,52 @@ if (p_bno055 == BNO055_ZERO_U8X) { write the config mode */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_OPERATION_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_OPERATION_MODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_OPERATION_MODE, - OPERATION_MODE_CONFIG); + BNO055_OPERATION_MODE_CONFIG); com_rslt += bno055_write_register( - BNO055_OPERATION_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_OPERATION_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); /* other mode to config mode switching required delay of 20ms*/ - p_bno055->delay_msec(BNO055_TWENTY_U8X); + p_bno055->delay_msec( + BNO055_CONFIG_MODE_SWITCHING_DELAY); } /* Write the operation mode */ - if (v_operation_mode_u8 != - OPERATION_MODE_CONFIG) { + if (operation_mode_u8 != + BNO055_OPERATION_MODE_CONFIG) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_OPERATION_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_OPERATION_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_OPERATION_MODE, - v_operation_mode_u8); + operation_mode_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_OPERATION_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_OPERATION_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); /* Config mode to other operation mode switching required delay of 600ms*/ p_bno055->delay_msec( - BNO055_SIX_HUNDRES_U8X); + BNO055_MODE_SWITCHING_DELAY); } } } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -7340,57 +7432,58 @@ if (p_bno055 == BNO055_ZERO_U8X) { /*! @brief This API used to read the power mode * from register from 0x3E bit 0 to 1 * - * @param v_power_mode_u8 : The value of power mode + * @param power_mode_u8 : The value of power mode * - * v_power_mode_u8| result | comments - * ----------|---------------------|------------------------------------- - * 0x00 | POWER_MODE_NORMAL | In the NORMAL mode the register - * - | - | map and the internal peripherals - * - | - | of the MCU are always - * - | - | operative in this mode - * 0x01 | POWER_MODE_LOWPOWER | This is first level of power saving mode - * 0x02 | POWER_MODE_SUSPEND | In suspend mode the system is - * - | - | paused and all the sensors and - * - | - | the micro controller are - * - | - | put into sleep mode. + * power_mode_u8| result | comments + * ---------|---------------------------|------------------------------------- + * 0x00 |BNO055_POWER_MODE_NORMAL | In the NORMAL mode the register + * - | - | map and the internal peripherals + * - | - | of the MCU are always + * - | - | operative in this mode + * 0x01 |BNO055_POWER_MODE_LOWPOWER | This is first level of power + * | - | saving mode + * 0x02 |BNO055_POWER_MODE_SUSPEND | In suspend mode the system is + * - | - | paused and all the sensors and + * - | - | the micro controller are + * - | - | put into sleep mode. * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note For detailed about LOWPOWER mode * refer data sheet 3.4.2 * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_power_mode( -u8 *v_power_mode_u8) +u8 *power_mode_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, power mode is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the value of power mode */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_POWER_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_power_mode_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_POWER_MODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *power_mode_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_POWER_MODE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -7398,74 +7491,77 @@ u8 *v_power_mode_u8) /*! @brief This API used to write the power mode * from register from 0x3E bit 0 to 1 * - * @param v_power_mode_u8 : The value of power mode + * @param power_mode_u8 : The value of power mode + * * - * v_power_mode_u8 | result | comments - * ----------|---------------------|------------------------------------- - * 0x00 | POWER_MODE_NORMAL | In the NORMAL mode the register - * - | - | map and the internal peripherals - * - | - | of the MCU are always - * - | - | operative in this mode - * 0x01 | POWER_MODE_LOWPOWER | This is first level of power saving mode - * 0x02 | POWER_MODE_SUSPEND | In suspend mode the system is - * - | - | paused and all the sensors and - * - | - | the micro controller are - * - | - | put into sleep mode. + * power_mode_u8| result | comments + * -------|----------------------------|--------------------------------- + * 0x00 | BNO055_POWER_MODE_NORMAL | In the NORMAL mode the register + * - | - | map and the internal peripherals + * - | - | of the MCU are always + * - | - | operative in this mode + * 0x01 | BNO055_POWER_MODE_LOWPOWER | This is first level of power + * | - | saving mode + * 0x02 | BNO055_POWER_MODE_SUSPEND | In suspend mode the system is + * - | - | paused and all the sensors and + * - | - | the micro controller are + * - | - | put into sleep mode. * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note For detailed about LOWPOWER mode * refer data sheet 3.4.2 * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_power_mode(u8 v_power_mode_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_set_power_mode(u8 power_mode_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write the value of power mode */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_POWER_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, - BNO055_POWER_MODE, v_power_mode_u8); + BNO055_POWER_MODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, + BNO055_POWER_MODE, power_mode_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_POWER_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_POWER_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! @@ -7473,46 +7569,46 @@ if (p_bno055 == BNO055_ZERO_U8X) { * from register from 0x3F bit 6 * It resets all the interrupt bit and interrupt output * - * @param v_intr_rst_u8 : The value of reset interrupt + * @param intr_rst_u8 : The value of reset interrupt * - * v_intr_rst_u8 | result - * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * intr_rst_u8 | result + * ------------ |---------- + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_rst( -u8 *v_intr_rst_u8) +u8 *intr_rst_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, reset interrupt is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the value of reset interrupt*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_INTR_RST__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_intr_rst_u8 = - BNO055_GET_BITSLICE(v_data_u8r, BNO055_INTR_RST); + BNO055_INTR_RST_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *intr_rst_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_INTR_RST); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -7522,51 +7618,51 @@ u8 *v_intr_rst_u8) * from register from 0x3F bit 6 * It resets all the interrupt bit and interrupt output * - * @param v_intr_rst_u8 : The value of reset interrupt + * @param intr_rst_u8 : The value of reset interrupt * - * v_intr_rst_u8 | result + * intr_rst_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_rst(u8 v_intr_rst_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_rst(u8 intr_rst_u8) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, reset interrupt available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Write the value of reset interrupt */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_INTR_RST__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, - BNO055_INTR_RST, v_intr_rst_u8); + BNO055_INTR_RST_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, + BNO055_INTR_RST, intr_rst_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_INTR_RST__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_INTR_RST_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -7575,46 +7671,46 @@ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_rst(u8 v_intr_rst_u8) * @brief This API used to read the clk source * from register from 0x3F bit 7 * - * @param v_clk_src_u8 : The value of clk source + * @param clk_src_u8 : The value of clk source * - * v_clk_src_u8 | result + * clk_src_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_clk_src( -u8 *v_clk_src_u8) +u8 *clk_src_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, clk source is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the value of clk source */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_CLK_SRC__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_clk_src_u8 = - BNO055_GET_BITSLICE(v_data_u8r, BNO055_CLK_SRC); + BNO055_CLK_SRC_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *clk_src_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_CLK_SRC); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -7623,51 +7719,51 @@ u8 *v_clk_src_u8) * @brief This API used to write the clk source * from register from 0x3F bit 7 * - * @param v_clk_src_u8 : The value of clk source + * @param clk_src_u8 : The value of clk source * - * v_clk_src_u8 | result + * clk_src_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_clk_src(u8 v_clk_src_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_set_clk_src(u8 clk_src_u8) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, clk source is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Write the value of clk source */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_CLK_SRC__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, - BNO055_CLK_SRC, v_clk_src_u8); + BNO055_CLK_SRC_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, + BNO055_CLK_SRC, clk_src_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_CLK_SRC__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_CLK_SRC_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -7676,48 +7772,48 @@ BNO055_RETURN_FUNCTION_TYPE bno055_set_clk_src(u8 v_clk_src_u8) * @brief This API used to read the reset system * from register from 0x3F bit 5 * - * @param v_sys_rst_u8 : The value of reset system + * @param sys_rst_u8 : The value of reset system * - * v_sys_rst_u8 | result + * sys_rst_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note It resets the whole system */ BNO055_RETURN_FUNCTION_TYPE bno055_get_sys_rst( -u8 *v_sys_rst_u8) +u8 *sys_rst_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, reset system is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the value of reset system */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SYS_RST__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_sys_rst_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_SYS_RST_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *sys_rst_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_SYS_RST); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -7726,52 +7822,52 @@ u8 *v_sys_rst_u8) * @brief This API used to write the reset system * from register from 0x3F bit 5 * - * @param v_sys_rst_u8 : The value of reset system + * @param sys_rst_u8 : The value of reset system * - * v_sys_rst_u8 | result + * sys_rst_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note It resets the whole system */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_sys_rst(u8 v_sys_rst_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_set_sys_rst(u8 sys_rst_u8) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, reset system is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Write the value of reset system */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SYS_RST__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, - BNO055_SYS_RST, v_sys_rst_u8); + BNO055_SYS_RST_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, + BNO055_SYS_RST, sys_rst_u8); com_rslt = p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SYS_RST__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_SYS_RST_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -7780,48 +7876,48 @@ BNO055_RETURN_FUNCTION_TYPE bno055_set_sys_rst(u8 v_sys_rst_u8) * @brief This API used to read the self test * from register from 0x3F bit 0 * - * @param v_selftest_u8 : The value of self test + * @param selftest_u8 : The value of self test * - * v_selftest_u8 | result + * selftest_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note It triggers the self test */ BNO055_RETURN_FUNCTION_TYPE bno055_get_selftest( -u8 *v_selftest_u8) +u8 *selftest_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, self test is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the value of self test */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SELFTEST__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_selftest_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_SELFTEST_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *selftest_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_SELFTEST); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -7830,116 +7926,117 @@ u8 *v_selftest_u8) * @brief This API used to write the self test * from register from 0x3F bit 0 * - * @param v_selftest_u8 : The value of self test + * @param selftest_u8 : The value of self test * - * v_selftest_u8 | result + * selftest_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note It triggers the self test * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_selftest(u8 v_selftest_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_set_selftest(u8 selftest_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write the value of self test */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SELFTEST__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_SELFTEST_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_SELFTEST, - v_selftest_u8); + selftest_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SELFTEST__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_SELFTEST_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the temperature source * from register from 0x40 bit 0 and 1 * - * @param v_temp_source_u8 : The value of selected temperature source + * @param temp_source_u8 : The value of selected temperature source * - * v_temp_source_u8 | result + * temp_source_u8 | result * ---------------- |--------------- - * 0x00 | ACCEL_TEMP_EN - * 0X01 | GYRO_TEMP_EN - * 0X03 | MCU_TEMP_EN + * 0x00 | BNO055_ACCEL_TEMP_EN + * 0X01 | BNO055_GYRO_TEMP_EN + * 0X03 | BNO055_MCU_TEMP_EN * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_temp_source( -u8 *v_temp_source_u8) +u8 *temp_source_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, temperature source is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the value of temperature source */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_TEMP_SOURCE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_temp_source_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_TEMP_SOURCE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *temp_source_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_TEMP_SOURCE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -7948,87 +8045,88 @@ u8 *v_temp_source_u8) * @brief This API used to write the temperature source * from register from 0x40 bit 0 and 1 * - * @param v_temp_source_u8 : The value of selected temperature source + * @param temp_source_u8 : The value of selected temperature source * - * v_temp_source_u8 | result + * temp_source_u8 | result * ---------------- |--------------- - * 0x00 | ACCEL_TEMP_EN - * 0X01 | GYRO_TEMP_EN - * 0X03 | MCU_TEMP_EN + * 0x00 | BNO055_ACCEL_TEMP_EN + * 0X01 | BNO055_GYRO_TEMP_EN + * 0X03 | BNO055_MCU_TEMP_EN * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_temp_source(u8 v_temp_source_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_set_temp_source(u8 temp_source_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write the value of temperature source*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_TEMP_SOURCE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, - BNO055_TEMP_SOURCE, v_temp_source_u8); + BNO055_TEMP_SOURCE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, + BNO055_TEMP_SOURCE, temp_source_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_TEMP_SOURCE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_TEMP_SOURCE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the axis remap value * from register from 0x41 bit 0 and 5 * - * @param v_remap_axis_u8 : The value of axis remapping + * @param remap_axis_u8 : The value of axis remapping * - * v_remap_axis_u8 | result | comments + * remap_axis_u8 | result | comments * ------------|-------------------|------------ - * 0X21 | REMAP_X_Y | Z=Z;X=Y;Y=X - * 0X18 | REMAP_Y_Z | X=X;Y=Z;Z=Y - * 0X06 | REMAP_Z_X | Y=Y;X=Z;Z=X - * 0X12 | REMAP_X_Y_Z_TYPE0 | X=Z;Y=X;Z=Y - * 0X09 | REMAP_X_Y_Z_TYPE1 | X=Y;Y=Z;Z=X - * 0X24 | DEFAULT_AXIS | X=X;Y=Y;Z=Z + * 0X21 | BNO055_REMAP_X_Y | Z=Z;X=Y;Y=X + * 0X18 | BNO055_REMAP_Y_Z | X=X;Y=Z;Z=Y + * 0X06 | BNO055_REMAP_Z_X | Y=Y;X=Z;Z=X + * 0X12 | BNO055_REMAP_X_Y_Z_TYPE0 | X=Z;Y=X;Z=Y + * 0X09 | BNO055_REMAP_X_Y_Z_TYPE1 | X=Y;Y=Z;Z=X + * 0X24 | BNO055_DEFAULT_AXIS | X=X;Y=Y;Z=Z * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * - * @note : For axis sign remap refer the following functions + * @note : For axis sign remap refer the following APIs * x-axis : * * bno055_set_x_remap_sign() @@ -8043,34 +8141,34 @@ if (p_bno055 == BNO055_ZERO_U8X) { * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_axis_remap_value( -u8 *v_remap_axis_u8) +u8 *remap_axis_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, axis remap is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the value of axis remap*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_REMAP_AXIS_VALUE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_remap_axis_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_REMAP_AXIS_VALUE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *remap_axis_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_REMAP_AXIS_VALUE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -8079,22 +8177,22 @@ u8 *v_remap_axis_u8) * @brief This API used to write the axis remap value * from register from 0x41 bit 0 and 5 * - * @param v_remap_axis_u8 : The value of axis remapping + * @param remap_axis_u8 : The value of axis remapping * - * v_remap_axis_u8 | result | comments + * remap_axis_u8 | result | comments * ------------|-------------------|------------ - * 0X21 | REMAP_X_Y | Z=Z;X=Y;Y=X - * 0X18 | REMAP_Y_Z | X=X;Y=Z;Z=Y - * 0X06 | REMAP_Z_X | Y=Y;X=Z;Z=X - * 0X12 | REMAP_X_Y_Z_TYPE0 | X=Z;Y=X;Z=Y - * 0X09 | REMAP_X_Y_Z_TYPE1 | X=Y;Y=Z;Z=X - * 0X24 | DEFAULT_AXIS | X=X;Y=Y;Z=Z + * 0X21 | BNO055_REMAP_X_Y | Z=Z;X=Y;Y=X + * 0X18 | BNO055_REMAP_Y_Z | X=X;Y=Z;Z=Y + * 0X06 | BNO055_REMAP_Z_X | Y=Y;X=Z;Z=X + * 0X12 | BNO055_REMAP_X_Y_Z_TYPE0 | X=Z;Y=X;Z=Y + * 0X09 | BNO055_REMAP_X_Y_Z_TYPE1 | X=Y;Y=Z;Z=X + * 0X24 | BNO055_DEFAULT_AXIS | X=X;Y=Y;Z=Z * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * - * @note : For axis sign remap refer the following functions + * @note : For axis sign remap refer the following APIs * x-axis : * * bno055_set_x_remap_sign() @@ -8109,48 +8207,49 @@ u8 *v_remap_axis_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_axis_remap_value( -u8 v_remap_axis_u8) +u8 remap_axis_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); /* Write the value of axis remap */ - if (v_stat_s8 == SUCCESS) { - switch (v_remap_axis_u8) { - case REMAP_X_Y: - case REMAP_Y_Z: - case REMAP_Z_X: - case REMAP_X_Y_Z_TYPE0: - case REMAP_X_Y_Z_TYPE1: - case DEFAULT_AXIS: + if (stat_s8 == BNO055_SUCCESS) { + switch (remap_axis_u8) { + case BNO055_REMAP_X_Y: + case BNO055_REMAP_Y_Z: + case BNO055_REMAP_Z_X: + case BNO055_REMAP_X_Y_Z_TYPE0: + case BNO055_REMAP_X_Y_Z_TYPE1: + case BNO055_DEFAULT_AXIS: com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_REMAP_AXIS_VALUE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_REMAP_AXIS_VALUE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_REMAP_AXIS_VALUE, - v_remap_axis_u8); + remap_axis_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_REMAP_AXIS_VALUE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_REMAP_AXIS_VALUE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } break; default: @@ -8158,80 +8257,81 @@ if (p_bno055 == BNO055_ZERO_U8X) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_REMAP_AXIS_VALUE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_REMAP_AXIS_VALUE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_REMAP_AXIS_VALUE, - DEFAULT_AXIS); + BNO055_DEFAULT_AXIS); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_REMAP_AXIS_VALUE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_REMAP_AXIS_VALUE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } break; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the x-axis remap * sign from register from 0x42 bit 2 * - * @param v_remap_x_sign_u8 : The value of x-axis remap sign + * @param remap_x_sign_u8 : The value of x-axis remap sign * - * v_remap_x_sign_u8 | result + * remap_x_sign_u8 | result * ------------------- |-------------------- - * 0X00 | REMAP_AXIS_POSITIVE - * 0X01 | REMAP_AXIS_NEGATIVE + * 0X00 | BNO055_REMAP_AXIS_POSITIVE + * 0X01 | BNO055_REMAP_AXIS_NEGATIVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_remap_x_sign( -u8 *v_remap_x_sign_u8) +u8 *remap_x_sign_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, x-axis remap sign is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the value of x-axis remap sign */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_REMAP_X_SIGN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_remap_x_sign_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_REMAP_X_SIGN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *remap_x_sign_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_REMAP_X_SIGN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -8240,113 +8340,115 @@ u8 *v_remap_x_sign_u8) * @brief This API used to write the x-axis remap * sign from register from 0x42 bit 2 * - * @param v_remap_x_sign_u8 : The value of x-axis remap sign + * @param remap_x_sign_u8 : The value of x-axis remap sign * - * v_remap_x_sign_u8 | result + * remap_x_sign_u8 | result * ------------------- |-------------------- - * 0X00 | REMAP_AXIS_POSITIVE - * 0X01 | REMAP_AXIS_NEGATIVE + * 0X00 | BNO055_REMAP_AXIS_POSITIVE + * 0X01 | BNO055_REMAP_AXIS_NEGATIVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_remap_x_sign( -u8 v_remap_x_sign_u8) +u8 remap_x_sign_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write the value of x-axis remap */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_REMAP_X_SIGN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_REMAP_X_SIGN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_REMAP_X_SIGN, - v_remap_x_sign_u8); + remap_x_sign_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_REMAP_X_SIGN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_REMAP_X_SIGN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the y-axis remap * sign from register from 0x42 bit 1 * - * @param v_remap_y_sign_u8 : The value of y-axis remap sign + * @param remap_y_sign_u8 : The value of y-axis remap sign * - * v_remap_y_sign_u8 | result + * remap_y_sign_u8 | result * ------------------- |-------------------- - * 0X00 | REMAP_AXIS_POSITIVE - * 0X01 | REMAP_AXIS_NEGATIVE + * 0X00 | BNO055_REMAP_AXIS_POSITIVE + * 0X01 | BNO055_REMAP_AXIS_NEGATIVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_remap_y_sign( -u8 *v_remap_y_sign_u8) +u8 *remap_y_sign_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, y-axis remap sign is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the value of y-axis remap sign*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_REMAP_Y_SIGN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_remap_y_sign_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_REMAP_Y_SIGN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *remap_y_sign_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_REMAP_Y_SIGN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -8355,113 +8457,114 @@ u8 *v_remap_y_sign_u8) * @brief This API used to write the y-axis remap * sign from register from 0x42 bit 1 * - * @param v_remap_y_sign_u8 : The value of y-axis remap sign + * @param remap_y_sign_u8 : The value of y-axis remap sign * - * v_remap_y_sign_u8 | result + * remap_y_sign_u8 | result * ------------------- |-------------------- - * 0X00 | REMAP_AXIS_POSITIVE - * 0X01 | REMAP_AXIS_NEGATIVE + * 0X00 | BNO055_REMAP_AXIS_POSITIVE + * 0X01 | BNO055_REMAP_AXIS_NEGATIVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_remap_y_sign( -u8 v_remap_y_sign_u8) +u8 remap_y_sign_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write the value of y-axis remap sign*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_REMAP_Y_SIGN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_REMAP_Y_SIGN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_REMAP_Y_SIGN, - v_remap_y_sign_u8); + remap_y_sign_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_REMAP_Y_SIGN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_REMAP_Y_SIGN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the z-axis remap * sign from register from 0x42 bit 0 * - * @param v_remap_z_sign_u8 : The value of z-axis remap sign + * @param remap_z_sign_u8 : The value of z-axis remap sign * - * v_remap_z_sign_u8 | result + * remap_z_sign_u8 | result * ------------------- |-------------------- - * 0X00 | REMAP_AXIS_POSITIVE - * 0X01 | REMAP_AXIS_NEGATIVE + * 0X00 | BNO055_REMAP_AXIS_POSITIVE + * 0X01 | BNO055_REMAP_AXIS_NEGATIVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_remap_z_sign( -u8 *v_remap_z_sign_u8) +u8 *remap_z_sign_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, z-axis remap sign is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read the value of z-axis remap sign*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_REMAP_Z_SIGN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_remap_z_sign_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_REMAP_Z_SIGN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *remap_z_sign_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_REMAP_Z_SIGN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -8470,66 +8573,67 @@ u8 *v_remap_z_sign_u8) * @brief This API used to write the z-axis remap * sign from register from 0x42 bit 0 * - * @param v_remap_z_sign_u8 : The value of z-axis remap sign + * @param remap_z_sign_u8 : The value of z-axis remap sign * - * v_remap_z_sign_u8 | result + * remap_z_sign_u8 | result * ------------------- |-------------------- - * 0X00 | REMAP_AXIS_POSITIVE - * 0X01 | REMAP_AXIS_NEGATIVE + * 0X00 | BNO055_REMAP_AXIS_POSITIVE + * 0X01 | BNO055_REMAP_AXIS_NEGATIVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_remap_z_sign( -u8 v_remap_z_sign_u8) +u8 remap_z_sign_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write the value of z-axis remap sign*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_REMAP_Z_SIGN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_REMAP_Z_SIGN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_REMAP_Z_SIGN, - v_remap_z_sign_u8); + remap_z_sign_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_REMAP_Z_SIGN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_REMAP_Z_SIGN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! @@ -8552,8 +8656,8 @@ if (p_bno055 == BNO055_ZERO_U8X) { * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note : Each soft iron calibration matrix range from -32768 to +32767 */ @@ -8562,168 +8666,186 @@ struct bno055_sic_matrix_t *sic_matrix) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the soft iron calibration matrix values - v_data_u8[INDEX_ZERO] - sic_0->LSB - v_data_u8[INDEX_ONE] - sic_0->MSB - v_data_u8[INDEX_TWO] - sic_1->LSB - v_data_u8[INDEX_THREE] - sic_1->MSB - v_data_u8[INDEX_FOUR] - sic_2->LSB - v_data_u8[INDEX_FIVE] - sic_2->MSB - v_data_u8[6] - sic_3->LSB - v_data_u8[7] - sic_3->MSB - v_data_u8[8] - sic_4->LSB - v_data_u8[9] - sic_4->MSB - v_data_u8[10] - sic_5->LSB - v_data_u8[11] - sic_5->MSB - v_data_u8[12] - sic_6->LSB - v_data_u8[13] - sic_6->MSB - v_data_u8[14] - sic_7->LSB - v_data_u8[15] - sic_7->MSB - v_data_u8[16] - sic_8->LSB - v_data_u8[17] - sic_8->MSB + data_u8[BNO055_SOFT_IRON_CALIB_0_LSB] - sic_0->LSB + data_u8[BNO055_SOFT_IRON_CALIB_0_MSB] - sic_0->MSB + data_u8[BNO055_SOFT_IRON_CALIB_1_LSB] - sic_1->LSB + data_u8[BNO055_SOFT_IRON_CALIB_1_MSB] - sic_1->MSB + data_u8[BNO055_SOFT_IRON_CALIB_2_LSB] - sic_2->LSB + data_u8[BNO055_SOFT_IRON_CALIB_2_MSB] - sic_2->MSB + data_u8[BNO055_SOFT_IRON_CALIB_3_LSB] - sic_3->LSB + data_u8[BNO055_SOFT_IRON_CALIB_3_MSB] - sic_3->MSB + data_u8[BNO055_SOFT_IRON_CALIB_4_LSB] - sic_4->LSB + data_u8[BNO055_SOFT_IRON_CALIB_4_MSB] - sic_4->MSB + data_u8[BNO055_SOFT_IRON_CALIB_5_LSB] - sic_5->LSB + data_u8[BNO055_SOFT_IRON_CALIB_5_MSB] - sic_5->MSB + data_u8[BNO055_SOFT_IRON_CALIB_6_LSB] - sic_6->LSB + data_u8[BNO055_SOFT_IRON_CALIB_6_MSB] - sic_6->MSB + data_u8[BNO055_SOFT_IRON_CALIB_7_LSB] - sic_7->LSB + data_u8[BNO055_SOFT_IRON_CALIB_7_MSB] - sic_7->MSB + data_u8[BNO055_SOFT_IRON_CALIB_8_LSB] - sic_8->LSB + data_u8[BNO055_SOFT_IRON_CALIB_8_MSB] - sic_8->MSB */ - u8 v_data_u8[ARRAY_SIZE_EIGHTEEN] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_SOFT_IRON_CALIBRATION_MATRIX_SIZE] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, soft iron calibration matrix is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read soft iron calibration matrix value it is eighteen bytes of data */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_0_LSB__REG, - v_data_u8, BNO055_EIGHTEEN_U8X); - if (com_rslt == SUCCESS) { + BNO055_SIC_MATRIX_0_LSB_REG, + data_u8, BNO055_SOFT_IRON_CALIBRATION_MATRIX_SIZE); + if (com_rslt == BNO055_SUCCESS) { /*soft iron calibration matrix zero*/ - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + data_u8[BNO055_SOFT_IRON_CALIB_0_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_0_LSB], BNO055_SIC_MATRIX_0_LSB); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SOFT_IRON_CALIB_0_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_0_MSB], BNO055_SIC_MATRIX_0_MSB); sic_matrix->sic_0 = (s16)((((s32) - (s8)(v_data_u8[INDEX_ONE])) << - (BNO055_SHIFT_8_POSITION)) - | (v_data_u8[INDEX_ZERO])); + (s8)(data_u8[BNO055_SOFT_IRON_CALIB_0_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) + | (data_u8[BNO055_SOFT_IRON_CALIB_0_LSB])); /*soft iron calibration matrix one*/ - v_data_u8[INDEX_TWO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TWO], + data_u8[BNO055_SOFT_IRON_CALIB_1_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_1_LSB], BNO055_SIC_MATRIX_1_LSB); - v_data_u8[INDEX_THREE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_THREE], + data_u8[BNO055_SOFT_IRON_CALIB_1_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_1_MSB], BNO055_SIC_MATRIX_1_MSB); sic_matrix->sic_1 = (s16)((((s32) - (s8)(v_data_u8[INDEX_THREE])) << - (BNO055_SHIFT_8_POSITION)) - | (v_data_u8[INDEX_TWO])); + (s8)(data_u8[BNO055_SOFT_IRON_CALIB_1_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) + | (data_u8[BNO055_SOFT_IRON_CALIB_1_LSB])); /*soft iron calibration matrix two*/ - v_data_u8[INDEX_FOUR] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FOUR], + data_u8[BNO055_SOFT_IRON_CALIB_2_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_2_LSB], BNO055_SIC_MATRIX_2_LSB); - v_data_u8[INDEX_FIVE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FIVE], + data_u8[BNO055_SOFT_IRON_CALIB_2_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_2_MSB], BNO055_SIC_MATRIX_2_MSB); sic_matrix->sic_2 = (s16)((((s32) - (s8)(v_data_u8[INDEX_FIVE])) << - (BNO055_SHIFT_8_POSITION)) - | (v_data_u8[INDEX_FOUR])); + (s8)(data_u8[BNO055_SOFT_IRON_CALIB_2_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) + | (data_u8[BNO055_SOFT_IRON_CALIB_2_LSB])); /*soft iron calibration matrix three*/ - v_data_u8[INDEX_SIX] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_SIX], + data_u8[BNO055_SOFT_IRON_CALIB_3_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_3_LSB], BNO055_SIC_MATRIX_3_LSB); - v_data_u8[INDEX_SEVEN] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_SEVEN], + data_u8[BNO055_SOFT_IRON_CALIB_3_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_3_MSB], BNO055_SIC_MATRIX_3_LSB); sic_matrix->sic_3 = (s16)((((s32) - (s8)(v_data_u8[INDEX_SEVEN])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_SIX])); + (s8)(data_u8[BNO055_SOFT_IRON_CALIB_3_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_SOFT_IRON_CALIB_3_LSB])); /*soft iron calibration matrix four*/ - v_data_u8[INDEX_EIGHT] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_EIGHT], + data_u8[BNO055_SOFT_IRON_CALIB_4_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_4_LSB], BNO055_SIC_MATRIX_4_LSB); - v_data_u8[INDEX_NINE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_NINE], + data_u8[BNO055_SOFT_IRON_CALIB_4_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_4_MSB], BNO055_SIC_MATRIX_4_LSB); sic_matrix->sic_4 = (s16)((((s32) - (s8)(v_data_u8[INDEX_NINE])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_EIGHT])); + (s8)(data_u8[BNO055_SOFT_IRON_CALIB_4_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_SOFT_IRON_CALIB_4_LSB])); /*soft iron calibration matrix five*/ - v_data_u8[INDEX_TEN] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TEN], + data_u8[BNO055_SOFT_IRON_CALIB_5_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_5_LSB], BNO055_SIC_MATRIX_5_LSB); - v_data_u8[INDEX_ELEVEN] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ELEVEN], + data_u8[BNO055_SOFT_IRON_CALIB_5_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_5_MSB], BNO055_SIC_MATRIX_5_LSB); sic_matrix->sic_5 = (s16)((((s32) - (s8)(v_data_u8[INDEX_ELEVEN])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_TEN])); + (s8)(data_u8[BNO055_SOFT_IRON_CALIB_5_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_SOFT_IRON_CALIB_5_LSB])); /*soft iron calibration matrix six*/ - v_data_u8[INDEX_TWELVE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TWELVE], + data_u8[BNO055_SOFT_IRON_CALIB_6_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_6_LSB], BNO055_SIC_MATRIX_6_LSB); - v_data_u8[INDEX_THIRTEEN] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_THIRTEEN], + data_u8[BNO055_SOFT_IRON_CALIB_6_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_6_MSB], BNO055_SIC_MATRIX_6_LSB); sic_matrix->sic_6 = (s16)((((s32) - (s8)(v_data_u8[INDEX_THIRTEEN])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_TWELVE])); + (s8)(data_u8[BNO055_SOFT_IRON_CALIB_6_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_SOFT_IRON_CALIB_6_LSB])); /*soft iron calibration matrix seven*/ - v_data_u8[INDEX_FOURTEEN] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FOURTEEN], + data_u8[BNO055_SOFT_IRON_CALIB_7_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_7_LSB], BNO055_SIC_MATRIX_7_LSB); - v_data_u8[INDEX_FIVETEEN] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FIVETEEN], + data_u8[BNO055_SOFT_IRON_CALIB_7_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_7_MSB], BNO055_SIC_MATRIX_7_LSB); sic_matrix->sic_7 = (s16)((((s32) - (s8)(v_data_u8[INDEX_FIVETEEN])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_FOURTEEN])); + (s8)(data_u8[BNO055_SOFT_IRON_CALIB_7_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_SOFT_IRON_CALIB_7_LSB])); /*soft iron calibration matrix eight*/ - v_data_u8[INDEX_SIXTEEN] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_SIXTEEN], + data_u8[BNO055_SOFT_IRON_CALIB_8_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_8_LSB], BNO055_SIC_MATRIX_8_LSB); - v_data_u8[INDEX_SEVENTEEN] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_SEVENTEEN], + data_u8[BNO055_SOFT_IRON_CALIB_8_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SOFT_IRON_CALIB_8_MSB], BNO055_SIC_MATRIX_8_LSB); sic_matrix->sic_8 = (s16)((((s32) - (s8)(v_data_u8[INDEX_SEVENTEEN])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_SIXTEEN])); + (s8)(data_u8[BNO055_SOFT_IRON_CALIB_8_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_SOFT_IRON_CALIB_8_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -8748,73 +8870,77 @@ struct bno055_sic_matrix_t *sic_matrix) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note : Each soft iron calibration matrix range from -32768 to +32767 */ BNO055_RETURN_FUNCTION_TYPE bno055_write_sic_matrix( struct bno055_sic_matrix_t *sic_matrix) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data1_u8r = BNO055_ZERO_U8X; -u8 v_data2_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data1_u8r = BNO055_INIT_VALUE; +u8 data2_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* write soft iron calibration matrix zero value*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_0_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_0_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_0 & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_0_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_0_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_0_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_0_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_0_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_0 >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_0_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_0_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_0_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write soft iron calibration @@ -8822,42 +8948,46 @@ if (p_bno055 == BNO055_ZERO_U8X) { com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_1_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_1_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_1 & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_1_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_1_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_1_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_1_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_1_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_1 >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_1_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_1_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_1_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write soft iron calibration @@ -8865,42 +8995,46 @@ if (p_bno055 == BNO055_ZERO_U8X) { com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_2_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_2_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_2 & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_2_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_2_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_2_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_2_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_2_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_2 >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_2_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_2_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_2_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write soft iron calibration @@ -8908,42 +9042,46 @@ if (p_bno055 == BNO055_ZERO_U8X) { com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_3_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_3_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_3 & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_3_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_3_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_3_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_3_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_3_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_3 >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_3_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_3_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_3_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write soft iron calibration @@ -8951,42 +9089,46 @@ if (p_bno055 == BNO055_ZERO_U8X) { com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_4_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_4_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_4 & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_4_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_4_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_4_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_4_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_4_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_4 >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_4_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_4_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_4_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write soft iron calibration @@ -8994,42 +9136,46 @@ if (p_bno055 == BNO055_ZERO_U8X) { com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_5_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_5_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_5 & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_5_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_5_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_5_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_5_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_5_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_5 >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_5_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_5_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_5_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write soft iron calibration @@ -9037,42 +9183,46 @@ if (p_bno055 == BNO055_ZERO_U8X) { com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_6_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_6_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_6 & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_6_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_6_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_6_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_6_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_6_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_6 >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_6_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_6_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_6_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write soft iron calibration @@ -9080,42 +9230,46 @@ if (p_bno055 == BNO055_ZERO_U8X) { com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_7_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_7_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_7 & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_7_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_7_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_7_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_7_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_7_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_7 >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_7_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_7_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_7_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write soft iron calibration @@ -9123,55 +9277,59 @@ if (p_bno055 == BNO055_ZERO_U8X) { com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_8_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_8_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_8 & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_8_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_8_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_8_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_8_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_SIC_MATRIX_8_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (sic_matrix->sic_8 >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_SIC_MATRIX_8_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_SIC_MATRIX_8_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_SIC_MATRIX_8_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! @@ -9189,125 +9347,132 @@ if (p_bno055 == BNO055_ZERO_U8X) { * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The range of the accel offset varies based on * the G-range of accel sensor. * * accel G range | offset range * --------------- | -------------- - * ACCEL_RANGE_2G | +/-2000 - * ACCEL_RANGE_4G | +/-4000 - * ACCEL_RANGE_8G | +/-8000 - * ACCEL_RANGE_16G | +/-16000 + * BNO055_ACCEL_RANGE_2G | +/-2000 + * BNO055_ACCEL_RANGE_4G | +/-4000 + * BNO055_ACCEL_RANGE_8G | +/-8000 + * BNO055_ACCEL_RANGE_16G | +/-16000 * * accel G range can be configured by using the - * bno055_set_accel_range() function + * bno055_set_accel_range() API */ BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_offset( struct bno055_accel_offset_t *accel_offset) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the accel offset values - v_data_u8[INDEX_ZERO] - offset x->LSB - v_data_u8[INDEX_ONE] - offset x->MSB - v_data_u8[INDEX_TWO] - offset y->LSB - v_data_u8[INDEX_THREE] - offset y->MSB - v_data_u8[INDEX_FOUR] - offset z->LSB - v_data_u8[INDEX_FIVE] - offset z->MSB + data_u8[BNO055_SENSOR_OFFSET_DATA_X_LSB] - offset x->LSB + data_u8[BNO055_SENSOR_OFFSET_DATA_X_MSB] - offset x->MSB + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_LSB] - offset y->LSB + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_MSB] - offset y->MSB + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_LSB] - offset z->LSB + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_MSB] - offset z->MSB */ - u8 v_data_u8[ARRAY_SIZE_SIX] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_ACCEL_OFFSET_ARRAY] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel offset is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read accel offset value it is six bytes of data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_X_LSB__REG, - v_data_u8, BNO055_SIX_U8X); - if (com_rslt == SUCCESS) { + BNO055_ACCEL_OFFSET_X_LSB_REG, + data_u8, BNO055_ACCEL_OFFSET_ARRAY); + if (com_rslt == BNO055_SUCCESS) { /* Read accel x offset value*/ - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + data_u8[BNO055_SENSOR_OFFSET_DATA_X_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_X_LSB], BNO055_ACCEL_OFFSET_X_LSB); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_OFFSET_DATA_X_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_X_MSB], BNO055_ACCEL_OFFSET_X_MSB); - accel_offset->x = (s16)((((s32) - (s8)(v_data_u8[INDEX_ONE])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_ZERO])); + accel_offset->x = (s16)((((s32)(s8) + (data_u8[BNO055_SENSOR_OFFSET_DATA_X_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_SENSOR_OFFSET_DATA_X_LSB])); /* Read accel y offset value*/ - v_data_u8[INDEX_TWO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TWO], + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_LSB], BNO055_ACCEL_OFFSET_Y_LSB); - v_data_u8[INDEX_THREE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_THREE], + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_MSB], BNO055_ACCEL_OFFSET_Y_MSB); - accel_offset->y = (s16)((((s32) - (s8)(v_data_u8[INDEX_THREE])) << - (BNO055_SHIFT_8_POSITION)) - | (v_data_u8[INDEX_TWO])); + accel_offset->y = (s16)((((s32)(s8) + (data_u8[BNO055_SENSOR_OFFSET_DATA_Y_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) + | (data_u8[BNO055_SENSOR_OFFSET_DATA_Y_LSB])); /* Read accel z offset value*/ - v_data_u8[INDEX_FOUR] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FOUR], + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_LSB], BNO055_ACCEL_OFFSET_Z_LSB); - v_data_u8[INDEX_FIVE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FIVE], + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_MSB], BNO055_ACCEL_OFFSET_Z_MSB); - accel_offset->z = (s16)((((s32) - (s8)(v_data_u8[INDEX_FIVE])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_FOUR])); + accel_offset->z = (s16)((((s32)(s8) + (data_u8[BNO055_SENSOR_OFFSET_DATA_Z_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_SENSOR_OFFSET_DATA_Z_LSB])); /* Read accel radius value it is two bytes of data*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_RADIUS_LSB__REG, - v_data_u8, BNO055_TWO_U8X); + BNO055_ACCEL_RADIUS_LSB_REG, + data_u8, + BNO055_LSB_MSB_READ_LENGTH); /* Array holding the accel radius values - v_data_u8[INDEX_ZERO] - radius->LSB - v_data_u8[INDEX_ONE] - radius->MSB + data_u8[BNO055_OFFSET_RADIUS_LSB] - radius->LSB + data_u8[BNO055_OFFSET_RADIUS_MSB] - radius->MSB */ - if (com_rslt == SUCCESS) { - v_data_u8[INDEX_ZERO] = + if (com_rslt == BNO055_SUCCESS) { + data_u8[BNO055_OFFSET_RADIUS_LSB] = BNO055_GET_BITSLICE( - v_data_u8[INDEX_ZERO], + data_u8[BNO055_OFFSET_RADIUS_LSB], BNO055_ACCEL_RADIUS_LSB); - v_data_u8[INDEX_ONE] = + data_u8[BNO055_OFFSET_RADIUS_MSB] = BNO055_GET_BITSLICE( - v_data_u8[INDEX_ONE], + data_u8[BNO055_OFFSET_RADIUS_MSB], BNO055_ACCEL_RADIUS_MSB); - accel_offset->r = (s16)((((s32) - (s8)(v_data_u8[INDEX_ONE])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_ZERO])); + accel_offset->r = (s16)((((s32)(s8) + (data_u8[BNO055_OFFSET_RADIUS_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_OFFSET_RADIUS_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -9327,221 +9492,237 @@ struct bno055_accel_offset_t *accel_offset) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The range of the accel offset varies based on * the G-range of accel sensor. * * accel G range | offset range * --------------- | -------------- - * ACCEL_RANGE_2G | +/-2000 - * ACCEL_RANGE_4G | +/-4000 - * ACCEL_RANGE_8G | +/-8000 - * ACCEL_RANGE_16G | +/-16000 + * BNO055_ACCEL_RANGE_2G | +/-2000 + * BNO055_ACCEL_RANGE_4G | +/-4000 + * BNO055_ACCEL_RANGE_8G | +/-8000 + * BNO055_ACCEL_RANGE_16G | +/-16000 * * accel G range can be configured by using the - * bno055_set_accel_range() function + * bno055_set_accel_range() API */ BNO055_RETURN_FUNCTION_TYPE bno055_write_accel_offset( struct bno055_accel_offset_t *accel_offset) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data1_u8r = BNO055_ZERO_U8X; -u8 v_data2_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data1_u8r = BNO055_INIT_VALUE; +u8 data2_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* write accel offset x value*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_X_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_ACCEL_OFFSET_X_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (accel_offset->x & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_ACCEL_OFFSET_X_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_X_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_OFFSET_X_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_X_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_ACCEL_OFFSET_X_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (accel_offset->x >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_ACCEL_OFFSET_X_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_X_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_OFFSET_X_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write accel offset y value*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_Y_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_ACCEL_OFFSET_Y_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (accel_offset->y & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_ACCEL_OFFSET_Y_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_Y_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_OFFSET_Y_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_Y_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_ACCEL_OFFSET_Y_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (accel_offset->y >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_ACCEL_OFFSET_Y_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_Y_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_OFFSET_Y_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write accel offset z value*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_Z_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_ACCEL_OFFSET_Z_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (accel_offset->z & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_ACCEL_OFFSET_Z_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_Z_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_OFFSET_Z_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_Z_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_ACCEL_OFFSET_Z_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (accel_offset->z >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_ACCEL_OFFSET_Z_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_OFFSET_Z_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_OFFSET_Z_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /*write accel radius value*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_RADIUS_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_ACCEL_RADIUS_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (accel_offset->r & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_ACCEL_RADIUS_LSB, - v_data1_u8r); + data1_u8r); com_rslt = p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_RADIUS_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_RADIUS_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_RADIUS_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_ACCEL_RADIUS_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (accel_offset->r >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_ACCEL_RADIUS_MSB, - v_data1_u8r); + data1_u8r); com_rslt = p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_RADIUS_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_RADIUS_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } @@ -9560,8 +9741,8 @@ if (p_bno055 == BNO055_ZERO_U8X) { * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The range of the magnetometer offset is +/-6400 in LSB */ @@ -9571,104 +9752,113 @@ struct bno055_mag_offset_t *mag_offset) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the mag offset values - v_data_u8[INDEX_ZERO] - offset x->LSB - v_data_u8[INDEX_ONE] - offset x->MSB - v_data_u8[INDEX_TWO] - offset y->LSB - v_data_u8[INDEX_THREE] - offset y->MSB - v_data_u8[INDEX_FOUR] - offset z->LSB - v_data_u8[INDEX_FIVE] - offset z->MSB + data_u8[BNO055_SENSOR_OFFSET_DATA_X_LSB] - offset x->LSB + data_u8[BNO055_SENSOR_OFFSET_DATA_X_MSB] - offset x->MSB + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_LSB] - offset y->LSB + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_MSB] - offset y->MSB + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_LSB] - offset z->LSB + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_MSB] - offset z->MSB */ - u8 v_data_u8[ARRAY_SIZE_SIX] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_MAG_OFFSET_ARRAY] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, mag offset is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read mag offset value it the six bytes of data */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_X_LSB__REG, - v_data_u8, BNO055_SIX_U8X); - if (com_rslt == SUCCESS) { + BNO055_MAG_OFFSET_X_LSB_REG, + data_u8, BNO055_MAG_OFFSET_ARRAY); + if (com_rslt == BNO055_SUCCESS) { /* Read mag x offset value*/ - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + data_u8[BNO055_SENSOR_OFFSET_DATA_X_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_X_LSB], BNO055_MAG_OFFSET_X_LSB); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_OFFSET_DATA_X_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_X_MSB], BNO055_MAG_OFFSET_X_MSB); - mag_offset->x = (s16)((((s32) - (s8)(v_data_u8[INDEX_ONE])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_ZERO])); + mag_offset->x = (s16)((((s32)(s8) + (data_u8[BNO055_SENSOR_OFFSET_DATA_X_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_SENSOR_OFFSET_DATA_X_LSB])); /* Read mag y offset value*/ - v_data_u8[INDEX_TWO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TWO], + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_LSB], BNO055_MAG_OFFSET_Y_LSB); - v_data_u8[INDEX_THREE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_THREE], + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_MSB], BNO055_MAG_OFFSET_Y_MSB); - mag_offset->y = (s16)((((s32) - (s8)(v_data_u8[INDEX_THREE])) << - (BNO055_SHIFT_8_POSITION)) - | (v_data_u8[INDEX_TWO])); + mag_offset->y = (s16)((((s32)(s8) + (data_u8[BNO055_SENSOR_OFFSET_DATA_Y_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) + | (data_u8[BNO055_SENSOR_OFFSET_DATA_Y_LSB])); /* Read mag z offset value*/ - v_data_u8[INDEX_FOUR] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FOUR], + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_LSB], BNO055_MAG_OFFSET_Z_LSB); - v_data_u8[INDEX_FIVE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FIVE], + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_MSB], BNO055_MAG_OFFSET_Z_MSB); - mag_offset->z = (s16)((((s32) - (s8)(v_data_u8[INDEX_FIVE])) << - (BNO055_SHIFT_8_POSITION)) - | (v_data_u8[INDEX_FOUR])); + mag_offset->z = (s16)((((s32)(s8) + (data_u8[BNO055_SENSOR_OFFSET_DATA_Z_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) + | (data_u8[BNO055_SENSOR_OFFSET_DATA_Z_LSB])); /* Read mag radius value it the two bytes of data */ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_RADIUS_LSB__REG, - v_data_u8, BNO055_TWO_U8X); - if (com_rslt == SUCCESS) { + BNO055_MAG_RADIUS_LSB_REG, + data_u8, + BNO055_LSB_MSB_READ_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Array holding the mag radius values - v_data_u8[INDEX_ZERO] - radius->LSB - v_data_u8[INDEX_ONE] - radius->MSB + data_u8[BNO055_OFFSET_RADIUS_LSB] - + radius->LSB + data_u8[BNO055_OFFSET_RADIUS_MSB] - + radius->MSB */ - v_data_u8[INDEX_ZERO] = + data_u8[BNO055_OFFSET_RADIUS_LSB] = BNO055_GET_BITSLICE( - v_data_u8[INDEX_ZERO], + data_u8[BNO055_OFFSET_RADIUS_LSB], BNO055_MAG_RADIUS_LSB); - v_data_u8[INDEX_ONE] = + data_u8[BNO055_OFFSET_RADIUS_MSB] = BNO055_GET_BITSLICE( - v_data_u8[INDEX_ONE], + data_u8[BNO055_OFFSET_RADIUS_MSB], BNO055_MAG_RADIUS_MSB); - mag_offset->r = (s16)((((s32) - (s8)(v_data_u8[INDEX_ONE])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_ZERO])); + mag_offset->r = (s16)((((s32)(s8) + (data_u8[BNO055_OFFSET_RADIUS_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_OFFSET_RADIUS_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -9689,210 +9879,226 @@ struct bno055_mag_offset_t *mag_offset) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The range of the magnetometer offset is +/-6400 in LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_write_mag_offset( struct bno055_mag_offset_t *mag_offset) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data1_u8r = BNO055_ZERO_U8X; -u8 v_data2_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data1_u8r = BNO055_INIT_VALUE; +u8 data2_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* write Mag offset x value*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_X_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_MAG_OFFSET_X_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (mag_offset->x & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_MAG_OFFSET_X_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_X_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_MAG_OFFSET_X_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_X_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_MAG_OFFSET_X_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (mag_offset->x >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_MAG_OFFSET_X_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_X_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_MAG_OFFSET_X_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write Mag offset y value*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_Y_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_MAG_OFFSET_Y_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (mag_offset->y & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_MAG_OFFSET_Y_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_Y_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_MAG_OFFSET_Y_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_Y_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_MAG_OFFSET_Y_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (mag_offset->y >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_MAG_OFFSET_Y_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_Y_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_MAG_OFFSET_Y_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write Mag offset z value*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_Z_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_MAG_OFFSET_Z_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (mag_offset->z & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_MAG_OFFSET_Z_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_Z_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_MAG_OFFSET_Z_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_Z_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_MAG_OFFSET_Z_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (mag_offset->z >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_MAG_OFFSET_Z_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_OFFSET_Z_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_MAG_OFFSET_Z_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write Mag radius value*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_RADIUS_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_MAG_RADIUS_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (mag_offset->r & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_MAG_RADIUS_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_RADIUS_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_MAG_RADIUS_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_RADIUS_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_MAG_RADIUS_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (mag_offset->r >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_MAG_RADIUS_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_RADIUS_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_MAG_RADIUS_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! @@ -9909,99 +10115,105 @@ if (p_bno055 == BNO055_ZERO_U8X) { * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The range of the gyro offset varies based on * the range of gyro sensor * * gyro G range | offset range * -------------------- | ------------ - * GYRO_RANGE_2000DPS | +/-32000 - * GYRO_RANGE_1000DPS | +/-16000 - * GYRO_RANGE_500DPS | +/-8000 - * GYRO_RANGE_250DPS | +/-4000 - * GYRO_RANGE_125DPS | +/-2000 + * BNO055_GYRO_RANGE_2000DPS | +/-32000 + * BNO055_GYRO_RANGE_1000DPS | +/-16000 + * BNO055_GYRO_RANGE_500DPS | +/-8000 + * BNO055_GYRO_RANGE_250DPS | +/-4000 + * BNO055_GYRO_RANGE_125DPS | +/-2000 * * Gyro range can be configured by using the - * bno055_set_gyro_range() function + * bno055_set_gyro_range() API */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_offset( struct bno055_gyro_offset_t *gyro_offset) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; /* Array holding the gyro offset values - v_data_u8[INDEX_ZERO] - offset x->LSB - v_data_u8[INDEX_ONE] - offset x->MSB - v_data_u8[INDEX_TWO] - offset y->LSB - v_data_u8[INDEX_THREE] - offset y->MSB - v_data_u8[INDEX_FOUR] - offset z->LSB - v_data_u8[INDEX_FIVE] - offset z->MSB + data_u8[BNO055_SENSOR_OFFSET_DATA_X_LSB] - offset x->LSB + data_u8[BNO055_SENSOR_OFFSET_DATA_X_MSB] - offset x->MSB + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_LSB] - offset y->LSB + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_MSB] - offset y->MSB + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_LSB] - offset z->LSB + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_MSB] - offset z->MSB */ - u8 v_data_u8[ARRAY_SIZE_SIX] = { - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X, - BNO055_ZERO_U8X, BNO055_ZERO_U8X}; - s8 v_stat_s8 = ERROR; + u8 data_u8[BNO055_GYRO_OFFSET_ARRAY] = { + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE, + BNO055_INIT_VALUE, BNO055_INIT_VALUE}; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro offset is available in the page zero*/ - if (p_bno055->page_id != PAGE_ZERO) + if (p_bno055->page_id != BNO055_PAGE_ZERO) /* Write the page zero*/ - v_stat_s8 = bno055_write_page_id(PAGE_ZERO); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ZERO)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ZERO); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ZERO)) { /* Read gyro offset value it the six bytes of data*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_X_LSB__REG, - v_data_u8, BNO055_SIX_U8X); - if (com_rslt == SUCCESS) { + BNO055_GYRO_OFFSET_X_LSB_REG, + data_u8, BNO055_GYRO_OFFSET_ARRAY); + if (com_rslt == BNO055_SUCCESS) { /* Read gyro x offset value*/ - v_data_u8[INDEX_ZERO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ZERO], + data_u8[BNO055_SENSOR_OFFSET_DATA_X_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_X_LSB], BNO055_GYRO_OFFSET_X_LSB); - v_data_u8[INDEX_ONE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_ONE], + data_u8[BNO055_SENSOR_OFFSET_DATA_X_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_X_MSB], BNO055_GYRO_OFFSET_X_MSB); - gyro_offset->x = (s16)((((s32) - (s8)(v_data_u8[INDEX_ONE])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_ZERO])); + gyro_offset->x = (s16)((((s32)(s8) + (data_u8[BNO055_SENSOR_OFFSET_DATA_X_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_SENSOR_OFFSET_DATA_X_LSB])); /* Read gyro y offset value*/ - v_data_u8[INDEX_TWO] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_TWO], + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_LSB], BNO055_GYRO_OFFSET_Y_LSB); - v_data_u8[INDEX_THREE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_THREE], + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_Y_MSB], BNO055_GYRO_OFFSET_Y_MSB); - gyro_offset->y = (s16)((((s32) - (s8)(v_data_u8[INDEX_THREE])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_TWO])); + gyro_offset->y = (s16)((((s32)(s8) + (data_u8[BNO055_SENSOR_OFFSET_DATA_Y_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_SENSOR_OFFSET_DATA_Y_LSB])); /* Read gyro z offset value*/ - v_data_u8[INDEX_FOUR] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FOUR], + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_LSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_LSB], BNO055_GYRO_OFFSET_Z_LSB); - v_data_u8[INDEX_FIVE] = - BNO055_GET_BITSLICE(v_data_u8[INDEX_FIVE], + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_MSB] = + BNO055_GET_BITSLICE( + data_u8[BNO055_SENSOR_OFFSET_DATA_Z_MSB], BNO055_GYRO_OFFSET_Z_MSB); - gyro_offset->z = (s16)((((s32) - (s8)(v_data_u8[INDEX_FIVE])) << - (BNO055_SHIFT_8_POSITION)) | - (v_data_u8[INDEX_FOUR])); + gyro_offset->z = (s16)((((s32)(s8) + (data_u8[BNO055_SENSOR_OFFSET_DATA_Z_MSB])) << + (BNO055_SHIFT_EIGHT_BITS)) | + (data_u8[BNO055_SENSOR_OFFSET_DATA_Z_LSB])); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -10020,180 +10232,192 @@ struct bno055_gyro_offset_t *gyro_offset) * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The range of the gyro offset varies based on * the range of gyro sensor * * gyro G range | offset range * -------------------- | ------------ - * GYRO_RANGE_2000DPS | +/-32000 - * GYRO_RANGE_1000DPS | +/-16000 - * GYRO_RANGE_500DPS | +/-8000 - * GYRO_RANGE_250DPS | +/-4000 - * GYRO_RANGE_125DPS | +/-2000 + * BNO055_GYRO_RANGE_2000DPS | +/-32000 + * BNO055_GYRO_RANGE_1000DPS | +/-16000 + * BNO055_GYRO_RANGE_500DPS | +/-8000 + * BNO055_GYRO_RANGE_250DPS | +/-4000 + * BNO055_GYRO_RANGE_125DPS | +/-2000 * * Gyro range can be configured by using the - * bno055_set_gyro_range() function + * bno055_set_gyro_range() API */ BNO055_RETURN_FUNCTION_TYPE bno055_write_gyro_offset( struct bno055_gyro_offset_t *gyro_offset) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data1_u8r = BNO055_ZERO_U8X; -u8 v_data2_u8r = BNO055_ZERO_U8X; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data1_u8r = BNO055_INIT_VALUE; +u8 data2_u8r = BNO055_INIT_VALUE; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* write gryo offset x value*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_X_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_GYRO_OFFSET_X_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (gyro_offset->x & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_GYRO_OFFSET_X_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_X_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_GYRO_OFFSET_X_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_X_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_GYRO_OFFSET_X_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (gyro_offset->x >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_GYRO_OFFSET_X_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_X_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_GYRO_OFFSET_X_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write gryo offset y value*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_Y_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_GYRO_OFFSET_Y_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (gyro_offset->y & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_GYRO_OFFSET_Y_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_Y_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_GYRO_OFFSET_Y_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_Y_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_GYRO_OFFSET_Y_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (gyro_offset->y >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_GYRO_OFFSET_Y_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_Y_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_GYRO_OFFSET_Y_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } /* write gryo offset z value*/ com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_Z_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_GYRO_OFFSET_Z_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (gyro_offset->z & BNO055_SIC_HEX_0_0_F_F_DATA)); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_GYRO_OFFSET_Z_LSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_Z_LSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_GYRO_OFFSET_Z_LSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } com_rslt += p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_Z_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data1_u8r = ((s8) + BNO055_GYRO_OFFSET_Z_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data1_u8r = ((s8) (gyro_offset->z >> - BNO055_SHIFT_8_POSITION) + BNO055_SHIFT_EIGHT_BITS) & BNO055_SIC_HEX_0_0_F_F_DATA); - v_data2_u8r = - BNO055_SET_BITSLICE(v_data2_u8r, + data2_u8r = + BNO055_SET_BITSLICE(data2_u8r, BNO055_GYRO_OFFSET_Z_MSB, - v_data1_u8r); + data1_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_OFFSET_Z_MSB__REG, - &v_data2_u8r, BNO055_ONE_U8X); + BNO055_GYRO_OFFSET_Z_MSB_REG, + &data2_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /********************************************************/ @@ -10203,49 +10427,49 @@ if (p_bno055 == BNO055_ZERO_U8X) { * @brief This API used to read the accel range * from page one register from 0x08 bit 0 and 1 * - * @param v_accel_range_u8 : The value of accel range - * v_accel_range_u8 | result + * @param accel_range_u8 : The value of accel range + * accel_range_u8 | result * ----------------- | -------------- - * 0x00 | ACCEL_RANGE_2G - * 0x01 | ACCEL_RANGE_4G - * 0x02 | ACCEL_RANGE_8G - * 0x03 | ACCEL_RANGE_16G + * 0x00 | BNO055_ACCEL_RANGE_2G + * 0x01 | BNO055_ACCEL_RANGE_4G + * 0x02 | BNO055_ACCEL_RANGE_8G + * 0x03 | BNO055_ACCEL_RANGE_16G * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_range( -u8 *v_accel_range_u8) +u8 *accel_range_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel range is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel g range */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_RANGE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_range_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_RANGE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_range_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_RANGE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -10254,135 +10478,137 @@ u8 *v_accel_range_u8) * @brief This API used to write the accel range * from page one register from 0x08 bit 0 and 1 * - * @param v_accel_range_u8 : The value of accel range + * @param accel_range_u8 : The value of accel range * - * v_accel_range_u8 | result + * accel_range_u8 | result * ----------------- | -------------- - * 0x00 | ACCEL_RANGE_2G - * 0x01 | ACCEL_RANGE_4G - * 0x02 | ACCEL_RANGE_8G - * 0x03 | ACCEL_RANGE_16G + * 0x00 | BNO055_ACCEL_RANGE_2G + * 0x01 | BNO055_ACCEL_RANGE_4G + * 0x02 | BNO055_ACCEL_RANGE_8G + * 0x03 | BNO055_ACCEL_RANGE_16G * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_range( -u8 v_accel_range_u8) +u8 accel_range_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - if (v_accel_range_u8 < BNO055_FIVE_U8X) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + if (accel_range_u8 < BNO055_ACCEL_RANGE) { /* Write the value of accel range*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_RANGE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_ACCEL_RANGE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_ACCEL_RANGE, - v_accel_range_u8); + accel_range_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_RANGE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_RANGE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the accel bandwidth * from page one register from 0x08 bit 2 to 4 * - * @param v_accel_bw_u8 : The value of accel bandwidth + * @param accel_bw_u8 : The value of accel bandwidth * - * v_accel_bw_u8 | result + * accel_bw_u8 | result * ----------------- | --------------- - * 0x00 | ACCEL_BW_7_81HZ - * 0x01 | ACCEL_BW_15_63HZ - * 0x02 | ACCEL_BW_31_25HZ - * 0x03 | ACCEL_BW_62_5HZ - * 0x04 | ACCEL_BW_125HZ - * 0x05 | ACCEL_BW_250HZ - * 0x06 | ACCEL_BW_500HZ - * 0x07 | ACCEL_BW_1000HZ + * 0x00 | BNO055_ACCEL_BW_7_81HZ + * 0x01 | BNO055_ACCEL_BW_15_63HZ + * 0x02 | BNO055_ACCEL_BW_31_25HZ + * 0x03 | BNO055_ACCEL_BW_62_5HZ + * 0x04 | BNO055_ACCEL_BW_125HZ + * 0x05 | BNO055_ACCEL_BW_250HZ + * 0x06 | BNO055_ACCEL_BW_500HZ + * 0x07 | BNO055_ACCEL_BW_1000HZ * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_bw( -u8 *v_accel_bw_u8) +u8 *accel_bw_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel bandwidth is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel bandwidth */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_BW__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_bw_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_BW_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_bw_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_BW); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -10391,135 +10617,138 @@ u8 *v_accel_bw_u8) * @brief This API used to write the accel bandwidth * from page one register from 0x08 bit 2 to 4 * - * @param v_accel_bw_u8 : The value of accel bandwidth + * @param accel_bw_u8 : The value of accel bandwidth * - * v_accel_bw_u8 | result + * accel_bw_u8 | result * ----------------- | --------------- - * 0x00 | ACCEL_BW_7_81HZ - * 0x01 | ACCEL_BW_15_63HZ - * 0x02 | ACCEL_BW_31_25HZ - * 0x03 | ACCEL_BW_62_5HZ - * 0x04 | ACCEL_BW_125HZ - * 0x05 | ACCEL_BW_250HZ - * 0x06 | ACCEL_BW_500HZ - * 0x07 | ACCEL_BW_1000HZ + * 0x00 | BNO055_ACCEL_BW_7_81HZ + * 0x01 | BNO055_ACCEL_BW_15_63HZ + * 0x02 | BNO055_ACCEL_BW_31_25HZ + * 0x03 | BNO055_ACCEL_BW_62_5HZ + * 0x04 | BNO055_ACCEL_BW_125HZ + * 0x05 | BNO055_ACCEL_BW_250HZ + * 0x06 | BNO055_ACCEL_BW_500HZ + * 0x07 | BNO055_ACCEL_BW_1000HZ * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_bw( -u8 v_accel_bw_u8) +u8 accel_bw_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - if (v_accel_bw_u8 < BNO055_EIGHT_U8X) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + if (accel_bw_u8 < + BNO055_ACCEL_GYRO_BW_RANGE) { /* Write the accel */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_BW__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, BNO055_ACCEL_BW, - v_accel_bw_u8); + BNO055_ACCEL_BW_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_ACCEL_BW, + accel_bw_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_BW__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_BW_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the accel power mode * from page one register from 0x08 bit 5 to 7 * - * @param v_accel_power_mode_u8 : The value of accel power mode - * v_accel_power_mode_u8 | result + * @param accel_power_mode_u8 : The value of accel power mode + * accel_power_mode_u8 | result * ----------------- | ------------- - * 0x00 | ACCEL_NORMAL - * 0x01 | ACCEL_SUSPEND - * 0x02 | ACCEL_LOWPOWER_1 - * 0x03 | ACCEL_STANDBY - * 0x04 | ACCEL_LOWPOWER_2 - * 0x05 | ACCEL_DEEPSUSPEND + * 0x00 | BNO055_ACCEL_NORMAL + * 0x01 | BNO055_ACCEL_SUSPEND + * 0x02 | BNO055_ACCEL_LOWPOWER_1 + * 0x03 | BNO055_ACCEL_STANDBY + * 0x04 | BNO055_ACCEL_LOWPOWER_2 + * 0x05 | BNO055_ACCEL_DEEPSUSPEND * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_power_mode( -u8 *v_accel_power_mode_u8) +u8 *accel_power_mode_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel power mode is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel bandwidth */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_POWER_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_power_mode_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_POWER_MODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_power_mode_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_POWER_MODE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -10528,91 +10757,94 @@ u8 *v_accel_power_mode_u8) * @brief This API used to write the accel power mode * from page one register from 0x08 bit 5 to 7 * - * @param v_accel_power_mode_u8 : The value of accel power mode - * v_accel_power_mode_u8 | result + * @param accel_power_mode_u8 : The value of accel power mode + * accel_power_mode_u8 | result * ----------------- | ------------- - * 0x00 | ACCEL_NORMAL - * 0x01 | ACCEL_SUSPEND - * 0x02 | ACCEL_LOWPOWER_1 - * 0x03 | ACCEL_STANDBY - * 0x04 | ACCEL_LOWPOWER_2 - * 0x05 | ACCEL_DEEPSUSPEND + * 0x00 | BNO055_ACCEL_NORMAL + * 0x01 | BNO055_ACCEL_SUSPEND + * 0x02 | BNO055_ACCEL_LOWPOWER_1 + * 0x03 | BNO055_ACCEL_STANDBY + * 0x04 | BNO055_ACCEL_LOWPOWER_2 + * 0x05 | BNO055_ACCEL_DEEPSUSPEND * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_power_mode( -u8 v_accel_power_mode_u8) +u8 accel_power_mode_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - if (v_accel_power_mode_u8 < BNO055_SIX_U8X) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + if (accel_power_mode_u8 < + BNO055_ACCEL_POWER_MODE_RANGE) { /* Write the value of accel bandwidth*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_POWER_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_ACCEL_POWER_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_ACCEL_POWER_MODE, - v_accel_power_mode_u8); + accel_power_mode_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_POWER_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_POWER_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the mag output data rate * from page one register from 0x09 bit 0 to 2 * - * @param v_mag_data_output_rate_u8 : The value of mag output data rate + * @param mag_data_output_rate_u8 : The value of mag output data rate * - * v_mag_data_output_rate_u8 | result + * mag_data_output_rate_u8 | result * ---------------------- |---------------------- * 0x00 | MAG_DATA_OUTPUT_RATE_2HZ * 0x01 | MAG_DATA_OUTPUT_RATE_6HZ @@ -10624,40 +10856,40 @@ return com_rslt; * 0x07 | MAG_DATA_OUTPUT_RATE_30HZ * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_mag_data_output_rate( -u8 *v_mag_data_output_rate_u8) +u8 *mag_data_output_rate_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, output data rate available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the mag output data rate*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_DATA_OUTPUT_RATE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_mag_data_output_rate_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_MAG_DATA_OUTPUT_RATE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *mag_data_output_rate_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_MAG_DATA_OUTPUT_RATE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -10666,9 +10898,9 @@ u8 *v_mag_data_output_rate_u8) * @brief This API used to write the mag output data rate * from page one register from 0x09 bit 0 to 2 * - * @param v_mag_data_output_rate_u8 : The value of mag output data rate + * @param mag_data_output_rate_u8 : The value of mag output data rate * - * v_mag_data_output_rate_u8 | result + * mag_data_output_rate_u8 | result * ---------------------- |---------------------- * 0x00 | MAG_DATA_OUTPUT_RATE_2HZ * 0x01 | MAG_DATA_OUTPUT_RATE_6HZ @@ -10680,82 +10912,83 @@ u8 *v_mag_data_output_rate_u8) * 0x07 | MAG_DATA_OUTPUT_RATE_30HZ * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_mag_data_output_rate( -u8 v_mag_data_output_rate_u8) +u8 mag_data_output_rate_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - if (v_mag_data_output_rate_u8 - < BNO055_EIGHT_U8X) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + if (mag_data_output_rate_u8 + < BNO055_MAG_OUTPUT_RANGE) { /* Write the value of mag output data rate*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_DATA_OUTPUT_RATE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_MAG_DATA_OUTPUT_RATE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_MAG_DATA_OUTPUT_RATE, - v_mag_data_output_rate_u8); + mag_data_output_rate_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_DATA_OUTPUT_RATE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_MAG_DATA_OUTPUT_RATE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { -com_rslt = ERROR; +com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the mag operation mode * from page one register from 0x09 bit 3 to 4 * - * @param v_mag_operation_mode_u8 : The value of mag operation mode + * @param mag_operation_mode_u8 : The value of mag operation mode * - * v_mag_operation_mode_u8 | result + * mag_operation_mode_u8 | result * ------------------------- |-------------------------- * 0x00 | MAG_OPR_MODE_LOWPOWER * 0x01 | MAG_OPR_MODE_REGULAR @@ -10763,40 +10996,40 @@ return com_rslt; * 0x03 | MAG_OPR_MODE_HIGH_ACCURACY * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_mag_operation_mode( -u8 *v_mag_operation_mode_u8) +u8 *mag_operation_mode_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, mag operation mode is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of mag operation mode*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_OPERATION_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_mag_operation_mode_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_MAG_OPERATION_MODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *mag_operation_mode_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_MAG_OPERATION_MODE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -10805,9 +11038,9 @@ u8 *v_mag_operation_mode_u8) * @brief This API used to write the mag operation mode * from page one register from 0x09 bit 3 to 4 * - * @param v_mag_operation_mode_u8 : The value of mag operation mode + * @param mag_operation_mode_u8 : The value of mag operation mode * - * v_mag_operation_mode_u8 | result + * mag_operation_mode_u8 | result * ------------------------- |-------------------------- * 0x00 | MAG_OPR_MODE_LOWPOWER * 0x01 | MAG_OPR_MODE_REGULAR @@ -10815,123 +11048,125 @@ u8 *v_mag_operation_mode_u8) * 0x03 | MAG_OPR_MODE_HIGH_ACCURACY * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_mag_operation_mode( -u8 v_mag_operation_mode_u8) +u8 mag_operation_mode_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - if (v_mag_operation_mode_u8 - < BNO055_FIVE_U8X) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + if (mag_operation_mode_u8 + < BNO055_MAG_OPR_MODE_RANGE) { /* Write the value of mag operation mode*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_OPERATION_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_MAG_OPERATION_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_MAG_OPERATION_MODE, - v_mag_operation_mode_u8); + mag_operation_mode_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_OPERATION_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_MAG_OPERATION_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the mag power mode * from page one register from 0x09 bit 4 to 6 * - * @param v_mag_power_mode_u8 : The value of mag power mode + * @param mag_power_mode_u8 : The value of mag power mode * - * v_mag_power_mode_u8 | result + * mag_power_mode_u8 | result * --------------------|----------------- - * 0x00 | MAG_POWER_MODE_NORMAL - * 0x01 | MAG_POWER_MODE_SLEEP - * 0x02 | MAG_POWER_MODE_SUSPEND - * 0x03 | MAG_POWER_MODE_FORCE_MODE + * 0x00 | BNO055_MAG_POWER_MODE_NORMAL + * 0x01 | BNO055_MAG_POWER_MODE_SLEEP + * 0x02 | BNO055_MAG_POWER_MODE_SUSPEND + * 0x03 | BNO055_MAG_POWER_MODE_FORCE_MODE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_mag_power_mode( -u8 *v_mag_power_mode_u8) +u8 *mag_power_mode_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, mag power mode is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of mag power mode */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_POWER_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_mag_power_mode_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_MAG_POWER_MODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *mag_power_mode_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_MAG_POWER_MODE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -10940,132 +11175,134 @@ u8 *v_mag_power_mode_u8) * @brief This API used to write the mag power mode * from page one register from 0x09 bit 4 to 6 * - * @param v_mag_power_mode_u8 : The value of mag power mode + * @param mag_power_mode_u8 : The value of mag power mode * - * v_mag_power_mode_u8 | result + * mag_power_mode_u8 | result * --------------------|----------------- - * 0x00 | MAG_POWER_MODE_NORMAL - * 0x01 | MAG_POWER_MODE_SLEEP - * 0x02 | MAG_POWER_MODE_SUSPEND - * 0x03 | MAG_POWER_MODE_FORCE_MODE + * 0x00 | BNO055_MAG_POWER_MODE_NORMAL + * 0x01 | BNO055_MAG_POWER_MODE_SLEEP + * 0x02 | BNO055_MAG_POWER_MODE_SUSPEND + * 0x03 | BNO055_MAG_POWER_MODE_FORCE_MODE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_mag_power_mode( -u8 v_mag_power_mode_u8) +u8 mag_power_mode_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode( - OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode( + BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - if (v_mag_power_mode_u8 < BNO055_FOUR_U8X) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + if (mag_power_mode_u8 < + BNO055_MAG_POWER_MODE_RANGE) { /* Write the value of mag power mode*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_POWER_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_MAG_POWER_MODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_MAG_POWER_MODE, - v_mag_power_mode_u8); + mag_power_mode_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_POWER_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_MAG_POWER_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the gyro range * from page one register from 0x0A bit 0 to 3 * - * @param v_gyro_range_u8 : The value of gyro range + * @param gyro_range_u8 : The value of gyro range * - * v_gyro_range_u8 | result + * gyro_range_u8 | result * --------------------|----------------- - * 0x00 | GYRO_RANGE_2000DPS - * 0x01 | GYRO_RANGE_1000DPS - * 0x02 | GYRO_RANGE_500DPS - * 0x03 | GYRO_RANGE_250DPS - * 0x04 | GYRO_RANGE_125DPS + * 0x00 | BNO055_GYRO_RANGE_2000DPS + * 0x01 | BNO055_GYRO_RANGE_1000DPS + * 0x02 | BNO055_GYRO_RANGE_500DPS + * 0x03 | BNO055_GYRO_RANGE_250DPS + * 0x04 | BNO055_GYRO_RANGE_125DPS * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_range( -u8 *v_gyro_range_u8) +u8 *gyro_range_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro range is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro range */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_RANGE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_range_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_RANGE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_range_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_RANGE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -11074,135 +11311,137 @@ u8 *v_gyro_range_u8) * @brief This API used to write the gyro range * from page one register from 0x0A bit 0 to 3 * - * @param v_gyro_range_u8 : The value of gyro range + * @param gyro_range_u8 : The value of gyro range * - * v_gyro_range_u8 | result + * gyro_range_u8 | result * --------------------|----------------- - * 0x00 | GYRO_RANGE_2000DPS - * 0x01 | GYRO_RANGE_1000DPS - * 0x02 | GYRO_RANGE_500DPS - * 0x03 | GYRO_RANGE_250DPS - * 0x04 | GYRO_RANGE_125DPS + * 0x00 | BNO055_GYRO_RANGE_2000DPS + * 0x01 | BNO055_GYRO_RANGE_1000DPS + * 0x02 | BNO055_GYRO_RANGE_500DPS + * 0x03 | BNO055_GYRO_RANGE_250DPS + * 0x04 | BNO055_GYRO_RANGE_125DPS * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_range( -u8 v_gyro_range_u8) +u8 gyro_range_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - if (v_gyro_range_u8 < BNO055_FIVE_U8X) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + if (gyro_range_u8 < BNO055_GYRO_RANGE) { /* Write the value of gyro range*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_RANGE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_GYRO_RANGE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_GYRO_RANGE, - v_gyro_range_u8); + gyro_range_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_RANGE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_RANGE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the gyro bandwidth * from page one register from 0x0A bit 3 to 5 * - * @param v_gyro_bw_u8 : The value of gyro bandwidth + * @param gyro_bw_u8 : The value of gyro bandwidth * - * v_gyro_bw_u8 | result + * gyro_bw_u8 | result * --------------------|----------------- - * 0x00 | GYRO_BW_523HZ - * 0x01 | GYRO_BW_230HZ - * 0x02 | GYRO_BW_116HZ - * 0x03 | GYRO_BW_47HZ - * 0x04 | GYRO_BW_23HZ - * 0x05 | GYRO_BW_12HZ - * 0x06 | GYRO_BW_64HZ - * 0x07 | GYRO_BW_32HZ + * 0x00 | BNO055_GYRO_BW_523HZ + * 0x01 | BNO055_GYRO_BW_230HZ + * 0x02 | BNO055_GYRO_BW_116HZ + * 0x03 | BNO055_GYRO_BW_47HZ + * 0x04 | BNO055_GYRO_BW_23HZ + * 0x05 | BNO055_GYRO_BW_12HZ + * 0x06 | BNO055_GYRO_BW_64HZ + * 0x07 | BNO055_GYRO_BW_32HZ * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_bw( -u8 *v_gyro_bw_u8) +u8 *gyro_bw_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro bandwidth is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_BW__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_bw_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_BW_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_bw_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_BW); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -11211,141 +11450,141 @@ u8 *v_gyro_bw_u8) * @brief This API used to write the gyro bandwidth * from page one register from 0x0A bit 3 to 5 * - * @param v_gyro_bw_u8 : The value of gyro bandwidth + * @param gyro_bw_u8 : The value of gyro bandwidth * - * v_gyro_bw_u8 | result + * gyro_bw_u8 | result * --------------------|----------------- - * 0x00 | GYRO_BW_523HZ - * 0x01 | GYRO_BW_230HZ - * 0x02 | GYRO_BW_116HZ - * 0x03 | GYRO_BW_47HZ - * 0x04 | GYRO_BW_23HZ - * 0x05 | GYRO_BW_12HZ - * 0x06 | GYRO_BW_64HZ - * 0x07 | GYRO_BW_32HZ + * 0x00 | BNO055_GYRO_BW_523HZ + * 0x01 | BNO055_GYRO_BW_230HZ + * 0x02 | BNO055_GYRO_BW_116HZ + * 0x03 | BNO055_GYRO_BW_47HZ + * 0x04 | BNO055_GYRO_BW_23HZ + * 0x05 | BNO055_GYRO_BW_12HZ + * 0x06 | BNO055_GYRO_BW_64HZ + * 0x07 | BNO055_GYRO_BW_32HZ * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_bw( -u8 v_gyro_bw_u8) -{ -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 gyro_opmode = BNO055_ZERO_U8X; -u8 gyro_auto_sleep_durn = BNO055_ZERO_U8X; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +u8 gyro_bw_u8) +{ +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 gyro_opmode = BNO055_INIT_VALUE; +u8 gyro_auto_sleep_durn = BNO055_INIT_VALUE; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro bandwidth */ - if ((v_gyro_bw_u8 == BNO055_ZERO_U8X || - v_gyro_bw_u8 > BNO055_ZERO_U8X) && - v_gyro_bw_u8 < BNO055_EIGHT_U8X) { - switch (v_gyro_bw_u8) { - case GYRO_BW_523HZ: - v_gyro_bw_u8 = GYRO_BW_523HZ; + if ((gyro_bw_u8 == BNO055_INIT_VALUE || + gyro_bw_u8 > BNO055_INIT_VALUE) && + gyro_bw_u8 < BNO055_ACCEL_GYRO_BW_RANGE) { + switch (gyro_bw_u8) { + case BNO055_GYRO_BW_523HZ: + gyro_bw_u8 = BNO055_GYRO_BW_523HZ; break; - case GYRO_BW_230HZ: - v_gyro_bw_u8 = GYRO_BW_230HZ; + case BNO055_GYRO_BW_230HZ: + gyro_bw_u8 = BNO055_GYRO_BW_230HZ; break; - case GYRO_BW_116HZ: - v_gyro_bw_u8 = GYRO_BW_116HZ; + case BNO055_GYRO_BW_116HZ: + gyro_bw_u8 = BNO055_GYRO_BW_116HZ; break; - case GYRO_BW_47HZ: - v_gyro_bw_u8 = GYRO_BW_47HZ; + case BNO055_GYRO_BW_47HZ: + gyro_bw_u8 = BNO055_GYRO_BW_47HZ; break; - case GYRO_BW_23HZ: - v_gyro_bw_u8 = GYRO_BW_23HZ; + case BNO055_GYRO_BW_23HZ: + gyro_bw_u8 = BNO055_GYRO_BW_23HZ; break; - case GYRO_BW_12HZ: - v_gyro_bw_u8 = GYRO_BW_12HZ; + case BNO055_GYRO_BW_12HZ: + gyro_bw_u8 = BNO055_GYRO_BW_12HZ; break; - case GYRO_BW_64HZ: - v_gyro_bw_u8 = GYRO_BW_64HZ; + case BNO055_GYRO_BW_64HZ: + gyro_bw_u8 = BNO055_GYRO_BW_64HZ; break; - case GYRO_BW_32HZ: - v_gyro_bw_u8 = GYRO_BW_32HZ; + case BNO055_GYRO_BW_32HZ: + gyro_bw_u8 = BNO055_GYRO_BW_32HZ; break; default: break; } com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_BW__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_GYRO_BW_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_GYRO_BW, - v_gyro_bw_u8); + gyro_bw_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_BW__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_BW_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } com_rslt = bno055_get_gyro_power_mode (&gyro_opmode); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { if (gyro_opmode == - GYRO_POWER_MODE_ADVANCE_POWERSAVE) { + BNO055_GYRO_POWER_MODE_ADVANCE_POWERSAVE) { com_rslt += bno055_get_gyro_auto_sleep_durn (&gyro_auto_sleep_durn); - if (com_rslt == SUCCESS) { + if (com_rslt == BNO055_SUCCESS) { com_rslt += bno055_gyro_set_auto_sleep_durn (gyro_auto_sleep_durn, - v_gyro_bw_u8); + gyro_bw_u8); } } } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { -com_rslt = ERROR; +com_rslt = BNO055_ERROR; } } else { -com_rslt = ERROR; +com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the gyro power mode * from page one register from 0x0B bit 0 to 2 * - * @param v_gyro_power_mode_u8 : The value of gyro power mode + * @param gyro_power_mode_u8 : The value of gyro power mode * - * v_gyro_power_mode_u8 | result + * gyro_power_mode_u8 | result * ----------------------|---------------------------- * 0x00 | GYRO_OPR_MODE_NORMAL * 0x01 | GYRO_OPR_MODE_FASTPOWERUP @@ -11354,40 +11593,40 @@ return com_rslt; * 0x04 | GYRO_OPR_MODE_ADVANCE_POWERSAVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_power_mode( -u8 *v_gyro_power_mode_u8) +u8 *gyro_power_mode_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro power mode is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Write the value of gyro power mode*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_POWER_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_power_mode_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_POWER_MODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_power_mode_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_POWER_MODE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -11396,9 +11635,9 @@ u8 *v_gyro_power_mode_u8) * @brief This API used to write the gyro power mode * from page one register from 0x0B bit 0 to 2 * - * @param v_gyro_power_mode_u8 : The value of gyro power mode + * @param gyro_power_mode_u8 : The value of gyro power mode * - * v_gyro_power_mode_u8 | result + * gyro_power_mode_u8 | result * ----------------------|---------------------------- * 0x00 | GYRO_OPR_MODE_NORMAL * 0x01 | GYRO_OPR_MODE_FASTPOWERUP @@ -11407,71 +11646,71 @@ u8 *v_gyro_power_mode_u8) * 0x04 | GYRO_OPR_MODE_ADVANCE_POWERSAVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_power_mode( -u8 v_gyro_power_mode_u8) -{ -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 gyro_auto_sleep_durn = BNO055_ZERO_U8X; -u8 v_gyro_bw_u8 = BNO055_ZERO_U8X; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +u8 gyro_power_mode_u8) +{ +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 gyro_auto_sleep_durn = BNO055_INIT_VALUE; +u8 gyro_bw_u8 = BNO055_INIT_VALUE; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of power mode*/ - if ((v_gyro_power_mode_u8 == BNO055_ZERO_U8X || - v_gyro_power_mode_u8 > BNO055_ZERO_U8X) && - v_gyro_power_mode_u8 < BNO055_FIVE_U8X) { - switch (v_gyro_power_mode_u8) { - case GYRO_POWER_MODE_NORMAL: - v_gyro_power_mode_u8 = - GYRO_POWER_MODE_NORMAL; + if ((gyro_power_mode_u8 == BNO055_INIT_VALUE || + gyro_power_mode_u8 > BNO055_INIT_VALUE) && + gyro_power_mode_u8 < BNO055_GYRO_RANGE) { + switch (gyro_power_mode_u8) { + case BNO055_GYRO_POWER_MODE_NORMAL: + gyro_power_mode_u8 = + BNO055_GYRO_POWER_MODE_NORMAL; break; - case GYRO_POWER_MODE_FASTPOWERUP: - v_gyro_power_mode_u8 = - GYRO_POWER_MODE_FASTPOWERUP; + case BNO055_GYRO_POWER_MODE_FASTPOWERUP: + gyro_power_mode_u8 = + BNO055_GYRO_POWER_MODE_FASTPOWERUP; break; - case GYRO_POWER_MODE_DEEPSUSPEND: - v_gyro_power_mode_u8 = - GYRO_POWER_MODE_DEEPSUSPEND; + case BNO055_GYRO_POWER_MODE_DEEPSUSPEND: + gyro_power_mode_u8 = + BNO055_GYRO_POWER_MODE_DEEPSUSPEND; break; - case GYRO_POWER_MODE_SUSPEND: - v_gyro_power_mode_u8 = - GYRO_POWER_MODE_SUSPEND; + case BNO055_GYRO_POWER_MODE_SUSPEND: + gyro_power_mode_u8 = + BNO055_GYRO_POWER_MODE_SUSPEND; break; - case GYRO_POWER_MODE_ADVANCE_POWERSAVE: + case BNO055_GYRO_POWER_MODE_ADVANCE_POWERSAVE: com_rslt = bno055_get_gyro_bw - (&v_gyro_bw_u8); + (&gyro_bw_u8); com_rslt += bno055_get_gyro_auto_sleep_durn (&gyro_auto_sleep_durn); - if (com_rslt == SUCCESS) + if (com_rslt == BNO055_SUCCESS) bno055_gyro_set_auto_sleep_durn (gyro_auto_sleep_durn, - v_gyro_bw_u8); - com_rslt += - bno055_write_page_id(PAGE_ONE); - v_gyro_power_mode_u8 = - GYRO_POWER_MODE_ADVANCE_POWERSAVE; + gyro_bw_u8); + com_rslt += + bno055_write_page_id(BNO055_PAGE_ONE); + gyro_power_mode_u8 = + BNO055_GYRO_POWER_MODE_ADVANCE_POWERSAVE; break; default: break; @@ -11479,85 +11718,87 @@ if (v_stat_s8 == SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_POWER_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_GYRO_POWER_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_GYRO_POWER_MODE, - v_gyro_power_mode_u8); + gyro_power_mode_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_POWER_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_POWER_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the accel sleep mode * from page one register from 0x0C bit 0 * - * @param v_sleep_tmr_u8 : The value of accel sleep mode + * @param sleep_tmr_u8 : The value of accel sleep mode * - * v_sleep_tmr_u8 | result + * sleep_tmr_u8 | result * ----------------- |------------------------------------ * 0x00 | enable EventDrivenSampling(EDT) * 0x01 | enable Equidistant sampling mode(EST) * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_sleep_tmr_mode( -u8 *v_sleep_tmr_u8) +u8 *sleep_tmr_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel sleep mode is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* read the value of accel sleep mode */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLEEP_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_sleep_tmr_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_SLEEP_MODE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *sleep_tmr_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_SLEEP_MODE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -11566,89 +11807,93 @@ u8 *v_sleep_tmr_u8) * @brief This API used to write the accel sleep mode * from page one register from 0x0C bit 0 * - * @param v_sleep_tmr_u8 : The value of accel sleep mode + * @param sleep_tmr_u8 : The value of accel sleep mode * - * v_sleep_tmr_u8 | result + * sleep_tmr_u8 | result * ----------------- |------------------------------------ * 0x00 | enable EventDrivenSampling(EDT) * 0x01 | enable Equidistant sampling mode(EST) * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_sleep_tmr_mode( -u8 v_sleep_tmr_u8) +u8 sleep_tmr_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - if (v_sleep_tmr_u8 < BNO055_TWO_U8X) { + pg_stat_s8 = bno055_write_page_id( + BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + if (sleep_tmr_u8 < + BNO055_ACCEL_SLEEP_MODE_RANGE) { /*Write the value of accel sleep mode*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLEEP_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_ACCEL_SLEEP_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_ACCEL_SLEEP_MODE, - v_sleep_tmr_u8); + sleep_tmr_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLEEP_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_SLEEP_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the accel sleep duration * from page one register from 0x0C bit 1 to 4 * - * @param v_sleep_durn_u8 : The value of accel sleep duration + * @param sleep_durn_u8 : The value of accel sleep duration * - * v_sleep_durn_u8 | result + * sleep_durn_u8 | result * ---------------- |----------------------------- * 0x05 | BNO055_ACCEL_SLEEP_DURN_0_5MS * 0x06 | BNO055_ACCEL_SLEEP_DURN_1MS @@ -11663,40 +11908,40 @@ return com_rslt; * 0x0F | BNO055_ACCEL_SLEEP_DURN_1S * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_sleep_durn( -u8 *v_sleep_durn_u8) +u8 *sleep_durn_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel sleep duration available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel sleep duration */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLEEP_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_sleep_durn_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_SLEEP_DURN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *sleep_durn_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_SLEEP_DURN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -11705,132 +11950,135 @@ u8 *v_sleep_durn_u8) * @brief This API used to write the accel sleep duration * from page one register from 0x0C bit 1 to 4 * - * @param v_sleep_durn_u8 : The value of accel sleep duration + * @param sleep_durn_u8 : The value of accel sleep duration * - * v_sleep_durn_u8 | result - * ---------------- |----------------------------- - * 0x05 | BNO055_ACCEL_SLEEP_DURN_0_5MS - * 0x06 | BNO055_ACCEL_SLEEP_DURN_1MS - * 0x07 | BNO055_ACCEL_SLEEP_DURN_2MS - * 0x08 | BNO055_ACCEL_SLEEP_DURN_4MS - * 0x09 | BNO055_ACCEL_SLEEP_DURN_6MS - * 0x0A | BNO055_ACCEL_SLEEP_DURN_10MS - * 0x0B | BNO055_ACCEL_SLEEP_DURN_25MS - * 0x0C | BNO055_ACCEL_SLEEP_DURN_50MS - * 0x0D | BNO055_ACCEL_SLEEP_DURN_100MS - * 0x0E | BNO055_ACCEL_SLEEP_DURN_500MS - * 0x0F | BNO055_ACCEL_SLEEP_DURN_1S + * sleep_durn_u8 | result + * ---------------|----------------------------- + * 0x05 | BNO055_ACCEL_SLEEP_DURN_0_5MS + * 0x06 | BNO055_ACCEL_SLEEP_DURN_1MS + * 0x07 | BNO055_ACCEL_SLEEP_DURN_2MS + * 0x08 | BNO055_ACCEL_SLEEP_DURN_4MS + * 0x09 | BNO055_ACCEL_SLEEP_DURN_6MS + * 0x0A | BNO055_ACCEL_SLEEP_DURN_10MS + * 0x0B | BNO055_ACCEL_SLEEP_DURN_25MS + * 0x0C | BNO055_ACCEL_SLEEP_DURN_50MS + * 0x0D | BNO055_ACCEL_SLEEP_DURN_100MS + * 0x0E | BNO055_ACCEL_SLEEP_DURN_500MS + * 0x0F | BNO055_ACCEL_SLEEP_DURN_1S * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_sleep_durn( -u8 v_sleep_durn_u8) +u8 sleep_durn_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - if (v_sleep_durn_u8 < - BNO055_SIXTEEN_U8X) { + pg_stat_s8 = bno055_write_page_id( + BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + if (sleep_durn_u8 < + BNO055_ACCEL_SLEEP_DURATION_RANGE) { /* Write the accel sleep duration*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLEEP_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_ACCEL_SLEEP_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_ACCEL_SLEEP_DURN, - v_sleep_durn_u8); + sleep_durn_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLEEP_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_SLEEP_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to write the gyro sleep duration * from page one register from 0x0D bit 0 to 2 * - * @param v_sleep_durn_u8 : The value of gyro sleep duration + * @param sleep_durn_u8 : The value of gyro sleep duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_sleep_durn(u8 *v_sleep_durn_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_sleep_durn(u8 *sleep_durn_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel range is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the gyro sleep duration */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_SLEEP_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_sleep_durn_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_SLEEP_DURN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *sleep_durn_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_SLEEP_DURN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -11839,117 +12087,120 @@ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_sleep_durn(u8 *v_sleep_durn_u8) * @brief This API used to write the gyro sleep duration * from page one register from 0x0D bit 0 to 2 * - * @param v_sleep_durn_u8 : The value of gyro sleep duration + * @param sleep_durn_u8 : The value of gyro sleep duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_sleep_durn(u8 v_sleep_durn_u8) +BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_sleep_durn(u8 sleep_durn_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - if (v_sleep_durn_u8 < BNO055_EIGHT_U8X) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + if (sleep_durn_u8 < + BNO055_GYRO_AUTO_SLEEP_DURATION_RANGE) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_SLEEP_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_GYRO_SLEEP_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the gyro sleep duration */ - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_GYRO_SLEEP_DURN, - v_sleep_durn_u8); + sleep_durn_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_SLEEP_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_SLEEP_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the gyro auto sleep duration * from page one register from 0x0D bit 3 to 5 * - * @param v_auto_sleep_durn_u8 : The value of gyro auto sleep duration + * @param auto_sleep_durn_u8 : The value of gyro auto sleep duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_auto_sleep_durn( -u8 *v_auto_sleep_durn_u8) +u8 *auto_sleep_durn_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel range is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro auto sleep duration */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_AUTO_SLEEP_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_auto_sleep_durn_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_AUTO_SLEEP_DURN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *auto_sleep_durn_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_AUTO_SLEEP_DURN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -11958,201 +12209,204 @@ u8 *v_auto_sleep_durn_u8) * @brief This API used to write the gyro auto sleep duration * from page one register from 0x0D bit 3 to 5 * - * @param v_auto_sleep_durn_u8 : The value of gyro auto sleep duration + * @param auto_sleep_durn_u8 : The value of gyro auto sleep duration * @param bw : The value of gyro bandwidth * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_gyro_set_auto_sleep_durn( -u8 v_auto_sleep_durn_u8, u8 bw) -{ -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_auto_sleep_durn_u8r; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +u8 auto_sleep_durn_u8, u8 bw) +{ +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 auto_sleep_durn_u8r; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro sleep duration */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_AUTO_SLEEP_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (v_auto_sleep_durn_u8 < BNO055_EIGHT_U8X) { + BNO055_GYRO_AUTO_SLEEP_DURN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (auto_sleep_durn_u8 < + BNO055_GYRO_AUTO_SLEEP_DURATION_RANGE) { switch (bw) { - case GYRO_BW_523HZ: - if (v_auto_sleep_durn_u8 > + case BNO055_GYRO_BW_523HZ: + if (auto_sleep_durn_u8 > BNO055_GYRO_4MS_AUTOSLPDUR) - v_auto_sleep_durn_u8r = - v_auto_sleep_durn_u8; + auto_sleep_durn_u8r = + auto_sleep_durn_u8; else - v_auto_sleep_durn_u8r = + auto_sleep_durn_u8r = BNO055_GYRO_4MS_AUTOSLPDUR; break; - case GYRO_BW_230HZ: - if (v_auto_sleep_durn_u8 > + case BNO055_GYRO_BW_230HZ: + if (auto_sleep_durn_u8 > BNO055_GYRO_4MS_AUTOSLPDUR) - v_auto_sleep_durn_u8r = - v_auto_sleep_durn_u8; + auto_sleep_durn_u8r = + auto_sleep_durn_u8; else - v_auto_sleep_durn_u8r = + auto_sleep_durn_u8r = BNO055_GYRO_4MS_AUTOSLPDUR; break; - case GYRO_BW_116HZ: - if (v_auto_sleep_durn_u8 > + case BNO055_GYRO_BW_116HZ: + if (auto_sleep_durn_u8 > BNO055_GYRO_4MS_AUTOSLPDUR) - v_auto_sleep_durn_u8r = - v_auto_sleep_durn_u8; + auto_sleep_durn_u8r = + auto_sleep_durn_u8; else - v_auto_sleep_durn_u8r = + auto_sleep_durn_u8r = BNO055_GYRO_4MS_AUTOSLPDUR; break; - case GYRO_BW_47HZ: - if (v_auto_sleep_durn_u8 > + case BNO055_GYRO_BW_47HZ: + if (auto_sleep_durn_u8 > BNO055_GYRO_5MS_AUTOSLPDUR) - v_auto_sleep_durn_u8r = - v_auto_sleep_durn_u8; + auto_sleep_durn_u8r = + auto_sleep_durn_u8; else - v_auto_sleep_durn_u8r = + auto_sleep_durn_u8r = BNO055_GYRO_5MS_AUTOSLPDUR; break; - case GYRO_BW_23HZ: - if (v_auto_sleep_durn_u8 > + case BNO055_GYRO_BW_23HZ: + if (auto_sleep_durn_u8 > BNO055_GYRO_10MS_AUTOSLPDUR) - v_auto_sleep_durn_u8r = - v_auto_sleep_durn_u8; + auto_sleep_durn_u8r = + auto_sleep_durn_u8; else - v_auto_sleep_durn_u8r = + auto_sleep_durn_u8r = BNO055_GYRO_10MS_AUTOSLPDUR; break; - case GYRO_BW_12HZ: - if (v_auto_sleep_durn_u8 > + case BNO055_GYRO_BW_12HZ: + if (auto_sleep_durn_u8 > BNO055_GYRO_20MS_AUTOSLPDUR) - v_auto_sleep_durn_u8r = - v_auto_sleep_durn_u8; + auto_sleep_durn_u8r = + auto_sleep_durn_u8; else - v_auto_sleep_durn_u8r = + auto_sleep_durn_u8r = BNO055_GYRO_20MS_AUTOSLPDUR; break; - case GYRO_BW_64HZ: - if (v_auto_sleep_durn_u8 > + case BNO055_GYRO_BW_64HZ: + if (auto_sleep_durn_u8 > BNO055_GYRO_10MS_AUTOSLPDUR) - v_auto_sleep_durn_u8r = - v_auto_sleep_durn_u8; + auto_sleep_durn_u8r = + auto_sleep_durn_u8; else - v_auto_sleep_durn_u8r = + auto_sleep_durn_u8r = BNO055_GYRO_10MS_AUTOSLPDUR; break; - case GYRO_BW_32HZ: - if (v_auto_sleep_durn_u8 > + case BNO055_GYRO_BW_32HZ: + if (auto_sleep_durn_u8 > BNO055_GYRO_20MS_AUTOSLPDUR) - v_auto_sleep_durn_u8r = - v_auto_sleep_durn_u8; + auto_sleep_durn_u8r = + auto_sleep_durn_u8; else - v_auto_sleep_durn_u8r = + auto_sleep_durn_u8r = BNO055_GYRO_20MS_AUTOSLPDUR; break; default: - if (v_auto_sleep_durn_u8 > + if (auto_sleep_durn_u8 > BNO055_GYRO_4MS_AUTOSLPDUR) - v_auto_sleep_durn_u8r = - v_auto_sleep_durn_u8; + auto_sleep_durn_u8r = + auto_sleep_durn_u8; else - v_auto_sleep_durn_u8r = + auto_sleep_durn_u8r = BNO055_GYRO_4MS_AUTOSLPDUR; break; } - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_GYRO_AUTO_SLEEP_DURN, - v_auto_sleep_durn_u8r); + auto_sleep_durn_u8r); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_AUTO_SLEEP_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_AUTO_SLEEP_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { -com_rslt = ERROR; +com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the mag sleep mode * from page one register from 0x0E bit 0 * - * @param v_sleep_mode_u8 : The value of mag sleep mode + * @param sleep_mode_u8 : The value of mag sleep mode * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_mag_sleep_mode( -u8 *v_sleep_mode_u8) +u8 *sleep_mode_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page,mag sleep mode is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of mag sleep mode*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_SLEEP_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_sleep_mode_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_MAG_SLEEP_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + *sleep_mode_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_MAG_SLEEP_MODE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -12161,114 +12415,117 @@ u8 *v_sleep_mode_u8) * @brief This API used to write the mag sleep mode * from page one register from 0x0E bit 0 * - * @param v_sleep_mode_u8 : The value of mag sleep mode + * @param sleep_mode_u8 : The value of mag sleep mode * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_mag_sleep_mode( -u8 v_sleep_mode_u8) +u8 sleep_mode_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id( + BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_SLEEP_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_MAG_SLEEP_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the value of mag sleep mode*/ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_MAG_SLEEP_MODE, - v_sleep_mode_u8); + sleep_mode_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_SLEEP_MODE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_MAG_SLEEP_MODE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the mag sleep duration * from page one register from 0x0E bit 1 to 4 * - * @param v_sleep_durn_u8 : The value of mag sleep duration + * @param sleep_durn_u8 : The value of mag sleep duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_mag_sleep_durn( -u8 *v_sleep_durn_u8) +u8 *sleep_durn_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page,mag sleep duration is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of mag sleep duration*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_SLEEP_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_sleep_durn_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_MAG_SLEEP_DURN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *sleep_durn_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_MAG_SLEEP_DURN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -12277,86 +12534,89 @@ u8 *v_sleep_durn_u8) * @brief This API used to write the mag sleep duration * from page one register from 0x0E bit 1 to 4 * - * @param v_sleep_durn_u8 : The value of mag sleep duration + * @param sleep_durn_u8 : The value of mag sleep duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_mag_sleep_durn( -u8 v_sleep_durn_u8) +u8 sleep_durn_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id( + BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_MAG_SLEEP_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_MAG_SLEEP_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the value of mag sleep duration */ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_MAG_SLEEP_DURN, - v_sleep_durn_u8); + sleep_durn_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_MAG_SLEEP_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_MAG_SLEEP_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the gyro anymotion interrupt mask * from page one register from 0x0F bit 2 * - * @param v_gyro_any_motion_u8 : The value of gyro anymotion interrupt mask - * v_gyro_any_motion_u8 | result + * @param gyro_any_motion_u8 : The value of gyro anymotion interrupt mask + * gyro_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro anymotion interrupt * configure the following settings @@ -12381,34 +12641,34 @@ if (p_bno055 == BNO055_ZERO_U8X) { * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_mask_gyro_any_motion( -u8 *v_gyro_any_motion_u8) +u8 *gyro_any_motion_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro anymotion interrupt mask is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro anymotion interrupt mask*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_any_motion_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_ANY_MOTION_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_any_motion_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_ANY_MOTION_INTR_MASK); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -12417,15 +12677,15 @@ u8 *v_gyro_any_motion_u8) * @brief This API used to write the gyro anymotion interrupt mask * from page one register from 0x0F bit 2 * - * @param v_gyro_any_motion_u8 : The value of gyro anymotion interrupt mask - * v_gyro_any_motion_u8 | result + * @param gyro_any_motion_u8 : The value of gyro anymotion interrupt mask + * gyro_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro anymotion interrupt * configure the following settings @@ -12450,40 +12710,40 @@ u8 *v_gyro_any_motion_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_mask_gyro_any_motion( -u8 v_gyro_any_motion_u8) +u8 gyro_any_motion_u8) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel range is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Write the value of gyro anymotion interrupt mask*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_ANY_MOTION_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_ANY_MOTION_INTR_MASK, - v_gyro_any_motion_u8); + gyro_any_motion_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_ANY_MOTION_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -12492,19 +12752,19 @@ u8 v_gyro_any_motion_u8) * @brief This API used to read the gyro highrate interrupt mask * from page one register from 0x0F bit 3 * - * @param v_gyro_highrate_u8 : The value of gyro highrate interrupt mask - * v_gyro_highrate_u8 | result + * @param gyro_highrate_u8 : The value of gyro highrate interrupt mask + * gyro_highrate_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro highrate interrupt * configure the below settings by using - * the following functions + * the following API * * Axis : * @@ -12540,34 +12800,34 @@ u8 v_gyro_any_motion_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_mask_gyro_highrate( -u8 *v_gyro_highrate_u8) +u8 *gyro_highrate_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate interrupt mask is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro highrate interrupt mask*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_INTR_MASK); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -12576,19 +12836,19 @@ u8 *v_gyro_highrate_u8) * @brief This API used to write the gyro highrate interrupt mask * from page one register from 0x0F bit 3 * - * @param v_gyro_highrate_u8 : The value of gyro highrate interrupt mask - * v_gyro_highrate_u8 | result + * @param gyro_highrate_u8 : The value of gyro highrate interrupt mask + * gyro_highrate_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro highrate interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -12624,41 +12884,41 @@ u8 *v_gyro_highrate_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_mask_gyro_highrate( -u8 v_gyro_highrate_u8) +u8 gyro_highrate_u8) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate interrupt mask is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_GYRO_HIGHRATE_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the value of gyro highrate interrupt mask*/ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_INTR_MASK, - v_gyro_highrate_u8); + gyro_highrate_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -12667,19 +12927,19 @@ u8 v_gyro_highrate_u8) * @brief This API used to read the accel highg interrupt mask * from page one register from 0x0F bit 5 * - * @param v_accel_high_g_u8 : The value of accel highg interrupt mask - * v_accel_high_g_u8 | result + * @param accel_high_g_u8 : The value of accel highg interrupt mask + * accel_high_g_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel highg interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -12695,34 +12955,34 @@ u8 v_gyro_highrate_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_mask_accel_high_g( -u8 *v_accel_high_g_u8) +u8 *accel_high_g_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel highg interrupt mask is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel highg interrupt mask*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_high_g_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_HIGH_G_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_high_g_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_HIGH_G_INTR_MASK); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -12731,19 +12991,19 @@ u8 *v_accel_high_g_u8) * @brief This API used to write the accel highg interrupt mask * from page one register from 0x0F bit 5 * - * @param v_accel_high_g_u8 : The value of accel highg interrupt mask - * v_accel_high_g_u8 | result + * @param accel_high_g_u8 : The value of accel highg interrupt mask + * accel_high_g_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel highg interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -12759,41 +13019,41 @@ u8 *v_accel_high_g_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_mask_accel_high_g( -u8 v_accel_high_g_u8) +u8 accel_high_g_u8) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel highg interrupt mask is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_ACCEL_HIGH_G_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the value of accel highg interrupt mask*/ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_HIGH_G_INTR_MASK, - v_accel_high_g_u8); + accel_high_g_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_HIGH_G_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -12802,19 +13062,19 @@ u8 v_accel_high_g_u8) * @brief This API used to read the accel anymotion interrupt mask * from page one register from 0x0F bit 6 * - * @param v_accel_any_motion_u8 : The value of accel anymotion interrupt mask - * v_accel_any_motion_u8 | result + * @param accel_any_motion_u8 : The value of accel anymotion interrupt mask + * accel_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel highg interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -12830,34 +13090,34 @@ u8 v_accel_high_g_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_mask_accel_any_motion( -u8 *v_accel_any_motion_u8) +u8 *accel_any_motion_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel anymotion interrupt mask is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* The value of accel anymotion interrupt mask*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_any_motion_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_ANY_MOTION_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_any_motion_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_ANY_MOTION_INTR_MASK); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -12866,15 +13126,15 @@ u8 *v_accel_any_motion_u8) * @brief This API used to write the accel anymotion interrupt mask * from page one register from 0x0F bit 6 * - * @param v_accel_any_motion_u8 : The value of accel anymotion interrupt mask - * v_accel_any_motion_u8 | result + * @param accel_any_motion_u8 : The value of accel anymotion interrupt mask + * accel_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel anymotion interrupt * configure the following settings @@ -12893,40 +13153,40 @@ u8 *v_accel_any_motion_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_mask_accel_any_motion( -u8 v_accel_any_motion_u8) +u8 accel_any_motion_u8) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel anymotion interrupt mask is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Write the value of accel anymotion interrupt mask*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_ACCEL_ANY_MOTION_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_ANY_MOTION_INTR_MASK, - v_accel_any_motion_u8); + accel_any_motion_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_ANY_MOTION_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -12935,14 +13195,14 @@ u8 v_accel_any_motion_u8) * @brief This API used to read the accel nomotion interrupt mask * from page one register from 0x0F bit 7 * - * @param v_accel_nomotion_u8 : The value of accel nomotion interrupt mask - * v_accel_nomotion_u8 | result + * @param accel_nomotion_u8 : The value of accel nomotion interrupt mask + * accel_nomotion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success + * @retval 0 -> BNO055_SUCCESS * * @note While enabling the accel anymotion interrupt * configure the following settings @@ -12961,34 +13221,34 @@ u8 v_accel_any_motion_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_mask_accel_no_motion( -u8 *v_accel_nomotion_u8) +u8 *accel_nomotion_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel nomotion interrupt mask is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel nomotion interrupt mask*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_NO_MOTION_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_nomotion_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_NO_MOTION_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_nomotion_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_NO_MOTION_INTR_MASK); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -12997,15 +13257,15 @@ u8 *v_accel_nomotion_u8) * @brief This API used to write the accel nomotion interrupt mask * from page one register from 0x0F bit 7 * - * @param v_accel_nomotion_u8 : The value of accel nomotion interrupt mask - * v_accel_nomotion_u8 | result + * @param accel_nomotion_u8 : The value of accel nomotion interrupt mask + * accel_nomotion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel nomotion interrupt * configure the following settings @@ -13028,42 +13288,42 @@ u8 *v_accel_nomotion_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_mask_accel_no_motion( -u8 v_accel_nomotion_u8) +u8 accel_nomotion_u8) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel nomotion interrupt mask is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_NO_MOTION_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_ACCEL_NO_MOTION_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the value of accel nomotion interrupt mask*/ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_NO_MOTION_INTR_MASK, - v_accel_nomotion_u8); + accel_nomotion_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_NO_MOTION_INTR_MASK__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_NO_MOTION_INTR_MASK_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13072,15 +13332,15 @@ u8 v_accel_nomotion_u8) * @brief This API used to read the gyro anymotion interrupt * from page one register from 0x10 bit 2 * - * @param v_gyro_any_motion_u8 : The value of gyro anymotion interrupt - * v_gyro_any_motion_u8 | result + * @param gyro_any_motion_u8 : The value of gyro anymotion interrupt + * gyro_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro anymotion interrupt * configure the following settings @@ -13104,34 +13364,34 @@ u8 v_accel_nomotion_u8) * bno055_set_gyro_any_motion_awake_durn() */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_gyro_any_motion( -u8 *v_gyro_any_motion_u8) +u8 *gyro_any_motion_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro anymotion interrupt is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro anymotion interrupt */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_any_motion_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_ANY_MOTION_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_any_motion_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_ANY_MOTION_INTR); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13140,15 +13400,15 @@ u8 *v_gyro_any_motion_u8) * @brief This API used to write the gyro anymotion interrupt * from page one register from 0x10 bit 2 * - * @param v_gyro_any_motion_u8 : The value of gyro anymotion interrupt - * v_gyro_any_motion_u8 | result + * @param gyro_any_motion_u8 : The value of gyro anymotion interrupt + * gyro_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro anymotion interrupt * configure the following settings @@ -13172,40 +13432,40 @@ u8 *v_gyro_any_motion_u8) * bno055_set_gyro_any_motion_awake_durn() */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_gyro_any_motion( -u8 v_gyro_any_motion_u8) +u8 gyro_any_motion_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro anymotion interrupt is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Write the value of gyro anymotion interrupt */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_ANY_MOTION_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_ANY_MOTION_INTR, - v_gyro_any_motion_u8); + gyro_any_motion_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_ANY_MOTION_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13214,19 +13474,19 @@ if (p_bno055 == BNO055_ZERO_U8X) { * @brief This API used to read the gyro highrate interrupt * from page one register from 0x10 bit 3 * - * @param v_gyro_highrate_u8 : The value of gyro highrate interrupt - * v_gyro_highrate_u8 | result + * @param gyro_highrate_u8 : The value of gyro highrate interrupt + * gyro_highrate_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro highrate interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -13262,34 +13522,34 @@ if (p_bno055 == BNO055_ZERO_U8X) { * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_gyro_highrate( -u8 *v_gyro_highrate_u8) +u8 *gyro_highrate_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate interrupt is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro highrate interrupt */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_INTR); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13298,19 +13558,19 @@ u8 *v_gyro_highrate_u8) * @brief This API used to write the gyro highrate interrupt * from page one register from 0x10 bit 3 * - * @param v_gyro_highrate_u8 : The value of gyro highrate interrupt - * v_gyro_highrate_u8 | result + * @param gyro_highrate_u8 : The value of gyro highrate interrupt + * gyro_highrate_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro highrate interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -13346,39 +13606,39 @@ u8 *v_gyro_highrate_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_gyro_highrate( -u8 v_gyro_highrate_u8) +u8 gyro_highrate_u8) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate interrupt is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_GYRO_HIGHRATE_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the value of gyro highrate interrupt */ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, - BNO055_GYRO_HIGHRATE_INTR, v_gyro_highrate_u8); + data_u8r = + BNO055_SET_BITSLICE(data_u8r, + BNO055_GYRO_HIGHRATE_INTR, gyro_highrate_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13387,19 +13647,19 @@ u8 v_gyro_highrate_u8) * @brief This API used to read the accel highg interrupt * from page one register from 0x10 bit 5 * - * @param v_accel_high_g_u8 : The value of accel highg interrupt - * v_accel_high_g_u8 | result + * @param accel_high_g_u8 : The value of accel highg interrupt + * accel_high_g_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel highg interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -13415,34 +13675,34 @@ u8 v_gyro_highrate_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_accel_high_g( -u8 *v_accel_high_g_u8) +u8 *accel_high_g_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel highg interrupt is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel highg interrupt*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_high_g_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_HIGH_G_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_high_g_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_HIGH_G_INTR); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13451,19 +13711,19 @@ u8 *v_accel_high_g_u8) * @brief This API used to write the accel highg interrupt * from page one register from 0x10 bit 5 * - * @param v_accel_high_g_u8 : The value of accel highg interrupt - * v_accel_high_g_u8 | result + * @param accel_high_g_u8 : The value of accel highg interrupt + * accel_high_g_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel highg interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -13479,40 +13739,40 @@ u8 *v_accel_high_g_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_accel_high_g( -u8 v_accel_high_g_u8) +u8 accel_high_g_u8) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel highg interrupt is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_ACCEL_HIGH_G_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the value of accel highg interrupt*/ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_HIGH_G_INTR, - v_accel_high_g_u8); + accel_high_g_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_HIGH_G_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13521,15 +13781,15 @@ u8 v_accel_high_g_u8) * @brief This API used to read the accel anymotion interrupt * from page one register from 0x10 bit 6 * - * @param v_accel_any_motion_u8 : The value of accel anymotion interrupt - * v_accel_any_motion_u8 | result + * @param accel_any_motion_u8 : The value of accel anymotion interrupt + * accel_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel anymotion interrupt * configure the following settings @@ -13548,34 +13808,34 @@ u8 v_accel_high_g_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_accel_any_motion( -u8 *v_accel_any_motion_u8) +u8 *accel_any_motion_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel anymotion interrupt is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel anymotion interrupt */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_any_motion_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_ANY_MOTION_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_any_motion_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_ANY_MOTION_INTR); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13584,15 +13844,15 @@ u8 *v_accel_any_motion_u8) * @brief This API used to write the accel anymotion interrupt * from page one register from 0x10 bit 6 * - * @param v_accel_any_motion_u8 : The value of accel anymotion interrupt - * v_accel_any_motion_u8 | result + * @param accel_any_motion_u8 : The value of accel anymotion interrupt + * accel_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel anymotion interrupt * configure the following settings @@ -13611,40 +13871,40 @@ u8 *v_accel_any_motion_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_accel_any_motion( -u8 v_accel_any_motion_u8) +u8 accel_any_motion_u8) { - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel range is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Write the value of accel anymotion interrupt */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_ACCEL_ANY_MOTION_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_ANY_MOTION_INTR, - v_accel_any_motion_u8); + accel_any_motion_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_ANY_MOTION_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13653,15 +13913,15 @@ u8 v_accel_any_motion_u8) * @brief This API used to read the accel nomotion interrupt * from page one register from 0x10 bit 6 * - * @param v_accel_nomotion_u8 : The value of accel nomotion interrupt - * v_accel_nomotion_u8 | result + * @param accel_nomotion_u8 : The value of accel nomotion interrupt + * accel_nomotion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel nomotion interrupt * configure the following settings @@ -13684,34 +13944,34 @@ u8 v_accel_any_motion_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_accel_no_motion( -u8 *v_accel_nomotion_u8) +u8 *accel_nomotion_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel nomotion interrupt is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel nomotion interrupt*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_NO_MOTION_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_nomotion_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_NO_MOTION_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_nomotion_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_NO_MOTION_INTR); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13720,15 +13980,15 @@ u8 *v_accel_nomotion_u8) * @brief This API used to write the accel nomotion interrupt * from page one register from 0x10 bit 6 * - * @param v_accel_nomotion_u8 : The value of accel nomotion interrupt - * v_accel_nomotion_u8 | result + * @param accel_nomotion_u8 : The value of accel nomotion interrupt + * accel_nomotion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel nomotion interrupt * configure the following settings @@ -13751,40 +14011,40 @@ u8 *v_accel_nomotion_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_accel_no_motion( -u8 v_accel_nomotion_u8) +u8 accel_nomotion_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel nomotion interrupt is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_NO_MOTION_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_ACCEL_NO_MOTION_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the value of accel nomotion interrupt */ - v_data_u8r = BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_NO_MOTION_INTR, - v_accel_nomotion_u8); + accel_nomotion_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_NO_MOTION_INTR__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_NO_MOTION_INTR_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13793,20 +14053,20 @@ if (p_bno055 == BNO055_ZERO_U8X) { * @brief This API used to read the accel any motion threshold * from page one register from 0x11 bit 0 to 7 * - * @param v_accel_any_motion_thres_u8 : The value of any motion threshold - * v_accel_any_motion_thres_u8 | result + * @param accel_any_motion_thres_u8 : The value of any motion threshold + * accel_any_motion_thres_u8 | result * ------------------------ | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel anymotion threshold dependent on the * range values * - * v_accel_range_u8 | threshold | LSB + * accel_range_u8 | threshold | LSB * ------------- | ------------- | --------- * 2g | 3.19mg | 1LSB * 4g | 7.81mg | 1LSB @@ -13815,34 +14075,35 @@ if (p_bno055 == BNO055_ZERO_U8X) { * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_any_motion_thres( -u8 *v_accel_any_motion_thres_u8) +u8 *accel_any_motion_thres_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel any motion threshold is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel any motion threshold */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_any_motion_thres_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_ANY_MOTION_THRES_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + *accel_any_motion_thres_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_ANY_MOTION_THRES); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13851,20 +14112,20 @@ u8 *v_accel_any_motion_thres_u8) * @brief This API used to write the accel any motion threshold * from page one register from 0x11 bit 0 to 7 * - * @param v_accel_any_motion_thres_u8 : The value of any motion threshold - * v_accel_any_motion_thres_u8 | result + * @param accel_any_motion_thres_u8 : The value of any motion threshold + * accel_any_motion_thres_u8 | result * ------------------------ | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel anymotion threshold dependent on the * range values * - * v_accel_range_u8 | threshold | LSB + * accel_range_u8 | threshold | LSB * ------------- | ------------- | --------- * 2g | 3.19mg | 1LSB * 4g | 7.81mg | 1LSB @@ -13873,108 +14134,109 @@ u8 *v_accel_any_motion_thres_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_any_motion_thres( -u8 v_accel_any_motion_thres_u8) +u8 accel_any_motion_thres_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_ACCEL_ANY_MOTION_THRES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the value of accel any motion threshold*/ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_ANY_MOTION_THRES, - v_accel_any_motion_thres_u8); + accel_any_motion_thres_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_ANY_MOTION_THRES_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the accel anymotion duration * from page one register from 0x12 bit 0 to 1 * - * @param v_accel_any_motion_durn_u8 : The value of accel anymotion duration - * v_accel_any_motion_durn_u8 | result + * @param accel_any_motion_durn_u8 : The value of accel anymotion duration + * accel_any_motion_durn_u8 | result * ------------------------- | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_any_motion_durn( -u8 *v_accel_any_motion_durn_u8) +u8 *accel_any_motion_durn_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel anymotion duration is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel anymotion duration */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_DURN_SET__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_any_motion_durn_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_ANY_MOTION_DURN_SET_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_any_motion_durn_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_ANY_MOTION_DURN_SET); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -13983,155 +14245,156 @@ u8 *v_accel_any_motion_durn_u8) * @brief This API used to write the accel anymotion duration * from page one register from 0x12 bit 0 to 1 * - * @param v_accel_any_motion_durn_u8 : The value of accel anymotion duration + * @param accel_any_motion_durn_u8 : The value of accel anymotion duration * - * v_accel_any_motion_durn_u8 | result + * accel_any_motion_durn_u8 | result * ------------------------- | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_any_motion_durn( -u8 v_accel_any_motion_durn_u8) +u8 accel_any_motion_durn_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_DURN_SET__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_ACCEL_ANY_MOTION_DURN_SET_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the value of accel anymotion duration*/ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_ANY_MOTION_DURN_SET, - v_accel_any_motion_durn_u8); + accel_any_motion_durn_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_DURN_SET__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_ANY_MOTION_DURN_SET_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the accel anymotion enable * from page one register from 0x12 bit 2 to 4 * - * @param v_data_u8 : The value of accel anymotion enable - * v_data_u8 | result + * @param data_u8 : The value of accel anymotion enable + * data_u8 | result * ------------ | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of accel anymotion axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of accel anymotion axis selection + * channel_u8 | value * -------------------------- | ---------- * BNO055_ACCEL_ANY_MOTION_NO_MOTION_X_AXIS | 0 * BNO055_ACCEL_ANY_MOTION_NO_MOTION_Y_AXIS | 1 * BNO055_ACCEL_ANY_MOTION_NO_MOTION_Y_AXIS | 2 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_any_motion_no_motion_axis_enable( -u8 v_channel_u8, u8 *v_data_u8) +u8 channel_u8, u8 *data_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel anymotion enable is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { - switch (v_channel_u8) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { + switch (channel_u8) { case BNO055_ACCEL_ANY_MOTION_NO_MOTION_X_AXIS: /* Read the value of accel anymotion x enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_X_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_ANY_MOTION_X_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_ANY_MOTION_X_AXIS); break; case BNO055_ACCEL_ANY_MOTION_NO_MOTION_Y_AXIS: /* Read the value of accel anymotion y enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_Y_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_ANY_MOTION_Y_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_ANY_MOTION_Y_AXIS); break; case BNO055_ACCEL_ANY_MOTION_NO_MOTION_Z_AXIS: /* Read the value of accel anymotion z enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_Z_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_ANY_MOTION_Z_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_ANY_MOTION_Z_AXIS); break; default: - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; break; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -14140,66 +14403,67 @@ u8 v_channel_u8, u8 *v_data_u8) * @brief This API used to write the accel anymotion enable * from page one register from 0x12 bit 2 to 4 * - * @param v_data_u8 : The value of accel anymotion enable - * v_data_u8 | result + * @param data_u8 : The value of accel anymotion enable + * data_u8 | result * ------------ | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of accel anymotion axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of accel anymotion axis selection + * channel_u8 | value * -------------------------- | ---------- * BNO055_ACCEL_ANY_MOTION_NO_MOTION_X_AXIS | 0 * BNO055_ACCEL_ANY_MOTION_NO_MOTION_Y_AXIS | 1 * BNO055_ACCEL_ANY_MOTION_NO_MOTION_Y_AXIS | 2 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_any_motion_no_motion_axis_enable( -u8 v_channel_u8, u8 v_data_u8) +u8 channel_u8, u8 data_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - switch (v_channel_u8) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + switch (channel_u8) { case BNO055_ACCEL_ANY_MOTION_NO_MOTION_X_AXIS: /* Write the value of accel anymotion x enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_X_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_ACCEL_ANY_MOTION_X_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_ACCEL_ANY_MOTION_X_AXIS, - v_data_u8); + data_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_X_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_ANY_MOTION_X_AXIS_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } break; case BNO055_ACCEL_ANY_MOTION_NO_MOTION_Y_AXIS: @@ -14207,18 +14471,19 @@ if (v_stat_s8 == SUCCESS) { accel anymotion y enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_Y_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_ACCEL_ANY_MOTION_Y_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_ACCEL_ANY_MOTION_Y_AXIS, - v_data_u8); + data_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_Y_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_ANY_MOTION_Y_AXIS_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } break; case BNO055_ACCEL_ANY_MOTION_NO_MOTION_Z_AXIS: @@ -14226,119 +14491,120 @@ if (v_stat_s8 == SUCCESS) { accel anymotion z enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_Z_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_ACCEL_ANY_MOTION_Z_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_ACCEL_ANY_MOTION_Z_AXIS, - v_data_u8); + data_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_ANY_MOTION_Z_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_ANY_MOTION_Z_AXIS_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } break; default: - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; break; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the accel highg enable * from page one register from 0x12 bit 5 to 7 * - * @param v_data_u8 : The value of accel highg enable - * v_data_u8| result + * @param data_u8 : The value of accel highg enable + * data_u8| result * ------------ | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of accel highg axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of accel highg axis selection + * channel_u8 | value * -------------------------- | ---------- * BNO055_ACCEL_HIGH_G_X_AXIS | 0 * BNO055_ACCEL_HIGH_G_Y_AXIS | 1 * BNO055_ACCEL_HIGH_G_Z_AXIS | 2 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_high_g_axis_enable( -u8 v_channel_u8, u8 *v_data_u8) +u8 channel_u8, u8 *data_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel highg enable is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { - switch (v_channel_u8) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { + switch (channel_u8) { case BNO055_ACCEL_HIGH_G_X_AXIS: /* Read the value of accel x highg enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_X_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_HIGH_G_X_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_HIGH_G_X_AXIS); break; case BNO055_ACCEL_HIGH_G_Y_AXIS: /* Read the value of accel y highg enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_Y_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_HIGH_G_Y_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_HIGH_G_Y_AXIS); break; case BNO055_ACCEL_HIGH_G_Z_AXIS: /* Read the value of accel z highg enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_Z_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_HIGH_G_Z_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_HIGH_G_Z_AXIS); break; default: - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; break; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -14347,65 +14613,67 @@ u8 v_channel_u8, u8 *v_data_u8) * @brief This API used to write the accel highg enable * from page one register from 0x12 bit 5 to 7 * - * @param v_data_u8 : The value of accel highg enable - * v_data_u8| result + * @param data_u8 : The value of accel highg enable + * data_u8| result * ------------ | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of accel highg axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of accel highg axis selection + * channel_u8 | value * -------------------------- | ---------- * BNO055_ACCEL_HIGH_G_X_AXIS | 0 * BNO055_ACCEL_HIGH_G_Y_AXIS | 1 * BNO055_ACCEL_HIGH_G_Z_AXIS | 2 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_high_g_axis_enable( -u8 v_channel_u8, u8 v_data_u8) +u8 channel_u8, u8 data_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - switch (v_channel_u8) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + switch (channel_u8) { case BNO055_ACCEL_HIGH_G_X_AXIS: /* Write the value of accel x highg enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_X_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, - BNO055_ACCEL_HIGH_G_X_AXIS, v_data_u8); + BNO055_ACCEL_HIGH_G_X_AXIS_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, + BNO055_ACCEL_HIGH_G_X_AXIS, data_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_X_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_HIGH_G_X_AXIS_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } break; case BNO055_ACCEL_HIGH_G_Y_AXIS: @@ -14413,18 +14681,19 @@ if (v_stat_s8 == SUCCESS) { accel y highg enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_Y_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_ACCEL_HIGH_G_Y_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_HIGH_G_Y_AXIS, - v_data_u8); + data_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_Y_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_HIGH_G_Y_AXIS_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } break; case BNO055_ACCEL_HIGH_G_Z_AXIS: @@ -14432,49 +14701,50 @@ if (v_stat_s8 == SUCCESS) { accel z highg enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_Z_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, - BNO055_ACCEL_HIGH_G_Z_AXIS, v_data_u8); + BNO055_ACCEL_HIGH_G_Z_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, + BNO055_ACCEL_HIGH_G_Z_AXIS, data_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_Z_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_HIGH_G_Z_AXIS_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } break; default: - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; break; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the accel highg duration * from page one register from 0x13 bit 0 to 7 * - * @param v_accel_high_g_durn_u8 : The value of accel highg duration + * @param accel_high_g_durn_u8 : The value of accel highg duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The high-g interrupt trigger delay according * to [highg duration + 1] * 2 ms @@ -14483,34 +14753,34 @@ return com_rslt; * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_high_g_durn( -u8 *v_accel_high_g_durn_u8) +u8 *accel_high_g_durn_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel highg duration is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel highg duration*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_high_g_durn_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_HIGH_G_DURN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_high_g_durn_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_HIGH_G_DURN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -14519,11 +14789,11 @@ u8 *v_accel_high_g_durn_u8) * @brief This API used to write the accel highg duration * from page one register from 0x13 bit 0 to 7 * - * @param v_accel_high_g_durn_u8 : The value of accel highg duration + * @param accel_high_g_durn_u8 : The value of accel highg duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The high-g interrupt trigger delay according * to [highg duration + 1] * 2 ms @@ -14532,79 +14802,82 @@ u8 *v_accel_high_g_durn_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_high_g_durn( -u8 v_accel_high_g_durn_u8) +u8 accel_high_g_durn_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id( + BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_ACCEL_HIGH_G_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the value of accel highg duration*/ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_HIGH_G_DURN, - v_accel_high_g_durn_u8); + accel_high_g_durn_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_HIGH_G_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the accel highg threshold * from page one register from 0x14 bit 0 to 7 * - * @param v_accel_high_g_thres_u8 : The value of accel highg threshold + * @param accel_high_g_thres_u8 : The value of accel highg threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel highg interrupt threshold dependent * for accel g range * - * v_accel_range_u8 | threshold | LSB + * accel_range_u8 | threshold | LSB * ------------- | ------------- | --------- * 2g | 7.81mg | 1LSB * 4g | 15.63mg | 1LSB @@ -14613,34 +14886,34 @@ if (p_bno055 == BNO055_ZERO_U8X) { * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_high_g_thres( -u8 *v_accel_high_g_thres_u8) +u8 *accel_high_g_thres_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, highg threshold is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of highg threshold */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_high_g_thres_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_HIGH_G_THRES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_high_g_thres_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_HIGH_G_THRES); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -14649,16 +14922,16 @@ u8 *v_accel_high_g_thres_u8) * @brief This API used to write the accel highg threshold * from page one register from 0x14 bit 0 to 7 * - * @param v_accel_high_g_thres_u8 : The value of accel highg threshold + * @param accel_high_g_thres_u8 : The value of accel highg threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel highg interrupt threshold dependent * for accel g range * - * v_accel_range_u8 | threshold | LSB + * accel_range_u8 | threshold | LSB * ------------- | ------------- | --------- * 2g | 7.81mg | 1LSB * 4g | 15.63mg | 1LSB @@ -14667,79 +14940,82 @@ u8 *v_accel_high_g_thres_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_high_g_thres( -u8 v_accel_high_g_thres_u8) +u8 accel_high_g_thres_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id( + BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_ACCEL_HIGH_G_THRES_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Write the value of accel highg threshold */ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_HIGH_G_THRES, - v_accel_high_g_thres_u8); + accel_high_g_thres_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_HIGH_G_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_HIGH_G_THRES_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the accel slownomotion threshold * from page one register from 0x15 bit 0 to 7 * - * @param v_accel_slow_no_motion_thres_u8 : + * @param accel_slow_no_motion_thres_u8 : * The value of accel slownomotion threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel slow no motion interrupt threshold dependent * for accel g range * - * v_accel_range_u8 | threshold | LSB + * accel_range_u8 | threshold | LSB * ------------- | ------------- | --------- * 2g | 3.19mg | 1LSB * 4g | 7.81mg | 1LSB @@ -14747,34 +15023,34 @@ if (p_bno055 == BNO055_ZERO_U8X) { * 16g | 31.25mg | 1LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_slow_no_motion_thres( -u8 *v_accel_slow_no_motion_thres_u8) +u8 *accel_slow_no_motion_thres_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel slownomotion threshold is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of slownomotion threshold */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLOW_NO_MOTION_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_slow_no_motion_thres_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_SLOW_NO_MOTION_THRES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_slow_no_motion_thres_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_SLOW_NO_MOTION_THRES); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -14783,17 +15059,17 @@ u8 *v_accel_slow_no_motion_thres_u8) * @brief This API used to write the accel slownomotion threshold * from page one register from 0x15 bit 0 to 7 * - * @param v_accel_slow_no_motion_thres_u8 : + * @param accel_slow_no_motion_thres_u8 : * The value of accel slownomotion threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel slow no motion interrupt threshold dependent * for accel g range * - * v_accel_range_u8 | threshold | LSB + * accel_range_u8 | threshold | LSB * ------------- | ------------- | --------- * 2g | 3.19mg | 1LSB * 4g | 7.81mg | 1LSB @@ -14801,107 +15077,108 @@ u8 *v_accel_slow_no_motion_thres_u8) * 16g | 31.25mg | 1LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_slow_no_motion_thres( -u8 v_accel_slow_no_motion_thres_u8) +u8 accel_slow_no_motion_thres_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of slownomotion threshold */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLOW_NO_MOTION_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_ACCEL_SLOW_NO_MOTION_THRES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_SLOW_NO_MOTION_THRES, - v_accel_slow_no_motion_thres_u8); + accel_slow_no_motion_thres_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLOW_NO_MOTION_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_SLOW_NO_MOTION_THRES_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read accel slownomotion enable * from page one register from 0x16 bit 0 * - * @param v_accel_slow_no_motion_en_u8 : The value of accel slownomotion enable - * v_accel_slow_no_motion_en_u8 | result + * @param accel_slow_no_motion_en_u8 : The value of accel slownomotion enable + * accel_slow_no_motion_en_u8 | result * ------------------------ | -------- * 0x01 | Slow motion * 0x00 | No motion * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_slow_no_motion_enable( -u8 *v_accel_slow_no_motion_en_u8) +u8 *accel_slow_no_motion_en_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel slownomotion enable is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of accel slownomotion enable */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLOW_NO_MOTION_ENABLE__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_slow_no_motion_en_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_SLOW_NO_MOTION_ENABLE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_slow_no_motion_en_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_SLOW_NO_MOTION_ENABLE); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -14910,116 +15187,117 @@ u8 *v_accel_slow_no_motion_en_u8) * @brief This API used to write accel slownomotion enable * from page one register from 0x16 bit 0 * - * @param v_accel_slow_no_motion_en_u8 : The value of accel slownomotion enable - * v_accel_slow_no_motion_en_u8 | result + * @param accel_slow_no_motion_en_u8 : The value of accel slownomotion enable + * accel_slow_no_motion_en_u8 | result * ------------------------ | -------- * 0x01 | Slow motion * 0x00 | No motion * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_slow_no_motion_enable( -u8 v_accel_slow_no_motion_en_u8) +u8 accel_slow_no_motion_en_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLOW_NO_MOTION_ENABLE__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_ACCEL_SLOW_NO_MOTION_ENABLE_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /* Read the value of accel slownomotion enable */ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_SLOW_NO_MOTION_ENABLE, - v_accel_slow_no_motion_en_u8); + accel_slow_no_motion_en_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLOW_NO_MOTION_ENABLE__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_SLOW_NO_MOTION_ENABLE_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read accel slownomotion duration * from page one register from 0x16 bit 1 to 6 * - * @param v_accel_slow_no_motion_durn_u8 : + * @param accel_slow_no_motion_durn_u8 : * The value of accel slownomotion duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_slow_no_motion_durn( -u8 *v_accel_slow_no_motion_durn_u8) +u8 *accel_slow_no_motion_durn_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, accel slownomotion duration is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /*read value of accel slownomotion duration*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLOW_NO_MOTION_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_accel_slow_no_motion_durn_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_ACCEL_SLOW_NO_MOTION_DURN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *accel_slow_no_motion_durn_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_ACCEL_SLOW_NO_MOTION_DURN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -15028,83 +15306,85 @@ u8 *v_accel_slow_no_motion_durn_u8) * @brief This API used to write accel slownomotion duration * from page one register from 0x16 bit 1 to 6 * - * @param v_accel_slow_no_motion_durn_u8 : + * @param accel_slow_no_motion_durn_u8 : * The value of accel slownomotion duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_slow_no_motion_durn( -u8 v_accel_slow_no_motion_durn_u8) +u8 accel_slow_no_motion_durn_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLOW_NO_MOTION_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { + BNO055_ACCEL_SLOW_NO_MOTION_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { /*Write the value of accel slownomotion duration*/ - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_ACCEL_SLOW_NO_MOTION_DURN, - v_accel_slow_no_motion_durn_u8); + accel_slow_no_motion_durn_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_ACCEL_SLOW_NO_MOTION_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_ACCEL_SLOW_NO_MOTION_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the gyro anymotion enable * from page one register from 0x17 bit 0 to 2 * - * @param v_data_u8 : The value of gyro anymotion enable - * v_data_u8 | result + * @param data_u8 : The value of gyro anymotion enable + * data_u8 | result * ----------------- |------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of gyro anymotion axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of gyro anymotion axis selection + * channel_u8 | value * --------------------------- | ---------- * BNO055_GYRO_ANY_MOTIONX_AXIS | 0 * BNO055_GYRO_ANY_MOTIONY_AXIS | 1 @@ -15112,67 +15392,67 @@ return com_rslt; * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_any_motion_axis_enable( -u8 v_channel_u8, u8 *v_data_u8) +u8 channel_u8, u8 *data_u8) { /* Variable used to return value of communication routine*/ -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro anymotion axis is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { - switch (v_channel_u8) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { + switch (channel_u8) { case BNO055_GYRO_ANY_MOTION_X_AXIS: /* Read the gyro anymotion x enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_X_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_ANY_MOTION_X_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_ANY_MOTION_X_AXIS); break; case BNO055_GYRO_ANY_MOTION_Y_AXIS: /* Read the gyro anymotion y enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_Y_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_ANY_MOTION_Y_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_ANY_MOTION_Y_AXIS); break; case BNO055_GYRO_ANY_MOTION_Z_AXIS: /* Read the gyro anymotion z enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_Z_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_ANY_MOTION_Z_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_ANY_MOTION_Z_AXIS); break; default: - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; break; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -15181,67 +15461,67 @@ return com_rslt; * @brief This API used to write the gyro anymotion enable * from page one register from 0x17 bit 0 to 2 * - * @param v_data_u8 : The value of gyro anymotion enable - * v_data_u8 | result + * @param data_u8 : The value of gyro anymotion enable + * data_u8 | result * ----------------- |------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of gyro anymotion axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of gyro anymotion axis selection + * channel_u8 | value * --------------------------- | ---------- * BNO055_GYRO_ANY_MOTIONX_AXIS | 0 * BNO055_GYRO_ANY_MOTIONY_AXIS | 1 * BNO055_GYRO_ANY_MOTIONZ_AXIS | 2 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_any_motion_axis_enable( -u8 v_channel_u8, u8 v_data_u8) +u8 channel_u8, u8 data_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - switch (v_channel_u8) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + switch (channel_u8) { case BNO055_GYRO_ANY_MOTION_X_AXIS: /* Write the gyro anymotion x enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_X_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_GYRO_ANY_MOTION_X_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_GYRO_ANY_MOTION_X_AXIS, - v_data_u8); + data_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_X_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_ANY_MOTION_X_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } break; case BNO055_GYRO_ANY_MOTION_Y_AXIS: @@ -15250,17 +15530,17 @@ if (v_stat_s8 == SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_Y_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, - BNO055_GYRO_ANY_MOTION_Y_AXIS, v_data_u8); + BNO055_GYRO_ANY_MOTION_Y_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, + BNO055_GYRO_ANY_MOTION_Y_AXIS, data_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_Y_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_ANY_MOTION_Y_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } break; case BNO055_GYRO_ANY_MOTION_Z_AXIS: @@ -15269,52 +15549,52 @@ if (v_stat_s8 == SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_Z_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, + BNO055_GYRO_ANY_MOTION_Z_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, BNO055_GYRO_ANY_MOTION_Z_AXIS, - v_data_u8); + data_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_Z_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_ANY_MOTION_Z_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); } break; default: - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; break; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { -com_rslt = ERROR; +com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read the gyro highrate enable * from page one register from 0x17 bit 3 to 5 * - * @param v_data_u8 : The value of gyro highrate enable - * v_data_u8 | result + * @param data_u8 : The value of gyro highrate enable + * data_u8 | result * ---------------- |------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of gyro highrate axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of gyro highrate axis selection + * channel_u8 | value * ------------------------ | ---------- * BNO055_GYRO_HIGHRATE_X_AXIS | 0 * BNO055_GYRO_HIGHRATE_Y_AXIS | 1 @@ -15322,67 +15602,67 @@ return com_rslt; * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_axis_enable( -u8 v_channel_u8, u8 *v_data_u8) +u8 channel_u8, u8 *data_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate enable is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { - switch (v_channel_u8) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { + switch (channel_u8) { case BNO055_GYRO_HIGHRATE_X_AXIS: /* Read the gyro highrate x enable */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_X_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_X_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_X_AXIS); break; case BNO055_GYRO_HIGHRATE_Y_AXIS: /* Read the gyro highrate y enable */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Y_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Y_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Y_AXIS); break; case BNO055_GYRO_HIGHRATE_Z_AXIS: /* Read the gyro highrate z enable */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Z_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_data_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Z_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *data_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Z_AXIS); break; default: - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; break; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -15391,65 +15671,66 @@ u8 v_channel_u8, u8 *v_data_u8) * @brief This API used to write the gyro highrate enable * from page one register from 0x17 bit 3 to 5 * - * @param v_data_u8 : The value of gyro highrate enable - * v_data_u8 | result + * @param data_u8 : The value of gyro highrate enable + * data_u8 | result * ---------------- |------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of gyro highrate axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of gyro highrate axis selection + * channel_u8 | value * ------------------------ | ---------- * BNO055_GYRO_HIGHRATE_X_AXIS | 0 * BNO055_GYRO_HIGHRATE_Y_AXIS | 1 * BNO055_GYRO_HIGHRATE_Z_AXIS | 2 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_axis_enable( -u8 v_channel_u8, u8 v_data_u8) +u8 channel_u8, u8 data_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { - switch (v_channel_u8) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { + switch (channel_u8) { case BNO055_GYRO_HIGHRATE_X_AXIS: /* Write the value of gyro highrate x enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_X_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, - BNO055_GYRO_HIGHRATE_X_AXIS, v_data_u8); + BNO055_GYRO_HIGHRATE_X_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, + BNO055_GYRO_HIGHRATE_X_AXIS, data_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_X_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_X_AXIS_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } break; case BNO055_GYRO_HIGHRATE_Y_AXIS: @@ -15457,18 +15738,19 @@ if (v_stat_s8 == SUCCESS) { gyro highrate y enable*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Y_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = + BNO055_GYRO_HIGHRATE_Y_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE( - v_data_u8r, - BNO055_GYRO_HIGHRATE_Y_AXIS, v_data_u8); + data_u8r, + BNO055_GYRO_HIGHRATE_Y_AXIS, data_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Y_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_Y_AXIS_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } break; case BNO055_GYRO_HIGHRATE_Z_AXIS: @@ -15477,84 +15759,85 @@ if (v_stat_s8 == SUCCESS) { com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Z_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = BNO055_SET_BITSLICE - (v_data_u8r, - BNO055_GYRO_HIGHRATE_Z_AXIS, v_data_u8); + BNO055_GYRO_HIGHRATE_Z_AXIS_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = BNO055_SET_BITSLICE + (data_u8r, + BNO055_GYRO_HIGHRATE_Z_AXIS, data_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Z_AXIS__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_Z_AXIS_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } break; default: - com_rslt = E_BNO055_OUT_OF_RANGE; + com_rslt = BNO055_OUT_OF_RANGE; break; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro anymotion filter * from page one register from 0x17 bit 6 * - * @param v_gyro_any_motion_filter_u8 : The value of gyro anymotion filter - * v_gyro_any_motion_filter_u8 | result + * @param gyro_any_motion_filter_u8 : The value of gyro anymotion filter + * gyro_any_motion_filter_u8 | result * --------------------------- |------------ - * 0x00 | FILTERED - * 0x01 | UNFILTERED + * 0x00 | BNO055_GYRO_FILTERED_CONFIG + * 0x01 | BNO055_GYRO_UNFILTERED_CONFIG * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_any_motion_filter( -u8 *v_gyro_any_motion_filter_u8) +u8 *gyro_any_motion_filter_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro anymotion filter is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro anymotion filter*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_FILTER__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_any_motion_filter_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_ANY_MOTION_FILTER_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_any_motion_filter_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_ANY_MOTION_FILTER); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -15563,119 +15846,120 @@ u8 *v_gyro_any_motion_filter_u8) * @brief This API used to write gyro anymotion filter * from page one register from 0x17 bit 6 * - * @param v_gyro_any_motion_filter_u8 : The value of gyro anymotion filter - * v_gyro_any_motion_filter_u8 | result + * @param gyro_any_motion_filter_u8 : The value of gyro anymotion filter + * gyro_any_motion_filter_u8 | result * --------------------------- |------------ - * 0x00 | FILTERED - * 0x01 | UNFILTERED + * 0x00 | BNO055_GYRO_FILTERED_CONFIG + * 0x01 | BNO055_GYRO_UNFILTERED_CONFIG * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_any_motion_filter( -u8 v_gyro_any_motion_filter_u8) +u8 gyro_any_motion_filter_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro anymotion filter*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_FILTER__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_ANY_MOTION_FILTER_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_ANY_MOTION_FILTER, - v_gyro_any_motion_filter_u8); + gyro_any_motion_filter_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_FILTER__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_ANY_MOTION_FILTER_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro highrate filter * from page one register from 0x17 bit 7 * - * @param v_gyro_highrate_filter_u8 : The value of gyro highrate filter - * v_gyro_highrate_filter_u8 | result + * @param gyro_highrate_filter_u8 : The value of gyro highrate filter + * gyro_highrate_filter_u8 | result * --------------------------- |------------ - * 0x00 | FILTERED - * 0x01 | UNFILTERED + * 0x00 | BNO055_GYRO_FILTERED_CONFIG + * 0x01 | BNO055_GYRO_UNFILTERED_CONFIG * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_filter( -u8 *v_gyro_highrate_filter_u8) +u8 *gyro_highrate_filter_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate filter is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro highrate filter */ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_FILTER__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_filter_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_FILTER_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_filter_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_FILTER); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -15684,91 +15968,92 @@ u8 *v_gyro_highrate_filter_u8) * @brief This API used to write gyro highrate filter * from page one register from 0x17 bit 7 * - * @param v_gyro_highrate_filter_u8 : The value of gyro highrate filter - * v_gyro_highrate_filter_u8 | result + * @param gyro_highrate_filter_u8 : The value of gyro highrate filter + * gyro_highrate_filter_u8 | result * --------------------------- |------------ - * 0x00 | FILTERED - * 0x01 | UNFILTERED + * 0x00 | BNO055_GYRO_FILTERED_CONFIG + * 0x01 | BNO055_GYRO_UNFILTERED_CONFIG * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_filter( -u8 v_gyro_highrate_filter_u8) +u8 gyro_highrate_filter_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro highrate filter*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_FILTER__REG, - &v_data_u8r, - BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_FILTER_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_FILTER, - v_gyro_highrate_filter_u8); + gyro_highrate_filter_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_FILTER__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_FILTER_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro highrate x threshold * from page one register from 0x18 bit 0 to 4 * - * @param v_gyro_highrate_x_thres_u8 : The value of gyro x highrate threshold + * @param gyro_highrate_x_thres_u8 : The value of gyro x highrate threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate threshold dependent on the * selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 62.5dps | 1LSB * 1000 | 31.25dps | 1LSB @@ -15777,34 +16062,34 @@ return com_rslt; * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_x_thres( -u8 *v_gyro_highrate_x_thres_u8) +u8 *gyro_highrate_x_thres_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate x threshold is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro highrate threshold*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_X_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_x_thres_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_X_THRES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_x_thres_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_X_THRES); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -15813,16 +16098,16 @@ u8 *v_gyro_highrate_x_thres_u8) * @brief This API used to write gyro highrate x threshold * from page one register from 0x18 bit 0 to 4 * - * @param v_gyro_highrate_x_thres_u8 : The value of gyro x highrate threshold + * @param gyro_highrate_x_thres_u8 : The value of gyro x highrate threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate threshold dependent on the * selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 62.5dps | 1LSB * 1000 | 31.25dps | 1LSB @@ -15831,80 +16116,81 @@ u8 *v_gyro_highrate_x_thres_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_x_thres( -u8 v_gyro_highrate_x_thres_u8) +u8 gyro_highrate_x_thres_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro highrate x threshold*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_X_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_X_THRES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_X_THRES, - v_gyro_highrate_x_thres_u8); + gyro_highrate_x_thres_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_X_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_X_THRES_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro highrate x hysteresis * from page one register from 0x18 bit 5 to 6 * - * @param v_gyro_highrate_x_hyst_u8 : The value of gyro highrate x hysteresis + * @param gyro_highrate_x_hyst_u8 : The value of gyro highrate x hysteresis * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro high rate hysteresis calculated by * - * using this (255 + 256 * v_gyro_highrate_x_hyst_u8) *4 LSB + * using this (255 + 256 * gyro_highrate_x_hyst_u8) *4 LSB * * The high rate value scales with the range setting * - * v_gyro_range_u8 | hysteresis | LSB + * gyro_range_u8 | hysteresis | LSB * ----------------- | ------------- | --------- * 2000 | 62.26dps | 1LSB * 1000 | 31.13dps | 1LSB @@ -15912,34 +16198,34 @@ return com_rslt; * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_x_hyst( -u8 *v_gyro_highrate_x_hyst_u8) +u8 *gyro_highrate_x_hyst_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page,gyro highrate x hysteresis is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro highrate x hysteresis*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_X_HYST__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_x_hyst_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_X_HYST_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_x_hyst_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_X_HYST); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -15948,19 +16234,19 @@ u8 *v_gyro_highrate_x_hyst_u8) * @brief This API used to write gyro highrate x hysteresis * from page one register from 0x18 bit 5 to 6 * - * @param v_gyro_highrate_x_hyst_u8 : The value of gyro highrate x hysteresis + * @param gyro_highrate_x_hyst_u8 : The value of gyro highrate x hysteresis * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro high rate hysteresis calculated by * - * using this (255 + 256 * v_gyro_highrate_x_hyst_u8) *4 LSB + * using this (255 + 256 * gyro_highrate_x_hyst_u8) *4 LSB * * The high rate value scales with the range setting * - * v_gyro_range_u8 | hysteresis | LSB + * gyro_range_u8 | hysteresis | LSB * ----------------- | ------------- | --------- * 2000 | 62.26dps | 1LSB * 1000 | 31.13dps | 1LSB @@ -15968,107 +16254,108 @@ u8 *v_gyro_highrate_x_hyst_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_x_hyst( -u8 v_gyro_highrate_x_hyst_u8) +u8 gyro_highrate_x_hyst_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /*Write the value of gyro highrate x hysteresis*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_X_HYST__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_X_HYST_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_X_HYST, - v_gyro_highrate_x_hyst_u8); + gyro_highrate_x_hyst_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_X_HYST__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_X_HYST_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro highrate x duration * from page one register from 0x19 bit 0 to 7 * - * @param v_gyro_highrate_x_durn_u8 : The value of gyro highrate x duration + * @param gyro_highrate_x_durn_u8 : The value of gyro highrate x duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate duration calculate by using the formula * - * (1 + v_gyro_highrate_x_durn_u8)*2.5ms + * (1 + gyro_highrate_x_durn_u8)*2.5ms * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_x_durn( -u8 *v_gyro_highrate_x_durn_u8) +u8 *gyro_highrate_x_durn_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate x duration is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro highrate x duration*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_X_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_x_durn_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_X_DURN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_x_durn_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_X_DURN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -16077,88 +16364,90 @@ u8 *v_gyro_highrate_x_durn_u8) * @brief This API used to write gyro highrate x duration * from page one register from 0x19 bit 0 to 7 * - * @param v_gyro_highrate_x_durn_u8 : The value of gyro highrate x duration + * @param gyro_highrate_x_durn_u8 : The value of gyro highrate x duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate duration calculate by using the formula * - * (1 + v_gyro_highrate_x_durn_u8)*2.5ms + * (1 + gyro_highrate_x_durn_u8)*2.5ms */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_x_durn( -u8 v_gyro_highrate_x_durn_u8) +u8 gyro_highrate_x_durn_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro highrate x duration*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_X_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_X_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_X_DURN, - v_gyro_highrate_x_durn_u8); + gyro_highrate_x_durn_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_X_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_X_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro highrate y threshold * from page one register from 0x1A bit 0 to 4 * - * @param v_gyro_highrate_y_thres_u8 : The value of gyro highrate y threshold + * @param gyro_highrate_y_thres_u8 : The value of gyro highrate y threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate threshold dependent on the * selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 62.5dps | 1LSB * 1000 | 31.25dps | 1LSB @@ -16167,34 +16456,34 @@ if (v_stat_s8 == SUCCESS) { * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_y_thres( -u8 *v_gyro_highrate_y_thres_u8) +u8 *gyro_highrate_y_thres_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate y threshold is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro highrate y threshold*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Y_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_y_thres_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Y_THRES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_y_thres_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Y_THRES); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -16203,16 +16492,16 @@ u8 *v_gyro_highrate_y_thres_u8) * @brief This API used to write gyro highrate y threshold * from page one register from 0x1A bit 0 to 4 * - * @param v_gyro_highrate_y_thres_u8 : The value of gyro highrate y threshold + * @param gyro_highrate_y_thres_u8 : The value of gyro highrate y threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate threshold dependent on the * selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 62.5dps | 1LSB * 1000 | 31.25dps | 1LSB @@ -16221,114 +16510,115 @@ u8 *v_gyro_highrate_y_thres_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_y_thres( -u8 v_gyro_highrate_y_thres_u8) +u8 gyro_highrate_y_thres_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro highrate y threshold*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Y_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Y_THRES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Y_THRES, - v_gyro_highrate_y_thres_u8); + gyro_highrate_y_thres_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Y_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_Y_THRES_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro highrate y hysteresis * from page one register from 0x1A bit 5 to 6 * - * @param v_gyro_highrate_y_hyst_u8 : The value of gyro highrate y hysteresis + * @param gyro_highrate_y_hyst_u8 : The value of gyro highrate y hysteresis * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro high rate hysteresis calculated by * - * using this (255 + 256 * v_gyro_highrate_y_hyst_u8) *4 LSB + * using this (255 + 256 * gyro_highrate_y_hyst_u8) *4 LSB * * The high rate value scales with the range setting * - * v_gyro_range_u8 | hysteresis | LSB + * gyro_range_u8 | hysteresis | LSB * ----------------- | ------------- | --------- * 2000 | 62.26dps | 1LSB * 1000 | 31.13dps | 1LSB * 500 | 15.56dps | 1LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_y_hyst( -u8 *v_gyro_highrate_y_hyst_u8) +u8 *gyro_highrate_y_hyst_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate y hysteresis is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro highrate y hysteresis*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Y_HYST__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_y_hyst_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Y_HYST_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_y_hyst_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Y_HYST); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -16337,125 +16627,126 @@ u8 *v_gyro_highrate_y_hyst_u8) * @brief This API used to write gyro highrate y hysteresis * from page one register from 0x1A bit 5 to 6 * - * @param v_gyro_highrate_y_hyst_u8 : The value of gyro highrate y hysteresis + * @param gyro_highrate_y_hyst_u8 : The value of gyro highrate y hysteresis * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro high rate hysteresis calculated by * - * using this (255 + 256 * v_gyro_highrate_y_hyst_u8) *4 LSB + * using this (255 + 256 * gyro_highrate_y_hyst_u8) *4 LSB * * The high rate value scales with the range setting * - * v_gyro_range_u8 | hysteresis | LSB + * gyro_range_u8 | hysteresis | LSB * ----------------- | ------------- | --------- * 2000 | 62.26dps | 1LSB * 1000 | 31.13dps | 1LSB * 500 | 15.56dps | 1LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_y_hyst( -u8 v_gyro_highrate_y_hyst_u8) +u8 gyro_highrate_y_hyst_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro highrate y hysteresis*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Y_HYST__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Y_HYST_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Y_HYST, - v_gyro_highrate_y_hyst_u8); + gyro_highrate_y_hyst_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Y_HYST__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_Y_HYST_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro highrate y duration * from page one register from 0x1B bit 0 to 7 * - * @param v_gyro_highrate_y_durn_u8 : The value of gyro highrate y duration + * @param gyro_highrate_y_durn_u8 : The value of gyro highrate y duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate duration calculate by using the formula * - * (1 + v_gyro_highrate_y_durn_u8)*2.5ms + * (1 + gyro_highrate_y_durn_u8)*2.5ms */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_y_durn( -u8 *v_gyro_highrate_y_durn_u8) +u8 *gyro_highrate_y_durn_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate y duration is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro highrate y duration*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Y_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_y_durn_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Y_DURN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_y_durn_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Y_DURN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -16464,89 +16755,90 @@ u8 *v_gyro_highrate_y_durn_u8) * @brief This API used to write gyro highrate y duration * from page one register from 0x1B bit 0 to 7 * - * @param v_gyro_highrate_y_durn_u8 : The value of gyro highrate y duration + * @param gyro_highrate_y_durn_u8 : The value of gyro highrate y duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate duration calculate by using the formula * - * (1 + v_gyro_highrate_y_durn_u8)*2.5ms + * (1 + gyro_highrate_y_durn_u8)*2.5ms */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_y_durn( -u8 v_gyro_highrate_y_durn_u8) +u8 gyro_highrate_y_durn_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro highrate y duration*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Y_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Y_DURN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Y_DURN, - v_gyro_highrate_y_durn_u8); + gyro_highrate_y_durn_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Y_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_Y_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro highrate z threshold * from page one register from 0x1C bit 0 to 4 * - * @param v_gyro_highrate_z_thres_u8 : The value of gyro highrate z threshold + * @param gyro_highrate_z_thres_u8 : The value of gyro highrate z threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate threshold dependent on the * selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 62.5dps | 1LSB * 1000 | 31.25dps | 1LSB @@ -16555,34 +16847,34 @@ if (v_stat_s8 == SUCCESS) { * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_z_thres( -u8 *v_gyro_highrate_z_thres_u8) +u8 *gyro_highrate_z_thres_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate z threshold is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro highrate z threshold*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Z_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_z_thres_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Z_THRES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_z_thres_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Z_THRES); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -16591,16 +16883,16 @@ u8 *v_gyro_highrate_z_thres_u8) * @brief This API used to write gyro highrate z threshold * from page one register from 0x1C bit 0 to 4 * - * @param v_gyro_highrate_z_thres_u8 : The value of gyro highrate z threshold + * @param gyro_highrate_z_thres_u8 : The value of gyro highrate z threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate threshold dependent on the * selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 62.5dps | 1LSB * 1000 | 31.25dps | 1LSB @@ -16609,114 +16901,116 @@ u8 *v_gyro_highrate_z_thres_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_z_thres( -u8 v_gyro_highrate_z_thres_u8) +u8 gyro_highrate_z_thres_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro highrate z threshold*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Z_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Z_THRES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Z_THRES, - v_gyro_highrate_z_thres_u8); + gyro_highrate_z_thres_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Z_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_Z_THRES_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro highrate z hysteresis * from page one register from 0x1C bit 5 to 6 * - * @param v_gyro_highrate_z_hyst_u8 : The value of gyro highrate z hysteresis + * @param gyro_highrate_z_hyst_u8 : The value of gyro highrate z hysteresis * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro high rate hysteresis calculated by * - * using this (255 + 256 * v_gyro_highrate_z_hyst_u8) *4 LSB + * using this (255 + 256 * gyro_highrate_z_hyst_u8) *4 LSB * * The high rate value scales with the range setting * - * v_gyro_range_u8 | hysteresis | LSB + * gyro_range_u8 | hysteresis | LSB * ----------------- | ------------- | --------- * 2000 | 62.26dps | 1LSB * 1000 | 31.13dps | 1LSB * 500 | 15.56dps | 1LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_z_hyst( -u8 *v_gyro_highrate_z_hyst_u8) +u8 *gyro_highrate_z_hyst_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate z hysteresis is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro highrate z hysteresis*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Z_HYST__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_z_hyst_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Z_HYST_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_z_hyst_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Z_HYST); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -16725,125 +17019,127 @@ u8 *v_gyro_highrate_z_hyst_u8) * @brief This API used to write gyro highrate z hysteresis * from page one register from 0x1C bit 5 to 6 * - * @param v_gyro_highrate_z_hyst_u8 : The value of gyro highrate z hysteresis + * @param gyro_highrate_z_hyst_u8 : The value of gyro highrate z hysteresis * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro high rate hysteresis calculated by * - * using this (255 + 256 * v_gyro_highrate_z_hyst_u8) *4 LSB + * using this (255 + 256 * gyro_highrate_z_hyst_u8) *4 LSB * * The high rate value scales with the range setting * - * v_gyro_range_u8 | hysteresis | LSB + * gyro_range_u8 | hysteresis | LSB * ----------------- | ------------- | --------- * 2000 | 62.26dps | 1LSB * 1000 | 31.13dps | 1LSB * 500 | 15.56dps | 1LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_z_hyst( -u8 v_gyro_highrate_z_hyst_u8) +u8 gyro_highrate_z_hyst_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro highrate z hysteresis*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Z_HYST__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Z_HYST_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Z_HYST, - v_gyro_highrate_z_hyst_u8); + gyro_highrate_z_hyst_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Z_HYST__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_Z_HYST_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro highrate z duration * from page one register from 0x1D bit 0 to 7 * - * @param v_gyro_highrate_z_durn_u8 : The value of gyro highrate z duration + * @param gyro_highrate_z_durn_u8 : The value of gyro highrate z duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate duration calculate by using the formula * - * (1 + v_gyro_highrate_z_durn_u8)*2.5ms + * (1 + gyro_highrate_z_durn_u8)*2.5ms */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_z_durn( -u8 *v_gyro_highrate_z_durn_u8) +u8 *gyro_highrate_z_durn_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro highrate z duration is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro highrate z duration*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Z_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_highrate_z_durn_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Z_DURN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_highrate_z_durn_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Z_DURN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -16852,88 +17148,90 @@ u8 *v_gyro_highrate_z_durn_u8) * @brief This API used to write gyro highrate z duration * from page one register from 0x1D bit 0 to 7 * - * @param v_gyro_highrate_z_durn_u8 : The value of gyro highrate z duration + * @param gyro_highrate_z_durn_u8 : The value of gyro highrate z duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate duration calculate by using the formula * - * (1 + v_gyro_highrate_z_durn_u8)*2.5ms + * (1 + gyro_highrate_z_durn_u8)*2.5ms */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_z_durn( -u8 v_gyro_highrate_z_durn_u8) +u8 gyro_highrate_z_durn_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro highrate z duration*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Z_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_HIGHRATE_Z_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_HIGHRATE_Z_DURN, - v_gyro_highrate_z_durn_u8); + gyro_highrate_z_durn_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_HIGHRATE_Z_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_HIGHRATE_Z_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro anymotion threshold * from page one register from 0x1E bit 0 to 6 * - * @param v_gyro_any_motion_thres_u8 : The value of gyro anymotion threshold + * @param gyro_any_motion_thres_u8 : The value of gyro anymotion threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro anymotion interrupt threshold dependent * on the selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 1dps | 1LSB * 1000 | 0.5dps | 1LSB @@ -16941,34 +17239,34 @@ if (v_stat_s8 == SUCCESS) { * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_any_motion_thres( -u8 *v_gyro_any_motion_thres_u8) +u8 *gyro_any_motion_thres_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page,gyro anymotion threshold is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro anymotion threshold*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_any_motion_thres_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_ANY_MOTION_THRES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_any_motion_thres_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_ANY_MOTION_THRES); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -16977,16 +17275,16 @@ u8 *v_gyro_any_motion_thres_u8) * @brief This API used to write gyro anymotion threshold * from page one register from 0x1E bit 0 to 6 * - * @param v_gyro_any_motion_thres_u8 : The value of gyro anymotion threshold + * @param gyro_any_motion_thres_u8 : The value of gyro anymotion threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro anymotion interrupt threshold dependent * on the selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 1dps | 1LSB * 1000 | 0.5dps | 1LSB @@ -16994,70 +17292,72 @@ u8 *v_gyro_any_motion_thres_u8) * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_any_motion_thres( -u8 v_gyro_any_motion_thres_u8) +u8 gyro_any_motion_thres_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; -s8 v_pg_stat_s8 = ERROR; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; +s8 pg_stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro anymotion threshold*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_ANY_MOTION_THRES_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_ANY_MOTION_THRES, - v_gyro_any_motion_thres_u8); + gyro_any_motion_thres_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_ANY_MOTION_THRES__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_ANY_MOTION_THRES_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } -if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) +if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro anymotion slope samples * from page one register from 0x1F bit 0 to 1 * - * @param v_gyro_any_motion_slope_samples_u8 : + * @param gyro_any_motion_slope_samples_u8 : * The value of gyro anymotion slope samples - * v_gyro_any_motion_slope_samples_u8 | result + * gyro_any_motion_slope_samples_u8 | result * ---------------------------------- | ----------- * 0 | 8 samples * 1 | 16 samples @@ -17065,39 +17365,39 @@ return com_rslt; * 3 | 64 samples * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_any_motion_slope_samples( -u8 *v_gyro_any_motion_slope_samples_u8) +u8 *gyro_any_motion_slope_samples_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro anymotion slope samples is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /*Read the value of gyro anymotion slope samples*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_SLOPE_SAMPLES__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_any_motion_slope_samples_u8 = - BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_SLOPE_SAMPLES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_any_motion_slope_samples_u8 = + BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_SLOPE_SAMPLES); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -17106,9 +17406,9 @@ u8 *v_gyro_any_motion_slope_samples_u8) * @brief This API used to write gyro anymotion slope samples * from page one register from 0x1F bit 0 to 1 * - * @param v_gyro_any_motion_slope_samples_u8 : + * @param gyro_any_motion_slope_samples_u8 : * The value of gyro anymotion slope samples - * v_gyro_any_motion_slope_samples_u8 | result + * gyro_any_motion_slope_samples_u8 | result * ---------------------------------- | ----------- * 0 | 8 samples * 1 | 16 samples @@ -17116,107 +17416,108 @@ u8 *v_gyro_any_motion_slope_samples_u8) * 3 | 64 samples * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_any_motion_slope_samples( -u8 v_gyro_any_motion_slope_samples_u8) +u8 gyro_any_motion_slope_samples_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ -v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); -if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { +stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); +if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro anymotion slope samples*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_SLOPE_SAMPLES__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_SLOPE_SAMPLES_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_SLOPE_SAMPLES, - v_gyro_any_motion_slope_samples_u8); + gyro_any_motion_slope_samples_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_SLOPE_SAMPLES__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_SLOPE_SAMPLES_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } /*! * @brief This API used to read gyro anymotion awake duration * from page one register from 0x1F bit 2 to 3 * - * @param v_gyro_awake_durn_u8 : The value of gyro anymotion awake duration + * @param gyro_awake_durn_u8 : The value of gyro anymotion awake duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_any_motion_awake_durn( -u8 *v_gyro_awake_durn_u8) +u8 *gyro_awake_durn_u8) { /* Variable used to return value of communication routine*/ - BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; - u8 v_data_u8r = BNO055_ZERO_U8X; - s8 v_stat_s8 = ERROR; + BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; + u8 data_u8r = BNO055_INIT_VALUE; + s8 stat_s8 = BNO055_ERROR; /* Check the struct p_bno055 is empty */ - if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; + if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /*condition check for page, gyro anymotion awake duration is available in the page one*/ - if (p_bno055->page_id != PAGE_ONE) + if (p_bno055->page_id != BNO055_PAGE_ONE) /* Write page as one */ - v_stat_s8 = bno055_write_page_id(PAGE_ONE); - if ((v_stat_s8 == SUCCESS) || - (p_bno055->page_id == PAGE_ONE)) { + stat_s8 = bno055_write_page_id(BNO055_PAGE_ONE); + if ((stat_s8 == BNO055_SUCCESS) || + (p_bno055->page_id == BNO055_PAGE_ONE)) { /* Read the value of gyro anymotion awake duration*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_AWAKE_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - *v_gyro_awake_durn_u8 = BNO055_GET_BITSLICE(v_data_u8r, + BNO055_GYRO_AWAKE_DURN_REG, + &data_u8r, BNO055_GEN_READ_WRITE_LENGTH); + *gyro_awake_durn_u8 = BNO055_GET_BITSLICE(data_u8r, BNO055_GYRO_AWAKE_DURN); } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } return com_rslt; @@ -17225,69 +17526,72 @@ u8 *v_gyro_awake_durn_u8) * @brief This API used to write gyro anymotion awake duration * from page one register from 0x1F bit 2 to 3 * - * @param v_gyro_awake_durn_u8 : The value of gyro anymotion awake duration + * @param gyro_awake_durn_u8 : The value of gyro anymotion awake duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_any_motion_awake_durn( -u8 v_gyro_awake_durn_u8) +u8 gyro_awake_durn_u8) { -BNO055_RETURN_FUNCTION_TYPE com_rslt = ERROR; -u8 v_data_u8r = BNO055_ZERO_U8X; -s8 v_stat_s8 = ERROR; -s8 v_pg_stat_s8 = ERROR; -u8 v_prev_opmode_u8 = OPERATION_MODE_CONFIG; +BNO055_RETURN_FUNCTION_TYPE com_rslt = BNO055_ERROR; +u8 data_u8r = BNO055_INIT_VALUE; +s8 stat_s8 = BNO055_ERROR; +s8 pg_stat_s8 = BNO055_ERROR; +u8 prev_opmode_u8 = BNO055_OPERATION_MODE_CONFIG; /* Check the struct p_bno055 is empty */ -if (p_bno055 == BNO055_ZERO_U8X) { - return E_NULL_PTR; +if (p_bno055 == BNO055_INIT_VALUE) { + return BNO055_E_NULL_PTR; } else { /* The write operation effective only if the operation mode is in config mode, this part of code is checking the current operation mode and set the config mode */ - v_stat_s8 = bno055_get_operation_mode(&v_prev_opmode_u8); - if (v_stat_s8 == SUCCESS) { - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) - v_stat_s8 += bno055_set_operation_mode - (OPERATION_MODE_CONFIG); - if (v_stat_s8 == SUCCESS) { + stat_s8 = bno055_get_operation_mode(&prev_opmode_u8); + if (stat_s8 == BNO055_SUCCESS) { + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) + stat_s8 += bno055_set_operation_mode + (BNO055_OPERATION_MODE_CONFIG); + if (stat_s8 == BNO055_SUCCESS) { /* Write page as one */ - v_pg_stat_s8 = bno055_write_page_id(PAGE_ONE); - if (v_pg_stat_s8 == SUCCESS) { + pg_stat_s8 = bno055_write_page_id( + BNO055_PAGE_ONE); + if (pg_stat_s8 == BNO055_SUCCESS) { /* Write the value of gyro anymotion awake duration*/ com_rslt = p_bno055->BNO055_BUS_READ_FUNC (p_bno055->dev_addr, - BNO055_GYRO_AWAKE_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); - if (com_rslt == SUCCESS) { - v_data_u8r = - BNO055_SET_BITSLICE(v_data_u8r, + BNO055_GYRO_AWAKE_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); + if (com_rslt == BNO055_SUCCESS) { + data_u8r = + BNO055_SET_BITSLICE(data_u8r, BNO055_GYRO_AWAKE_DURN, - v_gyro_awake_durn_u8); + gyro_awake_durn_u8); com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC (p_bno055->dev_addr, - BNO055_GYRO_AWAKE_DURN__REG, - &v_data_u8r, BNO055_ONE_U8X); + BNO055_GYRO_AWAKE_DURN_REG, + &data_u8r, + BNO055_GEN_READ_WRITE_LENGTH); } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } else { - com_rslt = ERROR; + com_rslt = BNO055_ERROR; } } - if (v_prev_opmode_u8 != OPERATION_MODE_CONFIG) + if (prev_opmode_u8 != BNO055_OPERATION_MODE_CONFIG) /* set the operation mode of previous operation mode*/ com_rslt += bno055_set_operation_mode - (v_prev_opmode_u8); + (prev_opmode_u8); return com_rslt; } diff --git a/bno055.h b/bno055.h index 15f53f7..e1abb3a 100644 --- a/bno055.h +++ b/bno055.h @@ -1,13 +1,13 @@ /** \mainpage * **************************************************************************** -* Copyright (C) 2013 - 2014 Bosch Sensortec GmbH +* Copyright (C) 2015 - 2016 Bosch Sensortec GmbH * * File : bno055.h * -* Date : 2014/12/12 +* Date : 2016/03/14 * -* Revision : 2.0.2 $ +* Revision : 2.0.3 $ * * Usage: Sensor Driver file for BNO055 sensor * @@ -293,13 +293,13 @@ define the data types manually /**\name BUS READ AND WRITE FUNCTIONS */ /***************************************************************/ #define BNO055_WR_FUNC_PTR s8 (*bus_write)\ -(u8, u8 , u8 *, u8) +(u8, u8, u8 *, u8) #define BNO055_BUS_WRITE_FUNC(dev_addr, reg_addr, reg_data, wr_len)\ bus_write(dev_addr, reg_addr, reg_data, wr_len) #define BNO055_RD_FUNC_PTR s8 \ -(*bus_read)(u8, u8 , u8 *, u8) +(*bus_read)(u8, u8, u8 *, u8) #define BNO055_BUS_READ_FUNC(dev_addr, reg_addr, reg_data, r_len)\ bus_read(dev_addr, reg_addr, reg_data, r_len) @@ -315,195 +315,195 @@ bus_read(dev_addr, reg_addr, reg_data, r_len) /**\name I2C ADDRESS DEFINITION FOR BNO055 */ /********************************************************/ /* bno055 I2C Address */ -#define BNO055_I2C_ADDR1 0x28 -#define BNO055_I2C_ADDR2 0x29 +#define BNO055_I2C_ADDR1 (0x28) +#define BNO055_I2C_ADDR2 (0x29) /***************************************************/ /**\name REGISTER ADDRESS DEFINITION */ /***************************************************/ /* Page id register definition*/ -#define BNO055_PAGE_ID_ADDR 0X07 +#define BNO055_PAGE_ID_ADDR (0X07) /* PAGE0 REGISTER DEFINITION START*/ -#define BNO055_CHIP_ID_ADDR 0x00 -#define BNO055_ACCEL_REV_ID_ADDR 0x01 -#define BNO055_MAG_REV_ID_ADDR 0x02 -#define BNO055_GYRO_REV_ID_ADDR 0x03 -#define BNO055_SW_REV_ID_LSB_ADDR 0x04 -#define BNO055_SW_REV_ID_MSB_ADDR 0x05 -#define BNO055_BL_REV_ID_ADDR 0X06 +#define BNO055_CHIP_ID_ADDR (0x00) +#define BNO055_ACCEL_REV_ID_ADDR (0x01) +#define BNO055_MAG_REV_ID_ADDR (0x02) +#define BNO055_GYRO_REV_ID_ADDR (0x03) +#define BNO055_SW_REV_ID_LSB_ADDR (0x04) +#define BNO055_SW_REV_ID_MSB_ADDR (0x05) +#define BNO055_BL_REV_ID_ADDR (0X06) /* Accel data register*/ -#define BNO055_ACCEL_DATA_X_LSB_ADDR 0X08 -#define BNO055_ACCEL_DATA_X_MSB_ADDR 0X09 -#define BNO055_ACCEL_DATA_Y_LSB_ADDR 0X0A -#define BNO055_ACCEL_DATA_Y_MSB_ADDR 0X0B -#define BNO055_ACCEL_DATA_Z_LSB_ADDR 0X0C -#define BNO055_ACCEL_DATA_Z_MSB_ADDR 0X0D +#define BNO055_ACCEL_DATA_X_LSB_ADDR (0X08) +#define BNO055_ACCEL_DATA_X_MSB_ADDR (0X09) +#define BNO055_ACCEL_DATA_Y_LSB_ADDR (0X0A) +#define BNO055_ACCEL_DATA_Y_MSB_ADDR (0X0B) +#define BNO055_ACCEL_DATA_Z_LSB_ADDR (0X0C) +#define BNO055_ACCEL_DATA_Z_MSB_ADDR (0X0D) /*Mag data register*/ -#define BNO055_MAG_DATA_X_LSB_ADDR 0X0E -#define BNO055_MAG_DATA_X_MSB_ADDR 0X0F -#define BNO055_MAG_DATA_Y_LSB_ADDR 0X10 -#define BNO055_MAG_DATA_Y_MSB_ADDR 0X11 -#define BNO055_MAG_DATA_Z_LSB_ADDR 0X12 -#define BNO055_MAG_DATA_Z_MSB_ADDR 0X13 +#define BNO055_MAG_DATA_X_LSB_ADDR (0X0E) +#define BNO055_MAG_DATA_X_MSB_ADDR (0X0F) +#define BNO055_MAG_DATA_Y_LSB_ADDR (0X10) +#define BNO055_MAG_DATA_Y_MSB_ADDR (0X11) +#define BNO055_MAG_DATA_Z_LSB_ADDR (0X12) +#define BNO055_MAG_DATA_Z_MSB_ADDR (0X13) /*Gyro data registers*/ -#define BNO055_GYRO_DATA_X_LSB_ADDR 0X14 -#define BNO055_GYRO_DATA_X_MSB_ADDR 0X15 -#define BNO055_GYRO_DATA_Y_LSB_ADDR 0X16 -#define BNO055_GYRO_DATA_Y_MSB_ADDR 0X17 -#define BNO055_GYRO_DATA_Z_LSB_ADDR 0X18 -#define BNO055_GYRO_DATA_Z_MSB_ADDR 0X19 +#define BNO055_GYRO_DATA_X_LSB_ADDR (0X14) +#define BNO055_GYRO_DATA_X_MSB_ADDR (0X15) +#define BNO055_GYRO_DATA_Y_LSB_ADDR (0X16) +#define BNO055_GYRO_DATA_Y_MSB_ADDR (0X17) +#define BNO055_GYRO_DATA_Z_LSB_ADDR (0X18) +#define BNO055_GYRO_DATA_Z_MSB_ADDR (0X19) /*Euler data registers*/ -#define BNO055_EULER_H_LSB_ADDR 0X1A -#define BNO055_EULER_H_MSB_ADDR 0X1B +#define BNO055_EULER_H_LSB_ADDR (0X1A) +#define BNO055_EULER_H_MSB_ADDR (0X1B) -#define BNO055_EULER_R_LSB_ADDR 0X1C -#define BNO055_EULER_R_MSB_ADDR 0X1D +#define BNO055_EULER_R_LSB_ADDR (0X1C) +#define BNO055_EULER_R_MSB_ADDR (0X1D) -#define BNO055_EULER_P_LSB_ADDR 0X1E -#define BNO055_EULER_P_MSB_ADDR 0X1F +#define BNO055_EULER_P_LSB_ADDR (0X1E) +#define BNO055_EULER_P_MSB_ADDR (0X1F) /*Quaternion data registers*/ -#define BNO055_QUATERNION_DATA_W_LSB_ADDR 0X20 -#define BNO055_QUATERNION_DATA_W_MSB_ADDR 0X21 -#define BNO055_QUATERNION_DATA_X_LSB_ADDR 0X22 -#define BNO055_QUATERNION_DATA_X_MSB_ADDR 0X23 -#define BNO055_QUATERNION_DATA_Y_LSB_ADDR 0X24 -#define BNO055_QUATERNION_DATA_Y_MSB_ADDR 0X25 -#define BNO055_QUATERNION_DATA_Z_LSB_ADDR 0X26 -#define BNO055_QUATERNION_DATA_Z_MSB_ADDR 0X27 +#define BNO055_QUATERNION_DATA_W_LSB_ADDR (0X20) +#define BNO055_QUATERNION_DATA_W_MSB_ADDR (0X21) +#define BNO055_QUATERNION_DATA_X_LSB_ADDR (0X22) +#define BNO055_QUATERNION_DATA_X_MSB_ADDR (0X23) +#define BNO055_QUATERNION_DATA_Y_LSB_ADDR (0X24) +#define BNO055_QUATERNION_DATA_Y_MSB_ADDR (0X25) +#define BNO055_QUATERNION_DATA_Z_LSB_ADDR (0X26) +#define BNO055_QUATERNION_DATA_Z_MSB_ADDR (0X27) /* Linear acceleration data registers*/ -#define BNO055_LINEAR_ACCEL_DATA_X_LSB_ADDR 0X28 -#define BNO055_LINEAR_ACCEL_DATA_X_MSB_ADDR 0X29 -#define BNO055_LINEAR_ACCEL_DATA_Y_LSB_ADDR 0X2A -#define BNO055_LINEAR_ACCEL_DATA_Y_MSB_ADDR 0X2B -#define BNO055_LINEAR_ACCEL_DATA_Z_LSB_ADDR 0X2C -#define BNO055_LINEAR_ACCEL_DATA_Z_MSB_ADDR 0X2D +#define BNO055_LINEAR_ACCEL_DATA_X_LSB_ADDR (0X28) +#define BNO055_LINEAR_ACCEL_DATA_X_MSB_ADDR (0X29) +#define BNO055_LINEAR_ACCEL_DATA_Y_LSB_ADDR (0X2A) +#define BNO055_LINEAR_ACCEL_DATA_Y_MSB_ADDR (0X2B) +#define BNO055_LINEAR_ACCEL_DATA_Z_LSB_ADDR (0X2C) +#define BNO055_LINEAR_ACCEL_DATA_Z_MSB_ADDR (0X2D) /*Gravity data registers*/ -#define BNO055_GRAVITY_DATA_X_LSB_ADDR 0X2E -#define BNO055_GRAVITY_DATA_X_MSB_ADDR 0X2F -#define BNO055_GRAVITY_DATA_Y_LSB_ADDR 0X30 -#define BNO055_GRAVITY_DATA_Y_MSB_ADDR 0X31 -#define BNO055_GRAVITY_DATA_Z_LSB_ADDR 0X32 -#define BNO055_GRAVITY_DATA_Z_MSB_ADDR 0X33 +#define BNO055_GRAVITY_DATA_X_LSB_ADDR (0X2E) +#define BNO055_GRAVITY_DATA_X_MSB_ADDR (0X2F) +#define BNO055_GRAVITY_DATA_Y_LSB_ADDR (0X30) +#define BNO055_GRAVITY_DATA_Y_MSB_ADDR (0X31) +#define BNO055_GRAVITY_DATA_Z_LSB_ADDR (0X32) +#define BNO055_GRAVITY_DATA_Z_MSB_ADDR (0X33) /* Temperature data register*/ -#define BNO055_TEMP_ADDR 0X34 +#define BNO055_TEMP_ADDR (0X34) /* Status registers*/ -#define BNO055_CALIB_STAT_ADDR 0X35 -#define BNO055_SELFTEST_RESULT_ADDR 0X36 -#define BNO055_INTR_STAT_ADDR 0X37 -#define BNO055_SYS_CLK_STAT_ADDR 0X38 -#define BNO055_SYS_STAT_ADDR 0X39 -#define BNO055_SYS_ERR_ADDR 0X3A +#define BNO055_CALIB_STAT_ADDR (0X35) +#define BNO055_SELFTEST_RESULT_ADDR (0X36) +#define BNO055_INTR_STAT_ADDR (0X37) +#define BNO055_SYS_CLK_STAT_ADDR (0X38) +#define BNO055_SYS_STAT_ADDR (0X39) +#define BNO055_SYS_ERR_ADDR (0X3A) /* Unit selection register*/ -#define BNO055_UNIT_SEL_ADDR 0X3B -#define BNO055_DATA_SELECT_ADDR 0X3C +#define BNO055_UNIT_SEL_ADDR (0X3B) +#define BNO055_DATA_SELECT_ADDR (0X3C) /* Mode registers*/ -#define BNO055_OPR_MODE_ADDR 0X3D -#define BNO055_PWR_MODE_ADDR 0X3E +#define BNO055_OPR_MODE_ADDR (0X3D) +#define BNO055_PWR_MODE_ADDR (0X3E) -#define BNO055_SYS_TRIGGER_ADDR 0X3F -#define BNO055_TEMP_SOURCE_ADDR 0X40 +#define BNO055_SYS_TRIGGER_ADDR (0X3F) +#define BNO055_TEMP_SOURCE_ADDR (0X40) /* Axis remap registers*/ -#define BNO055_AXIS_MAP_CONFIG_ADDR 0X41 -#define BNO055_AXIS_MAP_SIGN_ADDR 0X42 +#define BNO055_AXIS_MAP_CONFIG_ADDR (0X41) +#define BNO055_AXIS_MAP_SIGN_ADDR (0X42) /* SIC registers*/ -#define BNO055_SIC_MATRIX_0_LSB_ADDR 0X43 -#define BNO055_SIC_MATRIX_0_MSB_ADDR 0X44 -#define BNO055_SIC_MATRIX_1_LSB_ADDR 0X45 -#define BNO055_SIC_MATRIX_1_MSB_ADDR 0X46 -#define BNO055_SIC_MATRIX_2_LSB_ADDR 0X47 -#define BNO055_SIC_MATRIX_2_MSB_ADDR 0X48 -#define BNO055_SIC_MATRIX_3_LSB_ADDR 0X49 -#define BNO055_SIC_MATRIX_3_MSB_ADDR 0X4A -#define BNO055_SIC_MATRIX_4_LSB_ADDR 0X4B -#define BNO055_SIC_MATRIX_4_MSB_ADDR 0X4C -#define BNO055_SIC_MATRIX_5_LSB_ADDR 0X4D -#define BNO055_SIC_MATRIX_5_MSB_ADDR 0X4E -#define BNO055_SIC_MATRIX_6_LSB_ADDR 0X4F -#define BNO055_SIC_MATRIX_6_MSB_ADDR 0X50 -#define BNO055_SIC_MATRIX_7_LSB_ADDR 0X51 -#define BNO055_SIC_MATRIX_7_MSB_ADDR 0X52 -#define BNO055_SIC_MATRIX_8_LSB_ADDR 0X53 -#define BNO055_SIC_MATRIX_8_MSB_ADDR 0X54 +#define BNO055_SIC_MATRIX_0_LSB_ADDR (0X43) +#define BNO055_SIC_MATRIX_0_MSB_ADDR (0X44) +#define BNO055_SIC_MATRIX_1_LSB_ADDR (0X45) +#define BNO055_SIC_MATRIX_1_MSB_ADDR (0X46) +#define BNO055_SIC_MATRIX_2_LSB_ADDR (0X47) +#define BNO055_SIC_MATRIX_2_MSB_ADDR (0X48) +#define BNO055_SIC_MATRIX_3_LSB_ADDR (0X49) +#define BNO055_SIC_MATRIX_3_MSB_ADDR (0X4A) +#define BNO055_SIC_MATRIX_4_LSB_ADDR (0X4B) +#define BNO055_SIC_MATRIX_4_MSB_ADDR (0X4C) +#define BNO055_SIC_MATRIX_5_LSB_ADDR (0X4D) +#define BNO055_SIC_MATRIX_5_MSB_ADDR (0X4E) +#define BNO055_SIC_MATRIX_6_LSB_ADDR (0X4F) +#define BNO055_SIC_MATRIX_6_MSB_ADDR (0X50) +#define BNO055_SIC_MATRIX_7_LSB_ADDR (0X51) +#define BNO055_SIC_MATRIX_7_MSB_ADDR (0X52) +#define BNO055_SIC_MATRIX_8_LSB_ADDR (0X53) +#define BNO055_SIC_MATRIX_8_MSB_ADDR (0X54) /* Accelerometer Offset registers*/ -#define ACCEL_OFFSET_X_LSB_ADDR 0X55 -#define ACCEL_OFFSET_X_MSB_ADDR 0X56 -#define ACCEL_OFFSET_Y_LSB_ADDR 0X57 -#define ACCEL_OFFSET_Y_MSB_ADDR 0X58 -#define ACCEL_OFFSET_Z_LSB_ADDR 0X59 -#define ACCEL_OFFSET_Z_MSB_ADDR 0X5A +#define BNO055_ACCEL_OFFSET_X_LSB_ADDR (0X55) +#define BNO055_ACCEL_OFFSET_X_MSB_ADDR (0X56) +#define BNO055_ACCEL_OFFSET_Y_LSB_ADDR (0X57) +#define BNO055_ACCEL_OFFSET_Y_MSB_ADDR (0X58) +#define BNO055_ACCEL_OFFSET_Z_LSB_ADDR (0X59) +#define BNO055_ACCEL_OFFSET_Z_MSB_ADDR (0X5A) /* Magnetometer Offset registers*/ -#define MAG_OFFSET_X_LSB_ADDR 0X5B -#define MAG_OFFSET_X_MSB_ADDR 0X5C -#define MAG_OFFSET_Y_LSB_ADDR 0X5D -#define MAG_OFFSET_Y_MSB_ADDR 0X5E -#define MAG_OFFSET_Z_LSB_ADDR 0X5F -#define MAG_OFFSET_Z_MSB_ADDR 0X60 +#define BNO055_MAG_OFFSET_X_LSB_ADDR (0X5B) +#define BNO055_MAG_OFFSET_X_MSB_ADDR (0X5C) +#define BNO055_MAG_OFFSET_Y_LSB_ADDR (0X5D) +#define BNO055_MAG_OFFSET_Y_MSB_ADDR (0X5E) +#define BNO055_MAG_OFFSET_Z_LSB_ADDR (0X5F) +#define BNO055_MAG_OFFSET_Z_MSB_ADDR (0X60) /* Gyroscope Offset registers*/ -#define GYRO_OFFSET_X_LSB_ADDR 0X61 -#define GYRO_OFFSET_X_MSB_ADDR 0X62 -#define GYRO_OFFSET_Y_LSB_ADDR 0X63 -#define GYRO_OFFSET_Y_MSB_ADDR 0X64 -#define GYRO_OFFSET_Z_LSB_ADDR 0X65 -#define GYRO_OFFSET_Z_MSB_ADDR 0X66 +#define BNO055_GYRO_OFFSET_X_LSB_ADDR (0X61) +#define BNO055_GYRO_OFFSET_X_MSB_ADDR (0X62) +#define BNO055_GYRO_OFFSET_Y_LSB_ADDR (0X63) +#define BNO055_GYRO_OFFSET_Y_MSB_ADDR (0X64) +#define BNO055_GYRO_OFFSET_Z_LSB_ADDR (0X65) +#define BNO055_GYRO_OFFSET_Z_MSB_ADDR (0X66) /* Radius registers*/ -#define ACCEL_RADIUS_LSB_ADDR 0X67 -#define ACCEL_RADIUS_MSB_ADDR 0X68 -#define MAG_RADIUS_LSB_ADDR 0X69 -#define MAG_RADIUS_MSB_ADDR 0X6A +#define BNO055_ACCEL_RADIUS_LSB_ADDR (0X67) +#define BNO055_ACCEL_RADIUS_MSB_ADDR (0X68) +#define BNO055_MAG_RADIUS_LSB_ADDR (0X69) +#define BNO055_MAG_RADIUS_MSB_ADDR (0X6A) /* PAGE0 REGISTERS DEFINITION END*/ /* PAGE1 REGISTERS DEFINITION START*/ /* Configuration registers*/ -#define ACCEL_CONFIG_ADDR 0X08 -#define MAG_CONFIG_ADDR 0X09 -#define GYRO_CONFIG_ADDR 0X0A -#define GYRO_MODE_CONFIG_ADDR 0X0B -#define ACCEL_SLEEP_CONFIG_ADDR 0X0C -#define GYRO_SLEEP_CONFIG_ADDR 0X0D -#define MAG_SLEEP_CONFIG_ADDR 0x0E +#define BNO055_ACCEL_CONFIG_ADDR (0X08) +#define BNO055_MAG_CONFIG_ADDR (0X09) +#define BNO055_GYRO_CONFIG_ADDR (0X0A) +#define BNO055_GYRO_MODE_CONFIG_ADDR (0X0B) +#define BNO055_ACCEL_SLEEP_CONFIG_ADDR (0X0C) +#define BNO055_GYRO_SLEEP_CONFIG_ADDR (0X0D) +#define BNO055_MAG_SLEEP_CONFIG_ADDR (0x0E) /* Interrupt registers*/ -#define INT_MASK_ADDR 0X0F -#define INT_ADDR 0X10 -#define ACCEL_ANY_MOTION_THRES_ADDR 0X11 -#define ACCEL_INTR_SETTINGS_ADDR 0X12 -#define ACCEL_HIGH_G_DURN_ADDR 0X13 -#define ACCEL_HIGH_G_THRES_ADDR 0X14 -#define ACCEL_NO_MOTION_THRES_ADDR 0X15 -#define ACCEL_NO_MOTION_SET_ADDR 0X16 -#define GYRO_INTR_SETING_ADDR 0X17 -#define GYRO_HIGHRATE_X_SET_ADDR 0X18 -#define GYRO_DURN_X_ADDR 0X19 -#define GYRO_HIGHRATE_Y_SET_ADDR 0X1A -#define GYRO_DURN_Y_ADDR 0X1B -#define GYRO_HIGHRATE_Z_SET_ADDR 0X1C -#define GYRO_DURN_Z_ADDR 0X1D -#define GYRO_ANY_MOTION_THRES_ADDR 0X1E -#define GYRO_ANY_MOTION_SET_ADDR 0X1F +#define BNO055_INT_MASK_ADDR (0X0F) +#define BNO055_INT_ADDR (0X10) +#define BNO055_ACCEL_ANY_MOTION_THRES_ADDR (0X11) +#define BNO055_ACCEL_INTR_SETTINGS_ADDR (0X12) +#define BNO055_ACCEL_HIGH_G_DURN_ADDR (0X13) +#define BNO055_ACCEL_HIGH_G_THRES_ADDR (0X14) +#define BNO055_ACCEL_NO_MOTION_THRES_ADDR (0X15) +#define BNO055_ACCEL_NO_MOTION_SET_ADDR (0X16) +#define BNO055_GYRO_INTR_SETING_ADDR (0X17) +#define BNO055_GYRO_HIGHRATE_X_SET_ADDR (0X18) +#define BNO055_GYRO_DURN_X_ADDR (0X19) +#define BNO055_GYRO_HIGHRATE_Y_SET_ADDR (0X1A) +#define BNO055_GYRO_DURN_Y_ADDR (0X1B) +#define BNO055_GYRO_HIGHRATE_Z_SET_ADDR (0X1C) +#define BNO055_GYRO_DURN_Z_ADDR (0X1D) +#define BNO055_GYRO_ANY_MOTION_THRES_ADDR (0X1E) +#define BNO055_GYRO_ANY_MOTION_SET_ADDR (0X1F) /* PAGE1 REGISTERS DEFINITION END*/ -#define BNO055_MDELAY_DATA_TYPE u32 +#define BNO055_MDELAY_DATA_TYPE u32 /*< This refers BNO055 return type as s8 */ -#define BNO055_RETURN_FUNCTION_TYPE s8 +#define BNO055_RETURN_FUNCTION_TYPE s8 /* Compile switch definition for Float and double*/ #define BNO055_FLOAT_ENABLE @@ -727,1042 +727,1075 @@ s16 sic_8;/**< soft iron calibration matrix 8 data */ /***************************************************/ /**\name CONSTANT DEFINITIONS */ /***************************************************/ -#define BNO055_ZERO_U8X ((u8)0) -#define BNO055_ONE_U8X ((u8)1) -#define BNO055_TWO_U8X ((u8)2) -#define BNO055_FOUR_U8X ((u8)4) -#define BNO055_FIVE_U8X ((u8)5) -#define BNO055_SIX_U8X ((u8)6) -#define BNO055_SEVEN_U8X ((u8)7) -#define BNO055_ELEVEN_U8X ((u8)11) -#define BNO055_SIXTEEN_U8X ((u8)16) -#define BNO055_EIGHT_U8X ((u8)8) -#define BNO055_TWENTY_U8X ((u8)20) -#define BNO055_EIGHTEEN_U8X ((u8)18) - - -#define BNO055_SHIFT_8_POSITION ((u8)8) - - -/* BNO055 API error codes */ -#define E_NULL_PTR ((s8)-127) -#define E_BNO055_OUT_OF_RANGE ((s8)-2) -#define SUCCESS ((u8)0) -#define ERROR ((s8)-1) +#define BNO055_INIT_VALUE ((u8)0) +#define BNO055_GEN_READ_WRITE_LENGTH ((u8)1) +#define BNO055_LSB_MSB_READ_LENGTH ((u8)2) +#define BNO055_MAG_POWER_MODE_RANGE ((u8)4) +#define BNO055_MAG_OPR_MODE_RANGE ((u8)5) +#define BNO055_ACCEL_POWER_MODE_RANGE ((u8)6) +#define BNO055_ACCEL_SLEEP_DURATION_RANGE ((u8)16) +#define BNO055_GYRO_AUTO_SLEEP_DURATION_RANGE ((u8)8) +#define BNO055_ACCEL_GYRO_BW_RANGE ((u8)8) +#define BNO055_MAG_OUTPUT_RANGE ((u8)8) +#define BNO055_ACCEL_RANGE ((u8)5) +#define BNO055_SHIFT_EIGHT_BITS ((u8)8) +#define BNO055_GYRO_RANGE ((u8)5) +#define BNO055_ACCEL_SLEEP_MODE_RANGE ((u8)2) +/* BNO055 API BNO055_ERROR codes */ +#define BNO055_E_NULL_PTR ((s8)-127) +#define BNO055_OUT_OF_RANGE ((s8)-2) +#define BNO055_SUCCESS ((u8)0) +#define BNO055_ERROR ((s8)-1) /* Selection for bit enable and disable */ -#define ENABLED 0x01 -#define DISABLED 0x00 +#define BNO055_BIT_ENABLE (0x01) +#define BNO055_BIT_DISABLE (0x00) /* Page ID */ -#define PAGE_ZERO 0X00 -#define PAGE_ONE 0X01 +#define BNO055_PAGE_ZERO (0X00) +#define BNO055_PAGE_ONE (0X01) /* Enable the temperature source */ -#define ACCEL_TEMP_EN 0x00 -#define GYRO_TEMP_EN 0x01 -#define MCU_TEMP_EN 0x03 +#define BNO055_ACCEL_TEMP_EN (0x00) +#define BNO055_GYRO_TEMP_EN (0x01) +#define BNO055_MCU_TEMP_EN (0x03) /*Accel unit*/ -#define ACCEL_UNIT_MSQ 0x00 -#define ACCEL_UNIT_MG 0x01 +#define BNO055_ACCEL_UNIT_MSQ (0x00) +#define BNO055_ACCEL_UNIT_MG (0x01) /*Gyro unit*/ -#define GYRO_UNIT_DPS 0x00 -#define GYRO_UNIT_RPS 0x01 +#define BNO055_GYRO_UNIT_DPS (0x00) +#define BNO055_GYRO_UNIT_RPS (0x01) /* Euler unit*/ -#define EULER_UNIT_DEG 0x00 -#define EULER_UNIT_RAD 0x01 +#define BNO055_EULER_UNIT_DEG (0x00) +#define BNO055_EULER_UNIT_RAD (0x01) /*Temperature unit*/ -#define TEMP_UNIT_CELSIUS 0x00 -#define TEMP_UNIT_FAHRENHEIT 0x01 +#define BNO055_TEMP_UNIT_CELSIUS (0x00) +#define BNO055_TEMP_UNIT_FAHRENHEIT (0x01) /*Accel division factor*/ -#define ACCEL_DIV_MSQ 100.0 -#define ACCEL_DIV_MG 1 +#define BNO055_ACCEL_DIV_MSQ (100.0) +#define BNO055_ACCEL_DIV_MG (1) /*Mag division factor*/ -#define MAG_DIV_UT 16.0 +#define BNO055_MAG_DIV_UT (16.0) /*Gyro division factor*/ -#define GYRO_DIV_DPS 16.0 -#define GYRO_DIV_RPS 900.0 +#define BNO055_GYRO_DIV_DPS (16.0) +#define BNO055_GYRO_DIV_RPS (900.0) /*Euler division factor*/ -#define EULER_DIV_DEG 16.0 -#define EULER_DIV_RAD 900.0 +#define BNO055_EULER_DIV_DEG (16.0) +#define BNO055_EULER_DIV_RAD (900.0) /*Linear accel division factor*/ -#define LINEAR_ACCEL_DIV_MSQ 100.0 +#define BNO055_LINEAR_ACCEL_DIV_MSQ (100.0) /*Gravity accel division factor*/ -#define GRAVITY_DIV_MSQ 100.0 +#define BNO055_GRAVITY_DIV_MSQ (100.0) /* Temperature division factor*/ -#define TEMP_DIV_FAHRENHEIT 0.5 -#define TEMP_DIV_CELSIUS 1 +#define BNO055_TEMP_DIV_FAHRENHEIT (0.5) +#define BNO055_TEMP_DIV_CELSIUS (1) -#define BNO055_SIX_HUNDRES_U8X 600 +#define BNO055_MODE_SWITCHING_DELAY (600) +#define BNO055_CONFIG_MODE_SWITCHING_DELAY ((u8)20) /* Operation mode settings*/ -#define OPERATION_MODE_CONFIG 0X00 -#define OPERATION_MODE_ACCONLY 0X01 -#define OPERATION_MODE_MAGONLY 0X02 -#define OPERATION_MODE_GYRONLY 0X03 -#define OPERATION_MODE_ACCMAG 0X04 -#define OPERATION_MODE_ACCGYRO 0X05 -#define OPERATION_MODE_MAGGYRO 0X06 -#define OPERATION_MODE_AMG 0X07 -#define OPERATION_MODE_IMUPLUS 0X08 -#define OPERATION_MODE_COMPASS 0X09 -#define OPERATION_MODE_M4G 0X0A -#define OPERATION_MODE_NDOF_FMC_OFF 0X0B -#define OPERATION_MODE_NDOF 0X0C +#define BNO055_OPERATION_MODE_CONFIG (0X00) +#define BNO055_OPERATION_MODE_ACCONLY (0X01) +#define BNO055_OPERATION_MODE_MAGONLY (0X02) +#define BNO055_OPERATION_MODE_GYRONLY (0X03) +#define BNO055_OPERATION_MODE_ACCMAG (0X04) +#define BNO055_OPERATION_MODE_ACCGYRO (0X05) +#define BNO055_OPERATION_MODE_MAGGYRO (0X06) +#define BNO055_OPERATION_MODE_AMG (0X07) +#define BNO055_OPERATION_MODE_IMUPLUS (0X08) +#define BNO055_OPERATION_MODE_COMPASS (0X09) +#define BNO055_OPERATION_MODE_M4G (0X0A) +#define BNO055_OPERATION_MODE_NDOF_FMC_OFF (0X0B) +#define BNO055_OPERATION_MODE_NDOF (0X0C) /* Power mode*/ -#define POWER_MODE_NORMAL 0X00 -#define POWER_MODE_LOWPOWER 0X01 -#define POWER_MODE_SUSPEND 0X02 +#define BNO055_POWER_MODE_NORMAL (0X00) +#define BNO055_POWER_MODE_LOWPOWER (0X01) +#define BNO055_POWER_MODE_SUSPEND (0X02) /* PAGE-1 definitions*/ /* Accel Range */ -#define ACCEL_RANGE_2G 0X00 -#define ACCEL_RANGE_4G 0X01 -#define ACCEL_RANGE_8G 0X02 -#define ACCEL_RANGE_16G 0X03 +#define BNO055_ACCEL_RANGE_2G (0X00) +#define BNO055_ACCEL_RANGE_4G (0X01) +#define BNO055_ACCEL_RANGE_8G (0X02) +#define BNO055_ACCEL_RANGE_16G (0X03) /* Accel Bandwidth*/ -#define ACCEL_BW_7_81HZ 0x00 -#define ACCEL_BW_15_63HZ 0x01 -#define ACCEL_BW_31_25HZ 0x02 -#define ACCEL_BW_62_5HZ 0X03 -#define ACCEL_BW_125HZ 0X04 -#define ACCEL_BW_250HZ 0X05 -#define ACCEL_BW_500HZ 0X06 -#define ACCEL_BW_1000HZ 0X07 +#define BNO055_ACCEL_BW_7_81HZ (0x00) +#define BNO055_ACCEL_BW_15_63HZ (0x01) +#define BNO055_ACCEL_BW_31_25HZ (0x02) +#define BNO055_ACCEL_BW_62_5HZ (0X03) +#define BNO055_ACCEL_BW_125HZ (0X04) +#define BNO055_ACCEL_BW_250HZ (0X05) +#define BNO055_ACCEL_BW_500HZ (0X06) +#define BNO055_ACCEL_BW_1000HZ (0X07) /* Accel Power mode*/ -#define ACCEL_NORMAL 0X00 -#define ACCEL_SUSPEND 0X01 -#define ACCEL_LOWPOWER_1 0X02 -#define ACCEL_STANDBY 0X03 -#define ACCEL_LOWPOWER_2 0X04 -#define ACCEL_DEEPSUSPEND 0X05 +#define BNO055_ACCEL_NORMAL (0X00) +#define BNO055_ACCEL_SUSPEND (0X01) +#define BNO055_ACCEL_LOWPOWER_1 (0X02) +#define BNO055_ACCEL_STANDBY (0X03) +#define BNO055_ACCEL_LOWPOWER_2 (0X04) +#define BNO055_ACCEL_DEEPSUSPEND (0X05) /* Mag data output rate*/ -#define MAG_DATA_OUTRATE_2HZ 0X00 -#define MAG_DATA_OUTRATE_6HZ 0X01 -#define MAG_DATA_OUTRATE_8HZ 0X02 -#define MAG_DATA_OUTRATE_10HZ 0X03 -#define MAG_DATA_OUTRATE_15HZ 0X04 -#define MAG_DATA_OUTRATE_20HZ 0X05 -#define MAG_DATA_OUTRATE_25HZ 0X06 -#define MAG_DATA_OUTRATE_30HZ 0X07 +#define BNO055_MAG_DATA_OUTRATE_2HZ (0X00) +#define BNO055_MAG_DATA_OUTRATE_6HZ (0X01) +#define BNO055_MAG_DATA_OUTRATE_8HZ (0X02) +#define BNO055_MAG_DATA_OUTRATE_10HZ (0X03) +#define BNO055_MAG_DATA_OUTRATE_15HZ (0X04) +#define BNO055_MAG_DATA_OUTRATE_20HZ (0X05) +#define BNO055_MAG_DATA_OUTRATE_25HZ (0X06) +#define BNO055_MAG_DATA_OUTRATE_30HZ (0X07) /* Mag Operation mode*/ -#define MAG_OPERATION_MODE_LOWPOWER 0X00 -#define MAG_OPERATION_MODE_REGULAR 0X01 -#define MAG_OPERATION_MODE_ENHANCED_REGULAR 0X02 -#define MAG_OPERATION_MODE_HIGH_ACCURACY 0X03 +#define BNO055_MAG_OPERATION_MODE_LOWPOWER (0X00) +#define BNO055_MAG_OPERATION_MODE_REGULAR (0X01) +#define BNO055_MAG_OPERATION_MODE_ENHANCED_REGULAR (0X02) +#define BNO055_MAG_OPERATION_MODE_HIGH_ACCURACY (0X03) /* Mag power mode*/ -#define MAG_POWER_MODE_NORMAL 0X00 -#define MAG_POWER_MODE_SLEEP 0X01 -#define MAG_POWER_MODE_SUSPEND 0X02 -#define MAG_POWER_MODE_FORCE_MODE 0X03 +#define BNO055_MAG_POWER_MODE_NORMAL (0X00) +#define BNO055_MAG_POWER_MODE_SLEEP (0X01) +#define BNO055_MAG_POWER_MODE_SUSPEND (0X02) +#define BNO055_MAG_POWER_MODE_FORCE_MODE (0X03) /* Gyro range*/ -#define GYRO_RANGE_2000DPS 0x00 -#define GYRO_RANGE_1000DPS 0x01 -#define GYRO_RANGE_500DPS 0x02 -#define GYRO_RANGE_250DPS 0x03 -#define GYRO_RANGE_125DPS 0x04 +#define BNO055_GYRO_RANGE_2000DPS (0x00) +#define BNO055_GYRO_RANGE_1000DPS (0x01) +#define BNO055_GYRO_RANGE_500DPS (0x02) +#define BNO055_GYRO_RANGE_250DPS (0x03) +#define BNO055_GYRO_RANGE_125DPS (0x04) /* Gyro Bandwidth*/ -#define GYRO_BW_523HZ 0x00 -#define GYRO_BW_230HZ 0x01 -#define GYRO_BW_116HZ 0x02 -#define GYRO_BW_47HZ 0x03 -#define GYRO_BW_23HZ 0x04 -#define GYRO_BW_12HZ 0x05 -#define GYRO_BW_64HZ 0x06 -#define GYRO_BW_32HZ 0x07 +#define BNO055_GYRO_BW_523HZ (0x00) +#define BNO055_GYRO_BW_230HZ (0x01) +#define BNO055_GYRO_BW_116HZ (0x02) +#define BNO055_GYRO_BW_47HZ (0x03) +#define BNO055_GYRO_BW_23HZ (0x04) +#define BNO055_GYRO_BW_12HZ (0x05) +#define BNO055_GYRO_BW_64HZ (0x06) +#define BNO055_GYRO_BW_32HZ (0x07) /* Gyro power mode*/ -#define GYRO_POWER_MODE_NORMAL 0X00 -#define GYRO_POWER_MODE_FASTPOWERUP 0X01 -#define GYRO_POWER_MODE_DEEPSUSPEND 0X02 -#define GYRO_POWER_MODE_SUSPEND 0X03 -#define GYRO_POWER_MODE_ADVANCE_POWERSAVE 0X04 +#define BNO055_GYRO_POWER_MODE_NORMAL (0X00) +#define BNO055_GYRO_POWER_MODE_FASTPOWERUP (0X01) +#define BNO055_GYRO_POWER_MODE_DEEPSUSPEND (0X02) +#define BNO055_GYRO_POWER_MODE_SUSPEND (0X03) +#define BNO055_GYRO_POWER_MODE_ADVANCE_POWERSAVE (0X04) /* Accel Sleep Duration */ -#define BNO055_ACCEL_SLEEP_DURN_0_5MS 0x05 +#define BNO055_ACCEL_SLEEP_DURN_0_5MS (0x05) /* sets sleep duration to 0.5 ms */ -#define BNO055_ACCEL_SLEEP_DURN_1MS 0x06 +#define BNO055_ACCEL_SLEEP_DURN_1MS (0x06) /* sets sleep duration to 1 ms */ -#define BNO055_ACCEL_SLEEP_DURN_2MS 0x07 +#define BNO055_ACCEL_SLEEP_DURN_2MS (0x07) /* sets sleep duration to 2 ms */ -#define BNO055_ACCEL_SLEEP_DURN_4MS 0x08 +#define BNO055_ACCEL_SLEEP_DURN_4MS (0x08) /* sets sleep duration to 4 ms */ -#define BNO055_ACCEL_SLEEP_DURN_6MS 0x09 +#define BNO055_ACCEL_SLEEP_DURN_6MS (0x09) /* sets sleep duration to 6 ms*/ -#define BNO055_ACCEL_SLEEP_DURN_10MS 0x0A +#define BNO055_ACCEL_SLEEP_DURN_10MS (0x0A) /* sets sleep duration to 10 ms */ -#define BNO055_ACCEL_SLEEP_DURN_25MS 0x0B +#define BNO055_ACCEL_SLEEP_DURN_25MS (0x0B) /* sets sleep duration to 25 ms */ -#define BNO055_ACCEL_SLEEP_DURN_50MS 0x0C +#define BNO055_ACCEL_SLEEP_DURN_50MS (0x0C) /* sets sleep duration to 50 ms */ -#define BNO055_ACCEL_SLEEP_DURN_100MS 0x0D +#define BNO055_ACCEL_SLEEP_DURN_100MS (0x0D) /* sets sleep duration to 100 ms */ -#define BNO055_ACCEL_SLEEP_DURN_500MS 0x0E +#define BNO055_ACCEL_SLEEP_DURN_500MS (0x0E) /* sets sleep duration to 500 ms */ -#define BNO055_ACCEL_SLEEP_DURN_1S 0x0F +#define BNO055_ACCEL_SLEEP_DURN_1S (0x0F) /* sets sleep duration to 1 s */ /* Gyro Auto sleep duration*/ -#define BNO055_GYRO_No_AUTOSLPDUR 0x00 -#define BNO055_GYRO_4MS_AUTOSLPDUR 0x01 -#define BNO055_GYRO_5MS_AUTOSLPDUR 0x02 -#define BNO055_GYRO_8MS_AUTOSLPDUR 0x03 -#define BNO055_GYRO_10MS_AUTOSLPDUR 0x04 -#define BNO055_GYRO_15MS_AUTOSLPDUR 0x05 -#define BNO055_GYRO_20MS_AUTOSLPDUR 0x06 -#define BNO055_GYRO_40MS_AUTOSLPDUR 0x07 +#define BNO055_GYRO_No_AUTOSLPDUR (0x00) +#define BNO055_GYRO_4MS_AUTOSLPDUR (0x01) +#define BNO055_GYRO_5MS_AUTOSLPDUR (0x02) +#define BNO055_GYRO_8MS_AUTOSLPDUR (0x03) +#define BNO055_GYRO_10MS_AUTOSLPDUR (0x04) +#define BNO055_GYRO_15MS_AUTOSLPDUR (0x05) +#define BNO055_GYRO_20MS_AUTOSLPDUR (0x06) +#define BNO055_GYRO_40MS_AUTOSLPDUR (0x07) /* Accel Any/No motion axis selection*/ -#define BNO055_ACCEL_ANY_MOTION_NO_MOTION_X_AXIS 0 -#define BNO055_ACCEL_ANY_MOTION_NO_MOTION_Y_AXIS 1 -#define BNO055_ACCEL_ANY_MOTION_NO_MOTION_Z_AXIS 2 +#define BNO055_ACCEL_ANY_MOTION_NO_MOTION_X_AXIS (0) +#define BNO055_ACCEL_ANY_MOTION_NO_MOTION_Y_AXIS (1) +#define BNO055_ACCEL_ANY_MOTION_NO_MOTION_Z_AXIS (2) /* Accel High g axis selection*/ -#define BNO055_ACCEL_HIGH_G_X_AXIS 0 -#define BNO055_ACCEL_HIGH_G_Y_AXIS 1 -#define BNO055_ACCEL_HIGH_G_Z_AXIS 2 +#define BNO055_ACCEL_HIGH_G_X_AXIS (0) +#define BNO055_ACCEL_HIGH_G_Y_AXIS (1) +#define BNO055_ACCEL_HIGH_G_Z_AXIS (2) /* Gyro Any motion axis selection*/ -#define BNO055_GYRO_ANY_MOTION_X_AXIS 0 -#define BNO055_GYRO_ANY_MOTION_Y_AXIS 1 -#define BNO055_GYRO_ANY_MOTION_Z_AXIS 2 +#define BNO055_GYRO_ANY_MOTION_X_AXIS (0) +#define BNO055_GYRO_ANY_MOTION_Y_AXIS (1) +#define BNO055_GYRO_ANY_MOTION_Z_AXIS (2) /* Gyro High rate axis selection*/ -#define BNO055_GYRO_HIGHRATE_X_AXIS 0 -#define BNO055_GYRO_HIGHRATE_Y_AXIS 1 -#define BNO055_GYRO_HIGHRATE_Z_AXIS 2 +#define BNO055_GYRO_HIGHRATE_X_AXIS (0) +#define BNO055_GYRO_HIGHRATE_Y_AXIS (1) +#define BNO055_GYRO_HIGHRATE_Z_AXIS (2) /* Axis remap values*/ -#define REMAP_X_Y 0X21 -#define REMAP_Y_Z 0X18 -#define REMAP_Z_X 0X06 -#define REMAP_X_Y_Z_TYPE0 0X12 -#define REMAP_X_Y_Z_TYPE1 0X09 -#define DEFAULT_AXIS 0X24 +#define BNO055_REMAP_X_Y (0X21) +#define BNO055_REMAP_Y_Z (0X18) +#define BNO055_REMAP_Z_X (0X06) +#define BNO055_REMAP_X_Y_Z_TYPE0 (0X12) +#define BNO055_REMAP_X_Y_Z_TYPE1 (0X09) +#define BNO055_DEFAULT_AXIS (0X24) /* Axis remap sign */ -#define REMAP_AXIS_POSITIVE 0X00 -#define REMAP_AXIS_NEGATIVE 0X01 +#define BNO055_REMAP_AXIS_POSITIVE (0X00) +#define BNO055_REMAP_AXIS_NEGATIVE (0X01) /* Gyro anymotion and high rate filter configuration */ -#define FILTERED 0x00 -#define UNFILTERED 0x01 +#define BNO055_GYRO_FILTERED_CONFIG (0x00) +#define BNO055_GYRO_UNFILTERED_CONFIG (0x01) /* mask definitions*/ -#define BNO055_SIC_HEX_0_0_F_F_DATA 0x00FF +#define BNO055_SIC_HEX_0_0_F_F_DATA (0x00FF) /****************************************************/ /**\name ARRAY SIZE DEFINITIONS */ /***************************************************/ -#define ARRAY_SIZE_TWO 2 -#define ARRAY_SIZE_THREE 3 -#define ARRAY_SIZE_SIX 6 -#define ARRAY_SIZE_FIVE 5 -#define ARRAY_SIZE_EIGHT 8 -#define ARRAY_SIZE_TWELVE 12 -#define ARRAY_SIZE_FOURTEEN 14 -#define ARRAY_SIZE_EIGHTEEN 18 -#define ARRAY_SIZE_TWENTY_SIX 26 - -#define INDEX_ZERO 0 -#define INDEX_ONE 1 -#define INDEX_TWO 2 -#define INDEX_THREE 3 -#define INDEX_FOUR 4 -#define INDEX_FIVE 5 -#define INDEX_SIX 6 -#define INDEX_SEVEN 7 -#define INDEX_EIGHT 8 -#define INDEX_NINE 9 -#define INDEX_TEN 10 -#define INDEX_ELEVEN 11 -#define INDEX_TWELVE 12 -#define INDEX_THIRTEEN 13 -#define INDEX_FOURTEEN 14 -#define INDEX_FIVETEEN 15 -#define INDEX_SIXTEEN 16 -#define INDEX_SEVENTEEN 17 -#define INDEX_EIGHTEEN 18 -#define INDEX_NINETEEN 19 -#define INDEX_TWENTY 20 -#define INDEX_TWENTY_ONE 21 -#define INDEX_TWENTY_TWO 22 -#define INDEX_TWENTY_THREE 23 -#define INDEX_TWENTY_FIVE 25 -/****************************************************/ -/**\name ARRAY PARAMETERS */ -/***************************************************/ -#define LSB_ZERO 0 -#define MSB_ONE 1 -#define LSB_TWO 2 -#define MSB_THREE 3 -#define LSB_FOUR 4 -#define MSB_FIVE 5 -#define LSB_SIX 6 -#define MSB_SEVEN 7 +#define BNO055_REV_ID_SIZE (2) +#define BNO055_ACCEL_DATA_SIZE (2) +#define BNO055_ACCEL_XYZ_DATA_SIZE (6) +#define BNO055_MAG_DATA_SIZE (2) +#define BNO055_MAG_XYZ_DATA_SIZE (6) +#define BNO055_GYRO_DATA_SIZE (2) +#define BNO055_GYRO_XYZ_DATA_SIZE (6) +#define BNO055_EULER_DATA_SIZE (2) +#define BNO055_EULER_HRP_DATA_SIZE (6) +#define BNO055_QUATERNION_DATA_SIZE (2) +#define BNO055_QUATERNION_WXYZ_DATA_SIZE (8) +#define BNO055_GRAVITY_DATA_SIZE (2) +#define BNO055_GRAVITY_XYZ_DATA_SIZE (6) +#define BNO055_ACCEL_OFFSET_ARRAY (6) +#define BNO055_MAG_OFFSET_ARRAY (6) +#define BNO055_GYRO_OFFSET_ARRAY (6) +#define BNO055_SOFT_IRON_CALIBRATION_MATRIX_SIZE (18) + + +/*ARRAY INDEX DEFINITIONS*/ +#define BNO055_SW_ID_LSB (0) +#define BNO055_SW_ID_MSB (1) +#define BNO055_SENSOR_DATA_LSB (0) +#define BNO055_SENSOR_DATA_MSB (1) +#define BNO055_SENSOR_DATA_EULER_LSB (0) +#define BNO055_SENSOR_DATA_EULER_MSB (1) +#define BNO055_SENSOR_DATA_QUATERNION_LSB (0) +#define BNO055_SENSOR_DATA_QUATERNION_MSB (1) + +#define BNO055_SENSOR_DATA_QUATERNION_WXYZ_W_LSB (0) +#define BNO055_SENSOR_DATA_QUATERNION_WXYZ_W_MSB (1) +#define BNO055_SENSOR_DATA_QUATERNION_WXYZ_X_LSB (2) +#define BNO055_SENSOR_DATA_QUATERNION_WXYZ_X_MSB (3) +#define BNO055_SENSOR_DATA_QUATERNION_WXYZ_Y_LSB (4) +#define BNO055_SENSOR_DATA_QUATERNION_WXYZ_Y_MSB (5) +#define BNO055_SENSOR_DATA_QUATERNION_WXYZ_Z_LSB (6) +#define BNO055_SENSOR_DATA_QUATERNION_WXYZ_Z_MSB (7) + +#define BNO055_SENSOR_DATA_XYZ_X_LSB (0) +#define BNO055_SENSOR_DATA_XYZ_X_MSB (1) +#define BNO055_SENSOR_DATA_XYZ_Y_LSB (2) +#define BNO055_SENSOR_DATA_XYZ_Y_MSB (3) +#define BNO055_SENSOR_DATA_XYZ_Z_LSB (4) +#define BNO055_SENSOR_DATA_XYZ_Z_MSB (5) + + +#define BNO055_SENSOR_DATA_EULER_HRP_H_LSB (0) +#define BNO055_SENSOR_DATA_EULER_HRP_H_MSB (1) +#define BNO055_SENSOR_DATA_EULER_HRP_R_LSB (2) +#define BNO055_SENSOR_DATA_EULER_HRP_R_MSB (3) +#define BNO055_SENSOR_DATA_EULER_HRP_P_LSB (4) +#define BNO055_SENSOR_DATA_EULER_HRP_P_MSB (5) + +#define BNO055_SOFT_IRON_CALIB_0_LSB (0) +#define BNO055_SOFT_IRON_CALIB_0_MSB (1) +#define BNO055_SOFT_IRON_CALIB_1_LSB (2) +#define BNO055_SOFT_IRON_CALIB_1_MSB (3) +#define BNO055_SOFT_IRON_CALIB_2_LSB (4) +#define BNO055_SOFT_IRON_CALIB_2_MSB (5) +#define BNO055_SOFT_IRON_CALIB_3_LSB (6) +#define BNO055_SOFT_IRON_CALIB_3_MSB (7) +#define BNO055_SOFT_IRON_CALIB_4_LSB (8) +#define BNO055_SOFT_IRON_CALIB_4_MSB (9) +#define BNO055_SOFT_IRON_CALIB_5_LSB (10) +#define BNO055_SOFT_IRON_CALIB_5_MSB (11) +#define BNO055_SOFT_IRON_CALIB_6_LSB (12) +#define BNO055_SOFT_IRON_CALIB_6_MSB (13) +#define BNO055_SOFT_IRON_CALIB_7_LSB (14) +#define BNO055_SOFT_IRON_CALIB_7_MSB (15) +#define BNO055_SOFT_IRON_CALIB_8_LSB (16) +#define BNO055_SOFT_IRON_CALIB_8_MSB (17) + +#define BNO055_SENSOR_OFFSET_DATA_X_LSB (0) +#define BNO055_SENSOR_OFFSET_DATA_X_MSB (1) +#define BNO055_SENSOR_OFFSET_DATA_Y_LSB (2) +#define BNO055_SENSOR_OFFSET_DATA_Y_MSB (3) +#define BNO055_SENSOR_OFFSET_DATA_Z_LSB (4) +#define BNO055_SENSOR_OFFSET_DATA_Z_MSB (5) + +#define BNO055_OFFSET_RADIUS_LSB (0) +#define BNO055_OFFSET_RADIUS_MSB (1) /*********************************************************/ /**\name PAGE0 DATA REGISTERS DEFINITION */ /*********************************************************/ /* Chip ID */ -#define BNO055_CHIP_ID__POS 0 -#define BNO055_CHIP_ID__MSK 0xFF -#define BNO055_CHIP_ID__LEN 8 -#define BNO055_CHIP_ID__REG BNO055_CHIP_ID_ADDR +#define BNO055_CHIP_ID_POS (0) +#define BNO055_CHIP_ID_MSK (0xFF) +#define BNO055_CHIP_ID_LEN (8) +#define BNO055_CHIP_ID_REG BNO055_CHIP_ID_ADDR /* Accel revision id*/ -#define BNO055_ACCEL_REV_ID__POS 0 -#define BNO055_ACCEL_REV_ID__MSK 0xFF -#define BNO055_ACCEL_REV_ID__LEN 8 -#define BNO055_ACCEL_REV_ID__REG BNO055_ACCEL_REV_ID_ADDR +#define BNO055_ACCEL_REV_ID_POS (0) +#define BNO055_ACCEL_REV_ID_MSK (0xFF) +#define BNO055_ACCEL_REV_ID_LEN (8) +#define BNO055_ACCEL_REV_ID_REG BNO055_ACCEL_REV_ID_ADDR /* Mag revision id*/ -#define BNO055_MAG_REV_ID__POS 0 -#define BNO055_MAG_REV_ID__MSK 0xFF -#define BNO055_MAG_REV_ID__LEN 8 -#define BNO055_MAG_REV_ID__REG BNO055_MAG_REV_ID_ADDR +#define BNO055_MAG_REV_ID_POS (0) +#define BNO055_MAG_REV_ID_MSK (0xFF) +#define BNO055_MAG_REV_ID_LEN (8) +#define BNO055_MAG_REV_ID_REG BNO055_MAG_REV_ID_ADDR /* Gyro revision id*/ -#define BNO055_GYRO_REV_ID__POS 0 -#define BNO055_GYRO_REV_ID__MSK 0xFF -#define BNO055_GYRO_REV_ID__LEN 8 -#define BNO055_GYRO_REV_ID__REG BNO055_GYRO_REV_ID_ADDR +#define BNO055_GYRO_REV_ID_POS (0) +#define BNO055_GYRO_REV_ID_MSK (0xFF) +#define BNO055_GYRO_REV_ID_LEN (8) +#define BNO055_GYRO_REV_ID_REG BNO055_GYRO_REV_ID_ADDR /*Software revision id LSB*/ -#define BNO055_SW_REV_ID_LSB__POS 0 -#define BNO055_SW_REV_ID_LSB__MSK 0xFF -#define BNO055_SW_REV_ID_LSB__LEN 8 -#define BNO055_SW_REV_ID_LSB__REG BNO055_SW_REV_ID_LSB_ADDR +#define BNO055_SW_REV_ID_LSB_POS (0) +#define BNO055_SW_REV_ID_LSB_MSK (0xFF) +#define BNO055_SW_REV_ID_LSB_LEN (8) +#define BNO055_SW_REV_ID_LSB_REG BNO055_SW_REV_ID_LSB_ADDR /*Software revision id MSB*/ -#define BNO055_SW_REV_ID_MSB__POS 0 -#define BNO055_SW_REV_ID_MSB__MSK 0xFF -#define BNO055_SW_REV_ID_MSB__LEN 8 -#define BNO055_SW_REV_ID_MSB__REG BNO055_SW_REV_ID_MSB_ADDR +#define BNO055_SW_REV_ID_MSB_POS (0) +#define BNO055_SW_REV_ID_MSB_MSK (0xFF) +#define BNO055_SW_REV_ID_MSB_LEN (8) +#define BNO055_SW_REV_ID_MSB_REG BNO055_SW_REV_ID_MSB_ADDR /* BOOTLODER revision id*/ -#define BNO055_BL_REV_ID__POS 0 -#define BNO055_BL_REV_ID__MSK 0xFF -#define BNO055_BL_REV_ID__LEN 8 -#define BNO055_BL_REV_ID__REG BNO055_BL_REV_ID_ADDR +#define BNO055_BL_REV_ID_POS (0) +#define BNO055_BL_REV_ID_MSK (0xFF) +#define BNO055_BL_REV_ID_LEN (8) +#define BNO055_BL_REV_ID_REG BNO055_BL_REV_ID_ADDR /*Page id*/ -#define BNO055_PAGE_ID__POS 0 -#define BNO055_PAGE_ID__MSK 0xFF -#define BNO055_PAGE_ID__LEN 8 -#define BNO055_PAGE_ID__REG BNO055_PAGE_ID_ADDR +#define BNO055_PAGE_ID_POS (0) +#define BNO055_PAGE_ID_MSK (0xFF) +#define BNO055_PAGE_ID_LEN (8) +#define BNO055_PAGE_ID_REG BNO055_PAGE_ID_ADDR /* Accel data X-LSB register*/ -#define BNO055_ACCEL_DATA_X_LSB_VALUEX__POS 0 -#define BNO055_ACCEL_DATA_X_LSB_VALUEX__MSK 0xFF -#define BNO055_ACCEL_DATA_X_LSB_VALUEX__LEN 8 -#define BNO055_ACCEL_DATA_X_LSB_VALUEX__REG \ +#define BNO055_ACCEL_DATA_X_LSB_VALUEX_POS (0) +#define BNO055_ACCEL_DATA_X_LSB_VALUEX_MSK (0xFF) +#define BNO055_ACCEL_DATA_X_LSB_VALUEX_LEN (8) +#define BNO055_ACCEL_DATA_X_LSB_VALUEX_REG \ BNO055_ACCEL_DATA_X_LSB_ADDR /* Accel data X-MSB register*/ -#define BNO055_ACCEL_DATA_X_MSB_VALUEX__POS 0 -#define BNO055_ACCEL_DATA_X_MSB_VALUEX__MSK 0xFF -#define BNO055_ACCEL_DATA_X_MSB_VALUEX__LEN 8 -#define BNO055_ACCEL_DATA_X_MSB_VALUEX__REG \ +#define BNO055_ACCEL_DATA_X_MSB_VALUEX_POS (0) +#define BNO055_ACCEL_DATA_X_MSB_VALUEX_MSK (0xFF) +#define BNO055_ACCEL_DATA_X_MSB_VALUEX_LEN (8) +#define BNO055_ACCEL_DATA_X_MSB_VALUEX_REG \ BNO055_ACCEL_DATA_X_MSB_ADDR /* Accel data Y-LSB register*/ -#define BNO055_ACCEL_DATA_Y_LSB_VALUEY__POS 0 -#define BNO055_ACCEL_DATA_Y_LSB_VALUEY__MSK 0xFF -#define BNO055_ACCEL_DATA_Y_LSB_VALUEY__LEN 8 -#define BNO055_ACCEL_DATA_Y_LSB_VALUEY__REG \ +#define BNO055_ACCEL_DATA_Y_LSB_VALUEY_POS (0) +#define BNO055_ACCEL_DATA_Y_LSB_VALUEY_MSK (0xFF) +#define BNO055_ACCEL_DATA_Y_LSB_VALUEY_LEN (8) +#define BNO055_ACCEL_DATA_Y_LSB_VALUEY_REG \ BNO055_ACCEL_DATA_Y_LSB_ADDR /* Accel data Y-MSB register*/ -#define BNO055_ACCEL_DATA_Y_MSB_VALUEY__POS 0 -#define BNO055_ACCEL_DATA_Y_MSB_VALUEY__MSK 0xFF -#define BNO055_ACCEL_DATA_Y_MSB_VALUEY__LEN 8 -#define BNO055_ACCEL_DATA_Y_MSB_VALUEY__REG \ +#define BNO055_ACCEL_DATA_Y_MSB_VALUEY_POS (0) +#define BNO055_ACCEL_DATA_Y_MSB_VALUEY_MSK (0xFF) +#define BNO055_ACCEL_DATA_Y_MSB_VALUEY_LEN (8) +#define BNO055_ACCEL_DATA_Y_MSB_VALUEY_REG \ BNO055_ACCEL_DATA_Y_MSB_ADDR /* Accel data Z-LSB register*/ -#define BNO055_ACCEL_DATA_Z_LSB_VALUEZ__POS 0 -#define BNO055_ACCEL_DATA_Z_LSB_VALUEZ__MSK 0xFF -#define BNO055_ACCEL_DATA_Z_LSB_VALUEZ__LEN 8 -#define BNO055_ACCEL_DATA_Z_LSB_VALUEZ__REG \ +#define BNO055_ACCEL_DATA_Z_LSB_VALUEZ_POS (0) +#define BNO055_ACCEL_DATA_Z_LSB_VALUEZ_MSK (0xFF) +#define BNO055_ACCEL_DATA_Z_LSB_VALUEZ_LEN (8) +#define BNO055_ACCEL_DATA_Z_LSB_VALUEZ_REG \ BNO055_ACCEL_DATA_Z_LSB_ADDR /* Accel data Z-MSB register*/ -#define BNO055_ACCEL_DATA_Z_MSB_VALUEZ__POS 0 -#define BNO055_ACCEL_DATA_Z_MSB_VALUEZ__MSK 0xFF -#define BNO055_ACCEL_DATA_Z_MSB_VALUEZ__LEN 8 -#define BNO055_ACCEL_DATA_Z_MSB_VALUEZ__REG \ +#define BNO055_ACCEL_DATA_Z_MSB_VALUEZ_POS (0) +#define BNO055_ACCEL_DATA_Z_MSB_VALUEZ_MSK (0xFF) +#define BNO055_ACCEL_DATA_Z_MSB_VALUEZ_LEN (8) +#define BNO055_ACCEL_DATA_Z_MSB_VALUEZ_REG \ BNO055_ACCEL_DATA_Z_MSB_ADDR /* Mag data X-LSB register*/ -#define BNO055_MAG_DATA_X_LSB_VALUEX__POS 0 -#define BNO055_MAG_DATA_X_LSB_VALUEX__MSK 0xFF -#define BNO055_MAG_DATA_X_LSB_VALUEX__LEN 8 -#define BNO055_MAG_DATA_X_LSB_VALUEX__REG \ +#define BNO055_MAG_DATA_X_LSB_VALUEX_POS (0) +#define BNO055_MAG_DATA_X_LSB_VALUEX_MSK (0xFF) +#define BNO055_MAG_DATA_X_LSB_VALUEX_LEN (8) +#define BNO055_MAG_DATA_X_LSB_VALUEX_REG \ BNO055_MAG_DATA_X_LSB_ADDR /* Mag data X-MSB register*/ -#define BNO055_MAG_DATA_X_MSB_VALUEX__POS 0 -#define BNO055_MAG_DATA_X_MSB_VALUEX__MSK 0xFF -#define BNO055_MAG_DATA_X_MSB_VALUEX__LEN 8 -#define BNO055_MAG_DATA_X_MSB_VALUEX__REG BNO055_MAG_DATA_X_MSB_ADDR +#define BNO055_MAG_DATA_X_MSB_VALUEX_POS (0) +#define BNO055_MAG_DATA_X_MSB_VALUEX_MSK (0xFF) +#define BNO055_MAG_DATA_X_MSB_VALUEX_LEN (8) +#define BNO055_MAG_DATA_X_MSB_VALUEX_REG BNO055_MAG_DATA_X_MSB_ADDR /* Mag data Y-LSB register*/ -#define BNO055_MAG_DATA_Y_LSB_VALUEY__POS 0 -#define BNO055_MAG_DATA_Y_LSB_VALUEY__MSK 0xFF -#define BNO055_MAG_DATA_Y_LSB_VALUEY__LEN 8 -#define BNO055_MAG_DATA_Y_LSB_VALUEY__REG BNO055_MAG_DATA_Y_LSB_ADDR +#define BNO055_MAG_DATA_Y_LSB_VALUEY_POS (0) +#define BNO055_MAG_DATA_Y_LSB_VALUEY_MSK (0xFF) +#define BNO055_MAG_DATA_Y_LSB_VALUEY_LEN (8) +#define BNO055_MAG_DATA_Y_LSB_VALUEY_REG BNO055_MAG_DATA_Y_LSB_ADDR /* Mag data Y-MSB register*/ -#define BNO055_MAG_DATA_Y_MSB_VALUEY__POS 0 -#define BNO055_MAG_DATA_Y_MSB_VALUEY__MSK 0xFF -#define BNO055_MAG_DATA_Y_MSB_VALUEY__LEN 8 -#define BNO055_MAG_DATA_Y_MSB_VALUEY__REG BNO055_MAG_DATA_Y_MSB_ADDR +#define BNO055_MAG_DATA_Y_MSB_VALUEY_POS (0) +#define BNO055_MAG_DATA_Y_MSB_VALUEY_MSK (0xFF) +#define BNO055_MAG_DATA_Y_MSB_VALUEY_LEN (8) +#define BNO055_MAG_DATA_Y_MSB_VALUEY_REG BNO055_MAG_DATA_Y_MSB_ADDR /* Mag data Z-LSB register*/ -#define BNO055_MAG_DATA_Z_LSB_VALUEZ__POS 0 -#define BNO055_MAG_DATA_Z_LSB_VALUEZ__MSK 0xFF -#define BNO055_MAG_DATA_Z_LSB_VALUEZ__LEN 8 -#define BNO055_MAG_DATA_Z_LSB_VALUEZ__REG BNO055_MAG_DATA_Z_LSB_ADDR +#define BNO055_MAG_DATA_Z_LSB_VALUEZ_POS (0) +#define BNO055_MAG_DATA_Z_LSB_VALUEZ_MSK (0xFF) +#define BNO055_MAG_DATA_Z_LSB_VALUEZ_LEN (8) +#define BNO055_MAG_DATA_Z_LSB_VALUEZ_REG BNO055_MAG_DATA_Z_LSB_ADDR /* Mag data Z-MSB register*/ -#define BNO055_MAG_DATA_Z_MSB_VALUEZ__POS 0 -#define BNO055_MAG_DATA_Z_MSB_VALUEZ__MSK 0xFF -#define BNO055_MAG_DATA_Z_MSB_VALUEZ__LEN 8 -#define BNO055_MAG_DATA_Z_MSB_VALUEZ__REG BNO055_MAG_DATA_Z_MSB_ADDR +#define BNO055_MAG_DATA_Z_MSB_VALUEZ_POS (0) +#define BNO055_MAG_DATA_Z_MSB_VALUEZ_MSK (0xFF) +#define BNO055_MAG_DATA_Z_MSB_VALUEZ_LEN (8) +#define BNO055_MAG_DATA_Z_MSB_VALUEZ_REG BNO055_MAG_DATA_Z_MSB_ADDR /* Gyro data X-LSB register*/ -#define BNO055_GYRO_DATA_X_LSB_VALUEX__POS 0 -#define BNO055_GYRO_DATA_X_LSB_VALUEX__MSK 0xFF -#define BNO055_GYRO_DATA_X_LSB_VALUEX__LEN 8 -#define BNO055_GYRO_DATA_X_LSB_VALUEX__REG BNO055_GYRO_DATA_X_LSB_ADDR +#define BNO055_GYRO_DATA_X_LSB_VALUEX_POS (0) +#define BNO055_GYRO_DATA_X_LSB_VALUEX_MSK (0xFF) +#define BNO055_GYRO_DATA_X_LSB_VALUEX_LEN (8) +#define BNO055_GYRO_DATA_X_LSB_VALUEX_REG BNO055_GYRO_DATA_X_LSB_ADDR /* Gyro data X-MSB register*/ -#define BNO055_GYRO_DATA_X_MSB_VALUEX__POS 0 -#define BNO055_GYRO_DATA_X_MSB_VALUEX__MSK 0xFF -#define BNO055_GYRO_DATA_X_MSB_VALUEX__LEN 8 -#define BNO055_GYRO_DATA_X_MSB_VALUEX__REG BNO055_GYRO_DATA_X_MSB_ADDR +#define BNO055_GYRO_DATA_X_MSB_VALUEX_POS (0) +#define BNO055_GYRO_DATA_X_MSB_VALUEX_MSK (0xFF) +#define BNO055_GYRO_DATA_X_MSB_VALUEX_LEN (8) +#define BNO055_GYRO_DATA_X_MSB_VALUEX_REG BNO055_GYRO_DATA_X_MSB_ADDR /* Gyro data Y-LSB register*/ -#define BNO055_GYRO_DATA_Y_LSB_VALUEY__POS 0 -#define BNO055_GYRO_DATA_Y_LSB_VALUEY__MSK 0xFF -#define BNO055_GYRO_DATA_Y_LSB_VALUEY__LEN 8 -#define BNO055_GYRO_DATA_Y_LSB_VALUEY__REG BNO055_GYRO_DATA_Y_LSB_ADDR +#define BNO055_GYRO_DATA_Y_LSB_VALUEY_POS (0) +#define BNO055_GYRO_DATA_Y_LSB_VALUEY_MSK (0xFF) +#define BNO055_GYRO_DATA_Y_LSB_VALUEY_LEN (8) +#define BNO055_GYRO_DATA_Y_LSB_VALUEY_REG BNO055_GYRO_DATA_Y_LSB_ADDR /* Gyro data Y-MSB register*/ -#define BNO055_GYRO_DATA_Y_MSB_VALUEY__POS 0 -#define BNO055_GYRO_DATA_Y_MSB_VALUEY__MSK 0xFF -#define BNO055_GYRO_DATA_Y_MSB_VALUEY__LEN 8 -#define BNO055_GYRO_DATA_Y_MSB_VALUEY__REG BNO055_GYRO_DATA_Y_MSB_ADDR +#define BNO055_GYRO_DATA_Y_MSB_VALUEY_POS (0) +#define BNO055_GYRO_DATA_Y_MSB_VALUEY_MSK (0xFF) +#define BNO055_GYRO_DATA_Y_MSB_VALUEY_LEN (8) +#define BNO055_GYRO_DATA_Y_MSB_VALUEY_REG BNO055_GYRO_DATA_Y_MSB_ADDR /* Gyro data Z-LSB register*/ -#define BNO055_GYRO_DATA_Z_LSB_VALUEZ__POS 0 -#define BNO055_GYRO_DATA_Z_LSB_VALUEZ__MSK 0xFF -#define BNO055_GYRO_DATA_Z_LSB_VALUEZ__LEN 8 -#define BNO055_GYRO_DATA_Z_LSB_VALUEZ__REG BNO055_GYRO_DATA_Z_LSB_ADDR +#define BNO055_GYRO_DATA_Z_LSB_VALUEZ_POS (0) +#define BNO055_GYRO_DATA_Z_LSB_VALUEZ_MSK (0xFF) +#define BNO055_GYRO_DATA_Z_LSB_VALUEZ_LEN (8) +#define BNO055_GYRO_DATA_Z_LSB_VALUEZ_REG BNO055_GYRO_DATA_Z_LSB_ADDR /* Gyro data Z-MSB register*/ -#define BNO055_GYRO_DATA_Z_MSB_VALUEZ__POS 0 -#define BNO055_GYRO_DATA_Z_MSB_VALUEZ__MSK 0xFF -#define BNO055_GYRO_DATA_Z_MSB_VALUEZ__LEN 8 -#define BNO055_GYRO_DATA_Z_MSB_VALUEZ__REG BNO055_GYRO_DATA_Z_MSB_ADDR +#define BNO055_GYRO_DATA_Z_MSB_VALUEZ_POS (0) +#define BNO055_GYRO_DATA_Z_MSB_VALUEZ_MSK (0xFF) +#define BNO055_GYRO_DATA_Z_MSB_VALUEZ_LEN (8) +#define BNO055_GYRO_DATA_Z_MSB_VALUEZ_REG BNO055_GYRO_DATA_Z_MSB_ADDR /* Euler data HEADING-LSB register*/ -#define BNO055_EULER_H_LSB_VALUEH__POS 0 -#define BNO055_EULER_H_LSB_VALUEH__MSK 0xFF -#define BNO055_EULER_H_LSB_VALUEH__LEN 8 -#define BNO055_EULER_H_LSB_VALUEH__REG BNO055_EULER_H_LSB_ADDR +#define BNO055_EULER_H_LSB_VALUEH_POS (0) +#define BNO055_EULER_H_LSB_VALUEH_MSK (0xFF) +#define BNO055_EULER_H_LSB_VALUEH_LEN (8) +#define BNO055_EULER_H_LSB_VALUEH_REG BNO055_EULER_H_LSB_ADDR /* Euler data HEADING-MSB register*/ -#define BNO055_EULER_H_MSB_VALUEH__POS 0 -#define BNO055_EULER_H_MSB_VALUEH__MSK 0xFF -#define BNO055_EULER_H_MSB_VALUEH__LEN 8 -#define BNO055_EULER_H_MSB_VALUEH__REG BNO055_EULER_H_MSB_ADDR +#define BNO055_EULER_H_MSB_VALUEH_POS (0) +#define BNO055_EULER_H_MSB_VALUEH_MSK (0xFF) +#define BNO055_EULER_H_MSB_VALUEH_LEN (8) +#define BNO055_EULER_H_MSB_VALUEH_REG BNO055_EULER_H_MSB_ADDR /* Euler data ROLL-LSB register*/ -#define BNO055_EULER_R_LSB_VALUER__POS 0 -#define BNO055_EULER_R_LSB_VALUER__MSK 0xFF -#define BNO055_EULER_R_LSB_VALUER__LEN 8 -#define BNO055_EULER_R_LSB_VALUER__REG BNO055_EULER_R_LSB_ADDR +#define BNO055_EULER_R_LSB_VALUER_POS (0) +#define BNO055_EULER_R_LSB_VALUER_MSK (0xFF) +#define BNO055_EULER_R_LSB_VALUER_LEN (8) +#define BNO055_EULER_R_LSB_VALUER_REG BNO055_EULER_R_LSB_ADDR /* Euler data ROLL-MSB register*/ -#define BNO055_EULER_R_MSB_VALUER__POS 0 -#define BNO055_EULER_R_MSB_VALUER__MSK 0xFF -#define BNO055_EULER_R_MSB_VALUER__LEN 8 -#define BNO055_EULER_R_MSB_VALUER__REG BNO055_EULER_R_MSB_ADDR +#define BNO055_EULER_R_MSB_VALUER_POS (0) +#define BNO055_EULER_R_MSB_VALUER_MSK (0xFF) +#define BNO055_EULER_R_MSB_VALUER_LEN (8) +#define BNO055_EULER_R_MSB_VALUER_REG BNO055_EULER_R_MSB_ADDR /* Euler data PITCH-LSB register*/ -#define BNO055_EULER_P_LSB_VALUEP__POS 0 -#define BNO055_EULER_P_LSB_VALUEP__MSK 0xFF -#define BNO055_EULER_P_LSB_VALUEP__LEN 8 -#define BNO055_EULER_P_LSB_VALUEP__REG BNO055_EULER_P_LSB_ADDR +#define BNO055_EULER_P_LSB_VALUEP_POS (0) +#define BNO055_EULER_P_LSB_VALUEP_MSK (0xFF) +#define BNO055_EULER_P_LSB_VALUEP_LEN (8) +#define BNO055_EULER_P_LSB_VALUEP_REG BNO055_EULER_P_LSB_ADDR /* Euler data HEADING-MSB register*/ -#define BNO055_EULER_P_MSB_VALUEP__POS 0 -#define BNO055_EULER_P_MSB_VALUEP__MSK 0xFF -#define BNO055_EULER_P_MSB_VALUEP__LEN 8 -#define BNO055_EULER_P_MSB_VALUEP__REG BNO055_EULER_P_MSB_ADDR +#define BNO055_EULER_P_MSB_VALUEP_POS (0) +#define BNO055_EULER_P_MSB_VALUEP_MSK (0xFF) +#define BNO055_EULER_P_MSB_VALUEP_LEN (8) +#define BNO055_EULER_P_MSB_VALUEP_REG BNO055_EULER_P_MSB_ADDR /* Quaternion data W-LSB register*/ -#define BNO055_QUATERNION_DATA_W_LSB_VALUEW__POS 0 -#define BNO055_QUATERNION_DATA_W_LSB_VALUEW__MSK 0xFF -#define BNO055_QUATERNION_DATA_W_LSB_VALUEW__LEN 8 -#define BNO055_QUATERNION_DATA_W_LSB_VALUEW__REG \ +#define BNO055_QUATERNION_DATA_W_LSB_VALUEW_POS (0) +#define BNO055_QUATERNION_DATA_W_LSB_VALUEW_MSK (0xFF) +#define BNO055_QUATERNION_DATA_W_LSB_VALUEW_LEN (8) +#define BNO055_QUATERNION_DATA_W_LSB_VALUEW_REG \ BNO055_QUATERNION_DATA_W_LSB_ADDR /* Quaternion data W-MSB register*/ -#define BNO055_QUATERNION_DATA_W_MSB_VALUEW__POS 0 -#define BNO055_QUATERNION_DATA_W_MSB_VALUEW__MSK 0xFF -#define BNO055_QUATERNION_DATA_W_MSB_VALUEW__LEN 8 -#define BNO055_QUATERNION_DATA_W_MSB_VALUEW__REG \ +#define BNO055_QUATERNION_DATA_W_MSB_VALUEW_POS (0) +#define BNO055_QUATERNION_DATA_W_MSB_VALUEW_MSK (0xFF) +#define BNO055_QUATERNION_DATA_W_MSB_VALUEW_LEN (8) +#define BNO055_QUATERNION_DATA_W_MSB_VALUEW_REG \ BNO055_QUATERNION_DATA_W_MSB_ADDR /* Quaternion data X-LSB register*/ -#define BNO055_QUATERNION_DATA_X_LSB_VALUEX__POS 0 -#define BNO055_QUATERNION_DATA_X_LSB_VALUEX__MSK 0xFF -#define BNO055_QUATERNION_DATA_X_LSB_VALUEX__LEN 8 -#define BNO055_QUATERNION_DATA_X_LSB_VALUEX__REG \ +#define BNO055_QUATERNION_DATA_X_LSB_VALUEX_POS (0) +#define BNO055_QUATERNION_DATA_X_LSB_VALUEX_MSK (0xFF) +#define BNO055_QUATERNION_DATA_X_LSB_VALUEX_LEN (8) +#define BNO055_QUATERNION_DATA_X_LSB_VALUEX_REG \ BNO055_QUATERNION_DATA_X_LSB_ADDR /* Quaternion data X-MSB register*/ -#define BNO055_QUATERNION_DATA_X_MSB_VALUEX__POS 0 -#define BNO055_QUATERNION_DATA_X_MSB_VALUEX__MSK 0xFF -#define BNO055_QUATERNION_DATA_X_MSB_VALUEX__LEN 8 -#define BNO055_QUATERNION_DATA_X_MSB_VALUEX__REG \ +#define BNO055_QUATERNION_DATA_X_MSB_VALUEX_POS (0) +#define BNO055_QUATERNION_DATA_X_MSB_VALUEX_MSK (0xFF) +#define BNO055_QUATERNION_DATA_X_MSB_VALUEX_LEN (8) +#define BNO055_QUATERNION_DATA_X_MSB_VALUEX_REG \ BNO055_QUATERNION_DATA_X_MSB_ADDR /* Quaternion data Y-LSB register*/ -#define BNO055_QUATERNION_DATA_Y_LSB_VALUEY__POS 0 -#define BNO055_QUATERNION_DATA_Y_LSB_VALUEY__MSK 0xFF -#define BNO055_QUATERNION_DATA_Y_LSB_VALUEY__LEN 8 -#define BNO055_QUATERNION_DATA_Y_LSB_VALUEY__REG \ +#define BNO055_QUATERNION_DATA_Y_LSB_VALUEY_POS (0) +#define BNO055_QUATERNION_DATA_Y_LSB_VALUEY_MSK (0xFF) +#define BNO055_QUATERNION_DATA_Y_LSB_VALUEY_LEN (8) +#define BNO055_QUATERNION_DATA_Y_LSB_VALUEY_REG \ BNO055_QUATERNION_DATA_Y_LSB_ADDR /* Quaternion data Y-MSB register*/ -#define BNO055_QUATERNION_DATA_Y_MSB_VALUEY__POS 0 -#define BNO055_QUATERNION_DATA_Y_MSB_VALUEY__MSK 0xFF -#define BNO055_QUATERNION_DATA_Y_MSB_VALUEY__LEN 8 -#define BNO055_QUATERNION_DATA_Y_MSB_VALUEY__REG \ -NO055_QUATERNION_DATA_Y_MSB_ADDR +#define BNO055_QUATERNION_DATA_Y_MSB_VALUEY_POS (0) +#define BNO055_QUATERNION_DATA_Y_MSB_VALUEY_MSK (0xFF) +#define BNO055_QUATERNION_DATA_Y_MSB_VALUEY_LEN (8) +#define BNO055_QUATERNION_DATA_Y_MSB_VALUEY_REG \ +BNO055_QUATERNION_DATA_Y_MSB_ADDR /* Quaternion data Z-LSB register*/ -#define BNO055_QUATERNION_DATA_Z_LSB_VALUEZ__POS 0 -#define BNO055_QUATERNION_DATA_Z_LSB_VALUEZ__MSK 0xFF -#define BNO055_QUATERNION_DATA_Z_LSB_VALUEZ__LEN 8 -#define BNO055_QUATERNION_DATA_Z_LSB_VALUEZ__REG \ +#define BNO055_QUATERNION_DATA_Z_LSB_VALUEZ_POS (0) +#define BNO055_QUATERNION_DATA_Z_LSB_VALUEZ_MSK (0xFF) +#define BNO055_QUATERNION_DATA_Z_LSB_VALUEZ_LEN (8) +#define BNO055_QUATERNION_DATA_Z_LSB_VALUEZ_REG \ BNO055_QUATERNION_DATA_Z_LSB_ADDR /* Quaternion data Z-MSB register*/ -#define BNO055_QUATERNION_DATA_Z_MSB_VALUEZ__POS 0 -#define BNO055_QUATERNION_DATA_Z_MSB_VALUEZ__MSK 0xFF -#define BNO055_QUATERNION_DATA_Z_MSB_VALUEZ__LEN 8 -#define BNO055_QUATERNION_DATA_Z_MSB_VALUEZ__REG \ +#define BNO055_QUATERNION_DATA_Z_MSB_VALUEZ_POS (0) +#define BNO055_QUATERNION_DATA_Z_MSB_VALUEZ_MSK (0xFF) +#define BNO055_QUATERNION_DATA_Z_MSB_VALUEZ_LEN (8) +#define BNO055_QUATERNION_DATA_Z_MSB_VALUEZ_REG \ BNO055_QUATERNION_DATA_Z_MSB_ADDR /* Linear acceleration data X-LSB register*/ -#define BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX__POS 0 -#define BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX__MSK 0xFF -#define BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX__LEN 8 -#define BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX__REG \ +#define BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX_POS (0) +#define BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX_MSK (0xFF) +#define BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX_LEN (8) +#define BNO055_LINEAR_ACCEL_DATA_X_LSB_VALUEX_REG \ BNO055_LINEAR_ACCEL_DATA_X_LSB_ADDR /* Linear acceleration data X-MSB register*/ -#define BNO055_LINEAR_ACCEL_DATA_X_MSB_VALUEX__POS 0 -#define BNO055_LINEAR_ACCEL_DATA_X_MSB_VALUEX__MSK 0xFF -#define BNO055_LINEAR_ACCEL_DATA_X_MSB_VALUEX__LEN 8 -#define BNO055_LINEAR_ACCEL_DATA_X_MSB_VALUEX__REG \ +#define BNO055_LINEAR_ACCEL_DATA_X_MSB_VALUEX_POS (0) +#define BNO055_LINEAR_ACCEL_DATA_X_MSB_VALUEX_MSK (0xFF) +#define BNO055_LINEAR_ACCEL_DATA_X_MSB_VALUEX_LEN (8) +#define BNO055_LINEAR_ACCEL_DATA_X_MSB_VALUEX_REG \ BNO055_LINEAR_ACCEL_DATA_X_MSB_ADDR /* Linear acceleration data Y-LSB register*/ -#define BNO055_LINEAR_ACCEL_DATA_Y_LSB_VALUEY__POS 0 -#define BNO055_LINEAR_ACCEL_DATA_Y_LSB_VALUEY__MSK 0xFF -#define BNO055_LINEAR_ACCEL_DATA_Y_LSB_VALUEY__LEN 8 -#define BNO055_LINEAR_ACCEL_DATA_Y_LSB_VALUEY__REG \ +#define BNO055_LINEAR_ACCEL_DATA_Y_LSB_VALUEY_POS (0) +#define BNO055_LINEAR_ACCEL_DATA_Y_LSB_VALUEY_MSK (0xFF) +#define BNO055_LINEAR_ACCEL_DATA_Y_LSB_VALUEY_LEN (8) +#define BNO055_LINEAR_ACCEL_DATA_Y_LSB_VALUEY_REG \ BNO055_LINEAR_ACCEL_DATA_Y_LSB_ADDR /* Linear acceleration data Y-MSB register*/ -#define BNO055_LINEAR_ACCEL_DATA_Y_MSB_VALUEY__POS 0 -#define BNO055_LINEAR_ACCEL_DATA_Y_MSB_VALUEY__MSK 0xFF -#define BNO055_LINEAR_ACCEL_DATA_Y_MSB_VALUEY__LEN 8 -#define BNO055_LINEAR_ACCEL_DATA_Y_MSB_VALUEY__REG \ +#define BNO055_LINEAR_ACCEL_DATA_Y_MSB_VALUEY_POS (0) +#define BNO055_LINEAR_ACCEL_DATA_Y_MSB_VALUEY_MSK (0xFF) +#define BNO055_LINEAR_ACCEL_DATA_Y_MSB_VALUEY_LEN (8) +#define BNO055_LINEAR_ACCEL_DATA_Y_MSB_VALUEY_REG \ BNO055_LINEAR_ACCEL_DATA_Y_MSB_ADDR /* Linear acceleration data Z-LSB register*/ -#define BNO055_LINEAR_ACCEL_DATA_Z_LSB_VALUEZ__POS 0 -#define BNO055_LINEAR_ACCEL_DATA_Z_LSB_VALUEZ__MSK 0xFF -#define BNO055_LINEAR_ACCEL_DATA_Z_LSB_VALUEZ__LEN 8 -#define BNO055_LINEAR_ACCEL_DATA_Z_LSB_VALUEZ__REG \ +#define BNO055_LINEAR_ACCEL_DATA_Z_LSB_VALUEZ_POS (0) +#define BNO055_LINEAR_ACCEL_DATA_Z_LSB_VALUEZ_MSK (0xFF) +#define BNO055_LINEAR_ACCEL_DATA_Z_LSB_VALUEZ_LEN (8) +#define BNO055_LINEAR_ACCEL_DATA_Z_LSB_VALUEZ_REG \ BNO055_LINEAR_ACCEL_DATA_Z_LSB_ADDR /* Linear acceleration data Z-MSB register*/ -#define BNO055_LINEAR_ACCEL_DATA_Z_MSB_VALUEZ__POS 0 -#define BNO055_LINEAR_ACCEL_DATA_Z_MSB_VALUEZ__MSK 0xFF -#define BNO055_LINEAR_ACCEL_DATA_Z_MSB_VALUEZ__LEN 8 -#define BNO055_LINEAR_ACCEL_DATA_Z_MSB_VALUEZ__REG \ +#define BNO055_LINEAR_ACCEL_DATA_Z_MSB_VALUEZ_POS (0) +#define BNO055_LINEAR_ACCEL_DATA_Z_MSB_VALUEZ_MSK (0xFF) +#define BNO055_LINEAR_ACCEL_DATA_Z_MSB_VALUEZ_LEN (8) +#define BNO055_LINEAR_ACCEL_DATA_Z_MSB_VALUEZ_REG \ BNO055_LINEAR_ACCEL_DATA_Z_MSB_ADDR /* Gravity data X-LSB register*/ -#define BNO055_GRAVITY_DATA_X_LSB_VALUEX__POS 0 -#define BNO055_GRAVITY_DATA_X_LSB_VALUEX__MSK 0xFF -#define BNO055_GRAVITY_DATA_X_LSB_VALUEX__LEN 8 -#define BNO055_GRAVITY_DATA_X_LSB_VALUEX__REG \ +#define BNO055_GRAVITY_DATA_X_LSB_VALUEX_POS (0) +#define BNO055_GRAVITY_DATA_X_LSB_VALUEX_MSK (0xFF) +#define BNO055_GRAVITY_DATA_X_LSB_VALUEX_LEN (8) +#define BNO055_GRAVITY_DATA_X_LSB_VALUEX_REG \ BNO055_GRAVITY_DATA_X_LSB_ADDR /* Gravity data X-MSB register*/ -#define BNO055_GRAVITY_DATA_X_MSB_VALUEX__POS 0 -#define BNO055_GRAVITY_DATA_X_MSB_VALUEX__MSK 0xFF -#define BNO055_GRAVITY_DATA_X_MSB_VALUEX__LEN 8 -#define BNO055_GRAVITY_DATA_X_MSB_VALUEX__REG \ +#define BNO055_GRAVITY_DATA_X_MSB_VALUEX_POS (0) +#define BNO055_GRAVITY_DATA_X_MSB_VALUEX_MSK (0xFF) +#define BNO055_GRAVITY_DATA_X_MSB_VALUEX_LEN (8) +#define BNO055_GRAVITY_DATA_X_MSB_VALUEX_REG \ BNO055_GRAVITY_DATA_X_MSB_ADDR /* Gravity data Y-LSB register*/ -#define BNO055_GRAVITY_DATA_Y_LSB_VALUEY__POS 0 -#define BNO055_GRAVITY_DATA_Y_LSB_VALUEY__MSK 0xFF -#define BNO055_GRAVITY_DATA_Y_LSB_VALUEY__LEN 8 -#define BNO055_GRAVITY_DATA_Y_LSB_VALUEY__REG \ +#define BNO055_GRAVITY_DATA_Y_LSB_VALUEY_POS (0) +#define BNO055_GRAVITY_DATA_Y_LSB_VALUEY_MSK (0xFF) +#define BNO055_GRAVITY_DATA_Y_LSB_VALUEY_LEN (8) +#define BNO055_GRAVITY_DATA_Y_LSB_VALUEY_REG \ BNO055_GRAVITY_DATA_Y_LSB_ADDR /* Gravity data Y-MSB register*/ -#define BNO055_GRAVITY_DATA_Y_MSB_VALUEY__POS 0 -#define BNO055_GRAVITY_DATA_Y_MSB_VALUEY__MSK 0xFF -#define BNO055_GRAVITY_DATA_Y_MSB_VALUEY__LEN 8 -#define BNO055_GRAVITY_DATA_Y_MSB_VALUEY__REG \ +#define BNO055_GRAVITY_DATA_Y_MSB_VALUEY_POS (0) +#define BNO055_GRAVITY_DATA_Y_MSB_VALUEY_MSK (0xFF) +#define BNO055_GRAVITY_DATA_Y_MSB_VALUEY_LEN (8) +#define BNO055_GRAVITY_DATA_Y_MSB_VALUEY_REG \ BNO055_GRAVITY_DATA_Y_MSB_ADDR /* Gravity data Z-LSB register*/ -#define BNO055_GRAVITY_DATA_Z_LSB_VALUEZ__POS 0 -#define BNO055_GRAVITY_DATA_Z_LSB_VALUEZ__MSK 0xFF -#define BNO055_GRAVITY_DATA_Z_LSB_VALUEZ__LEN 8 -#define BNO055_GRAVITY_DATA_Z_LSB_VALUEZ__REG \ +#define BNO055_GRAVITY_DATA_Z_LSB_VALUEZ_POS (0) +#define BNO055_GRAVITY_DATA_Z_LSB_VALUEZ_MSK (0xFF) +#define BNO055_GRAVITY_DATA_Z_LSB_VALUEZ_LEN (8) +#define BNO055_GRAVITY_DATA_Z_LSB_VALUEZ_REG \ BNO055_GRAVITY_DATA_Z_LSB_ADDR /* Gravity data Z-MSB register*/ -#define BNO055_GRAVITY_DATA_Z_MSB_VALUEZ__POS 0 -#define BNO055_GRAVITY_DATA_Z_MSB_VALUEZ__MSK 0xFF -#define BNO055_GRAVITY_DATA_Z_MSB_VALUEZ__LEN 8 -#define BNO055_GRAVITY_DATA_Z_MSB_VALUEZ__REG \ +#define BNO055_GRAVITY_DATA_Z_MSB_VALUEZ_POS (0) +#define BNO055_GRAVITY_DATA_Z_MSB_VALUEZ_MSK (0xFF) +#define BNO055_GRAVITY_DATA_Z_MSB_VALUEZ_LEN (8) +#define BNO055_GRAVITY_DATA_Z_MSB_VALUEZ_REG \ BNO055_GRAVITY_DATA_Z_MSB_ADDR /* Temperature register*/ -#define BNO055_TEMP__POS 0 -#define BNO055_TEMP__MSK 0xFF -#define BNO055_TEMP__LEN 8 -#define BNO055_TEMP__REG BNO055_TEMP_ADDR +#define BNO055_TEMP_POS (0) +#define BNO055_TEMP_MSK (0xFF) +#define BNO055_TEMP_LEN (8) +#define BNO055_TEMP_REG BNO055_TEMP_ADDR /*Mag_Calib status register*/ -#define BNO055_MAG_CALIB_STAT__POS 0 -#define BNO055_MAG_CALIB_STAT__MSK 0X03 -#define BNO055_MAG_CALIB_STAT__LEN 2 -#define BNO055_MAG_CALIB_STAT__REG BNO055_CALIB_STAT_ADDR +#define BNO055_MAG_CALIB_STAT_POS (0) +#define BNO055_MAG_CALIB_STAT_MSK (0X03) +#define BNO055_MAG_CALIB_STAT_LEN (2) +#define BNO055_MAG_CALIB_STAT_REG BNO055_CALIB_STAT_ADDR /*Acc_Calib status register*/ -#define BNO055_ACCEL_CALIB_STAT__POS 2 -#define BNO055_ACCEL_CALIB_STAT__MSK 0X0C -#define BNO055_ACCEL_CALIB_STAT__LEN 2 -#define BNO055_ACCEL_CALIB_STAT__REG BNO055_CALIB_STAT_ADDR +#define BNO055_ACCEL_CALIB_STAT_POS (2) +#define BNO055_ACCEL_CALIB_STAT_MSK (0X0C) +#define BNO055_ACCEL_CALIB_STAT_LEN (2) +#define BNO055_ACCEL_CALIB_STAT_REG BNO055_CALIB_STAT_ADDR /*Gyro_Calib status register*/ -#define BNO055_GYRO_CALIB_STAT__POS 4 -#define BNO055_GYRO_CALIB_STAT__MSK 0X30 -#define BNO055_GYRO_CALIB_STAT__LEN 2 -#define BNO055_GYRO_CALIB_STAT__REG BNO055_CALIB_STAT_ADDR +#define BNO055_GYRO_CALIB_STAT_POS (4) +#define BNO055_GYRO_CALIB_STAT_MSK (0X30) +#define BNO055_GYRO_CALIB_STAT_LEN (2) +#define BNO055_GYRO_CALIB_STAT_REG BNO055_CALIB_STAT_ADDR /*Sys_Calib status register*/ -#define BNO055_SYS_CALIB_STAT__POS 6 -#define BNO055_SYS_CALIB_STAT__MSK 0XC0 -#define BNO055_SYS_CALIB_STAT__LEN 2 -#define BNO055_SYS_CALIB_STAT__REG BNO055_CALIB_STAT_ADDR +#define BNO055_SYS_CALIB_STAT_POS (6) +#define BNO055_SYS_CALIB_STAT_MSK (0XC0) +#define BNO055_SYS_CALIB_STAT_LEN (2) +#define BNO055_SYS_CALIB_STAT_REG BNO055_CALIB_STAT_ADDR /*ST_ACCEL register*/ -#define BNO055_SELFTEST_ACCEL__POS 0 -#define BNO055_SELFTEST_ACCEL__MSK 0X01 -#define BNO055_SELFTEST_ACCEL__LEN 1 -#define BNO055_SELFTEST_ACCEL__REG BNO055_SELFTEST_RESULT_ADDR +#define BNO055_SELFTEST_ACCEL_POS (0) +#define BNO055_SELFTEST_ACCEL_MSK (0X01) +#define BNO055_SELFTEST_ACCEL_LEN (1) +#define BNO055_SELFTEST_ACCEL_REG BNO055_SELFTEST_RESULT_ADDR /*ST_MAG register*/ -#define BNO055_SELFTEST_MAG__POS 1 -#define BNO055_SELFTEST_MAG__MSK 0X02 -#define BNO055_SELFTEST_MAG__LEN 1 -#define BNO055_SELFTEST_MAG__REG BNO055_SELFTEST_RESULT_ADDR +#define BNO055_SELFTEST_MAG_POS (1) +#define BNO055_SELFTEST_MAG_MSK (0X02) +#define BNO055_SELFTEST_MAG_LEN (1) +#define BNO055_SELFTEST_MAG_REG BNO055_SELFTEST_RESULT_ADDR /*ST_GYRO register*/ -#define BNO055_SELFTEST_GYRO__POS 2 -#define BNO055_SELFTEST_GYRO__MSK 0X04 -#define BNO055_SELFTEST_GYRO__LEN 1 -#define BNO055_SELFTEST_GYRO__REG BNO055_SELFTEST_RESULT_ADDR +#define BNO055_SELFTEST_GYRO_POS (2) +#define BNO055_SELFTEST_GYRO_MSK (0X04) +#define BNO055_SELFTEST_GYRO_LEN (1) +#define BNO055_SELFTEST_GYRO_REG BNO055_SELFTEST_RESULT_ADDR /*ST_MCU register*/ -#define BNO055_SELFTEST_MCU__POS 3 -#define BNO055_SELFTEST_MCU__MSK 0X08 -#define BNO055_SELFTEST_MCU__LEN 1 -#define BNO055_SELFTEST_MCU__REG BNO055_SELFTEST_RESULT_ADDR +#define BNO055_SELFTEST_MCU_POS (3) +#define BNO055_SELFTEST_MCU_MSK (0X08) +#define BNO055_SELFTEST_MCU_LEN (1) +#define BNO055_SELFTEST_MCU_REG BNO055_SELFTEST_RESULT_ADDR /*Interrupt status registers*/ -#define BNO055_INTR_STAT_GYRO_ANY_MOTION__POS 2 -#define BNO055_INTR_STAT_GYRO_ANY_MOTION__MSK 0X04 -#define BNO055_INTR_STAT_GYRO_ANY_MOTION__LEN 1 -#define BNO055_INTR_STAT_GYRO_ANY_MOTION__REG BNO055_INTR_STAT_ADDR - -#define BNO055_INTR_STAT_GYRO_HIGHRATE__POS 3 -#define BNO055_INTR_STAT_GYRO_HIGHRATE__MSK 0X08 -#define BNO055_INTR_STAT_GYRO_HIGHRATE__LEN 1 -#define BNO055_INTR_STAT_GYRO_HIGHRATE__REG BNO055_INTR_STAT_ADDR - -#define BNO055_INTR_STAT_ACCEL_HIGH_G__POS 5 -#define BNO055_INTR_STAT_ACCEL_HIGH_G__MSK 0X20 -#define BNO055_INTR_STAT_ACCEL_HIGH_G__LEN 1 -#define BNO055_INTR_STAT_ACCEL_HIGH_G__REG BNO055_INTR_STAT_ADDR - -#define BNO055_INTR_STAT_ACCEL_ANY_MOTION__POS 6 -#define BNO055_INTR_STAT_ACCEL_ANY_MOTION__MSK 0X40 -#define BNO055_INTR_STAT_ACCEL_ANY_MOTION__LEN 1 -#define BNO055_INTR_STAT_ACCEL_ANY_MOTION__REG BNO055_INTR_STAT_ADDR - -#define BNO055_INTR_STAT_ACCEL_NO_MOTION__POS 7 -#define BNO055_INTR_STAT_ACCEL_NO_MOTION__MSK 0X80 -#define BNO055_INTR_STAT_ACCEL_NO_MOTION__LEN 1 -#define BNO055_INTR_STAT_ACCEL_NO_MOTION__REG BNO055_INTR_STAT_ADDR +#define BNO055_INTR_STAT_GYRO_ANY_MOTION_POS (2) +#define BNO055_INTR_STAT_GYRO_ANY_MOTION_MSK (0X04) +#define BNO055_INTR_STAT_GYRO_ANY_MOTION_LEN (1) +#define BNO055_INTR_STAT_GYRO_ANY_MOTION_REG BNO055_INTR_STAT_ADDR + +#define BNO055_INTR_STAT_GYRO_HIGHRATE_POS (3) +#define BNO055_INTR_STAT_GYRO_HIGHRATE_MSK (0X08) +#define BNO055_INTR_STAT_GYRO_HIGHRATE_LEN (1) +#define BNO055_INTR_STAT_GYRO_HIGHRATE_REG BNO055_INTR_STAT_ADDR + +#define BNO055_INTR_STAT_ACCEL_HIGH_G_POS (5) +#define BNO055_INTR_STAT_ACCEL_HIGH_G_MSK (0X20) +#define BNO055_INTR_STAT_ACCEL_HIGH_G_LEN (1) +#define BNO055_INTR_STAT_ACCEL_HIGH_G_REG BNO055_INTR_STAT_ADDR + +#define BNO055_INTR_STAT_ACCEL_ANY_MOTION_POS (6) +#define BNO055_INTR_STAT_ACCEL_ANY_MOTION_MSK (0X40) +#define BNO055_INTR_STAT_ACCEL_ANY_MOTION_LEN (1) +#define BNO055_INTR_STAT_ACCEL_ANY_MOTION_REG BNO055_INTR_STAT_ADDR + +#define BNO055_INTR_STAT_ACCEL_NO_MOTION_POS (7) +#define BNO055_INTR_STAT_ACCEL_NO_MOTION_MSK (0X80) +#define BNO055_INTR_STAT_ACCEL_NO_MOTION_LEN (1) +#define BNO055_INTR_STAT_ACCEL_NO_MOTION_REG BNO055_INTR_STAT_ADDR /* system clock status register*/ -#define BNO055_SYS_MAIN_CLK__POS 0 -#define BNO055_SYS_MAIN_CLK__MSK 0X10 -#define BNO055_SYS_MAIN_CLK__LEN 1 -#define BNO055_SYS_MAIN_CLK__REG BNO055_SYS_CLK_STAT_ADDR +#define BNO055_SYS_MAIN_CLK_POS (0) +#define BNO055_SYS_MAIN_CLK_MSK (0X10) +#define BNO055_SYS_MAIN_CLK_LEN (1) +#define BNO055_SYS_MAIN_CLK_REG BNO055_SYS_CLK_STAT_ADDR /* System registers*/ -#define BNO055_SYS_STAT_CODE__POS 0 -#define BNO055_SYS_STAT_CODE__MSK 0XFF -#define BNO055_SYS_STAT_CODE__LEN 8 -#define BNO055_SYS_STAT_CODE__REG BNO055_SYS_STAT_ADDR +#define BNO055_SYS_STAT_CODE_POS (0) +#define BNO055_SYS_STAT_CODE_MSK (0XFF) +#define BNO055_SYS_STAT_CODE_LEN (8) +#define BNO055_SYS_STAT_CODE_REG BNO055_SYS_STAT_ADDR -#define BNO055_SYS_ERROR_CODE__POS 0 -#define BNO055_SYS_ERROR_CODE__MSK 0XFF -#define BNO055_SYS_ERROR_CODE__LEN 8 -#define BNO055_SYS_ERROR_CODE__REG BNO055_SYS_ERR_ADDR +#define BNO055_SYS_ERROR_CODE_POS (0) +#define BNO055_SYS_ERROR_CODE_MSK (0XFF) +#define BNO055_SYS_ERROR_CODE_LEN (8) +#define BNO055_SYS_ERROR_CODE_REG BNO055_SYS_ERR_ADDR /* Accel_Unit register*/ -#define BNO055_ACCEL_UNIT__POS 0 -#define BNO055_ACCEL_UNIT__MSK 0X01 -#define BNO055_ACCEL_UNIT__LEN 1 -#define BNO055_ACCEL_UNIT__REG BNO055_UNIT_SEL_ADDR +#define BNO055_ACCEL_UNIT_POS (0) +#define BNO055_ACCEL_UNIT_MSK (0X01) +#define BNO055_ACCEL_UNIT_LEN (1) +#define BNO055_ACCEL_UNIT_REG BNO055_UNIT_SEL_ADDR /* Gyro_Unit register*/ -#define BNO055_GYRO_UNIT__POS 1 -#define BNO055_GYRO_UNIT__MSK 0X02 -#define BNO055_GYRO_UNIT__LEN 1 -#define BNO055_GYRO_UNIT__REG BNO055_UNIT_SEL_ADDR +#define BNO055_GYRO_UNIT_POS (1) +#define BNO055_GYRO_UNIT_MSK (0X02) +#define BNO055_GYRO_UNIT_LEN (1) +#define BNO055_GYRO_UNIT_REG BNO055_UNIT_SEL_ADDR /* Euler_Unit register*/ -#define BNO055_EULER_UNIT__POS 2 -#define BNO055_EULER_UNIT__MSK 0X04 -#define BNO055_EULER_UNIT__LEN 1 -#define BNO055_EULER_UNIT__REG BNO055_UNIT_SEL_ADDR +#define BNO055_EULER_UNIT_POS (2) +#define BNO055_EULER_UNIT_MSK (0X04) +#define BNO055_EULER_UNIT_LEN (1) +#define BNO055_EULER_UNIT_REG BNO055_UNIT_SEL_ADDR /* Tilt_Unit register*/ -#define BNO055_TILT_UNIT__POS 3 -#define BNO055_TILT_UNIT__MSK 0X08 -#define BNO055_TILT_UNIT__LEN 1 -#define BNO055_TILT_UNIT__REG BNO055_UNIT_SEL_ADDR +#define BNO055_TILT_UNIT_POS (3) +#define BNO055_TILT_UNIT_MSK (0X08) +#define BNO055_TILT_UNIT_LEN (1) +#define BNO055_TILT_UNIT_REG BNO055_UNIT_SEL_ADDR /* Temperature_Unit register*/ -#define BNO055_TEMP_UNIT__POS 4 -#define BNO055_TEMP_UNIT__MSK 0X10 -#define BNO055_TEMP_UNIT__LEN 1 -#define BNO055_TEMP_UNIT__REG BNO055_UNIT_SEL_ADDR +#define BNO055_TEMP_UNIT_POS (4) +#define BNO055_TEMP_UNIT_MSK (0X10) +#define BNO055_TEMP_UNIT_LEN (1) +#define BNO055_TEMP_UNIT_REG BNO055_UNIT_SEL_ADDR /* ORI android-windows register*/ -#define BNO055_DATA_OUTPUT_FORMAT__POS 7 -#define BNO055_DATA_OUTPUT_FORMAT__MSK 0X80 -#define BNO055_DATA_OUTPUT_FORMAT__LEN 1 -#define BNO055_DATA_OUTPUT_FORMAT__REG BNO055_UNIT_SEL_ADDR +#define BNO055_DATA_OUTPUT_FORMAT_POS (7) +#define BNO055_DATA_OUTPUT_FORMAT_MSK (0X80) +#define BNO055_DATA_OUTPUT_FORMAT_LEN (1) +#define BNO055_DATA_OUTPUT_FORMAT_REG BNO055_UNIT_SEL_ADDR /*Operation Mode data register*/ -#define BNO055_OPERATION_MODE__POS 0 -#define BNO055_OPERATION_MODE__MSK 0X0F -#define BNO055_OPERATION_MODE__LEN 4 -#define BNO055_OPERATION_MODE__REG BNO055_OPR_MODE_ADDR +#define BNO055_OPERATION_MODE_POS (0) +#define BNO055_OPERATION_MODE_MSK (0X0F) +#define BNO055_OPERATION_MODE_LEN (4) +#define BNO055_OPERATION_MODE_REG BNO055_OPR_MODE_ADDR /* Power Mode register*/ -#define BNO055_POWER_MODE__POS 0 -#define BNO055_POWER_MODE__MSK 0X03 -#define BNO055_POWER_MODE__LEN 2 -#define BNO055_POWER_MODE__REG BNO055_PWR_MODE_ADDR +#define BNO055_POWER_MODE_POS (0) +#define BNO055_POWER_MODE_MSK (0X03) +#define BNO055_POWER_MODE_LEN (2) +#define BNO055_POWER_MODE_REG BNO055_PWR_MODE_ADDR /*Self Test register*/ -#define BNO055_SELFTEST__POS 0 -#define BNO055_SELFTEST__MSK 0X01 -#define BNO055_SELFTEST__LEN 1 -#define BNO055_SELFTEST__REG BNO055_SYS_TRIGGER_ADDR +#define BNO055_SELFTEST_POS (0) +#define BNO055_SELFTEST_MSK (0X01) +#define BNO055_SELFTEST_LEN (1) +#define BNO055_SELFTEST_REG BNO055_SYS_TRIGGER_ADDR /* RST_SYS register*/ -#define BNO055_SYS_RST__POS 5 -#define BNO055_SYS_RST__MSK 0X20 -#define BNO055_SYS_RST__LEN 1 -#define BNO055_SYS_RST__REG BNO055_SYS_TRIGGER_ADDR +#define BNO055_SYS_RST_POS (5) +#define BNO055_SYS_RST_MSK (0X20) +#define BNO055_SYS_RST_LEN (1) +#define BNO055_SYS_RST_REG BNO055_SYS_TRIGGER_ADDR /* RST_INT register*/ -#define BNO055_INTR_RST__POS 6 -#define BNO055_INTR_RST__MSK 0X40 -#define BNO055_INTR_RST__LEN 1 -#define BNO055_INTR_RST__REG BNO055_SYS_TRIGGER_ADDR +#define BNO055_INTR_RST_POS (6) +#define BNO055_INTR_RST_MSK (0X40) +#define BNO055_INTR_RST_LEN (1) +#define BNO055_INTR_RST_REG BNO055_SYS_TRIGGER_ADDR /* CLK_SRC register*/ -#define BNO055_CLK_SRC__POS 7 -#define BNO055_CLK_SRC__MSK 0X80 -#define BNO055_CLK_SRC__LEN 1 -#define BNO055_CLK_SRC__REG BNO055_SYS_TRIGGER_ADDR +#define BNO055_CLK_SRC_POS (7) +#define BNO055_CLK_SRC_MSK (0X80) +#define BNO055_CLK_SRC_LEN (1) +#define BNO055_CLK_SRC_REG BNO055_SYS_TRIGGER_ADDR /* Temp source register*/ -#define BNO055_TEMP_SOURCE__POS 0 -#define BNO055_TEMP_SOURCE__MSK 0X03 -#define BNO055_TEMP_SOURCE__LEN 2 -#define BNO055_TEMP_SOURCE__REG BNO055_TEMP_SOURCE_ADDR +#define BNO055_TEMP_SOURCE_POS (0) +#define BNO055_TEMP_SOURCE_MSK (0X03) +#define BNO055_TEMP_SOURCE_LEN (2) +#define BNO055_TEMP_SOURCE_REG BNO055_TEMP_SOURCE_ADDR /* Axis remap value register*/ -#define BNO055_REMAP_AXIS_VALUE__POS 0 -#define BNO055_REMAP_AXIS_VALUE__MSK 0X3F -#define BNO055_REMAP_AXIS_VALUE__LEN 6 -#define BNO055_REMAP_AXIS_VALUE__REG BNO055_AXIS_MAP_CONFIG_ADDR +#define BNO055_REMAP_AXIS_VALUE_POS (0) +#define BNO055_REMAP_AXIS_VALUE_MSK (0X3F) +#define BNO055_REMAP_AXIS_VALUE_LEN (6) +#define BNO055_REMAP_AXIS_VALUE_REG BNO055_AXIS_MAP_CONFIG_ADDR /* Axis sign value register*/ -#define BNO055_REMAP_Z_SIGN__POS 0 -#define BNO055_REMAP_Z_SIGN__MSK 0X01 -#define BNO055_REMAP_Z_SIGN__LEN 1 -#define BNO055_REMAP_Z_SIGN__REG BNO055_AXIS_MAP_SIGN_ADDR +#define BNO055_REMAP_Z_SIGN_POS (0) +#define BNO055_REMAP_Z_SIGN_MSK (0X01) +#define BNO055_REMAP_Z_SIGN_LEN (1) +#define BNO055_REMAP_Z_SIGN_REG BNO055_AXIS_MAP_SIGN_ADDR -#define BNO055_REMAP_Y_SIGN__POS 1 -#define BNO055_REMAP_Y_SIGN__MSK 0X02 -#define BNO055_REMAP_Y_SIGN__LEN 1 -#define BNO055_REMAP_Y_SIGN__REG BNO055_AXIS_MAP_SIGN_ADDR +#define BNO055_REMAP_Y_SIGN_POS (1) +#define BNO055_REMAP_Y_SIGN_MSK (0X02) +#define BNO055_REMAP_Y_SIGN_LEN (1) +#define BNO055_REMAP_Y_SIGN_REG BNO055_AXIS_MAP_SIGN_ADDR -#define BNO055_REMAP_X_SIGN__POS 2 -#define BNO055_REMAP_X_SIGN__MSK 0X04 -#define BNO055_REMAP_X_SIGN__LEN 1 -#define BNO055_REMAP_X_SIGN__REG BNO055_AXIS_MAP_SIGN_ADDR +#define BNO055_REMAP_X_SIGN_POS (2) +#define BNO055_REMAP_X_SIGN_MSK (0X04) +#define BNO055_REMAP_X_SIGN_LEN (1) +#define BNO055_REMAP_X_SIGN_REG BNO055_AXIS_MAP_SIGN_ADDR /* Soft Iron Calibration matrix register*/ -#define BNO055_SIC_MATRIX_0_LSB__POS 0 -#define BNO055_SIC_MATRIX_0_LSB__MSK 0XFF -#define BNO055_SIC_MATRIX_0_LSB__LEN 8 -#define BNO055_SIC_MATRIX_0_LSB__REG BNO055_SIC_MATRIX_0_LSB_ADDR - -#define BNO055_SIC_MATRIX_0_MSB__POS 0 -#define BNO055_SIC_MATRIX_0_MSB__MSK 0XFF -#define BNO055_SIC_MATRIX_0_MSB__LEN 8 -#define BNO055_SIC_MATRIX_0_MSB__REG BNO055_SIC_MATRIX_0_MSB_ADDR - -#define BNO055_SIC_MATRIX_1_LSB__POS 0 -#define BNO055_SIC_MATRIX_1_LSB__MSK 0XFF -#define BNO055_SIC_MATRIX_1_LSB__LEN 8 -#define BNO055_SIC_MATRIX_1_LSB__REG BNO055_SIC_MATRIX_1_LSB_ADDR - -#define BNO055_SIC_MATRIX_1_MSB__POS 0 -#define BNO055_SIC_MATRIX_1_MSB__MSK 0XFF -#define BNO055_SIC_MATRIX_1_MSB__LEN 8 -#define BNO055_SIC_MATRIX_1_MSB__REG BNO055_SIC_MATRIX_1_MSB_ADDR - -#define BNO055_SIC_MATRIX_2_LSB__POS 0 -#define BNO055_SIC_MATRIX_2_LSB__MSK 0XFF -#define BNO055_SIC_MATRIX_2_LSB__LEN 8 -#define BNO055_SIC_MATRIX_2_LSB__REG BNO055_SIC_MATRIX_2_LSB_ADDR - -#define BNO055_SIC_MATRIX_2_MSB__POS 0 -#define BNO055_SIC_MATRIX_2_MSB__MSK 0XFF -#define BNO055_SIC_MATRIX_2_MSB__LEN 8 -#define BNO055_SIC_MATRIX_2_MSB__REG BNO055_SIC_MATRIX_2_MSB_ADDR - -#define BNO055_SIC_MATRIX_3_LSB__POS 0 -#define BNO055_SIC_MATRIX_3_LSB__MSK 0XFF -#define BNO055_SIC_MATRIX_3_LSB__LEN 8 -#define BNO055_SIC_MATRIX_3_LSB__REG BNO055_SIC_MATRIX_3_LSB_ADDR - -#define BNO055_SIC_MATRIX_3_MSB__POS 0 -#define BNO055_SIC_MATRIX_3_MSB__MSK 0XFF -#define BNO055_SIC_MATRIX_3_MSB__LEN 8 -#define BNO055_SIC_MATRIX_3_MSB__REG BNO055_SIC_MATRIX_3_MSB_ADDR - -#define BNO055_SIC_MATRIX_4_LSB__POS 0 -#define BNO055_SIC_MATRIX_4_LSB__MSK 0XFF -#define BNO055_SIC_MATRIX_4_LSB__LEN 8 -#define BNO055_SIC_MATRIX_4_LSB__REG BNO055_SIC_MATRIX_4_LSB_ADDR - -#define BNO055_SIC_MATRIX_4_MSB__POS 0 -#define BNO055_SIC_MATRIX_4_MSB__MSK 0XFF -#define BNO055_SIC_MATRIX_4_MSB__LEN 8 -#define BNO055_SIC_MATRIX_4_MSB__REG BNO055_SIC_MATRIX_4_MSB_ADDR - -#define BNO055_SIC_MATRIX_5_LSB__POS 0 -#define BNO055_SIC_MATRIX_5_LSB__MSK 0XFF -#define BNO055_SIC_MATRIX_5_LSB__LEN 8 -#define BNO055_SIC_MATRIX_5_LSB__REG BNO055_SIC_MATRIX_5_LSB_ADDR - -#define BNO055_SIC_MATRIX_5_MSB__POS 0 -#define BNO055_SIC_MATRIX_5_MSB__MSK 0XFF -#define BNO055_SIC_MATRIX_5_MSB__LEN 8 -#define BNO055_SIC_MATRIX_5_MSB__REG BNO055_SIC_MATRIX_5_MSB_ADDR - -#define BNO055_SIC_MATRIX_6_LSB__POS 0 -#define BNO055_SIC_MATRIX_6_LSB__MSK 0XFF -#define BNO055_SIC_MATRIX_6_LSB__LEN 8 -#define BNO055_SIC_MATRIX_6_LSB__REG BNO055_SIC_MATRIX_6_LSB_ADDR - -#define BNO055_SIC_MATRIX_6_MSB__POS 0 -#define BNO055_SIC_MATRIX_6_MSB__MSK 0XFF -#define BNO055_SIC_MATRIX_6_MSB__LEN 8 -#define BNO055_SIC_MATRIX_6_MSB__REG BNO055_SIC_MATRIX_6_MSB_ADDR - -#define BNO055_SIC_MATRIX_7_LSB__POS 0 -#define BNO055_SIC_MATRIX_7_LSB__MSK 0XFF -#define BNO055_SIC_MATRIX_7_LSB__LEN 8 -#define BNO055_SIC_MATRIX_7_LSB__REG BNO055_SIC_MATRIX_7_LSB_ADDR - -#define BNO055_SIC_MATRIX_7_MSB__POS 0 -#define BNO055_SIC_MATRIX_7_MSB__MSK 0XFF -#define BNO055_SIC_MATRIX_7_MSB__LEN 8 -#define BNO055_SIC_MATRIX_7_MSB__REG BNO055_SIC_MATRIX_7_MSB_ADDR - -#define BNO055_SIC_MATRIX_8_LSB__POS 0 -#define BNO055_SIC_MATRIX_8_LSB__MSK 0XFF -#define BNO055_SIC_MATRIX_8_LSB__LEN 8 -#define BNO055_SIC_MATRIX_8_LSB__REG BNO055_SIC_MATRIX_8_LSB_ADDR - -#define BNO055_SIC_MATRIX_8_MSB__POS 0 -#define BNO055_SIC_MATRIX_8_MSB__MSK 0XFF -#define BNO055_SIC_MATRIX_8_MSB__LEN 8 -#define BNO055_SIC_MATRIX_8_MSB__REG BNO055_SIC_MATRIX_8_MSB_ADDR +#define BNO055_SIC_MATRIX_0_LSB_POS (0) +#define BNO055_SIC_MATRIX_0_LSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_0_LSB_LEN (8) +#define BNO055_SIC_MATRIX_0_LSB_REG BNO055_SIC_MATRIX_0_LSB_ADDR + +#define BNO055_SIC_MATRIX_0_MSB_POS (0) +#define BNO055_SIC_MATRIX_0_MSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_0_MSB_LEN (8) +#define BNO055_SIC_MATRIX_0_MSB_REG BNO055_SIC_MATRIX_0_MSB_ADDR + +#define BNO055_SIC_MATRIX_1_LSB_POS (0) +#define BNO055_SIC_MATRIX_1_LSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_1_LSB_LEN (8) +#define BNO055_SIC_MATRIX_1_LSB_REG BNO055_SIC_MATRIX_1_LSB_ADDR + +#define BNO055_SIC_MATRIX_1_MSB_POS (0) +#define BNO055_SIC_MATRIX_1_MSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_1_MSB_LEN (8) +#define BNO055_SIC_MATRIX_1_MSB_REG BNO055_SIC_MATRIX_1_MSB_ADDR + +#define BNO055_SIC_MATRIX_2_LSB_POS (0) +#define BNO055_SIC_MATRIX_2_LSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_2_LSB_LEN (8) +#define BNO055_SIC_MATRIX_2_LSB_REG BNO055_SIC_MATRIX_2_LSB_ADDR + +#define BNO055_SIC_MATRIX_2_MSB_POS (0) +#define BNO055_SIC_MATRIX_2_MSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_2_MSB_LEN (8) +#define BNO055_SIC_MATRIX_2_MSB_REG BNO055_SIC_MATRIX_2_MSB_ADDR + +#define BNO055_SIC_MATRIX_3_LSB_POS (0) +#define BNO055_SIC_MATRIX_3_LSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_3_LSB_LEN (8) +#define BNO055_SIC_MATRIX_3_LSB_REG BNO055_SIC_MATRIX_3_LSB_ADDR + +#define BNO055_SIC_MATRIX_3_MSB_POS (0) +#define BNO055_SIC_MATRIX_3_MSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_3_MSB_LEN (8) +#define BNO055_SIC_MATRIX_3_MSB_REG BNO055_SIC_MATRIX_3_MSB_ADDR + +#define BNO055_SIC_MATRIX_4_LSB_POS (0) +#define BNO055_SIC_MATRIX_4_LSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_4_LSB_LEN (8) +#define BNO055_SIC_MATRIX_4_LSB_REG BNO055_SIC_MATRIX_4_LSB_ADDR + +#define BNO055_SIC_MATRIX_4_MSB_POS (0) +#define BNO055_SIC_MATRIX_4_MSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_4_MSB_LEN (8) +#define BNO055_SIC_MATRIX_4_MSB_REG BNO055_SIC_MATRIX_4_MSB_ADDR + +#define BNO055_SIC_MATRIX_5_LSB_POS (0) +#define BNO055_SIC_MATRIX_5_LSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_5_LSB_LEN (8) +#define BNO055_SIC_MATRIX_5_LSB_REG BNO055_SIC_MATRIX_5_LSB_ADDR + +#define BNO055_SIC_MATRIX_5_MSB_POS (0) +#define BNO055_SIC_MATRIX_5_MSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_5_MSB_LEN (8) +#define BNO055_SIC_MATRIX_5_MSB_REG BNO055_SIC_MATRIX_5_MSB_ADDR + +#define BNO055_SIC_MATRIX_6_LSB_POS (0) +#define BNO055_SIC_MATRIX_6_LSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_6_LSB_LEN (8) +#define BNO055_SIC_MATRIX_6_LSB_REG BNO055_SIC_MATRIX_6_LSB_ADDR + +#define BNO055_SIC_MATRIX_6_MSB_POS (0) +#define BNO055_SIC_MATRIX_6_MSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_6_MSB_LEN (8) +#define BNO055_SIC_MATRIX_6_MSB_REG BNO055_SIC_MATRIX_6_MSB_ADDR + +#define BNO055_SIC_MATRIX_7_LSB_POS (0) +#define BNO055_SIC_MATRIX_7_LSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_7_LSB_LEN (8) +#define BNO055_SIC_MATRIX_7_LSB_REG BNO055_SIC_MATRIX_7_LSB_ADDR + +#define BNO055_SIC_MATRIX_7_MSB_POS (0) +#define BNO055_SIC_MATRIX_7_MSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_7_MSB_LEN (8) +#define BNO055_SIC_MATRIX_7_MSB_REG BNO055_SIC_MATRIX_7_MSB_ADDR + +#define BNO055_SIC_MATRIX_8_LSB_POS (0) +#define BNO055_SIC_MATRIX_8_LSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_8_LSB_LEN (8) +#define BNO055_SIC_MATRIX_8_LSB_REG BNO055_SIC_MATRIX_8_LSB_ADDR + +#define BNO055_SIC_MATRIX_8_MSB_POS (0) +#define BNO055_SIC_MATRIX_8_MSB_MSK (0XFF) +#define BNO055_SIC_MATRIX_8_MSB_LEN (8) +#define BNO055_SIC_MATRIX_8_MSB_REG BNO055_SIC_MATRIX_8_MSB_ADDR /*Accel Offset registers*/ -#define BNO055_ACCEL_OFFSET_X_LSB__POS 0 -#define BNO055_ACCEL_OFFSET_X_LSB__MSK 0XFF -#define BNO055_ACCEL_OFFSET_X_LSB__LEN 8 -#define BNO055_ACCEL_OFFSET_X_LSB__REG ACCEL_OFFSET_X_LSB_ADDR - -#define BNO055_ACCEL_OFFSET_X_MSB__POS 0 -#define BNO055_ACCEL_OFFSET_X_MSB__MSK 0XFF -#define BNO055_ACCEL_OFFSET_X_MSB__LEN 8 -#define BNO055_ACCEL_OFFSET_X_MSB__REG ACCEL_OFFSET_X_MSB_ADDR - -#define BNO055_ACCEL_OFFSET_Y_LSB__POS 0 -#define BNO055_ACCEL_OFFSET_Y_LSB__MSK 0XFF -#define BNO055_ACCEL_OFFSET_Y_LSB__LEN 8 -#define BNO055_ACCEL_OFFSET_Y_LSB__REG ACCEL_OFFSET_Y_LSB_ADDR - -#define BNO055_ACCEL_OFFSET_Y_MSB__POS 0 -#define BNO055_ACCEL_OFFSET_Y_MSB__MSK 0XFF -#define BNO055_ACCEL_OFFSET_Y_MSB__LEN 8 -#define BNO055_ACCEL_OFFSET_Y_MSB__REG ACCEL_OFFSET_Y_MSB_ADDR - -#define BNO055_ACCEL_OFFSET_Z_LSB__POS 0 -#define BNO055_ACCEL_OFFSET_Z_LSB__MSK 0XFF -#define BNO055_ACCEL_OFFSET_Z_LSB__LEN 8 -#define BNO055_ACCEL_OFFSET_Z_LSB__REG ACCEL_OFFSET_Z_LSB_ADDR - -#define BNO055_ACCEL_OFFSET_Z_MSB__POS 0 -#define BNO055_ACCEL_OFFSET_Z_MSB__MSK 0XFF -#define BNO055_ACCEL_OFFSET_Z_MSB__LEN 8 -#define BNO055_ACCEL_OFFSET_Z_MSB__REG ACCEL_OFFSET_Z_MSB_ADDR +#define BNO055_ACCEL_OFFSET_X_LSB_POS (0) +#define BNO055_ACCEL_OFFSET_X_LSB_MSK (0XFF) +#define BNO055_ACCEL_OFFSET_X_LSB_LEN (8) +#define BNO055_ACCEL_OFFSET_X_LSB_REG BNO055_ACCEL_OFFSET_X_LSB_ADDR + +#define BNO055_ACCEL_OFFSET_X_MSB_POS (0) +#define BNO055_ACCEL_OFFSET_X_MSB_MSK (0XFF) +#define BNO055_ACCEL_OFFSET_X_MSB_LEN (8) +#define BNO055_ACCEL_OFFSET_X_MSB_REG BNO055_ACCEL_OFFSET_X_MSB_ADDR + +#define BNO055_ACCEL_OFFSET_Y_LSB_POS (0) +#define BNO055_ACCEL_OFFSET_Y_LSB_MSK (0XFF) +#define BNO055_ACCEL_OFFSET_Y_LSB_LEN (8) +#define BNO055_ACCEL_OFFSET_Y_LSB_REG BNO055_ACCEL_OFFSET_Y_LSB_ADDR + +#define BNO055_ACCEL_OFFSET_Y_MSB_POS (0) +#define BNO055_ACCEL_OFFSET_Y_MSB_MSK (0XFF) +#define BNO055_ACCEL_OFFSET_Y_MSB_LEN (8) +#define BNO055_ACCEL_OFFSET_Y_MSB_REG BNO055_ACCEL_OFFSET_Y_MSB_ADDR + +#define BNO055_ACCEL_OFFSET_Z_LSB_POS (0) +#define BNO055_ACCEL_OFFSET_Z_LSB_MSK (0XFF) +#define BNO055_ACCEL_OFFSET_Z_LSB_LEN (8) +#define BNO055_ACCEL_OFFSET_Z_LSB_REG BNO055_ACCEL_OFFSET_Z_LSB_ADDR + +#define BNO055_ACCEL_OFFSET_Z_MSB_POS (0) +#define BNO055_ACCEL_OFFSET_Z_MSB_MSK (0XFF) +#define BNO055_ACCEL_OFFSET_Z_MSB_LEN (8) +#define BNO055_ACCEL_OFFSET_Z_MSB_REG BNO055_ACCEL_OFFSET_Z_MSB_ADDR /*Mag Offset registers*/ -#define BNO055_MAG_OFFSET_X_LSB__POS 0 -#define BNO055_MAG_OFFSET_X_LSB__MSK 0XFF -#define BNO055_MAG_OFFSET_X_LSB__LEN 8 -#define BNO055_MAG_OFFSET_X_LSB__REG MAG_OFFSET_X_LSB_ADDR - -#define BNO055_MAG_OFFSET_X_MSB__POS 0 -#define BNO055_MAG_OFFSET_X_MSB__MSK 0XFF -#define BNO055_MAG_OFFSET_X_MSB__LEN 8 -#define BNO055_MAG_OFFSET_X_MSB__REG MAG_OFFSET_X_MSB_ADDR - -#define BNO055_MAG_OFFSET_Y_LSB__POS 0 -#define BNO055_MAG_OFFSET_Y_LSB__MSK 0XFF -#define BNO055_MAG_OFFSET_Y_LSB__LEN 8 -#define BNO055_MAG_OFFSET_Y_LSB__REG MAG_OFFSET_Y_LSB_ADDR - -#define BNO055_MAG_OFFSET_Y_MSB__POS 0 -#define BNO055_MAG_OFFSET_Y_MSB__MSK 0XFF -#define BNO055_MAG_OFFSET_Y_MSB__LEN 8 -#define BNO055_MAG_OFFSET_Y_MSB__REG MAG_OFFSET_Y_MSB_ADDR - -#define BNO055_MAG_OFFSET_Z_LSB__POS 0 -#define BNO055_MAG_OFFSET_Z_LSB__MSK 0XFF -#define BNO055_MAG_OFFSET_Z_LSB__LEN 8 -#define BNO055_MAG_OFFSET_Z_LSB__REG MAG_OFFSET_Z_LSB_ADDR - -#define BNO055_MAG_OFFSET_Z_MSB__POS 0 -#define BNO055_MAG_OFFSET_Z_MSB__MSK 0XFF -#define BNO055_MAG_OFFSET_Z_MSB__LEN 8 -#define BNO055_MAG_OFFSET_Z_MSB__REG MAG_OFFSET_Z_MSB_ADDR +#define BNO055_MAG_OFFSET_X_LSB_POS (0) +#define BNO055_MAG_OFFSET_X_LSB_MSK (0XFF) +#define BNO055_MAG_OFFSET_X_LSB_LEN (8) +#define BNO055_MAG_OFFSET_X_LSB_REG BNO055_MAG_OFFSET_X_LSB_ADDR + +#define BNO055_MAG_OFFSET_X_MSB_POS (0) +#define BNO055_MAG_OFFSET_X_MSB_MSK (0XFF) +#define BNO055_MAG_OFFSET_X_MSB_LEN (8) +#define BNO055_MAG_OFFSET_X_MSB_REG BNO055_MAG_OFFSET_X_MSB_ADDR + +#define BNO055_MAG_OFFSET_Y_LSB_POS (0) +#define BNO055_MAG_OFFSET_Y_LSB_MSK (0XFF) +#define BNO055_MAG_OFFSET_Y_LSB_LEN (8) +#define BNO055_MAG_OFFSET_Y_LSB_REG BNO055_MAG_OFFSET_Y_LSB_ADDR + +#define BNO055_MAG_OFFSET_Y_MSB_POS (0) +#define BNO055_MAG_OFFSET_Y_MSB_MSK (0XFF) +#define BNO055_MAG_OFFSET_Y_MSB_LEN (8) +#define BNO055_MAG_OFFSET_Y_MSB_REG BNO055_MAG_OFFSET_Y_MSB_ADDR + +#define BNO055_MAG_OFFSET_Z_LSB_POS (0) +#define BNO055_MAG_OFFSET_Z_LSB_MSK (0XFF) +#define BNO055_MAG_OFFSET_Z_LSB_LEN (8) +#define BNO055_MAG_OFFSET_Z_LSB_REG BNO055_MAG_OFFSET_Z_LSB_ADDR + +#define BNO055_MAG_OFFSET_Z_MSB_POS (0) +#define BNO055_MAG_OFFSET_Z_MSB_MSK (0XFF) +#define BNO055_MAG_OFFSET_Z_MSB_LEN (8) +#define BNO055_MAG_OFFSET_Z_MSB_REG BNO055_MAG_OFFSET_Z_MSB_ADDR /* Gyro Offset registers*/ -#define BNO055_GYRO_OFFSET_X_LSB__POS 0 -#define BNO055_GYRO_OFFSET_X_LSB__MSK 0XFF -#define BNO055_GYRO_OFFSET_X_LSB__LEN 8 -#define BNO055_GYRO_OFFSET_X_LSB__REG GYRO_OFFSET_X_LSB_ADDR - -#define BNO055_GYRO_OFFSET_X_MSB__POS 0 -#define BNO055_GYRO_OFFSET_X_MSB__MSK 0XFF -#define BNO055_GYRO_OFFSET_X_MSB__LEN 8 -#define BNO055_GYRO_OFFSET_X_MSB__REG GYRO_OFFSET_X_MSB_ADDR - -#define BNO055_GYRO_OFFSET_Y_LSB__POS 0 -#define BNO055_GYRO_OFFSET_Y_LSB__MSK 0XFF -#define BNO055_GYRO_OFFSET_Y_LSB__LEN 8 -#define BNO055_GYRO_OFFSET_Y_LSB__REG GYRO_OFFSET_Y_LSB_ADDR - -#define BNO055_GYRO_OFFSET_Y_MSB__POS 0 -#define BNO055_GYRO_OFFSET_Y_MSB__MSK 0XFF -#define BNO055_GYRO_OFFSET_Y_MSB__LEN 8 -#define BNO055_GYRO_OFFSET_Y_MSB__REG GYRO_OFFSET_Y_MSB_ADDR - -#define BNO055_GYRO_OFFSET_Z_LSB__POS 0 -#define BNO055_GYRO_OFFSET_Z_LSB__MSK 0XFF -#define BNO055_GYRO_OFFSET_Z_LSB__LEN 8 -#define BNO055_GYRO_OFFSET_Z_LSB__REG GYRO_OFFSET_Z_LSB_ADDR - -#define BNO055_GYRO_OFFSET_Z_MSB__POS 0 -#define BNO055_GYRO_OFFSET_Z_MSB__MSK 0XFF -#define BNO055_GYRO_OFFSET_Z_MSB__LEN 8 -#define BNO055_GYRO_OFFSET_Z_MSB__REG GYRO_OFFSET_Z_MSB_ADDR +#define BNO055_GYRO_OFFSET_X_LSB_POS (0) +#define BNO055_GYRO_OFFSET_X_LSB_MSK (0XFF) +#define BNO055_GYRO_OFFSET_X_LSB_LEN (8) +#define BNO055_GYRO_OFFSET_X_LSB_REG BNO055_GYRO_OFFSET_X_LSB_ADDR + +#define BNO055_GYRO_OFFSET_X_MSB_POS (0) +#define BNO055_GYRO_OFFSET_X_MSB_MSK (0XFF) +#define BNO055_GYRO_OFFSET_X_MSB_LEN (8) +#define BNO055_GYRO_OFFSET_X_MSB_REG BNO055_GYRO_OFFSET_X_MSB_ADDR + +#define BNO055_GYRO_OFFSET_Y_LSB_POS (0) +#define BNO055_GYRO_OFFSET_Y_LSB_MSK (0XFF) +#define BNO055_GYRO_OFFSET_Y_LSB_LEN (8) +#define BNO055_GYRO_OFFSET_Y_LSB_REG BNO055_GYRO_OFFSET_Y_LSB_ADDR + +#define BNO055_GYRO_OFFSET_Y_MSB_POS (0) +#define BNO055_GYRO_OFFSET_Y_MSB_MSK (0XFF) +#define BNO055_GYRO_OFFSET_Y_MSB_LEN (8) +#define BNO055_GYRO_OFFSET_Y_MSB_REG BNO055_GYRO_OFFSET_Y_MSB_ADDR + +#define BNO055_GYRO_OFFSET_Z_LSB_POS (0) +#define BNO055_GYRO_OFFSET_Z_LSB_MSK (0XFF) +#define BNO055_GYRO_OFFSET_Z_LSB_LEN (8) +#define BNO055_GYRO_OFFSET_Z_LSB_REG BNO055_GYRO_OFFSET_Z_LSB_ADDR + +#define BNO055_GYRO_OFFSET_Z_MSB_POS (0) +#define BNO055_GYRO_OFFSET_Z_MSB_MSK (0XFF) +#define BNO055_GYRO_OFFSET_Z_MSB_LEN (8) +#define BNO055_GYRO_OFFSET_Z_MSB_REG BNO055_GYRO_OFFSET_Z_MSB_ADDR /* Radius register definition*/ -#define BNO055_ACCEL_RADIUS_LSB__POS 0 -#define BNO055_ACCEL_RADIUS_LSB__MSK 0XFF -#define BNO055_ACCEL_RADIUS_LSB__LEN 8 -#define BNO055_ACCEL_RADIUS_LSB__REG ACCEL_RADIUS_LSB_ADDR - -#define BNO055_ACCEL_RADIUS_MSB__POS 0 -#define BNO055_ACCEL_RADIUS_MSB__MSK 0XFF -#define BNO055_ACCEL_RADIUS_MSB__LEN 8 -#define BNO055_ACCEL_RADIUS_MSB__REG ACCEL_RADIUS_MSB_ADDR - -#define BNO055_MAG_RADIUS_LSB__POS 0 -#define BNO055_MAG_RADIUS_LSB__MSK 0XFF -#define BNO055_MAG_RADIUS_LSB__LEN 8 -#define BNO055_MAG_RADIUS_LSB__REG MAG_RADIUS_LSB_ADDR - -#define BNO055_MAG_RADIUS_MSB__POS 0 -#define BNO055_MAG_RADIUS_MSB__MSK 0XFF -#define BNO055_MAG_RADIUS_MSB__LEN 8 -#define BNO055_MAG_RADIUS_MSB__REG MAG_RADIUS_MSB_ADDR +#define BNO055_ACCEL_RADIUS_LSB_POS (0) +#define BNO055_ACCEL_RADIUS_LSB_MSK (0XFF) +#define BNO055_ACCEL_RADIUS_LSB_LEN (8) +#define BNO055_ACCEL_RADIUS_LSB_REG BNO055_ACCEL_RADIUS_LSB_ADDR + +#define BNO055_ACCEL_RADIUS_MSB_POS (0) +#define BNO055_ACCEL_RADIUS_MSB_MSK (0XFF) +#define BNO055_ACCEL_RADIUS_MSB_LEN (8) +#define BNO055_ACCEL_RADIUS_MSB_REG BNO055_ACCEL_RADIUS_MSB_ADDR + +#define BNO055_MAG_RADIUS_LSB_POS (0) +#define BNO055_MAG_RADIUS_LSB_MSK (0XFF) +#define BNO055_MAG_RADIUS_LSB_LEN (8) +#define BNO055_MAG_RADIUS_LSB_REG BNO055_MAG_RADIUS_LSB_ADDR + +#define BNO055_MAG_RADIUS_MSB_POS (0) +#define BNO055_MAG_RADIUS_MSB_MSK (0XFF) +#define BNO055_MAG_RADIUS_MSB_LEN (8) +#define BNO055_MAG_RADIUS_MSB_REG BNO055_MAG_RADIUS_MSB_ADDR /* PAGE0 DATA REGISTERS DEFINITION END*/ /*************************************************/ @@ -1770,353 +1803,353 @@ BNO055_GRAVITY_DATA_Z_MSB_ADDR /*************************************************/ /* Configuration registers*/ /* Accel range configuration register*/ -#define BNO055_ACCEL_RANGE__POS 0 -#define BNO055_ACCEL_RANGE__MSK 0X03 -#define BNO055_ACCEL_RANGE__LEN 2 -#define BNO055_ACCEL_RANGE__REG ACCEL_CONFIG_ADDR +#define BNO055_ACCEL_RANGE_POS (0) +#define BNO055_ACCEL_RANGE_MSK (0X03) +#define BNO055_ACCEL_RANGE_LEN (2) +#define BNO055_ACCEL_RANGE_REG BNO055_ACCEL_CONFIG_ADDR /* Accel bandwidth configuration register*/ -#define BNO055_ACCEL_BW__POS 2 -#define BNO055_ACCEL_BW__MSK 0X1C -#define BNO055_ACCEL_BW__LEN 3 -#define BNO055_ACCEL_BW__REG ACCEL_CONFIG_ADDR +#define BNO055_ACCEL_BW_POS (2) +#define BNO055_ACCEL_BW_MSK (0X1C) +#define BNO055_ACCEL_BW_LEN (3) +#define BNO055_ACCEL_BW_REG BNO055_ACCEL_CONFIG_ADDR /* Accel power mode configuration register*/ -#define BNO055_ACCEL_POWER_MODE__POS 5 -#define BNO055_ACCEL_POWER_MODE__MSK 0XE0 -#define BNO055_ACCEL_POWER_MODE__LEN 3 -#define BNO055_ACCEL_POWER_MODE__REG ACCEL_CONFIG_ADDR +#define BNO055_ACCEL_POWER_MODE_POS (5) +#define BNO055_ACCEL_POWER_MODE_MSK (0XE0) +#define BNO055_ACCEL_POWER_MODE_LEN (3) +#define BNO055_ACCEL_POWER_MODE_REG BNO055_ACCEL_CONFIG_ADDR /* Mag data output rate configuration register*/ -#define BNO055_MAG_DATA_OUTPUT_RATE__POS 0 -#define BNO055_MAG_DATA_OUTPUT_RATE__MSK 0X07 -#define BNO055_MAG_DATA_OUTPUT_RATE__LEN 3 -#define BNO055_MAG_DATA_OUTPUT_RATE__REG MAG_CONFIG_ADDR +#define BNO055_MAG_DATA_OUTPUT_RATE_POS (0) +#define BNO055_MAG_DATA_OUTPUT_RATE_MSK (0X07) +#define BNO055_MAG_DATA_OUTPUT_RATE_LEN (3) +#define BNO055_MAG_DATA_OUTPUT_RATE_REG BNO055_MAG_CONFIG_ADDR /* Mag operation mode configuration register*/ -#define BNO055_MAG_OPERATION_MODE__POS 3 -#define BNO055_MAG_OPERATION_MODE__MSK 0X18 -#define BNO055_MAG_OPERATION_MODE__LEN 2 -#define BNO055_MAG_OPERATION_MODE__REG MAG_CONFIG_ADDR +#define BNO055_MAG_OPERATION_MODE_POS (3) +#define BNO055_MAG_OPERATION_MODE_MSK (0X18) +#define BNO055_MAG_OPERATION_MODE_LEN (2) +#define BNO055_MAG_OPERATION_MODE_REG BNO055_MAG_CONFIG_ADDR /* Mag power mode configuration register*/ -#define BNO055_MAG_POWER_MODE__POS 5 -#define BNO055_MAG_POWER_MODE__MSK 0X60 -#define BNO055_MAG_POWER_MODE__LEN 2 -#define BNO055_MAG_POWER_MODE__REG MAG_CONFIG_ADDR +#define BNO055_MAG_POWER_MODE_POS (5) +#define BNO055_MAG_POWER_MODE_MSK (0X60) +#define BNO055_MAG_POWER_MODE_LEN (2) +#define BNO055_MAG_POWER_MODE_REG BNO055_MAG_CONFIG_ADDR /* Gyro range configuration register*/ -#define BNO055_GYRO_RANGE__POS 0 -#define BNO055_GYRO_RANGE__MSK 0X07 -#define BNO055_GYRO_RANGE__LEN 3 -#define BNO055_GYRO_RANGE__REG GYRO_CONFIG_ADDR +#define BNO055_GYRO_RANGE_POS (0) +#define BNO055_GYRO_RANGE_MSK (0X07) +#define BNO055_GYRO_RANGE_LEN (3) +#define BNO055_GYRO_RANGE_REG BNO055_GYRO_CONFIG_ADDR /* Gyro bandwidth configuration register*/ -#define BNO055_GYRO_BW__POS 3 -#define BNO055_GYRO_BW__MSK 0X38 -#define BNO055_GYRO_BW__LEN 3 -#define BNO055_GYRO_BW__REG GYRO_CONFIG_ADDR +#define BNO055_GYRO_BW_POS (3) +#define BNO055_GYRO_BW_MSK (0X38) +#define BNO055_GYRO_BW_LEN (3) +#define BNO055_GYRO_BW_REG BNO055_GYRO_CONFIG_ADDR /* Gyro power mode configuration register*/ -#define BNO055_GYRO_POWER_MODE__POS 0 -#define BNO055_GYRO_POWER_MODE__MSK 0X07 -#define BNO055_GYRO_POWER_MODE__LEN 3 -#define BNO055_GYRO_POWER_MODE__REG GYRO_MODE_CONFIG_ADDR +#define BNO055_GYRO_POWER_MODE_POS (0) +#define BNO055_GYRO_POWER_MODE_MSK (0X07) +#define BNO055_GYRO_POWER_MODE_LEN (3) +#define BNO055_GYRO_POWER_MODE_REG BNO055_GYRO_MODE_CONFIG_ADDR /* Sleep configuration registers*/ /* Accel sleep mode configuration register*/ -#define BNO055_ACCEL_SLEEP_MODE__POS 0 -#define BNO055_ACCEL_SLEEP_MODE__MSK 0X01 -#define BNO055_ACCEL_SLEEP_MODE__LEN 1 -#define BNO055_ACCEL_SLEEP_MODE__REG ACCEL_SLEEP_CONFIG_ADDR +#define BNO055_ACCEL_SLEEP_MODE_POS (0) +#define BNO055_ACCEL_SLEEP_MODE_MSK (0X01) +#define BNO055_ACCEL_SLEEP_MODE_LEN (1) +#define BNO055_ACCEL_SLEEP_MODE_REG BNO055_ACCEL_SLEEP_CONFIG_ADDR /* Accel sleep duration configuration register*/ -#define BNO055_ACCEL_SLEEP_DURN__POS 1 -#define BNO055_ACCEL_SLEEP_DURN__MSK 0X1E -#define BNO055_ACCEL_SLEEP_DURN__LEN 4 -#define BNO055_ACCEL_SLEEP_DURN__REG ACCEL_SLEEP_CONFIG_ADDR +#define BNO055_ACCEL_SLEEP_DURN_POS (1) +#define BNO055_ACCEL_SLEEP_DURN_MSK (0X1E) +#define BNO055_ACCEL_SLEEP_DURN_LEN (4) +#define BNO055_ACCEL_SLEEP_DURN_REG BNO055_ACCEL_SLEEP_CONFIG_ADDR /* Gyro sleep duration configuration register*/ -#define BNO055_GYRO_SLEEP_DURN__POS 0 -#define BNO055_GYRO_SLEEP_DURN__MSK 0X07 -#define BNO055_GYRO_SLEEP_DURN__LEN 3 -#define BNO055_GYRO_SLEEP_DURN__REG GYRO_SLEEP_CONFIG_ADDR +#define BNO055_GYRO_SLEEP_DURN_POS (0) +#define BNO055_GYRO_SLEEP_DURN_MSK (0X07) +#define BNO055_GYRO_SLEEP_DURN_LEN (3) +#define BNO055_GYRO_SLEEP_DURN_REG BNO055_GYRO_SLEEP_CONFIG_ADDR /* Gyro auto sleep duration configuration register*/ -#define BNO055_GYRO_AUTO_SLEEP_DURN__POS 3 -#define BNO055_GYRO_AUTO_SLEEP_DURN__MSK 0X38 -#define BNO055_GYRO_AUTO_SLEEP_DURN__LEN 3 -#define BNO055_GYRO_AUTO_SLEEP_DURN__REG GYRO_SLEEP_CONFIG_ADDR +#define BNO055_GYRO_AUTO_SLEEP_DURN_POS (3) +#define BNO055_GYRO_AUTO_SLEEP_DURN_MSK (0X38) +#define BNO055_GYRO_AUTO_SLEEP_DURN_LEN (3) +#define BNO055_GYRO_AUTO_SLEEP_DURN_REG BNO055_GYRO_SLEEP_CONFIG_ADDR /* Mag sleep mode configuration register*/ -#define BNO055_MAG_SLEEP_MODE__POS 0 -#define BNO055_MAG_SLEEP_MODE__MSK 0X01 -#define BNO055_MAG_SLEEP_MODE__LEN 1 -#define BNO055_MAG_SLEEP_MODE__REG MAG_SLEEP_CONFIG_ADDR +#define BNO055_MAG_SLEEP_MODE_POS (0) +#define BNO055_MAG_SLEEP_MODE_MSK (0X01) +#define BNO055_MAG_SLEEP_MODE_LEN (1) +#define BNO055_MAG_SLEEP_MODE_REG BNO055_MAG_SLEEP_CONFIG_ADDR /* Mag sleep duration configuration register*/ -#define BNO055_MAG_SLEEP_DURN__POS 1 -#define BNO055_MAG_SLEEP_DURN__MSK 0X1E -#define BNO055_MAG_SLEEP_DURN__LEN 4 -#define BNO055_MAG_SLEEP_DURN__REG MAG_SLEEP_CONFIG_ADDR +#define BNO055_MAG_SLEEP_DURN_POS (1) +#define BNO055_MAG_SLEEP_DURN_MSK (0X1E) +#define BNO055_MAG_SLEEP_DURN_LEN (4) +#define BNO055_MAG_SLEEP_DURN_REG BNO055_MAG_SLEEP_CONFIG_ADDR /* Interrupt registers*/ /* Gyro any motion interrupt msk register*/ -#define BNO055_GYRO_ANY_MOTION_INTR_MASK__POS 2 -#define BNO055_GYRO_ANY_MOTION_INTR_MASK__MSK 0X04 -#define BNO055_GYRO_ANY_MOTION_INTR_MASK__LEN 1 -#define BNO055_GYRO_ANY_MOTION_INTR_MASK__REG INT_MASK_ADDR +#define BNO055_GYRO_ANY_MOTION_INTR_MASK_POS (2) +#define BNO055_GYRO_ANY_MOTION_INTR_MASK_MSK (0X04) +#define BNO055_GYRO_ANY_MOTION_INTR_MASK_LEN (1) +#define BNO055_GYRO_ANY_MOTION_INTR_MASK_REG BNO055_INT_MASK_ADDR /* Gyro high rate interrupt msk register*/ -#define BNO055_GYRO_HIGHRATE_INTR_MASK__POS 3 -#define BNO055_GYRO_HIGHRATE_INTR_MASK__MSK 0X08 -#define BNO055_GYRO_HIGHRATE_INTR_MASK__LEN 1 -#define BNO055_GYRO_HIGHRATE_INTR_MASK__REG INT_MASK_ADDR +#define BNO055_GYRO_HIGHRATE_INTR_MASK_POS (3) +#define BNO055_GYRO_HIGHRATE_INTR_MASK_MSK (0X08) +#define BNO055_GYRO_HIGHRATE_INTR_MASK_LEN (1) +#define BNO055_GYRO_HIGHRATE_INTR_MASK_REG BNO055_INT_MASK_ADDR /* Accel high g interrupt msk register*/ -#define BNO055_ACCEL_HIGH_G_INTR_MASK__POS 5 -#define BNO055_ACCEL_HIGH_G_INTR_MASK__MSK 0X20 -#define BNO055_ACCEL_HIGH_G_INTR_MASK__LEN 1 -#define BNO055_ACCEL_HIGH_G_INTR_MASK__REG INT_MASK_ADDR +#define BNO055_ACCEL_HIGH_G_INTR_MASK_POS (5) +#define BNO055_ACCEL_HIGH_G_INTR_MASK_MSK (0X20) +#define BNO055_ACCEL_HIGH_G_INTR_MASK_LEN (1) +#define BNO055_ACCEL_HIGH_G_INTR_MASK_REG BNO055_INT_MASK_ADDR /* Accel any motion interrupt msk register*/ -#define BNO055_ACCEL_ANY_MOTION_INTR_MASK__POS 6 -#define BNO055_ACCEL_ANY_MOTION_INTR_MASK__MSK 0X40 -#define BNO055_ACCEL_ANY_MOTION_INTR_MASK__LEN 1 -#define BNO055_ACCEL_ANY_MOTION_INTR_MASK__REG INT_MASK_ADDR +#define BNO055_ACCEL_ANY_MOTION_INTR_MASK_POS (6) +#define BNO055_ACCEL_ANY_MOTION_INTR_MASK_MSK (0X40) +#define BNO055_ACCEL_ANY_MOTION_INTR_MASK_LEN (1) +#define BNO055_ACCEL_ANY_MOTION_INTR_MASK_REG BNO055_INT_MASK_ADDR /* Accel any motion interrupt msk register*/ -#define BNO055_ACCEL_NO_MOTION_INTR_MASK__POS 7 -#define BNO055_ACCEL_NO_MOTION_INTR_MASK__MSK 0X80 -#define BNO055_ACCEL_NO_MOTION_INTR_MASK__LEN 1 -#define BNO055_ACCEL_NO_MOTION_INTR_MASK__REG INT_MASK_ADDR +#define BNO055_ACCEL_NO_MOTION_INTR_MASK_POS (7) +#define BNO055_ACCEL_NO_MOTION_INTR_MASK_MSK (0X80) +#define BNO055_ACCEL_NO_MOTION_INTR_MASK_LEN (1) +#define BNO055_ACCEL_NO_MOTION_INTR_MASK_REG BNO055_INT_MASK_ADDR /* Gyro any motion interrupt register*/ -#define BNO055_GYRO_ANY_MOTION_INTR__POS 2 -#define BNO055_GYRO_ANY_MOTION_INTR__MSK 0X04 -#define BNO055_GYRO_ANY_MOTION_INTR__LEN 1 -#define BNO055_GYRO_ANY_MOTION_INTR__REG INT_ADDR +#define BNO055_GYRO_ANY_MOTION_INTR_POS (2) +#define BNO055_GYRO_ANY_MOTION_INTR_MSK (0X04) +#define BNO055_GYRO_ANY_MOTION_INTR_LEN (1) +#define BNO055_GYRO_ANY_MOTION_INTR_REG BNO055_INT_ADDR /* Gyro high rate interrupt register*/ -#define BNO055_GYRO_HIGHRATE_INTR__POS 3 -#define BNO055_GYRO_HIGHRATE_INTR__MSK 0X08 -#define BNO055_GYRO_HIGHRATE_INTR__LEN 1 -#define BNO055_GYRO_HIGHRATE_INTR__REG INT_ADDR +#define BNO055_GYRO_HIGHRATE_INTR_POS (3) +#define BNO055_GYRO_HIGHRATE_INTR_MSK (0X08) +#define BNO055_GYRO_HIGHRATE_INTR_LEN (1) +#define BNO055_GYRO_HIGHRATE_INTR_REG BNO055_INT_ADDR /* Accel high g interrupt register*/ -#define BNO055_ACCEL_HIGH_G_INTR__POS 5 -#define BNO055_ACCEL_HIGH_G_INTR__MSK 0X20 -#define BNO055_ACCEL_HIGH_G_INTR__LEN 1 -#define BNO055_ACCEL_HIGH_G_INTR__REG INT_ADDR +#define BNO055_ACCEL_HIGH_G_INTR_POS (5) +#define BNO055_ACCEL_HIGH_G_INTR_MSK (0X20) +#define BNO055_ACCEL_HIGH_G_INTR_LEN (1) +#define BNO055_ACCEL_HIGH_G_INTR_REG BNO055_INT_ADDR /* Accel any motion interrupt register*/ -#define BNO055_ACCEL_ANY_MOTION_INTR__POS 6 -#define BNO055_ACCEL_ANY_MOTION_INTR__MSK 0X40 -#define BNO055_ACCEL_ANY_MOTION_INTR__LEN 1 -#define BNO055_ACCEL_ANY_MOTION_INTR__REG INT_ADDR +#define BNO055_ACCEL_ANY_MOTION_INTR_POS (6) +#define BNO055_ACCEL_ANY_MOTION_INTR_MSK (0X40) +#define BNO055_ACCEL_ANY_MOTION_INTR_LEN (1) +#define BNO055_ACCEL_ANY_MOTION_INTR_REG BNO055_INT_ADDR /*Accel any motion interrupt register*/ -#define BNO055_ACCEL_NO_MOTION_INTR__POS 7 -#define BNO055_ACCEL_NO_MOTION_INTR__MSK 0X80 -#define BNO055_ACCEL_NO_MOTION_INTR__LEN 1 -#define BNO055_ACCEL_NO_MOTION_INTR__REG INT_ADDR +#define BNO055_ACCEL_NO_MOTION_INTR_POS (7) +#define BNO055_ACCEL_NO_MOTION_INTR_MSK (0X80) +#define BNO055_ACCEL_NO_MOTION_INTR_LEN (1) +#define BNO055_ACCEL_NO_MOTION_INTR_REG BNO055_INT_ADDR /*Accel any motion threshold setting*/ -#define BNO055_ACCEL_ANY_MOTION_THRES__POS 0 -#define BNO055_ACCEL_ANY_MOTION_THRES__MSK 0XFF -#define BNO055_ACCEL_ANY_MOTION_THRES__LEN 8 -#define BNO055_ACCEL_ANY_MOTION_THRES__REG ACCEL_ANY_MOTION_THRES_ADDR +#define BNO055_ACCEL_ANY_MOTION_THRES_POS (0) +#define BNO055_ACCEL_ANY_MOTION_THRES_MSK (0XFF) +#define BNO055_ACCEL_ANY_MOTION_THRES_LEN (8) +#define BNO055_ACCEL_ANY_MOTION_THRES_REG BNO055_ACCEL_ANY_MOTION_THRES_ADDR /*Accel interrupt setting register*/ -#define BNO055_ACCEL_ANY_MOTION_DURN_SET__POS 0 -#define BNO055_ACCEL_ANY_MOTION_DURN_SET__MSK 0X03 -#define BNO055_ACCEL_ANY_MOTION_DURN_SET__LEN 2 -#define BNO055_ACCEL_ANY_MOTION_DURN_SET__REG ACCEL_INTR_SETTINGS_ADDR +#define BNO055_ACCEL_ANY_MOTION_DURN_SET_POS (0) +#define BNO055_ACCEL_ANY_MOTION_DURN_SET_MSK (0X03) +#define BNO055_ACCEL_ANY_MOTION_DURN_SET_LEN (2) +#define BNO055_ACCEL_ANY_MOTION_DURN_SET_REG BNO055_ACCEL_INTR_SETTINGS_ADDR /* Accel AM/NM axis selection register*/ -#define BNO055_ACCEL_ANY_MOTION_X_AXIS__POS 2 -#define BNO055_ACCEL_ANY_MOTION_X_AXIS__MSK 0X04 -#define BNO055_ACCEL_ANY_MOTION_X_AXIS__LEN 1 -#define BNO055_ACCEL_ANY_MOTION_X_AXIS__REG ACCEL_INTR_SETTINGS_ADDR +#define BNO055_ACCEL_ANY_MOTION_X_AXIS_POS (2) +#define BNO055_ACCEL_ANY_MOTION_X_AXIS_MSK (0X04) +#define BNO055_ACCEL_ANY_MOTION_X_AXIS_LEN (1) +#define BNO055_ACCEL_ANY_MOTION_X_AXIS_REG BNO055_ACCEL_INTR_SETTINGS_ADDR -#define BNO055_ACCEL_ANY_MOTION_Y_AXIS__POS 3 -#define BNO055_ACCEL_ANY_MOTION_Y_AXIS__MSK 0X08 -#define BNO055_ACCEL_ANY_MOTION_Y_AXIS__LEN 1 -#define BNO055_ACCEL_ANY_MOTION_Y_AXIS__REG ACCEL_INTR_SETTINGS_ADDR +#define BNO055_ACCEL_ANY_MOTION_Y_AXIS_POS (3) +#define BNO055_ACCEL_ANY_MOTION_Y_AXIS_MSK (0X08) +#define BNO055_ACCEL_ANY_MOTION_Y_AXIS_LEN (1) +#define BNO055_ACCEL_ANY_MOTION_Y_AXIS_REG BNO055_ACCEL_INTR_SETTINGS_ADDR -#define BNO055_ACCEL_ANY_MOTION_Z_AXIS__POS 4 -#define BNO055_ACCEL_ANY_MOTION_Z_AXIS__MSK 0X10 -#define BNO055_ACCEL_ANY_MOTION_Z_AXIS__LEN 1 -#define BNO055_ACCEL_ANY_MOTION_Z_AXIS__REG ACCEL_INTR_SETTINGS_ADDR +#define BNO055_ACCEL_ANY_MOTION_Z_AXIS_POS (4) +#define BNO055_ACCEL_ANY_MOTION_Z_AXIS_MSK (0X10) +#define BNO055_ACCEL_ANY_MOTION_Z_AXIS_LEN (1) +#define BNO055_ACCEL_ANY_MOTION_Z_AXIS_REG BNO055_ACCEL_INTR_SETTINGS_ADDR /* Accel high g axis selection register*/ -#define BNO055_ACCEL_HIGH_G_X_AXIS__POS 5 -#define BNO055_ACCEL_HIGH_G_X_AXIS__MSK 0X20 -#define BNO055_ACCEL_HIGH_G_X_AXIS__LEN 1 -#define BNO055_ACCEL_HIGH_G_X_AXIS__REG ACCEL_INTR_SETTINGS_ADDR +#define BNO055_ACCEL_HIGH_G_X_AXIS_POS (5) +#define BNO055_ACCEL_HIGH_G_X_AXIS_MSK (0X20) +#define BNO055_ACCEL_HIGH_G_X_AXIS_LEN (1) +#define BNO055_ACCEL_HIGH_G_X_AXIS_REG BNO055_ACCEL_INTR_SETTINGS_ADDR -#define BNO055_ACCEL_HIGH_G_Y_AXIS__POS 6 -#define BNO055_ACCEL_HIGH_G_Y_AXIS__MSK 0X40 -#define BNO055_ACCEL_HIGH_G_Y_AXIS__LEN 1 -#define BNO055_ACCEL_HIGH_G_Y_AXIS__REG ACCEL_INTR_SETTINGS_ADDR +#define BNO055_ACCEL_HIGH_G_Y_AXIS_POS (6) +#define BNO055_ACCEL_HIGH_G_Y_AXIS_MSK (0X40) +#define BNO055_ACCEL_HIGH_G_Y_AXIS_LEN (1) +#define BNO055_ACCEL_HIGH_G_Y_AXIS_REG BNO055_ACCEL_INTR_SETTINGS_ADDR -#define BNO055_ACCEL_HIGH_G_Z_AXIS__POS 7 -#define BNO055_ACCEL_HIGH_G_Z_AXIS__MSK 0X80 -#define BNO055_ACCEL_HIGH_G_Z_AXIS__LEN 1 -#define BNO055_ACCEL_HIGH_G_Z_AXIS__REG ACCEL_INTR_SETTINGS_ADDR +#define BNO055_ACCEL_HIGH_G_Z_AXIS_POS (7) +#define BNO055_ACCEL_HIGH_G_Z_AXIS_MSK (0X80) +#define BNO055_ACCEL_HIGH_G_Z_AXIS_LEN (1) +#define BNO055_ACCEL_HIGH_G_Z_AXIS_REG BNO055_ACCEL_INTR_SETTINGS_ADDR /* Accel High g duration setting register*/ -#define BNO055_ACCEL_HIGH_G_DURN__POS 0 -#define BNO055_ACCEL_HIGH_G_DURN__MSK 0XFF -#define BNO055_ACCEL_HIGH_G_DURN__LEN 8 -#define BNO055_ACCEL_HIGH_G_DURN__REG ACCEL_HIGH_G_DURN_ADDR +#define BNO055_ACCEL_HIGH_G_DURN_POS (0) +#define BNO055_ACCEL_HIGH_G_DURN_MSK (0XFF) +#define BNO055_ACCEL_HIGH_G_DURN_LEN (8) +#define BNO055_ACCEL_HIGH_G_DURN_REG BNO055_ACCEL_HIGH_G_DURN_ADDR /* Accel High g threshold setting register*/ -#define BNO055_ACCEL_HIGH_G_THRES__POS 0 -#define BNO055_ACCEL_HIGH_G_THRES__MSK 0XFF -#define BNO055_ACCEL_HIGH_G_THRES__LEN 8 -#define BNO055_ACCEL_HIGH_G_THRES__REG ACCEL_HIGH_G_THRES_ADDR +#define BNO055_ACCEL_HIGH_G_THRES_POS (0) +#define BNO055_ACCEL_HIGH_G_THRES_MSK (0XFF) +#define BNO055_ACCEL_HIGH_G_THRES_LEN (8) +#define BNO055_ACCEL_HIGH_G_THRES_REG BNO055_ACCEL_HIGH_G_THRES_ADDR /* Accel no/slow motion threshold setting*/ -#define BNO055_ACCEL_SLOW_NO_MOTION_THRES__POS 0 -#define BNO055_ACCEL_SLOW_NO_MOTION_THRES__MSK 0XFF -#define BNO055_ACCEL_SLOW_NO_MOTION_THRES__LEN 8 -#define BNO055_ACCEL_SLOW_NO_MOTION_THRES__REG \ -ACCEL_NO_MOTION_THRES_ADDR +#define BNO055_ACCEL_SLOW_NO_MOTION_THRES_POS (0) +#define BNO055_ACCEL_SLOW_NO_MOTION_THRES_MSK (0XFF) +#define BNO055_ACCEL_SLOW_NO_MOTION_THRES_LEN (8) +#define BNO055_ACCEL_SLOW_NO_MOTION_THRES_REG \ +BNO055_ACCEL_NO_MOTION_THRES_ADDR /* Accel no/slow motion enable setting*/ -#define BNO055_ACCEL_SLOW_NO_MOTION_ENABLE__POS 0 -#define BNO055_ACCEL_SLOW_NO_MOTION_ENABLE__MSK 0X01 -#define BNO055_ACCEL_SLOW_NO_MOTION_ENABLE__LEN 1 -#define BNO055_ACCEL_SLOW_NO_MOTION_ENABLE__REG ACCEL_NO_MOTION_SET_ADDR +#define BNO055_ACCEL_SLOW_NO_MOTION_ENABLE_POS (0) +#define BNO055_ACCEL_SLOW_NO_MOTION_ENABLE_MSK (0X01) +#define BNO055_ACCEL_SLOW_NO_MOTION_ENABLE_LEN (1) +#define BNO055_ACCEL_SLOW_NO_MOTION_ENABLE_REG BNO055_ACCEL_NO_MOTION_SET_ADDR /* Accel no/slow motion duration setting*/ -#define BNO055_ACCEL_SLOW_NO_MOTION_DURN__POS 1 -#define BNO055_ACCEL_SLOW_NO_MOTION_DURN__MSK 0X7E -#define BNO055_ACCEL_SLOW_NO_MOTION_DURN__LEN 6 -#define BNO055_ACCEL_SLOW_NO_MOTION_DURN__REG ACCEL_NO_MOTION_SET_ADDR +#define BNO055_ACCEL_SLOW_NO_MOTION_DURN_POS (1) +#define BNO055_ACCEL_SLOW_NO_MOTION_DURN_MSK (0X7E) +#define BNO055_ACCEL_SLOW_NO_MOTION_DURN_LEN (6) +#define BNO055_ACCEL_SLOW_NO_MOTION_DURN_REG BNO055_ACCEL_NO_MOTION_SET_ADDR /*Gyro interrupt setting register*/ /*Gyro any motion axis setting*/ -#define BNO055_GYRO_ANY_MOTION_X_AXIS__POS 0 -#define BNO055_GYRO_ANY_MOTION_X_AXIS__MSK 0X01 -#define BNO055_GYRO_ANY_MOTION_X_AXIS__LEN 1 -#define BNO055_GYRO_ANY_MOTION_X_AXIS__REG GYRO_INTR_SETING_ADDR +#define BNO055_GYRO_ANY_MOTION_X_AXIS_POS (0) +#define BNO055_GYRO_ANY_MOTION_X_AXIS_MSK (0X01) +#define BNO055_GYRO_ANY_MOTION_X_AXIS_LEN (1) +#define BNO055_GYRO_ANY_MOTION_X_AXIS_REG BNO055_GYRO_INTR_SETING_ADDR -#define BNO055_GYRO_ANY_MOTION_Y_AXIS__POS 1 -#define BNO055_GYRO_ANY_MOTION_Y_AXIS__MSK 0X02 -#define BNO055_GYRO_ANY_MOTION_Y_AXIS__LEN 1 -#define BNO055_GYRO_ANY_MOTION_Y_AXIS__REG GYRO_INTR_SETING_ADDR +#define BNO055_GYRO_ANY_MOTION_Y_AXIS_POS (1) +#define BNO055_GYRO_ANY_MOTION_Y_AXIS_MSK (0X02) +#define BNO055_GYRO_ANY_MOTION_Y_AXIS_LEN (1) +#define BNO055_GYRO_ANY_MOTION_Y_AXIS_REG BNO055_GYRO_INTR_SETING_ADDR -#define BNO055_GYRO_ANY_MOTION_Z_AXIS__POS 2 -#define BNO055_GYRO_ANY_MOTION_Z_AXIS__MSK 0X04 -#define BNO055_GYRO_ANY_MOTION_Z_AXIS__LEN 1 -#define BNO055_GYRO_ANY_MOTION_Z_AXIS__REG GYRO_INTR_SETING_ADDR +#define BNO055_GYRO_ANY_MOTION_Z_AXIS_POS (2) +#define BNO055_GYRO_ANY_MOTION_Z_AXIS_MSK (0X04) +#define BNO055_GYRO_ANY_MOTION_Z_AXIS_LEN (1) +#define BNO055_GYRO_ANY_MOTION_Z_AXIS_REG BNO055_GYRO_INTR_SETING_ADDR /*Gyro high rate axis setting*/ -#define BNO055_GYRO_HIGHRATE_X_AXIS__POS 3 -#define BNO055_GYRO_HIGHRATE_X_AXIS__MSK 0X08 -#define BNO055_GYRO_HIGHRATE_X_AXIS__LEN 1 -#define BNO055_GYRO_HIGHRATE_X_AXIS__REG GYRO_INTR_SETING_ADDR +#define BNO055_GYRO_HIGHRATE_X_AXIS_POS (3) +#define BNO055_GYRO_HIGHRATE_X_AXIS_MSK (0X08) +#define BNO055_GYRO_HIGHRATE_X_AXIS_LEN (1) +#define BNO055_GYRO_HIGHRATE_X_AXIS_REG BNO055_GYRO_INTR_SETING_ADDR -#define BNO055_GYRO_HIGHRATE_Y_AXIS__POS 4 -#define BNO055_GYRO_HIGHRATE_Y_AXIS__MSK 0X10 -#define BNO055_GYRO_HIGHRATE_Y_AXIS__LEN 1 -#define BNO055_GYRO_HIGHRATE_Y_AXIS__REG GYRO_INTR_SETING_ADDR +#define BNO055_GYRO_HIGHRATE_Y_AXIS_POS (4) +#define BNO055_GYRO_HIGHRATE_Y_AXIS_MSK (0X10) +#define BNO055_GYRO_HIGHRATE_Y_AXIS_LEN (1) +#define BNO055_GYRO_HIGHRATE_Y_AXIS_REG BNO055_GYRO_INTR_SETING_ADDR -#define BNO055_GYRO_HIGHRATE_Z_AXIS__POS 5 -#define BNO055_GYRO_HIGHRATE_Z_AXIS__MSK 0X20 -#define BNO055_GYRO_HIGHRATE_Z_AXIS__LEN 1 -#define BNO055_GYRO_HIGHRATE_Z_AXIS__REG GYRO_INTR_SETING_ADDR +#define BNO055_GYRO_HIGHRATE_Z_AXIS_POS (5) +#define BNO055_GYRO_HIGHRATE_Z_AXIS_MSK (0X20) +#define BNO055_GYRO_HIGHRATE_Z_AXIS_LEN (1) +#define BNO055_GYRO_HIGHRATE_Z_AXIS_REG BNO055_GYRO_INTR_SETING_ADDR /* Gyro filter setting*/ -#define BNO055_GYRO_ANY_MOTION_FILTER__POS 6 -#define BNO055_GYRO_ANY_MOTION_FILTER__MSK 0X40 -#define BNO055_GYRO_ANY_MOTION_FILTER__LEN 1 -#define BNO055_GYRO_ANY_MOTION_FILTER__REG GYRO_INTR_SETING_ADDR +#define BNO055_GYRO_ANY_MOTION_FILTER_POS (6) +#define BNO055_GYRO_ANY_MOTION_FILTER_MSK (0X40) +#define BNO055_GYRO_ANY_MOTION_FILTER_LEN (1) +#define BNO055_GYRO_ANY_MOTION_FILTER_REG BNO055_GYRO_INTR_SETING_ADDR -#define BNO055_GYRO_HIGHRATE_FILTER__POS 7 -#define BNO055_GYRO_HIGHRATE_FILTER__MSK 0X80 -#define BNO055_GYRO_HIGHRATE_FILTER__LEN 1 -#define BNO055_GYRO_HIGHRATE_FILTER__REG GYRO_INTR_SETING_ADDR +#define BNO055_GYRO_HIGHRATE_FILTER_POS (7) +#define BNO055_GYRO_HIGHRATE_FILTER_MSK (0X80) +#define BNO055_GYRO_HIGHRATE_FILTER_LEN (1) +#define BNO055_GYRO_HIGHRATE_FILTER_REG BNO055_GYRO_INTR_SETING_ADDR /* Gyro high rate X axis settings*/ -#define BNO055_GYRO_HIGHRATE_X_THRES__POS 0 -#define BNO055_GYRO_HIGHRATE_X_THRES__MSK 0X1F -#define BNO055_GYRO_HIGHRATE_X_THRES__LEN 5 -#define BNO055_GYRO_HIGHRATE_X_THRES__REG GYRO_HIGHRATE_X_SET_ADDR +#define BNO055_GYRO_HIGHRATE_X_THRES_POS (0) +#define BNO055_GYRO_HIGHRATE_X_THRES_MSK (0X1F) +#define BNO055_GYRO_HIGHRATE_X_THRES_LEN (5) +#define BNO055_GYRO_HIGHRATE_X_THRES_REG BNO055_GYRO_HIGHRATE_X_SET_ADDR -#define BNO055_GYRO_HIGHRATE_X_HYST__POS 5 -#define BNO055_GYRO_HIGHRATE_X_HYST__MSK 0X60 -#define BNO055_GYRO_HIGHRATE_X_HYST__LEN 2 -#define BNO055_GYRO_HIGHRATE_X_HYST__REG GYRO_HIGHRATE_X_SET_ADDR +#define BNO055_GYRO_HIGHRATE_X_HYST_POS (5) +#define BNO055_GYRO_HIGHRATE_X_HYST_MSK (0X60) +#define BNO055_GYRO_HIGHRATE_X_HYST_LEN (2) +#define BNO055_GYRO_HIGHRATE_X_HYST_REG BNO055_GYRO_HIGHRATE_X_SET_ADDR -#define BNO055_GYRO_HIGHRATE_X_DURN__POS 0 -#define BNO055_GYRO_HIGHRATE_X_DURN__MSK 0XFF -#define BNO055_GYRO_HIGHRATE_X_DURN__LEN 8 -#define BNO055_GYRO_HIGHRATE_X_DURN__REG GYRO_DURN_X_ADDR +#define BNO055_GYRO_HIGHRATE_X_DURN_POS (0) +#define BNO055_GYRO_HIGHRATE_X_DURN_MSK (0XFF) +#define BNO055_GYRO_HIGHRATE_X_DURN_LEN (8) +#define BNO055_GYRO_HIGHRATE_X_DURN_REG BNO055_GYRO_DURN_X_ADDR /* Gyro high rate Y axis settings*/ -#define BNO055_GYRO_HIGHRATE_Y_THRES__POS 0 -#define BNO055_GYRO_HIGHRATE_Y_THRES__MSK 0X1F -#define BNO055_GYRO_HIGHRATE_Y_THRES__LEN 5 -#define BNO055_GYRO_HIGHRATE_Y_THRES__REG GYRO_HIGHRATE_Y_SET_ADDR +#define BNO055_GYRO_HIGHRATE_Y_THRES_POS (0) +#define BNO055_GYRO_HIGHRATE_Y_THRES_MSK (0X1F) +#define BNO055_GYRO_HIGHRATE_Y_THRES_LEN (5) +#define BNO055_GYRO_HIGHRATE_Y_THRES_REG BNO055_GYRO_HIGHRATE_Y_SET_ADDR -#define BNO055_GYRO_HIGHRATE_Y_HYST__POS 5 -#define BNO055_GYRO_HIGHRATE_Y_HYST__MSK 0X60 -#define BNO055_GYRO_HIGHRATE_Y_HYST__LEN 2 -#define BNO055_GYRO_HIGHRATE_Y_HYST__REG GYRO_HIGHRATE_Y_SET_ADDR +#define BNO055_GYRO_HIGHRATE_Y_HYST_POS (5) +#define BNO055_GYRO_HIGHRATE_Y_HYST_MSK (0X60) +#define BNO055_GYRO_HIGHRATE_Y_HYST_LEN (2) +#define BNO055_GYRO_HIGHRATE_Y_HYST_REG BNO055_GYRO_HIGHRATE_Y_SET_ADDR -#define BNO055_GYRO_HIGHRATE_Y_DURN__POS 0 -#define BNO055_GYRO_HIGHRATE_Y_DURN__MSK 0XFF -#define BNO055_GYRO_HIGHRATE_Y_DURN__LEN 8 -#define BNO055_GYRO_HIGHRATE_Y_DURN__REG GYRO_DURN_Y_ADDR +#define BNO055_GYRO_HIGHRATE_Y_DURN_POS (0) +#define BNO055_GYRO_HIGHRATE_Y_DURN_MSK (0XFF) +#define BNO055_GYRO_HIGHRATE_Y_DURN_LEN (8) +#define BNO055_GYRO_HIGHRATE_Y_DURN_REG BNO055_GYRO_DURN_Y_ADDR /* Gyro high rate Z axis settings*/ -#define BNO055_GYRO_HIGHRATE_Z_THRES__POS 0 -#define BNO055_GYRO_HIGHRATE_Z_THRES__MSK 0X1F -#define BNO055_GYRO_HIGHRATE_Z_THRES__LEN 5 -#define BNO055_GYRO_HIGHRATE_Z_THRES__REG GYRO_HIGHRATE_Z_SET_ADDR +#define BNO055_GYRO_HIGHRATE_Z_THRES_POS (0) +#define BNO055_GYRO_HIGHRATE_Z_THRES_MSK (0X1F) +#define BNO055_GYRO_HIGHRATE_Z_THRES_LEN (5) +#define BNO055_GYRO_HIGHRATE_Z_THRES_REG BNO055_GYRO_HIGHRATE_Z_SET_ADDR -#define BNO055_GYRO_HIGHRATE_Z_HYST__POS 5 -#define BNO055_GYRO_HIGHRATE_Z_HYST__MSK 0X60 -#define BNO055_GYRO_HIGHRATE_Z_HYST__LEN 2 -#define BNO055_GYRO_HIGHRATE_Z_HYST__REG GYRO_HIGHRATE_Z_SET_ADDR +#define BNO055_GYRO_HIGHRATE_Z_HYST_POS (5) +#define BNO055_GYRO_HIGHRATE_Z_HYST_MSK (0X60) +#define BNO055_GYRO_HIGHRATE_Z_HYST_LEN (2) +#define BNO055_GYRO_HIGHRATE_Z_HYST_REG BNO055_GYRO_HIGHRATE_Z_SET_ADDR -#define BNO055_GYRO_HIGHRATE_Z_DURN__POS 0 -#define BNO055_GYRO_HIGHRATE_Z_DURN__MSK 0XFF -#define BNO055_GYRO_HIGHRATE_Z_DURN__LEN 8 -#define BNO055_GYRO_HIGHRATE_Z_DURN__REG GYRO_DURN_Z_ADDR +#define BNO055_GYRO_HIGHRATE_Z_DURN_POS (0) +#define BNO055_GYRO_HIGHRATE_Z_DURN_MSK (0XFF) +#define BNO055_GYRO_HIGHRATE_Z_DURN_LEN (8) +#define BNO055_GYRO_HIGHRATE_Z_DURN_REG (BNO055_GYRO_DURN_Z_ADDR) /*Gyro any motion threshold setting*/ -#define BNO055_GYRO_ANY_MOTION_THRES__POS 0 -#define BNO055_GYRO_ANY_MOTION_THRES__MSK 0X7F -#define BNO055_GYRO_ANY_MOTION_THRES__LEN 7 -#define BNO055_GYRO_ANY_MOTION_THRES__REG \ -GYRO_ANY_MOTION_THRES_ADDR +#define BNO055_GYRO_ANY_MOTION_THRES_POS (0) +#define BNO055_GYRO_ANY_MOTION_THRES_MSK (0X7F) +#define BNO055_GYRO_ANY_MOTION_THRES_LEN (7) +#define BNO055_GYRO_ANY_MOTION_THRES_REG \ +BNO055_GYRO_ANY_MOTION_THRES_ADDR /* Gyro any motion slope sample setting*/ -#define BNO055_GYRO_SLOPE_SAMPLES__POS 0 -#define BNO055_GYRO_SLOPE_SAMPLES__MSK 0X03 -#define BNO055_GYRO_SLOPE_SAMPLES__LEN 2 -#define BNO055_GYRO_SLOPE_SAMPLES__REG GYRO_ANY_MOTION_SET_ADDR +#define BNO055_GYRO_SLOPE_SAMPLES_POS (0) +#define BNO055_GYRO_SLOPE_SAMPLES_MSK (0X03) +#define BNO055_GYRO_SLOPE_SAMPLES_LEN (2) +#define BNO055_GYRO_SLOPE_SAMPLES_REG BNO055_GYRO_ANY_MOTION_SET_ADDR /* Gyro awake duration setting*/ -#define BNO055_GYRO_AWAKE_DURN__POS 2 -#define BNO055_GYRO_AWAKE_DURN__MSK 0X0C -#define BNO055_GYRO_AWAKE_DURN__LEN 2 -#define BNO055_GYRO_AWAKE_DURN__REG GYRO_ANY_MOTION_SET_ADDR +#define BNO055_GYRO_AWAKE_DURN_POS (2) +#define BNO055_GYRO_AWAKE_DURN_MSK (0X0C) +#define BNO055_GYRO_AWAKE_DURN_LEN (2) +#define BNO055_GYRO_AWAKE_DURN_REG BNO055_GYRO_ANY_MOTION_SET_ADDR /* PAGE1 DATA REGISTERS DEFINITION END*/ /*************************************************/ /**\name GET AND SET BITSLICE FUNCTIONS */ /*************************************************/ #define BNO055_GET_BITSLICE(regvar, bitname)\ -((regvar & bitname##__MSK) >> bitname##__POS) +((regvar & bitname##_MSK) >> bitname##_POS) #define BNO055_SET_BITSLICE(regvar, bitname, val)\ -((regvar & ~bitname##__MSK) | ((val< Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While changing the parameter of the bno055_t * consider the following point: @@ -2152,152 +2185,152 @@ BNO055_RETURN_FUNCTION_TYPE bno055_init(struct bno055_t *bno055); * This API gives data to the given register and * the data is written in the corresponding register address * - * @param v_addr_u8 : Address of the register - * @param p_data_u8 : Data to be written to the register - * @param v_len_u8 : Length of the Data + * @param addr_u8 : Address of the register + * @param data_u8 : Data to be written to the register + * @param len_u8 : Length of the Data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_write_register(u8 v_addr_u8, -u8 *p_data_u8, u8 v_len_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_write_register(u8 addr_u8, +u8 *data_u8, u8 len_u8); /*! * @brief This API reads the data from * the given register address * - * @param v_addr_u8 : Address of the register - * @param p_data_u8 : address of the variable, + * @param addr_u8 : Address of the register + * @param data_u8 : address of the variable, * read value will be kept - * @param v_len_u8 : Length of the data + * @param len_u8 : Length of the data * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_register(u8 v_addr_u8, -u8 *p_data_u8, u8 v_len_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_read_register(u8 addr_u8, +u8 *data_u8, u8 len_u8); /*! * @brief This API reads chip id * from register 0x00 it is a byte of data * * - * @param v_chip_id_u8 : The chip id value 0xA0 + * @param chip_id_u8 : The chip id value 0xA0 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_chip_id(u8 *v_chip_id_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_read_chip_id(u8 *chip_id_u8); /*! * @brief This API reads software revision id * from register 0x04 and 0x05 it is a two byte of data * - * @param v_sw_id_u8 : The SW revision id + * @param sw_id_u8 : The SW revision id * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_sw_rev_id(u16 *v_sw_id_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_read_sw_rev_id(u16 *sw_id_u8); /*! * @brief This API reads page id * from register 0x07 it is a byte of data * * - * @param v_page_id_u8 : The value of page id + * @param page_id_u8 : The value of page id * - * PAGE_ZERO -> 0x00 - * PAGE_ONE -> 0x01 + * BNO055_PAGE_ZERO -> 0x00 + * BNO055_PAGE_ONE -> 0x01 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_page_id(u8 *v_page_id_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_read_page_id(u8 *page_id_u8); /*! * @brief This API used to write * the page id register 0x07 * - * @param v_page_id_u8 : The value of page id + * @param page_id_u8 : The value of page id * - * PAGE_ZERO -> 0x00 - * PAGE_ONE -> 0x01 + * BNO055_PAGE_ZERO -> 0x00 + * BNO055_PAGE_ONE -> 0x01 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_write_page_id(u8 v_page_id_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_write_page_id(u8 page_id_u8); /*! * @brief This API reads accel revision id * from register 0x01 it is a byte of value * - * @param v_accel_rev_id_u8 : The accel revision id 0xFB + * @param accel_rev_id_u8 : The accel revision id 0xFB * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_rev_id( -u8 *v_accel_rev_id_u8); +u8 *accel_rev_id_u8); /*! * @brief This API reads mag revision id * from register 0x02 it is a byte of value * - * @param v_mag_rev_id_u8 : The mag revision id 0x32 + * @param mag_rev_id_u8 : The mag revision id 0x32 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_rev_id( -u8 *v_mag_rev_id_u8); +u8 *mag_rev_id_u8); /*! * @brief This API reads gyro revision id * from register 0x03 it is a byte of value * - * @param v_gyro_rev_id_u8 : The gyro revision id 0xF0 + * @param gyro_rev_id_u8 : The gyro revision id 0xF0 * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_rev_id( -u8 *v_gyro_rev_id_u8); +u8 *gyro_rev_id_u8); /*! * @brief This API used to read boot loader revision id * from register 0x06 it is a byte of value * - * @param v_bl_rev_id_u8 : The boot loader revision id + * @param bl_rev_id_u8 : The boot loader revision id * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_bl_rev_id( -u8 *v_bl_rev_id_u8); +u8 *bl_rev_id_u8); /**************************************************/ /**\name ACCEL DATA READ FUNCTIONS */ /**************************************************/ @@ -2308,17 +2341,17 @@ u8 *v_bl_rev_id_u8); * * * - * @param v_accel_x_s16 : The X raw data + * @param accel_x_s16 : The X raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_x(s16 *v_accel_x_s16); +BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_x(s16 *accel_x_s16); /*! * @brief This API reads acceleration data Y values * from register 0x0A and 0x0B it is a two byte data @@ -2326,17 +2359,17 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_x(s16 *v_accel_x_s16); * * * - * @param v_accel_y_s16 : The Y raw data + * @param accel_y_s16 : The Y raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_y(s16 *v_accel_y_s16); +BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_y(s16 *accel_y_s16); /*! * @brief This API reads acceleration data z values * from register 0x0C and 0x0D it is a two byte data @@ -2344,17 +2377,17 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_y(s16 *v_accel_y_s16); * * * - * @param v_accel_z_s16 : The z raw data + * @param accel_z_s16 : The z raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_z(s16 *v_accel_z_s16); +BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_z(s16 *accel_z_s16); /*! * @brief This API reads acceleration data xyz values * from register 0x08 to 0x0D it is a six byte data @@ -2371,8 +2404,8 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_z(s16 *v_accel_z_s16); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_xyz( @@ -2387,18 +2420,18 @@ struct bno055_accel_t *accel); * * * - * @param v_mag_x_s16 : The x raw data + * @param mag_x_s16 : The x raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_x(s16 *v_mag_x_s16); +BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_x(s16 *mag_x_s16); /*! * @brief This API reads mag data y values * from register 0x10 and 0x11 it is a two byte data @@ -2406,17 +2439,17 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_x(s16 *v_mag_x_s16); * * * - * @param v_mag_y_s16 : The y raw data + * @param mag_y_s16 : The y raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_y(s16 *v_mag_y_s16); +BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_y(s16 *mag_y_s16); /*! * @brief This API reads mag data z values * from register 0x12 and 0x13 it is a two byte data @@ -2424,18 +2457,18 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_y(s16 *v_mag_y_s16); * * * - * @param v_mag_z_s16 : The z raw data + * @param mag_z_s16 : The z raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_z(s16 *v_mag_z_s16); +BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_z(s16 *mag_z_s16); /*! * @brief This API reads mag data xyz values * from register 0x0E to 0x13 it is a six byte data @@ -2452,8 +2485,8 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_z(s16 *v_mag_z_s16); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_xyz(struct bno055_mag_t *mag); @@ -2467,17 +2500,17 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_mag_xyz(struct bno055_mag_t *mag); * * * - * @param v_gyro_x_s16 : The x raw data + * @param gyro_x_s16 : The x raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_x(s16 *v_gyro_x_s16); +BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_x(s16 *gyro_x_s16); /*! * @brief This API reads gyro data y values * from register 0x16 and 0x17 it is a two byte data @@ -2485,30 +2518,30 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_x(s16 *v_gyro_x_s16); * * * - * @param v_gyro_y_s16 : The y raw data + * @param gyro_y_s16 : The y raw data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_y(s16 *v_gyro_y_s16); +BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_y(s16 *gyro_y_s16); /*! * @brief This API reads gyro data z values * from register 0x18 and 0x19 it is a two byte data * - * @param v_gyro_z_s16 : The z raw data + * @param gyro_z_s16 : The z raw data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_z(s16 *v_gyro_z_s16); +BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_z(s16 *gyro_z_s16); /*! * @brief This API reads gyro data xyz values * from register 0x14 to 0x19 it is a six byte data @@ -2525,8 +2558,8 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_z(s16 *v_gyro_z_s16); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_xyz(struct bno055_gyro_t *gyro); @@ -2537,39 +2570,39 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_xyz(struct bno055_gyro_t *gyro); * @brief This API reads gyro data z values * from register 0x1A and 0x1B it is a two byte data * - * @param v_euler_h_s16 : The raw h data + * @param euler_h_s16 : The raw h data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_h(s16 *v_euler_h_s16); +BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_h(s16 *euler_h_s16); /*! * @brief This API reads Euler data r values * from register 0x1C and 0x1D it is a two byte data * - * @param v_euler_r_s16 : The raw r data + * @param euler_r_s16 : The raw r data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_r(s16 *v_euler_r_s16); +BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_r(s16 *euler_r_s16); /*! * @brief This API reads Euler data p values * from register 0x1E and 0x1F it is a two byte data * - * @param v_euler_p_s16 : The raw p data + * @param euler_p_s16 : The raw p data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_p(s16 *v_euler_p_s16); +BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_p(s16 *euler_p_s16); /*! * @brief This API reads Euler data hrp values * from register 0x1A to 0x1F it is a six byte data @@ -2585,8 +2618,8 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_p(s16 *v_euler_p_s16); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_euler_hrp( @@ -2598,58 +2631,58 @@ struct bno055_euler_t *euler); * @brief This API reads quaternion data w values * from register 0x20 and 0x21 it is a two byte data * - * @param v_quaternion_w_s16 : The raw w data + * @param quaternion_w_s16 : The raw w data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_quaternion_w( -s16 *v_quaternion_w_s16); +s16 *quaternion_w_s16); /*! * @brief This API reads quaternion data x values * from register 0x22 and 0x23 it is a two byte data * - * @param v_quaternion_x_s16 : The raw x data + * @param quaternion_x_s16 : The raw x data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_quaternion_x( -s16 *v_quaternion_x_s16); +s16 *quaternion_x_s16); /*! * @brief This API reads quaternion data y values * from register 0x24 and 0x25 it is a two byte data * - * @param v_quaternion_y_s16 : The raw y data + * @param quaternion_y_s16 : The raw y data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_quaternion_y( -s16 *v_quaternion_y_s16); +s16 *quaternion_y_s16); /*! * @brief This API reads quaternion data z values * from register 0x26 and 0x27 it is a two byte data * - * @param v_quaternion_z_s16 : The raw z data + * @param quaternion_z_s16 : The raw z data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_quaternion_z( -s16 *v_quaternion_z_s16); +s16 *quaternion_z_s16); /*! * @brief This API reads Quaternion data wxyz values * from register 0x20 to 0x27 it is a six byte data @@ -2667,8 +2700,8 @@ s16 *v_quaternion_z_s16); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_quaternion_wxyz( @@ -2680,44 +2713,44 @@ struct bno055_quaternion_t *quaternion); * @brief This API reads Linear accel data x values * from register 0x29 and 0x2A it is a two byte data * - * @param v_linear_accel_x_s16 : The raw x data + * @param linear_accel_x_s16 : The raw x data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_linear_accel_x( -s16 *v_linear_accel_x_s16); +s16 *linear_accel_x_s16); /*! * @brief This API reads Linear accel data x values * from register 0x2B and 0x2C it is a two byte data * - * @param v_linear_accel_y_s16 : The raw y data + * @param linear_accel_y_s16 : The raw y data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_linear_accel_y( -s16 *v_linear_accel_y_s16); +s16 *linear_accel_y_s16); /*! * @brief This API reads Linear accel data x values * from register 0x2C and 0x2D it is a two byte data * - * @param v_linear_accel_z_s16 : The raw z data + * @param linear_accel_z_s16 : The raw z data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_linear_accel_z( -s16 *v_linear_accel_z_s16); +s16 *linear_accel_z_s16); /*! * @brief This API reads Linear accel data xyz values * from register 0x28 to 0x2D it is a six byte data @@ -2733,8 +2766,8 @@ s16 *v_linear_accel_z_s16); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR */ BNO055_RETURN_FUNCTION_TYPE bno055_read_linear_accel_xyz( struct bno055_linear_accel_t *linear_accel); @@ -2745,44 +2778,44 @@ struct bno055_linear_accel_t *linear_accel); * @brief This API reads gravity data x values * from register 0x2E and 0x2F it is a two byte data * - * @param v_gravity_x_s16 : The raw x data + * @param gravity_x_s16 : The raw x data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gravity_x( -s16 *v_gravity_x_s16); +s16 *gravity_x_s16); /*! * @brief This API reads gravity data y values * from register 0x30 and 0x31 it is a two byte data * - * @param v_gravity_y_s16 : The raw y data + * @param gravity_y_s16 : The raw y data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gravity_y( -s16 *v_gravity_y_s16); +s16 *gravity_y_s16); /*! * @brief This API reads gravity data z values * from register 0x32 and 0x33 it is a two byte data * - * @param v_gravity_z_s16 : The raw z data + * @param gravity_z_s16 : The raw z data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gravity_z( -s16 *v_gravity_z_s16); +s16 *gravity_z_s16); /*! * @brief This API reads gravity data xyz values * from register 0x2E to 0x33 it is a six byte data @@ -2798,8 +2831,8 @@ s16 *v_gravity_z_s16); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gravity_xyz( @@ -2811,15 +2844,15 @@ struct bno055_gravity_t *gravity); * @brief This API reads temperature values * from register 0x33 it is a byte data * - * @param v_temp_s8 : The raw temperature data + * @param temp_s8 : The raw temperature data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_read_temp_data(s8 *v_temp_s8); +BNO055_RETURN_FUNCTION_TYPE bno055_read_temp_data(s8 *temp_s8); #ifdef BNO055_FLOAT_ENABLE /********************************************************************/ /**\name FUNCTIONS FOR READING ACCEL DATA OUTPUT AS FLOAT PRECISION */ @@ -2828,96 +2861,96 @@ BNO055_RETURN_FUNCTION_TYPE bno055_read_temp_data(s8 *v_temp_s8); * @brief This API is used to convert the accel x raw data * to meterpersecseq output as float * - * @param v_accel_x_f : The accel x meterpersecseq data + * @param accel_x_f : The accel x meterpersecseq data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_accel_x_msq( -float *v_accel_x_f); +float *accel_x_f); /*! * @brief This API is used to convert the accel x raw data * to meterpersecseq output as float * - * @param v_accel_y_f : The accel y meterpersecseq data + * @param accel_y_f : The accel y meterpersecseq data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_accel_y_msq( -float *v_accel_y_f); +float *accel_y_f); /*! * @brief This API is used to convert the accel z raw data * to meterpersecseq output as float * - * @param v_accel_z_f : The accel z meterpersecseq data + * @param accel_z_f : The accel z meterpersecseq data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_accel_z_msq( -float *v_accel_z_f); +float *accel_z_f); /*! * @brief This API is used to convert the accel y raw data * to millig output as float * - * @param v_accel_x_f : The accel y millig data + * @param accel_x_f : The accel y millig data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_accel_x_mg( -float *v_accel_x_f); +float *accel_x_f); /*! * @brief This API is used to convert the accel y raw data * to millig output as float * - * @param v_accel_y_f : The accel y millig data + * @param accel_y_f : The accel y millig data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_accel_y_mg( -float *v_accel_y_f); +float *accel_y_f); /*! * @brief This API is used to convert the accel z raw data * to millig output as float * - * @param v_accel_z_f : The accel z millig data + * @param accel_z_f : The accel z millig data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_accel_z_mg( -float *v_accel_z_f); +float *accel_z_f); /*! * @brief This API is used to convert the accel xyz raw data * to meterpersecseq output as float @@ -2931,8 +2964,8 @@ float *v_accel_z_f); * z | meterpersecseq data of accel * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -2952,8 +2985,8 @@ struct bno055_accel_float_t *accel_xyz); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -2966,48 +2999,48 @@ struct bno055_accel_float_t *accel_xyz); * @brief This API is used to convert the mag x raw data * to microTesla output as float * - * @param v_mag_x_f : The mag x microTesla data + * @param mag_x_f : The mag x microTesla data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_mag_x_uT( -float *v_mag_x_f); +float *mag_x_f); /*! * @brief This API is used to convert the mag y raw data * to microTesla output as float * - * @param v_mag_y_f : The mag y microTesla data + * @param mag_y_f : The mag y microTesla data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_mag_y_uT( -float *v_mag_y_f); +float *mag_y_f); /*! * @brief This API is used to convert the mag z raw data * to microTesla output as float * - * @param v_mag_z_f : The mag z microTesla data + * @param mag_z_f : The mag z microTesla data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_mag_z_uT( -float *v_mag_z_f); +float *mag_z_f); /*! * @brief This API is used to convert the mag yz raw data * to microTesla output as float @@ -3022,8 +3055,8 @@ float *v_mag_z_f); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_mag_xyz_uT( @@ -3035,92 +3068,92 @@ struct bno055_mag_float_t *mag_xyz_data); * @brief This API is used to convert the gyro x raw data * to dps output as float * - * @param v_gyro_x_f : The gyro x dps float data + * @param gyro_x_f : The gyro x dps float data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_gyro_x_dps( -float *v_gyro_x_f); +float *gyro_x_f); /*! * @brief This API is used to convert the gyro x raw data * to rps output as float * - * @param v_gyro_x_f : The gyro x dps float data + * @param gyro_x_f : The gyro x dps float data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_gyro_x_rps( -float *v_gyro_x_f); +float *gyro_x_f); /*! * @brief This API is used to convert the gyro y raw data * to dps output as float * - * @param v_gyro_y_f : The gyro y dps float data + * @param gyro_y_f : The gyro y dps float data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_gyro_y_dps( -float *v_gyro_y_f); +float *gyro_y_f); /*! * @brief This API is used to convert the gyro y raw data * to rps output as float * - * @param v_gyro_y_f : The gyro y dps float data + * @param gyro_y_f : The gyro y dps float data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_gyro_y_rps( -float *v_gyro_y_f); +float *gyro_y_f); /*! * @brief This API is used to convert the gyro z raw data * to dps output as float * - * @param v_gyro_z_f : The gyro z dps float data + * @param gyro_z_f : The gyro z dps float data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_gyro_z_dps( -float *v_gyro_z_f); +float *gyro_z_f); /*! * @brief This API is used to convert the gyro z raw data * to rps output as float * - * @param v_gyro_z_f : The gyro z rps float data + * @param gyro_z_f : The gyro z rps float data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_gyro_z_rps( -float *v_gyro_z_f); +float *gyro_z_f); /*! * @brief This API is used to convert the gyro xyz raw data * to dps output as float @@ -3135,8 +3168,8 @@ float *v_gyro_z_f); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -3156,8 +3189,8 @@ struct bno055_gyro_float_t *gyro_xyz_data); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -3170,83 +3203,83 @@ struct bno055_gyro_float_t *gyro_xyz_data); * @brief This API is used to convert the Euler h raw data * to degree output as float * - * @param v_euler_h_f : The float value of Euler h degree + * @param euler_h_f : The float value of Euler h degree * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_h_deg( -float *v_euler_h_f); +float *euler_h_f); /*! * @brief This API is used to convert the Euler h raw data * to radians output as float * - * @param v_euler_h_f : The float value of Euler h radians + * @param euler_h_f : The float value of Euler h radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_h_rad( -float *v_euler_h_f); +float *euler_h_f); /*! * @brief This API is used to convert the Euler r raw data * to degree output as float * - * @param v_euler_r_f : The float value of Euler r degree + * @param euler_r_f : The float value of Euler r degree * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_r_deg( -float *v_euler_r_f); +float *euler_r_f); /*! * @brief This API is used to convert the Euler r raw data * to radians output as float * - * @param v_euler_r_f : The float value of Euler r radians + * @param euler_r_f : The float value of Euler r radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_r_rad( -float *v_euler_r_f); +float *euler_r_f); /*! * @brief This API is used to convert the Euler p raw data * to degree output as float * - * @param v_euler_p_f : The float value of Euler p degree + * @param euler_p_f : The float value of Euler p degree * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_p_deg( -float *v_euler_p_f); +float *euler_p_f); /*! * @brief This API is used to convert the Euler p raw data * to radians output as float * - * @param v_euler_p_f : The float value of Euler p radians + * @param euler_p_f : The float value of Euler p radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_p_rad( -float *v_euler_p_f); +float *euler_p_f); /*! * @brief This API is used to convert the Euler hrp raw data * to degree output as float @@ -3261,8 +3294,8 @@ float *v_euler_p_f); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_hpr_deg( @@ -3281,8 +3314,8 @@ struct bno055_euler_float_t *euler_hpr); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_euler_hpr_rad( @@ -3294,39 +3327,39 @@ struct bno055_euler_float_t *euler_hpr); * @brief This API is used to convert the linear * accel x raw data to meterpersecseq output as float * - * @param v_linear_accel_x_f : The float value of linear accel x meterpersecseq + * @param linear_accel_x_f : The float value of linear accel x meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_linear_accel_x_msq( -float *v_linear_accel_x_f); +float *linear_accel_x_f); /*! * @brief This API is used to convert the linear * accel y raw data to meterpersecseq output as float * - * @param v_linear_accel_y_f : The float value of linear accel y meterpersecseq + * @param linear_accel_y_f : The float value of linear accel y meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_linear_accel_y_msq( -float *v_linear_accel_y_f); +float *linear_accel_y_f); /*! * @brief This API is used to convert the linear * accel z raw data to meterpersecseq output as float * - * @param v_linear_accel_z_f : The float value of linear accel z meterpersecseq + * @param linear_accel_z_f : The float value of linear accel z meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_linear_accel_z_msq( -float *v_linear_accel_z_f); +float *linear_accel_z_f); /*! * @brief This API is used to convert the linear accel xyz raw data * to meterpersecseq output as float @@ -3341,8 +3374,8 @@ float *v_linear_accel_z_f); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -3355,43 +3388,43 @@ struct bno055_linear_accel_float_t *linear_accel_xyz); * @brief This API is used to convert the gravity * x raw data to meterpersecseq output as float * - * @param v_gravity_x_f : The float value of gravity x meterpersecseq + * @param gravity_x_f : The float value of gravity x meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_gravity_float_x_msq( -float *v_gravity_x_f); +float *gravity_x_f); /*! * @brief This API is used to convert the gravity * y raw data to meterpersecseq output as float * - * @param v_gravity_y_f : The float value of gravity y meterpersecseq + * @param gravity_y_f : The float value of gravity y meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_gravity_float_y_msq( -float *v_gravity_y_f); +float *gravity_y_f); /*! * @brief This API is used to convert the gravity * z raw data to meterpersecseq output as float * - * @param v_gravity_z_f : The float value of gravity z meterpersecseq + * @param gravity_z_f : The float value of gravity z meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_gravity_float_z_msq( -float *gravity_z); +float *gravity_z_f); /*! * @brief This API is used to convert the gravity xyz raw data * to meterpersecseq output as float @@ -3406,8 +3439,8 @@ float *gravity_z); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -3420,31 +3453,31 @@ struct bno055_gravity_float_t *gravity_xyz); * @brief This API is used to convert the temperature * data to Fahrenheit output as float * - * @param v_temp_f : The float value of temperature Fahrenheit + * @param temp_f : The float value of temperature Fahrenheit * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_temp_fahrenheit( -float *v_temp_f); +float *temp_f); /*! * @brief This API is used to convert the temperature * data to Celsius output as float * - * @param v_temp_f : The float value of temperature Celsius + * @param temp_f : The float value of temperature Celsius * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_float_temp_celsius( -float *v_temp_f); +float *temp_f); #endif #ifdef BNO055_DOUBLE_ENABLE /**************************************************************************/ @@ -3454,97 +3487,97 @@ float *v_temp_f); * @brief This API is used to convert the accel x raw data * to meterpersecseq output as double * - * @param v_accel_x_d : The accel x meterpersecseq data + * @param accel_x_d : The accel x meterpersecseq data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_x_msq( -double *v_accel_x_d); +double *accel_x_d); /*! * @brief This API is used to convert the accel y raw data * to meterpersecseq output as double * - * @param v_accel_y_d : The accel y meterpersecseq data + * @param accel_y_d : The accel y meterpersecseq data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_y_msq( -double *v_accel_y_d); +double *accel_y_d); /*! * @brief This API is used to convert the accel z raw data * to meterpersecseq output as double * - * @param v_accel_z_d : The accel z meterpersecseq data + * @param accel_z_d : The accel z meterpersecseq data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_z_msq( -double *v_accel_z_d); +double *accel_z_d); /*! * @brief This API is used to convert the accel x raw data * to millig output as double * - * @param v_accel_x_d : The accel x millig data + * @param accel_x_d : The accel x millig data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_x_mg( -double *v_accel_x_d); +double *accel_x_d); /*! * @brief This API is used to convert the accel y raw data * to millig output as double * - * @param v_accel_y_d : The accel y millig data + * @param accel_y_d : The accel y millig data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_y_mg( -double *v_accel_y_d); +double *accel_y_d); /*! * @brief This API is used to convert the accel z raw data * to millig output as double * - * @param v_accel_z_d : The accel z millig data + * @param accel_z_d : The accel z millig data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_z_mg( -double *v_accel_z_d); +double *accel_z_d); /*! * @brief This API is used to convert the accel xyz raw data * to meterpersecseq output as double @@ -3559,8 +3592,8 @@ double *v_accel_z_d); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -3580,8 +3613,8 @@ struct bno055_accel_double_t *accel_xyz); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_accel_xyz_mg( @@ -3593,52 +3626,52 @@ struct bno055_accel_double_t *accel_xyz); * @brief This API is used to convert the mag x raw data * to microTesla output as double * - * @param v_mag_x_d : The mag x microTesla data + * @param mag_x_d : The mag x microTesla data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_mag_x_uT( -double *v_mag_x_d); +double *mag_x_d); /*! * @brief This API is used to convert the mag x raw data * to microTesla output as double * - * @param v_mag_y_d : The mag x microTesla data + * @param mag_y_d : The mag x microTesla data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_mag_y_uT( -double *v_mag_y_d); +double *mag_y_d); /*! * @brief This API is used to convert the mag z raw data * to microTesla output as double * - * @param v_mag_z_d : The mag z microTesla data + * @param mag_z_d : The mag z microTesla data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_mag_z_uT( -double *v_mag_z_d); +double *mag_z_d); /*! * @brief This API is used to convert the mag yz raw data * to microTesla output as double @@ -3653,8 +3686,8 @@ double *v_mag_z_d); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_mag_xyz_uT( @@ -3666,98 +3699,98 @@ struct bno055_mag_double_t *mag_xyz); * @brief This API is used to convert the gyro x raw data * to dps output as double * - * @param v_gyro_x_d : The gyro x dps double data + * @param gyro_x_d : The gyro x dps double data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_x_dps( -double *v_gyro_x_d); +double *gyro_x_d); /*! * @brief This API is used to convert the gyro y raw data * to dps output as double * - * @param v_gyro_y_d : The gyro y dps double data + * @param gyro_y_d : The gyro y dps double data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_y_dps( -double *v_gyro_y_d); +double *gyro_y_d); /*! * @brief This API is used to convert the gyro z raw data * to dps output as double * - * @param v_gyro_z_d : The gyro z dps double data + * @param gyro_z_d : The gyro z dps double data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_z_dps( -double *v_gyro_z_d); +double *gyro_z_d); /*! * @brief This API is used to convert the gyro x raw data * to rps output as double * - * @param v_gyro_x_d : The gyro x dps double data + * @param gyro_x_d : The gyro x dps double data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_x_rps( -double *v_gyro_x_d); +double *gyro_x_d); /*! * @brief This API is used to convert the gyro y raw data * to rps output as double * - * @param v_gyro_y_d : The gyro y dps double data + * @param gyro_y_d : The gyro y dps double data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_y_rps( -double *v_gyro_y_d); +double *gyro_y_d); /*! * @brief This API is used to convert the gyro z raw data * to rps output as double * - * @param v_gyro_z_d : The gyro z rps double data + * @param gyro_z_d : The gyro z rps double data * * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_z_rps( -double *v_gyro_z_d); +double *gyro_z_d); /*! * @brief This API is used to convert the gyro xyz raw data * to dps output as double @@ -3772,8 +3805,8 @@ double *v_gyro_z_d); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_xyz_dps( @@ -3792,8 +3825,8 @@ struct bno055_gyro_double_t *gyro_xyz); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gyro_xyz_rps( @@ -3805,87 +3838,87 @@ struct bno055_gyro_double_t *gyro_xyz); * @brief This API is used to convert the Euler h raw data * to degree output as double * - * @param v_euler_h_d : The double value of Euler h degree + * @param euler_h_d : The double value of Euler h degree * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_h_deg( -double *v_euler_h_d); +double *euler_h_d); /*! * @brief This API is used to convert the Euler p raw data * to degree output as double * - * @param v_euler_p_d : The double value of Euler p degree + * @param euler_p_d : The double value of Euler p degree * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_p_deg( -double *v_euler_p_d); +double *euler_p_d); /*! * @brief This API is used to convert the Euler r raw data * to degree output as double * - * @param v_euler_r_d : The double value of Euler r degree + * @param euler_r_d : The double value of Euler r degree * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_r_deg( -double *v_euler_r_d); +double *euler_r_d); /*! * @brief This API is used to convert the Euler h raw data * to radians output as double * - * @param v_euler_h_d : The double value of Euler h radians + * @param euler_h_d : The double value of Euler h radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_h_rad( -double *v_euler_h_d); +double *euler_h_d); /*! * @brief This API is used to convert the Euler p raw data * to radians output as double * - * @param v_euler_p_d : The double value of Euler p radians + * @param euler_p_d : The double value of Euler p radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_p_rad( -double *v_euler_p_d); +double *euler_p_d); /*! * @brief This API is used to convert the Euler r raw data * to radians output as double * - * @param v_euler_r_d : The double value of Euler r radians + * @param euler_r_d : The double value of Euler r radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_r_rad( -double *v_euler_r_d); +double *euler_r_d); /*! * @brief This API is used to convert the Euler hpr raw data * to degree output as double @@ -3900,8 +3933,8 @@ double *v_euler_r_d); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_hpr_deg( @@ -3920,8 +3953,8 @@ struct bno055_euler_double_t *euler_hpr); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_euler_hpr_rad( @@ -3933,48 +3966,48 @@ struct bno055_euler_double_t *euler_hpr); * @brief This API is used to convert the linear * accel x raw data to meterpersecseq output as double * - * @param v_linear_accel_x_d : The double value of + * @param linear_accel_x_d : The double value of * linear accel x meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_linear_accel_x_msq( -double *v_linear_accel_x_d); +double *linear_accel_x_d); /*! * @brief This API is used to convert the linear * accel y raw data to meterpersecseq output as double * - * @param v_linear_accel_y_d : The double value of + * @param linear_accel_y_d : The double value of * linear accel y meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_linear_accel_y_msq( -double *v_linear_accel_y_d); +double *linear_accel_y_d); /*! * @brief This API is used to convert the linear * accel z raw data to meterpersecseq output as double * - * @param v_linear_accel_z_d : The double value of + * @param linear_accel_z_d : The double value of * linear accel z meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_linear_accel_z_msq( -double *v_linear_accel_z_d); +double *linear_accel_z_d); /*! * @brief This API is used to convert the linear accel xyz raw data * to meterpersecseq output as double @@ -3989,8 +4022,8 @@ double *v_linear_accel_z_d); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ @@ -4003,44 +4036,44 @@ struct bno055_linear_accel_double_t *linear_accel_xyz); * @brief This API is used to convert the gravity * x raw data to meterpersecseq output as double * - * @param v_gravity_x_d : The double value of gravity x meterpersecseq + * @param gravity_x_d : The double value of gravity x meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_gravity_double_x_msq( -double *v_gravity_x_d); +double *gravity_x_d); /*! * @brief This API is used to convert the gravity * y raw data to meterpersecseq output as double * - * @param v_gravity_y_d : The double value of gravity y meterpersecseq + * @param gravity_y_d : The double value of gravity y meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_gravity_double_y_msq( -double *v_gravity_y_d); +double *gravity_y_d); /*! * @brief This API is used to convert the gravity * z raw data to meterpersecseq output as double * - * @param v_gravity_z_d : The double value of gravity z meterpersecseq + * @param gravity_z_d : The double value of gravity z meterpersecseq * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_gravity_double_z_msq( -double *v_gravity_z_d); +double *gravity_z_d); /*! * @brief This API is used to convert the gravity xyz raw data * to meterpersecseq output as double @@ -4055,8 +4088,8 @@ double *v_gravity_z_d); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_gravity_xyz_msq( @@ -4068,184 +4101,184 @@ struct bno055_gravity_double_t *gravity_xyz); * @brief This API is used to convert the temperature * data to Fahrenheit output as double * - * @param v_temp_d : The double value of temperature Fahrenheit + * @param temp_d : The double value of temperature Fahrenheit * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_temp_fahrenheit( -double *v_temp_d); +double *temp_d); /*! * @brief This API is used to convert the temperature * data to Celsius output as double * - * @param v_temp_d : The double value of temperature Celsius + * @param temp_d : The double value of temperature Celsius * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_convert_double_temp_celsius( -double *v_temp_d); +double *temp_d); #endif /**************************************************************************/ -/**\name FUNCTIONS FOR READING ACCEL,MAG,GYRO AND SYTEM CALIBRATION STATUS*/ +/**\name FUNCTIONS FOR READING ACCEL,MAG,GYRO AND SYSTEM CALIBRATION STATUS*/ /*************************************************************************/ /*! * @brief This API used to read * mag calibration status from register from 0x35 bit 0 and 1 * - * @param v_mag_calib_u8 : The value of mag calib status + * @param mag_calib_u8 : The value of mag calib status * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_mag_calib_stat( -u8 *v_mag_calib_u8); +u8 *mag_calib_u8); /*! * @brief This API used to read * accel calibration status from register from 0x35 bit 2 and 3 * - * @param v_accel_calib_u8 : The value of accel calib status + * @param accel_calib_u8 : The value of accel calib status * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_calib_stat( -u8 *v_accel_calib_u8); +u8 *accel_calib_u8); /*! * @brief This API used to read * gyro calibration status from register from 0x35 bit 4 and 5 * - * @param v_gyro_calib_u8 : The value of gyro calib status + * @param gyro_calib_u8 : The value of gyro calib status * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_calib_stat( -u8 *v_gyro_calib_u8); +u8 *gyro_calib_u8); /*! * @brief This API used to read * system calibration status from register from 0x35 bit 6 and 7 * - * @param v_sys_calib_u8 : The value of system calib status + * @param sys_calib_u8 : The value of system calib status * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_sys_calib_stat( -u8 *v_sys_calib_u8); +u8 *sys_calib_u8); /******************************************************************/ -/**\name FUNCTIONS FOR READING ACCEL,MAG,GYRO AND SYTEM SELF TEST */ +/**\name FUNCTIONS FOR READING ACCEL,MAG,GYRO AND SYSTEM SELF TEST */ /******************************************************************/ /*! * @brief This API used to read * self test of accel from register from 0x36 bit 0 * - * @param v_selftest_accel_u8 : The value of self test of accel + * @param selftest_accel_u8 : The value of self test of accel * - * v_selftest_accel_u8 | result + * selftest_accel_u8 | result * -------------------- | --------------------- * 0x00 | indicates test failed * 0x01 | indicated test passed * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_selftest_accel( -u8 *v_selftest_accel_u8); +u8 *selftest_accel_u8); /*! * @brief This API used to read * self test of mag from register from 0x36 bit 1 * - * @param v_selftest_mag_u8 : The value of self test of mag + * @param selftest_mag_u8 : The value of self test of mag * - * v_selftest_mag_u8 | result + * selftest_mag_u8 | result * -------------------- | --------------------- * 0x00 | indicates test failed * 0x01 | indicated test passed * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_selftest_mag( -u8 *v_selftest_mag_u8); +u8 *selftest_mag_u8); /*! * @brief This API used to read * self test of gyro from register from 0x36 bit 2 * - * @param v_selftest_gyro_u8 : The value of self test of gyro + * @param selftest_gyro_u8 : The value of self test of gyro * - * v_selftest_gyro_u8 | result + * selftest_gyro_u8 | result * -------------------- | --------------------- * 0x00 | indicates test failed * 0x01 | indicated test passed * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_selftest_gyro( -u8 *v_selftest_gyro_u8); +u8 *selftest_gyro_u8); /*! * @brief This API used to read * self test of micro controller from register from 0x36 bit 3 * - * @param v_selftest_mcu_u8 : The value of self test of micro controller + * @param selftest_mcu_u8 : The value of self test of micro controller * - * v_selftest_mcu_u8 | result + * selftest_mcu_u8 | result * -------------------- | --------------------- * 0x00 | indicates test failed * 0x01 | indicated test passed * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_selftest_mcu( -u8 *v_selftest_mcu_u8); +u8 *selftest_mcu_u8); /*****************************************************/ /**\name FUNCTIONS FOR READING GYRO INTERRUPT STATUS */ /*****************************************************/ /*! - * @brief This API used to read the v_stat_s8 of + * @brief This API used to read the stat_s8 of * gyro anymotion interrupt from register from 0x37 bit 2 * - * @param v_gyro_any_motion_u8 : The value of gyro anymotion interrupt + * @param gyro_any_motion_u8 : The value of gyro anymotion interrupt * - * v_gyro_any_motion_u8 | result + * gyro_any_motion_u8 | result * -------------------- | --------------------- * 0x00 | indicates no interrupt triggered * 0x01 | indicates interrupt triggered * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * - * @note Gyro anymotion interrupt can be enabled + * @note Gyro anymotion interrupt can be BNO055_BIT_ENABLE * by the following APIs * * bno055_set_intr_mask_gyro_any_motion() @@ -4254,21 +4287,21 @@ u8 *v_selftest_mcu_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_stat_gyro_any_motion( -u8 *v_gyro_any_motion_u8); +u8 *gyro_any_motion_u8); /*! - * @brief This API used to read the v_stat_s8 of + * @brief This API used to read the stat_s8 of * gyro highrate interrupt from register from 0x37 bit 3 * - * @param v_gyro_highrate_u8 : The value of gyro highrate interrupt + * @param gyro_highrate_u8 : The value of gyro highrate interrupt * - * v_gyro_highrate_u8 | result - * ------------------- | --------------------- - * 0x00 | indicates no interrupt triggered - * 0x01 | indicates interrupt triggered + * gyro_highrate_u8 | result + * ------------------- | --------------------- + * 0x00 | indicates no interrupt triggered + * 0x01 | indicates interrupt triggered * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate interrupt can be configured * by the following APIs @@ -4278,7 +4311,7 @@ u8 *v_gyro_any_motion_u8); * bno055_set_intr_gyro_highrate() */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_stat_gyro_highrate( -u8 *v_gyro_highrate_u8); +u8 *gyro_highrate_u8); /*****************************************************/ /**\name FUNCTIONS FOR READING ACCEL INTERRUPT STATUS */ /*****************************************************/ @@ -4286,16 +4319,16 @@ u8 *v_gyro_highrate_u8); * @brief This API used to read the status of * accel highg interrupt from register from 0x37 bit 5 * - * @param v_accel_high_g_u8 : The value of accel highg interrupt + * @param accel_high_g_u8 : The value of accel highg interrupt * - * v_accel_high_g_u8 | result + * accel_high_g_u8 | result * ------------------- | --------------------- * 0x00 | indicates no interrupt triggered * 0x01 | indicates interrupt triggered * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel highg interrupt can be configured * by the following APIs @@ -4306,21 +4339,21 @@ u8 *v_gyro_highrate_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_stat_accel_high_g( -u8 *v_accel_high_g_u8); +u8 *accel_high_g_u8); /*! - * @brief This API used to read the v_stat_s8 of + * @brief This API used to read the stat_s8 of * accel anymotion interrupt from register from 0x37 bit 6 * - * @param v_accel_any_motion_u8 : The value of accel anymotion interrupt + * @param accel_any_motion_u8 : The value of accel anymotion interrupt * - * v_accel_any_motion_u8 | result + * accel_any_motion_u8 | result * ------------------- | --------------------- * 0x00 | indicates no interrupt triggered * 0x01 | indicates interrupt triggered * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel anymotion interrupt can be configured * by the following APIs @@ -4330,22 +4363,22 @@ u8 *v_accel_high_g_u8); * bno055_set_intr_accel_any_motion() */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_stat_accel_any_motion( -u8 *v_accel_any_motion_u8); +u8 *accel_any_motion_u8); /*! - * @brief This API used to read the v_stat_s8 of + * @brief This API used to read the stat_s8 of * accel nomotion/slowmotion interrupt from register from 0x37 bit 6 * - * @param v_accel_no_motion_u8 : + * @param accel_no_motion_u8 : * The value of accel nomotion/slowmotion interrupt * - * v_accel_no_motion_u8 | result + * accel_no_motion_u8 | result * ------------------- | --------------------- * 0x00 | indicates no interrupt triggered * 0x01 | indicates interrupt triggered * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel nomotion/slowmotion interrupt can be configured * by the following APIs @@ -4355,53 +4388,53 @@ u8 *v_accel_any_motion_u8); * bno055_set_intr_accel_nomotion() */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_stat_accel_no_motion( -u8 *v_accel_no_motion_u8); +u8 *accel_no_motion_u8); /**************************************************************************/ -/**\name FUNCTIONS FOR READING SYSTEM CLOCK, STATUS AND ERROR CODE */ +/**\name FUNCTIONS FOR READING SYSTEM CLOCK, STATUS AND BNO055_ERROR CODE */ /*************************************************************************/ /*! * @brief This API is used to read status of main clock * from the register 0x38 bit 0 * - * @param v_stat_main_clk_u8 : the status of main clock + * @param stat_main_clk_u8 : the status of main clock * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_stat_main_clk( -u8 *v_stat_main_clk_u8); +u8 *stat_main_clk_u8); /*! * @brief This API is used to read system status * code from the register 0x39 it is a byte of data * - * @param v_sys_stat_u8 : the status of system + * @param sys_stat_u8 : the status of system * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_sys_stat_code( -u8 *v_sys_stat_u8); +u8 *sys_stat_u8); /*! - * @brief This API is used to read system error + * @brief This API is used to read system BNO055_ERROR * code from the register 0x3A it is a byte of data * - * @param v_sys_error_u8 : The value of system error code + * @param sys_error_u8 : The value of system BNO055_ERROR code * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_sys_error_code( -u8 *v_sys_error_u8); +u8 *sys_error_u8); /********************************************/ /**\name FUNCTIONS FOR ACCEL UNIT SELECTION */ /********************************************/ @@ -4409,39 +4442,39 @@ u8 *v_sys_error_u8); * @brief This API used to read the accel unit * from register from 0x3B bit 0 * - * @param v_accel_unit_u8 : The value of accel unit + * @param accel_unit_u8 : The value of accel unit * - * v_accel_unit_u8 | result + * accel_unit_u8 | result * ------------- | --------------- - * 0x00 | ACCEL_UNIT_MSQ - * 0x01 | ACCEL_UNIT_MG + * 0x00 | BNO055_ACCEL_UNIT_MSQ + * 0x01 | BNO055_ACCEL_UNIT_MG * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_unit( -u8 *v_accel_unit_u8); +u8 *accel_unit_u8); /*! * @brief This API used to write the accel unit * from register from 0x3B bit 0 * - * @param v_accel_unit_u8 : The value of accel unit + * @param accel_unit_u8 : The value of accel unit * - * v_accel_unit_u8 | result + * accel_unit_u8 | result * ------------- | --------------- - * 0x00 | ACCEL_UNIT_MSQ - * 0x01 | ACCEL_UNIT_MG + * 0x00 | BNO055_ACCEL_UNIT_MSQ + * 0x01 | BNO055_ACCEL_UNIT_MG * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_unit( -u8 v_accel_unit_u8); +u8 accel_unit_u8); /********************************************/ /**\name FUNCTIONS FOR GYRO UNIT SELECTION */ /********************************************/ @@ -4449,39 +4482,39 @@ u8 v_accel_unit_u8); * @brief This API used to read the gyro unit * from register from 0x3B bit 1 * - * @param v_gyro_unit_u8 : The value of accel unit + * @param gyro_unit_u8 : The value of accel unit * - * v_gyro_unit_u8 | result + * gyro_unit_u8 | result * ------------- | ----------- - * 0x00 | GYRO_UNIT_DPS - * 0x01 | GYRO_UNIT_RPS + * 0x00 | BNO055_GYRO_UNIT_DPS + * 0x01 | BNO055_GYRO_UNIT_RPS * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_unit( -u8 *v_gyro_unit_u8); +u8 *gyro_unit_u8); /*! * @brief This API used to write the gyro unit * from register from 0x3B bit 1 * - * @param v_gyro_unit_u8 : The value of accel unit + * @param gyro_unit_u8 : The value of accel unit * - * v_gyro_unit_u8 | result + * gyro_unit_u8 | result * ------------- | ----------- - * 0x00 | GYRO_UNIT_DPS - * 0x01 | GYRO_UNIT_RPS + * 0x00 | BNO055_GYRO_UNIT_DPS + * 0x01 | BNO055_GYRO_UNIT_RPS * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_unit(u8 v_gyro_unit_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_unit(u8 gyro_unit_u8); /********************************************/ /**\name FUNCTIONS FOR EULER UNIT SELECTION */ /********************************************/ @@ -4489,39 +4522,39 @@ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_unit(u8 v_gyro_unit_u8); * @brief This API used to read the Euler unit * from register from 0x3B bit 2 * - * @param v_euler_unit_u8 : The value of accel unit + * @param euler_unit_u8 : The value of accel unit * - * v_euler_unit_u8 | result + * euler_unit_u8 | result * -------------- | ----------- - * 0x00 | EULER_UNIT_DEG - * 0x01 | EULER_UNIT_RAD + * 0x00 | BNO055_EULER_UNIT_DEG + * 0x01 | BNO055_EULER_UNIT_RAD * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_euler_unit( -u8 *v_euler_unit_u8); +u8 *euler_unit_u8); /*! * @brief This API used to write the Euler unit * from register from 0x3B bit 2 * - * @param v_euler_unit_u8 : The value of Euler unit + * @param euler_unit_u8 : The value of Euler unit * - * v_euler_unit_u8 | result + * euler_unit_u8 | result * -------------- | ----------- - * 0x00 | EULER_UNIT_DEG - * 0x01 | EULER_UNIT_RAD + * 0x00 | BNO055_EULER_UNIT_DEG + * 0x01 | BNO055_EULER_UNIT_RAD * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_euler_unit(u8 v_euler_unit_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_set_euler_unit(u8 euler_unit_u8); /********************************************/ /**\name FUNCTIONS FOR TILT UNIT SELECTION */ /********************************************/ @@ -4529,35 +4562,35 @@ BNO055_RETURN_FUNCTION_TYPE bno055_set_euler_unit(u8 v_euler_unit_u8); * @brief This API used to write the tilt unit * from register from 0x3B bit 3 * - * @param v_tilt_unit_u8 : The value of tilt unit + * @param tilt_unit_u8 : The value of tilt unit * - * v_tilt_unit_u8 | result + * tilt_unit_u8 | result * --------------- | --------- * 0x00 | degrees * 0x01 | radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_tilt_unit( -u8 *v_tilt_unit_u8); +u8 *tilt_unit_u8); /*! * @brief This API used to write the tilt unit * from register from 0x3B bit 3 * - * @param v_tilt_unit_u8 : The value of tilt unit + * @param tilt_unit_u8 : The value of tilt unit * - * v_tilt_unit_u8 | result + * tilt_unit_u8 | result * --------------- | --------- * 0x00 | degrees * 0x01 | radians * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * * @@ -4566,7 +4599,7 @@ u8 *v_tilt_unit_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_tilt_unit( -u8 v_tilt_unit_u8); +u8 tilt_unit_u8); /**************************************************/ /**\name FUNCTIONS FOR TEMPERATURE UNIT SELECTION */ /**************************************************/ @@ -4574,39 +4607,39 @@ u8 v_tilt_unit_u8); * @brief This API used to read the temperature unit * from register from 0x3B bit 4 * - * @param v_temp_unit_u8 : The value of temperature unit + * @param temp_unit_u8 : The value of temperature unit * - * v_temp_unit_u8 | result + * temp_unit_u8 | result * ----------- | -------------- - * 0x00 | TEMP_UNIT_CELCIUS - * 0x01 | TEMP_UNIT_FAHRENHEIT + * 0x00 | BNO055_TEMP_UNIT_CELSIUS + * 0x01 | BNO055_TEMP_UNIT_FAHRENHEIT * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_temp_unit( -u8 *v_temp_unit_u8); +u8 *temp_unit_u8); /*! * @brief This API used to write the temperature unit * from register from 0x3B bit 4 * - * @param v_temp_unit_u8 : The value of temperature unit + * @param temp_unit_u8 : The value of temperature unit * - * v_temp_unit_u8 | result + * temp_unit_u8 | result * ----------- | -------------- - * 0x00 | TEMP_UNIT_CELCIUS - * 0x01 | TEMP_UNIT_FAHRENHEIT + * 0x00 | BNO055_TEMP_UNIT_CELSIUS + * 0x01 | BNO055_TEMP_UNIT_FAHRENHEIT * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_temp_unit( -u8 v_temp_unit_u8); +u8 temp_unit_u8); /**************************************************/ /**\name FUNCTIONS FOR DATA OUTPUT FORMAT SELECT */ /**************************************************/ @@ -4614,73 +4647,73 @@ u8 v_temp_unit_u8); * @brief This API used to read the current selected orientation mode * from register from 0x3B bit 7 * - * @param v_data_output_format_u8 : The value of data output format + * @param data_output_format_u8 : The value of data output format * - * v_data_output_format_u8 | result + * data_output_format_u8 | result * -------------------- | -------- * 0x00 | Windows * 0x01 | Android * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_data_output_format( -u8 *v_data_output_format_u8); +u8 *data_output_format_u8); /*! * @brief This API used to read the current selected orientation mode * from register from 0x3B bit 7 * - * @param v_data_output_format_u8 : The value of data output format + * @param data_output_format_u8 : The value of data output format * - * v_data_output_format_u8 | result + * data_output_format_u8 | result * -------------------- | -------- * 0x00 | Windows * 0x01 | Android * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_data_output_format( -u8 v_data_output_format_u8); +u8 data_output_format_u8); /**************************************************/ /**\name FUNCTIONS FOR DATA OPERATION MODE */ /**************************************************/ /*! @brief This API used to read the operation mode * from register from 0x3D bit 0 to 3 * - * @param v_operation_mode_u8 : The value of operation mode + * @param operation_mode_u8 : The value of operation mode * - * v_operation_mode_u8 | result | comments + * operation_mode_u8 | result | comments * ----------|----------------------------|---------------------------- - * 0x00 | OPERATION_MODE_CONFIG | Configuration mode - * 0x01 | OPERATION_MODE_ACCONLY | Reads accel data alone - * 0x02 | OPERATION_MODE_MAGONLY | Reads mag data alone - * 0x03 | OPERATION_MODE_GYRONLY | Reads gyro data alone - * 0x04 | OPERATION_MODE_ACCMAG | Reads accel and mag data - * 0x05 | OPERATION_MODE_ACCGYRO | Reads accel and gyro data - * 0x06 | OPERATION_MODE_MAGGYRO | Reads accel and mag data + * 0x00 | BNO055_OPERATION_MODE_CONFIG | Configuration mode + * 0x01 | BNO055_OPERATION_MODE_ACCONLY | Reads accel data alone + * 0x02 | BNO055_OPERATION_MODE_MAGONLY | Reads mag data alone + * 0x03 | BNO055_OPERATION_MODE_GYRONLY | Reads gyro data alone + * 0x04 | BNO055_OPERATION_MODE_ACCMAG | Reads accel and mag data + * 0x05 | BNO055_OPERATION_MODE_ACCGYRO | Reads accel and gyro data + * 0x06 | BNO055_OPERATION_MODE_MAGGYRO | Reads accel and mag data * 0x07 | OPERATION_MODE_ANY_MOTION | Reads accel mag and gyro data - * 0x08 | OPERATION_MODE_IMUPLUS | Inertial measurement unit + * 0x08 | BNO055_OPERATION_MODE_IMUPLUS | Inertial measurement unit * - | - | Reads accel,gyro and fusion data - * 0x09 | OPERATION_MODE_COMPASS | Reads accel, mag data + * 0x09 | BNO055_OPERATION_MODE_COMPASS | Reads accel, mag data * - | - | and fusion data - * 0x0A | OPERATION_MODE_M4G | Reads accel, mag data + * 0x0A | BNO055_OPERATION_MODE_M4G | Reads accel, mag data * - | - | and fusion data - * 0x0B | OPERATION_MODE_NDOF_FMC_OFF| Nine degrees of freedom with + * 0x0B | BNO055_OPERATION_MODE_NDOF_FMC_OFF| Nine degrees of freedom with * - | - | fast magnetic calibration * - | - | Reads accel,mag, gyro * - | - | and fusion data - * 0x0C | OPERATION_MODE_NDOF | Nine degrees of freedom + * 0x0C | BNO055_OPERATION_MODE_NDOF | Nine degrees of freedom * - | - | Reads accel,mag, gyro * - | - | and fusion data * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note In the config mode, all sensor and fusion data * becomes zero and it is mainly derived @@ -4688,102 +4721,107 @@ u8 v_data_output_format_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_operation_mode( -u8 *v_operation_mode_u8); +u8 *operation_mode_u8); /*! @brief This API used to write the operation mode * from register from 0x3D bit 0 to 3 * - * @param v_operation_mode_u8 : The value of operation mode - * - * v_operation_mode_u8 | result | comments - * ----------|----------------------------|---------------------------- - * 0x00 | OPERATION_MODE_CONFIG | Configuration mode - * 0x01 | OPERATION_MODE_ACCONLY | Reads accel data alone - * 0x02 | OPERATION_MODE_MAGONLY | Reads mag data alone - * 0x03 | OPERATION_MODE_GYRONLY | Reads gyro data alone - * 0x04 | OPERATION_MODE_ACCMAG | Reads accel and mag data - * 0x05 | OPERATION_MODE_ACCGYRO | Reads accel and gyro data - * 0x06 | OPERATION_MODE_MAGGYRO | Reads accel and mag data - * 0x07 | OPERATION_MODE_ANY_MOTION | Reads accel mag and gyro data - * 0x08 | OPERATION_MODE_IMUPLUS | Inertial measurement unit - * - | - | Reads accel,gyro and fusion data - * 0x09 | OPERATION_MODE_COMPASS | Reads accel, mag data - * - | - | and fusion data - * 0x0A | OPERATION_MODE_M4G | Reads accel, mag data - * - | - | and fusion data - * 0x0B | OPERATION_MODE_NDOF_FMC_OFF| Nine degrees of freedom with - * - | - | fast magnetic calibration - * - | - | Reads accel,mag, gyro - * - | - | and fusion data - * 0x0C | OPERATION_MODE_NDOF | Nine degrees of freedom - * - | - | Reads accel,mag, gyro - * - | - | and fusion data - * - * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @param operation_mode_u8 : The value of operation mode + * + * operation_mode_u8 | result | comments + * ---------|-----------------------------------|-------------------------- + * 0x00 | BNO055_OPERATION_MODE_CONFIG | Configuration mode + * 0x01 | BNO055_OPERATION_MODE_ACCONLY | Reads accel data alone + * 0x02 | BNO055_OPERATION_MODE_MAGONLY | Reads mag data alone + * 0x03 | BNO055_OPERATION_MODE_GYRONLY | Reads gyro data alone + * 0x04 | BNO055_OPERATION_MODE_ACCMAG | Reads accel and mag data + * 0x05 | BNO055_OPERATION_MODE_ACCGYRO | Reads accel and gyro data + * 0x06 | BNO055_OPERATION_MODE_MAGGYRO | Reads accel and mag data + * 0x07 | OPERATION_MODE_ANY_MOTION | Reads accel mag and + * | - | gyro data + * 0x08 | BNO055_OPERATION_MODE_IMUPLUS | Inertial measurement unit + * - | | Reads accel,gyro and + * | - | fusion data + * 0x09 | BNO055_OPERATION_MODE_COMPASS | Reads accel, mag data + * - | - | and fusion data + * 0x0A | BNO055_OPERATION_MODE_M4G | Reads accel, mag data + * - | - | and fusion data + * 0x0B | BNO055_OPERATION_MODE_NDOF_FMC_OFF| Nine degrees of freedom with + * - | - | fast magnetic calibration + * - | - | Reads accel,mag, gyro + * - | - | and fusion data + * 0x0C | BNO055_OPERATION_MODE_NDOF | Nine degrees of freedom + * - | - | Reads accel,mag, gyro + * - | - | and fusion data + * + * @return results of bus communication function + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note In the config mode, all sensor and fusion data * becomes zero and it is mainly derived * to configure the various settings of the BNO * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_operation_mode(u8 v_operation_mode_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_set_operation_mode(u8 operation_mode_u8); /**************************************************/ /**\name FUNCTIONS FOR POWER MODE */ /**************************************************/ /*! @brief This API used to read the power mode * from register from 0x3E bit 0 to 1 * - * @param v_power_mode_u8 : The value of power mode + * @param power_mode_u8 : The value of power mode * - * v_power_mode_u8| result | comments - * ----------|---------------------|------------------------------------- - * 0x00 | POWER_MODE_NORMAL | In the NORMAL mode the register - * - | - | map and the internal peripherals - * - | - | of the MCU are always - * - | - | operative in this mode - * 0x01 | POWER_MODE_LOWPOWER | This is first level of power saving mode - * 0x02 | POWER_MODE_SUSPEND | In suspend mode the system is - * - | - | paused and all the sensors and - * - | - | the micro controller are - * - | - | put into sleep mode. + * power_mode_u8| result | comments + * ---------|---------------------------|------------------------------------- + * 0x00 |BNO055_POWER_MODE_NORMAL | In the NORMAL mode the register + * - | - | map and the internal peripherals + * - | - | of the MCU are always + * - | - | operative in this mode + * 0x01 |BNO055_POWER_MODE_LOWPOWER | This is first level of power + * | - | saving mode + * 0x02 |BNO055_POWER_MODE_SUSPEND | In suspend mode the system is + * - | - | paused and all the sensors and + * - | - | the micro controller are + * - | - | put into sleep mode. * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note For detailed about LOWPOWER mode * refer data sheet 3.4.2 * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_power_mode( -u8 *v_power_mode_u8); +u8 *power_mode_u8); /*! @brief This API used to write the power mode * from register from 0x3E bit 0 to 1 * - * @param v_power_mode_u8 : The value of power mode + * @param power_mode_u8 : The value of power mode * - * v_power_mode_u8 | result | comments - * ----------|---------------------|------------------------------------- - * 0x00 | POWER_MODE_NORMAL | In the NORMAL mode the register - * - | - | map and the internal peripherals - * - | - | of the MCU are always - * - | - | operative in this mode - * 0x01 | POWER_MODE_LOWPOWER | This is first level of power saving mode - * 0x02 | POWER_MODE_SUSPEND | In suspend mode the system is - * - | - | paused and all the sensors and - * - | - | the micro controller are - * - | - | put into sleep mode. + * + * power_mode_u8| result | comments + * -------|----------------------------|--------------------------------- + * 0x00 | BNO055_POWER_MODE_NORMAL | In the NORMAL mode the register + * - | - | map and the internal peripherals + * - | - | of the MCU are always + * - | - | operative in this mode + * 0x01 | BNO055_POWER_MODE_LOWPOWER | This is first level of power + * | - | saving mode + * 0x02 | BNO055_POWER_MODE_SUSPEND | In suspend mode the system is + * - | - | paused and all the sensors and + * - | - | the micro controller are + * - | - | put into sleep mode. * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note For detailed about LOWPOWER mode * refer data sheet 3.4.2 * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_power_mode(u8 v_power_mode_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_set_power_mode(u8 power_mode_u8); /**************************************************/ /**\name FUNCTIONS FOR RESET INTERRUPT */ /**************************************************/ @@ -4792,38 +4830,38 @@ BNO055_RETURN_FUNCTION_TYPE bno055_set_power_mode(u8 v_power_mode_u8); * from register from 0x3F bit 6 * It resets all the interrupt bit and interrupt output * - * @param v_intr_rst_u8 : The value of reset interrupt + * @param intr_rst_u8 : The value of reset interrupt * - * v_intr_rst_u8 | result - * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * intr_rst_u8 | result + * -------------|---------- + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_rst( -u8 *v_intr_rst_u8); +u8 *intr_rst_u8); /*! * @brief This API used to write the reset interrupt - * from register from 0x3F bit 6 + * from register from 0x3F bit 6 * It resets all the interrupt bit and interrupt output * - * @param v_intr_rst_u8 : The value of reset interrupt + * @param intr_rst_u8 : The value of reset interrupt * - * v_intr_rst_u8 | result + * intr_rst_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_rst(u8 v_intr_rst_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_rst(u8 intr_rst_u8); /**************************************************/ /**\name FUNCTIONS FOR CLOCK SOURCE */ /**************************************************/ @@ -4831,37 +4869,37 @@ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_rst(u8 v_intr_rst_u8); * @brief This API used to read the clk source * from register from 0x3F bit 7 * - * @param v_clk_src_u8 : The value of clk source + * @param clk_src_u8 : The value of clk source * - * v_clk_src_u8 | result - * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * clk_src_u8 | result + * -------------|---------- + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_clk_src( -u8 *v_clk_src_u8); +u8 *clk_src_u8); /*! * @brief This API used to write the clk source * from register from 0x3F bit 7 * - * @param v_clk_src_u8 : The value of clk source + * @param clk_src_u8 : The value of clk source * - * v_clk_src_u8 | result + * clk_src_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_clk_src(u8 v_clk_src_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_set_clk_src(u8 clk_src_u8); /**************************************************/ /**\name FUNCTIONS FOR RESET SYSTEM */ /**************************************************/ @@ -4869,39 +4907,39 @@ BNO055_RETURN_FUNCTION_TYPE bno055_set_clk_src(u8 v_clk_src_u8); * @brief This API used to read the reset system * from register from 0x3F bit 5 * - * @param v_sys_rst_u8 : The value of reset system + * @param sys_rst_u8 : The value of reset system * - * v_sys_rst_u8 | result + * sys_rst_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note It resets the whole system */ BNO055_RETURN_FUNCTION_TYPE bno055_get_sys_rst( -u8 *v_sys_rst_u8); +u8 *sys_rst_u8); /*! * @brief This API used to write the reset system * from register from 0x3F bit 5 * - * @param v_sys_rst_u8 : The value of reset system + * @param sys_rst_u8 : The value of reset system * - * v_sys_rst_u8 | result + * sys_rst_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note It resets the whole system */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_sys_rst(u8 v_sys_rst_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_set_sys_rst(u8 sys_rst_u8); /**************************************************/ /**\name FUNCTIONS FOR SELF TEST */ /**************************************************/ @@ -4909,41 +4947,41 @@ BNO055_RETURN_FUNCTION_TYPE bno055_set_sys_rst(u8 v_sys_rst_u8); * @brief This API used to read the self test * from register from 0x3F bit 0 * - * @param v_selftest_u8 : The value of self test + * @param selftest_u8 : The value of self test * - * v_selftest_u8 | result + * selftest_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note It triggers the self test */ BNO055_RETURN_FUNCTION_TYPE bno055_get_selftest( -u8 *v_selftest_u8); +u8 *selftest_u8); /*! * @brief This API used to write the self test * from register from 0x3F bit 0 * - * @param v_selftest_u8 : The value of self test + * @param selftest_u8 : The value of self test * - * v_selftest_u8 | result + * selftest_u8 | result * -------------- |---------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note It triggers the self test * * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_selftest(u8 v_selftest_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_set_selftest(u8 selftest_u8); /**************************************************/ /**\name FUNCTIONS FOR TEMPERATURE SOURCE */ /**************************************************/ @@ -4951,62 +4989,62 @@ BNO055_RETURN_FUNCTION_TYPE bno055_set_selftest(u8 v_selftest_u8); * @brief This API used to read the temperature source * from register from 0x40 bit 0 and 1 * - * @param v_temp_source_u8 : The value of selected temperature source + * @param temp_source_u8 : The value of selected temperature source * - * v_temp_source_u8 | result + * temp_source_u8 | result * ---------------- |--------------- - * 0x00 | ACCEL_TEMP_EN - * 0X01 | GYRO_TEMP_EN - * 0X03 | MCU_TEMP_EN + * 0x00 | BNO055_ACCEL_TEMP_EN + * 0X01 | BNO055_GYRO_TEMP_EN + * 0X03 | BNO055_MCU_TEMP_EN * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_temp_source( -u8 *v_temp_source_u8); +u8 *temp_source_u8); /*! * @brief This API used to write the temperature source * from register from 0x40 bit 0 and 1 * - * @param v_temp_source_u8 : The value of selected temperature source + * @param temp_source_u8 : The value of selected temperature source * - * v_temp_source_u8 | result + * temp_source_u8 | result * ---------------- |--------------- - * 0x00 | ACCEL_TEMP_EN - * 0X01 | GYRO_TEMP_EN - * 0X03 | MCU_TEMP_EN + * 0x00 | BNO055_ACCEL_TEMP_EN + * 0X01 | BNO055_GYRO_TEMP_EN + * 0X03 | BNO055_MCU_TEMP_EN * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ -BNO055_RETURN_FUNCTION_TYPE bno055_set_temp_source(u8 v_temp_source_u8); +BNO055_RETURN_FUNCTION_TYPE bno055_set_temp_source(u8 temp_source_u8); /**************************************************/ -/**\name FUNCTIONS FOR AXIS REMAP */ +/**\name APIs FOR AXIS REMAP */ /**************************************************/ /*! * @brief This API used to read the axis remap value * from register from 0x41 bit 0 and 5 * - * @param v_remap_axis_u8 : The value of axis remapping + * @param remap_axis_u8 : The value of axis remapping * - * v_remap_axis_u8 | result | comments + * remap_axis_u8 | result | comments * ------------|-------------------|------------ - * 0X21 | REMAP_X_Y | Z=Z;X=Y;Y=X - * 0X18 | REMAP_Y_Z | X=X;Y=Z;Z=Y - * 0X06 | REMAP_Z_X | Y=Y;X=Z;Z=X - * 0X12 | REMAP_X_Y_Z_TYPE0 | X=Z;Y=X;Z=Y - * 0X09 | REMAP_X_Y_Z_TYPE1 | X=Y;Y=Z;Z=X - * 0X24 | DEFAULT_AXIS | X=X;Y=Y;Z=Z + * 0X21 | BNO055_REMAP_X_Y | Z=Z;X=Y;Y=X + * 0X18 | BNO055_REMAP_Y_Z | X=X;Y=Z;Z=Y + * 0X06 | BNO055_REMAP_Z_X | Y=Y;X=Z;Z=X + * 0X12 | BNO055_REMAP_X_Y_Z_TYPE0 | X=Z;Y=X;Z=Y + * 0X09 | BNO055_REMAP_X_Y_Z_TYPE1 | X=Y;Y=Z;Z=X + * 0X24 | BNO055_DEFAULT_AXIS | X=X;Y=Y;Z=Z * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * - * @note : For axis sign remap refer the following functions + * @note : For axis sign remap refer the following APIs * x-axis : * * bno055_set_x_remap_sign() @@ -5021,27 +5059,27 @@ BNO055_RETURN_FUNCTION_TYPE bno055_set_temp_source(u8 v_temp_source_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_axis_remap_value( -u8 *v_remap_axis_u8); +u8 *remap_axis_u8); /*! * @brief This API used to write the axis remap value * from register from 0x41 bit 0 and 5 * - * @param v_remap_axis_u8 : The value of axis remapping + * @param remap_axis_u8 : The value of axis remapping * - * v_remap_axis_u8 | result | comments - * ------------|-------------------|------------ - * 0X21 | REMAP_X_Y | Z=Z;X=Y;Y=X - * 0X18 | REMAP_Y_Z | X=X;Y=Z;Z=Y - * 0X06 | REMAP_Z_X | Y=Y;X=Z;Z=X - * 0X12 | REMAP_X_Y_Z_TYPE0 | X=Z;Y=X;Z=Y - * 0X09 | REMAP_X_Y_Z_TYPE1 | X=Y;Y=Z;Z=X - * 0X24 | DEFAULT_AXIS | X=X;Y=Y;Z=Z + * remap_axis_u8 | result | comments + * ------------|--------------------------|------------ + * 0X21 | BNO055_REMAP_X_Y | Z=Z;X=Y;Y=X + * 0X18 | BNO055_REMAP_Y_Z | X=X;Y=Z;Z=Y + * 0X06 | BNO055_REMAP_Z_X | Y=Y;X=Z;Z=X + * 0X12 | BNO055_REMAP_X_Y_Z_TYPE0 | X=Z;Y=X;Z=Y + * 0X09 | BNO055_REMAP_X_Y_Z_TYPE1 | X=Y;Y=Z;Z=X + * 0X24 | BNO055_DEFAULT_AXIS | X=X;Y=Y;Z=Z * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * - * @note : For axis sign remap refer the following functions + * @note : For axis sign remap refer the following APIs * x-axis : * * bno055_set_x_remap_sign() @@ -5056,118 +5094,118 @@ u8 *v_remap_axis_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_axis_remap_value( -u8 v_remap_axis_u8); +u8 remap_axis_u8); /**************************************************/ -/**\name FUNCTIONS FOR AXIS REMAP SIGN */ +/**\name APIs FOR AXIS REMAP SIGN */ /**************************************************/ /*! * @brief This API used to read the x-axis remap * sign from register from 0x42 bit 2 * - * @param v_remap_x_sign_u8 : The value of x-axis remap sign + * @param remap_x_sign_u8 : The value of x-axis remap sign * - * v_remap_x_sign_u8 | result + * remap_x_sign_u8 | result * ------------------- |-------------------- - * 0X00 | REMAP_AXIS_POSITIVE - * 0X01 | REMAP_AXIS_NEGATIVE + * 0X00 | BNO055_REMAP_AXIS_POSITIVE + * 0X01 | BNO055_REMAP_AXIS_NEGATIVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_remap_x_sign( -u8 *v_remap_x_sign_u8); +u8 *remap_x_sign_u8); /*! * @brief This API used to write the x-axis remap * sign from register from 0x42 bit 2 * - * @param v_remap_x_sign_u8 : The value of x-axis remap sign + * @param remap_x_sign_u8 : The value of x-axis remap sign * - * v_remap_x_sign_u8 | result + * remap_x_sign_u8 | result * ------------------- |-------------------- - * 0X00 | REMAP_AXIS_POSITIVE - * 0X01 | REMAP_AXIS_NEGATIVE + * 0X00 | BNO055_REMAP_AXIS_POSITIVE + * 0X01 | BNO055_REMAP_AXIS_NEGATIVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_remap_x_sign( -u8 v_remap_x_sign_u8); +u8 remap_x_sign_u8); /*! * @brief This API used to read the y-axis remap * sign from register from 0x42 bit 1 * - * @param v_remap_y_sign_u8 : The value of y-axis remap sign + * @param remap_y_sign_u8 : The value of y-axis remap sign * - * v_remap_y_sign_u8 | result + * remap_y_sign_u8 | result * ------------------- |-------------------- - * 0X00 | REMAP_AXIS_POSITIVE - * 0X01 | REMAP_AXIS_NEGATIVE + * 0X00 | BNO055_REMAP_AXIS_POSITIVE + * 0X01 | BNO055_REMAP_AXIS_NEGATIVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_remap_y_sign( -u8 *v_remap_y_sign_u8); +u8 *remap_y_sign_u8); /*! * @brief This API used to write the y-axis remap * sign from register from 0x42 bit 1 * - * @param v_remap_y_sign_u8 : The value of y-axis remap sign + * @param remap_y_sign_u8 : The value of y-axis remap sign * - * v_remap_y_sign_u8 | result + * remap_y_sign_u8 | result * ------------------- |-------------------- - * 0X00 | REMAP_AXIS_POSITIVE - * 0X01 | REMAP_AXIS_NEGATIVE + * 0X00 | BNO055_REMAP_AXIS_POSITIVE + * 0X01 | BNO055_REMAP_AXIS_NEGATIVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_remap_y_sign( -u8 v_remap_y_sign_u8); +u8 remap_y_sign_u8); /*! * @brief This API used to read the z-axis remap * sign from register from 0x42 bit 0 * - * @param v_remap_z_sign_u8 : The value of z-axis remap sign + * @param remap_z_sign_u8 : The value of z-axis remap sign * - * v_remap_z_sign_u8 | result + * remap_z_sign_u8 | result * ------------------- |-------------------- - * 0X00 | REMAP_AXIS_POSITIVE - * 0X01 | REMAP_AXIS_NEGATIVE + * 0X00 | BNO055_REMAP_AXIS_POSITIVE + * 0X01 | BNO055_REMAP_AXIS_NEGATIVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_remap_z_sign( -u8 *v_remap_z_sign_u8); +u8 *remap_z_sign_u8); /*! * @brief This API used to write the z-axis remap * sign from register from 0x42 bit 0 * - * @param v_remap_z_sign_u8 : The value of z-axis remap sign + * @param remap_z_sign_u8 : The value of z-axis remap sign * - * v_remap_z_sign_u8 | result - * ------------------- |-------------------- - * 0X00 | REMAP_AXIS_POSITIVE - * 0X01 | REMAP_AXIS_NEGATIVE + * remap_z_sign_u8 | result + * ------------------|-------------------- + * 0X00 | BNO055_REMAP_AXIS_POSITIVE + * 0X01 | BNO055_REMAP_AXIS_NEGATIVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_remap_z_sign( -u8 v_remap_z_sign_u8); +u8 remap_z_sign_u8); /*****************************************************/ /**\name FUNCTIONS FOR SOFT IRON CALIBRATION MATRIX */ /*****************************************************/ @@ -5191,8 +5229,8 @@ u8 v_remap_z_sign_u8); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note : Each soft iron calibration matrix range from -32768 to +32767 */ @@ -5218,8 +5256,8 @@ struct bno055_sic_matrix_t *sic_matrix); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note : Each soft iron calibration matrix range from -32768 to +32767 */ @@ -5243,21 +5281,21 @@ struct bno055_sic_matrix_t *sic_matrix); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The range of the accel offset varies based on * the G-range of accel sensor. * * accel G range | offset range * --------------- | -------------- - * ACCEL_RANGE_2G | +/-2000 - * ACCEL_RANGE_4G | +/-4000 - * ACCEL_RANGE_8G | +/-8000 - * ACCEL_RANGE_16G | +/-16000 + * BNO055_ACCEL_RANGE_2G | +/-2000 + * BNO055_ACCEL_RANGE_4G | +/-4000 + * BNO055_ACCEL_RANGE_8G | +/-8000 + * BNO055_ACCEL_RANGE_16G | +/-16000 * * accel G range can be configured by using the - * bno055_set_accel_range() function + * bno055_set_accel_range() API */ BNO055_RETURN_FUNCTION_TYPE bno055_read_accel_offset( struct bno055_accel_offset_t *accel_offset); @@ -5276,21 +5314,21 @@ struct bno055_accel_offset_t *accel_offset); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The range of the accel offset varies based on * the G-range of accel sensor. * * accel G range | offset range * --------------- | -------------- - * ACCEL_RANGE_2G | +/-2000 - * ACCEL_RANGE_4G | +/-4000 - * ACCEL_RANGE_8G | +/-8000 - * ACCEL_RANGE_16G | +/-16000 + * BNO055_ACCEL_RANGE_2G | +/-2000 + * BNO055_ACCEL_RANGE_4G | +/-4000 + * BNO055_ACCEL_RANGE_8G | +/-8000 + * BNO055_ACCEL_RANGE_16G | +/-16000 * * accel G range can be configured by using the - * bno055_set_accel_range() function + * bno055_set_accel_range() API */ BNO055_RETURN_FUNCTION_TYPE bno055_write_accel_offset( struct bno055_accel_offset_t *accel_offset); @@ -5312,8 +5350,8 @@ struct bno055_accel_offset_t *accel_offset); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The range of the magnetometer offset is +/-6400 in LSB */ @@ -5335,8 +5373,8 @@ struct bno055_mag_offset_t *mag_offset); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The range of the magnetometer offset is +/-6400 in LSB */ @@ -5359,22 +5397,22 @@ struct bno055_mag_offset_t *mag_offset); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The range of the gyro offset varies based on * the range of gyro sensor * * gyro G range | offset range * -------------------- | ------------ - * GYRO_RANGE_2000DPS | +/-32000 - * GYRO_RANGE_1000DPS | +/-16000 - * GYRO_RANGE_500DPS | +/-8000 - * GYRO_RANGE_250DPS | +/-4000 - * GYRO_RANGE_125DPS | +/-2000 + * BNO055_GYRO_RANGE_2000DPS | +/-32000 + * BNO055_GYRO_RANGE_1000DPS | +/-16000 + * BNO055_GYRO_RANGE_500DPS | +/-8000 + * BNO055_GYRO_RANGE_250DPS | +/-4000 + * BNO055_GYRO_RANGE_125DPS | +/-2000 * * Gyro range can be configured by using the - * bno055_set_gyro_range() function + * bno055_set_gyro_range() API */ BNO055_RETURN_FUNCTION_TYPE bno055_read_gyro_offset( struct bno055_gyro_offset_t *gyro_offset); @@ -5392,22 +5430,22 @@ struct bno055_gyro_offset_t *gyro_offset); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The range of the gyro offset varies based on * the range of gyro sensor * * gyro G range | offset range * -------------------- | ------------ - * GYRO_RANGE_2000DPS | +/-32000 - * GYRO_RANGE_1000DPS | +/-16000 - * GYRO_RANGE_500DPS | +/-8000 - * GYRO_RANGE_250DPS | +/-4000 - * GYRO_RANGE_125DPS | +/-2000 + * BNO055_GYRO_RANGE_2000DPS | +/-32000 + * BNO055_GYRO_RANGE_1000DPS | +/-16000 + * BNO055_GYRO_RANGE_500DPS | +/-8000 + * BNO055_GYRO_RANGE_250DPS | +/-4000 + * BNO055_GYRO_RANGE_125DPS | +/-2000 * * Gyro range can be configured by using the - * bno055_set_gyro_range() function + * bno055_set_gyro_range() API */ BNO055_RETURN_FUNCTION_TYPE bno055_write_gyro_offset( struct bno055_gyro_offset_t *gyro_offset); @@ -5421,137 +5459,137 @@ struct bno055_gyro_offset_t *gyro_offset); * @brief This API used to read the accel range * from page one register from 0x08 bit 0 and 1 * - * @param v_accel_range_u8 : The value of accel range - * v_accel_range_u8 | result + * @param accel_range_u8 : The value of accel range + * accel_range_u8 | result * ----------------- | -------------- - * 0x00 | ACCEL_RANGE_2G - * 0x01 | ACCEL_RANGE_4G - * 0x02 | ACCEL_RANGE_8G - * 0x03 | ACCEL_RANGE_16G + * 0x00 | BNO055_ACCEL_RANGE_2G + * 0x01 | BNO055_ACCEL_RANGE_4G + * 0x02 | BNO055_ACCEL_RANGE_8G + * 0x03 | BNO055_ACCEL_RANGE_16G * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_range( -u8 *v_accel_range_u8); +u8 *accel_range_u8); /*! * @brief This API used to write the accel range * from page one register from 0x08 bit 0 and 1 * - * @param v_accel_range_u8 : The value of accel range + * @param accel_range_u8 : The value of accel range * - * v_accel_range_u8 | result + * accel_range_u8 | result * ----------------- | -------------- - * 0x00 | ACCEL_RANGE_2G - * 0x01 | ACCEL_RANGE_4G - * 0x02 | ACCEL_RANGE_8G - * 0x03 | ACCEL_RANGE_16G + * 0x00 | BNO055_ACCEL_RANGE_2G + * 0x01 | BNO055_ACCEL_RANGE_4G + * 0x02 | BNO055_ACCEL_RANGE_8G + * 0x03 | BNO055_ACCEL_RANGE_16G * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_range( -u8 v_accel_range_u8); +u8 accel_range_u8); /*! * @brief This API used to read the accel bandwidth * from page one register from 0x08 bit 2 to 4 * - * @param v_accel_bw_u8 : The value of accel bandwidth + * @param accel_bw_u8 : The value of accel bandwidth * - * v_accel_bw_u8 | result + * accel_bw_u8 | result * ----------------- | --------------- - * 0x00 | ACCEL_BW_7_81HZ - * 0x01 | ACCEL_BW_15_63HZ - * 0x02 | ACCEL_BW_31_25HZ - * 0x03 | ACCEL_BW_62_5HZ - * 0x04 | ACCEL_BW_125HZ - * 0x05 | ACCEL_BW_250HZ - * 0x06 | ACCEL_BW_500HZ - * 0x07 | ACCEL_BW_1000HZ + * 0x00 | BNO055_ACCEL_BW_7_81HZ + * 0x01 | BNO055_ACCEL_BW_15_63HZ + * 0x02 | BNO055_ACCEL_BW_31_25HZ + * 0x03 | BNO055_ACCEL_BW_62_5HZ + * 0x04 | BNO055_ACCEL_BW_125HZ + * 0x05 | BNO055_ACCEL_BW_250HZ + * 0x06 | BNO055_ACCEL_BW_500HZ + * 0x07 | BNO055_ACCEL_BW_1000HZ * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_bw( -u8 *v_accel_bw_u8); +u8 *accel_bw_u8); /*! * @brief This API used to write the accel bandwidth * from page one register from 0x08 bit 2 to 4 * - * @param v_accel_bw_u8 : The value of accel bandwidth + * @param accel_bw_u8 : The value of accel bandwidth * - * v_accel_bw_u8 | result + * accel_bw_u8 | result * ----------------- | --------------- - * 0x00 | ACCEL_BW_7_81HZ - * 0x01 | ACCEL_BW_15_63HZ - * 0x02 | ACCEL_BW_31_25HZ - * 0x03 | ACCEL_BW_62_5HZ - * 0x04 | ACCEL_BW_125HZ - * 0x05 | ACCEL_BW_250HZ - * 0x06 | ACCEL_BW_500HZ - * 0x07 | ACCEL_BW_1000HZ + * 0x00 | BNO055_ACCEL_BW_7_81HZ + * 0x01 | BNO055_ACCEL_BW_15_63HZ + * 0x02 | BNO055_ACCEL_BW_31_25HZ + * 0x03 | BNO055_ACCEL_BW_62_5HZ + * 0x04 | BNO055_ACCEL_BW_125HZ + * 0x05 | BNO055_ACCEL_BW_250HZ + * 0x06 | BNO055_ACCEL_BW_500HZ + * 0x07 | BNO055_ACCEL_BW_1000HZ * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_bw( -u8 v_accel_bw_u8); +u8 accel_bw_u8); /*! * @brief This API used to read the accel power mode * from page one register from 0x08 bit 5 to 7 * - * @param v_accel_power_mode_u8 : The value of accel power mode - * v_accel_power_mode_u8 | result + * @param accel_power_mode_u8 : The value of accel power mode + * accel_power_mode_u8 | result * ----------------- | ------------- - * 0x00 | ACCEL_NORMAL - * 0x01 | ACCEL_SUSPEND - * 0x02 | ACCEL_LOWPOWER_1 - * 0x03 | ACCEL_STANDBY - * 0x04 | ACCEL_LOWPOWER_2 - * 0x05 | ACCEL_DEEPSUSPEND + * 0x00 | BNO055_ACCEL_NORMAL + * 0x01 | BNO055_ACCEL_SUSPEND + * 0x02 | BNO055_ACCEL_LOWPOWER_1 + * 0x03 | BNO055_ACCEL_STANDBY + * 0x04 | BNO055_ACCEL_LOWPOWER_2 + * 0x05 | BNO055_ACCEL_DEEPSUSPEND * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_power_mode( -u8 *v_accel_power_mode_u8); +u8 *accel_power_mode_u8); /*! * @brief This API used to write the accel power mode * from page one register from 0x08 bit 5 to 7 * - * @param v_accel_power_mode_u8 : The value of accel power mode - * v_accel_power_mode_u8 | result + * @param accel_power_mode_u8 : The value of accel power mode + * accel_power_mode_u8 | result * ----------------- | ------------- - * 0x00 | ACCEL_NORMAL - * 0x01 | ACCEL_SUSPEND - * 0x02 | ACCEL_LOWPOWER_1 - * 0x03 | ACCEL_STANDBY - * 0x04 | ACCEL_LOWPOWER_2 - * 0x05 | ACCEL_DEEPSUSPEND + * 0x00 | BNO055_ACCEL_NORMAL + * 0x01 | BNO055_ACCEL_SUSPEND + * 0x02 | BNO055_ACCEL_LOWPOWER_1 + * 0x03 | BNO055_ACCEL_STANDBY + * 0x04 | BNO055_ACCEL_LOWPOWER_2 + * 0x05 | BNO055_ACCEL_DEEPSUSPEND * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_power_mode( -u8 v_accel_power_mode_u8); +u8 accel_power_mode_u8); /*****************************************************/ /**\name FUNCTIONS FOR MAG CONFIGURATION */ /*****************************************************/ @@ -5559,9 +5597,9 @@ u8 v_accel_power_mode_u8); * @brief This API used to read the mag output data rate * from page one register from 0x09 bit 0 to 2 * - * @param v_mag_data_output_rate_u8 : The value of mag output data rate + * @param mag_data_output_rate_u8 : The value of mag output data rate * - * v_mag_data_output_rate_u8 | result + * mag_data_output_rate_u8 | result * ---------------------- |---------------------- * 0x00 | MAG_DATA_OUTPUT_RATE_2HZ * 0x01 | MAG_DATA_OUTPUT_RATE_6HZ @@ -5573,122 +5611,122 @@ u8 v_accel_power_mode_u8); * 0x07 | MAG_DATA_OUTPUT_RATE_30HZ * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_mag_data_output_rate( -u8 *v_mag_data_output_rate_u8); +u8 *mag_data_output_rate_u8); /*! * @brief This API used to write the mag output data rate * from page one register from 0x09 bit 0 to 2 * - * @param v_mag_data_output_rate_u8 : The value of mag output data rate + * @param mag_data_output_rate_u8 : The value of mag output data rate * - * v_mag_data_output_rate_u8 | result - * ---------------------- |---------------------- - * 0x00 | MAG_DATA_OUTPUT_RATE_2HZ - * 0x01 | MAG_DATA_OUTPUT_RATE_6HZ - * 0x02 | MAG_DATA_OUTPUT_RATE_8HZ - * 0x03 | MAG_DATA_OUTPUT_RATE_10HZ - * 0x04 | MAG_DATA_OUTPUT_RATE_15HZ - * 0x05 | MAG_DATA_OUTPUT_RATE_20HZ - * 0x06 | MAG_DATA_OUTPUT_RATE_25HZ - * 0x07 | MAG_DATA_OUTPUT_RATE_30HZ + * mag_data_output_rate_u8 | result + * ---------------------- |---------------------- + * 0x00 | MAG_DATA_OUTPUT_RATE_2HZ + * 0x01 | MAG_DATA_OUTPUT_RATE_6HZ + * 0x02 | MAG_DATA_OUTPUT_RATE_8HZ + * 0x03 | MAG_DATA_OUTPUT_RATE_10HZ + * 0x04 | MAG_DATA_OUTPUT_RATE_15HZ + * 0x05 | MAG_DATA_OUTPUT_RATE_20HZ + * 0x06 | MAG_DATA_OUTPUT_RATE_25HZ + * 0x07 | MAG_DATA_OUTPUT_RATE_30HZ * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_mag_data_output_rate( -u8 v_mag_data_output_rate_u8); +u8 mag_data_output_rate_u8); /*! * @brief This API used to read the mag operation mode * from page one register from 0x09 bit 3 to 4 * - * @param v_mag_operation_mode_u8 : The value of mag operation mode + * @param mag_operation_mode_u8 : The value of mag operation mode * - * v_mag_operation_mode_u8 | result - * ------------------------- |-------------------------- - * 0x00 | MAG_OPR_MODE_LOWPOWER - * 0x01 | MAG_OPR_MODE_REGULAR - * 0x02 | MAG_OPR_MODE_ENHANCED_REGULAR - * 0x03 | MAG_OPR_MODE_HIGH_ACCURACY + * mag_operation_mode_u8 | result + * ------------------------|-------------------------- + * 0x00 | MAG_OPR_MODE_LOWPOWER + * 0x01 | MAG_OPR_MODE_REGULAR + * 0x02 | MAG_OPR_MODE_ENHANCED_REGULAR + * 0x03 | MAG_OPR_MODE_HIGH_ACCURACY * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_mag_operation_mode( -u8 *v_mag_operation_mode_u8); +u8 *mag_operation_mode_u8); /*! * @brief This API used to write the mag operation mode * from page one register from 0x09 bit 3 to 4 * - * @param v_mag_operation_mode_u8 : The value of mag operation mode + * @param mag_operation_mode_u8 : The value of mag operation mode * - * v_mag_operation_mode_u8 | result - * ------------------------- |-------------------------- - * 0x00 | MAG_OPR_MODE_LOWPOWER - * 0x01 | MAG_OPR_MODE_REGULAR - * 0x02 | MAG_OPR_MODE_ENHANCED_REGULAR - * 0x03 | MAG_OPR_MODE_HIGH_ACCURACY + * mag_operation_mode_u8 | result + * ------------------------|-------------------------- + * 0x00 | MAG_OPR_MODE_LOWPOWER + * 0x01 | MAG_OPR_MODE_REGULAR + * 0x02 | MAG_OPR_MODE_ENHANCED_REGULAR + * 0x03 | MAG_OPR_MODE_HIGH_ACCURACY * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_mag_operation_mode( -u8 v_mag_operation_mode_u8); +u8 mag_operation_mode_u8); /*! * @brief This API used to read the mag power mode * from page one register from 0x09 bit 4 to 6 * - * @param v_mag_power_mode_u8 : The value of mag power mode + * @param mag_power_mode_u8 : The value of mag power mode * - * v_mag_power_mode_u8 | result + * mag_power_mode_u8 | result * --------------------|----------------- - * 0x00 | MAG_POWER_MODE_NORMAL - * 0x01 | MAG_POWER_MODE_SLEEP - * 0x02 | MAG_POWER_MODE_SUSPEND - * 0x03 | MAG_POWER_MODE_FORCE_MODE + * 0x00 | BNO055_MAG_POWER_MODE_NORMAL + * 0x01 | BNO055_MAG_POWER_MODE_SLEEP + * 0x02 | BNO055_MAG_POWER_MODE_SUSPEND + * 0x03 | BNO055_MAG_POWER_MODE_FORCE_MODE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_mag_power_mode( -u8 *v_mag_power_mode_u8); +u8 *mag_power_mode_u8); /*! * @brief This API used to write the mag power mode * from page one register from 0x09 bit 4 to 6 * - * @param v_mag_power_mode_u8 : The value of mag power mode + * @param mag_power_mode_u8 : The value of mag power mode * - * v_mag_power_mode_u8 | result - * --------------------|----------------- - * 0x00 | MAG_POWER_MODE_NORMAL - * 0x01 | MAG_POWER_MODE_SLEEP - * 0x02 | MAG_POWER_MODE_SUSPEND - * 0x03 | MAG_POWER_MODE_FORCE_MODE + * mag_power_mode_u8 | result + * ------------------|----------------- + * 0x00 | BNO055_MAG_POWER_MODE_NORMAL + * 0x01 | BNO055_MAG_POWER_MODE_SLEEP + * 0x02 | BNO055_MAG_POWER_MODE_SUSPEND + * 0x03 | BNO055_MAG_POWER_MODE_FORCE_MODE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_mag_power_mode( -u8 v_mag_power_mode_u8); +u8 mag_power_mode_u8); /*****************************************************/ /**\name FUNCTIONS FOR GYRO CONFIGURATION */ /*****************************************************/ @@ -5696,103 +5734,103 @@ u8 v_mag_power_mode_u8); * @brief This API used to read the gyro range * from page one register from 0x0A bit 0 to 3 * - * @param v_gyro_range_u8 : The value of gyro range + * @param gyro_range_u8 : The value of gyro range * - * v_gyro_range_u8 | result + * gyro_range_u8 | result * --------------------|----------------- - * 0x00 | GYRO_RANGE_2000DPS - * 0x01 | GYRO_RANGE_1000DPS - * 0x02 | GYRO_RANGE_500DPS - * 0x03 | GYRO_RANGE_250DPS - * 0x04 | GYRO_RANGE_125DPS + * 0x00 | BNO055_GYRO_RANGE_2000DPS + * 0x01 | BNO055_GYRO_RANGE_1000DPS + * 0x02 | BNO055_GYRO_RANGE_500DPS + * 0x03 | BNO055_GYRO_RANGE_250DPS + * 0x04 | BNO055_GYRO_RANGE_125DPS * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_range( -u8 *v_gyro_range_u8); +u8 *gyro_range_u8); /*! * @brief This API used to write the gyro range * from page one register from 0x0A bit 0 to 3 * - * @param v_gyro_range_u8 : The value of gyro range + * @param gyro_range_u8 : The value of gyro range * - * v_gyro_range_u8 | result + * gyro_range_u8 | result * --------------------|----------------- - * 0x00 | GYRO_RANGE_2000DPS - * 0x01 | GYRO_RANGE_1000DPS - * 0x02 | GYRO_RANGE_500DPS - * 0x03 | GYRO_RANGE_250DPS - * 0x04 | GYRO_RANGE_125DPS + * 0x00 | BNO055_GYRO_RANGE_2000DPS + * 0x01 | BNO055_GYRO_RANGE_1000DPS + * 0x02 | BNO055_GYRO_RANGE_500DPS + * 0x03 | BNO055_GYRO_RANGE_250DPS + * 0x04 | BNO055_GYRO_RANGE_125DPS * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_range( -u8 v_gyro_range_u8); +u8 gyro_range_u8); /*! * @brief This API used to read the gyro bandwidth * from page one register from 0x0A bit 3 to 5 * - * @param v_gyro_bw_u8 : The value of gyro bandwidth + * @param gyro_bw_u8 : The value of gyro bandwidth * - * v_gyro_bw_u8 | result + * gyro_bw_u8 | result * --------------------|----------------- - * 0x00 | GYRO_BW_523HZ - * 0x01 | GYRO_BW_230HZ - * 0x02 | GYRO_BW_116HZ - * 0x03 | GYRO_BW_47HZ - * 0x04 | GYRO_BW_23HZ - * 0x05 | GYRO_BW_12HZ - * 0x06 | GYRO_BW_64HZ - * 0x07 | GYRO_BW_32HZ + * 0x00 | BNO055_GYRO_BW_523HZ + * 0x01 | BNO055_GYRO_BW_230HZ + * 0x02 | BNO055_GYRO_BW_116HZ + * 0x03 | BNO055_GYRO_BW_47HZ + * 0x04 | BNO055_GYRO_BW_23HZ + * 0x05 | BNO055_GYRO_BW_12HZ + * 0x06 | BNO055_GYRO_BW_64HZ + * 0x07 | BNO055_GYRO_BW_32HZ * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_bw( -u8 *v_gyro_bw_u8); +u8 *gyro_bw_u8); /*! * @brief This API used to write the gyro bandwidth * from page one register from 0x0A bit 3 to 5 * - * @param v_gyro_bw_u8 : The value of gyro bandwidth + * @param gyro_bw_u8 : The value of gyro bandwidth * - * v_gyro_bw_u8 | result + * gyro_bw_u8 | result * --------------------|----------------- - * 0x00 | GYRO_BW_523HZ - * 0x01 | GYRO_BW_230HZ - * 0x02 | GYRO_BW_116HZ - * 0x03 | GYRO_BW_47HZ - * 0x04 | GYRO_BW_23HZ - * 0x05 | GYRO_BW_12HZ - * 0x06 | GYRO_BW_64HZ - * 0x07 | GYRO_BW_32HZ + * 0x00 | BNO055_GYRO_BW_523HZ + * 0x01 | BNO055_GYRO_BW_230HZ + * 0x02 | BNO055_GYRO_BW_116HZ + * 0x03 | BNO055_GYRO_BW_47HZ + * 0x04 | BNO055_GYRO_BW_23HZ + * 0x05 | BNO055_GYRO_BW_12HZ + * 0x06 | BNO055_GYRO_BW_64HZ + * 0x07 | BNO055_GYRO_BW_32HZ * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_bw( -u8 v_gyro_bw_u8); +u8 gyro_bw_u8); /*! * @brief This API used to read the gyro power mode * from page one register from 0x0B bit 0 to 2 * - * @param v_gyro_power_mode_u8 : The value of gyro power mode + * @param gyro_power_mode_u8 : The value of gyro power mode * - * v_gyro_power_mode_u8 | result + * gyro_power_mode_u8 | result * ----------------------|---------------------------- * 0x00 | GYRO_OPR_MODE_NORMAL * 0x01 | GYRO_OPR_MODE_FASTPOWERUP @@ -5801,20 +5839,20 @@ u8 v_gyro_bw_u8); * 0x04 | GYRO_OPR_MODE_ADVANCE_POWERSAVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_power_mode( -u8 *v_gyro_power_mode_u8); +u8 *gyro_power_mode_u8); /*! * @brief This API used to write the gyro power mode * from page one register from 0x0B bit 0 to 2 * - * @param v_gyro_power_mode_u8 : The value of gyro power mode + * @param gyro_power_mode_u8 : The value of gyro power mode * - * v_gyro_power_mode_u8 | result + * gyro_power_mode_u8 | result * ----------------------|---------------------------- * 0x00 | GYRO_OPR_MODE_NORMAL * 0x01 | GYRO_OPR_MODE_FASTPOWERUP @@ -5823,13 +5861,13 @@ u8 *v_gyro_power_mode_u8); * 0x04 | GYRO_OPR_MODE_ADVANCE_POWERSAVE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_power_mode( -u8 v_gyro_power_mode_u8); +u8 gyro_power_mode_u8); /*****************************************************/ /**\name FUNCTIONS FOR ACCEL SLEEP SETTINGS */ /*****************************************************/ @@ -5837,47 +5875,47 @@ u8 v_gyro_power_mode_u8); * @brief This API used to read the accel sleep mode * from page one register from 0x0C bit 0 * - * @param v_sleep_tmr_u8 : The value of accel sleep mode + * @param sleep_tmr_u8 : The value of accel sleep mode * - * v_sleep_tmr_u8 | result + * sleep_tmr_u8 | result * ----------------- |------------------------------------ * 0x00 | enable EventDrivenSampling(EDT) * 0x01 | enable Equidistant sampling mode(EST) * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_sleep_tmr_mode( -u8 *v_sleep_tmr_u8); +u8 *sleep_tmr_u8); /*! * @brief This API used to write the accel sleep mode * from page one register from 0x0C bit 0 * - * @param v_sleep_tmr_u8 : The value of accel sleep mode + * @param sleep_tmr_u8 : The value of accel sleep mode * - * v_sleep_tmr_u8 | result + * sleep_tmr_u8 | result * ----------------- |------------------------------------ * 0x00 | enable EventDrivenSampling(EDT) * 0x01 | enable Equidistant sampling mode(EST) * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_sleep_tmr_mode( -u8 v_sleep_tmr_u8); +u8 sleep_tmr_u8); /*! * @brief This API used to read the accel sleep duration * from page one register from 0x0C bit 1 to 4 * - * @param v_sleep_durn_u8 : The value of accel sleep duration + * @param sleep_durn_u8 : The value of accel sleep duration * - * v_sleep_durn_u8 | result + * sleep_durn_u8 | result * ---------------- |----------------------------- * 0x05 | BNO055_ACCEL_SLEEP_DURN_0_5MS * 0x06 | BNO055_ACCEL_SLEEP_DURN_1MS @@ -5892,20 +5930,20 @@ u8 v_sleep_tmr_u8); * 0x0F | BNO055_ACCEL_SLEEP_DURN_1S * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_sleep_durn( -u8 *v_sleep_durn_u8); +u8 *sleep_durn_u8); /*! * @brief This API used to write the accel sleep duration * from page one register from 0x0C bit 1 to 4 * - * @param v_sleep_durn_u8 : The value of accel sleep duration + * @param sleep_durn_u8 : The value of accel sleep duration * - * v_sleep_durn_u8 | result + * sleep_durn_u8 | result * ---------------- |----------------------------- * 0x05 | BNO055_ACCEL_SLEEP_DURN_0_5MS * 0x06 | BNO055_ACCEL_SLEEP_DURN_1MS @@ -5920,13 +5958,13 @@ u8 *v_sleep_durn_u8); * 0x0F | BNO055_ACCEL_SLEEP_DURN_1S * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_sleep_durn( -u8 v_sleep_durn_u8); +u8 sleep_durn_u8); /*****************************************************/ /**\name FUNCTIONS FOR GYRO SLEEP SETTINGS */ /*****************************************************/ @@ -5934,25 +5972,25 @@ u8 v_sleep_durn_u8); * @brief This API used to write the gyro sleep duration * from page one register from 0x0D bit 0 to 2 * - * @param v_sleep_durn_u8 : The value of gyro sleep duration + * @param sleep_durn_u8 : The value of gyro sleep duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_sleep_durn( -u8 *v_sleep_durn_u8); +u8 *sleep_durn_u8); /*! * @brief This API used to write the gyro sleep duration * from page one register from 0x0D bit 0 to 2 * - * @param v_sleep_durn_u8 : The value of gyro sleep duration + * @param sleep_durn_u8 : The value of gyro sleep duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ @@ -5962,31 +6000,31 @@ u8 sleep_durn); * @brief This API used to read the gyro auto sleep duration * from page one register from 0x0D bit 3 to 5 * - * @param v_auto_sleep_durn_u8 : The value of gyro auto sleep duration + * @param auto_sleep_durn_u8 : The value of gyro auto sleep duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_auto_sleep_durn( -u8 *v_auto_sleep_durn_u8); +u8 *auto_sleep_durn_u8); /*! * @brief This API used to write the gyro auto sleep duration * from page one register from 0x0D bit 3 to 5 * - * @param v_auto_sleep_durn_u8 : The value of gyro auto sleep duration + * @param auto_sleep_durn_u8 : The value of gyro auto sleep duration * @param bw : The value of gyro bandwidth * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_gyro_set_auto_sleep_durn( -u8 v_auto_sleep_durn_u8, u8 bw); +u8 auto_sleep_durn_u8, u8 bw); /*****************************************************/ /**\name FUNCTIONS FOR MAG SLEEP SETTINGS */ /*****************************************************/ @@ -5994,58 +6032,58 @@ u8 v_auto_sleep_durn_u8, u8 bw); * @brief This API used to read the mag sleep mode * from page one register from 0x0E bit 0 * - * @param v_sleep_mode_u8 : The value of mag sleep mode + * @param sleep_mode_u8 : The value of mag sleep mode * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_mag_sleep_mode( -u8 *v_sleep_mode_u8); +u8 *sleep_mode_u8); /*! * @brief This API used to write the mag sleep mode * from page one register from 0x0E bit 0 * - * @param v_sleep_mode_u8 : The value of mag sleep mode + * @param sleep_mode_u8 : The value of mag sleep mode * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_mag_sleep_mode( -u8 v_sleep_mode_u8); +u8 sleep_mode_u8); /*! * @brief This API used to read the mag sleep duration * from page one register from 0x0E bit 1 to 4 * - * @param v_sleep_durn_u8 : The value of mag sleep duration + * @param sleep_durn_u8 : The value of mag sleep duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_mag_sleep_durn( -u8 *v_sleep_durn_u8); +u8 *sleep_durn_u8); /*! * @brief This API used to write the mag sleep duration * from page one register from 0x0E bit 1 to 4 * - * @param v_sleep_durn_u8 : The value of mag sleep duration + * @param sleep_durn_u8 : The value of mag sleep duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_mag_sleep_durn( -u8 v_sleep_durn_u8); +u8 sleep_durn_u8); /*****************************************************/ /**\name FUNCTIONS FOR GYRO INTERRUPT MASK */ /*****************************************************/ @@ -6053,15 +6091,15 @@ u8 v_sleep_durn_u8); * @brief This API used to read the gyro anymotion interrupt mask * from page one register from 0x0F bit 2 * - * @param v_gyro_any_motion_u8 : The value of gyro anymotion interrupt mask - * v_gyro_any_motion_u8 | result + * @param gyro_any_motion_u8 : The value of gyro anymotion interrupt mask + * gyro_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro anymotion interrupt * configure the following settings @@ -6086,20 +6124,20 @@ u8 v_sleep_durn_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_mask_gyro_any_motion( -u8 *v_gyro_any_motion_u8); +u8 *gyro_any_motion_u8); /*! * @brief This API used to write the gyro anymotion interrupt mask * from page one register from 0x0F bit 2 * - * @param v_gyro_any_motion_u8 : The value of gyro anymotion interrupt mask - * v_gyro_any_motion_u8 | result + * @param gyro_any_motion_u8 : The value of gyro anymotion interrupt mask + * gyro_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro anymotion interrupt * configure the following settings @@ -6124,24 +6162,24 @@ u8 *v_gyro_any_motion_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_mask_gyro_any_motion( -u8 v_gyro_any_motion_u8); +u8 gyro_any_motion_u8); /*! * @brief This API used to read the gyro highrate interrupt mask * from page one register from 0x0F bit 3 * - * @param v_gyro_highrate_u8 : The value of gyro highrate interrupt mask - * v_gyro_highrate_u8 | result + * @param gyro_highrate_u8 : The value of gyro highrate interrupt mask + * gyro_highrate_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro highrate interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -6177,24 +6215,24 @@ u8 v_gyro_any_motion_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_mask_gyro_highrate( -u8 *v_gyro_highrate_u8); +u8 *gyro_highrate_u8); /*! * @brief This API used to write the gyro highrate interrupt mask * from page one register from 0x0F bit 3 * - * @param v_gyro_highrate_u8 : The value of gyro highrate interrupt mask - * v_gyro_highrate_u8 | result + * @param gyro_highrate_u8 : The value of gyro highrate interrupt mask + * gyro_highrate_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro highrate interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -6230,27 +6268,27 @@ u8 *v_gyro_highrate_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_mask_gyro_highrate( -u8 v_gyro_highrate_u8); +u8 gyro_highrate_u8); /*****************************************************/ -/**\name FUNCTIONS FOR ACCEL INTERRUPT MASK */ +/**\name APIs FOR ACCEL INTERRUPT MASK */ /*****************************************************/ /*! * @brief This API used to read the accel highg interrupt mask * from page one register from 0x0F bit 5 * - * @param v_accel_high_g_u8 : The value of accel highg interrupt mask - * v_accel_high_g_u8 | result + * @param accel_high_g_u8 : The value of accel highg interrupt mask + * accel_high_g_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel highg interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -6266,24 +6304,24 @@ u8 v_gyro_highrate_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_mask_accel_high_g( -u8 *v_accel_high_g_u8); +u8 *accel_high_g_u8); /*! * @brief This API used to write the accel highg interrupt mask * from page one register from 0x0F bit 5 * - * @param v_accel_high_g_u8 : The value of accel highg interrupt mask - * v_accel_high_g_u8 | result + * @param accel_high_g_u8 : The value of accel highg interrupt mask + * accel_high_g_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel highg interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -6299,24 +6337,24 @@ u8 *v_accel_high_g_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_mask_accel_high_g( -u8 v_accel_high_g_u8); +u8 accel_high_g_u8); /*! * @brief This API used to read the accel anymotion interrupt mask * from page one register from 0x0F bit 6 * - * @param v_accel_any_motion_u8 : The value of accel anymotion interrupt mask - * v_accel_any_motion_u8 | result + * @param accel_any_motion_u8 : The value of accel anymotion interrupt mask + * accel_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel highg interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -6332,20 +6370,20 @@ u8 v_accel_high_g_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_mask_accel_any_motion( -u8 *v_accel_any_motion_u8); +u8 *accel_any_motion_u8); /*! * @brief This API used to write the accel anymotion interrupt mask * from page one register from 0x0F bit 6 * - * @param v_accel_any_motion_u8 : The value of accel anymotion interrupt mask - * v_accel_any_motion_u8 | result + * @param accel_any_motion_u8 : The value of accel anymotion interrupt mask + * accel_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel anymotion interrupt * configure the following settings @@ -6364,19 +6402,19 @@ u8 *v_accel_any_motion_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_mask_accel_any_motion( -u8 v_accel_any_motion_u8); +u8 accel_any_motion_u8); /*! * @brief This API used to read the accel nomotion interrupt mask * from page one register from 0x0F bit 7 * - * @param v_accel_nomotion_u8 : The value of accel nomotion interrupt mask - * v_accel_nomotion_u8 | result + * @param accel_nomotion_u8 : The value of accel nomotion interrupt mask + * accel_nomotion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success + * @retval 0 -> BNO055_SUCCESS * * @note While enabling the accel anymotion interrupt * configure the following settings @@ -6395,20 +6433,20 @@ u8 v_accel_any_motion_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_mask_accel_no_motion( -u8 *v_accel_nomotion_u8); +u8 *accel_nomotion_u8); /*! * @brief This API used to write the accel nomotion interrupt mask * from page one register from 0x0F bit 7 * - * @param v_accel_nomotion_u8 : The value of accel nomotion interrupt mask - * v_accel_nomotion_u8 | result + * @param accel_nomotion_u8 : The value of accel nomotion interrupt mask + * accel_nomotion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel nomotion interrupt * configure the following settings @@ -6431,7 +6469,7 @@ u8 *v_accel_nomotion_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_mask_accel_no_motion( -u8 v_accel_nomotion_u8); +u8 accel_nomotion_u8); /*****************************************************/ /**\name FUNCTIONS FOR GYRO INTERRUPT */ /*****************************************************/ @@ -6439,15 +6477,15 @@ u8 v_accel_nomotion_u8); * @brief This API used to read the gyro anymotion interrupt * from page one register from 0x10 bit 2 * - * @param v_gyro_any_motion_u8 : The value of gyro anymotion interrupt - * v_gyro_any_motion_u8 | result + * @param gyro_any_motion_u8 : The value of gyro anymotion interrupt + * gyro_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro anymotion interrupt * configure the following settings @@ -6471,20 +6509,20 @@ u8 v_accel_nomotion_u8); * bno055_set_gyro_any_motion_awake_durn() */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_gyro_any_motion( -u8 *v_gyro_any_motion_u8); +u8 *gyro_any_motion_u8); /*! * @brief This API used to write the gyro anymotion interrupt * from page one register from 0x10 bit 2 * - * @param v_gyro_any_motion_u8 : The value of gyro anymotion interrupt - * v_gyro_any_motion_u8 | result + * @param gyro_any_motion_u8 : The value of gyro anymotion interrupt + * gyro_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro anymotion interrupt * configure the following settings @@ -6508,24 +6546,24 @@ u8 *v_gyro_any_motion_u8); * bno055_set_gyro_any_motion_awake_durn() */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_gyro_any_motion( -u8 v_gyro_any_motion_u8); +u8 gyro_any_motion_u8); /*! * @brief This API used to read the gyro highrate interrupt * from page one register from 0x10 bit 3 * - * @param v_gyro_highrate_u8 : The value of gyro highrate interrupt - * v_gyro_highrate_u8 | result + * @param gyro_highrate_u8 : The value of gyro highrate interrupt + * gyro_highrate_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro highrate interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -6561,24 +6599,24 @@ u8 v_gyro_any_motion_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_gyro_highrate( -u8 *v_gyro_highrate_u8); +u8 *gyro_highrate_u8); /*! * @brief This API used to write the gyro highrate interrupt * from page one register from 0x10 bit 3 * - * @param v_gyro_highrate_u8 : The value of gyro highrate interrupt - * v_gyro_highrate_u8 | result + * @param gyro_highrate_u8 : The value of gyro highrate interrupt + * gyro_highrate_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the gyro highrate interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -6614,7 +6652,7 @@ u8 *v_gyro_highrate_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_gyro_highrate( -u8 v_gyro_highrate_u8); +u8 gyro_highrate_u8); /*****************************************************/ /**\name FUNCTIONS FOR ACCEL INTERRUPT */ /*****************************************************/ @@ -6622,19 +6660,19 @@ u8 v_gyro_highrate_u8); * @brief This API used to read the accel highg interrupt * from page one register from 0x10 bit 5 * - * @param v_accel_high_g_u8 : The value of accel highg interrupt - * v_accel_high_g_u8 | result + * @param accel_high_g_u8 : The value of accel highg interrupt + * accel_high_g_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel highg interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -6650,24 +6688,24 @@ u8 v_gyro_highrate_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_accel_high_g( -u8 *v_accel_high_g_u8); +u8 *accel_high_g_u8); /*! * @brief This API used to write the accel highg interrupt * from page one register from 0x10 bit 5 * - * @param v_accel_high_g_u8 : The value of accel highg interrupt - * v_accel_high_g_u8 | result + * @param accel_high_g_u8 : The value of accel highg interrupt + * accel_high_g_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel highg interrupt * configure the below settings by using - * the following functions + * the following APIs * * Axis : * @@ -6683,20 +6721,20 @@ u8 *v_accel_high_g_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_accel_high_g( -u8 v_accel_high_g_u8); +u8 accel_high_g_u8); /*! * @brief This API used to read the accel anymotion interrupt * from page one register from 0x10 bit 6 * - * @param v_accel_any_motion_u8 : The value of accel anymotion interrupt - * v_accel_any_motion_u8 | result + * @param accel_any_motion_u8 : The value of accel anymotion interrupt + * accel_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel anymotion interrupt * configure the following settings @@ -6715,20 +6753,20 @@ u8 v_accel_high_g_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_accel_any_motion( -u8 *v_accel_any_motion_u8); +u8 *accel_any_motion_u8); /*! * @brief This API used to write the accel anymotion interrupt * from page one register from 0x10 bit 6 * - * @param v_accel_any_motion_u8 : The value of accel anymotion interrupt - * v_accel_any_motion_u8 | result + * @param accel_any_motion_u8 : The value of accel anymotion interrupt + * accel_any_motion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel anymotion interrupt * configure the following settings @@ -6747,20 +6785,20 @@ u8 *v_accel_any_motion_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_accel_any_motion( -u8 v_accel_any_motion_u8); +u8 accel_any_motion_u8); /*! * @brief This API used to read the accel nomotion interrupt * from page one register from 0x10 bit 6 * - * @param v_accel_nomotion_u8 : The value of accel nomotion interrupt - * v_accel_nomotion_u8 | result + * @param accel_nomotion_u8 : The value of accel nomotion interrupt + * accel_nomotion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel nomotion interrupt * configure the following settings @@ -6783,20 +6821,20 @@ u8 v_accel_any_motion_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_accel_no_motion( -u8 *v_accel_nomotion_u8); +u8 *accel_nomotion_u8); /*! * @brief This API used to write the accel nomotion interrupt * from page one register from 0x10 bit 6 * - * @param v_accel_nomotion_u8 : The value of accel nomotion interrupt - * v_accel_nomotion_u8 | result + * @param accel_nomotion_u8 : The value of accel nomotion interrupt + * accel_nomotion_u8 | result * -------------------- |------------ - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note While enabling the accel nomotion interrupt * configure the following settings @@ -6819,7 +6857,7 @@ u8 *v_accel_nomotion_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_accel_no_motion( -u8 v_accel_nomotion_u8); +u8 accel_nomotion_u8); /*****************************************************/ /**\name FUNCTIONS FOR ACCEL ANY_MOTION THRESHOLD */ /*****************************************************/ @@ -6827,20 +6865,20 @@ u8 v_accel_nomotion_u8); * @brief This API used to read the accel any motion threshold * from page one register from 0x11 bit 0 to 7 * - * @param v_accel_any_motion_thres_u8 : The value of any motion threshold - * v_accel_any_motion_thres_u8 | result + * @param accel_any_motion_thres_u8 : The value of any motion threshold + * accel_any_motion_thres_u8 | result * ------------------------ | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel anymotion threshold dependent on the * range values * - * v_accel_range_u8 | threshold | LSB + * accel_range_u8 | threshold | LSB * ------------- | ------------- | --------- * 2g | 3.19mg | 1LSB * 4g | 7.81mg | 1LSB @@ -6849,25 +6887,25 @@ u8 v_accel_nomotion_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_any_motion_thres( -u8 *v_accel_any_motion_thres_u8); +u8 *accel_any_motion_thres_u8); /*! * @brief This API used to write the accel any motion threshold * from page one register from 0x11 bit 0 to 7 * - * @param v_accel_any_motion_thres_u8 : The value of any motion threshold - * v_accel_any_motion_thres_u8 | result + * @param accel_any_motion_thres_u8 : The value of any motion threshold + * accel_any_motion_thres_u8 | result * ------------------------ | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel anymotion threshold dependent on the * range values * - * v_accel_range_u8 | threshold | LSB + * accel_range_u8 | threshold | LSB * ------------- | ------------- | --------- * 2g | 3.19mg | 1LSB * 4g | 7.81mg | 1LSB @@ -6876,7 +6914,7 @@ u8 *v_accel_any_motion_thres_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_any_motion_thres( -u8 v_accel_any_motion_thres_u8); +u8 accel_any_motion_thres_u8); /*****************************************************/ /**\name FUNCTIONS FOR ACCEL ANY_MOTION DURATION */ /*****************************************************/ @@ -6884,39 +6922,39 @@ u8 v_accel_any_motion_thres_u8); * @brief This API used to read the accel anymotion duration * from page one register from 0x12 bit 0 to 1 * - * @param v_accel_any_motion_durn_u8 : The value of accel anymotion duration - * v_accel_any_motion_durn_u8 | result + * @param accel_any_motion_durn_u8 : The value of accel anymotion duration + * accel_any_motion_durn_u8 | result * ------------------------- | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_any_motion_durn( -u8 *v_accel_any_motion_durn_u8); +u8 *accel_any_motion_durn_u8); /*! * @brief This API used to write the accel anymotion duration * from page one register from 0x12 bit 0 to 1 * - * @param v_accel_any_motion_durn_u8 : The value of accel anymotion duration + * @param accel_any_motion_durn_u8 : The value of accel anymotion duration * - * v_accel_any_motion_durn_u8 | result + * accel_any_motion_durn_u8 | result * ------------------------- | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_any_motion_durn( -u8 v_accel_any_motion_durn_u8); +u8 accel_any_motion_durn_u8); /*****************************************************/ /**\name FUNCTIONS FOR ACCEL ANY_MOTION AXIS ENABLE */ /*****************************************************/ @@ -6924,50 +6962,50 @@ u8 v_accel_any_motion_durn_u8); * @brief This API used to read the accel anymotion enable * from page one register from 0x12 bit 2 to 4 * - * @param v_data_u8 : The value of accel anymotion enable - * v_data_u8 | result + * @param data_u8 : The value of accel anymotion enable + * data_u8 | result * ------------ | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of accel anymotion axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of accel anymotion axis selection + * channel_u8 | value * -------------------------- | ---------- * BNO055_ACCEL_ANY_MOTION_NO_MOTION_X_AXIS | 0 * BNO055_ACCEL_ANY_MOTION_NO_MOTION_Y_AXIS | 1 * BNO055_ACCEL_ANY_MOTION_NO_MOTION_Y_AXIS | 2 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_any_motion_no_motion_axis_enable( -u8 v_channel_u8, u8 *v_data_u8); +u8 channel_u8, u8 *data_u8); /*! * @brief This API used to write the accel anymotion enable * from page one register from 0x12 bit 2 to 4 * - * @param v_data_u8 : The value of accel anymotion enable - * v_data_u8 | result + * @param data_u8 : The value of accel anymotion enable + * data_u8 | result * ------------ | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of accel anymotion axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of accel anymotion axis selection + * channel_u8 | value * -------------------------- | ---------- * BNO055_ACCEL_ANY_MOTION_NO_MOTION_X_AXIS | 0 * BNO055_ACCEL_ANY_MOTION_NO_MOTION_Y_AXIS | 1 * BNO055_ACCEL_ANY_MOTION_NO_MOTION_Y_AXIS | 2 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_any_motion_no_motion_axis_enable( -u8 v_channel_u8, u8 v_data_u8); +u8 channel_u8, u8 data_u8); /*****************************************************/ /**\name FUNCTIONS FOR ACCEL HIGHG AXIS ENABLE */ /*****************************************************/ @@ -6975,50 +7013,50 @@ u8 v_channel_u8, u8 v_data_u8); * @brief This API used to read the accel highg enable * from page one register from 0x12 bit 5 to 7 * - * @param v_data_u8 : The value of accel highg enable - * v_data_u8| result + * @param data_u8 : The value of accel highg enable + * data_u8| result * ------------ | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of accel highg axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of accel highg axis selection + * channel_u8 | value * -------------------------- | ---------- * BNO055_ACCEL_HIGH_G_X_AXIS | 0 * BNO055_ACCEL_HIGH_G_Y_AXIS | 1 * BNO055_ACCEL_HIGH_G_Z_AXIS | 2 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_high_g_axis_enable( -u8 v_channel_u8, u8 *v_data_u8); +u8 channel_u8, u8 *data_u8); /*! * @brief This API used to write the accel highg enable * from page one register from 0x12 bit 5 to 7 * - * @param v_data_u8 : The value of accel highg enable - * v_data_u8| result + * @param data_u8 : The value of accel highg enable + * data_u8| result * ------------ | ------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of accel highg axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of accel highg axis selection + * channel_u8 | value * -------------------------- | ---------- * BNO055_ACCEL_HIGH_G_X_AXIS | 0 * BNO055_ACCEL_HIGH_G_Y_AXIS | 1 * BNO055_ACCEL_HIGH_G_Z_AXIS | 2 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_high_g_axis_enable( -u8 v_channel_u8, u8 v_data_u8); +u8 channel_u8, u8 data_u8); /*****************************************************/ /**\name FUNCTIONS FOR ACCEL HIGHG DURATION */ /*****************************************************/ @@ -7026,11 +7064,11 @@ u8 v_channel_u8, u8 v_data_u8); * @brief This API used to read the accel highg duration * from page one register from 0x13 bit 0 to 7 * - * @param v_accel_high_g_durn_u8 : The value of accel highg duration + * @param accel_high_g_durn_u8 : The value of accel highg duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The high-g interrupt trigger delay according * to [highg duration + 1] * 2 ms @@ -7039,16 +7077,16 @@ u8 v_channel_u8, u8 v_data_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_high_g_durn( -u8 *v_accel_high_g_durn_u8); +u8 *accel_high_g_durn_u8); /*! * @brief This API used to write the accel highg duration * from page one register from 0x13 bit 0 to 7 * - * @param v_accel_high_g_durn_u8 : The value of accel highg duration + * @param accel_high_g_durn_u8 : The value of accel highg duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note The high-g interrupt trigger delay according * to [highg duration + 1] * 2 ms @@ -7057,7 +7095,7 @@ u8 *v_accel_high_g_durn_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_high_g_durn( -u8 v_accel_high_g_durn_u8); +u8 accel_high_g_durn_u8); /*****************************************************/ /**\name FUNCTIONS FOR ACCEL HIGHG THRESHOLD */ /*****************************************************/ @@ -7065,16 +7103,16 @@ u8 v_accel_high_g_durn_u8); * @brief This API used to read the accel highg threshold * from page one register from 0x14 bit 0 to 7 * - * @param v_accel_high_g_thres_u8 : The value of accel highg threshold + * @param accel_high_g_thres_u8 : The value of accel highg threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel highg interrupt threshold dependent * for accel g range * - * v_accel_range_u8 | threshold | LSB + * accel_range_u8 | threshold | LSB * ------------- | ------------- | --------- * 2g | 7.81mg | 1LSB * 4g | 15.63mg | 1LSB @@ -7083,21 +7121,21 @@ u8 v_accel_high_g_durn_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_high_g_thres( -u8 *v_accel_high_g_thres_u8); +u8 *accel_high_g_thres_u8); /*! * @brief This API used to write the accel highg threshold * from page one register from 0x14 bit 0 to 7 * - * @param v_accel_high_g_thres_u8 : The value of accel highg threshold + * @param accel_high_g_thres_u8 : The value of accel highg threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel highg interrupt threshold dependent * for accel g range * - * v_accel_range_u8 | threshold | LSB + * accel_range_u8 | threshold | LSB * ------------- | ------------- | --------- * 2g | 7.81mg | 1LSB * 4g | 15.63mg | 1LSB @@ -7106,7 +7144,7 @@ u8 *v_accel_high_g_thres_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_high_g_thres( -u8 v_accel_high_g_thres_u8); +u8 accel_high_g_thres_u8); /**************************************************************/ /**\name FUNCTIONS FOR ACCEL SLOWNOMOTION THRESHOLD */ /**************************************************************/ @@ -7114,17 +7152,17 @@ u8 v_accel_high_g_thres_u8); * @brief This API used to read the accel slownomotion threshold * from page one register from 0x15 bit 0 to 7 * - * @param v_accel_slow_no_motion_thres_u8 : + * @param accel_slow_no_motion_thres_u8 : * The value of accel slownomotion threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel slow no motion interrupt threshold dependent * for accel g range * - * v_accel_range_u8 | threshold | LSB + * accel_range_u8 | threshold | LSB * ------------- | ------------- | --------- * 2g | 3.19mg | 1LSB * 4g | 7.81mg | 1LSB @@ -7132,22 +7170,22 @@ u8 v_accel_high_g_thres_u8); * 16g | 31.25mg | 1LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_slow_no_motion_thres( -u8 *v_accel_slow_no_motion_thres_u8); +u8 *accel_slow_no_motion_thres_u8); /*! * @brief This API used to write the accel slownomotion threshold * from page one register from 0x15 bit 0 to 7 * - * @param v_accel_slow_no_motion_thres_u8 : + * @param accel_slow_no_motion_thres_u8 : * The value of accel slownomotion threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Accel slow no motion interrupt threshold dependent * for accel g range * - * v_accel_range_u8 | threshold | LSB + * accel_range_u8 | threshold | LSB * ------------- | ------------- | --------- * 2g | 3.19mg | 1LSB * 4g | 7.81mg | 1LSB @@ -7155,7 +7193,7 @@ u8 *v_accel_slow_no_motion_thres_u8); * 16g | 31.25mg | 1LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_slow_no_motion_thres( -u8 v_accel_slow_no_motion_thres_u8); +u8 accel_slow_no_motion_thres_u8); /**************************************************************/ /**\name FUNCTIONS FOR ACCEL SLOWNOMOTION ENABLE */ /**************************************************************/ @@ -7163,36 +7201,36 @@ u8 v_accel_slow_no_motion_thres_u8); * @brief This API used to read accel slownomotion enable * from page one register from 0x16 bit 0 * - * @param v_accel_slow_no_motion_en_u8 : The value of accel slownomotion enable - * v_accel_slow_no_motion_en_u8 | result + * @param accel_slow_no_motion_en_u8 : The value of accel slownomotion enable + * accel_slow_no_motion_en_u8 | result * ------------------------ | -------- * 0x01 | Slow motion * 0x00 | No motion * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_slow_no_motion_enable( -u8 *v_accel_slow_no_motion_en_u8); +u8 *accel_slow_no_motion_en_u8); /*! * @brief This API used to write accel slownomotion enable * from page one register from 0x16 bit 0 * - * @param v_accel_slow_no_motion_en_u8 : The value of accel slownomotion enable - * v_accel_slow_no_motion_en_u8 | result + * @param accel_slow_no_motion_en_u8 : The value of accel slownomotion enable + * accel_slow_no_motion_en_u8 | result * ------------------------ | -------- * 0x01 | Slow motion * 0x00 | No motion * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_slow_no_motion_enable( -u8 v_accel_slow_no_motion_en_u8); +u8 accel_slow_no_motion_en_u8); /**************************************************************/ /**\name FUNCTIONS FOR ACCEL SLOWNOMOTION DURATION */ /**************************************************************/ @@ -7200,30 +7238,30 @@ u8 v_accel_slow_no_motion_en_u8); * @brief This API used to read accel slownomotion duration * from page one register from 0x16 bit 1 to 6 * - * @param v_accel_slow_no_motion_durn_u8 : + * @param accel_slow_no_motion_durn_u8 : * The value of accel slownomotion duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_accel_slow_no_motion_durn( -u8 *v_accel_slow_no_motion_durn_u8); +u8 *accel_slow_no_motion_durn_u8); /*! * @brief This API used to write accel slownomotion duration * from page one register from 0x16 bit 1 to 6 * - * @param v_accel_slow_no_motion_durn_u8 : + * @param accel_slow_no_motion_durn_u8 : * The value of accel slownomotion duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_accel_slow_no_motion_durn( -u8 v_accel_slow_no_motion_durn_u8); +u8 accel_slow_no_motion_durn_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO ANY_MOTION AXIS ENABLE */ /**************************************************************/ @@ -7231,13 +7269,13 @@ u8 v_accel_slow_no_motion_durn_u8); * @brief This API used to read the gyro anymotion enable * from page one register from 0x17 bit 0 to 2 * - * @param v_data_u8 : The value of gyro anymotion enable - * v_data_u8 | result + * @param data_u8 : The value of gyro anymotion enable + * data_u8 | result * ----------------- |------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of gyro anymotion axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of gyro anymotion axis selection + * channel_u8 | value * --------------------------- | ---------- * BNO055_GYRO_ANY_MOTIONX_AXIS | 0 * BNO055_GYRO_ANY_MOTIONY_AXIS | 1 @@ -7245,37 +7283,37 @@ u8 v_accel_slow_no_motion_durn_u8); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_any_motion_axis_enable( -u8 v_channel_u8, u8 *v_data_u8); +u8 channel_u8, u8 *data_u8); /*! * @brief This API used to write the gyro anymotion enable * from page one register from 0x17 bit 0 to 2 * - * @param v_data_u8 : The value of gyro anymotion enable - * v_data_u8 | result + * @param data_u8 : The value of gyro anymotion enable + * data_u8 | result * ----------------- |------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of gyro anymotion axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of gyro anymotion axis selection + * channel_u8 | value * --------------------------- | ---------- * BNO055_GYRO_ANY_MOTIONX_AXIS | 0 * BNO055_GYRO_ANY_MOTIONY_AXIS | 1 * BNO055_GYRO_ANY_MOTIONZ_AXIS | 2 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_any_motion_axis_enable( -u8 v_channel_u8, u8 v_data_u8); +u8 channel_u8, u8 data_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO HIGHRATE ENABLE */ /**************************************************************/ @@ -7283,13 +7321,13 @@ u8 v_channel_u8, u8 v_data_u8); * @brief This API used to read the gyro highrate enable * from page one register from 0x17 bit 3 to 5 * - * @param v_data_u8 : The value of gyro highrate enable - * v_data_u8 | result + * @param data_u8 : The value of gyro highrate enable + * data_u8 | result * ---------------- |------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of gyro highrate axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of gyro highrate axis selection + * channel_u8 | value * ------------------------ | ---------- * BNO055_GYRO_HIGHRATE_X_AXIS | 0 * BNO055_GYRO_HIGHRATE_Y_AXIS | 1 @@ -7297,13 +7335,13 @@ u8 v_channel_u8, u8 v_data_u8); * * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_axis_enable( -u8 v_channel_u8, u8 *v_data_u8); +u8 channel_u8, u8 *data_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO HIGHRATE AXIS ENABLE */ /**************************************************************/ @@ -7311,26 +7349,26 @@ u8 v_channel_u8, u8 *v_data_u8); * @brief This API used to write the gyro highrate enable * from page one register from 0x17 bit 3 to 5 * - * @param v_data_u8 : The value of gyro highrate enable - * v_data_u8 | result + * @param data_u8 : The value of gyro highrate enable + * data_u8 | result * ---------------- |------------- - * 0x01 | ENABLED - * 0x00 | DISABLED - * @param v_channel_u8 : The value of gyro highrate axis selection - * v_channel_u8 | value + * 0x01 | BNO055_BIT_ENABLE + * 0x00 | BNO055_BIT_DISABLE + * @param channel_u8 : The value of gyro highrate axis selection + * channel_u8 | value * ------------------------ | ---------- * BNO055_GYRO_HIGHRATE_X_AXIS | 0 * BNO055_GYRO_HIGHRATE_Y_AXIS | 1 * BNO055_GYRO_HIGHRATE_Z_AXIS | 2 * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_axis_enable( -u8 v_channel_u8, u8 v_data_u8); +u8 channel_u8, u8 data_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO ANY_MOTION FILTER */ /**************************************************************/ @@ -7338,36 +7376,36 @@ u8 v_channel_u8, u8 v_data_u8); * @brief This API used to read gyro anymotion filter * from page one register from 0x17 bit 6 * - * @param v_gyro_any_motion_filter_u8 : The value of gyro anymotion filter - * v_gyro_any_motion_filter_u8 | result + * @param gyro_any_motion_filter_u8 : The value of gyro anymotion filter + * gyro_any_motion_filter_u8 | result * --------------------------- |------------ - * 0x00 | FILTERED - * 0x01 | UNFILTERED + * 0x00 | BNO055_GYRO_FILTERED_CONFIG + * 0x01 | BNO055_GYRO_UNFILTERED_CONFIG * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_any_motion_filter( -u8 *v_gyro_any_motion_filter_u8); +u8 *gyro_any_motion_filter_u8); /*! * @brief This API used to write gyro anymotion filter * from page one register from 0x17 bit 6 * - * @param v_gyro_any_motion_filter_u8 : The value of gyro anymotion filter - * v_gyro_any_motion_filter_u8 | result + * @param gyro_any_motion_filter_u8 : The value of gyro anymotion filter + * gyro_any_motion_filter_u8 | result * --------------------------- |------------ - * 0x00 | FILTERED - * 0x01 | UNFILTERED + * 0x00 | BNO055_GYRO_FILTERED_CONFIG + * 0x01 | BNO055_GYRO_UNFILTERED_CONFIG * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_any_motion_filter( -u8 v_gyro_any_motion_filter_u8); +u8 gyro_any_motion_filter_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO HIGHRATE FILTER */ /**************************************************************/ @@ -7375,36 +7413,36 @@ u8 v_gyro_any_motion_filter_u8); * @brief This API used to read gyro highrate filter * from page one register from 0x17 bit 7 * - * @param v_gyro_highrate_filter_u8 : The value of gyro highrate filter - * v_gyro_highrate_filter_u8 | result + * @param gyro_highrate_filter_u8 : The value of gyro highrate filter + * gyro_highrate_filter_u8 | result * --------------------------- |------------ - * 0x00 | FILTERED - * 0x01 | UNFILTERED + * 0x00 | BNO055_GYRO_FILTERED_CONFIG + * 0x01 | BNO055_GYRO_UNFILTERED_CONFIG * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_filter( -u8 *v_gyro_highrate_filter_u8); +u8 *gyro_highrate_filter_u8); /*! * @brief This API used to write gyro highrate filter * from page one register from 0x17 bit 7 * - * @param v_gyro_highrate_filter_u8 : The value of gyro highrate filter - * v_gyro_highrate_filter_u8 | result + * @param gyro_highrate_filter_u8 : The value of gyro highrate filter + * gyro_highrate_filter_u8 | result * --------------------------- |------------ - * 0x00 | FILTERED - * 0x01 | UNFILTERED + * 0x00 | BNO055_GYRO_FILTERED_CONFIG + * 0x01 | BNO055_GYRO_UNFILTERED_CONFIG * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_filter( -u8 v_gyro_highrate_filter_u8); +u8 gyro_highrate_filter_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO HIGHRATE X THRESHOLD */ /**************************************************************/ @@ -7412,16 +7450,16 @@ u8 v_gyro_highrate_filter_u8); * @brief This API used to read gyro highrate x threshold * from page one register from 0x18 bit 0 to 4 * - * @param v_gyro_highrate_x_thres_u8 : The value of gyro x highrate threshold + * @param gyro_highrate_x_thres_u8 : The value of gyro x highrate threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate threshold dependent on the * selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 62.5dps | 1LSB * 1000 | 31.25dps | 1LSB @@ -7430,21 +7468,21 @@ u8 v_gyro_highrate_filter_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_x_thres( -u8 *v_gyro_highrate_x_thres_u8); +u8 *gyro_highrate_x_thres_u8); /*! * @brief This API used to write gyro highrate x threshold * from page one register from 0x18 bit 0 to 4 * - * @param v_gyro_highrate_x_thres_u8 : The value of gyro x highrate threshold + * @param gyro_highrate_x_thres_u8 : The value of gyro x highrate threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate threshold dependent on the * selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 62.5dps | 1LSB * 1000 | 31.25dps | 1LSB @@ -7453,7 +7491,7 @@ u8 *v_gyro_highrate_x_thres_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_x_thres( -u8 v_gyro_highrate_x_thres_u8); +u8 gyro_highrate_x_thres_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO HIGHRATE X HYSTERESIS */ /**************************************************************/ @@ -7461,19 +7499,19 @@ u8 v_gyro_highrate_x_thres_u8); * @brief This API used to read gyro highrate x hysteresis * from page one register from 0x18 bit 5 to 6 * - * @param v_gyro_highrate_x_hyst_u8 : The value of gyro highrate x hysteresis + * @param gyro_highrate_x_hyst_u8 : The value of gyro highrate x hysteresis * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro high rate hysteresis calculated by * - * using this (255 + 256 * v_gyro_highrate_x_hyst_u8) *4 LSB + * using this (255 + 256 * gyro_highrate_x_hyst_u8) *4 LSB * * The high rate value scales with the range setting * - * v_gyro_range_u8 | hysteresis | LSB + * gyro_range_u8 | hysteresis | LSB * ----------------- | ------------- | --------- * 2000 | 62.26dps | 1LSB * 1000 | 31.13dps | 1LSB @@ -7481,24 +7519,24 @@ u8 v_gyro_highrate_x_thres_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_x_hyst( -u8 *v_gyro_highrate_x_hyst_u8); +u8 *gyro_highrate_x_hyst_u8); /*! * @brief This API used to write gyro highrate x hysteresis * from page one register from 0x18 bit 5 to 6 * - * @param v_gyro_highrate_x_hyst_u8 : The value of gyro highrate x hysteresis + * @param gyro_highrate_x_hyst_u8 : The value of gyro highrate x hysteresis * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro high rate hysteresis calculated by * - * using this (255 + 256 * v_gyro_highrate_x_hyst_u8) *4 LSB + * using this (255 + 256 * gyro_highrate_x_hyst_u8) *4 LSB * * The high rate value scales with the range setting * - * v_gyro_range_u8 | hysteresis | LSB + * gyro_range_u8 | hysteresis | LSB * ----------------- | ------------- | --------- * 2000 | 62.26dps | 1LSB * 1000 | 31.13dps | 1LSB @@ -7506,7 +7544,7 @@ u8 *v_gyro_highrate_x_hyst_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_x_hyst( -u8 v_gyro_highrate_x_hyst_u8); +u8 gyro_highrate_x_hyst_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO HIGHRATE X DURATION */ /**************************************************************/ @@ -7514,35 +7552,35 @@ u8 v_gyro_highrate_x_hyst_u8); * @brief This API used to read gyro highrate x duration * from page one register from 0x19 bit 0 to 7 * - * @param v_gyro_highrate_x_durn_u8 : The value of gyro highrate x duration + * @param gyro_highrate_x_durn_u8 : The value of gyro highrate x duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate duration calculate by using the formula * - * (1 + v_gyro_highrate_x_durn_u8)*2.5ms + * (1 + gyro_highrate_x_durn_u8)*2.5ms * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_x_durn( -u8 *v_gyro_highrate_x_durn_u8); +u8 *gyro_highrate_x_durn_u8); /*! * @brief This API used to write gyro highrate x duration * from page one register from 0x19 bit 0 to 7 * - * @param v_gyro_highrate_x_durn_u8 : The value of gyro highrate x duration + * @param gyro_highrate_x_durn_u8 : The value of gyro highrate x duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate duration calculate by using the formula * - * (1 + v_gyro_highrate_x_durn_u8)*2.5ms + * (1 + gyro_highrate_x_durn_u8)*2.5ms */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_x_durn( -u8 v_gyro_highrate_x_durn_u8); +u8 gyro_highrate_x_durn_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO HIGHRATE Y THRESHOLD */ /**************************************************************/ @@ -7550,16 +7588,16 @@ u8 v_gyro_highrate_x_durn_u8); * @brief This API used to read gyro highrate y threshold * from page one register from 0x1A bit 0 to 4 * - * @param v_gyro_highrate_y_thres_u8 : The value of gyro highrate y threshold + * @param gyro_highrate_y_thres_u8 : The value of gyro highrate y threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate threshold dependent on the * selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 62.5dps | 1LSB * 1000 | 31.25dps | 1LSB @@ -7568,21 +7606,21 @@ u8 v_gyro_highrate_x_durn_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_y_thres( -u8 *v_gyro_highrate_y_thres_u8); +u8 *gyro_highrate_y_thres_u8); /*! * @brief This API used to write gyro highrate y threshold * from page one register from 0x1A bit 0 to 4 * - * @param v_gyro_highrate_y_thres_u8 : The value of gyro highrate y threshold + * @param gyro_highrate_y_thres_u8 : The value of gyro highrate y threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate threshold dependent on the * selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 62.5dps | 1LSB * 1000 | 31.25dps | 1LSB @@ -7591,7 +7629,7 @@ u8 *v_gyro_highrate_y_thres_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_y_thres( -u8 v_gyro_highrate_y_thres_u8); +u8 gyro_highrate_y_thres_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO HIGHRATE Y HYSTERESIS */ /**************************************************************/ @@ -7599,50 +7637,50 @@ u8 v_gyro_highrate_y_thres_u8); * @brief This API used to read gyro highrate y hysteresis * from page one register from 0x1A bit 5 to 6 * - * @param v_gyro_highrate_y_hyst_u8 : The value of gyro highrate y hysteresis + * @param gyro_highrate_y_hyst_u8 : The value of gyro highrate y hysteresis * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro high rate hysteresis calculated by * - * using this (255 + 256 * v_gyro_highrate_y_hyst_u8) *4 LSB + * using this (255 + 256 * gyro_highrate_y_hyst_u8) *4 LSB * * The high rate value scales with the range setting * - * v_gyro_range_u8 | hysteresis | LSB + * gyro_range_u8 | hysteresis | LSB * ----------------- | ------------- | --------- * 2000 | 62.26dps | 1LSB * 1000 | 31.13dps | 1LSB * 500 | 15.56dps | 1LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_y_hyst( -u8 *v_gyro_highrate_y_hyst_u8); +u8 *gyro_highrate_y_hyst_u8); /*! * @brief This API used to write gyro highrate y hysteresis * from page one register from 0x1A bit 5 to 6 * - * @param v_gyro_highrate_y_hyst_u8 : The value of gyro highrate y hysteresis + * @param gyro_highrate_y_hyst_u8 : The value of gyro highrate y hysteresis * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro high rate hysteresis calculated by * - * using this (255 + 256 * v_gyro_highrate_y_hyst_u8) *4 LSB + * using this (255 + 256 * gyro_highrate_y_hyst_u8) *4 LSB * * The high rate value scales with the range setting * - * v_gyro_range_u8 | hysteresis | LSB + * gyro_range_u8 | hysteresis | LSB * ----------------- | ------------- | --------- * 2000 | 62.26dps | 1LSB * 1000 | 31.13dps | 1LSB * 500 | 15.56dps | 1LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_y_hyst( -u8 v_gyro_highrate_y_hyst_u8); +u8 gyro_highrate_y_hyst_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO HIGHRATE Y DURATION */ /**************************************************************/ @@ -7650,34 +7688,34 @@ u8 v_gyro_highrate_y_hyst_u8); * @brief This API used to read gyro highrate y duration * from page one register from 0x1B bit 0 to 7 * - * @param v_gyro_highrate_y_durn_u8 : The value of gyro highrate y duration + * @param gyro_highrate_y_durn_u8 : The value of gyro highrate y duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate duration calculate by using the formula * - * (1 + v_gyro_highrate_y_durn_u8)*2.5ms + * (1 + gyro_highrate_y_durn_u8)*2.5ms */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_y_durn( -u8 *v_gyro_highrate_y_durn_u8); +u8 *gyro_highrate_y_durn_u8); /*! * @brief This API used to write gyro highrate y duration * from page one register from 0x1B bit 0 to 7 * - * @param v_gyro_highrate_y_durn_u8 : The value of gyro highrate y duration + * @param gyro_highrate_y_durn_u8 : The value of gyro highrate y duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate duration calculate by using the formula * - * (1 + v_gyro_highrate_y_durn_u8)*2.5ms + * (1 + gyro_highrate_y_durn_u8)*2.5ms */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_y_durn( -u8 v_gyro_highrate_y_durn_u8); +u8 gyro_highrate_y_durn_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO HIGHRATE Z THRESHOLD */ /**************************************************************/ @@ -7685,16 +7723,16 @@ u8 v_gyro_highrate_y_durn_u8); * @brief This API used to read gyro highrate z threshold * from page one register from 0x1C bit 0 to 4 * - * @param v_gyro_highrate_z_thres_u8 : The value of gyro highrate z threshold + * @param gyro_highrate_z_thres_u8 : The value of gyro highrate z threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate threshold dependent on the * selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 62.5dps | 1LSB * 1000 | 31.25dps | 1LSB @@ -7703,21 +7741,21 @@ u8 v_gyro_highrate_y_durn_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_z_thres( -u8 *v_gyro_highrate_z_thres_u8); +u8 *gyro_highrate_z_thres_u8); /*! * @brief This API used to write gyro highrate z threshold * from page one register from 0x1C bit 0 to 4 * - * @param v_gyro_highrate_z_thres_u8 : The value of gyro highrate z threshold + * @param gyro_highrate_z_thres_u8 : The value of gyro highrate z threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate threshold dependent on the * selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 62.5dps | 1LSB * 1000 | 31.25dps | 1LSB @@ -7726,7 +7764,7 @@ u8 *v_gyro_highrate_z_thres_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_z_thres( -u8 v_gyro_highrate_z_thres_u8); +u8 gyro_highrate_z_thres_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO HIGHRATE Z HYSTERESIS */ /**************************************************************/ @@ -7734,50 +7772,50 @@ u8 v_gyro_highrate_z_thres_u8); * @brief This API used to read gyro highrate z hysteresis * from page one register from 0x1C bit 5 to 6 * - * @param v_gyro_highrate_z_hyst_u8 : The value of gyro highrate z hysteresis + * @param gyro_highrate_z_hyst_u8 : The value of gyro highrate z hysteresis * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro high rate hysteresis calculated by * - * using this (255 + 256 * v_gyro_highrate_z_hyst_u8) *4 LSB + * using this (255 + 256 * gyro_highrate_z_hyst_u8) *4 LSB * * The high rate value scales with the range setting * - * v_gyro_range_u8 | hysteresis | LSB + * gyro_range_u8 | hysteresis | LSB * ----------------- | ------------- | --------- * 2000 | 62.26dps | 1LSB * 1000 | 31.13dps | 1LSB * 500 | 15.56dps | 1LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_z_hyst( -u8 *v_gyro_highrate_z_hyst_u8); +u8 *gyro_highrate_z_hyst_u8); /*! * @brief This API used to write gyro highrate z hysteresis * from page one register from 0x1C bit 5 to 6 * - * @param v_gyro_highrate_z_hyst_u8 : The value of gyro highrate z hysteresis + * @param gyro_highrate_z_hyst_u8 : The value of gyro highrate z hysteresis * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro high rate hysteresis calculated by * - * using this (255 + 256 * v_gyro_highrate_z_hyst_u8) *4 LSB + * using this (255 + 256 * gyro_highrate_z_hyst_u8) *4 LSB * * The high rate value scales with the range setting * - * v_gyro_range_u8 | hysteresis | LSB + * gyro_range_u8 | hysteresis | LSB * ----------------- | ------------- | --------- * 2000 | 62.26dps | 1LSB * 1000 | 31.13dps | 1LSB * 500 | 15.56dps | 1LSB */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_z_hyst( -u8 v_gyro_highrate_z_hyst_u8); +u8 gyro_highrate_z_hyst_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO HIGHRATE Z DURATION */ /**************************************************************/ @@ -7785,34 +7823,34 @@ u8 v_gyro_highrate_z_hyst_u8); * @brief This API used to read gyro highrate z duration * from page one register from 0x1D bit 0 to 7 * - * @param v_gyro_highrate_z_durn_u8 : The value of gyro highrate z duration + * @param gyro_highrate_z_durn_u8 : The value of gyro highrate z duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate duration calculate by using the formula * - * (1 + v_gyro_highrate_z_durn_u8)*2.5ms + * (1 + gyro_highrate_z_durn_u8)*2.5ms */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_highrate_z_durn( -u8 *v_gyro_highrate_z_durn_u8); +u8 *gyro_highrate_z_durn_u8); /*! * @brief This API used to write gyro highrate z duration * from page one register from 0x1D bit 0 to 7 * - * @param v_gyro_highrate_z_durn_u8 : The value of gyro highrate z duration + * @param gyro_highrate_z_durn_u8 : The value of gyro highrate z duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro highrate duration calculate by using the formula * - * (1 + v_gyro_highrate_z_durn_u8)*2.5ms + * (1 + gyro_highrate_z_durn_u8)*2.5ms */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_highrate_z_durn( -u8 v_gyro_highrate_z_durn_u8); +u8 gyro_highrate_z_durn_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO ANY_MOTION THRESHOLD */ /**************************************************************/ @@ -7820,16 +7858,16 @@ u8 v_gyro_highrate_z_durn_u8); * @brief This API used to read gyro anymotion threshold * from page one register from 0x1E bit 0 to 6 * - * @param v_gyro_any_motion_thres_u8 : The value of gyro anymotion threshold + * @param gyro_any_motion_thres_u8 : The value of gyro anymotion threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro anymotion interrupt threshold dependent * on the selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 1dps | 1LSB * 1000 | 0.5dps | 1LSB @@ -7837,21 +7875,21 @@ u8 v_gyro_highrate_z_durn_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_any_motion_thres( -u8 *v_gyro_any_motion_thres_u8); +u8 *gyro_any_motion_thres_u8); /*! * @brief This API used to write gyro anymotion threshold * from page one register from 0x1E bit 0 to 6 * - * @param v_gyro_any_motion_thres_u8 : The value of gyro anymotion threshold + * @param gyro_any_motion_thres_u8 : The value of gyro anymotion threshold * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * * @note Gyro anymotion interrupt threshold dependent * on the selection of gyro range * - * v_gyro_range_u8 | threshold | LSB + * gyro_range_u8 | threshold | LSB * ----------------- | ------------- | --------- * 2000 | 1dps | 1LSB * 1000 | 0.5dps | 1LSB @@ -7859,7 +7897,7 @@ u8 *v_gyro_any_motion_thres_u8); * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_any_motion_thres( -u8 v_gyro_any_motion_thres_u8); +u8 gyro_any_motion_thres_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO ANY_MOTION SLOPE SAMPLES */ /**************************************************************/ @@ -7867,9 +7905,9 @@ u8 v_gyro_any_motion_thres_u8); * @brief This API used to read gyro anymotion slope samples * from page one register from 0x1F bit 0 to 1 * - * @param v_gyro_any_motion_slope_samples_u8 : + * @param gyro_any_motion_slope_samples_u8 : * The value of gyro anymotion slope samples - * v_gyro_any_motion_slope_samples_u8 | result + * gyro_any_motion_slope_samples_u8 | result * ---------------------------------- | ----------- * 0 | 8 samples * 1 | 16 samples @@ -7877,32 +7915,32 @@ u8 v_gyro_any_motion_thres_u8); * 3 | 64 samples * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_any_motion_slope_samples( -u8 *v_gyro_any_motion_slope_samples_u8); +u8 *gyro_any_motion_slope_samples_u8); /*! * @brief This API used to write gyro anymotion slope samples * from page one register from 0x1F bit 0 to 1 * - * @param v_gyro_any_motion_slope_samples_u8 : + * @param gyro_any_motion_slope_samples_u8 : * The value of gyro anymotion slope samples - * v_gyro_any_motion_slope_samples_u8 | result - * ---------------------------------- | ----------- - * 0 | 8 samples - * 1 | 16 samples - * 2 | 32 samples - * 3 | 64 samples + * gyro_any_motion_slope_samples_u8 | result + * ---------------------------------- | ----------- + * 0 | 8 samples + * 1 | 16 samples + * 2 | 32 samples + * 3 | 64 samples * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_any_motion_slope_samples( -u8 v_gyro_any_motion_slope_samples_u8); +u8 gyro_any_motion_slope_samples_u8); /**************************************************************/ /**\name FUNCTIONS FOR GYRO ANY_MOTION AWAKE DURATION */ /**************************************************************/ @@ -7910,26 +7948,26 @@ u8 v_gyro_any_motion_slope_samples_u8); * @brief This API used to read gyro anymotion awake duration * from page one register from 0x1F bit 2 to 3 * - * @param v_gyro_awake_durn_u8 : The value of gyro anymotion awake duration + * @param gyro_awake_durn_u8 : The value of gyro anymotion awake duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_get_gyro_any_motion_awake_durn( -u8 *v_gyro_awake_durn_u8); +u8 *gyro_awake_durn_u8); /*! * @brief This API used to write gyro anymotion awake duration * from page one register from 0x1F bit 2 to 3 * - * @param v_gyro_awake_durn_u8 : The value of gyro anymotion awake duration + * @param gyro_awake_durn_u8 : The value of gyro anymotion awake duration * * @return results of bus communication function - * @retval 0 -> Success - * @retval 1 -> Error + * @retval 0 -> BNO055_SUCCESS + * @retval 1 -> BNO055_ERROR * */ BNO055_RETURN_FUNCTION_TYPE bno055_set_gyro_any_motion_awake_durn( -u8 v_gyro_awake_durn_u8); +u8 gyro_awake_durn_u8); #endif diff --git a/bno055_support.c b/bno055_support.c index 99e44d2..e808418 100644 --- a/bno055_support.c +++ b/bno055_support.c @@ -1,10 +1,10 @@ /* **************************************************************************** -* Copyright (C) 2014 Bosch Sensortec GmbH +* Copyright (C) 2015 - 2016 Bosch Sensortec GmbH * * bno055_support.c -* Date: 2014/12/12 -* Revision: 1.0.3 $ +* Date: 2016/03/14 +* Revision: 1.0.4 $ * * Usage: Sensor Driver support file for BNO055 sensor * @@ -55,24 +55,28 @@ #include "bno055.h" /*----------------------------------------------------------------------------* - * The following functions are used for reading and writing of + * The following APIs are used for reading and writing of * sensor data using I2C communication *----------------------------------------------------------------------------*/ #ifdef BNO055_API -/* \Brief: The function is used as I2C bus read +#define BNO055_I2C_BUS_WRITE_ARRAY_INDEX ((u8)1) +/* \Brief: The API is used as I2C bus read * \Return : Status of the I2C read * \param dev_addr : The device address of the sensor - * \param reg_addr : Address of the first register, will data is going to be read - * \param reg_data : This data read from the sensor, which is hold in an array + * \param reg_addr : Address of the first register, + * will data is going to be read + * \param reg_data : This data read from the sensor, + * which is hold in an array * \param cnt : The no of byte of data to be read */ s8 BNO055_I2C_bus_read(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt); -/* \Brief: The function is used as SPI bus write +/* \Brief: The API is used as SPI bus write * \Return : Status of the SPI write * \param dev_addr : The device address of the sensor - * \param reg_addr : Address of the first register, will data is going to be written + * \param reg_addr : Address of the first register, + * will data is going to be written * \param reg_data : It is a value hold in the array, - * will be used for write the value into the register + * will be used for write the value into the register * \param cnt : The no of byte of data to be write */ s8 BNO055_I2C_bus_write(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt); @@ -81,12 +85,12 @@ s8 BNO055_I2C_bus_write(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt); */ s8 I2C_routine(void); #endif -/********************End of I2C function declarations***********************/ +/********************End of I2C APIs declarations***********************/ /* Brief : The delay routine * \param : delay in ms */ void BNO055_delay_msek(u32 msek); -/* This function is an example for reading sensor data +/* This API is an example for reading sensor data * \param: None * \return: communication result */ @@ -102,7 +106,7 @@ s32 bno055_data_readout_template(void); * Chip id of the sensor: chip_id *---------------------------------------------------------------------------*/ struct bno055_t bno055; -/* This function is an example for reading sensor data +/* This API is an example for reading sensor data * \param: None * \return: communication result */ @@ -110,138 +114,142 @@ s32 bno055_data_readout_template(void) { /* Variable used to return value of communication routine*/ - s32 comres = ERROR; + s32 comres = BNO055_ERROR; /* variable used to set the power mode of the sensor*/ - u8 power_mode = BNO055_ZERO_U8X; + u8 power_mode = BNO055_INIT_VALUE; /*********read raw accel data***********/ /* variable used to read the accel x data */ - s16 accel_datax = BNO055_ZERO_U8X; + s16 accel_datax = BNO055_INIT_VALUE; /* variable used to read the accel y data */ - s16 accel_datay = BNO055_ZERO_U8X; + s16 accel_datay = BNO055_INIT_VALUE; /* variable used to read the accel z data */ - s16 accel_dataz = BNO055_ZERO_U8X; + s16 accel_dataz = BNO055_INIT_VALUE; /* variable used to read the accel xyz data */ struct bno055_accel_t accel_xyz; /*********read raw mag data***********/ /* variable used to read the mag x data */ - s16 mag_datax = BNO055_ZERO_U8X; + s16 mag_datax = BNO055_INIT_VALUE; /* variable used to read the mag y data */ - s16 mag_datay = BNO055_ZERO_U8X; + s16 mag_datay = BNO055_INIT_VALUE; /* variable used to read the mag z data */ - s16 mag_dataz = BNO055_ZERO_U8X; + s16 mag_dataz = BNO055_INIT_VALUE; /* structure used to read the mag xyz data */ struct bno055_mag_t mag_xyz; /***********read raw gyro data***********/ /* variable used to read the gyro x data */ - s16 gyro_datax = BNO055_ZERO_U8X; + s16 gyro_datax = BNO055_INIT_VALUE; /* variable used to read the gyro y data */ - s16 gyro_datay = BNO055_ZERO_U8X; + s16 gyro_datay = BNO055_INIT_VALUE; /* variable used to read the gyro z data */ - s16 gyro_dataz = BNO055_ZERO_U8X; + s16 gyro_dataz = BNO055_INIT_VALUE; /* structure used to read the gyro xyz data */ struct bno055_gyro_t gyro_xyz; /*************read raw Euler data************/ /* variable used to read the euler h data */ - s16 euler_data_h = BNO055_ZERO_U8X; + s16 euler_data_h = BNO055_INIT_VALUE; /* variable used to read the euler r data */ - s16 euler_data_r = BNO055_ZERO_U8X; + s16 euler_data_r = BNO055_INIT_VALUE; /* variable used to read the euler p data */ - s16 euler_data_p = BNO055_ZERO_U8X; + s16 euler_data_p = BNO055_INIT_VALUE; /* structure used to read the euler hrp data */ struct bno055_euler_t euler_hrp; /************read raw quaternion data**************/ /* variable used to read the quaternion w data */ - s16 quaternion_data_w = BNO055_ZERO_U8X; + s16 quaternion_data_w = BNO055_INIT_VALUE; /* variable used to read the quaternion x data */ - s16 quaternion_data_x = BNO055_ZERO_U8X; + s16 quaternion_data_x = BNO055_INIT_VALUE; /* variable used to read the quaternion y data */ - s16 quaternion_data_y = BNO055_ZERO_U8X; + s16 quaternion_data_y = BNO055_INIT_VALUE; /* variable used to read the quaternion z data */ - s16 quaternion_data_z = BNO055_ZERO_U8X; + s16 quaternion_data_z = BNO055_INIT_VALUE; /* structure used to read the quaternion wxyz data */ struct bno055_quaternion_t quaternion_wxyz; /************read raw linear acceleration data***********/ /* variable used to read the linear accel x data */ - s16 linear_accel_data_x = BNO055_ZERO_U8X; + s16 linear_accel_data_x = BNO055_INIT_VALUE; /* variable used to read the linear accel y data */ - s16 linear_accel_data_y = BNO055_ZERO_U8X; + s16 linear_accel_data_y = BNO055_INIT_VALUE; /* variable used to read the linear accel z data */ - s16 linear_accel_data_z = BNO055_ZERO_U8X; + s16 linear_accel_data_z = BNO055_INIT_VALUE; /* structure used to read the linear accel xyz data */ struct bno055_linear_accel_t linear_acce_xyz; /*****************read raw gravity sensor data****************/ /* variable used to read the gravity x data */ - s16 gravity_data_x = BNO055_ZERO_U8X; + s16 gravity_data_x = BNO055_INIT_VALUE; /* variable used to read the gravity y data */ - s16 gravity_data_y = BNO055_ZERO_U8X; + s16 gravity_data_y = BNO055_INIT_VALUE; /* variable used to read the gravity z data */ - s16 gravity_data_z = BNO055_ZERO_U8X; + s16 gravity_data_z = BNO055_INIT_VALUE; /* structure used to read the gravity xyz data */ struct bno055_gravity_t gravity_xyz; /*************read accel converted data***************/ /* variable used to read the accel x data output as m/s2 or mg */ - double d_accel_datax = BNO055_ZERO_U8X; + double d_accel_datax = BNO055_INIT_VALUE; /* variable used to read the accel y data output as m/s2 or mg */ - double d_accel_datay = BNO055_ZERO_U8X; + double d_accel_datay = BNO055_INIT_VALUE; /* variable used to read the accel z data output as m/s2 or mg */ - double d_accel_dataz = BNO055_ZERO_U8X; + double d_accel_dataz = BNO055_INIT_VALUE; /* structure used to read the accel xyz data output as m/s2 or mg */ struct bno055_accel_double_t d_accel_xyz; /******************read mag converted data********************/ /* variable used to read the mag x data output as uT*/ - double d_mag_datax = BNO055_ZERO_U8X; + double d_mag_datax = BNO055_INIT_VALUE; /* variable used to read the mag y data output as uT*/ - double d_mag_datay = BNO055_ZERO_U8X; + double d_mag_datay = BNO055_INIT_VALUE; /* variable used to read the mag z data output as uT*/ - double d_mag_dataz = BNO055_ZERO_U8X; + double d_mag_dataz = BNO055_INIT_VALUE; /* structure used to read the mag xyz data output as uT*/ struct bno055_mag_double_t d_mag_xyz; /*****************read gyro converted data************************/ /* variable used to read the gyro x data output as dps or rps */ - double d_gyro_datax = BNO055_ZERO_U8X; + double d_gyro_datax = BNO055_INIT_VALUE; /* variable used to read the gyro y data output as dps or rps */ - double d_gyro_datay = BNO055_ZERO_U8X; + double d_gyro_datay = BNO055_INIT_VALUE; /* variable used to read the gyro z data output as dps or rps */ - double d_gyro_dataz = BNO055_ZERO_U8X; + double d_gyro_dataz = BNO055_INIT_VALUE; /* structure used to read the gyro xyz data output as dps or rps */ struct bno055_gyro_double_t d_gyro_xyz; /*******************read euler converted data*******************/ - /* variable used to read the euler h data output as degree or radians */ - double d_euler_data_h = BNO055_ZERO_U8X; - /* variable used to read the euler r data output as degree or radians */ - double d_euler_data_r = BNO055_ZERO_U8X; - /* variable used to read the euler p data output as degree or radians */ - double d_euler_data_p = BNO055_ZERO_U8X; - /* structure used to read the euler hrp data output as as degree or radians */ + /* variable used to read the euler h data output + as degree or radians*/ + double d_euler_data_h = BNO055_INIT_VALUE; + /* variable used to read the euler r data output + as degree or radians*/ + double d_euler_data_r = BNO055_INIT_VALUE; + /* variable used to read the euler p data output + as degree or radians*/ + double d_euler_data_p = BNO055_INIT_VALUE; + /* structure used to read the euler hrp data output + as as degree or radians */ struct bno055_euler_double_t d_euler_hpr; - /*********************read linear acceleration converted data*************************/ + /*********read linear acceleration converted data**********/ /* variable used to read the linear accel x data output as m/s2*/ - double d_linear_accel_datax = BNO055_ZERO_U8X; + double d_linear_accel_datax = BNO055_INIT_VALUE; /* variable used to read the linear accel y data output as m/s2*/ - double d_linear_accel_datay = BNO055_ZERO_U8X; + double d_linear_accel_datay = BNO055_INIT_VALUE; /* variable used to read the linear accel z data output as m/s2*/ - double d_linear_accel_dataz = BNO055_ZERO_U8X; + double d_linear_accel_dataz = BNO055_INIT_VALUE; /* structure used to read the linear accel xyz data output as m/s2*/ struct bno055_linear_accel_double_t d_linear_accel_xyz; - /********************Gravity converted data*****************************/ + /********************Gravity converted data**********************/ /* variable used to read the gravity sensor x data output as m/s2*/ - double d_gravity_data_x = BNO055_ZERO_U8X; + double d_gravity_data_x = BNO055_INIT_VALUE; /* variable used to read the gravity sensor y data output as m/s2*/ - double d_gravity_data_y = BNO055_ZERO_U8X; + double d_gravity_data_y = BNO055_INIT_VALUE; /* variable used to read the gravity sensor z data output as m/s2*/ - double d_gravity_data_z = BNO055_ZERO_U8X; + double d_gravity_data_z = BNO055_INIT_VALUE; /* structure used to read the gravity xyz data output as m/s2*/ struct bno055_gravity_double_t d_gravity_xyz; /*---------------------------------------------------------------------------* @@ -250,10 +258,10 @@ s32 bno055_data_readout_template(void) #ifdef BNO055_API /* Based on the user need configure I2C interface. * It is example code to explain how to use the bno055 API*/ - I2C_routine(); + I2C_routine(); #endif /*--------------------------------------------------------------------------* - * This function used to assign the value/reference of + * This API used to assign the value/reference of * the following parameters * I2C address * Bus Write @@ -274,11 +282,12 @@ s32 bno055_data_readout_template(void) Page - page0 register - 0x3E bit positions - 0 and 1*/ - power_mode = POWER_MODE_NORMAL; /* set the power mode as NORMAL*/ + power_mode = BNO055_POWER_MODE_NORMAL; + /* set the power mode as NORMAL*/ comres += bno055_set_power_mode(power_mode); -/*--------------------------------------------------------------------------* +/*----------------------------------------------------------------* ************************* END INITIALIZATION ************************* -*---------------------------------------------------------------------------*/ +*-----------------------------------------------------------------*/ /************************* START READ RAW SENSOR DATA****************/ @@ -301,15 +310,15 @@ s32 bno055_data_readout_template(void) bit - 0 to 3 for sensor data read following operation mode have to set * SENSOR MODE - *0x01 - OPERATION_MODE_ACCONLY - *0x02 - OPERATION_MODE_MAGONLY - *0x03 - OPERATION_MODE_GYRONLY - *0x04 - OPERATION_MODE_ACCMAG - *0x05 - OPERATION_MODE_ACCGYRO - *0x06 - OPERATION_MODE_MAGGYRO - *0x07 - OPERATION_MODE_AMG + *0x01 - BNO055_OPERATION_MODE_ACCONLY + *0x02 - BNO055_OPERATION_MODE_MAGONLY + *0x03 - BNO055_OPERATION_MODE_GYRONLY + *0x04 - BNO055_OPERATION_MODE_ACCMAG + *0x05 - BNO055_OPERATION_MODE_ACCGYRO + *0x06 - BNO055_OPERATION_MODE_MAGGYRO + *0x07 - BNO055_OPERATION_MODE_AMG based on the user need configure the operation mode*/ - comres += bno055_set_operation_mode(OPERATION_MODE_AMG); + comres += bno055_set_operation_mode(BNO055_OPERATION_MODE_AMG); /* Raw accel X, Y and Z data can read from the register page - page 0 register - 0x08 to 0x0D*/ @@ -335,7 +344,7 @@ s32 bno055_data_readout_template(void) /************************* END READ RAW SENSOR DATA****************/ /************************* START READ RAW FUSION DATA ******** - For reading fusion data it is required to set the + For reading fusion data it is required to set the operation modes of the sensor operation mode can set from the register page - page0 @@ -343,13 +352,13 @@ s32 bno055_data_readout_template(void) bit - 0 to 3 for sensor data read following operation mode have to set *FUSION MODE - *0x08 - OPERATION_MODE_IMUPLUS - *0x09 - OPERATION_MODE_COMPASS - *0x0A - OPERATION_MODE_M4G - *0x0B - OPERATION_MODE_NDOF_FMC_OFF - *0x0C - OPERATION_MODE_NDOF + *0x08 - BNO055_OPERATION_MODE_IMUPLUS + *0x09 - BNO055_OPERATION_MODE_COMPASS + *0x0A - BNO055_OPERATION_MODE_M4G + *0x0B - BNO055_OPERATION_MODE_NDOF_FMC_OFF + *0x0C - BNO055_OPERATION_MODE_NDOF based on the user need configure the operation mode*/ - comres += bno055_set_operation_mode(OPERATION_MODE_NDOF); + comres += bno055_set_operation_mode(BNO055_OPERATION_MODE_NDOF); /* Raw Euler H, R and P data can read from the register page - page 0 register - 0x1A to 0x1E */ @@ -424,10 +433,14 @@ s32 bno055_data_readout_template(void) /* API used to read Linear acceleration data output as m/s2 float functions also available in the BNO055 API */ - comres += bno055_convert_double_linear_accel_x_msq(&d_linear_accel_datax); - comres += bno055_convert_double_linear_accel_y_msq(&d_linear_accel_datay); - comres += bno055_convert_double_linear_accel_z_msq(&d_linear_accel_dataz); - comres += bno055_convert_double_linear_accel_xyz_msq(&d_linear_accel_xyz); + comres += bno055_convert_double_linear_accel_x_msq( + &d_linear_accel_datax); + comres += bno055_convert_double_linear_accel_y_msq( + &d_linear_accel_datay); + comres += bno055_convert_double_linear_accel_z_msq( + &d_linear_accel_dataz); + comres += bno055_convert_double_linear_accel_xyz_msq( + &d_linear_accel_xyz); /* API used to read Gravity sensor data output as m/s2 float functions also available in the BNO055 API */ @@ -438,13 +451,14 @@ s32 bno055_data_readout_template(void) /*-----------------------------------------------------------------------* ************************* START DE-INITIALIZATION *********************** *-------------------------------------------------------------------------*/ -/* For de - initializing the BNO sensor it is required to the operation mode - of the sensor as SUSPEND +/* For de - initializing the BNO sensor it is required + to the operation mode of the sensor as SUSPEND Suspend mode can set from the register Page - page0 register - 0x3E bit positions - 0 and 1*/ - power_mode = POWER_MODE_SUSPEND; /* set the power mode as SUSPEND*/ + power_mode = BNO055_POWER_MODE_SUSPEND; + /* set the power mode as SUSPEND*/ comres += bno055_set_power_mode(power_mode); /*---------------------------------------------------------------------* @@ -455,7 +469,7 @@ return comres; #ifdef BNO055_API /*--------------------------------------------------------------------------* -* The following function is used to map the I2C bus read, write, delay and +* The following API is used to map the I2C bus read, write, delay and * device address with global structure bno055_t *-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------* @@ -465,14 +479,14 @@ return comres; * Delay function pointer: delay_msec * I2C address: dev_addr *--------------------------------------------------------------------------*/ - s8 I2C_routine(void) { - +s8 I2C_routine(void) +{ bno055.bus_write = BNO055_I2C_bus_write; bno055.bus_read = BNO055_I2C_bus_read; bno055.delay_msec = BNO055_delay_msek; bno055.dev_addr = BNO055_I2C_ADDR1; - return BNO055_ZERO_U8X; + return BNO055_INIT_VALUE; } /************** I2C buffer length******/ @@ -485,69 +499,77 @@ return comres; * Use either I2C based on your need * The device address defined in the bno055.h file * -*-----------------------------------------------------------------------*/ +*--------------------------------------------------------------------*/ -/* \Brief: The function is used as I2C bus write +/* \Brief: The API is used as I2C bus write * \Return : Status of the I2C write * \param dev_addr : The device address of the sensor - * \param reg_addr : Address of the first register, will data is going to be written + * \param reg_addr : Address of the first register, + * will data is going to be written * \param reg_data : It is a value hold in the array, * will be used for write the value into the register * \param cnt : The no of byte of data to be write */ s8 BNO055_I2C_bus_write(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt) { - s32 iError = BNO055_ZERO_U8X; + s32 BNO055_iERROR = BNO055_INIT_VALUE; u8 array[I2C_BUFFER_LEN]; - u8 stringpos = BNO055_ZERO_U8X; - array[BNO055_ZERO_U8X;] = reg_addr; - for (stringpos = BNO055_ZERO_U8X; stringpos < cnt; stringpos++) { - array[stringpos + BNO055_ONE_U8X] = *(reg_data + stringpos); + u8 stringpos = BNO055_INIT_VALUE; + + array[BNO055_INIT_VALUE] = reg_addr; + for (stringpos = BNO055_INIT_VALUE; stringpos < cnt; stringpos++) + array[stringpos + BNO055_I2C_BUS_WRITE_ARRAY_INDEX] = + *(reg_data + stringpos); } /* - * Please take the below function as your reference for + * Please take the below APIs as your reference for * write the data using I2C communication - * "IERROR = I2C_WRITE_STRING(DEV_ADDR, ARRAY, CNT+1)" - * add your I2C write function here - * iError is an return value of I2C read function + * "BNO055_iERROR = I2C_WRITE_STRING(DEV_ADDR, ARRAY, CNT+1)" + * add your I2C write APIs here + * BNO055_iERROR is an return value of I2C read API * Please select your valid return value - * In the driver SUCCESS defined as 0 + * In the driver BNO055_SUCCESS defined as 0 * and FAILURE defined as -1 * Note : * This is a full duplex operation, * The first read data is discarded, for that extra write operation - * have to be initiated. For that cnt+1 operation done in the I2C write string function + * have to be initiated. For that cnt+1 operation done + * in the I2C write string function * For more information please refer data sheet SPI communication: */ - return (s8)iError; + return (s8)BNO055_iERROR; } - /* \Brief: The function is used as I2C bus read + /* \Brief: The API is used as I2C bus read * \Return : Status of the I2C read * \param dev_addr : The device address of the sensor - * \param reg_addr : Address of the first register, will data is going to be read - * \param reg_data : This data read from the sensor, which is hold in an array + * \param reg_addr : Address of the first register, + * will data is going to be read + * \param reg_data : This data read from the sensor, + * which is hold in an array * \param cnt : The no of byte of data to be read */ s8 BNO055_I2C_bus_read(u8 dev_addr, u8 reg_addr, u8 *reg_data, u8 cnt) { - s32 iError = BNO055_ZERO_U8X; - u8 array[I2C_BUFFER_LEN] = {BNO055_ZERO_U8X;}; - u8 stringpos = BNO055_ZERO_U8X; - array[BNO055_ZERO_U8X;] = reg_addr; - /* Please take the below function as your reference + s32 BNO055_iERROR = BNO055_INIT_VALUE; + u8 array[I2C_BUFFER_LEN] = {BNO055_INIT_VALUE}; + u8 stringpos = BNO055_INIT_VALUE; + + array[BNO055_INIT_VALUE] = reg_addr; + + /* Please take the below API as your reference * for read the data using I2C communication - * add your I2C rad function here. - * "IERROR = I2C_WRITE_READ_STRING(DEV_ADDR, ARRAY, ARRAY, 1, CNT)" - * iError is an return value of SPI write function + * add your I2C read API here. + * "BNO055_iERROR = I2C_WRITE_READ_STRING(DEV_ADDR, + * ARRAY, ARRAY, 1, CNT)" + * BNO055_iERROR is an return value of SPI write API * Please select your valid return value - * In the driver SUCCESS defined as 0 + * In the driver BNO055_SUCCESS defined as 0 * and FAILURE defined as -1 */ - for (stringpos = BNO055_ZERO_U8X; stringpos < cnt; stringpos++) { + for (stringpos = BNO055_INIT_VALUE; stringpos < cnt; stringpos++) *(reg_data + stringpos) = array[stringpos]; - } - return (s8)iError; + return (s8)BNO055_iERROR; } /* Brief : The delay routine * \param : delay in ms