Add OUTTOGGLE mode to STM32H7 timer driver (#541)
* stm32h7: New timer output mode STM32_TIM_CH_OUTTOGGLE. In this mode timer generates a square waveform on given timer channel. The maximal waveform freq is timer clock divided by 4 (prescaler 1, period 1 results in 2 clocks '0' and 2 clocks '1'). * stm32_tim.h styling fixes.
This commit is contained in:
parent
39725109fa
commit
4e65d543d8
|
@ -904,6 +904,11 @@ static int stm32_tim_setchannel(FAR struct stm32_tim_dev_s *dev,
|
|||
case STM32_TIM_CH_DISABLED:
|
||||
break;
|
||||
|
||||
case STM32_TIM_CH_OUTTOGGLE:
|
||||
ccmr_val = (ATIM_CCMR_MODE_OCREFTOG << ATIM_CCMR1_OC1M_SHIFT);
|
||||
ccer_val |= ATIM_CCER_CC1E << (channel << 2);
|
||||
break;
|
||||
|
||||
case STM32_TIM_CH_OUTPWM:
|
||||
ccmr_val = (ATIM_CCMR_MODE_PWM1 << ATIM_CCMR1_OC1M_SHIFT) +
|
||||
ATIM_CCMR1_OC1PE;
|
||||
|
|
|
@ -137,11 +137,12 @@ typedef enum
|
|||
|
||||
/* MODES: */
|
||||
|
||||
STM32_TIM_CH_MODE_MASK = 0x06,
|
||||
STM32_TIM_CH_MODE_MASK = 0x0e,
|
||||
|
||||
/* Output Compare Modes */
|
||||
|
||||
STM32_TIM_CH_OUTPWM = 0x04, /* Enable standard PWM mode, active high when counter < compare */
|
||||
STM32_TIM_CH_OUTTOGGLE = 0x08, /* Toggle TIM_CHx output on UEV */
|
||||
#if 0
|
||||
STM32_TIM_CH_OUTCOMPARE = 0x06,
|
||||
|
||||
|
@ -181,7 +182,7 @@ struct stm32_tim_ops_s
|
|||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* Power-up timer and get its structure */
|
||||
|
|
Loading…
Reference in New Issue