📄 #objdict.c#
字号:
/* Computed by strSdoClients *//* For a slave node, declare only one SDO client to send data to the master *//* The master node must have one SDO client for each slave */#define INDEX_LAST_SDO_CLIENT 0x1280#define DEF_MAX_COUNT_OF_SDO_CLIENT 1#define _CREATE_SDO_CLIENT_(SDONUM) \static s_sdo_parameter clientSDO ## SDONUM = \{ 3, /* Number of entries. Always 3 for the SDO*/\0x600, /* The cob_id transmited in CAN msg to the server. Put the "good" value instead : 0x600 + server node */\0x580, /* The cob_id received in CAN msg from the server. Put the "good" value instead : 0x600 + server node*/\0x00 /* The node id of the server. Put the "good" value : server node*/\};\static subindex Index ## SDONUM [] =\{\ { RO, uint8, sizeof( UNS8 ), (void*)&clientSDO ## SDONUM.count },\ { RO, uint32, sizeof( UNS32), (void*)&clientSDO ## SDONUM.cob_id_client },\ { RO, uint32, sizeof( UNS32), (void*)&clientSDO ## SDONUM.cob_id_server },\ { RO, uint8, sizeof( UNS8), (void*)&clientSDO ## SDONUM.node_id }\};_CREATE_SDO_CLIENT_(1280)/* Create the client SDO Parameter area. */const indextable clientSDOParameter[] ={ DeclareIndexTableEntry(Index1280)};/**************************************************************************//* The PDO(s) Which could be received *//**************************************************************************//* Computed by strPdoReceive */#define INDEX_LAST_PDO_RECEIVE 0X1402#define MAX_COUNT_OF_PDO_RECEIVE 3#define _CREATE_RXPDO_(RXPDO) \static s_pdo_communication_parameter RxPDO ## RXPDO = \{ 2, /* Number of entries. Always 2*/\0x000, /* Default cobid*/\0x00 /* Transmission type. See objetdictdef.h*/\};\static subindex Index ## RXPDO[] =\{\ { RO, uint8, sizeof( UNS8 ), (void*)&RxPDO ## RXPDO.count },\ { RW, uint32, sizeof( UNS32), (void*)&RxPDO ## RXPDO.cob_id },\ { RW, uint8, sizeof( UNS8), (void*)&RxPDO ## RXPDO.type }\};// This define the PDO receive entries from index 0x1400 to 0x1402 _CREATE_RXPDO_(1400)_CREATE_RXPDO_(1401)_CREATE_RXPDO_(1402)/* Create the Receive PDO Parameter area. */const indextable receivePDOParameter[] ={ DeclareIndexTableEntry(Index1400), DeclareIndexTableEntry(Index1401), DeclareIndexTableEntry(Index1402)};/**************************************************************************//* The PDO(s) Which could be transmited *//**************************************************************************//* Computed by strPdoTransmit */#define INDEX_LAST_PDO_TRANSMIT 0X1802#define MAX_COUNT_OF_PDO_TRANSMIT 3/** Usually the ID of a transmitting PDO is 0x180 + device_node_id,* but the node_id is not known during compilation... so what to do?!* the correct values have to be setted up during bootup of the device...*/#define _CREATE_TXPDO_(TXPDO) \static s_pdo_communication_parameter TxPDO ## TXPDO = \{ 2, /* Number of entries. Always 2*/\0x000, /* Default cobid*/\0x00 /* Transmission type. See objetdictdef.h*/\};\static subindex Index ## TXPDO[] =\{\ { RO, uint8, sizeof( UNS8 ), (void*)&TxPDO ## TXPDO.count },\ { RW, uint32, sizeof( UNS32), (void*)&TxPDO ## TXPDO.cob_id },\ { RW, uint8, sizeof( UNS8), (void*)&TxPDO ## TXPDO.type }\};// This define the PDO transmit entries from index 0x1800 to 0x1802 _CREATE_TXPDO_(1800)_CREATE_TXPDO_(1801)_CREATE_TXPDO_(1802)/* Create the Transmit PDO Parameter area. */const indextable transmitPDOParameter[] ={ DeclareIndexTableEntry(Index1800), DeclareIndexTableEntry(Index1801), DeclareIndexTableEntry(Index1802)};/**************************************************************************//* PDO Mapping parameters *//**************************************************************************//* Computed by strPdoParam */# define PDO_MAP(index, sub_index, size_variable_in_bits)\0x ## index ## sub_index ## size_variable_in_bits/* Beware : index *must* be writen 4 numbers in hexasub_index *must* be writen 2 numbers in hexasize_variable_in_UNS8 *must* be writen 2 numbers in hexa*//* Max number of data which can be put in a PDO Example, one PDO contains 2 objects, an other contains 5 objects. put MAX_COUNT_OF_PDO_MAPPING 5*/#define MAX_COUNT_OF_PDO_MAPPING 8typedef struct td_s_pdo_mapping_parameter // Index: 0x21{/** count of mapping entries */ UNS8 count; /** mapping entries itself. */ UNS32 object[MAX_COUNT_OF_PDO_MAPPING];} s_pdo_mapping_parameter;/**************************************************************************//* The mapping area of the PDO received *//**************************************************************************//* Computed by strPdoReceiveMapTop *//* Note, The index 160x is used to map the PDO 140x. The relation between the two is automatic *//* Computed by strCreateRxMap */#define _CREATE_RXMAP_(RXMAP) \static s_pdo_mapping_parameter RxMap ## RXMAP = \{ 0,\{\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00)\ }\ };\ subindex Index ## RXMAP [] =\{\ { RW, uint8, sizeof( UNS8 ), (void*)&RxMap ## RXMAP.count },\ { RW, uint32, sizeof( UNS32 ), (void*)&RxMap ## RXMAP.object[0] },\ { RW, uint32, sizeof( UNS32 ), (void*)&RxMap ## RXMAP.object[1] },\ { RW, uint32, sizeof( UNS32 ), (void*)&RxMap ## RXMAP.object[2] },\ { RW, uint32, sizeof( UNS32 ), (void*)&RxMap ## RXMAP.object[3] },\ { RW, uint32, sizeof( UNS32 ), (void*)&RxMap ## RXMAP.object[4] },\ { RW, uint32, sizeof( UNS32 ), (void*)&RxMap ## RXMAP.object[5] },\ { RW, uint32, sizeof( UNS32 ), (void*)&RxMap ## RXMAP.object[6] },\ { RW, uint32, sizeof( UNS32 ), (void*)&RxMap ## RXMAP.object[7] }\};/* Computed by strPdoReceiveMapBot */#define INDEX_LAST_PDO_MAPPING_RECEIVE 0x1602_CREATE_RXMAP_(1600)_CREATE_RXMAP_(1601)_CREATE_RXMAP_(1602)const indextable RxPDOMappingTable[ ] ={ DeclareIndexTableEntry(Index1600), DeclareIndexTableEntry(Index1601), DeclareIndexTableEntry(Index1602)};/**************************************************************************//* The mapping area of the PDO transmited *//**************************************************************************//* Computed by strPdoTransmitMapTop *//* Note, The index 18xx is used to map the PDO 1Axxx. The relation between the two is automatic *//* Computed by strCreateRxMap */#define _CREATE_TXMAP_(TXMAP) \static s_pdo_mapping_parameter TxMap ## TXMAP = \{ 0,\{\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00),\ PDO_MAP(0000, 00, 00)\ }\ };\ subindex Index ## TXMAP [] =\{\ { RW, uint8, sizeof( UNS8 ), (void*)&TxMap ## TXMAP.count },\ { RW, uint32, sizeof( UNS32 ), (void*)&TxMap ## TXMAP.object[0] },\ { RW, uint32, sizeof( UNS32 ), (void*)&TxMap ## TXMAP.object[1] },\ { RW, uint32, sizeof( UNS32 ), (void*)&TxMap ## TXMAP.object[2] },\ { RW, uint32, sizeof( UNS32 ), (void*)&TxMap ## TXMAP.object[3] },\ { RW, uint32, sizeof( UNS32 ), (void*)&TxMap ## TXMAP.object[4] },\ { RW, uint32, sizeof( UNS32 ), (void*)&TxMap ## TXMAP.object[5] },\ { RW, uint32, sizeof( UNS32 ), (void*)&TxMap ## TXMAP.object[6] },\ { RW, uint32, sizeof( UNS32 ), (void*)&TxMap ## TXMAP.object[7] }\};/* Computed by strPdoTransmitMapBot */#define INDEX_LAST_PDO_MAPPING_TRANSMIT 0x1a02_CREATE_TXMAP_(1a00)_CREATE_TXMAP_(1a01)_CREATE_TXMAP_(1a02)const indextable TxPDOMappingTable[ ] ={ DeclareIndexTableEntry(Index1a00), DeclareIndexTableEntry(Index1a01), DeclareIndexTableEntry(Index1a02)};**************************************************************************//* The mapped variables at index 0x2000 - 0x5fff *//**************************************************************************//* Computed by strMapVar *//********* Index 2000 *********/static UNS8 highestSubIndex_2000 = 4; // number of subindex - 1subindex Index2000[] = { { RO, uint8, sizeof(UNS8), (void*)&highestSubIndex_2000 }, { RW, uint8, sizeof (UNS8), (void*)&seconds }, { RW, uint8, sizeof (UNS8), (void*)&minutes }, { RW, uint8, sizeof (UNS8), (void*)&hours }, { RO, uint8, sizeof (UNS8), (void*)&day }};/********* Index 2001 *********/static UNS8 highestSubIndex_2001 = 5; // number of subindex - 1subindex Index2001[] = { { RO, uint8, sizeof(UNS8), (void*)&highestSubIndex_2001 }, { RO, uint8, sizeof (UNS8), (void*)&essaiTable[0] }, { RO, uint8, sizeof (UNS8), (void*)&essaiTable[1] }, { RO, uint8, sizeof (UNS8), (void*)&essaiTable[2] }, { RO, uint8, sizeof (UNS8), (void*)&essaiTable[3] }, { RO, uint8, sizeof (UNS8), (void*)&essaiTable[4] }};#define MANUFACTURER_SPECIFIC_LAST_INDEX 0x2001const indextable manufacturerProfileTable[] = { DeclareIndexTableEntry(Index2000), DeclareIndexTableEntry(Index2001)};/**************************************************************************//* The mapped variables at index 0x6000 - 0x61ff *//**************************************************************************//* Computed by strMapVar *//********* Index 6000 *********/static UNS8 highestSubIndex_6000 = 0; // number of subindex - 1subindex Index6000[] = { { RW, uint32, sizeof (UNS32), (void*)&canopenErrNB }};/********* Index 6001 *********/static UNS8 highestSubIndex_6001 = 0; // number of subindex - 1subindex Index6001[] = { { RW, uint32, sizeof (UNS32), (void*)&canopenErrVAL }};#define DIGITAL_INPUT_LAST_TABLE_INDEX 0x6001const indextable digitalInputTable[] = { DeclareIndexTableEntry(Index6000), DeclareIndexTableEntry(Index6001)};/**************************************************************************//* The mapped variables at index 0x6200 - 0x9fff *//**************************************************************************//* Computed by strMapVar */#define DIGITAL_OUTPUT_LAST_TABLE_INDEX 0x0const indextable digitalOutputTable[] = { {NULL, 0}};/**************************************************************************//* Varia used by other files *//**************************************************************************//* Computed by strVaria2 */UNS8 count_sync[MAX_COUNT_OF_PDO_TRANSMIT];#define COMM_PROFILE_LAST 0x1018/* Should not be modified */const dict_cste dict_cstes = {COMM_PROFILE_LAST,INDEX_LAST_SDO_SERVER, DEF_MAX_COUNT_OF_SDO_SERVER, INDEX_LAST_SDO_CLIENT, DEF_MAX_COUNT_OF_SDO_CLIENT, INDEX_LAST_PDO_RECEIVE, MAX_COUNT_OF_PDO_RECEIVE, INDEX_LAST_PDO_TRANSMIT, MAX_COUNT_OF_PDO_TRANSMIT, INDEX_LAST_PDO_MAPPING_RECEIVE, INDEX_LAST_PDO_MAPPING_TRANSMIT,MANUFACTURER_SPECIFIC_LAST_INDEX,DIGITAL_INPUT_LAST_TABLE_INDEX,DIGITAL_OUTPUT_LAST_TABLE_INDEX,NB_OF_HEARTBEAT_PRODUCERS };
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -