MPU9250.c
static void bytewrite_AK8963(uint8_t address, uint8_t data) {
	const uint16_t microsec = 500;
	bytewrite_MPU(MPUREG_I2C_SLV0_ADDR, AK8963_I2C_ADDR);			// Write the Slave 0 AK8963 address and the direction of the data acess
	delay_micro(microsec);
	bytewrite_MPU(MPUREG_I2C_SLV0_REG, address);							// AK8963 register address from where to begin data transfer
	delay_micro(microsec);
	bytewrite_MPU(MPUREG_I2C_SLV0_DO, data);									// The data to be written into AK8963
	delay_micro(microsec);
																														// Yes even if it's a write action, you have to set I2C_SLV0_EN
	bytewrite_MPU(MPUREG_I2C_SLV0_CTRL, 0x81);								// which datasheet says enables reading data from the slave.
	delay_micro(microsec);
}
// Data access from AK8963 normally takes 1ms to 2ms to finish
// Therefore don't use it too often

Data access from AK8963 normally takes 1ms to 2ms to finish
Therefore don't use it too often
Data access from AK8963 normally takes 1ms to 2ms to finish Therefore don ' t use it too often
static void bytewrite_AK8963(uint8_t address, uint8_t data) {
	const uint16_t microsec = 500;
	bytewrite_MPU(MPUREG_I2C_SLV0_ADDR, AK8963_I2C_ADDR);			
	delay_micro(microsec);
	bytewrite_MPU(MPUREG_I2C_SLV0_REG, address);							
	delay_micro(microsec);
	bytewrite_MPU(MPUREG_I2C_SLV0_DO, data);									
	delay_micro(microsec);
	bytewrite_MPU(MPUREG_I2C_SLV0_CTRL, 0x81);								
	delay_micro(microsec);
}
static void bytewrite_AK8963 ( uint8_t address , uint8_t data ) { const uint16_t microsec = 500 ; bytewrite_MPU ( MPUREG_I2C_SLV0_ADDR , AK8963_I2C_ADDR ) ; delay_micro ( microsec ) ; bytewrite_MPU ( MPUREG_I2C_SLV0_REG , address ) ; delay_micro ( microsec ) ; bytewrite_MPU ( MPUREG_I2C_SLV0_DO , data ) ; delay_micro ( microsec ) ; bytewrite_MPU ( MPUREG_I2C_SLV0_CTRL , 0x81 ) ; delay_micro ( microsec ) ; }
Data access from AK8963 normally takes 1ms to 2ms to finish
Therefore don't use it too often
Data access from AK8963 normally takes 1ms to 2ms to finish Therefore don ' t use it too often
// Write the Slave 0 AK8963 address and the direction of the data acess
 // AK8963 register address from where to begin data transfer
 // The data to be written into AK8963
 // Yes even if it's a write action, you have to set I2C_SLV0_EN
 // which datasheet says enables reading data from the slave.
