mirror of https://github.com/ARMmbed/mbed-os.git
pwmout - IMX - add read methods for period and pulsewidth
parent
ea6e806a31
commit
9f83ce1cc7
|
@ -194,6 +194,11 @@ void pwmout_period_us(pwmout_t* obj, int us)
|
||||||
pwmout_write(obj, dc);
|
pwmout_write(obj, dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pwmout_read_period_us(pwmout_t *obj)
|
||||||
|
{
|
||||||
|
return (base->SM[module].VAL1) & PWM_VAL1_VAL1_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
void pwmout_pulsewidth(pwmout_t *obj, float seconds)
|
void pwmout_pulsewidth(pwmout_t *obj, float seconds)
|
||||||
{
|
{
|
||||||
pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
|
pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
|
||||||
|
@ -223,6 +228,18 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
|
||||||
PWM_SetPwmLdok(base, (1 << module), true);
|
PWM_SetPwmLdok(base, (1 << module), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pwmout_read_pulsewidth_us(pwmout_t *obj {
|
||||||
|
uint16_t count;
|
||||||
|
|
||||||
|
if (pwmchannel == 0)
|
||||||
|
{
|
||||||
|
count = (base->SM[module].VAL3) & PWM_VAL3_VAL3_MASK;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
count = (base->SM[module].VAL5) & PWM_VAL5_VAL5_MASK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const PinMap *pwmout_pinmap()
|
const PinMap *pwmout_pinmap()
|
||||||
{
|
{
|
||||||
return PinMap_PWM;
|
return PinMap_PWM;
|
||||||
|
|
Loading…
Reference in New Issue