Stage APEM



Attestation de stage 2023



Evaluation Stage 2023




Attestation de stage 2024



Evaluation de stage 2024


Le DARREN



Quesque le Darren ?

Le Darren est un outil permettant de tester des clavier (tactile).

Il se connecte en USB sur l’ordinateur, et s’exécute par le logiciel.

Il permet de tester  différent clavier conçut par Apem, on peut les calibrer pour leurs bons fonctionnements.

les photos suivante sont les accessoires utile pour le fonctionnement du Darren et pour tester les clavier.




​Clavier iris



  ​ Clavier agilia



​Connecteur

​ permet de connecter le clavier au Darren



  ​calibreur

​permet de calibrée le Darren pour les claviers tactiles



Manette vibrante

Avant de rentrer dans le détail je vais énumérer le besoin initial. le besoin initial d'un collègue de Apem est de crée un soft permettant de choisir le type de vibration selon la fréquence, la durée, et l'amplitude pour trois manette vibrante,  ces manettes vont permettre a un client de tester quelle type de vibration il voudra et ainsi déterminer celui qui lui convient . 

Avant de crée le soft il faut lire les documentation constructeur de chaque vibreur et s'imprégner du projet, Pour commencer il faut crée un projet sur git permettant d'avoir une sauvegarde en cas de problème aussi d'avoir une backup, ensuite avec un logiciel permettant de coder dans notre cas nous utilisons MPLAB X IDE, en langage C, j'ai repris un programme déjà existant ( utilisant la même carte can ), j'ai commencer par modifier e fichier HardwareProfile.h qui contient tout les noms et les noms de port utiliser par cette carte can (exemple en descendant), ensuite  


definition : Carte CAN 

Une carte CAN est une interface matérielle utilisée dans les systèmes de contrôle industriels pour permettre la communication entre les composants électroniques via le protocole CAN (Controller Area Network).



  Sur la première photo, sous les 3 manettes, on peut observer 3 boutons. Sur la deuxième photo, on remarque également 3 boutons qui ont la même fonctionnalité. Le bouton jaune est connecté au premier vibreur, correspondant à la manette 1. Le bouton bleu est relié au deuxième vibreur, correspondant à la 2ème manette, et enfin le bouton vert est relié au troisième vibreur, correspondant à la 3ème manette.

Et on le connecte en USB (sur le port de droite) 


Le logiciel


  J'ai commencé par cloner le projet existant avec Git. Ensuite, j'ai modifié le fichier HardwareProfile.h dans le but de le faire correspondre avec le microcontrôleur 64KFLASH 16KRAM 16ANALOG 3V3 1W, car il correspondait actuellement au PIC32MX5.



Le code avant modification : 
/* ************************************************************************** */

/** Descriptive File Name

  @Company
    APEM

  @File Name
    HardwareProfile.h

  @Summary
    Define the hardware profile.

  @Description
    This file define the hardware profile.
 */
/* ************************************************************************** */


    /* Define for EEPROM counter */
#define ADD_E2P_FIRST_REQUESTER 0x00
#define E2P_NEXT_REQUESTER_FLAG 0x64

    /*
     * I2C E2P EE24LC04BT
     */
#define E2P_I2C_SDA_Pin PORTFbits.RF5
#define E2P_I2C_SDA_Lat LATFbits.LATF5
#define E2P_I2C_SDA_Odc ODCFbits.ODCF5
#define E2P_I2C_SDA_Tris TRISFbits.TRISF5

#define E2P_I2C_SCL_Pin PORTFbits.RF4
#define E2P_I2C_SCL_Lat LATFbits.LATF4
#define E2P_I2C_SCL_Odc ODCFbits.ODCF4
#define E2P_I2C_SCL_Tris TRISFbits.TRISF4

    /* Init I2C EEPROM */
#define InitI2CEEPROM()                 \
    {                                   \
        E2P_I2C_SCL_Tris = 0; /* RF4 */ \
        E2P_I2C_SCL_Odc = 1;  /* RF4 */ \
        E2P_I2C_SCL_Lat = 0;  /* RF4 */ \
        E2P_I2C_SDA_Tris = 0; /* RF5 */ \
        E2P_I2C_SDA_Odc = 1;  /* RF5 */ \
        E2P_I2C_SDA_Lat = 0;  /* RF5 */ \
    }

    /* E2P WP */
    /** Write Pin protection is not wired on APEM CAN std card */
#define E2P_WP_TRIS 0
#define E2P_WP_PORT 0
#define E2P_WP_LAT 0

#define IO13_Port PORTDbits.RD0 /* IO13 INT0 */
#define IO13_Lat LATDbits.LATD0
#define IO13_Tris TRISDbits.TRISD0
#define IO13_Odc ODCDbits.ODCD0

#define IO1_Port PORTDbits.RD1 /* IO1 */
#define IO1_Lat LATDbits.LATD1
#define IO1_Tris TRISDbits.TRISD1
#define IO1_Odc ODCDbits.ODCD1

#define IO2_Port PORTDbits.RD2 /* IO2 */
#define IO2_Lat LATDbits.LATD2
#define IO2_Tris TRISDbits.TRISD2
#define IO2_Odc ODCDbits.ODCD2

#define IO3_Port PORTDbits.RD3 /* IO3 */
#define IO3_Lat LATDbits.LATD3
#define IO3_Tris TRISDbits.TRISD3
#define IO3_Odc ODCDbits.ODCD3

#define IO4_Port PORTDbits.RD4 /* IO4 CN13 */
#define IO4_Lat LATDbits.LATD4
#define IO4_Tris TRISDbits.TRISD4
#define IO4_Odc ODCDbits.ODCD4

#define IO5_Port PORTDbits.RD5 /* IO5 CN14 */
#define IO5_Lat LATDbits.LATD5
#define IO5_Tris TRISDbits.TRISD5
#define IO5_Odc ODCDbits.ODCD5

#define STBY_CAN_Port PORTDbits.RD8 /* STBY DRIVER CAN */
#define STBY_CAN_Lat LATDbits.LATD8
#define STBY_CAN_Tris TRISDbits.TRISD8

#define SDA1_Port PORTDbits.RD9 /* SDA1 INT2 43 */
#define SDA1_Tris TRISDbits.TRISD9
#define SDA1_Lat LATDbits.LATD9
#define SDA1_Odc ODCDbits.ODCD9

#define SCL1_Port PORTDbits.RD10 /* SCL1 INT3 44 */
#define SCL1_Tris TRISDbits.TRISD10
#define SCL1_Lat LATDbits.LATD10
#define SCL1_Odc ODCDbits.ODCD10

#define IO14_Port PORTDbits.RD11 /* IO14 INT4 */
#define IO14_Lat LATDbits.LATD11
#define IO14_Tris TRISDbits.TRISD11
#define IO14_Odc ODCDbits.ODCD11

#define IO6_Port PORTEbits.RE0 /* IO6 */
#define IO6_Lat LATEbits.LATE0
#define IO6_Tris TRISEbits.TRISE0
#define IO6_Odc ODCEbits.ODCE0

