I have seen some other APIs for setting the backlight.
I think one would be useful to incorporate as well.
I have seen backlight() and noBackight() as well.
To turn the backlight on and off (no dimming).
I bring this up because in the Arduino core code if you call analogWrite() on a pin that does not support pwm,
the code will set the pin to LOW for values 0-127 and HIGH for values 128-255.
In my opinion this is wrong, I think any pin that does not support pwm should be LOW for 0 and HIGH for
any other value.
Because of this core code, it makes it very difficult to implement the setBacklight() function as it is intended
to work because any value between 1-127 will turn the backlight off vs turn it on.
I'm wrestling with this very issue in the glcd library.
My thought for glcd is to add all three:
backlight() turns on the backlight
noBacklight() turns of the backlight()
setBacklight() can either call analogWrite() - which technically does not implement the lcd 1.0 api becaue
of the core code.
or it calls backlight()/noBacklight() depending on the value.
(I'll have a "hidden" ifdef/define to control the setBacklight behavior but by default it won't support dimming)
While backlight dimming is cool and I've played around with it for some cool blink effects,
my preference is actually for backlight() noBacklight() as it ensures a consistent interface and
functionality across all hardware that supports backlight control, but that is just my person opinion.
In the mean time I'm going to try to lobby the Arduino team to change the analogWrite() behavior on
non pwm pins.