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: mbed
user.h
00001 /******************************************************************************* 00002 user.h -> fichier de fonctions 00003 00004 Gestion des 2 DELs de la carte CPU 00005 Mesure tension batterie 00006 Mesure courant panneaux solaires 00007 Mesure température 00008 *******************************************************************************/ 00009 // Initialistion du µC, Tests divers 00010 /** 00011 * @param null 00012 */ 00013 void Init_System(void) { 00014 // Hello World 00015 pc.printf("\r\nIniSat V2 : TP5\r\n\n"); 00016 00017 // Test de l'horloge Systeme 00018 // pc.printf("Horloge CPU a %d Hz\r\n", SystemCoreClock); 00019 00020 xbee.baud(38400); 00021 } 00022 /******************************************************************************/ 00023 // Gestion des 2 Dels de la carte CPU 00024 Ticker Compteur_Led; 00025 uint16_t cmpt_led; 00026 uint8_t etat_led; 00027 enum {Off, Ro, Ve, Ro_Ve} couleur; 00028 00029 void Tache_Cmpt_Led(void) { 00030 cmpt_led++; 00031 if(cmpt_led >= 100) { // Période : 1 sec 00032 cmpt_led = 0; 00033 DEL_R = etat_led & 1; 00034 } 00035 else if(cmpt_led == 5) { 00036 DEL_R = 0; 00037 } 00038 else if(cmpt_led == 50) { 00039 DEL_V = etat_led & 2; 00040 } 00041 else if(cmpt_led == 60) { 00042 DEL_V = 0; 00043 } 00044 } 00045 00046 void Init_Led(void) { 00047 cmpt_led = 0; 00048 etat_led = 0; 00049 Compteur_Led.attach(&Tache_Cmpt_Led,0.01); // 10ms 00050 } 00051 00052 void Start_Led(void) { 00053 Compteur_Led.attach(&Tache_Cmpt_Led,0.01); // 10ms 00054 } 00055 00056 void Stop_Led(void) { 00057 Compteur_Led.detach(); 00058 } 00059 00060 void Set_Led(uint8_t couleur) { 00061 etat_led = couleur; 00062 } 00063 /******************************************************************************/ 00064 // Mesure de la tension de la batterie 00065 float mes_bat; 00066 00067 float Mes_Bat(void) { 00068 00069 mes_bat = batin.read()*4.59f + 0.31f; // 3.3 x 13.9/10 + 310mV(D2 carte EPS) 00070 return mes_bat; 00071 } 00072 00073 void Envoi_Mes_Bat(void) { 00074 00075 pc.printf("BAT: %.2f V\n",mes_bat); // Format pour Terminal (Putty) 00076 // pc.printf("B%.2f\n",mes_bat); // Format pour Serial Data Plotter 00077 } 00078 /******************************************************************************/ 00079 // Mesure des courants des 2 panneaux solaires 00080 float mes_sp1, mes_sp2; 00081 00082 void Mes_SP(void) { 00083 00084 mes_sp1 = sp_1in.read()*165.0f; // 3.3 x 50 00085 mes_sp2 = sp_2in.read()*165.0f; // 3.3 x 50 00086 } 00087 00088 void Envoi_Mes_SP(void) { 00089 00090 pc.printf("SP1: %.1f mA\tSP2: %.1f mA\n",mes_sp1,mes_sp2); 00091 } 00092 /******************************************************************************/ 00093 // Fonction pour initialiser les fonctions précédentes 00094 00095 void Init_User_Fonctions(void) { 00096 00097 ctrl_reg = 1; // Pour mettre sous tension le moniteur de courant des Solar Panels 00098 Init_Led(); 00099 } 00100 // Fonction pour stopper les fonctions précédentes 00101 00102 void Stop_User_Fonctions(void) { 00103 00104 ctrl_reg = 0; 00105 Stop_Led(); 00106 } 00107 /******************************************************************************/ 00108 // Mesure de la température 00109 float mes_temp; 00110 00111 void Mes_Temp(void) { 00112 00113 mes_temp = (tempin.read()*3.3f-0.5f)/0.01f; // 3.3 x -500mV 00114 } 00115 00116 void Envoi_Mes_Temp(void) { 00117 00118 pc.printf("Temp: %.1f degC\r\n",mes_temp); // Mesure directe 00119 // pc.printf("%.1f\n",mes_temp); // Supervision -> Format pour Serial Data Plotter 00120 } 00121 /******************************************************************************/ 00122 00123
Generated on Tue Sep 12 2023 09:27:22 by
1.7.2