#define IO7_Port PORTEbits.RE1 /* IO7 */
#define IO7_Lat LATEbits.LATE1
#define IO7_Tris TRISEbits.TRISE1
#define IO7_Odc ODCEbits.ODCE1

#define IO8_Port PORTEbits.RE2 /* IO8 */
#define IO8_Lat LATEbits.LATE2
#define IO8_Tris TRISEbits.TRISE2
#define IO8_Odc ODCEbits.ODCE2

#define IO9_Port PORTEbits.RE3 /* IO9 */
#define IO9_Lat LATEbits.LATE3
#define IO9_Tris TRISEbits.TRISE3
#define IO9_Odc ODCEbits.ODCE3

#define IO10_Port PORTEbits.RE4 /* I10 */
#define IO10_Lat LATEbits.LATE4
#define IO10_Tris TRISEbits.TRISE4
#define IO10_Odc ODCEbits.ODCE4

#define IO11_Port PORTEbits.RE5 /* I11 */
#define IO11_Lat LATEbits.LATE5
#define IO11_Tris TRISEbits.TRISE5
#define IO11_Odc ODCEbits.ODCE5

#define IO12_Port PORTEbits.RE6 /* I12 */
#define IO12_Lat LATEbits.LATE6
#define IO12_Tris TRISEbits.TRISE6
#define IO12_Odc ODCEbits.ODCE6

#define SDA5_Port PORTFbits.RF5 /* CN18 */
#define SDA5_Lat LATFbits.LATF5
#define SDA5_Tris TRISFbits.TRISF5

#define SCL5_Port PORTFbits.RF4 /* CN17 */
#define SCL5_Lat LATFbits.LATF4
#define SCL5_Tris TRISFbits.TRISF4

#define Al1_Port PORTBbits.RB13 /* Al1 AN13 RB13 */
#define Al1_Lat LATBbits.LATB13
#define Al1_Tris TRISBbits.TRISB13

#define Al2_Port PORTBbits.RB12 /* Al2 AN12 RB12 */
#define Al2_Lat LATBbits.LATB12
#define Al2_Tris TRISBbits.TRISB12

#define Al3_Port PORTBbits.RB11 /* Al3 AN11 RB11 */
#define Al3_Lat LATBbits.LATB11
#define Al3_Tris TRISBbits.TRISB11

#define Al4_Port PORTBbits.RB10 /* Al4 AN10 RB10 */
#define Al4_Lat LATBbits.LATB10
#define Al4_Tris TRISBbits.TRISB10

#define Al5_Port PORTBbits.RB9 /* Al5 AN9 RB9 */
#define Al5_Lat LATBbits.LATB9
#define Al5_Tris TRISBbits.TRISB9

#define Al6_Lat LATBbits.LATB8 /* Al6 AN8 RB8 */
#define Al6_Port PORTBbits.RB8
#define Al6_Tris TRISBbits.TRISB8

#define LED1_Port PORTBbits.RB2 /* LED1 RB2 */
#define LED1_Lat LATBbits.LATB2
#define LED1_Tris TRISBbits.TRISB2
#define LED1_Odc ODCBbits.ODCB2

#define LED2_Port PORTBbits.RB3 /* LED2 RB3 */
#define LED2_Lat LATBbits.LATB3
#define LED2_Tris TRISBbits.TRISB3
#define LED2_Odc ODCBbits.ODCB3

#define LED3_Port PORTBbits.RB4 /* LED3 RB4 */
#define LED3_Lat LATBbits.LATB4
#define LED3_Tris TRISBbits.TRISB4
#define LED3_Odc ODCBbits.ODCB4

#define LED4_Port PORTBbits.RB5 /* LED4 RB5 */
#define LED4_Lat LATBbits.LATB5
#define LED4_Tris TRISBbits.TRISB5
#define LED4_Odc ODCBbits.ODCB5

#define LED5_Port PORTGbits.RG8 /* LED5 RG8 */
#define LED5_Lat LATGbits.LATG8
#define LED5_Tris TRISGbits.TRISG8
#define LED5_Odc ODCGbits.ODCG8

#define LED6_Port PORTGbits.RG7 /* LED6 RG7 */
#define LED6_Lat LATGbits.LATG7 /* Led diag */
#define LED6_Tris TRISGbits.TRISG7

#define LED_2P_Port PORTGbits.RG6 /* LED_2P RG6 */
#define LED_2P_Lat LATGbits.LATG6
#define LED_2P_Tris TRISGbits.TRISG6
#define LED_2P_Odc ODCGbits.ODCG6

#define LED_1P_Port PORTEbits.RE7 /* LED_1P RE7 */
#define LED_1P_Lat LATEbits.LATE7
#define LED_1P_Tris TRISEbits.TRISE7
#define LED_1P_Odc ODCEbits.ODCE7

    /* DIAG */
#define mLED_DIAG LATDbits.LATD6
#define mLED_DIAG_TRIS TRISDbits.TRISD6

#define InitLED_DIAG()      \
    {                       \
        mLED_DIAG_TRIS = 0; \
        mLED_DIAG = 0;      \
    }

#define BlinkLED() (mLED_DIAG = ((ReadCoreTimer() & 0x2000000) != 0))
#define BlinkLEDClaimingStep() (mLED_DIAG = ((ReadCoreTimer() & 0x0200000) != 0))

#define BlinkAllLEDS() (LED1_Lat = LED2_Lat = LED3_Lat = LED4_Lat = LED5_Lat = LED6_Lat = LED_1P_Lat = LED_2P_Lat = ((ReadCoreTimer() & 0x0400000) != 0))
#define RazAllLEDS()                                                         \
    {                                                                        \
        LED1_Lat = LED2_Lat = LED3_Lat = LED4_Lat = LED5_Lat = LED6_Lat = 1; \
        LED_1P_Lat = LED_2P_Lat = 0;                                         \
    }





 le code après modification :

       /*
     * I2C SDA SCL
     */
#define I2C_SDA_2605_0_Pin PORTGbits.RG7
#define I2C_SDA_2605_0_Lat LATGbits.LATG7
#define I2C_SDA_2605_0_Odc ODCGbits.ODCG7
#define I2C_SDA_2605_0_Tris TRISGbits.TRISG7

#define I2C_SCL_2605_0_Pin PORTGbits.RG8
#define I2C_SCL_2605_0_Lat LATGbits.LATG8
#define I2C_SCL_2605_0_Odc ODCGbits.ODCG8
#define I2C_SCL_2605_0_Tris TRISGbits.TRISG8

#define I2C_SDA_2510_0_Pin PORTFbits.RF4
#define I2C_SDA_2510_0_Lat LATFbits.LATF4
#define I2C_SDA_2510_0_Odc ODCFbits.ODCF4
#define I2C_SDA_2510_0_Tris TRISFbits.TRISF4

#define I2C_SCL_2510_0_Pin PORTFbits.RF5
#define I2C_SCL_2510_0_Lat LATFbits.LATF5
#define I2C_SCL_2510_0_Odc ODCFbits.ODCF5
#define I2C_SCL_2510_0_Tris TRISFbits.TRISF5

