Hacker News new | ask | show | jobs
by seltzered_ 2216 days ago
It's not just the sensor. I'd warn people trying to DIY from scratch to make sure you really think of the full gestalt of a touch / gesture experience which spans:

- Mechanics (a good surface, sensing)

- Robustly designed state machines to track states even before your finger lands.

- Math (to deal with finger acceleration, stabilization)

- Feedback! Mechanical clicking, piezo, weight actuation, etc. I cringe when I see projects lacking feedback.

As a teaser here's my messy breakdown of the macbook trackpad states, based on things done back around 2008/2009 (http://blog.sendapatch.se/2009/november/multitouch-on-unibod...):

    enum RawTouchStateOneValues {
        TOUCH_STARTED_STATE = 1,       // initial touch started state - i.e. first frame of a touch. warning on this state: StateTwoValues seem invalid here
        TOUCH_HOVERING_STATE = 2,      // multi-frame: typically occurs when a touch is about to land. 
        TOUCH_LANDED_ON_PAD_STATE = 3, // usually single-frame, but can occur multiple times if a touch hovers and returns (from state 6,2,1) - you can also go here from state 6, which means a hanging touch can 'return'
        TOUCH_ON_PAD_STATE = 4,        // typical duration of a touch - moving around on pad
        TOUCH_LEAVING_PAD_STATE = 5,   // usually single-frame - 
        TOUCH_LEFT_NOW_HOVERING_STATE = 6, // multi-frame: occurs when a touch occurred but then left pad (state 5), and is now hovering
        TOUCH_ENDED_STATE = 7          // single-frame: touch finally ends
    };

    enum RawTouchStateTwoValues {
        TOUCH_DETECTED_ALTSTATE = 0, //state only seems to occur on initial touch (stateOne's TOUCH_STARTED_STATE), which I filter out 
        TOUCH_RESTING = 1,
        TOUCH_NON_RESTING = 2,
        TOUCH_NON_RESTING_AGAIN = 3,
        TOUCH_THIRD_TOUCH = 4,
        TOUCH_EDGE_REGION = 5, //only observed on magic trackpad - seems to occur when starting at the edge.
        TOUCH_SIXTH_TOUCH = 6,
        TOUCH_GROWING_FROM_EDGE = 7, //both cases 12 and 7 seem be used for palm-rejection scenarios
        TOUCH_EIGHTH_TOUCH = 8,
        TOUCH_NINTH_TOUCH = 9,
        TOUCH_TENTH_TOUCH = 10,
        TOUCH_ELEVENTH_TOUCH = 11,
        TOUCH_COMING_FROM_EDGE = 12 //both cases 12 and 7 seem be used for palm-rejection scenarios
        
        //other states observed but unknown - 4 (seems to consistently occur when I have three fingers down. 
        //                                         likely occurs in certain pad regions)
        // 
    };