Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: LCD_DISCO_F429ZI mbed BSP_DISCO_F429ZI
Diff: Horloges/horloge.cpp
- Revision:
- 33:31271a36a9a4
- Parent:
- 32:8ad4b5555e6e
- Child:
- 35:bda112796505
--- a/Horloges/horloge.cpp Thu May 16 08:50:03 2019 +0000
+++ b/Horloges/horloge.cpp Thu May 16 10:17:34 2019 +0000
@@ -1,6 +1,16 @@
#include "horloge.h"
-char VRGL_AFFICHAGE_ELEMENTS = 1; //Cette variable globale vaut 1 si on affiche les éléments et vaut 0 sinon
+char VRGL_AFFICHAGE_ELEMENTS = 0; //Cette variable globale vaut 1 si on affiche les éléments et vaut 0 sinon
+DigitalIn PinSwEl(PG_2); //Bouton utile pour changer le mode d'affichage
+
+void H_toogleElem(){
+ if(PinSwEl.read()){
+ while(PinSwEl.read()){
+ ;
+ }
+ VRGL_AFFICHAGE_ELEMENTS=!VRGL_AFFICHAGE_ELEMENTS;
+ }
+}
void H_ChangeHour(temps* moment,int mod){
if(mod){
@@ -41,34 +51,41 @@
}
void H_afficheHorlogeElemClean(temps mnt,int x,int y,int taille,long long int couleur,long long int fond){
+ H_afficheHorlogeElemTri(mnt,x,y,taille,couleur,couleur,couleur,fond);
+}
+
+void H_afficheHorlogeElemTri(temps mnt,int x,int y,int taille,long long int couleur1,long long int couleur2,long long int couleur3,long long int fond){
if(VRGL_AFFICHAGE_ELEMENTS){
- DisplayMatrixClean(x,y,BS_ElemHeure(mnt.heure),taille,couleur,fond);
- DisplayMatrixClean(x + 11 * taille,y,BS_dotdot(),taille,couleur,fond);
- DisplayMatrixClean(x + 19 * taille,y,BS_ElemMinute(mnt.minute),taille,couleur,fond);
+ DisplayMatrixClean(x,y,BS_ElemHeure(mnt.heure),taille,couleur1,fond);
+ DisplayMatrixClean(x + 11 * taille,y,BS_dotdot(),taille,couleur2,fond);
+ DisplayMatrixClean(x + 19 * taille,y,BS_ElemMinute(mnt.minute),taille,couleur3,fond);
}else{
- BS_displayChiffre10Clean(x,y,mnt.heure,taille,couleur,fond);
- DisplayMatrixClean(x + 11 * taille,y,BS_dotdot(),taille,couleur,fond);
- BS_displayChiffre10Clean(x + 19 * taille,y,mnt.minute,taille,couleur,fond);
+ BS_displayChiffre10Clean(x,y,mnt.heure,taille,couleur1,fond);
+ DisplayMatrixClean(x + 11 * taille,y,BS_dotdot(),taille,couleur2,fond);
+ BS_displayChiffre10Clean(x + 19 * taille,y,mnt.minute,taille,couleur3,fond);
}
}
void H_reglage(temps* mnt,int x,int y,int taille,long long int couleur,long long int fond){
- H_afficheHorlogeElemClean(*mnt,x,y,taille,couleur,fond);
+ H_afficheHorlogeElemTri(*mnt,x,y,taille,couleur,couleur,COULEUR_HEURE_EDIT,fond);
int tamponClick=1; //Cette valeur sert à faire la distinction entre les moments où on veut changer l'heure et les moments où on veut passer au nombre suivant.
while(tamponClick){ //réglage des minutes
tamponClick=CdRelatif();
H_ChangeMinute(mnt,tamponClick);
- H_afficheHorlogeElemClean(*mnt,x,y,taille,couleur,fond);
- wait(0.05); //réduit les problèmes de rebond
+ H_afficheHorlogeElemTri(*mnt,x,y,taille,couleur,couleur,COULEUR_HEURE_EDIT,fond);
+ wait(0.1); //réduit les problèmes de rebond
}
+ H_afficheHorlogeElemTri(*mnt,x,y,taille,COULEUR_HEURE_EDIT,couleur,couleur,fond);
wait(0.3);//evite le double-click
tamponClick=1;
while(tamponClick){ //téglage de l'heure
tamponClick=CdRelatif();
H_ChangeHour(mnt,tamponClick);
- H_afficheHorlogeElemClean(*mnt,x,y,taille,couleur,fond);
- wait(0.05);
+ H_afficheHorlogeElemTri(*mnt,x,y,taille,COULEUR_HEURE_EDIT,couleur,couleur,fond);
+ wait(0.1);
}
+ H_afficheHorlogeElemClean(*mnt,x,y,taille,couleur,fond);
+ wait(0.45);
}
void H_test1(){
@@ -78,7 +95,8 @@
for(int i=0;i<48;i++){
for(int j=0;j<60;j++){
H_ChangeMinute(&tempsTest,1);
- H_afficheHorlogeElemClean(tempsTest,50,50,4,0xFFA000E3,0xFFFFFFFF);
+ H_afficheHorlogeElemTri(tempsTest,50,50,4,0xFFA000E3,0xFFA03333,0xFF0000A5,0xFFFFFFFF);
+ H_afficheHorlogeElemClean(tempsTest,50,150,4,0xFF0000FF,0xFFFFFFFF);
wait(1);
}
}
