pour trouver l'automate de reception can

Fork of CRAC-Strat_copy by Clement Breteau

Revision:
15:c2fc239e85df
Parent:
14:c8fc06c4887f
--- a/AX12-V2/AX12-V2.h	Fri Mar 31 16:20:26 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-#ifndef CRAC_AX12
-#define CRAC_AX12
-
-#include "global.h"
-
-#define MAX_AX12 30
-
-
-#define AX12_REG_ID 0x03
-#define AX12_REG_BAUD 0x04
-#define AX12_REG_DELAY_TIME 0x05
-#define AX12_REG_CW_LIMIT 0x06
-#define AX12_REG_CCW_LIMIT 0x08
-#define AX12_REG_TEMP_MAX 0x0B
-#define AX12_REG_LOWEST_VOLTAGE 0x0C
-#define AX12_REG_HIGHEST_VOLTAGE 0x0D
-#define AX12_REG_MAX_TORQUE 0x0E
-#define AX12_REG_SATUS_RETURN 0x10
-#define AX12_REG_ALARM_LED 0x11
-#define AX12_REG_ALARM_SHUTDOWN 0x12
-#define AX12_REG_DOWN_CALIBRATION 0x14
-#define AX12_REG_UP_CALIBRATION 0x16
-#define AX12_REG_TORQUE_ENABLE 0x18
-#define AX12_REG_LED 0x19
-#define AX12_REG_CW_MARGIN 0x1A
-#define AX12_REG_CCW_MARGIN 0x1B
-#define AX12_REG_CW_SLOPE 0x1C
-#define AX12_REG_CCW_SLOPE 0x1D
-#define AX12_REG_GOAL_POSITION 0x1E
-#define AX12_REG_MOVING_SPEED 0x20
-#define AX12_REG_TORQUE_LIMIT 0x22
-#define AX12_REG_POSITION 0x24
-#define AX12_REG_PRESENT_SPEED 0x26
-#define AX12_REG_PRESENT_LOAD 0x28
-#define AX12_REG_VOLTS 0x2A
-#define AX12_REG_TEMP 0x2B
-#define AX12_REG_INSTRUCTION 0x2C
-#define AX12_REG_MOVING 0x2E
-#define AX12_REG_LOCK 0x2F
-#define AX12_REG_PUNCH 0x30
-
-
-#define AX12_MODE_POSITION  0
-#define AX12_MODE_ROTATION  1
-
-#define AX12_CW 1
-#define AX12_CCW 0
-
-//--- Instruction ---
-#define INST_PING 0x01
-#define INST_READ 0x02
-#define INST_WRITE 0x03
-#define INST_REG_WRITE 0x04
-#define INST_ACTION 0x05
-#define INST_RESET 0x06
-#define INST_DIGITAL_RESET 0x07
-#define INST_SYSTEM_READ 0x0C
-#define INST_SYSTEM_WRITE 0x0D
-#define INST_SYNC_WRITE 0x83
-#define INST_SYNC_REG_WRITE 0x84
-
-#define DEFAULT_RETURN_PACKET_SIZE 6
-
-#define BROADCASTING_ID 0xfe
-
-#define MAX_TIMEOUT 5000
-
-#define AX12_SERIAL1 0
-#define AX12_SERIAL2 1
-
-
-struct S_AX12 {
-    unsigned char id;//L'id de l'AX12
-    unsigned short goal;//La position ou doit aller le robot
-    unsigned short speed;//La vitesse de déplacement du bras    
-    unsigned char isUsingCAN;//Indique si il faut envoyer les information via CAN (0=>non | autre=>oui)
-    unsigned char needToUpdate;//Indique qu'il faut mettre à jour la position
-    unsigned char needCheckMoving;//Permet d'indiquer que l'on doit verifier si l'AX12 bouge
-    unsigned char serial;
-};
-
-/****************************************************************************************/
-/* FUNCTION NAME: AX12_register                                                         */
-/* DESCRIPTION  : Indiquer qu'un AX12 est connecté à la carte                           */
-/****************************************************************************************/
-void AX12_register(unsigned char id,unsigned char serial, unsigned short speed = 0x3FF);
-
-/****************************************************************************************/
-/* FUNCTION NAME: AX12_setGoal                                                          */
-/* DESCRIPTION  : Definir la position d'un ax12, !!Ne déclanche pas le mouvement        */
-/****************************************************************************************/
-void AX12_setGoal(unsigned char id, unsigned short goal, unsigned short speed = 0x3FF);
-
-/****************************************************************************************/
-/* FUNCTION NAME: AX12_isLocal                                                          */
-/* DESCRIPTION  : Savoir si un AX12 est enregistré sur la carte                         */
-/****************************************************************************************/
-unsigned char AX12_isLocal(unsigned char id);
-
-/****************************************************************************************/
-/* FUNCTION NAME: AX12_notifyCANEnd                                                     */
-/* DESCRIPTION  : indiquer qu'un mouvement d'AX12 CAN est terminé                       */
-/****************************************************************************************/
-void AX12_notifyCANEnd(unsigned char id);
-
-/****************************************************************************************/
-/* FUNCTION NAME: AX12_getLocalID                                                       */
-/* DESCRIPTION  : Obtenir les info sur un AX12 ou l'initialiser si non présent          */
-/****************************************************************************************/
-int AX12_getLocalID(unsigned char id);
-
-/****************************************************************************************/
-/* FUNCTION NAME: AX12_doLoop                                                           */
-/* DESCRIPTION  : Boucle de vérification de la position des AX12                        */
-/****************************************************************************************/
-void AX12_doLoop(void);
-
-/****************************************************************************************/
-/* FUNCTION NAME: AX12_processChange                                                    */
-/* DESCRIPTION  : Permet de prendre en compte les changement d'instruction des AX12     */
-/*    Début du mouvement à partir de l'appel de cette fonction                          */
-/****************************************************************************************/
-void AX12_processChange(unsigned char fromCan = 0);
-
-/****************************************************************************************/
-/* FUNCTION NAME: AX12_isMoving                                                         */
-/* DESCRIPTION  : Fonction pour savoir si un AX12 local est entrain de bouger           */
-/****************************************************************************************/
-int AX12_isMoving(unsigned char id);
-
-/****************************************************************************************/
-/* FUNCTION NAME: AX12_syncWrite                                                        */
-/* DESCRIPTION  : Fonction pour envoyer des trames aux AX12 en mode syncWrite           */
-/****************************************************************************************/
-int AX12_syncWrite(SerialHalfDuplex& AX12_Serial,int start, int bytes, char* data);
-
-/****************************************************************************************/
-/* FUNCTION NAME: AX12_write                                                            */
-/* DESCRIPTION  : Fonction pour envoyer des trames aux AX12                             */
-/****************************************************************************************/
-int AX12_write(SerialHalfDuplex& AX12_Serial, int ID, int start, int bytes, char* data, int flag=0);
-
-/****************************************************************************************/
-/* FUNCTION NAME: AX12_read                                                             */
-/* DESCRIPTION  : Lire des données dans un registre de l'AX12                           */
-/****************************************************************************************/
-int AX12_read(SerialHalfDuplex& AX12_Serial, int ID, int start, int bytes, char* data);
-
-#endif
-