mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Update bl702_pwm.c
This commit is contained in:
@@ -90,7 +90,7 @@ static BL_Err_Type PWM_IntHandler(IRQn_Type intPeriph);
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM interrupt handle
|
* @brief PWM interrupt handle
|
||||||
*
|
*
|
||||||
* @param intPeriph: Select the peripheral, such as PWM0_IRQn
|
* @param intPeriph: Select the peripheral, such as PWM0_IRQn
|
||||||
@@ -145,7 +145,7 @@ static BL_Err_Type PWM_IntHandler(IRQn_Type intPeriph) {
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM channel init
|
* @brief PWM channel init
|
||||||
*
|
*
|
||||||
* @param chCfg: PWM configuration
|
* @param chCfg: PWM configuration
|
||||||
@@ -200,14 +200,10 @@ BL_Err_Type PWM_Channel_Init(PWM_CH_CFG_Type *chCfg) {
|
|||||||
// PWM_IntMask(chCfg->ch, PWM_INT_PULSE_CNT, chCfg->intPulseCnt != 0 ? UNMASK : MASK);
|
// PWM_IntMask(chCfg->ch, PWM_INT_PULSE_CNT, chCfg->intPulseCnt != 0 ? UNMASK : MASK);
|
||||||
CPU_Interrupt_Disable(PWM_IRQn);
|
CPU_Interrupt_Disable(PWM_IRQn);
|
||||||
|
|
||||||
// #ifndef BFLB_USE_HAL_DRIVER
|
|
||||||
// Interrupt_Handler_Register(PWM_IRQn, PWM_IRQHandler);
|
|
||||||
// #endif
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM channel update source memory address and len
|
* @brief PWM channel update source memory address and len
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel
|
* @param ch: PWM channel
|
||||||
@@ -231,7 +227,7 @@ void PWM_Channel_Update(PWM_CH_ID_Type ch, uint16_t period, uint16_t threshold1,
|
|||||||
BL_WR_REG(PWMx, PWM_PERIOD, period);
|
BL_WR_REG(PWMx, PWM_PERIOD, period);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM channel update clock divider
|
* @brief PWM channel update clock divider
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel
|
* @param ch: PWM channel
|
||||||
@@ -250,7 +246,7 @@ void PWM_Channel_Set_Div(PWM_CH_ID_Type ch, uint16_t div) {
|
|||||||
BL_WR_REG(PWMx, PWM_CLKDIV, div);
|
BL_WR_REG(PWMx, PWM_CLKDIV, div);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM channel update threshold1
|
* @brief PWM channel update threshold1
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel
|
* @param ch: PWM channel
|
||||||
@@ -270,7 +266,7 @@ void PWM_Channel_Set_Threshold1(PWM_CH_ID_Type ch, uint16_t threshold1) {
|
|||||||
BL_WR_REG(PWMx, PWM_THRE1, threshold1);
|
BL_WR_REG(PWMx, PWM_THRE1, threshold1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM channel update threshold2
|
* @brief PWM channel update threshold2
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel
|
* @param ch: PWM channel
|
||||||
@@ -290,7 +286,7 @@ void PWM_Channel_Set_Threshold2(PWM_CH_ID_Type ch, uint16_t threshold2) {
|
|||||||
BL_WR_REG(PWMx, PWM_THRE2, threshold2);
|
BL_WR_REG(PWMx, PWM_THRE2, threshold2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM channel update period
|
* @brief PWM channel update period
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel
|
* @param ch: PWM channel
|
||||||
@@ -310,7 +306,7 @@ void PWM_Channel_Set_Period(PWM_CH_ID_Type ch, uint16_t period) {
|
|||||||
BL_WR_REG(PWMx, PWM_PERIOD, period);
|
BL_WR_REG(PWMx, PWM_PERIOD, period);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM get configuration
|
* @brief PWM get configuration
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel
|
* @param ch: PWM channel
|
||||||
@@ -338,7 +334,7 @@ void PWM_Channel_Get(PWM_CH_ID_Type ch, uint16_t *period, uint16_t *threshold1,
|
|||||||
*period = BL_GET_REG_BITS_VAL(tmpVal, PWM_PERIOD);
|
*period = BL_GET_REG_BITS_VAL(tmpVal, PWM_PERIOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM enable
|
* @brief PWM enable
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel number
|
* @param ch: PWM channel number
|
||||||
@@ -359,7 +355,7 @@ void PWM_Channel_Enable(PWM_CH_ID_Type ch) {
|
|||||||
BL_WR_REG(PWMx, PWM_CONFIG, BL_CLR_REG_BIT(tmpVal, PWM_STOP_EN));
|
BL_WR_REG(PWMx, PWM_CONFIG, BL_CLR_REG_BIT(tmpVal, PWM_STOP_EN));
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM disable
|
* @brief PWM disable
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel number
|
* @param ch: PWM channel number
|
||||||
@@ -381,7 +377,7 @@ void PWM_Channel_Disable(PWM_CH_ID_Type ch) {
|
|||||||
PWM_IntMask(ch, PWM_INT_PULSE_CNT, MASK);
|
PWM_IntMask(ch, PWM_INT_PULSE_CNT, MASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM channel software mode enable or disable
|
* @brief PWM channel software mode enable or disable
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel number
|
* @param ch: PWM channel number
|
||||||
@@ -402,7 +398,7 @@ void PWM_SW_Mode(PWM_CH_ID_Type ch, BL_Fun_Type enable) {
|
|||||||
BL_WR_REG(PWMx, PWM_CONFIG, BL_SET_REG_BITS_VAL(tmpVal, PWM_SW_MODE, enable));
|
BL_WR_REG(PWMx, PWM_CONFIG, BL_SET_REG_BITS_VAL(tmpVal, PWM_SW_MODE, enable));
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM channel force output high or low
|
* @brief PWM channel force output high or low
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel number
|
* @param ch: PWM channel number
|
||||||
@@ -423,7 +419,7 @@ void PWM_SW_Force_Value(PWM_CH_ID_Type ch, uint8_t value) {
|
|||||||
BL_WR_REG(PWMx, PWM_CONFIG, BL_SET_REG_BITS_VAL(tmpVal, PWM_SW_FORCE_VAL, value));
|
BL_WR_REG(PWMx, PWM_CONFIG, BL_SET_REG_BITS_VAL(tmpVal, PWM_SW_FORCE_VAL, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM channel force output high
|
* @brief PWM channel force output high
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel number
|
* @param ch: PWM channel number
|
||||||
@@ -443,7 +439,7 @@ void PWM_Channel_Fource_Output(PWM_CH_ID_Type ch) {
|
|||||||
BL_WR_REG(PWMx, PWM_CONFIG, BL_SET_REG_BIT(tmpVal, PWM_SW_MODE));
|
BL_WR_REG(PWMx, PWM_CONFIG, BL_SET_REG_BIT(tmpVal, PWM_SW_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief Mask/Unmask the PWM interrupt
|
* @brief Mask/Unmask the PWM interrupt
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel number
|
* @param ch: PWM channel number
|
||||||
@@ -492,7 +488,7 @@ void PWM_IntMask(PWM_CH_ID_Type ch, PWM_INT_Type intType, BL_Mask_Type intMask)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief Install PWM interrupt callback function
|
* @brief Install PWM interrupt callback function
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel number
|
* @param ch: PWM channel number
|
||||||
@@ -504,7 +500,7 @@ void PWM_IntMask(PWM_CH_ID_Type ch, PWM_INT_Type intType, BL_Mask_Type intMask)
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
void PWM_Int_Callback_Install(PWM_CH_ID_Type ch, uint32_t intType, intCallback_Type *cbFun) { PWMIntCbfArra[ch][intType] = cbFun; }
|
void PWM_Int_Callback_Install(PWM_CH_ID_Type ch, uint32_t intType, intCallback_Type *cbFun) { PWMIntCbfArra[ch][intType] = cbFun; }
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM smart configure according to frequency and duty cycle function
|
* @brief PWM smart configure according to frequency and duty cycle function
|
||||||
*
|
*
|
||||||
* @param ch: PWM channel number
|
* @param ch: PWM channel number
|
||||||
@@ -573,7 +569,7 @@ BL_Err_Type PWM_Smart_Configure(PWM_CH_ID_Type ch, uint32_t frequency, uint8_t d
|
|||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/ /**
|
/****************************************************************************
|
||||||
* @brief PWM interrupt function
|
* @brief PWM interrupt function
|
||||||
*
|
*
|
||||||
* @param None
|
* @param None
|
||||||
|
|||||||
Reference in New Issue
Block a user