lib_Mbed_LPS
lib_Mbed_LPS.h@4:5e21f6f2e1f6, 2016-05-04 (annotated)
- Committer:
- YSI
- Date:
- Wed May 04 10:46:46 2016 +0000
- Revision:
- 4:5e21f6f2e1f6
- Parent:
- 3:660de8a5eff2
change exemple
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
YSI | 0:a217c0617441 | 1 | /** Lib Mbed LPS |
YSI | 0:a217c0617441 | 2 | * |
YSI | 0:a217c0617441 | 3 | * Copyright (c) 2014, cstyles (http://mbed.org) |
YSI | 0:a217c0617441 | 4 | * |
YSI | 0:a217c0617441 | 5 | * Exemple: |
YSI | 0:a217c0617441 | 6 | * @code |
YSI | 0:a217c0617441 | 7 | * #include "mbed.h" |
YSI | 0:a217c0617441 | 8 | * #include "lib_Mbed_LPS.h" |
YSI | 0:a217c0617441 | 9 | * |
YSI | 0:a217c0617441 | 10 | * |
YSI | 0:a217c0617441 | 11 | * Serial pc(USBTX,USBRX); |
YSI | 3:660de8a5eff2 | 12 | * DigitalOut led(LED1); |
YSI | 0:a217c0617441 | 13 | * |
YSI | 0:a217c0617441 | 14 | * void interruption_serie(void); |
YSI | 0:a217c0617441 | 15 | * |
YSI | 0:a217c0617441 | 16 | * |
YSI | 0:a217c0617441 | 17 | * int main() |
YSI | 0:a217c0617441 | 18 | * { |
YSI | 3:660de8a5eff2 | 19 | * if(!checkIDs()) return 0; |
YSI | 0:a217c0617441 | 20 | * pc.attach(&interruption_serie); |
YSI | 0:a217c0617441 | 21 | * |
YSI | 0:a217c0617441 | 22 | * while(1) |
YSI | 0:a217c0617441 | 23 | * { |
YSI | 3:660de8a5eff2 | 24 | * led = !led; |
YSI | 0:a217c0617441 | 25 | * wait(0.25); |
YSI | 0:a217c0617441 | 26 | * } |
YSI | 0:a217c0617441 | 27 | * } |
YSI | 0:a217c0617441 | 28 | * |
YSI | 0:a217c0617441 | 29 | * void interruption_serie(void) |
YSI | 0:a217c0617441 | 30 | * { |
YSI | 0:a217c0617441 | 31 | * char caractere = pc.getc(); |
YSI | 0:a217c0617441 | 32 | * switch(caractere) |
YSI | 0:a217c0617441 | 33 | * { |
YSI | 0:a217c0617441 | 34 | * case '?': |
YSI | 0:a217c0617441 | 35 | * pc.printf("%s\r\n",getLastMbedFileName()); |
YSI | 0:a217c0617441 | 36 | * break; |
YSI | 0:a217c0617441 | 37 | * } |
YSI | 0:a217c0617441 | 38 | * } |
YSI | 0:a217c0617441 | 39 | * @endcode |
YSI | 0:a217c0617441 | 40 | * @file lib_Mbed_LPS.h |
YSI | 0:a217c0617441 | 41 | * @purpose library for Mbed LPS |
YSI | 0:a217c0617441 | 42 | * @date 2015 |
YSI | 0:a217c0617441 | 43 | * @author Yannic Simon |
YSI | 0:a217c0617441 | 44 | */ |
YSI | 0:a217c0617441 | 45 | |
YSI | 0:a217c0617441 | 46 | #ifndef DEF_lib_Mbed_LPS_H |
YSI | 0:a217c0617441 | 47 | #define DEF_lib_Mbed_LPS_H |
YSI | 0:a217c0617441 | 48 | |
YSI | 0:a217c0617441 | 49 | #include "mbed.h" |
YSI | 0:a217c0617441 | 50 | |
YSI | 3:660de8a5eff2 | 51 | /** MBED_ID est un define correspondant a une chaine de caracteres contenant l'ID attendu du Mbed |
YSI | 3:660de8a5eff2 | 52 | */ |
YSI | 3:660de8a5eff2 | 53 | #define MBED_ID "101000000000000000000002F7F204A764cc6e6a004f5a3470ff1975de9d0ddd" // MBED_ID se trouvant dans MBED.HTM entre auth= et &loader= |
YSI | 3:660de8a5eff2 | 54 | |
YSI | 4:5e21f6f2e1f6 | 55 | /** Permet d'obtenir l'ID unique du Mbed |
YSI | 1:4d90513f226d | 56 | * |
YSI | 1:4d90513f226d | 57 | * @param ID pointeur sur une chaine de caractere contenant l'ID unique du Mbed |
YSI | 1:4d90513f226d | 58 | */ |
YSI | 0:a217c0617441 | 59 | void getMbedID(char *ID); |
YSI | 0:a217c0617441 | 60 | |
YSI | 1:4d90513f226d | 61 | /** Renvoie true si l'ID unique du Mbed correspond à celui attendu |
YSI | 1:4d90513f226d | 62 | * |
YSI | 1:4d90513f226d | 63 | */ |
YSI | 0:a217c0617441 | 64 | bool checkIDs(void); |
YSI | 0:a217c0617441 | 65 | |
YSI | 1:4d90513f226d | 66 | /** Renvoie une chaine de caractere contenant le nom du dernier fichier cree sur le Mbed |
YSI | 1:4d90513f226d | 67 | * |
YSI | 1:4d90513f226d | 68 | */ |
YSI | 0:a217c0617441 | 69 | char * getLastMbedFileName(void); |
YSI | 0:a217c0617441 | 70 | |
YSI | 0:a217c0617441 | 71 | #endif |