mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-08-18 09:29:03 +08:00
fix external interrupts, step dir now working
This commit is contained in:
+2
-2
@@ -27,8 +27,8 @@
|
||||
"STM32F405xx",
|
||||
"USE_HAL_DRIVER",
|
||||
"HW_VERSION_MAJOR=3",
|
||||
"HW_VERSION_MINOR=4",
|
||||
"HW_VERSION_VOLTAGE=24",
|
||||
"HW_VERSION_MINOR=5",
|
||||
"HW_VERSION_VOLTAGE=48",
|
||||
"__weak=\"__attribute__((weak))\"",
|
||||
"__packed=\"__attribute__((__packed__))\"",
|
||||
"__GNUC__"
|
||||
|
||||
@@ -138,8 +138,9 @@ void MX_GPIO_Init(void)
|
||||
HAL_GPIO_Init(nFAULT_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/* EXTI interrupt init*/
|
||||
HAL_NVIC_SetPriority(EXTI2_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI2_IRQn);
|
||||
// TODO get Cube to not emit this
|
||||
// HAL_NVIC_SetPriority(EXTI2_IRQn, 0, 0);
|
||||
// HAL_NVIC_EnableIRQ(EXTI2_IRQn);
|
||||
|
||||
}
|
||||
|
||||
@@ -151,6 +152,7 @@ void MX_GPIO_Init(void)
|
||||
// no matter which port they belong to.
|
||||
IRQn_Type get_irq_number(uint16_t pin) {
|
||||
uint16_t pin_number = 0;
|
||||
pin >>= 1;
|
||||
while (pin) {
|
||||
pin >>= 1;
|
||||
pin_number++;
|
||||
|
||||
@@ -341,6 +341,14 @@ void EXTI4_IRQHandler(void)
|
||||
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles EXTI lines 5-9 interrupt.
|
||||
*/
|
||||
void EXTI9_5_IRQHandler(void)
|
||||
{
|
||||
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_9);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles EXTI lines 10-15 interrupt.
|
||||
*/
|
||||
|
||||
@@ -25,6 +25,10 @@ Axis::Axis(const AxisHardwareConfig_t& hw_config,
|
||||
motor_.axis_ = this;
|
||||
}
|
||||
|
||||
static void step_cb_wrapper(void* ctx) {
|
||||
reinterpret_cast<Axis*>(ctx)->step_cb();
|
||||
}
|
||||
|
||||
// @brief Sets up all components of the axis,
|
||||
// such as gate driver and encoder hardware.
|
||||
void Axis::setup() {
|
||||
@@ -56,10 +60,6 @@ bool Axis::wait_for_current_meas() {
|
||||
return osSignalWait(M_SIGNAL_PH_CURRENT_MEAS, PH_CURRENT_MEAS_TIMEOUT).status == osEventSignal;
|
||||
}
|
||||
|
||||
static void step_cb_wrapper(void* ctx) {
|
||||
reinterpret_cast<Axis*>(ctx)->step_cb();
|
||||
}
|
||||
|
||||
// step/direction interface
|
||||
void Axis::step_cb() {
|
||||
if (enable_step_dir_) {
|
||||
|
||||
@@ -31,6 +31,7 @@ void save_configuration(void) {
|
||||
}
|
||||
|
||||
void load_configuration(void) {
|
||||
// Try to load configs
|
||||
if (NVM_init() ||
|
||||
ConfigFormat::safe_load_config(
|
||||
&board_config,
|
||||
@@ -38,6 +39,7 @@ void load_configuration(void) {
|
||||
&controller_configs,
|
||||
&motor_configs,
|
||||
&axis_configs)) {
|
||||
//If loading failed, restore defaults
|
||||
board_config = BoardConfig_t();
|
||||
for (size_t i = 0; i < AXIS_COUNT; ++i) {
|
||||
encoder_configs[i] = EncoderConfig_t();
|
||||
|
||||
@@ -3,4 +3,3 @@
|
||||
#CONFIG_BOARD_VERSION=v3.5-24V
|
||||
CONFIG_USB_PROTOCOL=native
|
||||
CONFIG_UART_PROTOCOL=ascii
|
||||
CONFIG_STEP_DIR=n
|
||||
|
||||
Reference in New Issue
Block a user