Fixed PWM mode
This commit is contained in:
@@ -158,15 +158,15 @@ getTimerCaptureCompareModeRegistersOutput(Timer_Key key) {
|
||||
SHAL_TIM_Capture_Compare_Mode_Registers_Output res = {
|
||||
{nullptr, nullptr},
|
||||
TIM_CCMR1_CC1S_Pos, //Channel 1 Capture/Compare selection
|
||||
TIM_CCMR1_OC1FE_Pos, //Channel 1 Fast enable
|
||||
TIM_CCMR1_OC1PE_Pos, //Channel 1 Preload enable
|
||||
TIM_CCMR1_OC1FE, //Channel 1 Fast enable
|
||||
TIM_CCMR1_OC1PE, //Channel 1 Preload enable
|
||||
TIM_CCMR1_OC1M_Pos, //Channel 1 Mode (OC1M)
|
||||
TIM_CCMR1_OC1CE_Pos, //Channel 1 Clear enable
|
||||
TIM_CCMR1_OC1CE, //Channel 1 Clear enable
|
||||
TIM_CCMR1_CC2S_Pos, //Channel 2 Capture/Compare selection
|
||||
TIM_CCMR1_OC2FE_Pos, //Channel 2 Fast enable
|
||||
TIM_CCMR1_OC2PE_Pos, //Channel 2 Preload enable
|
||||
TIM_CCMR1_OC2FE, //Channel 2 Fast enable
|
||||
TIM_CCMR1_OC2PE, //Channel 2 Preload enable
|
||||
TIM_CCMR1_OC2M_Pos, //Channel 2 Mode (OC2M)
|
||||
TIM_CCMR1_OC2CE_Pos //Channel 2 Clear enable
|
||||
TIM_CCMR1_OC2CE //Channel 2 Clear enable
|
||||
};
|
||||
|
||||
volatile TIM_TypeDef* tim = TIM_TABLE[static_cast<uint8_t>(key)];
|
||||
@@ -176,7 +176,7 @@ getTimerCaptureCompareModeRegistersOutput(Timer_Key key) {
|
||||
return res;
|
||||
}
|
||||
|
||||
static inline SHAL_TIM_Break_Dead_Time_Register getBreakDeadTimeRegister(Timer_Key key){
|
||||
static inline SHAL_TIM_Break_Dead_Time_Register getTimerBreakDeadTimeRegister(Timer_Key key){
|
||||
|
||||
SHAL_TIM_Break_Dead_Time_Register res = {nullptr, 1UL << 15};
|
||||
|
||||
|
||||
@@ -38,7 +38,11 @@ public:
|
||||
//Enable interrupts
|
||||
void enableInterrupt();
|
||||
|
||||
void setPWMMode(SHAL_Timer_Channel channel, SHAL_Timer_Channel_Main_Output_Mode mainOutputMode, SHAL_Timer_Channel_Complimentary_Output_Mode complimentaryOutputMode);
|
||||
void setPWMMode(SHAL_Timer_Channel channel, SHAL_TIM_Output_Compare_Mode outputCompareMode, SHAL_Timer_Channel_Main_Output_Mode mainOutputMode, SHAL_Timer_Channel_Complimentary_Output_Mode complimentaryOutputMode);
|
||||
|
||||
/// Set the duty cycle for PWM
|
||||
/// \param dutyCycle 10 * percentage (e.g. 500 = 50%)
|
||||
void setPWMDutyCycle(uint32_t dutyCycle);
|
||||
|
||||
//Set TIMER_KEY IRQ callback function
|
||||
void setCallbackFunc(TimerCallback callback){
|
||||
@@ -52,6 +56,7 @@ private:
|
||||
|
||||
Timer_Key m_key;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -59,15 +59,15 @@ struct SHAL_TIM_Capture_Compare_Mode_Registers_Input {
|
||||
struct SHAL_TIM_Capture_Compare_Mode_Registers_Output {
|
||||
volatile uint32_t* regs[2];
|
||||
uint32_t capture_compare_1_selection_offset;
|
||||
uint32_t output_compare_1_fast_enable_offset;
|
||||
uint32_t output_compare_1_preload_enable_offset;
|
||||
uint32_t output_compare_1_fast_enable_mask;
|
||||
uint32_t output_compare_1_preload_enable_mask;
|
||||
uint32_t output_compare_1_mode_offset;
|
||||
uint32_t output_compare_1_clear_enable_offset;
|
||||
uint32_t output_compare_1_clear_enable_mask;
|
||||
uint32_t capture_compare_2_selection_offset;
|
||||
uint32_t output_compare_2_fast_enable_offset;
|
||||
uint32_t output_compare_2_preload_enable_offset;
|
||||
uint32_t output_compare_2_fast_enable_mask;
|
||||
uint32_t output_compare_2_preload_enable_mask;
|
||||
uint32_t output_compare_2_mode_offset;
|
||||
uint32_t output_compare_2_clear_enable_offset;
|
||||
uint32_t output_compare_2_clear_enable_mask;
|
||||
};
|
||||
|
||||
struct SHAL_TIM_Break_Dead_Time_Register {
|
||||
|
||||
Reference in New Issue
Block a user