Create setEncoderCount function

This commit is contained in:
Paul Guenette
2017-11-23 15:42:22 -05:00
parent 0d7d5647f6
commit 2880b65a1e
2 changed files with 9 additions and 0 deletions
+7
View File
@@ -1379,3 +1379,10 @@ void motor_thread(void const * argument) {
}
motor->thread_ready = false;
}
void setEncoderCount(Motor_t* motor, uint16_t count){
motor->encoder.encoder_state = count;
motor->motor_timer->Instance->CNT = count;
motor->encoder.pll_pos = count;
}
+2
View File
@@ -172,6 +172,8 @@ void step_cb(uint16_t GPIO_Pin);
void pwm_trig_adc_cb(ADC_HandleTypeDef* hadc, bool injected);
void vbus_sense_adc_cb(ADC_HandleTypeDef* hadc, bool injected);
void setEncoderCount(Motor_t* motor, uint16_t count);
bool anti_cogging_calibration(Motor_t* motor);
//@TODO move motor thread to high level file