#define I2C_SDA_AUX_Pin PORTDbits.RD9
#define I2C_SDA_AUX_Lat LATDbits.LATD9
#define I2C_SDA_AUX_Odc ODCDbits.ODCD9
#define I2C_SDA_AUX_Tris TRISDbits.TRISD9

#define I2C_SCL_AUX_Pin PORTDbits.RD10
#define I2C_SCL_AUX_Lat LATDbits.LATD10
#define I2C_SCL_AUX_Odc ODCDbits.ODCD10
#define I2C_SCL_AUX_Tris TRISDbits.TRISD10     

    /*ENABLE*/

#define EN2605_0_Pin PORTGbits.RG6
#define EN2605_0_Lat LATGbits.LATG6
#define EN2605_0_Odc ODCGbits.ODCG6
#define EN2605_0_Tris TRISGbits.TRISG6   

#define EN2605_1_Pin PORTBbits.RB8
#define EN2605_1_Lat LATBbits.LATB8
#define EN2605_1_Odc ODCBbits.ODCB8
#define EN2605_1_Tris TRISBbits.TRISB8

#define EN2510_0_Pin PORTBbits.RB13
#define EN2510_0_Lat LATBbits.LATB13
#define EN2510_0_Odc ODCBbits.ODCB13
#define EN2510_0_Tris TRISBbits.TRISB13

#define EN2510_1_Pin PORTFbits.RF3
#define EN2510_1_Lat LATFbits.LATF3
#define EN2510_1_Odc ODCFbits.ODCF3
#define EN2510_1_Tris TRISFbits.TRISF3   

    /*Boutons*/

#define BTN5_Port PORTEbits.RE3 /* BTN5 */
#define BTN5_Lat LATEbits.LATE3
#define BTN5_Tris TRISEbits.TRISE3
#define BTN5_Odc ODCEbits.ODCE3   

#define BTN4_Port PORTEbits.RE2 /* BTN4 */
#define BTN4_Lat LATEbits.LATE2
#define BTN4_Tris TRISEbits.TRISE2
#define BTN4_Odc ODCEbits.ODCE2     

#define BTN3_Port PORTEbits.RE1 /* BTN3 */
#define BTN3_Lat LATEbits.LATE1
#define BTN3_Tris TRISEbits.TRISE1
#define BTN3_Odc ODCEbits.ODCE1     

#define BTN2_Port PORTEbits.RE0 /* BTN2 */
#define BTN2_Lat LATEbits.LATE0
#define BTN2_Tris TRISEbits.TRISE0
#define BTN2_Odc ODCEbits.ODCE0

#define BTN1_Port PORTFbits.RF1 /* BTN1 */
#define BTN1_Lat LATFbits.LATF1
#define BTN1_Tris TRISFbits.TRISF1
#define BTN1_Odc ODCFbits.ODCF1

#define BTN0_Port PORTFbits.RF0 /* BTN0 */
#define BTN0_Lat LATFbits.LATF0
#define BTN0_Tris TRISFbits.TRISF0
#define BTN0_Odc ODCFbits.ODCF0

    /*Manette*/

#define HAPTIC_RHT_Port PORTBbits.R /*  */
#define HAPTIC_RHT_Lat LATBbits.LAT
#define HAPTIC_RHT_Tris TRISBbits.TRIS 

#define MICRODRIVE_Port PORTBbits.R /*  */
#define MICRODRIVE_Lat LATBbits.LAT
#define MICRODRIVE_Tris TRISBbits.TRIS

#define TACHAMMER_Port PORTBbits.R /*  */
#define TACHAMMER_Lat LATBbits.LAT
#define TACHAMMER_Tris TRISBbits.TRIS   

    /*LED*/

#define LED3_Port PORTDbits.RD6 /* LED3 RD6 */
#define LED3_Lat LATDbits.LATD6
#define LED3_Tris TRISDbits.TRISD6
#define LED3_Odc ODCDbits.ODCD6

#define LED2_Port PORTDbits.RD5 /* LED3 RD5 */
#define LED2_Lat LATDbits.LATD5
#define LED2_Tris TRISDbits.TRISD5
#define LED2_Odc ODCDbits.ODCD5 

#define LED1_Port PORTCbits.RC14 /* LED3 RC14 */
#define LED1_Lat LATCbits.LATC14
#define LED1_Tris TRISCbits.TRISC14
#define LED1_Odc ODCCbits.ODCC14 

#define LED0_Port PORTCbits.RC13 /* LED3 RC13 */
#define LED0_Lat LATCbits.LATC13
#define LED0_Tris TRISCbits.TRISC13
#define LED0_Odc ODCCbits.ODCC13 

    /*STDBY*/

#define STDBY_2510_1_Port PORTEbits.RE6 /* STBY DRIVER CAN */
#define STDBY_2510_1_Lat LATEbits.LATE6
#define STDBY_2510_1_Tris TRISEbits.TRISE6

#define STDBY_2510_0_Port PORTBbits.RB14 /* STBY DRIVER CAN */
#define STDBY_2510_0_Lat LATBbits.LATB14
#define STDBY_2510_0_Tris TRISBbits.TRISB14   

    /*INTZ*/

#define INTZ_2510_1_Port PORTEbits.RE7   
#define INTZ_2510_1_Lat LATEbits.LATE7
#define INTZ_2510_1_Tris TRISEbits.TRISE7

#define INTZ_2510_0_Port PORTBbits.REB15   
#define INTZ_2510_0_Lat LATBbits.LATB15
#define INTZ_2510_0_Tris TRISBbits.TRISB15

    /*IN*/

#define IN_2510_1_Port PORTEbits.RE5   
#define IN_2510_1_Lat LATEbits.LATE5
#define IN_2510_1_Tris TRISEbits.TRISE5


   
   
    /*PGE*/

#define PGEC2
#define PGED2   

    /*OC*/

#define OC1_Port PORTDbits.RD0
#define OC1_Lat LATDbits.LATD0     
#define OC1_Tris TRISDbits.TRISD0

#define OC2_Port PORTDbits.RD1
#define OC2_Lat LATDbits.LATD1     
#define OC2_Tris TRISDbits.TRISD1

#define OC3_Port PORTDbits.RD2
#define OC3_Lat LATDbits.LATD2     
#define OC3_Tris TRISDbits.TRISD2

#define OC4_Port PORTDbits.RD3
#define OC4_Lat LATDbits.LATD3     
#define OC4_Tris TRISDbits.TRISD3

#define OC5_Port PORTDbits.RD4
#define OC5_Lat LATDbits.LATD4     
#define OC5_Tris TRISDbits.TRISD4
   

 Compilation réussite



Les vibreurs


​Confidentialité apem

j'ai utilisé 3 vibreur prédéfinit par apem

exemple d'un vibreur que j'ai tester pour voir les diffèrent effet de vibration : 



Haptic Feedback Evaluation Kit

 J'ai pu tester ce vibreur qui a diffèrent mode de fonctionnement  et selon les fréquence envoyer la vibration varie (voir photo)





