/elec/propeller-clock

To get this branch, use:
bzr branch http://bzr.ed.am/elec/propeller-clock

« back to all changes in this revision

Viewing changes to src/button.h

  • Committer: Tim Marston
  • Date: 2012-05-23 23:02:50 UTC
  • Revision ID: tim@ed.am-20120523230250-3pls2u6zt3av0uam
fixed text glitch; extended all modes; added screen flip super-long press;
added button unpress debounde; moved interim button press ignoration to
settings mode; fixed left-over led issue; finished for demo!

Show diffs side-by-side

added added

removed removed

61
61
         */
62
62
        int get_event();
63
63
 
 
64
        /**
 
65
         * Get the current button state.
 
66
         *
 
67
         * @return true if the button is pressed
 
68
         */
 
69
        bool get_state();
 
70
 
64
71
protected:
65
72
 
66
73
        /** pin */
67
74
        int _pin;
68
75
 
69
 
        /** last state */
70
 
        bool _state_last;
71
 
 
72
 
        /** time when this state began */
 
76
        /** last real state */
 
77
        bool _last_real_state;
 
78
 
 
79
        /** time when the real state began */
 
80
        unsigned long _millis_real_state;
 
81
 
 
82
        /** accepted state */
 
83
        bool _state;
 
84
 
 
85
        /** time when the accepted state began */
73
86
        unsigned long _millis_state;
74
87
 
75
88
        /** amount of time that we've already triggered events for this press */
80
93
 
81
94
        /** pending event */
82
95
        int _pending_event;
83
 
 
84
 
        /** an interim event buffer */
85
 
        int _interim_event;
86
 
 
87
 
        /** send interim events? */
88
 
        bool _send_interim;
89
 
 
90
 
        /** when not sending interim events, ignore the next unpress */
91
 
        bool _ignore_next_unpress;
92
 
 
93
96
};
94
97
 
95
98