Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Data-Ready (DRDY) Register addresses for > v3.14 #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions bno055.c
Original file line number Diff line number Diff line change
Expand Up @@ -14458,6 +14458,132 @@ BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_mask_accel_no_motion(u8 accel_nomoti
return com_rslt;
}

/*!
* @brief This API used to write the Accelerometer Data-Ready interrupt
* from page one register from 0x10 bit 0
* *
* @param intrmask_u8 : Mask of interrupts to enable:
* - BNO055_ACC_BSX_DRDY_INTR_MSK
* - BNO055_MAG_DRDY_INTR_MSK
* - BNO055_GYRO_ANY_MOTION_INTR_MSK
* - BNO055_GYRO_HIGHRATE_INTR_MSK
* - BNO055_GYR_DRDY_INTR_MSK
* - BNO055_ACCEL_HIGH_G_INTR_MSK
* - BNO055_ACCEL_ANY_MOTION_INTR_MSK
* - BNO055_ACCEL_NO_MOTION_INTR_MSK
*
* @return results of bus communication function
* @retval 0 -> BNO055_SUCCESS
* @retval 1 -> BNO055_ERROR
*/
BNO055_RETURN_FUNCTION_TYPE bno055_enable_intr( u8 intrmask_u8 )
{
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 == NULL )
{
return BNO055_E_NULL_PTR;
}
else
{
/*condition check for page, Accelerometer Data-Ready interrupt is
* available in the page one*/
if( p_bno055->page_id != BNO055_PAGE_ONE )
{
/* Write page as 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 Accelerometer Data-Ready interrupt */
com_rslt = p_bno055->BNO055_BUS_READ_FUNC( p_bno055->dev_addr,
BNO055_INT_ADDR,
&data_u8r,
BNO055_GEN_READ_WRITE_LENGTH );
if( com_rslt == BNO055_SUCCESS )
{
data_u8r |= intrmask_u8;
com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC( p_bno055->dev_addr,
BNO055_INT_ADDR,
&data_u8r,
BNO055_GEN_READ_WRITE_LENGTH );
}
}
else
{
com_rslt = BNO055_ERROR;
}
}

return com_rslt;
}

/*!
* @brief This API used to write the Accelerometer Data-Ready interrupt
* from page one register from 0x10 bit 0
* *
* @param intrmask_u8 : Mask of interrupts to disable:
* - BNO055_ACC_BSX_DRDY_INTR_MSK
* - BNO055_MAG_DRDY_INTR_MSK
* - BNO055_GYRO_ANY_MOTION_INTR_MSK
* - BNO055_GYRO_HIGHRATE_INTR_MSK
* - BNO055_GYR_DRDY_INTR_MSK
* - BNO055_ACCEL_HIGH_G_INTR_MSK
* - BNO055_ACCEL_ANY_MOTION_INTR_MSK
* - BNO055_ACCEL_NO_MOTION_INTR_MSK
*
* @return results of bus communication function
* @retval 0 -> BNO055_SUCCESS
* @retval 1 -> BNO055_ERROR
*/
BNO055_RETURN_FUNCTION_TYPE bno055_disable_intr( u8 intrmask_u8 )
{
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 == NULL )
{
return BNO055_E_NULL_PTR;
}
else
{
/*condition check for page, Accelerometer Data-Ready interrupt is
* available in the page one*/
if( p_bno055->page_id != BNO055_PAGE_ONE )
{
/* Write page as 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 Accelerometer Data-Ready interrupt */
com_rslt = p_bno055->BNO055_BUS_READ_FUNC( p_bno055->dev_addr,
BNO055_INT_ADDR,
&data_u8r,
BNO055_GEN_READ_WRITE_LENGTH );
if( com_rslt == BNO055_SUCCESS )
{
data_u8r &= ~intrmask_u8;
com_rslt += p_bno055->BNO055_BUS_WRITE_FUNC( p_bno055->dev_addr,
BNO055_INT_ADDR,
&data_u8r,
BNO055_GEN_READ_WRITE_LENGTH );
}
}
else
{
com_rslt = BNO055_ERROR;
}
}

return com_rslt;
}