-Moteurs haptiques : Le kit est équipé de moteurs haptiques qui génèrent des vibrations et des sensations tactiles pour produire le retour haptique. Ces moteurs sont conçus pour être intégrés dans des appareils électroniques tels que des téléphones, des manettes de jeu, des dispositifs portables

-Contrôleur ou pilote haptique : Le kit est généralement associé à un contrôleur ou un pilote haptique qui permet de gérer les signaux envoyés aux moteurs haptiques. Ce contrôleur peut être programmable pour ajuster la force, la fréquence et d'autres paramètres des vibrations produites.

-Interface utilisateur : Le kit est livré avec une interface conviviale qui permet aux utilisateurs de tester et de régler les paramètres du retour haptique. Cela peut inclure des logiciels, des applications ou des commandes physiques pour ajuster les réglages du retour haptique.

-Documentation et support : Le kit est accompagné de guides d'utilisation, de tutoriels et d'une assistance technique pour aider les utilisateurs à comprendre et à exploiter pleinement les fonctionnalités du retour haptique.




Signaux du  HAPTIC FEEDBACK



SQR = signal carré, SIN = signal sinusoïdale, TRI = signal triangle, SAW = signal dent de scie

Création d'un soft


Programmation


Création d'un projet : 

logiciel utilisé :

-MPLAB X IDE

-git

-picoscope


 j'ai commençer par crée un projet sur git ce nommant : "Demo_manette_​vibrante" 

Avec MPLAB j'ai commencer a crée des sous dossier :

 j'ai crée les sous dossier :

dans les header :

-08_DRV2605L

  ​-DRV2605_0_Driver.h

​-DRV2605_1_Driver.h

​-haptic_0_app.h

​-haptic_1_app.h

-09_DRV2510

dans le source :

08_DRV2605L

​-DRV2605_0_Driver.c

​-DRV2605_1_Driver.c

​-haptic_0_app.c

​-haptic_1_app.c


a noté que le  DRV2605_0_Driver /DRV2605_1_Driver /haptic_0_app /haptic_1_app pour le 0 c'est pour l'I2C4 et le 1 pour l'I2C1 ( qui correspondent a un vibreur différent ) 


voici le DRV2605_0_Driver.h :
BOOL DRV2605_1_Driver_I2C_Idle(void);
BOOL DRV2605_1_Driver_I2C_TransmitOneByte(BYTE byData);
BOOL DRV2605_1_SendMsgToWrite(I2C_MODULE id, uint8_t regAddress, uint8_t *ptrData, uint8_t dataSize);
BYTE DRV2605_1_Driver_I2C_ReadOneByte(BYTE *ptr_value, BOOL is_last_byte);
BOOL DRV2605_1_Driver_I2C_StartTransfer(BOOL restart);
BOOL DRV2605_1_Driver_I2C_StopTransfer(void);
BOOL DRV2605_1_Driver_CheckAckStatusI2C(void);
BOOL DRV2605_1_Driver_I2C_ByteWasAcknowledged(I2C_MODULE id);
void DRV2605_1_Select_Waveform(uint8_t wav_frm_seq_reg_ad, uint8_t wav_frm_seq);
void DRV2605_1_Driver_Init(void);
void DRV2605_1_Driver_Go(void);

/** Descriptive File Name

  @Company
APEM

  @File Name
    DRV2605_Driver.h

  @Summary
    Brief description of the file.

  @Description
    Describe the purpose of this file.
*/
/* ************************************************************************** */

#ifndef DRV2605_0_DRIVER_H
#define DRV2605_0_DRIVER_H

#include "Common.h"
#include <peripheral/i2c.h>
#include <GenericTypeDefs.h>    
#include <stdint.h>

/*
* Defines
*/
#define USE_LED_I2C_TIMEOUT

#ifdef USE_LED_I2C_TIMEOUT
#define LED_I2C_TIMEOUT         100
#define LED_I2C_ACK_TIMEOUT     100
WORD wClock_LED_I2C_TimeOut;
WORD wClock_LED_I2C_Ack_TimeOut;
#endif       
#define I2C_TIMEOUT 1000
/*
* DRV2605L register mapping
*/

#define DRV2605_REG_SIZE 0x22u
#define DRV2605_REG_00_AD 0x00u
#define DRV2605_REG_01_AD 0x01u
#define DRV2605_REG_02_AD 0x02u
#define DRV2605_REG_03_AD 0x03u

#define DRV2605_WAV_FRM_SEQ1_REG_AD 0x04u
#define DRV2605_WAV_FRM_SEQ2_REG_AD 0x05u
#define DRV2605_WAV_FRM_SEQ3_REG_AD 0x06u
#define DRV2605_WAV_FRM_SEQ4_REG_AD 0x07u
#define DRV2605_WAV_FRM_SEQ5_REG_AD 0x08u
#define DRV2605_WAV_FRM_SEQ6_REG_AD 0x09u
#define DRV2605_WAV_FRM_SEQ7_REG_AD 0x0Au
#define DRV2605_WAV_FRM_SEQ8_REG_AD 0x0Bu

#define DRV2605_GO_REG_AD 0x0Cu

#define DRV2605_ODT         0x0Du
#define DRV2605_SPT         0x0Eu
#define DRV2605_SNT         0x0Fu
#define DRV2605_BRT         0x10u
#define DRV2605_ATH            0x11u
#define DRV2605_ATH_MIN_INPUT    0x12u
#define DRV2605_ATH_MAX_INPUT    0x13u
#define DRV2605_ATH_MIN_DRIVE    0x14u
#define DRV2605_ATH_MAX_DRIVE    0x15u
#define DRV2605_RATED_VOLTAGE    0x16u
#define DRV2605_OD_CLAMP         0x17u
#define DRV2605_A_CAL_COMP       0x18u
#define DRV2605_A_CAL_BEMF       0x19u
#define DRV2605_N_ERM_LRA        0x1Au
#define DRV2605_STARTUP_BOOST    0x1Bu
#define DRV2605_BIDIR_INPUT      0x1Cu
#define DRV2605_NG_THRESH        0x1Du
#define DRV2605_ZC_DET_TIME      0x1Eu
#define DRV2605_AUTO_OL_CNT      0x1Fu
#define DRV2605_OL_LRA_PERIOD    0x20u
#define DRV2605_VBAT             0x21u

#define DRV2605_I2C_ADDRESS 0x5A
#define DRV2605_ADDRESS_WRITE 0xB4
#define DRV2605_ADDRESS_READ 0xB5

/* NULL */
#define SHARP_TICK1_100 24u
#define LONG_DOUBLE_SHARP_CLICK_STRONG 37u
/* MOINS NULL*/
#define MS_ALERT75 15u
#define MS_ALERT1s 16u
#define BUZZ_1 47u


/*
* Waveform Library Effects List
*/
#define STRONG_CLICK_100 1u
#define SOFT_BUMP_100 7u
#define STRONG_BUZZ_100 14u
#define SOFT_FUZZ_60 16u
#define STRONG_CLICK1_100 17u
#define MEDIUM_CLICK1_100 21u
#define PULSING_STRONG_1 52u
#define SHORT_DOUBLE_CLICK_MEDIUM1 31u
#define Long_Double_Sharp_Tick_1 44U

