Sunday, July 22, 2012

Blinky Lights

Not so long ago I mentioned that the dronz alarm clock in the jffs was nice but... even with the lid closed the LEDs on the zipit are too darn bright and keep me awake.  At least they're only green and amber, and not those evil blue ones that seem to be popping up on just about everything these days.  I swear the blue ones can trigger migraines and burn holes in the backs of your eyes, but that's a story for another day.

Anyhow, the LEDs have gotta go if I'm gonna get any sleep.  I already had a utility for controlling the right LED, so I just dug up the GPIO numbers for the other two LEDs from the wiki, and patched it into the existing IZ2S powerbutton and lid checking MCB program.  The only tricky bit was the GPIO for the  middle LED defaults to an input for some strange reason, so I had to borrow some more code to set the direction register.  That seems to work, so now you can softlink the new "lid" executable on the jffs (or copy it on IZ2S) to a bunch of new utilities for the left and middle LEDs.  I also added commands to query the current state of each of the LEDs, so they can be saved when the clock starts up, and restored when the alarm goes off.

Here's a zip file with the new "lid" executable, the source code, a script to make all the softlinks, and another script that prints all of the current LED states.  Nothing really exciting, but hey, I need my sleep.

ledctrl-iz2s.zip


1 comment:

  1. I've read blue leds spectrum can spread varyingly into the ultraviolet. Worse of all prolonged exposure to these can cause eye damage. It surprises me we don't hear more about them. :)

    ReplyDelete