Skip to content

Commit 2d5e517

Browse files
committed
pwmout - RZ_A2XX - add read methods for period and pulsewidth
1 parent c4559ba commit 2d5e517

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

targets/TARGET_RENESAS/TARGET_RZ_A2XX/pwmout_api.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ void pwmout_period_us(pwmout_t *obj, int us)
166166
pwmout_write(obj, obj->duty);
167167
}
168168

169+
int pwmout_read_period_us(pwmout_t *obj)
170+
{
171+
return obj->pwm->GTPR.LONG;
172+
}
173+
169174
void pwmout_pulsewidth(pwmout_t *obj, float seconds)
170175
{
171176
pwmout_pulsewidth_us(obj, seconds * 1000000.0f);
@@ -188,6 +193,14 @@ void pwmout_pulsewidth_us(pwmout_t *obj, int us)
188193
pwmout_write(obj, value);
189194
}
190195

196+
int pwmout_read_pulsewidth_us(pwmout_t *obj)
197+
{
198+
if (obj->type == 0) {
199+
return (float)obj->pwm->GTCCRC.LONG;
200+
}
201+
return (float)obj->pwm->GTCCRE.LONG ;
202+
}
203+
191204
const PinMap *pwmout_pinmap()
192205
{
193206
return PinMap_PWM;

0 commit comments

Comments
 (0)