mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-08-18 09:29:03 +08:00
Add doctest, fix drv8301 warning
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
// drivers
|
||||
#include "drv8301.h"
|
||||
|
||||
#include "utils.hpp"
|
||||
|
||||
|
||||
// **************************************************************************
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "odrive_main.h"
|
||||
#include "utils.hpp"
|
||||
#include "gpio_utils.hpp"
|
||||
#include "communication/interface_can.hpp"
|
||||
|
||||
Axis::Axis(int axis_num,
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include "gpio.h"
|
||||
constexpr GPIO_TypeDef* get_gpio_port_by_pin(uint16_t GPIO_pin){
|
||||
switch(GPIO_pin){
|
||||
case 1: return GPIO_1_GPIO_Port; break;
|
||||
case 2: return GPIO_2_GPIO_Port; break;
|
||||
case 3: return GPIO_3_GPIO_Port; break;
|
||||
case 4: return GPIO_4_GPIO_Port; break;
|
||||
#ifdef GPIO_5_GPIO_Port
|
||||
case 5: return GPIO_5_GPIO_Port; break;
|
||||
#endif
|
||||
#ifdef GPIO_6_GPIO_Port
|
||||
case 6: return GPIO_6_GPIO_Port; break;
|
||||
#endif
|
||||
#ifdef GPIO_7_GPIO_Port
|
||||
case 7: return GPIO_7_GPIO_Port; break;
|
||||
#endif
|
||||
#ifdef GPIO_8_GPIO_Port
|
||||
case 8: return GPIO_8_GPIO_Port; break;
|
||||
#endif
|
||||
default: return GPIO_1_GPIO_Port;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr uint16_t get_gpio_pin_by_pin(uint16_t GPIO_pin){
|
||||
switch(GPIO_pin){
|
||||
case 1: return GPIO_1_Pin; break;
|
||||
case 2: return GPIO_2_Pin; break;
|
||||
case 3: return GPIO_3_Pin; break;
|
||||
case 4: return GPIO_4_Pin; break;
|
||||
#ifdef GPIO_5_Pin
|
||||
case 5: return GPIO_5_Pin; break;
|
||||
#endif
|
||||
#ifdef GPIO_6_Pin
|
||||
case 6: return GPIO_6_Pin; break;
|
||||
#endif
|
||||
#ifdef GPIO_7_Pin
|
||||
case 7: return GPIO_7_Pin; break;
|
||||
#endif
|
||||
#ifdef GPIO_8_Pin
|
||||
case 8: return GPIO_8_Pin; break;
|
||||
#endif
|
||||
default: return GPIO_1_Pin;
|
||||
}
|
||||
}
|
||||
@@ -131,6 +131,7 @@ inline ENUMTYPE operator ~ (ENUMTYPE a) { return static_cast<ENUMTYPE>(~static_c
|
||||
|
||||
// ODrive specific includes
|
||||
#include <utils.hpp>
|
||||
#include <gpio_utils.hpp>
|
||||
#include <low_level.h>
|
||||
#include <motor.hpp>
|
||||
#include <encoder.hpp>
|
||||
|
||||
@@ -113,50 +113,4 @@ float our_arm_cos_f32(float x);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#include "gpio.h"
|
||||
constexpr GPIO_TypeDef* get_gpio_port_by_pin(uint16_t GPIO_pin){
|
||||
switch(GPIO_pin){
|
||||
case 1: return GPIO_1_GPIO_Port; break;
|
||||
case 2: return GPIO_2_GPIO_Port; break;
|
||||
case 3: return GPIO_3_GPIO_Port; break;
|
||||
case 4: return GPIO_4_GPIO_Port; break;
|
||||
#ifdef GPIO_5_GPIO_Port
|
||||
case 5: return GPIO_5_GPIO_Port; break;
|
||||
#endif
|
||||
#ifdef GPIO_6_GPIO_Port
|
||||
case 6: return GPIO_6_GPIO_Port; break;
|
||||
#endif
|
||||
#ifdef GPIO_7_GPIO_Port
|
||||
case 7: return GPIO_7_GPIO_Port; break;
|
||||
#endif
|
||||
#ifdef GPIO_8_GPIO_Port
|
||||
case 8: return GPIO_8_GPIO_Port; break;
|
||||
#endif
|
||||
default: return GPIO_1_GPIO_Port;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr uint16_t get_gpio_pin_by_pin(uint16_t GPIO_pin){
|
||||
switch(GPIO_pin){
|
||||
case 1: return GPIO_1_Pin; break;
|
||||
case 2: return GPIO_2_Pin; break;
|
||||
case 3: return GPIO_3_Pin; break;
|
||||
case 4: return GPIO_4_Pin; break;
|
||||
#ifdef GPIO_5_Pin
|
||||
case 5: return GPIO_5_Pin; break;
|
||||
#endif
|
||||
#ifdef GPIO_6_Pin
|
||||
case 6: return GPIO_6_Pin; break;
|
||||
#endif
|
||||
#ifdef GPIO_7_Pin
|
||||
case 7: return GPIO_7_Pin; break;
|
||||
#endif
|
||||
#ifdef GPIO_8_Pin
|
||||
case 8: return GPIO_8_Pin; break;
|
||||
#endif
|
||||
default: return GPIO_1_Pin;
|
||||
}
|
||||
}
|
||||
|
||||
#endif //__UTILS_H
|
||||
|
||||
@@ -185,12 +185,12 @@ build{
|
||||
'MotorControl',
|
||||
'fibre/cpp/include',
|
||||
'.',
|
||||
"C:/Tools/doctest/doctest"
|
||||
"doctest"
|
||||
}
|
||||
}
|
||||
|
||||
if tup.getconfig('DOCTEST') == 'true' then
|
||||
TEST_INCLUDES = '-I. -I./MotorControl -I./fibre/cpp/include -I./Drivers/DRV8301 -IC:/Tools/doctest/doctest'
|
||||
TEST_INCLUDES = '-I. -I./MotorControl -I./fibre/cpp/include -I./Drivers/DRV8301 -I./doctest'
|
||||
tup.frule{inputs='Tests/*.cpp', command='g++ -O3 -std=gnu++17 '..TEST_INCLUDES..' %f -o %o', outputs='Tests/test_runner.exe'}
|
||||
tup.frule{inputs='Tests/test_runner.exe', command='%f'}
|
||||
end
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "odrive_main.h"
|
||||
#include "freertos_vars.h"
|
||||
#include "utils.hpp"
|
||||
#include "gpio_utils.hpp"
|
||||
|
||||
#include "../build/version.h" // autogenerated based on Git state
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user