Ronex_Protocol_0x02000009_DC_Motor_Small_00.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2013, Shadow Robot Company, All rights reserved.
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 3.0 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library.
00016  */
00017 
00019 
00020 #ifndef RONEX_PROTOCOL_0x02000009_DC_MOTOR_SMALL_H_INCLUDED
00021 #define RONEX_PROTOCOL_0x02000009_DC_MOTOR_SMALL_H_INCLUDED
00022 
00023 #include "typedefs_shadow.h"
00024 
00025 #if defined(__GNUC__)
00026 
00027 #else
00028     #define __attribute__(x)
00029 #endif
00030 
00031 #define RONEX_COMMAND_02000009_MASTER_CLOCK_SPEED_HZ                 64000000        //!< Master clock. This is divided down to create the SPI clock.
00032 #define RONEX_COMMAND_02000009_ADC_SAMPLE_RATE_HZ                        1000        //!< Maximum possible ADC sample rate. Don't send EtherCAT packets faster than this.
00033 #define NUM_ANALOGUE_INPUTS_02000009                                        6
00034 #define ANALOGUE_INPUT_RESOLUTION_02000009                                 12        //!<
00035 #define ANALOGUE_INPUT_JUSTIFICATION_02000009                           RIGHT
00036 #define NUM_ANALOGUE_OUTPUTS_02000009                                       0
00037 #define ANALOGUE_OUTPUT_RESOLUTION_02000009                                 0
00038 #define ANALOGUE_OUTPUT_JUSTIFICATION_02000009                          RIGHT
00039 #define NUM_DIGITAL_IO_02000009                                             6
00040 #define PRODUCT_NAME_02000009                                 "dc_motor_small"
00041 #define PRODUCT_ID_02000009                                        0x02000009
00042 #define MAXIMUM_NUM_STACKERS_02000009                                       2
00043 #define STACKER_TYPE_02000009                                               4            //!< range [1..13]
00044 
00045 
00054 #define RONEX_COMMAND_02000009_COMMAND_TYPE_INVALID             0x0000      //!< Zeros imply a failed EtherCAT packet, so this it taken to be invalid.
00055 #define RONEX_COMMAND_02000009_COMMAND_TYPE_NORMAL              0x0001      //!< This is for normal operation.
00056 #define RONEX_COMMAND_02000009_COMMAND_TYPE_ERROR               0x0002      //!< This is for normal operation.
00057 
00058 
00059 
00066 #define RONEX_02000009_FLAGS_STACKER_0_PRESENT                  0x1000
00067 #define RONEX_02000009_FLAGS_STACKER_1_PRESENT                  0x2000
00068 #define RONEX_02000009_FLAGS_STACKER_2_PRESENT                  0x4000
00069 #define RONEX_02000009_FLAGS_STACKER_3_PRESENT                  0x8000
00070 #define RONEX_02000009_FLAGS_STACKER_0_ERROR                    0x0100
00071 #define RONEX_02000009_FLAGS_STACKER_1_ERROR                    0x0200
00072 #define RONEX_02000009_FLAGS_STACKER_2_ERROR                    0x0400
00073 #define RONEX_02000009_FLAGS_STACKER_3_ERROR                    0x0800
00074 #define RONEX_02000009_FLAGS_RESERVED_ERRORS                    0x00FC
00075 #define RONEX_02000009_FLAGS_OVER_TEMPERATURE_ERROR             0x0002
00076 #define RONEX_02000009_FLAGS_UNKNOWN_ERROR                      0x0001
00077                                                                 
00078 #define RONEX_02000009_MOTOR_STATUS_FLAG_R_UP                   0x0001
00079 #define RONEX_02000009_MOTOR_STATUS_FLAG_R_DOWN                 0x0002
00080 #define RONEX_02000009_MOTOR_STATUS_FLAG_I_UP                   0x0004
00081 #define RONEX_02000009_MOTOR_STATUS_FLAG_I_DOWN                 0x0008
00082                                                                 
00083 #define RONEX_02000009_MOTOR_COMMAND_FLAG_DIRECTION_FORE        0x0001
00084 #define RONEX_02000009_MOTOR_COMMAND_FLAG_DIRECTION_BACK        0x0000
00085 #define RONEX_02000009_MOTOR_COMMAND_FLAG_WAKE                  0x0002
00086 #define RONEX_02000009_MOTOR_COMMAND_FLAG_SLEEP                 0x0000
00087 #define RONEX_02000009_MOTOR_COMMAND_FLAG_MODE_BRAKE            0x0004
00088 #define RONEX_02000009_MOTOR_COMMAND_FLAG_MODE_NO_BRAKE         0x0000
00089 #define RONEX_02000009_MOTOR_COMMAND_FLAG_INDEX_SIGN_POS        0x0000
00090 #define RONEX_02000009_MOTOR_COMMAND_FLAG_INDEX_SIGN_NEG        0x0008
00091 #define RONEX_02000009_MOTOR_COMMAND_FLAG_INDEX_ENABLE          0x0000
00092 #define RONEX_02000009_MOTOR_COMMAND_FLAG_INDEX_DISABLE         0x0010
00093 #define RONEX_02000009_MOTOR_COMMAND_FLAG_MOTOR_KILL_ENABLE     0x0020
00094 #define RONEX_02000009_MOTOR_COMMAND_FLAG_MOTOR_KILL_DISABLE    0x0000
00095 
00096 typedef struct
00097 {
00098     int16u period;
00099     int16u onTime;
00100     int16u flags;
00101 }__attribute__((packed)) MotorPacketCommand;        // 6 bytes
00102 
00103 typedef struct
00104 {
00105     int16u quadrature;
00106     int16u flags;
00107 }__attribute__((packed)) MotorPacketStatus;         // 4 bytes
00108 
00109 // =========================
00110 //     Command Structure
00111 // =========================
00112 typedef struct
00113 {
00114     int16u              command_type;               // 2
00115     int16u              pin_output_states_DIO;      // 2
00116     MotorPacketCommand  motor_packet_command[2];    // 6x2
00117 }__attribute__((packed)) RONEX_COMMAND_02000009;    // 16 bytes
00118 
00119 
00120 
00121 // ======================================================
00122 // This is the packet that's actually sent back to the PC
00123 //   containing either the Status data or Config data
00124 // ======================================================
00125 typedef struct
00126 {
00127     int16u              command_type;               //  2         // This is a copy of the value in the command structure
00128 
00129     int16u              pin_input_states_DIO;       //  2
00130     int16u              analogue_in[6];             // 12
00131     MotorPacketStatus   motor_packet_status[2];     // 4x2
00132     
00133 }__attribute__((packed)) RONEX_STATUS_02000009;     // 24 bytes
00134 
00135 
00136 #define COMMAND_ARRAY_SIZE_BYTES_02000009    (sizeof(RONEX_COMMAND_02000009))
00137 #define COMMAND_ARRAY_SIZE_WORDS_02000009    (sizeof(RONEX_COMMAND_02000009)/2)
00138 #define STATUS_ARRAY_SIZE_BYTES_02000009     (sizeof(RONEX_STATUS_02000009))
00139 #define STATUS_ARRAY_SIZE_WORDS_02000009     (sizeof(RONEX_STATUS_02000009)/2)
00140 
00141 #define COMMAND_ARRAY_EXPECTED_SIZE_BYTES_02000009       16
00142 #define STATUS_ARRAY_EXPECTED_SIZE_BYTES_02000009        24
00143                                                                             // Queued (Mailbox)
00144                                                                             // Syncmanager Definitions
00145                                                                             // -----------------------
00146 #define PROTOCOL_TYPE   EC_QUEUED                                           //  Synchronous communication
00147 #define COMMAND_ADDRESS_02000009 0x1000                                              //!< ET1200 address containing the Command Structure
00148 #define STATUS_ADDRESS_02000009  (COMMAND_ADDRESS_02000009+sizeof(RONEX_COMMAND_02000009) *4) //!< ET1200 address containing the Status  Structure
00149 
00150 #define RONEX_COMMAND_STRUCT_02000009        RONEX_COMMAND_02000009                  //!< Required for et1200_interface.h to be generic
00151 #define RONEX_STATUS_STRUCT_02000009         RONEX_STATUS_02000009                   //!< Required for et1200_interface.h to be generic
00152 
00153 
00154 
00155 #endif


sr_ronex_external_protocol
Author(s): Ugo Cupcic, Toni Oliver, Mark Pitchless
autogenerated on Thu Jun 6 2019 21:21:43