Add gitignore
create motor_controller source files.
This commit is contained in:
		
							
								
								
									
										36
									
								
								Core/Src/motor_controller.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								Core/Src/motor_controller.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
#include "motor_controller.h"
 | 
			
		||||
 | 
			
		||||
void BLDC_Init(Cont_Mot_Interface_TypeDef Interface) {
 | 
			
		||||
    HAL_TIM_PWM_Start(Interface.Driver_PWM_TIM, Interface.U_Phase_TIM_Channel);
 | 
			
		||||
    HAL_TIMEx_PWMN_Start(Interface.Driver_PWM_TIM, Interface.U_Phase_TIM_Channel);
 | 
			
		||||
    HAL_TIM_PWM_Start(Interface.Driver_PWM_TIM, Interface.V_Phase_TIM_Channel);
 | 
			
		||||
    HAL_TIMEx_PWMN_Start(Interface.Driver_PWM_TIM, Interface.V_Phase_TIM_Channel);
 | 
			
		||||
    HAL_TIM_PWM_Start(Interface.Driver_PWM_TIM, Interface.W_Phase_TIM_Channel);
 | 
			
		||||
    HAL_TIMEx_PWMN_Start(Interface.Driver_PWM_TIM, Interface.W_Phase_TIM_Channel);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BLDC_Loop() {
 | 
			
		||||
    static uint32_t int_count;
 | 
			
		||||
    
 | 
			
		||||
    int_count++;
 | 
			
		||||
    static uint32_t seconds;
 | 
			
		||||
 | 
			
		||||
    if (int_count/1000u > seconds) {
 | 
			
		||||
      seconds = int_count/1000u;
 | 
			
		||||
 | 
			
		||||
      uint8_t txMsg1[20] = "";
 | 
			
		||||
      snprintf(txMsg1, sizeof(txMsg1), "IRQ: %8lu\n\0", int_count);
 | 
			
		||||
      //HAL_UART_Transmit(&huart1, txMsg1, strlen(txMsg1), 100);
 | 
			
		||||
      //HAL_UART_Transmit_DMA(&huart1, txMsg1, strlen(txMsg1));
 | 
			
		||||
 | 
			
		||||
      uint8_t txMsg2[20] = "";
 | 
			
		||||
      //snprintf(txMsg2, sizeof(txMsg2), "CNT: %8lu\n\0", htim->Instance->CNT);
 | 
			
		||||
      //HAL_UART_Transmit(&huart1, txMsg2, strlen(txMsg2), 100);
 | 
			
		||||
      //HAL_UART_Transmit_DMA(&huart1, txMsg2, strlen(txMsg2));
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user