drivers: pwm: pwm_stm32: Add error log for 16-bit timer buffer overflow
If the value in the period_cycles variable exceeds UINT16_MAX, a 16-bit timer will return an error code 134. An error message was added to indicate that the value does not fit into the 16-bit timer register. An error message advising developers to reduce the value to 16-bit simplifies the process, allowing them to understand immediately that reducing the value will resolve the issue. Signed-off-by: Marek Sroka <m.sroka14@gmail.com>
This commit is contained in:
parent
80a92f51a5
commit
226e381d6e
|
@ -330,6 +330,7 @@ static int pwm_stm32_set_cycles(const struct device *dev, uint32_t channel,
|
|||
*/
|
||||
if (!IS_TIM_32B_COUNTER_INSTANCE(cfg->timer) &&
|
||||
(period_cycles > UINT16_MAX + 1)) {
|
||||
LOG_ERR("Cannot set PWM output, value exceeds 16-bit timer limit.");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue