I'm trying to understand how to handle error codes from the twi driver at the moment. When I hold my I2C slave in reset and try to configure it nrf_drv_twi_tx() returns 0x8201 which I was able to figure out how to decode by looking through the sdk_errors.h file. However, I'm not sure what the best way to handle these errors in the code is. In my case where I'm trying to do an I2C read I expect either a success or a nack.
Should I mask the return code and check the LSB only?
Is there standard way of checking these codes?
Should my I2C peripheral initialization functions return ret_code_t or handle it directly with APP_ERROR_CHECK?
Finally, is there a more graceful way of using APP_ERROR_CHECK() without causing a reset?
I'm sure there are many ways to do this but I'm wondering what the recommended approach is for the cleanest code.