pwm: changed to use strtol for return values.
* Minor spelling corrections * Small format change in function. Incorrect spacing. Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com> Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
committed by
Brendan Le Foll
parent
6333a21c6f
commit
0c82a47fe4
@@ -27,7 +27,7 @@
|
|||||||
#include "pwm.h"
|
#include "pwm.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A strucutre representing a PWM pin
|
* A structure representing a PWM pin
|
||||||
*/
|
*/
|
||||||
struct _pwm {
|
struct _pwm {
|
||||||
/*@{*/
|
/*@{*/
|
||||||
@@ -95,7 +95,9 @@ maa_pwm_get_period(maa_pwm_context dev)
|
|||||||
}
|
}
|
||||||
fgets(output, 16, period_f);
|
fgets(output, 16, period_f);
|
||||||
fclose(period_f);
|
fclose(period_f);
|
||||||
return atoi(output);
|
int ret = strtol(output, NULL, 10);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@@ -107,7 +109,9 @@ maa_pwm_get_duty(maa_pwm_context dev)
|
|||||||
char output[16];
|
char output[16];
|
||||||
fgets(output, 16, dev->duty_fp);
|
fgets(output, 16, dev->duty_fp);
|
||||||
fseek(dev->duty_fp, SEEK_SET, 0);
|
fseek(dev->duty_fp, SEEK_SET, 0);
|
||||||
return atoi(output);
|
|
||||||
|
int ret = strtol(output, NULL, 10);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
maa_pwm_context
|
maa_pwm_context
|
||||||
@@ -150,7 +154,7 @@ maa_pwm_init_raw(int chipin, int pin)
|
|||||||
maa_result_t
|
maa_result_t
|
||||||
maa_pwm_write(maa_pwm_context dev, float percentage)
|
maa_pwm_write(maa_pwm_context dev, float percentage)
|
||||||
{
|
{
|
||||||
return maa_pwm_write_duty(dev, percentage * maa_pwm_get_period(dev));
|
return maa_pwm_write_duty(dev, percentage * maa_pwm_get_period(dev));
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
|
|||||||
Reference in New Issue
Block a user