29 if (!this->
read_byte(MPU6050_REGISTER_WHO_AM_I, &who_am_i) ||
30 (who_am_i != 0x68 && who_am_i != 0x70 && who_am_i != 0x98)) {
34 ESP_LOGV(TAG,
" Setting up Power Management");
36 uint8_t power_management;
37 if (!this->
read_byte(MPU6050_REGISTER_POWER_MANAGEMENT_1, &power_management)) {
40 ESP_LOGV(TAG,
" Input power_management: 0b" BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(power_management));
42 power_management &= 0b11111000;
48 ESP_LOGV(TAG,
" Output power_management: 0b" BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(power_management));
49 if (!this->
write_byte(MPU6050_REGISTER_POWER_MANAGEMENT_1, power_management)) {
53 ESP_LOGV(TAG,
" Setting up Gyro Config");
56 if (!this->
read_byte(MPU6050_REGISTER_GYRO_CONFIG, &gyro_config)) {
59 ESP_LOGV(TAG,
" Input gyro_config: 0b" BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(gyro_config));
60 gyro_config &= 0b11100111;
62 ESP_LOGV(TAG,
" Output gyro_config: 0b" BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(gyro_config));
63 if (!this->
write_byte(MPU6050_REGISTER_GYRO_CONFIG, gyro_config)) {
67 ESP_LOGV(TAG,
" Setting up Accel Config");
70 if (!this->
read_byte(MPU6050_REGISTER_ACCEL_CONFIG, &accel_config)) {
73 ESP_LOGV(TAG,
" Input accel_config: 0b" BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(accel_config));
74 accel_config &= 0b11100111;
76 ESP_LOGV(TAG,
" Output accel_config: 0b" BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(accel_config));
77 return this->
write_byte(MPU6050_REGISTER_ACCEL_CONFIG, accel_config);