#define HAPTIC_BTN PULSING_STRONG_1
#define HAPTIC_VALID MS_ALERT1s

/*
* Prototypes
*/
BOOL DRV2605_0_Driver_I2C_Idle(void);
BOOL DRV2605_0_Driver_I2C_TransmitOneByte(BYTE byData);
BOOL DRV2605_0_SendMsgToWrite(I2C_MODULE id, uint8_t regAddress, uint8_t *ptrData, uint8_t dataSize);
BYTE DRV2605_0_Driver_I2C_ReadOneByte(BYTE *ptr_value, BOOL is_last_byte);
BOOL DRV2605_0_Driver_I2C_StartTransfer(BOOL restart);
BOOL DRV2605_0_Driver_I2C_StopTransfer(void);
BOOL DRV2605_0_Driver_CheckAckStatusI2C(void);
BOOL DRV2605_0_Driver_I2C_ByteWasAcknowledged(I2C_MODULE id);
void DRV2605_0_Select_Waveform(uint8_t wav_frm_seq_reg_ad, uint8_t wav_frm_seq);
void DRV2605_0_Driver_Init(void);
void DRV2605_0_Driver_Go(void);

#endif /* _DRV2605_0_DRIVER_H */

/* *****************************************************************************
End of File
*/


pour le DRV2605_1_Driver il n'y a que ça qui change :

BOOL DRV2605_1_Driver_I2C_Idle(void);
BOOL DRV2605_1_Driver_I2C_TransmitOneByte(BYTE byData);
BOOL DRV2605_1_SendMsgToWrite(I2C_MODULE id, uint8_t regAddress, uint8_t *ptrData, uint8_t dataSize);
BYTE DRV2605_1_Driver_I2C_ReadOneByte(BYTE *ptr_value, BOOL is_last_byte);
BOOL DRV2605_1_Driver_I2C_StartTransfer(BOOL restart);
BOOL DRV2605_1_Driver_I2C_StopTransfer(void);
BOOL DRV2605_1_Driver_CheckAckStatusI2C(void);
BOOL DRV2605_1_Driver_I2C_ByteWasAcknowledged(I2C_MODULE id);
void DRV2605_1_Select_Waveform(uint8_t wav_frm_seq_reg_ad, uint8_t wav_frm_seq);
void DRV2605_1_Driver_Init(void);
void DRV2605_1_Driver_Go(void);


pour le haptic_0_app.h :

/** Descriptive File Name

  @Company
APEM

  @File Name
    haptic_0_app.h

  @Summary
    Brief description of the file.

  @Description
    Describe the purpose of this file.
*/
/* ************************************************************************** */
#ifndef HAPTIC_0_APP_H_
#define HAPTIC_0_APP_H_

/*
* Prototypes
*/

void Haptic_0_App_Init(void);
void Haptic_0_App_Task(void);
void Haptic_0_App_Go(void);
void Haptic_0_App_Set_Valid(void);
void Haptic_0_App_Set_Btn(void);
void Haptic_0_App_Go_Valid(void);

#endif /* HAPTIC_0_APP_H_ */
/*
End of File
*/

ce qui change pour le haptic_1_app.h :

void Haptic_1_App_Init(void);
void Haptic_1_App_Task(void);
void Haptic_1_App_Go(void);
void Haptic_1_App_Set_Valid(void);
void Haptic_1_App_Set_Btn(void);
void Haptic_1_App_Go_Valid(void);

ensuite nous avons le DRV2605_0_Driver.c et le DRV2605_1_Driver.c
la seule chose qui change sont les 0 ou les 1 pour DRV2605_0_Driver.c :

/* Descriptive File Name
  @Company
    APEM

  @File Name
    DRV2605_0_driver.c
*/

#include <plib.h>
#include <string.h>
#include <GenericTypeDefs.h>
#include <peripheral/i2c.h>
#include "Initialize.h"
#include "HardwareProfile.h"
#include "DRV2605_0_Driver.h"

extern volatile UINT16 u16_clock1ms;
static void DRV2605_0_Remove_Standby_Mode(void);
/*prototype*/
BOOL InitI2C_0();

/********************************************************************
* Function:             DRV2605_0_Driver_I2C_Idle
*
* Precondition:
*
* Input:                None.
*
* Output:               BOOL : TRUE if in idle state, FALSE instead
*
* Side Effects:
*
* Overview:             Check if the I2C is in idle situation.
*
* Note:
********************************************************************/
BOOL DRV2605_0_Driver_I2C_Idle(void) {
#ifdef USE_LED_I2C_TIMEOUT
    wClock_LED_I2C_TimeOut = u16_clock1ms + LED_I2C_TIMEOUT;
#endif

    while (I2C4CONbits.SEN || I2C4CONbits.PEN || I2C4CONbits.RSEN || I2C4CONbits.RCEN || I2C4CONbits.ACKEN || I2C4STATbits.TRSTAT) {
#ifdef USE_LED_I2C_TIMEOUT
        if (TIME_OVER(wClock_LED_I2C_TimeOut, u16_clock1ms)) {
            return FALSE;
        }
#else
        Nop();
#endif   
    }
    return TRUE;
}

/********************************************************************
* Function:             DRV2605_Driver_InitI2C
*
* Precondition:         
*
* Input:                None.
*
* Output:               BOOL = true if init ok
*
* Side Effects:
*
* Overview:             Init TLC register according to TLC datasheet 
*                       
* Note:                 Initialize I2C peripherical
********************************************************************/
BOOL InitI2C_0(void) {
    BOOL bl_ret = FALSE;

    // Initialisation de l'I2C pour U2
    I2C_SDA_2605_0_Odc = 0;
    I2C_SCL_2605_0_Odc = 0;
    EN2605_0_Odc = 0;
    OC1_Odc = 0;

    I2C_SDA_2605_0_Tris = 0;
    I2C_SCL_2605_0_Tris = 0;
    EN2605_0_Tris = 0;
    OC1_Tris = 0;

    EN2605_0_Lat = 0;
    EN2605_0_Lat = 1;

    I2CSetFrequency(I2C4, GetPeripheralClock(), I2C4_CLOCK_FREQ);

    I2CConfigure(I2C4, I2C_STOP_IN_IDLE | I2C_ENABLE_HIGH_SPEED);
    I2CEnable(I2C4, TRUE);

    //        bl_ret = DRV2605_Driver_CheckAckStatusI2C();
    return bl_ret;
}

