Yves Roy
/
247-637-th4
Exemple fait en classe th4 du cours 247-637 (2017)
Revision 0:669a6bff2494, committed 2017-09-15
- Comitter:
- YROY2004
- Date:
- Fri Sep 15 20:02:05 2017 +0000
- Commit message:
- 2017-08 247-637 Exemple fait en classe lors du cours th4
Changed in this revision
diff -r 000000000000 -r 669a6bff2494 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Sep 15 20:02:05 2017 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" + +#include "processusUART.h" +#include "processusExemple.h" +#include "processusBouton.h" + + + +void initialiseMain(void) +{ + initialiseUART(); + initialiseBouton(); + initialiseExemple(); + } + + +int main() +{ + while(1) { + wait(1); + gereBouton(); + gereExemple(); + gereUART(); + } +}
diff -r 000000000000 -r 669a6bff2494 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Sep 15 20:02:05 2017 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/675da3299148 \ No newline at end of file
diff -r 000000000000 -r 669a6bff2494 processusBouton.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/processusBouton.cpp Fri Sep 15 20:02:05 2017 +0000 @@ -0,0 +1,20 @@ +#include "mbed.h" +#include "processusBouton.h" + +uint16_t etatBouton; + + +DigitalIn bouton1(USER_BUTTON); + +void initialiseBouton(void) +{ + etatBouton = 0; +} + +void gereBouton(void) +{ + if (bouton1 == 1) + { + etatBouton = 1; + } +} \ No newline at end of file
diff -r 000000000000 -r 669a6bff2494 processusBouton.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/processusBouton.h Fri Sep 15 20:02:05 2017 +0000 @@ -0,0 +1,11 @@ +#ifndef PROCESSUS_BOUTON_H +#define PROCESSUS_BOUTON_H + +extern uint16_t etatBouton; + + + +void initialiseBouton(void); +void gereBouton(void); + +#endif \ No newline at end of file
diff -r 000000000000 -r 669a6bff2494 processusExemple.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/processusExemple.cpp Fri Sep 15 20:02:05 2017 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" +#include "processusUART.h" +#include "processusBouton.h" +#include "processusExemple.h" + +void initialiseExemple(void) +{ +} + + +void gereExemple(void) +{ + if (etatBouton == 1) + { + messagePret = PROCESSUS_UART_PRET; + } +} \ No newline at end of file
diff -r 000000000000 -r 669a6bff2494 processusExemple.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/processusExemple.h Fri Sep 15 20:02:05 2017 +0000 @@ -0,0 +1,7 @@ +#ifndef PROCESSUS_EXEMPLE_H +#define PROCESSUS_EXEMPLE_H + +void initialiseExemple(void); +void gereExemple(void); + +#endif \ No newline at end of file
diff -r 000000000000 -r 669a6bff2494 processusUART.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/processusUART.cpp Fri Sep 15 20:02:05 2017 +0000 @@ -0,0 +1,24 @@ +#include "mbed.h" +#include "processusUART.h" + + +Serial pc(SERIAL_TX, SERIAL_RX); + +uint16_t messagePret; + +void initialiseUART(void) +{ + messagePret = 0; + +} + +void gereUART(void) +{ + if (messagePret == 1) + { + pc.printf("bouton.\n"); + } + +} + +
diff -r 000000000000 -r 669a6bff2494 processusUART.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/processusUART.h Fri Sep 15 20:02:05 2017 +0000 @@ -0,0 +1,20 @@ +#ifndef PROCESSUS_UART_H +#define PROCESSUS_UART_H + + +//------------------------------------ +// Hyperterminal configuration +// 9600 bauds, 8-bit data, no parity +//------------------------------------ + + +#define PROCESSUS_UART_PRET 1 +#define PROCESSUS_UART_LIBRE 0 + +extern uint16_t messagePret; + +void initialiseUART(void); +void gereUART(void); + + +#endif \ No newline at end of file