Чет работает
This commit is contained in:
33
Core/UKSI/uksi_dc_control.c
Normal file
33
Core/UKSI/uksi_dc_control.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "uksi_dc_control.h"
|
||||
|
||||
HAL_StatusTypeDef DC_Init(UKSI_DC_t *dc, TIM_HandleTypeDef *htim, uint32_t activemode, uint32_t inactivemode)
|
||||
{
|
||||
if(check_null_ptr_2(dc, htim))
|
||||
return HAL_ERROR;
|
||||
|
||||
dc->htim = htim;
|
||||
dc->ActiveMode = activemode;
|
||||
dc->InactiveMode = inactivemode;
|
||||
|
||||
HAL_TIMEx_OCN_Start(htim, TIM_CHANNEL_1);
|
||||
return HAL_TIM_OC_Start(htim, TIM_CHANNEL_1);
|
||||
}
|
||||
|
||||
|
||||
HAL_StatusTypeDef DC_Enable(UKSI_DC_t *dc, uint8_t state)
|
||||
{
|
||||
if(check_null_ptr_1(dc))
|
||||
return HAL_ERROR;
|
||||
|
||||
dc->htim->Instance->CCMR1 &= ~TIM_OCMODE_PWM2;
|
||||
if(state)
|
||||
{
|
||||
dc->htim->Instance->CCMR1 |= dc->ActiveMode;
|
||||
}
|
||||
else
|
||||
{
|
||||
dc->htim->Instance->CCMR1 |= dc->InactiveMode;
|
||||
}
|
||||
|
||||
return HAL_OK;
|
||||
}
|
||||
Reference in New Issue
Block a user