/********************************************************************
* Function:             DRV2605_0_Driver_I2C_TransmitOneByte
*
* Precondition:         The transfer must have been previously started.
*
* Input:                BYTE data = Data byte to transmit
*
* Output:               BOOL = TRUE - Data was sent successfully
                        FALSE   - A bus collision occured
*
* Side Effects:
*
* Overview:             Transmits one byte to the TLC Driver led, and reports errors for any bus
*                       collisions.
*
* Note:                 This is a blocking routine that waits for the
*                      transmission to complete if timeout not defined
********************************************************************/
BOOL DRV2605_0_Driver_I2C_TransmitOneByte(BYTE byData) {
    if (DRV2605_0_Driver_I2C_Idle()) {

        /* Wait for the transmitter to be ready */
#ifdef USE_LED_I2C_TIMEOUT
        /* Arm the timer */
        wClock_LED_I2C_TimeOut = u16_clock1ms + LED_I2C_TIMEOUT;
#endif   
        while (!I2CTransmitterIsReady(I2C4)) {
#ifdef USE_LED_I2C_TIMEOUT
            if (TIME_OVER(wClock_LED_I2C_TimeOut, u16_clock1ms)) {
                return FALSE;
            }
#else
            Nop();
#endif
        }
        /* Transmit the byte */
        if (I2CSendByte(I2C4, byData) != I2C_SUCCESS) {
            /* I2C Master Bus Collision" */
            return FALSE;
        }

#ifdef USE_LED_I2C_TIMEOUT
        /* Arm the timer */
        wClock_LED_I2C_TimeOut = u16_clock1ms + LED_I2C_TIMEOUT;
#endif     
        /* Wait for the transmission to finish */
        while (!I2CTransmissionHasCompleted(I2C4)) {
#ifdef USE_LED_I2C_TIMEOUT
            if (TIME_OVER(wClock_LED_I2C_TimeOut, u16_clock1ms)) {
                return FALSE;
            }
#else
            Nop();
#endif
        }
        return TRUE;
    } else {
        return FALSE;
    }
}

/********************************************************************
* Function:         DRV2605_0_SendMsgToWrite
*
* Precondition:
*
* Input:           
*
* Output:           
*
* Side Effects:
*
* Overview:         
*
* Note:             
********************************************************************/
BOOL DRV2605_0_SendMsgToWrite(I2C_MODULE id, uint8_t regAddress, uint8_t *ptrData, uint8_t dataSize) {
    I2C_7_BIT_ADDRESS SlaveAddress;
    I2C_FORMAT_7_BIT_ADDRESS(SlaveAddress, DRV2605_I2C_ADDRESS, I2C_WRITE);

    I2CClearStatus(I2C4, I2C_BYTE_ACKNOWLEDGED);

    // Start Condition on I2C bus
    if (!DRV2605_0_Driver_I2C_StartTransfer(FALSE)) {
        return FALSE;
    }

    // Send Address on I2C bus
    if (!DRV2605_0_Driver_I2C_TransmitOneByte(SlaveAddress.byte)) {
        return FALSE;
    }

#ifdef USE_LED_I2C_TIMEOUT
    wClock_LED_I2C_TimeOut = u16_clock1ms + LED_I2C_TIMEOUT;
#endif

    // Attendre l'acknowledgement
    while (!I2CByteWasAcknowledged(I2C4)) {
#ifdef USE_LED_I2C_TIMEOUT
        if (TIME_OVER(wClock_LED_I2C_TimeOut, u16_clock1ms)) {
            return FALSE;
        }
#else
        Nop();
#endif
    }

    // Envoyer l'adresse du registre
    if (!DRV2605_0_Driver_I2C_TransmitOneByte(regAddress)) {
        return FALSE;
    }

#ifdef USE_LED_I2C_TIMEOUT
    wClock_LED_I2C_TimeOut = u16_clock1ms + LED_I2C_TIMEOUT;
#endif

    // Attendre l'acknowledgement
    while (!I2CByteWasAcknowledged(I2C4)) {
#ifdef USE_LED_I2C_TIMEOUT
        if (TIME_OVER(wClock_LED_I2C_TimeOut, u16_clock1ms)) {
            return FALSE;
        }
#else
        Nop();
#endif
    }

    // Envoyer les données
    uint8_t i;
    for (i = 0; i < dataSize; i++) {
        if (!DRV2605_0_Driver_I2C_TransmitOneByte(ptrData[i])) {
            return FALSE;
        }
    }

    // Fin de la transmission (arrêt si une erreur est survenue)
    if (!DRV2605_0_Driver_I2C_StopTransfer()) {
        return FALSE;
    }

    return TRUE;
}

/********************************************************************
* Function:         DRV2605_0_Driver_I2C_ReadOneByte
*
* Precondition:
*
* Input:           
*
* Output:           BYTE = value from TLC59116_Driver
*
* Side Effects:
*
* Overview:         Read the Data in EEPROM at the specified Address
*
* Note:             Check TLC59116_Driver_CheckAckStatusI2C before re-used
********************************************************************/
BYTE DRV2605_0_Driver_I2C_ReadOneByte(BYTE *ptr_value, BOOL is_last_byte) {
    // Assurez-vous que le bus I2C est disponible
    if (DRV2605_0_Driver_I2C_Idle()) {
        // Activez le récepteur I2C
        if (I2CReceiverEnable(I2C4, TRUE) != I2C_RECEIVE_OVERFLOW) {
            // Attendez que les données soient disponibles sur le bus I2C
            while (!I2CReceivedDataIsAvailable(I2C4)) {
#ifdef USE_LED_I2C_TIMEOUT
                // Vérifiez le dépassement du temps d'attente
                if (TIME_OVER(wClock_LED_I2C_TimeOut, u16_clock1ms)) {
                    return FALSE;
                }
#else
                // Ajoutez une légère pause pour permettre la réception des données
                Nop();
#endif
            }

            // Confirmez la réception de l'octet
            if (!is_last_byte) {
                I2CAcknowledgeByte(I2C4, TRUE);
                while (!I2CAcknowledgeHasCompleted(I2C4)) {
                    // Attendez la fin de la confirmation de l'octet
                }
            }

            // Lisez l'octet du bus I2C
            *ptr_value = (BYTE) I2CGetByte(I2C4);

            // Effacez le statut de données disponibles
            I2CClearStatus(I2C4, I2C_DATA_AVAILABLE);

            // Indiquez que la lecture a réussi
            return TRUE;
        } else {
            // Le récepteur I2C a rencontré un problème, retournez FALSE
            return FALSE;
        }
    } else {
        // Le bus I2C n'est pas disponible, retournez FALSE
        return FALSE;
    }
}

