Source code for the Curilights Controller. See http://www.saccade.com/writing/projects/CuriController/ for details.
Dependencies: FatFileSystem mbed
This is the source code for the Curilights controller. This lets you interactively control a string of Curilights. It provides a simple click-wheel user interface for changing colors, brightness and behavior. It responds to movement and lighting.
Finished Controller
System Block Diagram
Diff: RotaryEncoder.h
- Revision:
- 0:6da5625a6946
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RotaryEncoder.h Thu Dec 29 01:59:53 2011 +0000 @@ -0,0 +1,45 @@ +// Rotary Encoder +// Support for the rotary encoder control, +// typically a knob with quadrature output. + +#ifndef _ROTARY_ENCODER_ +#define _ROTARY_ENCODER_ + +#ifndef MBED_H +#include "mbed.h" +#endif + +#ifndef AJK_PIN_DETECT_H +#include "PinDetect.h" +#endif + +#ifndef AJK_FPOINTER_H +#include "FPointer.h" +#endif + +class RotaryEncoder +{ + public: + RotaryEncoder( PinName a, PinName b, PinMode mode = PullDown ); + + void attach( int32_t (*function)(int32_t) = 0) + { fCallback.attach( function ); } + + template<typename T> + void attach(T* item, int32_t (T::*method)(int32_t)) + { fCallback.attach( item, method ); } + + void detach() { fCallback = FPointer(); } + + private: + DigitalIn fPinA; + PinDetect fPinB; + + FPointer fCallback; + + void debug( const char *where ); + + void bRise(); + +}; +#endif