|
|
@@ -259,15 +259,20 @@ void Icm20948::ak09916_init(Config_Mag_t *config)
|
|
|
this->icm20948_i2c_master_enable();
|
|
|
this->icm20948_i2c_master_clk_frq(7);
|
|
|
|
|
|
- while(!this->ak09916_who_am_i());
|
|
|
+ this->_ak09916_enable = false;
|
|
|
+ if(this->ak09916_who_am_i()){
|
|
|
+ this->_ak09916_enable = true;
|
|
|
+ }
|
|
|
|
|
|
- this->ak09916_soft_reset();
|
|
|
- this->ak09916_operation_mode_setting(config->mode);
|
|
|
+ if(this->_ak09916_enable == true){
|
|
|
+ this->ak09916_soft_reset();
|
|
|
+ this->ak09916_operation_mode_setting(config->mode);
|
|
|
|
|
|
- if (config->mode == mag_mode_power_down) {
|
|
|
- this->_ak09916_enable = false;
|
|
|
- } else {
|
|
|
- this->_ak09916_enable = true;
|
|
|
+ if (config->mode == mag_mode_power_down) {
|
|
|
+ this->_ak09916_enable = false;
|
|
|
+ } else {
|
|
|
+ this->_ak09916_enable = true;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|