sn32 pwm: introduce non stop mode

This commit is contained in:
Dimitris Mantzouranis 2021-12-01 10:19:43 +02:00
parent 97c5ea166a
commit 7c62da9728
2 changed files with 19 additions and 3 deletions

View File

@ -451,7 +451,7 @@ void pwm_lld_start(PWMDriver *pwmp) {
#if SN32_PWM_USE_ONESHOT || defined(__DOXYGEN__)
pwmp->ct->MCTRL3 |= mskCT16_MR24STOP_EN;
#else
#elif !defined(SN32_PWM_NO_RESET)
pwmp->ct->MCTRL3 |= mskCT16_MR24RST_EN;
#endif
#else
@ -459,7 +459,7 @@ void pwm_lld_start(PWMDriver *pwmp) {
#if SN32_PWM_USE_ONESHOT || defined(__DOXYGEN__)
pwmp->ct->MCTRL3 |= mskCT16_MR23STOP_EN;
#else
#elif !defined(SN32_PWM_NO_RESET)
pwmp->ct->MCTRL3 |= mskCT16_MR23RST_EN;
#endif
#endif

View File

@ -219,7 +219,7 @@ struct PWMDriver {
/*===========================================================================*/
/**
* @brief Changes the period the PWM peripheral.
* @brief Changes the period of the PWM peripheral.
* @details This function changes the period of a PWM unit that has already
* been activated using @p pwmStart().
* @pre The PWM unit must have been activated using @p pwmStart().
@ -241,6 +241,22 @@ struct PWMDriver {
#define pwm_lld_change_period(pwmp, period) \
((pwmp)->ct->MR23 = ((period) - 1))
#endif
/**
* @brief Changes the timer counter of the PWM peripheral.
* @details This function changes the timer counter of a PWM unit that has
* already been activated using @p pwmStart().
* @pre The PWM unit must have been activated using @p pwmStart().
* @post The PWM unit timer counter is changed to the new value.
* @note The function overrides the TC value of the PWM peripheral
*
* @param[in] pwmp pointer to a @p PWMDriver object
* @param[in] counter new timer counter value in bits
*
* @notapi
*/
#define pwm_lld_change_counter(pwmp, counter) \
((pwmp)->ct->TC = (counter))
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/