Private
Public Access
2
0

pwm: added existing exposition logic

* Understands when pwm pin is already exported.
* Will not unexport if didnt export. Can be forced.

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:
Thomas Ingleby
2014-05-20 13:38:15 +01:00
committed by Brendan Le Foll
parent fa7180cb91
commit 5fa6f50edc
3 changed files with 66 additions and 17 deletions

View File

@@ -36,11 +36,13 @@ namespace maa {
class Pwm {
public:
Pwm(int pin, int chipid=-1) {
Pwm(int pin, int chipid=-1, bool owner = true) {
if (chipid == -1)
m_pwm = maa_pwm_init(pin);
else
m_pwm = maa_pwm_init_raw(pin, chipid);
if (!owner)
maa_pwm_owner(m_pwm, 0);
}
~Pwm() {
maa_pwm_close(m_pwm);