Hello I am working the BMA400 accelerometer. I have been using the BMA400 API on Git (https://github.com/BoschSensortec/BMA400-API) as reference point. I have run into an issue regarding the null_ptr_check() function. Below is an example.
I figured this function is suppose to check if any (or some )of "dev"'s parameters are NULL. If it succeeds it will return BMA400_OK. However, when I run this the return is -1 or BMA400_E_NULL_PTR.
I guess I did something wrong in the interface setting for the BMA400, but I am not sure. My set_interface function looks like the last picture. I assume that the function pointers for dev->read and dev->write should be replaced with my I2C functions. And the example on Git had dev->delay_ms pointing to a delay function too. I took that out and replaced the calls in the API with _delay_ms from util/delay. I think that's okay though. I am pretty sure the I2C read/write commands work, I just don't know why the null_ptr_check fails.
I appriecate any help!
Solved! Go to Solution.
Thanks for replying BSTRobin,
I have defined the structures for the bma400 like this above main().
I don't know if it cannot be done this way. I assume you can create the instances like this.