CANopenNode
CANopen protocol stack
|
CANopen Object Dictionary interface. More...
Topics | |
Getters and setters | |
OD definition objects | |
Files | |
file | CO_ODinterface.h |
CANopen Object Dictionary interface. | |
Data Structures | |
struct | OD_stream_t |
IO stream structure, used for read/write access to OD variable, part of OD_IO_t. More... | |
struct | OD_IO_t |
Structure for input / output on the OD variable. More... | |
struct | OD_extension_t |
Extension of OD object, which can optionally be specified by application in initialization phase with OD_extension_init() function. More... | |
struct | OD_entry_t |
Object Dictionary entry for one OD object. More... | |
struct | OD_t |
Object Dictionary. More... | |
Macros | |
#define | OD_FLAGS_PDO_SIZE 4U |
Size of of flagsPDO variable inside OD_extension_t, from 0 to 32. | |
#define | CO_PROGMEM const |
Modifier for OD objects. | |
Typedefs | |
typedef uint32_t | OD_size_t |
Variable of type OD_size_t contains data length in bytes of OD variable. | |
typedef uint8_t | OD_attr_t |
Type (and size) of Object Dictionary attribute. | |
Functions | |
ODR_t | OD_readOriginal (OD_stream_t *stream, void *buf, OD_size_t count, OD_size_t *countRead) |
Read value from original OD location. | |
ODR_t | OD_writeOriginal (OD_stream_t *stream, const void *buf, OD_size_t count, OD_size_t *countWritten) |
Write value to original OD location. | |
OD_entry_t * | OD_find (OD_t *od, uint16_t index) |
Find OD entry in Object Dictionary. | |
ODR_t | OD_getSub (const OD_entry_t *entry, uint8_t subIndex, OD_IO_t *io, bool_t odOrig) |
Find sub-object with specified sub-index on OD entry returned by OD_find. | |
static uint16_t | OD_getIndex (const OD_entry_t *entry) |
Return index from OD entry. | |
static bool_t | OD_mappable (OD_stream_t *stream) |
Check, if OD variable is mappable to PDO or SRDO. | |
static void | OD_rwRestart (OD_stream_t *stream) |
Restart read or write operation on OD variable. | |
static void | OD_requestTPDO (OD_entry_t *entry, uint8_t subIndex) |
Request TPDO, to which OD variable is mapped. | |
static bool_t | OD_TPDOtransmitted (OD_entry_t *entry, uint8_t subIndex) |
Check if requested TPDO was transmitted. | |
uint32_t | OD_getSDOabCode (ODR_t returnCode) |
Get SDO abort code from returnCode. | |
static ODR_t | OD_extension_init (OD_entry_t *entry, OD_extension_t *extension) |
Extend OD object with own read/write functions and/or flagsPDO. | |
CANopen Object Dictionary interface.
#define CO_PROGMEM const |
Modifier for OD objects.
This is large amount of data and is specified in Object Dictionary (OD.c file usually)
enum OD_ObjDicId_30x_t |
Common DS301 object dictionary entries.
enum OD_attributes_t |
Attributes (bit masks) for OD sub-object.
enum ODR_t |
Return codes from OD access functions.
OD_getSDOabCode() can be used to retrieve corresponding SDO abort code.
ODR_t OD_readOriginal | ( | OD_stream_t * | stream, |
void * | buf, | ||
OD_size_t | count, | ||
OD_size_t * | countRead ) |
Read value from original OD location.
This function can be used inside read / write functions, specified by OD_extension_init(). It reads data directly from memory location specified by Object dictionary. If no IO extension is used on OD entry, then io->read returned by OD_getSub() equals to this function. See also OD_IO_t.
ODR_t OD_writeOriginal | ( | OD_stream_t * | stream, |
const void * | buf, | ||
OD_size_t | count, | ||
OD_size_t * | countWritten ) |
Write value to original OD location.
This function can be used inside read / write functions, specified by OD_extension_init(). It writes data directly to memory location specified by Object dictionary. If no IO extension is used on OD entry, then io->write returned by OD_getSub() equals to this function. See also OD_IO_t.
OD_entry_t * OD_find | ( | OD_t * | od, |
uint16_t | index ) |
Find OD entry in Object Dictionary.
od | Object Dictionary |
index | CANopen Object Dictionary index of object in Object Dictionary |
ODR_t OD_getSub | ( | const OD_entry_t * | entry, |
uint8_t | subIndex, | ||
OD_IO_t * | io, | ||
bool_t | odOrig ) |
Find sub-object with specified sub-index on OD entry returned by OD_find.
Function populates io structure with sub-object data.
entry | Object Dictionary entry. | |
subIndex | Sub-index of the variable from the OD object. | |
[out] | io | Structure will be populated on success. |
odOrig | If true, then potential IO extension on entry will be ignored and access to data entry in the original OD location will be returned |
|
inlinestatic |
Return index from OD entry.
entry | Object Dictionary entry. |
|
inlinestatic |
Check, if OD variable is mappable to PDO or SRDO.
If OD variable is mappable, then it may be necessary to protect read/write access from mainline function. See Critical sections.
stream | Object Dictionary stream object. |
|
inlinestatic |
Restart read or write operation on OD variable.
It is not necessary to call this function, if stream was initialized by OD_getSub(). It is also not necessary to call this function, if previous read or write was successfully finished.
stream | Object Dictionary stream object. |
|
inlinestatic |
Request TPDO, to which OD variable is mapped.
Function clears the flagPDO bit, which corresponds to OD variable at specific OD index and subindex. For this functionality to work, OD_extension_t must be enabled on OD variable. If OD variable is mapped to any TPDO with event driven transmission, then TPDO will be transmitted after this function call. If OD variable is mapped to more than one TPDO with event driven transmission, only the first matched TPDO will be transmitted.
TPDO event driven transmission is enabled, if TPDO communication parameter, transmission type is set to 0, 254 or 255. For other transmission types (synchronous) flagPDO bit is ignored.
entry | Object Dictionary entry. |
subIndex | subIndex of the OD variable. |
|
inlinestatic |
Check if requested TPDO was transmitted.
entry | Object Dictionary entry. |
subIndex | subIndex of the OD variable. |
Get SDO abort code from returnCode.
returnCode | Returned from some OD access functions |
|
inlinestatic |
Extend OD object with own read/write functions and/or flagsPDO.
This function gives application very powerful tool: definition of own IO access on OD object. Structure and attributes are the same as defined in original OD object, but data are read directly from (or written directly to) application specified object via custom function calls.
Before this function specifies extension, OD variables are accessed from original OD location. After this function specifies extension OD variables are accessed from read/write functions specified by extension. (Except when "odOrig" argument to OD_getSub() is set to true.)
This function must also be used, when flagsPDO needs to be enabled for specific entry.
entry | Object Dictionary entry. |
extension | Extension object, which must be initialized externally. Extension object must exist permanently. If NULL, extension will be removed. |