/*!
* @brief This API used to read the gyro anymotion interrupt
* from page one register from 0x10 bit 2
Expand Down
96 changes: 96 additions & 0 deletions bno055.h
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,19 @@ struct bno055_sic_matrix_t
#define BNO055_SELFTEST_MCU_REG BNO055_SELFTEST_RESULT_ADDR

/*Interrupt status registers*/

/* @note Firmware >v3.14 */
#define BNO055_INTR_STAT_ACC_BSX_DRDY_POS (0)
#define BNO055_INTR_STAT_ACC_BSX_DRDY_MSK (0X01)
#define BNO055_INTR_STAT_ACC_BSX_DRDY_LEN (1)
#define BNO055_INTR_STAT_ACC_BSX_DRDY_REG BNO055_INTR_STAT_ADDR

/* @note Firmware >v3.14 */
#define BNO055_INTR_STAT_MAG_DRDY_POS (1)
#define BNO055_INTR_STAT_MAG_DRDY_MSK (0X02)
#define BNO055_INTR_STAT_MAG_DRDY_LEN (1)
#define BNO055_INTR_STAT_MAG_DRDY_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)
Expand All @@ -1512,6 +1525,12 @@ struct bno055_sic_matrix_t
#define BNO055_INTR_STAT_GYRO_HIGHRATE_LEN (1)
#define BNO055_INTR_STAT_GYRO_HIGHRATE_REG BNO055_INTR_STAT_ADDR

/* @note Firmware >v3.14 */
#define BNO055_INTR_STAT_GYR_DRDY_POS (4)
#define BNO055_INTR_STAT_GYR_DRDY_MSK (0X10)
#define BNO055_INTR_STAT_GYR_DRDY_LEN (1)
#define BNO055_INTR_STAT_GYR_DRDY_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)
Expand Down Expand Up @@ -1946,6 +1965,18 @@ struct bno055_sic_matrix_t
#define BNO055_MAG_SLEEP_DURN_REG BNO055_MAG_SLEEP_CONFIG_ADDR

/* Interrupt registers*/
/* Accelerometer Data-Ready interrupt msk register @note Firmware >v3.14 */
#define BNO055_ACC_BSX_DRDY_INTR_MASK_POS (0)
#define BNO055_ACC_BSX_DRDY_INTR_MASK_MSK (0X01)
#define BNO055_ACC_BSX_DRDY_INTR_MASK_LEN (1)
#define BNO055_ACC_BSX_DRDY_INTR_MASK_REG BNO055_INT_MASK_ADDR

/* Magnetometer Data-Ready interrupt msk register @note Firmware >v3.14 */
#define BNO055_MAG_DRDY_INTR_MASK_POS (1)
#define BNO055_MAG_DRDY_INTR_MASK_MSK (0X02)
#define BNO055_MAG_DRDY_INTR_MASK_LEN (1)
#define BNO055_MAG_DRDY_INTR_MASK_REG BNO055_INT_MASK_ADDR

/* Gyro any motion interrupt msk register*/
#define BNO055_GYRO_ANY_MOTION_INTR_MASK_POS (2)
#define BNO055_GYRO_ANY_MOTION_INTR_MASK_MSK (0X04)
Expand All @@ -1958,6 +1989,12 @@ struct bno055_sic_matrix_t
#define BNO055_GYRO_HIGHRATE_INTR_MASK_LEN (1)
#define BNO055_GYRO_HIGHRATE_INTR_MASK_REG BNO055_INT_MASK_ADDR

/* Magnetometer Data-Ready interrupt msk register @note Firmware >v3.14 */
#define BNO055_GYR_DRDY_INTR_MASK_POS (4)
#define BNO055_GYR_DRDY_INTR_MASK_MSK (0X10)
#define BNO055_GYR_DRDY_INTR_MASK_LEN (1)
#define BNO055_GYR_DRDY_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)
Expand All @@ -1976,6 +2013,18 @@ struct bno055_sic_matrix_t
#define BNO055_ACCEL_NO_MOTION_INTR_MASK_LEN (1)
#define BNO055_ACCEL_NO_MOTION_INTR_MASK_REG BNO055_INT_MASK_ADDR

