refactor(sdm): add check and error info to the clock division

This commit is contained in:
laokaiyao
2024-09-09 12:43:22 +08:00
committed by Kevin (Lao Kaiyao)
parent d8d57e1965
commit d9d316b97d
9 changed files with 40 additions and 10 deletions

View File

@@ -15,6 +15,8 @@
extern "C" {
#endif
#define SDM_LL_PRESCALE_MAX 256
/**
* @brief Set Sigma-delta enable
*
@@ -49,7 +51,7 @@ static inline void sdm_ll_set_pulse_density(gpio_sd_dev_t *hw, int channel, int8
*/
static inline void sdm_ll_set_prescale(gpio_sd_dev_t *hw, int channel, uint32_t prescale)
{
HAL_ASSERT(prescale && prescale <= 256);
HAL_ASSERT(prescale && prescale <= SDM_LL_PRESCALE_MAX);
HAL_FORCE_MODIFY_U32_REG_FIELD(hw->channel[channel], prescale, prescale - 1);
}