mirror of
https://github.com/Mercantec-GHC/h5-projekt-mst.git
synced 2026-08-26 21:27:38 +02:00
remove esp-idf-lib/mpu6050
This commit is contained in:
parent
632e7b73fd
commit
01679d6da7
@ -1,77 +1,10 @@
|
||||
dependencies:
|
||||
esp-idf-lib/esp_idf_lib_helpers:
|
||||
component_hash: 689853bb8993434f9556af0f2816e808bf77b5d22100144b21f3519993daf237
|
||||
dependencies: []
|
||||
source:
|
||||
registry_url: https://components.espressif.com
|
||||
type: service
|
||||
targets:
|
||||
- esp32
|
||||
- esp32c2
|
||||
- esp32c3
|
||||
- esp32c5
|
||||
- esp32c6
|
||||
- esp32c61
|
||||
- esp32h2
|
||||
- esp32p4
|
||||
- esp32s2
|
||||
- esp32s3
|
||||
version: 1.4.0
|
||||
esp-idf-lib/i2cdev:
|
||||
component_hash: 9e22a91420695242ceac2c00788820ae45826224d38ef003a1a894367c55ede4
|
||||
dependencies:
|
||||
- name: esp-idf-lib/esp_idf_lib_helpers
|
||||
registry_url: https://components.espressif.com
|
||||
require: private
|
||||
version: '*'
|
||||
source:
|
||||
registry_url: https://components.espressif.com
|
||||
type: service
|
||||
targets:
|
||||
- esp32
|
||||
- esp32c2
|
||||
- esp32c3
|
||||
- esp32c5
|
||||
- esp32c6
|
||||
- esp32c61
|
||||
- esp32h2
|
||||
- esp32p4
|
||||
- esp32s2
|
||||
- esp32s3
|
||||
version: 2.1.1
|
||||
esp-idf-lib/mpu6050:
|
||||
component_hash: 2d4c6db42322162aeadded002cb811028f05115d969e143bad6470822cc75a8a
|
||||
dependencies:
|
||||
- name: esp-idf-lib/esp_idf_lib_helpers
|
||||
registry_url: https://components.espressif.com
|
||||
require: private
|
||||
version: '*'
|
||||
- name: esp-idf-lib/i2cdev
|
||||
registry_url: https://components.espressif.com
|
||||
require: private
|
||||
version: '*'
|
||||
source:
|
||||
registry_url: https://components.espressif.com/
|
||||
type: service
|
||||
targets:
|
||||
- esp32
|
||||
- esp32c2
|
||||
- esp32c3
|
||||
- esp32c5
|
||||
- esp32c6
|
||||
- esp32c61
|
||||
- esp32h2
|
||||
- esp32p4
|
||||
- esp32s2
|
||||
- esp32s3
|
||||
version: 2.1.9
|
||||
idf:
|
||||
source:
|
||||
type: idf
|
||||
version: 5.5.3
|
||||
direct_dependencies:
|
||||
- esp-idf-lib/mpu6050
|
||||
- idf
|
||||
manifest_hash: 555befbc35f7160bcfad0b8961e2bbca4bfb6b90242eecc7749fe036d221aa41
|
||||
manifest_hash: e44bf68eca6b7b264ddae08cd014cd3294c0473230381b6d6f88ed18ec879038
|
||||
target: esp32s3
|
||||
version: 2.0.0
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
idf_component_register(
|
||||
SRCS skateboard.c app_wifi.c app_mpu.c app_mqtt.c new_mpu6050.c
|
||||
SRCS skateboard.c app_wifi.c app_mqtt.c new_mpu6050.c
|
||||
PRIV_REQUIRES nvs_flash esp_netif esp_wifi mqtt esp_driver_i2c esp_timer
|
||||
INCLUDE_DIRS ".")
|
||||
|
||||
|
||||
@ -1,72 +0,0 @@
|
||||
#include "app_mpu.h"
|
||||
#include "esp_log.h"
|
||||
#include "mpu6050.h"
|
||||
|
||||
extern const char* TAG;
|
||||
|
||||
#ifdef CONFIG_MPU6050_I2C_ADDRESS_LOW
|
||||
#define MPU6050_I2C_ADDRESS MPU6050_I2C_ADDRESS_LOW
|
||||
#else
|
||||
#define MPU6050_I2C_ADDRESS MPU6050_I2C_ADDRESS_HIGH
|
||||
#endif
|
||||
|
||||
#define MPU6050_SDA_GPIO CONFIG_MPU6050_SDA_GPIO
|
||||
#define MPU6050_SCL_GPIO CONFIG_MPU6050_SCL_GPIO
|
||||
|
||||
void app_mpu_init(AppMpu* mpu)
|
||||
{
|
||||
ESP_ERROR_CHECK(i2cdev_init());
|
||||
|
||||
ESP_ERROR_CHECK(mpu6050_init_desc(
|
||||
&mpu->dev, MPU6050_I2C_ADDRESS, 0, MPU6050_SDA_GPIO, MPU6050_SCL_GPIO));
|
||||
ESP_LOGI(TAG,
|
||||
"Initializing MPU6050 device. Address: 0x%02x, SDA %d, SCL: %d",
|
||||
MPU6050_I2C_ADDRESS,
|
||||
MPU6050_SDA_GPIO,
|
||||
MPU6050_SCL_GPIO);
|
||||
|
||||
int retries = 0;
|
||||
while (true) {
|
||||
esp_err_t res = i2c_dev_probe(&mpu->dev.i2c_dev, I2C_DEV_WRITE);
|
||||
if (res == ESP_OK) {
|
||||
ESP_LOGI(TAG, "Found MPU6050 device");
|
||||
break;
|
||||
}
|
||||
if (retries >= 5) {
|
||||
ESP_ERROR_CHECK(res);
|
||||
}
|
||||
ESP_LOGE(TAG, "MPU6050 not found. Retrying (%d/%d)", retries + 1, 5);
|
||||
retries += 1;
|
||||
vTaskDelay(pdMS_TO_TICKS(1000));
|
||||
}
|
||||
|
||||
ESP_ERROR_CHECK(mpu6050_init(&mpu->dev));
|
||||
ESP_ERROR_CHECK(mpu6050_set_rate(&mpu->dev, 7));
|
||||
}
|
||||
|
||||
void app_mpu_read_acceleration(AppMpu* mpu, float3* out_accel)
|
||||
{
|
||||
mpu6050_acceleration_t acceleration = { 0 };
|
||||
|
||||
ESP_ERROR_CHECK(mpu6050_get_acceleration(&mpu->dev, &acceleration));
|
||||
|
||||
out_accel->x = acceleration.x;
|
||||
out_accel->y = acceleration.y;
|
||||
out_accel->z = acceleration.z;
|
||||
}
|
||||
|
||||
void app_mpu_read_rotation(AppMpu* mpu, float3* out_rotation)
|
||||
{
|
||||
mpu6050_rotation_t rotation = { 0 };
|
||||
|
||||
ESP_ERROR_CHECK(mpu6050_get_rotation(&mpu->dev, &rotation));
|
||||
|
||||
out_rotation->x = rotation.x;
|
||||
out_rotation->y = rotation.y;
|
||||
out_rotation->z = rotation.z;
|
||||
}
|
||||
|
||||
void app_mpu_read_temperature(AppMpu* mpu, float* degree_celsius)
|
||||
{
|
||||
ESP_ERROR_CHECK(mpu6050_get_temperature(&mpu->dev, degree_celsius));
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "mpu6050.h"
|
||||
|
||||
typedef struct float3 {
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
} float3;
|
||||
|
||||
typedef struct AppMpu {
|
||||
mpu6050_dev_t dev;
|
||||
} AppMpu;
|
||||
|
||||
void app_mpu_init(AppMpu* mpu);
|
||||
void app_mpu_read_acceleration(AppMpu* mpu, float3* out_accel);
|
||||
void app_mpu_read_rotation(AppMpu* mpu, float3* out_rotation);
|
||||
void app_mpu_read_temperature(AppMpu* mpu, float* degree_celsius);
|
||||
@ -1,17 +1,3 @@
|
||||
## IDF Component Manager Manifest File
|
||||
dependencies:
|
||||
## Required IDF version
|
||||
idf:
|
||||
version: '>=4.1.0'
|
||||
# # Put list of dependencies here
|
||||
# # For components maintained by Espressif:
|
||||
# component: "~1.0.0"
|
||||
# # For 3rd party components:
|
||||
# username/component: ">=1.0.0,<2.0.0"
|
||||
# username2/component2:
|
||||
# version: "~1.0.0"
|
||||
# # For transient dependencies `public` flag can be set.
|
||||
# # `public` flag doesn't have an effect dependencies of the `main` component.
|
||||
# # All dependencies of `main` are public by default.
|
||||
# public: true
|
||||
esp-idf-lib/mpu6050: '*'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user