/********************************************************************
* Function:             DRV2605_0_Driver_I2C_StartTransfer
*
* Precondition:         The I2C module must have been initialized.
*
* Input:                - If FALSE, send a "Start" condition
*                       - If TRUE, send a "Restart" condition
*
* Output:               - TRUE    - If successful
*                       - FALSE   - If a collision occured during Start signaling
*
* Side Effects:         Starts (or restarts) a transfer to the LED driver.
*
* Overview:             This routine starts (or restarts) a transfer to the LED driver,
*                       waiting (in a blocking loop) until the start (or re-start) condition
*                       has completed.
*
* Note:                 This is a blocking routine that waits for the bus to be
*                       idle and the Start (or Restart) signal to complete.
********************************************************************/
BOOL DRV2605_0_Driver_I2C_StartTransfer(BOOL restart) {
    I2C_STATUS status;

    // Assurez-vous que le bus I2C est en attente
    if (!DRV2605_0_Driver_I2C_Idle()) {
        return FALSE;
    }

    // Envoyer le signal de démarrage (ou de redémarrage)
    if (restart) {
        // Redémarrer la communication I2C
        if (I2CRepeatStart(I2C4) /*!= I2C_SUCCESS*/) {
            return FALSE; // En cas d'échec du redémarrage
        }
    } else {
        // Vérifier si le bus I2C est déjà occupé
        if (!I2CBusIsIdle(I2C4)) {
            return FALSE; // En cas d'occupation du bus
        }
        // Démarrer la communication I2C
        if (I2CStart(I2C4) != I2C_SUCCESS) {
            return FALSE; // En cas d'échec du démarrage
        }
    }

#ifdef USE_LED_I2C_TIMEOUT
    // Configuration du délai d'attente pour le signal de démarrage
    wClock_LED_I2C_TimeOut = u16_clock1ms + LED_I2C_TIMEOUT;
#endif

    // Attendre que le signal de démarrage soit complet
    do {
        status = I2CGetStatus(I2C4);
        if (I2C_ARBITRATION_LOSS & status) {
            I2CClearStatus(I2C4, I2C_ARBITRATION_LOSS);
            DRV2605_0_Driver_I2C_Idle();
            I2CStart(I2C4);
        }

#ifdef USE_LED_I2C_TIMEOUT
        if (TIME_OVER(wClock_LED_I2C_TimeOut, u16_clock1ms)) {
            return FALSE; // En cas de dépassement du délai d'attente
        }
#endif
    } while (!(status & I2C_START));

    // Vérifier si le bus est à nouveau en attente après le démarrage
    return DRV2605_0_Driver_I2C_Idle();
}

/********************************************************************
* Function:            DRV2605_0_Driver_I2C_StopTransfer
*
* Precondition:         The I2C module must have been initialized & a
*                       transfer started.
*
* Input:                None.
*
* Output:               BOOL = true if ok otherwise false.
*
* Side Effects:         Stops a transfer to the LED driver.
*
* Overview:             This routine Stops a transfer to the LED Driver, waiting
*                       (in a blocking loop) until the Stop condition has completed.
*
* Note:                 This is a blocking routine that waits for the Stop signal to complete
*                       if timeout not defined
********************************************************************/
BOOL DRV2605_0_Driver_I2C_StopTransfer(void) {
    I2C_STATUS status;
    /* Send the Stop signal */
    I2CStop(I2C4);
    /* Wait for the signal to complete */
#ifdef USE_LED_I2C_TIMEOUT
    /* Arm the timer */
    wClock_LED_I2C_TimeOut = u16_clock1ms + LED_I2C_TIMEOUT;
#endif

    do {
        status = I2CGetStatus(I2C4);
        if (I2C_ARBITRATION_LOSS & status) {
            I2CClearStatus(I2C4, I2C_ARBITRATION_LOSS);
            DRV2605_0_Driver_I2C_Idle();
            I2CStop(I2C4);
        }
#ifdef USE_LED_I2C_TIMEOUT
        if (TIME_OVER(wClock_LED_I2C_TimeOut, u16_clock1ms)) {
            return FALSE;
        }
#endif
    } while (!(status & I2C_STOP));

    return DRV2605_0_Driver_I2C_Idle();
}

/********************************************************************
* Function:             DRV2605_0_CheckAckStatusI2C
*
* Precondition:
*
* Input:                None.
*
* Output:               BOOL = TRUE if Ack ok FALSE instead
*
* Side Effects:
*
* Overview:             Verify if the TLC59116 Ack the last command
*
* Note:
********************************************************************/
BOOL DRV2605_0_Driver_CheckAckStatusI2C(void) {
    BOOL Success = TRUE;
    BOOL Acknowledged;
    I2C_7_BIT_ADDRESS SlaveAddress;

    I2C_FORMAT_7_BIT_ADDRESS(SlaveAddress, DRV2605_I2C_ADDRESS, I2C_WRITE);
    Acknowledged = FALSE;

#ifdef USE_LED_I2C_TIMEOUT
    /* Arm the ACK timeout */
    wClock_LED_I2C_Ack_TimeOut = u16_clock1ms + LED_I2C_ACK_TIMEOUT;
#endif

    do {
        /* Start the transfer to address the I2C LED Drive */
        if (!DRV2605_0_Driver_I2C_StartTransfer(FALSE)) {
            return FALSE;
        }

        /* Transmit just the LED Driver's address */
        if (DRV2605_0_Driver_I2C_TransmitOneByte(SlaveAddress.byte)) {
            /* Check to see if the byte was acknowledged */
            Acknowledged = I2CByteWasAcknowledged(I2C4);
        }

#ifdef USE_LED_I2C_TIMEOUT
        if (TIME_OVER(wClock_LED_I2C_Ack_TimeOut, u16_clock1ms)) {

            return FALSE;
        }
#endif       

        /* End the transfer (stop here if an error occured) */
        if (!DRV2605_0_Driver_I2C_StopTransfer()) {
            return FALSE;
        }
    } while (Acknowledged != TRUE);

    return Success;
}

/********************************************************************
* Function:             DRV2605_0_Driver_I2C_ByteWasAcknowledged
*
* Precondition:
*
* Input:                I2C_MODULE id  lise : I2C1 or IC2C2 ...
*
* Output:               BOOL = true if ok otherwise false.
*
* Side Effects:
*
* Overview:             Check if byte was acknowledged
*
* Note:
********************************************************************/
BOOL DRV2605_0_Driver_I2C_ByteWasAcknowledged(I2C_MODULE id) {
    /* Check to see if the byte was acknowledged */
    I2CByteWasAcknowledged(I2C4);
#ifdef USE_LED_I2C_TIMEOUT
    if (TIME_OVER(wClock_LED_I2C_Ack_TimeOut, u16_clock1ms)) {
        return FALSE;
    }
#endif
    return TRUE;
}

/********************************************************************
* Function:             DRV2605_0_Select_Waveform
*
* Precondition:
*
* Input: uint8_t wav_frm_seq_reg_ad : register add like DRV2605L_WAV_FRM_SEQ1_REG_AD
* uint8_t wav_frm_seq : register sequence possible value 0-6
*
* Output:
*
* Side Effects:
*
* Overview:
*
* Note:
********************************************************************/
void DRV2605_0_Select_Waveform(uint8_t wav_frm_seq_reg_ad, uint8_t wav_frm_seq) {
    DRV2605_0_SendMsgToWrite(I2C4, wav_frm_seq_reg_ad, &wav_frm_seq, 1u);
}

/********************************************************************
* Function:             DRV2605_0_Remove_Standby_Mode
*
* Precondition:
*
* Input:
*
* Output:
*
* Side Effects:
*
* Overview:
*
* Note:
********************************************************************/
static void DRV2605_0_Remove_Standby_Mode(void) {
    /* DEV_RESET - 0: Device reset. */
    /* STANDBY - 0:Device ready */
    /* MODE - 0: Internal trigger */
    uint8_t resetReg = 0u;
    DRV2605_0_SendMsgToWrite(I2C4, DRV2605_REG_01_AD, &resetReg, 1u);
}

