/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-03-21 20:35:28 UTC
  • Revision ID: tim@ed.am-20120321203528-wfhpych1tub75rgj
fixed bug initialising text services on mode activation

Show diffs side-by-side

added added

removed removed

43
43
        void set_event_times( int *event_times );
44
44
 
45
45
        /**
46
 
         * Set button press mode
47
 
         *
48
 
         * @param send_interim send interim presses during a long press?
49
 
         */
50
 
        void set_press_mode( bool send_interim );
51
 
 
52
 
        /**
53
46
         * Update internal state (call as regularly sa possible!)
54
47
         */
55
48
        void update();
61
54
         */
62
55
        int get_event();
63
56
 
64
 
        /**
65
 
         * Get the current button state.
66
 
         *
67
 
         * @return true if the button is pressed
68
 
         */
69
 
        bool get_state();
70
 
 
71
57
protected:
72
58
 
73
59
        /** pin */
74
60
        int _pin;
75
61
 
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 */
 
62
        /** current state */
83
63
        bool _state;
84
64
 
85
 
        /** time when the accepted state began */
86
 
        unsigned long _millis_state;
 
65
        /** time when current state began */
 
66
        unsigned long _state_millis;
87
67
 
88
 
        /** amount of time that we've already triggered events for this press */
89
 
        unsigned long _millis_done;
 
68
        /** milliseconds that have been accountred for (in terms of
 
69
         * triggering events) since current state began */
 
70
        unsigned long _state_duration;
90
71
 
91
72
        /** pointer to event times */
92
73
        int *_event_times;
93
74
 
94
75
        /** pending event */
95
76
        int _pending_event;
 
77
 
96
78
};
97
79
 
98
80