mirror of
https://github.com/Mercantec-GHC/h5-projekt-mst.git
synced 2026-08-26 21:27:38 +02:00
add eim-idf project
This commit is contained in:
parent
52f41f449b
commit
303fa45c44
16
skateboard-firmware/.clang-format
Normal file
16
skateboard-firmware/.clang-format
Normal file
@ -0,0 +1,16 @@
|
||||
BasedOnStyle: WebKit
|
||||
IndentWidth: 4
|
||||
ColumnLimit: 80
|
||||
|
||||
IndentCaseLabels: true
|
||||
InsertNewlineAtEOF: true
|
||||
AllowShortFunctionsOnASingleLine: None
|
||||
|
||||
BinPackArguments: false
|
||||
# BinPackLongBracedList: false
|
||||
# BinPackParameters: OnePerLine
|
||||
BinPackParameters: true
|
||||
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
|
||||
1
skateboard-firmware/.gitignore
vendored
Normal file
1
skateboard-firmware/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
build
|
||||
7
skateboard-firmware/CMakeLists.txt
Normal file
7
skateboard-firmware/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.22)
|
||||
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
idf_build_set_property(MINIMAL_BUILD ON)
|
||||
project(hello_world)
|
||||
|
||||
6
skateboard-firmware/build.sh
Executable file
6
skateboard-firmware/build.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -xe
|
||||
|
||||
docker run --rm -v $PWD:/project -w /project -u $UID -e HOME=/tmp espressif/idf idf.py build
|
||||
|
||||
21
skateboard-firmware/dependencies.lock
Normal file
21
skateboard-firmware/dependencies.lock
Normal file
@ -0,0 +1,21 @@
|
||||
dependencies:
|
||||
espressif/mpu6050:
|
||||
component_hash: 3370b55e3c1337c0a80c8cd833bf48c0ba61cf9f7d226856ae88abb61eba1d67
|
||||
dependencies:
|
||||
- name: idf
|
||||
require: private
|
||||
version: '>=4.0'
|
||||
source:
|
||||
registry_url: https://components.espressif.com/
|
||||
type: service
|
||||
version: 1.2.1
|
||||
idf:
|
||||
source:
|
||||
type: idf
|
||||
version: 5.5.3
|
||||
direct_dependencies:
|
||||
- espressif/mpu6050
|
||||
- idf
|
||||
manifest_hash: 389fcce1891f49698e26c9e67ecf8cf7d8e6b2bf9fd10bb2f55ae4003ec75013
|
||||
target: esp32s3
|
||||
version: 2.0.0
|
||||
8
skateboard-firmware/flash.sh
Executable file
8
skateboard-firmware/flash.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -xe
|
||||
|
||||
# run this on the host: esp_rfc2217_server -v -p 4000 /dev/ttyACM0
|
||||
|
||||
docker run --rm -v $PWD:/project -w /project -u $UID -e HOME=/tmp espressif/idf idf.py -p 4000:4000 flash
|
||||
|
||||
4
skateboard-firmware/main/CMakeLists.txt
Normal file
4
skateboard-firmware/main/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
idf_component_register(SRCS "main.c"
|
||||
PRIV_REQUIRES spi_flash "driver" mpu6050
|
||||
INCLUDE_DIRS "")
|
||||
|
||||
17
skateboard-firmware/main/idf_component.yml
Normal file
17
skateboard-firmware/main/idf_component.yml
Normal file
@ -0,0 +1,17 @@
|
||||
## 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
|
||||
espressif/mpu6050: ^1.2.1
|
||||
85
skateboard-firmware/main/main.c
Normal file
85
skateboard-firmware/main/main.c
Normal file
@ -0,0 +1,85 @@
|
||||
#include "esp_chip_info.h"
|
||||
#include "esp_flash.h"
|
||||
#include "esp_system.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "mpu6050.h"
|
||||
#include "sdkconfig.h"
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static mpu6050_handle_t mpu6050_dev = NULL;
|
||||
|
||||
static mpu6050_acce_value_t acce;
|
||||
static mpu6050_gyro_value_t gyro;
|
||||
|
||||
static void mpu6050_init()
|
||||
{
|
||||
mpu6050_dev = mpu6050_create(BSP_I2C_NUM, MPU6050_I2C_ADDRESS);
|
||||
mpu6050_config(mpu6050_dev, ACCE_FS_4G, GYRO_FS_500DPS);
|
||||
mpu6050_wake_up(mpu6050_dev);
|
||||
}
|
||||
|
||||
static void mpu6050_read(void* pvParameters)
|
||||
{
|
||||
mpu6050_get_acce(mpu6050_dev, &acce);
|
||||
mpu6050_get_gyro(mpu6050_dev, &gyro);
|
||||
mpu6050_complimentory_filter(
|
||||
mpu6050_dev, &acce, &gyro, &complimentary_angle);
|
||||
}
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
mpu6050_init();
|
||||
|
||||
printf("Hello world!\n");
|
||||
|
||||
for (size_t i = 0; i < 10000) {
|
||||
printf("acce_x:%.2f, acce_y:%.2f, acce_z:%.2f\n",
|
||||
acce.acce_x,
|
||||
acce.acce_y,
|
||||
acce.acce_z);
|
||||
printf("gyro_x:%.2f, gyro_y:%.2f, gyro_z:%.2f",
|
||||
gyro.gyro_x,
|
||||
gyro.gyro_y,
|
||||
gyro.gyro_z);
|
||||
}
|
||||
|
||||
/* Print chip information */
|
||||
esp_chip_info_t chip_info;
|
||||
uint32_t flash_size;
|
||||
esp_chip_info(&chip_info);
|
||||
printf("This is %s chip with %d CPU core(s), %s%s%s%s, ",
|
||||
CONFIG_IDF_TARGET,
|
||||
chip_info.cores,
|
||||
(chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "",
|
||||
(chip_info.features & CHIP_FEATURE_BT) ? "BT" : "",
|
||||
(chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "",
|
||||
(chip_info.features & CHIP_FEATURE_IEEE802154)
|
||||
? ", 802.15.4 (Zigbee/Thread)"
|
||||
: "");
|
||||
|
||||
unsigned major_rev = chip_info.revision / 100;
|
||||
unsigned minor_rev = chip_info.revision % 100;
|
||||
printf("silicon revision v%d.%d, ", major_rev, minor_rev);
|
||||
if (esp_flash_get_size(NULL, &flash_size) != ESP_OK) {
|
||||
printf("Get flash size failed");
|
||||
return;
|
||||
}
|
||||
|
||||
printf("%" PRIu32 "MB %s flash\n",
|
||||
flash_size / (uint32_t)(1024 * 1024),
|
||||
(chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded"
|
||||
: "external");
|
||||
|
||||
printf("Minimum free heap size: %" PRIu32 " bytes\n",
|
||||
esp_get_minimum_free_heap_size());
|
||||
|
||||
for (int i = 10; i >= 0; i--) {
|
||||
printf("Restarting in %d seconds...\n", i);
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
printf("Restarting now.\n");
|
||||
fflush(stdout);
|
||||
esp_restart();
|
||||
}
|
||||
1673
skateboard-firmware/sdkconfig
Normal file
1673
skateboard-firmware/sdkconfig
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user