There is an issue that mraa_pwm_write would fail, because mraa_pwm_read
would fail and return 0. When the read fails, journalctl shows an
error:
Dec 28 18:01:38 Edison libmraa[365]: pwm: Error in reading period
So now trying version, where the pwm object caches the period, that is
updated whenever you do a read or write of the period. Side benefit is
that the write should be sped up.
Signed-off-by: Kurt Eckhardt <kurte@rockisland.com>
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
Added minimum, maximum and default period settings to board definitions
PWM will now have a default period as defined in the board defintion.
When using pwm_write() writing 1.0f or above will default to 100%.
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
syslog messages should be written as <module>: Message in order to increase
readability and usefulness
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
* Fix a few resource leaks in error conditions
* Makes strtol() calls safer in pwm module
* Make sure buffer is terminated after read() in aio
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Syslog is now used for all error messages, return values in the code should be
used by programmers to see the status of the library/board and syslog can be
used to see quickly from a debugging perspective what has gone wrong. A few
cosmetics where improved as well as a mraa_set_log_level() call where the
syslog log mask can be set directly from libmraa.
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
* Allows user to set both at the same time. Will reset to previous if
* period for duty cycle fails to write
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
Based on feedback received. All check functions renamed to setup.
Update all modules to use new name and header.
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
* 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>
* maa_pwm_context becomes an opaque pointer
* C++ wrapper class Pwm
* swig now uses C++ wrapper Pwm to generate API
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
* Intended function of check_pwm also checks for conflicting gpio, due
* to quirk on galileo rev d, functionality commented.
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
* Removed all C++ code and renamed all .cxx extensions to .c
* All functions are renamed to maa_ and modules are for example called maa_pwm
* Cmake can now 'make doc' using a Doxyfile.in to create documentation
* examples/ have been updated but swig generated API is untested
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>