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
Bluetooth/IHM_Bluetooth.h@3:07109a6bb472, 2020-03-12 (annotated)
- Committer:
- EISR
- Date:
- Thu Mar 12 15:22:02 2020 +0000
- Revision:
- 3:07109a6bb472
- Parent:
- 2:1103f5d61035
commentaires de la partie bluetooth;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Wael_H | 2:1103f5d61035 | 1 | #ifndef BT_H |
| Wael_H | 2:1103f5d61035 | 2 | #define BT_H |
| Wael_H | 2:1103f5d61035 | 3 | |
| Wael_H | 2:1103f5d61035 | 4 | #include "mbed.h" |
| Wael_H | 2:1103f5d61035 | 5 | #include "math.h" |
| Wael_H | 2:1103f5d61035 | 6 | |
| EISR | 3:07109a6bb472 | 7 | #define STARTBYTE 240 // Valeur de l'octet de start |
| EISR | 3:07109a6bb472 | 8 | #define STOPBYTE 15 // Valeur de l'octet de stop |
| Wael_H | 2:1103f5d61035 | 9 | |
| EISR | 3:07109a6bb472 | 10 | #define KPBYTE 30 // entete de KP |
| EISR | 3:07109a6bb472 | 11 | #define KIBYTE 45 // entete de KI |
| EISR | 3:07109a6bb472 | 12 | #define KDBYTE 60 // entete de KD |
| EISR | 3:07109a6bb472 | 13 | #define SPCMDBYTE 75 // entete de la commande de vitesse |
| EISR | 3:07109a6bb472 | 14 | #define CAMXBYTE 100 // entete de la camera |
| EISR | 3:07109a6bb472 | 15 | #define POSBYTE 130 // entete pour la position du robot sur la piste |
| EISR | 3:07109a6bb472 | 16 | #define LMBYTE 150 // entete du graphe du moteur gauche |
| EISR | 3:07109a6bb472 | 17 | #define RMBYTE 165 // entete du graphe du moteur droit |
| EISR | 3:07109a6bb472 | 18 | #define ERRORBYTE 180 // entete du graphe de l'erreur d'asservissement |
| EISR | 3:07109a6bb472 | 19 | #define CERRBYTE 195 // entete du graphe de la correction de l'erreur (asservissement) |
| EISR | 3:07109a6bb472 | 20 | #define SGRABYTE 210 // entete du graphe de la vitesse du robot |
| Wael_H | 2:1103f5d61035 | 21 | |
| Wael_H | 2:1103f5d61035 | 22 | class IHM_Bluetooth |
| Wael_H | 2:1103f5d61035 | 23 | { |
| Wael_H | 2:1103f5d61035 | 24 | public: |
| Wael_H | 2:1103f5d61035 | 25 | IHM_Bluetooth(); |
| Wael_H | 2:1103f5d61035 | 26 | void run(void); |
| Wael_H | 2:1103f5d61035 | 27 | |
| Wael_H | 2:1103f5d61035 | 28 | private: |
| EISR | 3:07109a6bb472 | 29 | /**************************************** FONCTIONS **************************************/ |
| EISR | 3:07109a6bb472 | 30 | |
| EISR | 3:07109a6bb472 | 31 | void transmitBlu (void); // Fonction permettant la transmission d'une trame de 6octets (interruption) |
| EISR | 3:07109a6bb472 | 32 | |
| EISR | 3:07109a6bb472 | 33 | |
| EISR | 3:07109a6bb472 | 34 | void receptionBlu (void); // Fonction d'interruption de reception. |
| EISR | 3:07109a6bb472 | 35 | |
| EISR | 3:07109a6bb472 | 36 | |
| EISR | 3:07109a6bb472 | 37 | void formatTrameT(short reg, int val); // Creation de trames de 6 octets pour des donnees a valeur decimale |
| EISR | 3:07109a6bb472 | 38 | |
| EISR | 3:07109a6bb472 | 39 | |
| EISR | 3:07109a6bb472 | 40 | int get_val_pc(short reg); // Permet de recuperer la valeur associee au entete en entrée |
| EISR | 3:07109a6bb472 | 41 | // et stockee dans un tableau apres sa reception |
| EISR | 3:07109a6bb472 | 42 | |
| EISR | 3:07109a6bb472 | 43 | void TrameCAM(int CAM1, int CAM2); // Creation d'une trame de 6 octets permettant d'envoyer la position sur X |
| EISR | 3:07109a6bb472 | 44 | // des vecteurs gauche et droit vu par la camera |
| Wael_H | 2:1103f5d61035 | 45 | |
| EISR | 3:07109a6bb472 | 46 | void TramePos(int left, int barc, int right); // Creation d'une trame de 6 octets permettant d'envoyer la position du robot |
| EISR | 3:07109a6bb472 | 47 | // sur la piste (cote gauche, barycentre, cote droit) |
| EISR | 3:07109a6bb472 | 48 | |
| EISR | 3:07109a6bb472 | 49 | void automate_Tx(void); // Automate pour la transmission. Permet de choisir la trame a creer. |
| EISR | 3:07109a6bb472 | 50 | |
| EISR | 3:07109a6bb472 | 51 | /*************************************** VARIABLES ****************************************/ |
| EISR | 3:07109a6bb472 | 52 | |
| EISR | 3:07109a6bb472 | 53 | unsigned int blueRxBuffer[6]; // Buffer de reception de la liaison serie bluetooth |
| EISR | 3:07109a6bb472 | 54 | unsigned char blueTxBuffer[6]; // Buffer de transmission de la liaison série bluetooth |
| EISR | 3:07109a6bb472 | 55 | unsigned int paramRx[4]; // 0 KP 1 KI 2 KD 3 SPEED |
| EISR | 3:07109a6bb472 | 56 | short cb_lm; // Checkbox du graphe moteur gauche |
| EISR | 3:07109a6bb472 | 57 | short cb_rm; // Checkbox du graphe moteur droit |
| EISR | 3:07109a6bb472 | 58 | short cb_err; // Checkbox du graphe d'erreur de l'asservissement |
| EISR | 3:07109a6bb472 | 59 | short cb_cerr; // Checkbox du graphe de la correction de l'erreur (asservissement) |
| EISR | 3:07109a6bb472 | 60 | short cb_speed; // Checkbox du graphe de la vitesse du robot |
| EISR | 3:07109a6bb472 | 61 | Ticker timer; // Ticker pour gérer la frequence d'appel de l'automate fonction |
| EISR | 3:07109a6bb472 | 62 | |
| Wael_H | 2:1103f5d61035 | 63 | }; |
| Wael_H | 2:1103f5d61035 | 64 | |
| Wael_H | 2:1103f5d61035 | 65 | #endif // BT_H |