From db97f3663168a138461d5b693aa285b67a0193d5 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 11 Oct 2017 22:50:29 -0400 Subject: gpiocmds: Allow the start value for a pin to differ from the default_value Allow the start value to be different from the default/shutdown value for the pin. This will be useful for "heater fans" that should startup in the off state, and transition to full on in a shutdown state. Signed-off-by: Kevin O'Connor --- src/pwmcmds.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/pwmcmds.c') diff --git a/src/pwmcmds.c b/src/pwmcmds.c index 82326b9d..cf025ddb 100644 --- a/src/pwmcmds.c +++ b/src/pwmcmds.c @@ -37,14 +37,15 @@ pwm_event(struct timer *timer) void command_config_pwm_out(uint32_t *args) { + struct gpio_pwm pin = gpio_pwm_setup(args[1], args[2], args[3]); struct pwm_out_s *p = oid_alloc(args[0], command_config_pwm_out, sizeof(*p)); - p->default_value = args[3]; - p->pin = gpio_pwm_setup(args[1], args[2], p->default_value); - p->max_duration = args[4]; + p->pin = pin; + p->default_value = args[4]; + p->max_duration = args[5]; } DECL_COMMAND(command_config_pwm_out, - "config_pwm_out oid=%c pin=%u cycle_ticks=%u default_value=%hu" - " max_duration=%u"); + "config_pwm_out oid=%c pin=%u cycle_ticks=%u value=%hu" + " default_value=%hu max_duration=%u"); void command_schedule_pwm_out(uint32_t *args) -- cgit v1.2.3-70-g09d2