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.
Fork of Utils by
Utils.h@0:794c15bd30b0, 2018-02-06 (annotated)
- Committer:
- POTLESS_2
- Date:
- Tue Feb 06 13:15:53 2018 +0000
- Revision:
- 0:794c15bd30b0
- Child:
- 2:5af7a1fb1903
S?paration des fonctions sd card
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
POTLESS_2 | 0:794c15bd30b0 | 1 | #ifndef CHANGEME_H_ |
POTLESS_2 | 0:794c15bd30b0 | 2 | #define CHANGEME_H_ |
POTLESS_2 | 0:794c15bd30b0 | 3 | |
POTLESS_2 | 0:794c15bd30b0 | 4 | #include "mbed.h" |
POTLESS_2 | 0:794c15bd30b0 | 5 | #include <string> |
POTLESS_2 | 0:794c15bd30b0 | 6 | |
POTLESS_2 | 0:794c15bd30b0 | 7 | #include "FATFileSystem.h" |
POTLESS_2 | 0:794c15bd30b0 | 8 | #include "SDBlockDevice.h" |
POTLESS_2 | 0:794c15bd30b0 | 9 | #include <stdio.h> |
POTLESS_2 | 0:794c15bd30b0 | 10 | #include <errno.h> |
POTLESS_2 | 0:794c15bd30b0 | 11 | |
POTLESS_2 | 0:794c15bd30b0 | 12 | //PIN OUT carte SD |
POTLESS_2 | 0:794c15bd30b0 | 13 | #define SD_MOSI PA_7 |
POTLESS_2 | 0:794c15bd30b0 | 14 | #define SD_MISO PA_6 |
POTLESS_2 | 0:794c15bd30b0 | 15 | #define SD_SCK PA_5 |
POTLESS_2 | 0:794c15bd30b0 | 16 | #define SD_CS PB_6 |
POTLESS_2 | 0:794c15bd30b0 | 17 | |
POTLESS_2 | 0:794c15bd30b0 | 18 | /** Utils class. |
POTLESS_2 | 0:794c15bd30b0 | 19 | * Rassemblant des fonctions annexes pour le fonctionnement de l'ARNSRS. |
POTLESS_2 | 0:794c15bd30b0 | 20 | * |
POTLESS_2 | 0:794c15bd30b0 | 21 | * A besoin des libs suivantes : |
POTLESS_2 | 0:794c15bd30b0 | 22 | * |
POTLESS_2 | 0:794c15bd30b0 | 23 | * - FATFileSystem |
POTLESS_2 | 0:794c15bd30b0 | 24 | * |
POTLESS_2 | 0:794c15bd30b0 | 25 | * - SDBlockDevice |
POTLESS_2 | 0:794c15bd30b0 | 26 | * |
POTLESS_2 | 0:794c15bd30b0 | 27 | * |
POTLESS_2 | 0:794c15bd30b0 | 28 | * Constantes de l'application : |
POTLESS_2 | 0:794c15bd30b0 | 29 | * |
POTLESS_2 | 0:794c15bd30b0 | 30 | * Pin out carte SD : |
POTLESS_2 | 0:794c15bd30b0 | 31 | * |
POTLESS_2 | 0:794c15bd30b0 | 32 | * - SD_MOSI PA_7 |
POTLESS_2 | 0:794c15bd30b0 | 33 | * |
POTLESS_2 | 0:794c15bd30b0 | 34 | * - SD_MISO PA_6 |
POTLESS_2 | 0:794c15bd30b0 | 35 | * |
POTLESS_2 | 0:794c15bd30b0 | 36 | * - SD_SCK PA_5 |
POTLESS_2 | 0:794c15bd30b0 | 37 | * |
POTLESS_2 | 0:794c15bd30b0 | 38 | * - SD_CS PB_6 |
POTLESS_2 | 0:794c15bd30b0 | 39 | * |
POTLESS_2 | 0:794c15bd30b0 | 40 | */ |
POTLESS_2 | 0:794c15bd30b0 | 41 | |
POTLESS_2 | 0:794c15bd30b0 | 42 | class UTILS |
POTLESS_2 | 0:794c15bd30b0 | 43 | { |
POTLESS_2 | 0:794c15bd30b0 | 44 | |
POTLESS_2 | 0:794c15bd30b0 | 45 | public: |
POTLESS_2 | 0:794c15bd30b0 | 46 | |
POTLESS_2 | 0:794c15bd30b0 | 47 | /**Remapper une valeur dans une autre échelle. |
POTLESS_2 | 0:794c15bd30b0 | 48 | * @param float Valeur à remapper |
POTLESS_2 | 0:794c15bd30b0 | 49 | * @param float Minimum de l'échelle de la valeur |
POTLESS_2 | 0:794c15bd30b0 | 50 | * @param float Maximum de l'échelle de la valeur |
POTLESS_2 | 0:794c15bd30b0 | 51 | * @param float Minimum de la nouvelle échelle |
POTLESS_2 | 0:794c15bd30b0 | 52 | * @param float Maximum de de la nouvelle échelle |
POTLESS_2 | 0:794c15bd30b0 | 53 | */ |
POTLESS_2 | 0:794c15bd30b0 | 54 | static float Remap(float x, float in_min, float in_max, float out_min, float out_max); |
POTLESS_2 | 0:794c15bd30b0 | 55 | |
POTLESS_2 | 0:794c15bd30b0 | 56 | /**Contraint une valeur entre deux limites. |
POTLESS_2 | 0:794c15bd30b0 | 57 | * @param float Valeur à contraindre |
POTLESS_2 | 0:794c15bd30b0 | 58 | * @param float Minimum de la valeur |
POTLESS_2 | 0:794c15bd30b0 | 59 | * @param float Maximum de la valeur |
POTLESS_2 | 0:794c15bd30b0 | 60 | */ |
POTLESS_2 | 0:794c15bd30b0 | 61 | static float constrain(float x, float a, float b); |
POTLESS_2 | 0:794c15bd30b0 | 62 | |
POTLESS_2 | 0:794c15bd30b0 | 63 | /**Fonction de stockage valeur sur la carte SD. |
POTLESS_2 | 0:794c15bd30b0 | 64 | * @param float Val_To_Store, la valeur à stocker |
POTLESS_2 | 0:794c15bd30b0 | 65 | * @param char* Nom du fichier ou stocker cette valeur |
POTLESS_2 | 0:794c15bd30b0 | 66 | */ |
POTLESS_2 | 0:794c15bd30b0 | 67 | static void Store_A_Val(float Val_To_Store, char* File_Name); |
POTLESS_2 | 0:794c15bd30b0 | 68 | |
POTLESS_2 | 0:794c15bd30b0 | 69 | /**Fonction de récupération d'une valeur stockée sur la carte SD. |
POTLESS_2 | 0:794c15bd30b0 | 70 | * @param char* Nom du fichier ou stocker cette valeur |
POTLESS_2 | 0:794c15bd30b0 | 71 | * @returns |
POTLESS_2 | 0:794c15bd30b0 | 72 | * valeur de calibration des capteurs O2 |
POTLESS_2 | 0:794c15bd30b0 | 73 | */ |
POTLESS_2 | 0:794c15bd30b0 | 74 | static float Read_A_Val(char* File_Name); |
POTLESS_2 | 0:794c15bd30b0 | 75 | |
POTLESS_2 | 0:794c15bd30b0 | 76 | /**Fonction d'enregistrement d'une chaine de charatères sur la carte SD. |
POTLESS_2 | 0:794c15bd30b0 | 77 | * @param char* To_Store, chaine de charactères |
POTLESS_2 | 0:794c15bd30b0 | 78 | * @param char* Nom du fichier, s'il existe il est ouvert, sinon il est créé |
POTLESS_2 | 0:794c15bd30b0 | 79 | */ |
POTLESS_2 | 0:794c15bd30b0 | 80 | static void Write_SD_File(string To_Store, char* File_Name = "Data_LOG.txt"); |
POTLESS_2 | 0:794c15bd30b0 | 81 | |
POTLESS_2 | 0:794c15bd30b0 | 82 | /**Fonction de lecture d'un fichier sur la carte SD. |
POTLESS_2 | 0:794c15bd30b0 | 83 | * @param char* Nom du fichier |
POTLESS_2 | 0:794c15bd30b0 | 84 | */ |
POTLESS_2 | 0:794c15bd30b0 | 85 | static void Read_SD_File(string File_Name = "Data_LOG.txt"); |
POTLESS_2 | 0:794c15bd30b0 | 86 | |
POTLESS_2 | 0:794c15bd30b0 | 87 | /**Fonction d'éffaçage d'un fichier sur la carte SD. |
POTLESS_2 | 0:794c15bd30b0 | 88 | * @param char* Nom du fichier |
POTLESS_2 | 0:794c15bd30b0 | 89 | */ |
POTLESS_2 | 0:794c15bd30b0 | 90 | static void Delete_SD_File(string File_Name); |
POTLESS_2 | 0:794c15bd30b0 | 91 | |
POTLESS_2 | 0:794c15bd30b0 | 92 | /**Fonction d'éffaçage d'un fichier sur la carte SD. |
POTLESS_2 | 0:794c15bd30b0 | 93 | * @param char* Nom du fichier à effacer |
POTLESS_2 | 0:794c15bd30b0 | 94 | * @param char* Nouveau Nom du fichier |
POTLESS_2 | 0:794c15bd30b0 | 95 | */ |
POTLESS_2 | 0:794c15bd30b0 | 96 | static void Rename_SD_File(string Old_File_Name, string New_File_Name); |
POTLESS_2 | 0:794c15bd30b0 | 97 | |
POTLESS_2 | 0:794c15bd30b0 | 98 | /**Fonction montage de la carte SD. |
POTLESS_2 | 0:794c15bd30b0 | 99 | */ |
POTLESS_2 | 0:794c15bd30b0 | 100 | static void Mount_SD(); |
POTLESS_2 | 0:794c15bd30b0 | 101 | |
POTLESS_2 | 0:794c15bd30b0 | 102 | /**Fonction demontage de la carte SD. |
POTLESS_2 | 0:794c15bd30b0 | 103 | */ |
POTLESS_2 | 0:794c15bd30b0 | 104 | static void UnMount_SD(); |
POTLESS_2 | 0:794c15bd30b0 | 105 | |
POTLESS_2 | 0:794c15bd30b0 | 106 | /**Fonction formatage de la carte SD. |
POTLESS_2 | 0:794c15bd30b0 | 107 | */ |
POTLESS_2 | 0:794c15bd30b0 | 108 | static void Format_SD(); |
POTLESS_2 | 0:794c15bd30b0 | 109 | |
POTLESS_2 | 0:794c15bd30b0 | 110 | private: |
POTLESS_2 | 0:794c15bd30b0 | 111 | //Rien... |
POTLESS_2 | 0:794c15bd30b0 | 112 | }; |
POTLESS_2 | 0:794c15bd30b0 | 113 | #endif |