NRF52840 Eval Kit User Manual
Vision: V1.0.1 Date: 2019.01.19
37
/
72
READ DATA FROM MPU6050
This example is run to read MPU6050 data via I2C bus.
u8 IIC_Write_1Byte
(
u8 SlaveAddress
,
u8 REG_Address
,
u8 REG_data
)
{
ret_code_t err_code
=
user_i2c_write
(
SlaveAddress
,
REG_Address
,
&
REG_data
,
1
);
return
err_code
;
}
u8 IIC_Read_1Byte
(
u8 SlaveAddress
,
u8 REG_Address
,
u8
*
REG_data
)
{
ret_code_t err_code
=
user_i2c_read
(
SlaveAddress
,
REG_Address
,
REG_data
,
1
);
return
err_code
;
}
u8 IIC_Write_nByte
(
u8 SlaveAddress
,
u8 REG_Address
,
u8 len
,
u8
*
buf
)
{
ret_code_t err_code
=
user_i2c_write
(
SlaveAddress
,
REG_Address
,
buf
,
len
);
return
err_code
;
}
u8 IIC_Read_nByte
(
u8 SlaveAddress
,
u8 REG_Address
,
u8 len
,
u8
*
buf
)
{
ret_code_t err_code
=
user_i2c_read
(
SlaveAddress
,
REG_Address
,
buf
,
len
);
return
err_code
;
}
The basic functions are user_i2c_read() and user_i2c_write().