Hello Belaya,
This is sensor initialization code on STM32, please refer it.
/*! * @brief Initializes BHY smart sensor and its required connections * */ int8_t bhy_initialize_support(void) { uint8_t tmp_retry = RETRY_NUM;
bhy.bus_write = &I2Cx_Write; bhy.bus_read = &I2Cx_Read; bhy.delay_msec = &bhy_delay_msec; bhy.device_addr = BHY_I2C_SLAVE_ADDRESS<<1;
bhy_init(&bhy);
bhy_set_reset_request(BHY_RESET_ENABLE);;
while(tmp_retry--) { bhy_get_product_id(&bhy.product_id);
if(PRODUCT_ID_7183 == bhy.product_id) { return BHY_SUCCESS; }
bhy_delay_msec(BHY_PARAMETER_ACK_DELAY); }
return BHY_PRODUCT_ID_ERROR; } /*! * @brief Initiates a delay of the length of the argument in milliseconds * * @param[in] msec Delay length in terms of milliseconds * */ void bhy_delay_msec(uint32_t msec) { HAL_Delay(msec); }
... View more