Implement spindle PWM and H-bridge control
Fill in the LibSpindle platform callbacks so the spindle commands (spindle start/stop/status) drive the BTS7960 H-bridge. - spindleLogic.c: SPINDLE_SetDutyCycle sets the TIM2 compare values, CH4 (SPINDLE_PWM_R) for forward and CH3 (SPINDLE_PWM_L) for backward, the inactive channel is set to 0 first. SPINDLE_EnaPWM switches both half bridges via SPINDLE_ENA_L/R. Both PWM channels are started in init_spindle_custom before the spindle instance is created. - main.h: export htim2 so the spindle module can access the timer. - consoleLogic.c: report CAP_HAS_SPINDLE and CAP_HAS_SPINDLE_STATUS in the capability command. - main.c: fix typo in the playground task output. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
26fe4cc0cf
commit
46398252ad
4 files changed
+23
-9
No files matched your search
@@ -41,7 +41,8 @@ extern "C" {
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EC */
|
||||
|
||||
// timer handle defined in main.c, used for the spindle PWM (CH3 = SPINDLE_PWM_L, CH4 = SPINDLE_PWM_R)
|
||||
extern TIM_HandleTypeDef htim2;
|
||||
/* USER CODE END EC */
|
||||
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
|
||||
Reference in new issue
Block a user