mirror of
https://github.com/odriverobotics/ODrive.git
synced 2026-09-25 11:06:48 +08:00
implement step callback
This commit is contained in:
@@ -676,6 +676,11 @@ static void sync_timers(TIM_HandleTypeDef* htim_a, TIM_HandleTypeDef* htim_b,
|
||||
// IRQ Callbacks
|
||||
//--------------------------------
|
||||
|
||||
// step/direction interface
|
||||
void step_cb(uint16_t GPIO_Pin) {
|
||||
|
||||
}
|
||||
|
||||
void vbus_sense_adc_cb(ADC_HandleTypeDef* hadc) {
|
||||
static const float voltage_scale = 3.3f * 11.0f / (float)(1<<12);
|
||||
// Only one conversion in sequence, so only rank1
|
||||
|
||||
@@ -126,6 +126,7 @@ void set_current_setpoint(Motor_t* motor, float current_setpoint);
|
||||
|
||||
void safe_assert(int arg);
|
||||
void init_motor_control();
|
||||
void step_cb(uint16_t GPIO_Pin);
|
||||
void pwm_trig_adc_cb(ADC_HandleTypeDef* hadc);
|
||||
void vbus_sense_adc_cb(ADC_HandleTypeDef* hadc);
|
||||
|
||||
|
||||
+9
-1
@@ -50,7 +50,7 @@
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "gpio.h"
|
||||
/* USER CODE BEGIN 0 */
|
||||
|
||||
#include "low_level.h"
|
||||
/* USER CODE END 0 */
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
@@ -143,6 +143,14 @@ void MX_GPIO_Init(void)
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
||||
//Dispatch processing of external interrupts based on source
|
||||
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
||||
//Step signals for M0 and M1
|
||||
if (GPIO_Pin & GPIO_1_Pin || GPIO_Pin & GPIO_3_Pin) {
|
||||
step_cb(GPIO_Pin);
|
||||
}
|
||||
}
|
||||
|
||||
/* USER CODE END 2 */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user