247-637-2017 / Mbed 2 deprecated 247-637-th4

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
YROY2004
Date:
Fri Sep 15 20:02:05 2017 +0000
Child:
1:204d168becaa
Commit message:
2017-08 247-637 Exemple fait en classe lors du cours th4

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
processusBouton.cpp Show annotated file Show diff for this revision Revisions of this file
processusBouton.h Show annotated file Show diff for this revision Revisions of this file
processusExemple.cpp Show annotated file Show diff for this revision Revisions of this file
processusExemple.h Show annotated file Show diff for this revision Revisions of this file
processusUART.cpp Show annotated file Show diff for this revision Revisions of this file
processusUART.h Show annotated file Show diff for this revision Revisions of this file
--- /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();
+    }
+}
--- /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
--- /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
--- /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
--- /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
--- /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
--- /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");
+    }
+
+}
+
+
--- /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