Ronex_Protocol_0x02000008_ADC16_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_0x02000008_ADC16_H_INCLUDED
00021 #define RONEX_PROTOCOL_0x02000008_ADC16_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_02000008_MASTER_CLOCK_SPEED_HZ        64000000        //!< Master clock. This is divided down to create the SPI clock.
00032 #define RONEX_COMMAND_02000008_ADC_SAMPLE_RATE_HZ               1000        //!< Maximum possible ADC sample rate. Don't send EtherCAT packets faster than this.
00033 #define NUM_ANALOGUE_INPUTS                                        6        
00034 #define ANALOGUE_INPUT_RESOLUTION                                 12        //!< 
00035 #define ANALOGUE_INPUT_JUSTIFICATION                           RIGHT
00036 #define NUM_ANALOGUE_OUTPUTS                                       0
00037 #define ANALOGUE_OUTPUT_RESOLUTION                                 0
00038 #define ANALOGUE_OUTPUT_JUSTIFICATION                          RIGHT
00039 #define NUM_DIGITAL_IO                                             6
00040 #define PRODUCT_NAME                                         "adc16"
00041 #define PRODUCT_ID                                        0x02000008
00042 #define MAXIMUM_NUM_STACKERS                                       3
00043 #define STACKER_TYPE                                               3            //!< range [1..13]
00044 #define NUM_ADC16_INPUTS                                          48
00045 #define ADC16_INPUT_RESOLUTION                                    16
00046 #define ADC16_INPUT_SAMPLE_RATE                                 1000
00047 
00048 
00057 #define RONEX_COMMAND_02000008_COMMAND_TYPE_INVALID             0x0000      //!< Zeros imply a failed EtherCAT packet, so this it taken to be invalid.
00058 #define RONEX_COMMAND_02000008_COMMAND_TYPE_NORMAL              0x0001      //!< This is for normal operation.
00059 #define RONEX_COMMAND_02000008_COMMAND_TYPE_SET_REG_VAL         0x0002      //!< This is used to configure the single ended / differential inputs
00060 #define RONEX_COMMAND_02000008_COMMAND_TYPE_WRITE_REGS          0x0003      //!< This is used to configure the single ended / differential inputs
00061 #define RONEX_COMMAND_02000008_COMMAND_TYPE_GET_CONFIG_INFO     0x0004      //!< This requests a CONFIG_INFO_02000008 block from the node.
00062 #define RONEX_COMMAND_02000008_COMMAND_TYPE_ERROR               0x00FF      //!< If this is returned from the node, then some kind of error has happened.
00063 
00064 
00065 
00072 #define RONEX_02000008_FLAGS_STACKER_0_PRESENT              0x1000
00073 #define RONEX_02000008_FLAGS_STACKER_1_PRESENT              0x2000
00074 #define RONEX_02000008_FLAGS_STACKER_2_PRESENT              0x4000
00075 #define RONEX_02000008_FLAGS_STACKER_3_PRESENT              0x8000
00076 #define RONEX_02000008_FLAGS_STACKER_0_ERROR                0x0100
00077 #define RONEX_02000008_FLAGS_STACKER_1_ERROR                0x0200
00078 #define RONEX_02000008_FLAGS_STACKER_2_ERROR                0x0400
00079 #define RONEX_02000008_FLAGS_STACKER_3_ERROR                0x0800
00080 #define RONEX_02000008_FLAGS_RESERVED_ERRORS                0x00FC
00081 #define RONEX_02000008_FLAGS_OVER_TEMPERATURE_ERROR         0x0002
00082 #define RONEX_02000008_FLAGS_UNKNOWN_ERROR                  0x0001
00083 
00084 
00085 
00097 #define IMPLEMENTED_FEATURE_ANALOGUE_INPUTS                 0x0001
00098 #define IMPLEMENTED_FEATURE_DIGITAL_IO                      0x0002
00099 #define IMPLEMENTED_FEATURE_ADC16_READ_SINGLE_ENDED         0x0004
00100 #define IMPLEMENTED_FEATURE_ADC16_READ_DIFFERENTIAL         0x0008
00101 #define IMPLEMENTED_FEATURE_ADC16_SENSOR_BIAS               0x0010
00102 
00103 #define RONEX_02000008_ADS1158_REGISTER_CONFIG_0            0x00
00104 #define RONEX_02000008_ADS1158_REGISTER_CONFIG_1            0x01
00105 #define RONEX_02000008_ADS1158_REGISTER_MUXSCH              0x02
00106 #define RONEX_02000008_ADS1158_REGISTER_MUXDIF              0x03
00107 #define RONEX_02000008_ADS1158_REGISTER_MUXSG0              0x04
00108 #define RONEX_02000008_ADS1158_REGISTER_MUXSG1              0x05
00109 #define RONEX_02000008_ADS1158_REGISTER_SYSRED              0x06
00110 #define RONEX_02000008_ADS1158_REGISTER_GPIOC               0x07
00111 #define RONEX_02000008_ADS1158_REGISTER_GPIOD               0x08
00112 #define RONEX_02000008_ADS1158_REGISTER_ID                  0x09
00113 
00114 // =========================
00115 //     Command Structure
00116 // =========================
00117 typedef struct
00118 {
00119     int16u      command_type;
00120     int8u       address;
00121     int8u       values[3];
00122     int16u      pin_output_states;
00123 }__attribute__((packed)) RONEX_COMMAND_02000008;
00124 
00125 
00126 // =========================
00127 //     Status Structure
00128 // =========================
00129 typedef struct
00130 {
00131     int16u      pin_input_states_DIO;
00132     int16u      analogue_in[6];
00133     union16     adc16[48];
00134 }__attribute__((packed)) STATUS_DATA_02000008;
00135 
00136 
00137 // =============================
00138 // Alternative Status Structure
00139 // containing config information
00140 // =============================
00141 typedef struct
00142 {
00143     int32u    implemented_features;
00144     int16u    flags;
00145     int8u     padding[sizeof(STATUS_DATA_02000008) - (sizeof(int32u)+sizeof(int16u))];
00146 }__attribute__((packed)) CONFIG_INFO_02000008;
00147 
00148 typedef struct
00149 {
00150     int8u       address;
00151     int8u       values[3];
00152     int8u       padding[sizeof(STATUS_DATA_02000008) - (sizeof(int8u)*4)];
00153 }__attribute__((packed)) REGISTER_FB_02000008;
00154 
00155 // ======================================================
00156 // This is the packet that's actually sent back to the PC
00157 //   containing either the Status data or Config data
00158 // ======================================================
00159 typedef struct
00160 {
00161     int16u    command_type;                             // This is a copy of the value in the command structure
00162 
00163     union                                               // The returned status packet contains either
00164     {                                                   // 
00165         STATUS_DATA_02000008  status_data;              //      - Actual sensor data
00166         CONFIG_INFO_02000008  config_info;              //      - Or configuration info
00167         REGISTER_FB_02000008  register_feedback;        //      - A check that the PSoC recieved our register write data
00168     }info_type;
00169 }__attribute__((packed)) RONEX_STATUS_02000008;
00170 
00171 
00172 #define COMMAND_ARRAY_SIZE_BYTES    (sizeof(RONEX_COMMAND_02000008))
00173 #define COMMAND_ARRAY_SIZE_WORDS    (sizeof(RONEX_COMMAND_02000008)/2)
00174 #define STATUS_ARRAY_SIZE_BYTES     (sizeof(RONEX_STATUS_02000008))
00175 #define STATUS_ARRAY_SIZE_WORDS     (sizeof(RONEX_STATUS_02000008)/2)
00176 
00177 
00178                                                                             // Queued (Mailbox)
00179                                                                             // Syncmanager Definitions
00180                                                                             // -----------------------
00181 #define PROTOCOL_TYPE   EC_QUEUED                                           //  Synchronous communication
00182 #define COMMAND_ADDRESS 0x1000                                              //!< ET1200 address containing the Command Structure
00183 #define STATUS_ADDRESS  (COMMAND_ADDRESS+sizeof(RONEX_COMMAND_02000008) *4) //!< ET1200 address containing the Status  Structure
00184 
00185 #define RONEX_COMMAND_STRUCT        RONEX_COMMAND_02000008                  //!< Required for et1200_interface.h to be generic
00186 #define RONEX_STATUS_STRUCT         RONEX_STATUS_02000008                   //!< Required for et1200_interface.h to be generic
00187 
00188 
00189 
00190 #endif


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