This is small library for rotary encoders often found being used for controls or volume knobs in embedded platforms.
Go to file
Jake Goodwin 599f5a32d9 finished code and testing of functions on AVR 328P. 2023-03-02 21:16:03 -08:00
src finished code and testing of functions on AVR 328P. 2023-03-02 21:16:03 -08:00
AVR_ENCODER.hex finished code and testing of functions on AVR 328P. 2023-03-02 21:16:03 -08:00
LICENSE Initial commit 2023-03-03 04:18:44 +00:00
Makefile finished code and testing of functions on AVR 328P. 2023-03-02 21:16:03 -08:00
README.md finished code and testing of functions on AVR 328P. 2023-03-02 21:16:03 -08:00

README.md

AVR_ENCODER

This is small library for rotary encoders often found being used for controls or volume knobs in embedded platforms.

The recomended way to use the code is by calling the poll_encoder() function in the C file.

This allows the use of polling for monitoring the state of the encoder. This should be fine for most applications that don't require interrupts for encoder use.

The only issue would be if running the AVR at very very low speed and preforming too many other taskts to the point that the polling loop doesn't capture the full wave form from the encoder. But this is a well known weakness in polling.

Demo Funciton:

//This is just an example function of how you could use it.
int demo() {
    init_encoder();
    uint8_t volume = 0;
    led_blink(2);

    while(1) {
        switch(poll_encoder()) {
            case CW:
                if(volume < 100){volume++;}
                led_blink(1);
                break;
            case CCW:
                if(volume > 0){volume--;}
                led_blink(2);
                break;
            default:
                ;//nothing.
        }
        
        //Do other polling operations here
    }
    return 0;
}