/* Accelerometer Data-Ready interrupt register @note Firmware >v3.14 */
#define BNO055_ACC_BSX_DRDY_INTR_POS (0)
#define BNO055_ACC_BSX_DRDY_INTR_MSK (0X01)
#define BNO055_ACC_BSX_DRDY_INTR_LEN (1)
#define BNO055_ACC_BSX_DRDY_INTR_REG BNO055_INT_ADDR

/* Magnetometer Data-Ready interrupt register @note Firmware >v3.14*/
#define BNO055_MAG_DRDY_INTR_POS (1)
#define BNO055_MAG_DRDY_INTR_MSK (0X02)
#define BNO055_MAG_DRDY_INTR_LEN (1)
#define BNO055_MAG_DRDY_INTR_REG BNO055_INT_ADDR

/* Gyro any motion interrupt register*/
#define BNO055_GYRO_ANY_MOTION_INTR_POS (2)
#define BNO055_GYRO_ANY_MOTION_INTR_MSK (0X04)
Expand All @@ -1988,6 +2037,12 @@ struct bno055_sic_matrix_t
#define BNO055_GYRO_HIGHRATE_INTR_LEN (1)
#define BNO055_GYRO_HIGHRATE_INTR_REG BNO055_INT_ADDR

/* Gyro Data-Ready interrupt register @note Firmware >v3.14*/
#define BNO055_GYR_DRDY_INTR_POS (4)
#define BNO055_GYR_DRDY_INTR_MSK (0X10)
#define BNO055_GYR_DRDY_INTR_LEN (1)
#define BNO055_GYR_DRDY_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)
Expand Down Expand Up @@ -6607,6 +6662,47 @@ BNO055_RETURN_FUNCTION_TYPE bno055_get_intr_mask_accel_no_motion(u8 *accel_nomot
*/
BNO055_RETURN_FUNCTION_TYPE bno055_set_intr_mask_accel_no_motion(u8 accel_nomotion_u8);


/*!
* @brief This API used to write the Accelerometer Data-Ready interrupt
* from page one register from 0x10 bit 0
* *
* @param intrmask_u8 : Mask of interrupts to enable:
* - BNO055_ACC_BSX_DRDY_INTR_MSK
* - BNO055_MAG_DRDY_INTR_MSK
* - BNO055_GYRO_ANY_MOTION_INTR_MSK
* - BNO055_GYRO_HIGHRATE_INTR_MSK
* - BNO055_GYR_DRDY_INTR_MSK
* - BNO055_ACCEL_HIGH_G_INTR_MSK
* - BNO055_ACCEL_ANY_MOTION_INTR_MSK
* - BNO055_ACCEL_NO_MOTION_INTR_MSK
*
* @return results of bus communication function
* @retval 0 -> BNO055_SUCCESS
* @retval 1 -> BNO055_ERROR
*/
BNO055_RETURN_FUNCTION_TYPE bno055_enable_intr( u8 intrmask_u8 );

/*!
* @brief This API used to write the Accelerometer Data-Ready interrupt
* from page one register from 0x10 bit 0
* *
* @param intrmask_u8 : Mask of interrupts to disable:
* - BNO055_ACC_BSX_DRDY_INTR_MSK
* - BNO055_MAG_DRDY_INTR_MSK
* - BNO055_GYRO_ANY_MOTION_INTR_MSK
* - BNO055_GYRO_HIGHRATE_INTR_MSK
* - BNO055_GYR_DRDY_INTR_MSK
* - BNO055_ACCEL_HIGH_G_INTR_MSK
* - BNO055_ACCEL_ANY_MOTION_INTR_MSK
* - BNO055_ACCEL_NO_MOTION_INTR_MSK
*
* @return results of bus communication function
* @retval 0 -> BNO055_SUCCESS
* @retval 1 -> BNO055_ERROR
*/
BNO055_RETURN_FUNCTION_TYPE bno055_disable_intr( u8 intrmask_u8 );

/*****************************************************/
/**\name FUNCTIONS FOR GYRO INTERRUPT */
/*****************************************************/
Expand Down