Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VescVESC Zephyr "Sensor" Driver #9

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "drivers/sensor/as5x47/lib/AS5047P"]
path = drivers/sensor/as5x47/lib/AS5047P
url = https://github.com/teamspatzenhirn/AS5047P.git
[submodule "drivers/sensor/vesc/lib/VESC-Lib"]
path = drivers/sensor/vesc/lib/VESC-Lib
url = https://github.com/teamspatzenhirn/VESC-Lib.git
7 changes: 7 additions & 0 deletions drivers/sensor/vesc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: Apache-2.0

zephyr_library()

zephyr_library_sources(vesc.c)
zephyr_library_include_directories(lib)
zephyr_library_compile_definitions(-DVESC_OP_MODE_Zephyr)
7 changes: 7 additions & 0 deletions drivers/sensor/vesc/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# VESC BLDC Motor Controller

menuconfig VESC
bool "VESC BLDC Motor Controller"
depends on UART
help
Enable VESC BLDC Motor Controller driver
1 change: 1 addition & 0 deletions drivers/sensor/vesc/lib/VESC-Lib
Submodule VESC-Lib added at 3c3223
8 changes: 8 additions & 0 deletions drivers/sensor/vesc/lib/vesc_c_interface.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @file vesc_c_interface.c
* @author Jonas Merkle [JJM] (jonas@jjm.one)
* @date 30.11.21
* Description here TODO
*/

#include "vesc_c_interface.h"
11 changes: 11 additions & 0 deletions drivers/sensor/vesc/lib/vesc_c_interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @file vesc_c_interface.h
* @author Jonas Merkle [JJM] (jonas@jjm.one)
* @date 30.11.21
* Description here TODO
*/

#ifndef CAROLO_APP_VESC_C_INTERFACE_H
#define CAROLO_APP_VESC_C_INTERFACE_H

#endif //CAROLO_APP_VESC_C_INTERFACE_H
11 changes: 11 additions & 0 deletions drivers/sensor/vesc/lib/vesc_c_types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @file vesc_c_types.h
* @author Jonas Merkle [JJM] (jonas@jjm.one)
* @date 30.11.21
* Description here TODO
*/

#ifndef CAROLO_APP_VESC_C_TYPES_H
#define CAROLO_APP_VESC_C_TYPES_H

#endif //CAROLO_APP_VESC_C_TYPES_H
8 changes: 8 additions & 0 deletions drivers/sensor/vesc/lib/vesc_master_c_interface.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* @file vesc_master_c_interface.c
* @author Jonas Merkle [JJM] (jonas@jjm.one)
* @date 30.11.21
* Description here TODO
*/

#include "vesc_master_c_interface.h"
11 changes: 11 additions & 0 deletions drivers/sensor/vesc/lib/vesc_master_c_interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @file vesc_master_c_interface.h
* @author Jonas Merkle [JJM] (jonas@jjm.one)
* @date 30.11.21
* Description here TODO
*/

#ifndef CAROLO_APP_VESC_MASTER_C_INTERFACE_H
#define CAROLO_APP_VESC_MASTER_C_INTERFACE_H

#endif //CAROLO_APP_VESC_MASTER_C_INTERFACE_H
20 changes: 20 additions & 0 deletions drivers/sensor/vesc/vesc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* @file vesc.c
* @author Jonas Merkle [JJM] (jonas@jjm.one)
* @date 30.11.21
* Description here TODO
*/

#include "vesc.h"

#define DT_DRV_COMPAT vesc

#include <devicetree.h>
#include <drivers/sensor.h>
#include <logging/log.h>

#if DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 0
#error "VESC driver enabled without any devices"
#endif

LOG_MODULE_REGISTER(vesc_driver, LOG_LEVEL_DBG);
23 changes: 23 additions & 0 deletions drivers/sensor/vesc/vesc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @file vesc.h
* @author Jonas Merkle [JJM] (jonas@jjm.one)
* @date 30.11.21
* Description here TODO
*/

#ifndef CAROLO_APP_VESC_H
#define CAROLO_APP_VESC_H

#include <drivers/uart.h>

typedef struct vesc_data {
//
} vesc_data;

typedef struct vesc_config {
struct uart_dt_spec uart_spec;
//VESC_handle vesc;
//VESC_master_handle vescMaster;
} as5x47_config;

#endif //CAROLO_APP_VESC_H