Closed edlins closed 6 years ago
Alternately this could be done with an extern unsigned char _PCA9685_MODE1_OPTIONS
that is set directly from applications instead of adding a function.
int ret = PCA9685_MODE1_opts(0x00 | _PCA9685_SUB1BIT | _PCA9685_ALLCALLBIT);
I like this! I would like the ability to use it to clear the AUTOINC bit if I so choose, however. (Although off the top of my head I cannot think of a situation where it would really be hurting anything)
I think I will look at this tonight, but if I don't get to it tonight it's highly unlikely that I will have time over the weekend so if you don't see anything tonight you won't see anything for a few days at least.
Added the PR #20 for this.
If there's anything you don't like about the implementation feel free to let me know (just don't dock my pay). :)
Edit: Just committed the change to remove setting the ALLCALL bit by default.
Added PR #24 for my solution. Please test this before I merge into develop. Also LMK if you have any feedback on the code changes. Thanks!
This got a little ugly with unrelated changes that I didn't branch out, but I'm confident so I merged it. If there's a problem, please open a new issue.
MUST HAVE
PCA9685
MODE1
ALLCALL
bit.PCA9685_initPWM()
to clear_PCA9685_ALLCALLBIT
by default.NICE TO HAVE
MODE1
andMODE2
.Right now,
develop
is hardcoded to setALLCALL
. It should change to clearALLCALL
. Add a new functionint PCA9685_MODE1_opts(unsigned char)
where theunsigned char
represents the options inMODE1
as defined inPCA9685.h
.PCA9685_initPWM(int, unsigned char, unsigned int)
should use reasonable defaults whenPCA9685_MODE1_opts()
is not called._PCA9685_AUTOINCBIT
should always be set (that's half the point of the lib).