Kaoss Guitar (Update 2) :: 27 Aug 2010

The touchscreen is now working. I'm using the internal pull-up resistor on the ADC pin to detect when the touchscreen isn't touched. The algorithm looks something like this:

    uint16_t x = touch_get_x();
    // ADC values go from 0-1023, so a value over 1000 indicates
    // that the screen isn't being touched and the resistor is
    // what's pulling the value high. The value when someone
    // is touching the screen varies from around 100 to 900.
    if(x > 1000) {
        // Screen is not being touched
    } else {
        // Screen is being touched
        x = touch_normalize_x(x);
        // ...
    }
    

Comments

blog comments powered by Disqus