Samuel Flipo / Mbed 2 deprecated projetinterface

Dependencies:   BSP_DISCO_F746NG L3GD20H LCD_DISCO_F746NG TS_DISCO_F746NG mbed

Files at this revision

API Documentation at this revision

Comitter:
SamSF
Date:
Tue Jun 12 12:50:01 2018 +0000
Child:
1:262ed79fa7d7
Commit message:
Projet interface avec capteur L3GD20H

Changed in this revision

BSP_DISCO_F746NG.lib Show annotated file Show diff for this revision Revisions of this file
L3GD20H.lib Show annotated file Show diff for this revision Revisions of this file
LCD_DISCO_F746NG.lib Show annotated file Show diff for this revision Revisions of this file
TS_DISCO_F746NG.lib Show annotated file Show diff for this revision Revisions of this file
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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BSP_DISCO_F746NG.lib	Tue Jun 12 12:50:01 2018 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/BSP_DISCO_F746NG/#df2ea349c37a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/L3GD20H.lib	Tue Jun 12 12:50:01 2018 +0000
@@ -0,0 +1,1 @@
+http://os.mbed.com/users/julioefajardo/code/L3GD20H/#81b60e58e9e1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD_DISCO_F746NG.lib	Tue Jun 12 12:50:01 2018 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/LCD_DISCO_F746NG/#d44525b1de98
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TS_DISCO_F746NG.lib	Tue Jun 12 12:50:01 2018 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/ST/code/TS_DISCO_F746NG/#fe0cf5e2960f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Jun 12 12:50:01 2018 +0000
@@ -0,0 +1,90 @@
+#include "mbed.h"
+#include "TS_DISCO_F746NG.h"
+#include "LCD_DISCO_F746NG.h"
+#include"L3GD20H.h"
+#define GYR_ADDRESS 0xD6
+
+LCD_DISCO_F746NG lcd;
+TS_DISCO_F746NG ts;
+
+L3GD20H gyro(PB_9, PB_8);
+
+int main()
+{
+    TS_StateTypeDef TS_State;
+    ts.Init(420, 272);
+    //  uint32_t pY= 272.0, pX=480.0; //nombre de pixel sur notre écran
+
+    //Interface d'initilisation
+    int circle_X = 234; // position d'init du cercle en X
+    int circle_Y = 159; // position d'init du cercle en Y
+    short g[3];
+    bool tampon = false;
+    int i;
+    lcd.Clear(LCD_COLOR_BLUE);
+    lcd.SetBackColor(LCD_COLOR_BLUE);
+    lcd.SetTextColor(LCD_COLOR_WHITE);
+    lcd.DisplayStringAt(0, LINE(4), (uint8_t *)"INTERFACAGE POUR L3GD20H", CENTER_MODE); // Initialisation
+    lcd.SetFont(&Font16);
+    lcd.DisplayStringAt(0, LINE(8), (uint8_t *)"Cree par", CENTER_MODE);
+    lcd.DisplayStringAt(0, LINE(9), (uint8_t *)"Flipo Samuel", CENTER_MODE);
+    lcd.DisplayStringAt(0, LINE(10), (uint8_t *)"Bully Jerome", CENTER_MODE);
+    lcd.DisplayStringAt(0, LINE(11), (uint8_t *)"Barrocas Miguel", CENTER_MODE);
+    wait(2);
+    //Interface définitive
+    lcd.Clear(LCD_COLOR_WHITE); //Couleur d'arrière plan
+    lcd.SetFont(&Font24); //Taille de police @24
+    lcd.SetBackColor(LCD_COLOR_WHITE); //Fond d'écran du texte en bleu
+    lcd.SetTextColor(LCD_COLOR_BLUE); //Texte en blanc
+    lcd.DisplayStringAt(0,LINE(0),(uint8_t *)"GYROSCOPE L3GD20H", CENTER_MODE); // TITRE
+    lcd.SetFont(&Font12); // Taille de police @12
+    lcd.DisplayStringAt(0,236,(uint8_t *)"Flipo Samuel", LEFT_MODE); //Auteur 1
+    lcd.DisplayStringAt(0,248,(uint8_t *)"Bully Jerome", LEFT_MODE); //Auteur 2
+    lcd.DisplayStringAt(0,260,(uint8_t *)"Barrocas Miguel", LEFT_MODE); //Auteur 3
+    lcd.SetFont(&Font16); // Taille de police @16
+    while (1) {
+        ts.GetState(&TS_State);
+        gyro.read(g); //acquisition des données du gyroscope
+        /*sprintf(tmp, "%5d %5d %5d" , g[0], g[1],g[2]); //%hd uint16_t
+        lcd.SetTextColor(LCD_COLOR_BLUE);
+        lcd.DisplayStringAt(0, LINE(2),(uint8_t *)tmp,CENTER_MODE); // Affichage des valeurs*/ //utilité d'afficher les valeurs??
+
+        //------------------------------GESTION DE LA BOULE----------------------------------\\
+        //affichage de la zone de déplacement
+        BSP_LCD_DrawRect(5,40,460,190); //XPOS , YPOS, TAILLE X, TAILLE Y
+        for (i=0; i<=3; i++) {
+            g[i]=g[i]/1000; //"mise à l'échelle" data/pixel
+        }
+        lcd.SetTextColor(LCD_COLOR_WHITE);
+        BSP_LCD_FillCircle(circle_X,circle_Y,10); //effacement de l'ancien cercle
+        circle_X=circle_X+g[0];//déplacement sur l'axe X
+        circle_Y=circle_Y+g[2];//déplacement sur l'axe Y
+        if (circle_X <15) {
+            circle_X=15;   //limite vers la gauche
+        }
+        if (circle_X >450) {
+            circle_X=450;   //limite vers la droite
+        }
+        if (circle_Y <50) {
+            circle_Y=50;   //limite vers le haut
+        }
+        if (circle_Y >220) {
+            circle_Y=220;   //limite vers le bas
+        }
+        if (TS_State.touchDetected) { //ecran touché
+            tampon =not(tampon); //inversion de la variable tampon;
+            do {//Blocaque pour effectuer une seule inversion
+                ts.GetState(&TS_State);  //récup du TS
+            } while(TS_State.touchDetected !=0);
+        } //fin Touch Screen
+        if (tampon ==false) {
+            lcd.SetTextColor(LCD_COLOR_RED);   //boule en couleur rouge
+        } else if (tampon ==true) {
+            lcd.SetTextColor(LCD_COLOR_WHITE);   //boule en blanc
+
+        }
+        BSP_LCD_FillCircle(circle_X,circle_Y,10); //écriture de la boule rouge
+        wait(0.01); //attente pour le calcul
+        
+    } //fin while
+}//fin main
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Jun 12 12:50:01 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/5aab5a7997ee
\ No newline at end of file