FXLS896xAF library: fxls896xaf_disable_interrupt() uses wrong register?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

FXLS896xAF library: fxls896xaf_disable_interrupt() uses wrong register?

1,111 Views
andrewneil
Contributor III

The function uses the SENS_CONFIG4 register:

uint8_t fxls896xaf_disable_interrupt(fxls896xaf_driver_t *pDriver, fxls896xaf_interrupt_source_t intSource)
{
    if(NULL == pDriver)
	{
		return SENSOR_INVALIDPARAM_ERR;
	}
	uint8_t ctrlReg;
	uint8_t status = SENSOR_SUCCESS;
	status = sensor_comm_read(&pDriver->comHandle, FXLS896xAF_SENS_CONFIG4, 1, &ctrlReg);
	if(status != SENSOR_SUCCESS)
	{
	    return status;
	}
	ctrlReg &= ~intSource;
	// disable the interrupt sources configured
	status = sensor_comm_write(&pDriver->comHandle, FXLS896xAF_SENS_CONFIG4, 1, &ctrlReg);
	if(status != SENSOR_SUCCESS)
	{
	    return status;
	}
    return status;
}

 

But, surely, SENS_CONFIG4 is the wrong register - it should be INT_EN ?

Also, the header comment has the wrong parameter descriptions (copy-paste error):

/*! @brief       The interface function to disable specified interrupt source/sources 
 *  @details     This function allow the disable the multiple source using single call.
 *  @Param[in]   pDriver - Pointer to the driver. 
 *  @Param[in]   ODR - ODR to be configured 
 *  @Param[in]   pConfig, the pointer to the acceleration configuration.
 *  @return      returns the status of the operation.
 */
uint8_t fxls896xaf_disable_interrupt(fxls896xaf_driver_t *pDriver, fxls896xaf_interrupt_source_t intSource);

 

Labels (1)
0 Kudos
0 Replies
%3CLINGO-SUB%20id%3D%22lingo-sub-1789691%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EFXLS896xAF%20library%3A%20fxls896xaf_disable_interrupt()%20uses%20wrong%20register%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1789691%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThe%20function%20uses%20the%26nbsp%3BSENS_CONFIG4%20register%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Euint8_t%20fxls896xaf_disable_interrupt(fxls896xaf_driver_t%20*pDriver%2C%20fxls896xaf_interrupt_source_t%20intSource)%0A%7B%0A%20%20%20%20if(NULL%20%3D%3D%20pDriver)%0A%09%7B%0A%09%09return%20SENSOR_INVALIDPARAM_ERR%3B%0A%09%7D%0A%09uint8_t%20ctrlReg%3B%0A%09uint8_t%20status%20%3D%20SENSOR_SUCCESS%3B%0A%09status%20%3D%20sensor_comm_read(%26amp%3BpDriver-%26gt%3BcomHandle%2C%20FXLS896xAF_SENS_CONFIG4%2C%201%2C%20%26amp%3BctrlReg)%3B%0A%09if(status%20!%3D%20SENSOR_SUCCESS)%0A%09%7B%0A%09%20%20%20%20return%20status%3B%0A%09%7D%0A%09ctrlReg%20%26amp%3B%3D%20~intSource%3B%0A%09%2F%2F%20disable%20the%20interrupt%20sources%20configured%0A%09status%20%3D%20sensor_comm_write(%26amp%3BpDriver-%26gt%3BcomHandle%2C%20FXLS896xAF_SENS_CONFIG4%2C%201%2C%20%26amp%3BctrlReg)%3B%0A%09if(status%20!%3D%20SENSOR_SUCCESS)%0A%09%7B%0A%09%20%20%20%20return%20status%3B%0A%09%7D%0A%20%20%20%20return%20status%3B%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3EBut%2C%20surely%2C%20SENS_CONFIG4%20is%20the%20wrong%20register%20-%20it%20should%20be%20INT_EN%20%3F%3C%2FP%3E%3CP%3EAlso%2C%20the%20header%20comment%20has%20the%20wrong%20parameter%20descriptions%20(copy-paste%20error)%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%2F*!%20%40brief%20%20%20%20%20%20%20The%20interface%20function%20to%20disable%20specified%20interrupt%20source%2Fsources%20%0A%20*%20%20%40details%20%20%20%20%20This%20function%20allow%20the%20disable%20the%20multiple%20source%20using%20single%20call.%0A%20*%20%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F197964%22%20target%3D%22_blank%22%3E%40Param%3C%2FA%3E%5Bin%5D%20%20%20pDriver%20-%20Pointer%20to%20the%20driver.%20%0A%20*%20%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F197964%22%20target%3D%22_blank%22%3E%40Param%3C%2FA%3E%5Bin%5D%20%20%20ODR%20-%20ODR%20to%20be%20configured%20%0A%20*%20%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F197964%22%20target%3D%22_blank%22%3E%40Param%3C%2FA%3E%5Bin%5D%20%20%20pConfig%2C%20the%20pointer%20to%20the%20acceleration%20configuration.%0A%20*%20%20%40return%20%20%20%20%20%20returns%20the%20status%20of%20the%20operation.%0A%20*%2F%0Auint8_t%20fxls896xaf_disable_interrupt(fxls896xaf_driver_t%20*pDriver%2C%20fxls896xaf_interrupt_source_t%20intSource)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1789691%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EAccelerometers%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E