Hal kütüphanesi

Başlatan şeriban, 15 Şubat 2019, 15:18:25

şeriban

Tx_buffer[0]=0x10;
HAL_I2C_Master_Transmit(&hi2c1 , MPU6050_Address , Tx_buffer ,1 , 100);
 HAL_Delay(200);
 
Tx_buffer[1]= 0x6B;
Tx_buffer[2]= 0x00;
 HAL_I2C_Master_Transmit(&hi2c1 ,MPU6050_Address , Tx_buffer ,2 ,100);
 
Tx_buffer[3]=0x1B;//GYRO_CONFIG
Tx_buffer[4]=0x08;//FS_SEL +-250
HAL_I2C_Master_Transmit(&hi2c1 , MPU6050_Address , Tx_buffer ,2 , 100);

 


  while (1)
  { 
		 
	if (HAL_I2C_IsDeviceReady (&hi2c1 , MPU6050_Address ,2 ,1000 ) == HAL_OK) {
		
    HAL_GPIO_WritePin(GPIOD ,GPIO_PIN_13 ,GPIO_PIN_SET);
	}
		i2cBuff[0]= 0x3B;
       HAL_I2C_Master_Transmit(&hi2c1, MPU6050_Address, i2cBuff, 1, 10);
       i2cBuff[1] = 0x00;
       HAL_I2C_Master_Receive(&hi2c1, MPU6050_Address, &i2cBuff[1], 6, 10);

       ax = -(i2cBuff[1]<<8 | i2cBuff[2]);
       ay = -(i2cBuff[3]<<8 | i2cBuff[4]);
       az = -(i2cBuff[5]<<8 | i2cBuff[6]);



buradaki HAL_I2C_IsDeviceReady kütüphanesi cihazı ilk taktığımda çalışıyor ama debug yaptıktan kontrol ledim sönüyor baglantı mı kopuyor anlamadım . lütfen yardım edin