pwm.c: cache period
authorKurt Eckhardt <kurte@rockisland.com>
Mon, 29 Dec 2014 15:18:16 +0000 (07:18 -0800)
committerThomas Ingleby <thomas.c.ingleby@intel.com>
Mon, 5 Jan 2015 15:24:28 +0000 (15:24 +0000)
commit41956b07d65bfaed7e872632a67af385f5fbacc4
tree816d2832dec9f1a1f1ac2d6378cad0a939673362
parent3eb0a8dbf77a8d6243faa900244f3db4888ab31c
pwm.c: cache period

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>
include/mraa_internal_types.h
src/pwm/pwm.c