pwm: add period write replace hook
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
This commit is contained in:
@@ -49,4 +49,6 @@ typedef struct {
|
|||||||
|
|
||||||
mraa_result_t (*i2c_init_pre) (unsigned int bus);
|
mraa_result_t (*i2c_init_pre) (unsigned int bus);
|
||||||
mraa_result_t (*i2c_init_post) (mraa_i2c_context dev);
|
mraa_result_t (*i2c_init_post) (mraa_i2c_context dev);
|
||||||
|
|
||||||
|
mraa_result_t (*pwm_period_replace) (mraa_pwm_context dev, int period);
|
||||||
} mraa_adv_func_t;
|
} mraa_adv_func_t;
|
||||||
|
|||||||
@@ -60,6 +60,9 @@ mraa_pwm_setup_duty_fp(mraa_pwm_context dev)
|
|||||||
static mraa_result_t
|
static mraa_result_t
|
||||||
mraa_pwm_write_period(mraa_pwm_context dev, int period)
|
mraa_pwm_write_period(mraa_pwm_context dev, int period)
|
||||||
{
|
{
|
||||||
|
if (advance_func->pwm_period_replace != NULL)
|
||||||
|
return advance_func->pwm_period_replace(dev,period);
|
||||||
|
|
||||||
char bu[MAX_SIZE];
|
char bu[MAX_SIZE];
|
||||||
snprintf(bu,MAX_SIZE ,"/sys/class/pwm/pwmchip%d/pwm%d/period", dev->chipid, dev->pin);
|
snprintf(bu,MAX_SIZE ,"/sys/class/pwm/pwmchip%d/pwm%d/period", dev->chipid, dev->pin);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user