Revision 126ace3c unittests/periphery-lld/src/ut_alld_MPU6050_v1.c
unittests/periphery-lld/src/ut_alld_MPU6050_v1.c | ||
---|---|---|
49 | 49 |
{ |
50 | 50 |
aos_utresult_t result = {0, 0}; |
51 | 51 |
|
52 |
const mpu6050_lld_register_t addr = 0x75; // register to read from |
|
53 |
uint16_t const data; // buffer for data |
|
54 |
const uint8_t num = 1; // read one register |
|
55 |
const apalTime_t timeout = 100; // TODO: Check units |
|
52 |
uint8_t data[1] = {0}; |
|
53 |
uint32_t status = 0; |
|
56 | 54 |
|
55 |
status = mpu6050_lld_read_register(((ut_mpu6050data_t*)ut->data)->mpu, MPU6050_LLD_WHO_AM_I, data, 1, ((ut_mpu6050data_t*)ut->data)->timeout); |
|
56 |
if (status == APAL_STATUS_OK && data[0] == MPU6050_I_AM) { |
|
57 |
aosUtPassed(stream, &result); |
|
58 |
} else { |
|
59 |
aosUtFailedMsg(stream, &result, "0x%08X | 0x%02X\n", status, data[0]); |
|
60 |
} |
|
57 | 61 |
|
58 |
mpu6050_lld_read_register(((ut_mpu6050data_t*)ut->data)->mpu, addr, &data, num, ((ut_mpu6050data_t*)ut->data)->timeout); |
|
59 |
/** registers to read: |
|
60 |
0x75: WHO AM I (should return I2C-Adress without the last bit, which is determined by the state of the AO pin!) returns 0x68 |
|
61 |
*/ |
|
62 |
|
|
63 |
return result; // TODO: Adjust |
|
62 |
return result; |
|
64 | 63 |
} |
65 | 64 |
|
66 | 65 |
#endif /* (AMIROOS_CFG_TESTS_ENABLE == true) && defined(AMIROLLD_CFG_MPU6050) && (AMIROLLD_CFG_MPU6050 == 1) */ |
Also available in: Unified diff