From 2911ad535f239b9806b6aca808bddb1f47973d14 Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Mon, 14 Jan 2019 13:07:11 -0800 Subject: [PATCH] start work on mpu driver --- components/mpu_driver/CMakeLists.txt | 7 +++++++ components/mpu_driver/mpu_driver.c | 18 ++++++++++++++++++ components/mpu_driver/mpu_driver.h | 11 +++++++++++ main/CMakeLists.txt | 2 +- 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 components/mpu_driver/CMakeLists.txt create mode 100644 components/mpu_driver/mpu_driver.c create mode 100644 components/mpu_driver/mpu_driver.h diff --git a/components/mpu_driver/CMakeLists.txt b/components/mpu_driver/CMakeLists.txt new file mode 100644 index 0000000..599bddd --- /dev/null +++ b/components/mpu_driver/CMakeLists.txt @@ -0,0 +1,7 @@ +set(COMPONENT_SRCS + "mpu_driver.c") +set(COMPONENT_ADD_INCLUDEDIRS ".") + +register_component() + +component_compile_options("-Werror=incompatible-pointer-types") diff --git a/components/mpu_driver/mpu_driver.c b/components/mpu_driver/mpu_driver.c new file mode 100644 index 0000000..02231f0 --- /dev/null +++ b/components/mpu_driver/mpu_driver.c @@ -0,0 +1,18 @@ +#include "mpu_driver.h" + +typedef struct mpu_s { +} mpu_t; + +esp_err_t mpu_init(mpu_config_t *config, mpu_t **hndl_out) { + mpu_t *hndl = malloc(sizeof(mpu_t)); + if (!hndl) return ESP_ERR_NO_MEM; + *hndl_out = hndl; + + return ESP_OK; +} + +esp_err_t mpu_free(mpu_t *hndl) { + free(hndl); + + return ESP_OK; +} diff --git a/components/mpu_driver/mpu_driver.h b/components/mpu_driver/mpu_driver.h new file mode 100644 index 0000000..10fde86 --- /dev/null +++ b/components/mpu_driver/mpu_driver.h @@ -0,0 +1,11 @@ +#pragma once + +#include + +typedef struct mpu_config_s { +} mpu_config_t; + +typedef struct mpu_s *mpu_hndl_t; + +esp_err_t mpu_init(mpu_config_t *config, mpu_hndl_t *hndl_out); +esp_err_t mpu_free(mpu_hndl_t hndl); diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 191dcd7..0b398c5 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -11,7 +11,7 @@ list(APPEND COMPONENT_SRCS "ugv_main.c" "u8g2_esp32_hal.c" ${PROTO_SRCS}) set(COMPONENT_PRIV_INCLUDEDIRS "." ${PB_OUT}) -set(COMPONENT_REQUIRES "u8g2" "sx127x_driver" "nanopb") +set(COMPONENT_REQUIRES "u8g2" "sx127x_driver" "nanopb" "mpu_driver") register_component()