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
main.cpp@1:13af94a28e0d, 2020-02-06 (annotated)
- Committer:
- EISR
- Date:
- Thu Feb 06 08:22:13 2020 +0000
- Revision:
- 1:13af94a28e0d
- Parent:
- 0:9e8a54e32f30
V2 fonctionnelle commentee
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EISR | 0:9e8a54e32f30 | 1 | #include "mbed.h" |
EISR | 0:9e8a54e32f30 | 2 | #include "math.h" |
EISR | 0:9e8a54e32f30 | 3 | #include "bluetoothV2bibli.h" |
EISR | 0:9e8a54e32f30 | 4 | |
EISR | 1:13af94a28e0d | 5 | DigitalOut myled(LED1); //led de test |
EISR | 0:9e8a54e32f30 | 6 | |
EISR | 0:9e8a54e32f30 | 7 | void data_on_blueth(void); //fonction d'interruption |
EISR | 0:9e8a54e32f30 | 8 | int main(void) |
EISR | 0:9e8a54e32f30 | 9 | { |
EISR | 1:13af94a28e0d | 10 | Ticker timer; //ticker pour gérer la frequence d'appelle d'une fonction |
EISR | 0:9e8a54e32f30 | 11 | |
EISR | 1:13af94a28e0d | 12 | init_blueth(); //initialisation avec ISR de reception et premier message |
EISR | 1:13af94a28e0d | 13 | myled=1; |
EISR | 1:13af94a28e0d | 14 | timer.attach(&data_on_blueth,0.005); // permet d'appeler formatTrameT qui gère l'ISR de transmission |
EISR | 0:9e8a54e32f30 | 15 | while(1) { |
EISR | 1:13af94a28e0d | 16 | if(get_val_pc(30) == 1024)myled=!myled; //Test en reception |
EISR | 0:9e8a54e32f30 | 17 | } |
EISR | 0:9e8a54e32f30 | 18 | } |
EISR | 0:9e8a54e32f30 | 19 | |
EISR | 1:13af94a28e0d | 20 | void data_on_blueth(void) //fonction de test pour appeler formatTrameT |
EISR | 0:9e8a54e32f30 | 21 | { |
EISR | 0:9e8a54e32f30 | 22 | static short i = 0; |
EISR | 0:9e8a54e32f30 | 23 | short reg[4]={30,45,60,75}; |
EISR | 1:13af94a28e0d | 24 | formatTrameT(reg[i], 500000 ); // envoie du registre et de la valeur sur ce registre |
EISR | 1:13af94a28e0d | 25 | i++; // permet lecture du tableau pour le test |
EISR | 1:13af94a28e0d | 26 | if(i>3)i=0; |
EISR | 0:9e8a54e32f30 | 27 | } |