Éric Bisson
/
Code_APP3_R
app3
Fork of Code_APP1 by
Sensors/IO_p15.cpp@9:dc81d8ee4a97, 2017-02-14 (annotated)
- Committer:
- ericbisson
- Date:
- Tue Feb 14 04:11:07 2017 +0000
- Revision:
- 9:dc81d8ee4a97
app3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ericbisson | 9:dc81d8ee4a97 | 1 | #include "IO_p15.h" |
ericbisson | 9:dc81d8ee4a97 | 2 | |
ericbisson | 9:dc81d8ee4a97 | 3 | DigitalIn btn(p15); |
ericbisson | 9:dc81d8ee4a97 | 4 | bool bLastState = false; |
ericbisson | 9:dc81d8ee4a97 | 5 | |
ericbisson | 9:dc81d8ee4a97 | 6 | //--------------------------------------------------------------// |
ericbisson | 9:dc81d8ee4a97 | 7 | // Fonction pour l'envoie de données pour le bouton |
ericbisson | 9:dc81d8ee4a97 | 8 | // Testé et fonctionnel |
ericbisson | 9:dc81d8ee4a97 | 9 | //--------------------------------------------------------------// |
ericbisson | 9:dc81d8ee4a97 | 10 | void func_button(CArray* DATA_TO_SEND) |
ericbisson | 9:dc81d8ee4a97 | 11 | { |
ericbisson | 9:dc81d8ee4a97 | 12 | if (!bLastState == btn) |
ericbisson | 9:dc81d8ee4a97 | 13 | { |
ericbisson | 9:dc81d8ee4a97 | 14 | DATA_TO_SEND->_ptr = new char[1]; |
ericbisson | 9:dc81d8ee4a97 | 15 | DATA_TO_SEND->_ptr[0] = btn; |
ericbisson | 9:dc81d8ee4a97 | 16 | DATA_TO_SEND->size = 1; |
ericbisson | 9:dc81d8ee4a97 | 17 | } |
ericbisson | 9:dc81d8ee4a97 | 18 | bLastState = btn; |
ericbisson | 9:dc81d8ee4a97 | 19 | } |
ericbisson | 9:dc81d8ee4a97 | 20 | //--------------------------------------------------------------// |