/********************************************************************
* Function:             DRV2605_0_Driver_Init
*
* Precondition:
*
* Input:
*
* Output:
*
* Side Effects:
*
* Overview:
*
* Note:
********************************************************************/
void DRV2605_0_Driver_Init(void) {
    InitI2C_0();

    /* Initialization Procedure */
    /* EN pin is set by default at high */
    /* Write MODE register 0x01 to 0x00 */
    DRV2605_0_Remove_Standby_Mode();
    DRV2605_0_Select_Waveform(DRV2605_WAV_FRM_SEQ1_REG_AD, 0x00u);
    DRV2605_0_Select_Waveform(DRV2605_WAV_FRM_SEQ2_REG_AD, 0x00u);
    DRV2605_0_Select_Waveform(DRV2605_WAV_FRM_SEQ3_REG_AD, 0x00u);
    DRV2605_0_Select_Waveform(DRV2605_WAV_FRM_SEQ4_REG_AD, 0x00u);
    DRV2605_0_Select_Waveform(DRV2605_WAV_FRM_SEQ5_REG_AD, 0x00u);
    DRV2605_0_Select_Waveform(DRV2605_WAV_FRM_SEQ6_REG_AD, 0x00u);
    DRV2605_0_Select_Waveform(DRV2605_WAV_FRM_SEQ7_REG_AD, 0x00u);
    DRV2605_0_Select_Waveform(DRV2605_WAV_FRM_SEQ8_REG_AD, 0x00u);

    //    DRV2605_Driver_I2C_ReadOneByte();
    DRV2605_0_Driver_Go();
}

/********************************************************************
* Function:             DRV2605_0_Driver_Go
*
* Precondition:
*
* Input:
*
* Output:
*
* Side Effects:
*
* Overview:
*
* Note:
********************************************************************/
void DRV2605_0_Driver_Go(void) {
    uint8_t u8_Go = 1u;
    DRV2605_0_SendMsgToWrite(I2C4, DRV2605_GO_REG_AD, &u8_Go, 1u);
}

/* *****************************************************************************
End of File
*/

et pour le haptic_0_app.c et haptic_1_app.c c'est la même chose soit 0 soit 1 qui change :

/** Descriptive File Name

  @Company
APEM

  @File Name
    haptic_0_app.c

  @Summary
    Brief description of the file.

  @Description
    Describe the purpose of this file.
*/

/* ************************************************************************** */
/* ************************************************************************** */
/* Section: Included Files                                                    */
/* ************************************************************************** */
/* ************************************************************************** */

#include "haptic_0_app.h"
#include "common.h"
#include "DRV2605_0_Driver.h"

/********************************************************************
* Function:             Haptic_App_Init
*
* Input:
*
* Output:
*
* Side Effects:
*
* Overview:
*
* Note:
********************************************************************/
void Haptic_0_App_Init(void) {
   
DRV2605_0_Driver_Init();
DRV2605_0_Select_Waveform(DRV2605_WAV_FRM_SEQ1_REG_AD, WAVEFORM_HAPTIC_BTN);
}

/********************************************************************
* Function:             Haptic_App_Go
*
* Input:
*
* Output:
*
* Side Effects:
*
* Overview:
*
* Note:
********************************************************************/
void Haptic_0_App_Go(void)
{
DRV2605_0_Driver_Go();
}

/********************************************************************
* Function:             Haptic_App_Set_Valid
*
* Input:
*
* Output:
*
* Side Effects:
*
* Overview:
*
* Note:
********************************************************************/
void Haptic_0_App_Set_Valid(void) {
DRV2605_0_Select_Waveform(DRV2605_WAV_FRM_SEQ1_REG_AD, WAVEFORM_HAPTIC_VALID);
}

/********************************************************************
* Function:             Haptic_App_Set_Btn
*
* Input:
*
* Output:
*
* Side Effects:
*
* Overview:
*
* Note:
********************************************************************/
void Haptic_0_App_Set_Btn(void) {
DRV2605_0_Select_Waveform(DRV2605_WAV_FRM_SEQ1_REG_AD, WAVEFORM_HAPTIC_BTN);
}

/********************************************************************
* Function:             Haptic_App_Go_Valid
*
* Input:
*
* Output:
*
* Side Effects:x
*
* Overview:
*
* Note:
********************************************************************/
void Haptic_0_App_Go_Valid(void) {
Haptic_0_App_Set_Valid();
Haptic_0_App_Go();
Haptic_0_App_Set_Btn();
}

/********************************************************************
* Function:             Haptic_App_Task
*
* Input:
*
* Output:
*
* Side Effects:
*
* Overview:
*
* Note:
********************************************************************/
void Haptic_0_App_Task(void) {
}
/* *****************************************************************************
End of File
*/

ensuite comment on l'utilise dans le main :

int main(void) {

    /* Reset TickSystem */
    u16_clock1ms = 0;

    /* Initialize µC */
    InitializePIC();

    /* Initialize USB */
#ifdef USB_ACTIVE
    InitializeUSB(); /* enable USB module and initialize registers */
#ifdef USB_INTERRUPT
    USBDeviceAttach(); /* enable interrupts and initialize them */
#endif
#endif

    /* To change the USB Product string descriptor */
    /* go to this file */
    /* usb_descriptions.c */
    /* and change the sd002 */

    /* Unlock the bootloader */
    EraseLastRequester(BTL_SENDER_ID);

    /* WDT timeout period is set in the Device Configuration */
    DisableWDT();
    if (ReadEventWDT()) { /* A WDT event did occur */
        DisableWDT();
        ClearEventWDT(); /* clear the WDT event flag so a subsequent event can set the event bit */
    }
    EnableWDT();

    Haptic_0_App_Init();
    Haptic_0_App_Set_Btn();
    Haptic_1_App_Init();
    Haptic_1_App_Set_Btn();

    while (1) {
        ClearWDT();
#ifdef USB_ACTIVE
#ifdef USB_POLLING
        USBDeviceTasks(); /* detect current status of USB module and handle it */
#endif
        USB_RECEIVE_DATA();

      if (BTN2_Port != 1 || BTN5_Port != 1) {
            DRV2605_0_Driver_Go();
            delay_us(2500);
        }
        if (BTN1_Port != 1 || BTN4_Port != 1) {
            DRV2605_1_Driver_Go();
            delay_us(2500);
        }
        if (BTN0_Port != 1 || BTN3_Port != 1) {

        }

    }

#endif
}


utilisation du picoscope


 démarrage du logiciel picoscope

choix de l'appareil

Page d'accueil 

une fois l'appareil détecter on arrive ici

 ceci est la configuration de la mise en tension.

 Voici comment paramétrer l'I2C (avec un exemple)


Schéma des vibreurs


​Confidentialité apem


Test d'un vibreur !