Modified version to work with EventQueue (outside of ISR)

Committer:
ohtsuka
Date:
Fri Jun 10 08:09:22 2016 +0000
Revision:
0:9c5c674dcaea
Child:
1:67d677ad73e7
first commit.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ohtsuka 0:9c5c674dcaea 1 #include "mbed.h"
ohtsuka 0:9c5c674dcaea 2
ohtsuka 0:9c5c674dcaea 3 class MultiClick
ohtsuka 0:9c5c674dcaea 4 {
ohtsuka 0:9c5c674dcaea 5 public:
ohtsuka 0:9c5c674dcaea 6 MultiClick(PinName pin);
ohtsuka 0:9c5c674dcaea 7 MultiClick(PinName pin, PinMode m);
ohtsuka 0:9c5c674dcaea 8 void attach_clicked(void (*function)(void));
ohtsuka 0:9c5c674dcaea 9 void attach_doubleclicked(void (*function)(void));
ohtsuka 0:9c5c674dcaea 10 void attach_n_clicked(void (*function)(int));
ohtsuka 0:9c5c674dcaea 11
ohtsuka 0:9c5c674dcaea 12 private:
ohtsuka 0:9c5c674dcaea 13 void isr(void);
ohtsuka 0:9c5c674dcaea 14 void click_timeout( void );
ohtsuka 0:9c5c674dcaea 15
ohtsuka 0:9c5c674dcaea 16 Timeout *_timeout;
ohtsuka 0:9c5c674dcaea 17 InterruptIn *_iin;
ohtsuka 0:9c5c674dcaea 18 PinMode _mode;
ohtsuka 0:9c5c674dcaea 19
ohtsuka 0:9c5c674dcaea 20 float _click_interval;
ohtsuka 0:9c5c674dcaea 21 int _longpress;
ohtsuka 0:9c5c674dcaea 22
ohtsuka 0:9c5c674dcaea 23 int _click_times;
ohtsuka 0:9c5c674dcaea 24
ohtsuka 0:9c5c674dcaea 25 void (*_c_callback_clicked)(void);
ohtsuka 0:9c5c674dcaea 26 void (*_c_callback_doubleclicked)(void);
ohtsuka 0:9c5c674dcaea 27 void (*_c_callback_n_clicked)(int);
ohtsuka 0:9c5c674dcaea 28 };