implement step callback

This commit is contained in:
Oskar Weigl
2017-07-12 02:52:39 -07:00
parent 1f5acaadc0
commit 9ce254e269
3 changed files with 15 additions and 1 deletions
+5
View File
@@ -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
+1
View File
@@ -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
View File
@@ -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 */
/**