mirror of https://github.com/ARMmbed/mbed-os.git
parent
95dc61dac3
commit
c83307e96c
|
@ -297,7 +297,7 @@ void pwmout_pulsewidth(pwmout_t *obj, float pulse)
|
||||||
DEBUG_PRINTF("pwmout_pulsewidt: %f\r\n", pulse);
|
DEBUG_PRINTF("pwmout_pulsewidt: %f\r\n", pulse);
|
||||||
|
|
||||||
/* Cap pulsewidth to period before setting it. */
|
/* Cap pulsewidth to period before setting it. */
|
||||||
if ((pulse * 1000000) > (float) (obj->pulse & ~SEQ_POLARITY_BIT)) {
|
if ((pulse * 1000000) > (float) obj->period) {
|
||||||
obj->pulse &= SEQ_POLARITY_BIT;
|
obj->pulse &= SEQ_POLARITY_BIT;
|
||||||
obj->pulse |= obj->period;
|
obj->pulse |= obj->period;
|
||||||
pwmout_pulsewidth_us(obj, obj->pulse);
|
pwmout_pulsewidth_us(obj, obj->pulse);
|
||||||
|
@ -354,4 +354,3 @@ const PinMap *pwmout_pinmap()
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DEVICE_PWMOUT
|
#endif // DEVICE_PWMOUT
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue