Ronex_Protocol_0x02000001_GIO_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 
00020 
00021 #ifndef RONEX_PROTOCOL_0x02000001_GIO_H_INCLUDED
00022 #define RONEX_PROTOCOL_0x02000001_GIO_H_INCLUDED
00023 
00024 #include "typedefs_shadow.h"
00025 
00026 #if defined(__GNUC__)
00027 
00028 #else
00029     #define __attribute__(x)
00030 #endif
00031 
00032 
00033                                                                             // PSoC Hardware Definitions
00034                                                                             // -------------------------
00035 #define RONEX_COMMAND_02000001_MASTER_CLOCK_SPEED_HZ        64000000        //!< Master clock. This is divided down to create the PWM clock.
00036 #define RONEX_COMMAND_02000001_ADC_SAMPLE_RATE_HZ               1000        //!< Maximum possible ADC sample rate. Don't send EtherCAT packets faster than this.
00037 #define NUM_ANALOGUE_INPUTS                                       12        
00038 #define ANALOGUE_INPUT_RESOLUTION                                 12        //!< 
00039 #define ANALOGUE_INPUT_JUSTIFICATION                           RIGHT
00040 #define NUM_ANALOGUE_OUTPUTS                                       0
00041 #define ANALOGUE_OUTPUT_RESOLUTION                                 0
00042 #define ANALOGUE_OUTPUT_JUSTIFICATION                          RIGHT
00043 #define NUM_DIGITAL_IO                                            12
00044 #define NUM_PWM_MODULES                            (NUM_DIGITAL_IO/2)
00045 #define PRODUCT_NAME                                    "general_IO"
00046 #define PRODUCT_ID                                        0x02000001
00047 #define MAXIMUM_NUM_STACKERS                                       1
00048 #define STACKER_TYPE                                               1            //!< range [1..13]
00049 
00050 #define RONEX_COMMAND_02000001_COMMAND_TYPE_INVALID           0x0000        //!< COMMAND_TYPE values are sent by the host to tell the node
00051 #define RONEX_COMMAND_02000001_COMMAND_TYPE_NORMAL            0x0001        //!  the type of data contained in the COMMAND struct.
00052 #define RONEX_COMMAND_02000001_COMMAND_TYPE_ERROR             0x00FF        //!  Currently there is only one type available, NORMAL. The others
00053 
00054 
00055 #define RONEX_02000001_FLAGS_STACKER_0_PRESENT                0x1000
00056 #define RONEX_02000001_FLAGS_STACKER_1_PRESENT                0x2000
00057 #define RONEX_02000001_FLAGS_STACKER_2_PRESENT                0x4000
00058 #define RONEX_02000001_FLAGS_STACKER_3_PRESENT                0x8000
00059 #define RONEX_02000001_FLAGS_STACKER_0_ERROR                  0x0100
00060 #define RONEX_02000001_FLAGS_STACKER_1_ERROR                  0x0200
00061 #define RONEX_02000001_FLAGS_STACKER_2_ERROR                  0x0400
00062 #define RONEX_02000001_FLAGS_STACKER_3_ERROR                  0x0800
00063 #define RONEX_02000001_FLAGS_RESERVED_ERRORS                  0x00FC
00064 #define RONEX_02000001_FLAGS_OVER_TEMPERATURE_ERROR           0x0002
00065 #define RONEX_02000001_FLAGS_UNKNOWN_ERROR                    0x0001
00066 
00067 
00068                                                                             // Queued (Mailbox)
00069                                                                             // Syncmanager Definitions
00070                                                                             // -----------------------
00071 #define PROTOCOL_TYPE   EC_QUEUED                                           //  Synchronous communication
00072 #define COMMAND_ADDRESS 0x1000                                              //!< ET1200 address containing the Command Structure
00073 #define STATUS_ADDRESS  (COMMAND_ADDRESS+sizeof(RONEX_COMMAND_02000001) *4) //!< ET1200 address containing the Status  Structure
00074 
00075 #define COMMAND_ARRAY_SIZE_BYTES    (sizeof(RONEX_COMMAND_02000001))
00076 #define COMMAND_ARRAY_SIZE_WORDS    (sizeof(RONEX_COMMAND_02000001)/2)
00077 #define STATUS_ARRAY_SIZE_BYTES     (sizeof(RONEX_STATUS_02000001 ))
00078 #define STATUS_ARRAY_SIZE_WORDS     (sizeof(RONEX_STATUS_02000001 )/2)
00079 
00080 
00081 
00082 
00083 
00084 
00085 
00086 typedef struct                                                              
00087 {
00088     int16u  pwm_period;                                                     
00089     int16u  pwm_on_time_0;                                                  
00090     int16u  pwm_on_time_1;
00091 }__attribute__((packed)) RONEX_COMMAND_02000001_PWM;
00092 
00093 
00094 
00095 
00096 
00097 typedef struct                                                              
00098 {                                                                           //   ----------------
00099     int16u                          command_type;                           // Copy of command_type from COMMAND struct (NOT USED YET)
00100     int16u                          analogue_in[12];
00101     int16u                          digital_in;                             
00102     int16u                          flags;
00103 }__attribute__((packed)) RONEX_STATUS_02000001;
00104 
00105 
00106 
00107 typedef struct                                                              
00108 {                                                                           //   --------------------------------
00109     int16u                          command_type;                         
00110     RONEX_COMMAND_02000001_PWM      pwm_module[NUM_PWM_MODULES];
00111     int32u                          digital_out;                            
00112 
00113 
00114 
00115 
00116     int16u                          pwm_clock_divider;
00117 }__attribute__((packed)) RONEX_COMMAND_02000001;
00118 
00119 #endif


sr_ronex_external_protocol
Author(s): Ugo Cupcic, Toni Oliver, Mark Pitchless
autogenerated on Fri Aug 28 2015 13:12:14