Skip to content

Commit

Permalink
pwm: remove pwm config_* apis as unused
Browse files Browse the repository at this point in the history
Signed-off-by: Brendan Le Foll <[email protected]>
  • Loading branch information
arfoll committed Apr 25, 2016
1 parent c524c3d commit 4195a61
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 104 deletions.
20 changes: 0 additions & 20 deletions api/mraa/pwm.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,26 +166,6 @@ mraa_result_t mraa_pwm_owner(mraa_pwm_context dev, mraa_boolean_t owner);
*/
mraa_result_t mraa_pwm_close(mraa_pwm_context dev);

/**
* Set Both Period and DutyCycle on a PWM context
*
* @param dev The pwm context to use
* @param period represented in ms.
* @param duty dutycycle of the pwm signal.
* @return Result of operation
*/
mraa_result_t mraa_pwm_config_ms(mraa_pwm_context dev, int period, float duty);

/**
* Set Both Period and DutyCycle on a PWM context. Duty represented as percentage.
*
* @param dev The pwm context to use
* @param period represented in ms.
* @param duty duty percantage. i.e. 50% = 0.5f
* @return Result of operation
*/
mraa_result_t mraa_pwm_config_percent(mraa_pwm_context dev, int period, float duty);

/**
* Get the maximum pwm period in us
*
Expand Down
24 changes: 0 additions & 24 deletions api/mraa/pwm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,30 +178,6 @@ class Pwm
{
return (Result) mraa_pwm_enable(m_pwm, enable);
}
/**
* Set the period and duty of a PWM object.
*
* @param period represented in ms.
* @param duty represnted in ms as float.
* @return Result of operation
*/
Result
config_ms(int period, float duty)
{
return (Result) mraa_pwm_config_ms(m_pwm, period, duty);
}
/**
* Set the period and duty (percent) of a PWM object.
*
* @param period as represented in ms.
* @param duty percentage i.e. 50% = 0.5f
* @return Result of operation
*/
Result
config_percent(int period, float duty)
{
return (Result) mraa_pwm_config_percent(m_pwm, period, duty);
}
/**
* Get the maximum pwm period in us
*
Expand Down
60 changes: 0 additions & 60 deletions src/pwm/pwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,66 +516,6 @@ mraa_pwm_owner(mraa_pwm_context dev, mraa_boolean_t owner_new)
return MRAA_SUCCESS;
}

mraa_result_t
mraa_pwm_config_ms(mraa_pwm_context dev, int ms, float ms_float)
{
int old_dutycycle, old_period, status;

if (!dev) {
syslog(LOG_ERR, "pwm: config_ms: context is NULL");
return MRAA_ERROR_INVALID_HANDLE;
}

old_dutycycle = mraa_pwm_read_duty(dev);
old_period = mraa_pwm_read_period(dev);
status = mraa_pwm_period_us(dev, ms * 1000);
if (status != MRAA_SUCCESS) {
mraa_pwm_write_duty(dev, old_dutycycle);
return status;
}
status = mraa_pwm_write_duty(dev, 0);
if (status != MRAA_SUCCESS) {
return status;
}
status = mraa_pwm_pulsewidth_us(dev, ms_float * 1000);
if (status != MRAA_SUCCESS) {
mraa_pwm_write_duty(dev, old_dutycycle);
mraa_pwm_write_period(dev, old_period);
return status;
}
return MRAA_SUCCESS;
}

mraa_result_t
mraa_pwm_config_percent(mraa_pwm_context dev, int ms, float percentage)
{
int old_dutycycle, old_period, status;

if (!dev) {
syslog(LOG_ERR, "pwm: config_percent: context is NULL");
return MRAA_ERROR_INVALID_HANDLE;
}

old_dutycycle = mraa_pwm_read_duty(dev);
old_period = mraa_pwm_read_period(dev);
status = mraa_pwm_period_us(dev, ms * 1000);
if (status != MRAA_SUCCESS) {
mraa_pwm_write_duty(dev, old_dutycycle);
return status;
}
status = mraa_pwm_write_duty(dev, 0);
if (status != MRAA_SUCCESS) {
return status;
}
status = mraa_pwm_pulsewidth_us(dev, (ms * 1000) * percentage);
if (status != MRAA_SUCCESS) {
mraa_pwm_write_duty(dev, old_dutycycle);
mraa_pwm_write_period(dev, old_period);
return status;
}
return MRAA_SUCCESS;
}

int
mraa_pwm_get_max_period(mraa_pwm_context dev)
{
Expand Down

0 comments on commit 4195a61

Please sign in to comment.