CODirWrBuffer

CODirWrBuffer

Description

This function writes a buffer byte stream to the given object directory. The object entry is addressed with the given key and the bytes will be read from to the given source buffer of the given length.

Prototype

CPU_INT16S CODirWrBuffer(CO_DIR     *cod,
                         CPU_INT32U  key,
                         CPU_INT08U *buffer,
                         CPU_INT32U  len);

ParameterMeaning
codpointer to the CANopen object directory
keyobject entry key; should be generated with the macro CO_DEV()
bufferpointer to the source bytes
lenlength of source buffer

Returned Value

 = CO_ERR.NONE   Successful operation

!= CO_ERR.NONE  An error is detected (see section "Error Identification")

Example

The following example writes the value to the hypothetical application specific object entry "[1234:56]" within the object directory of the CANopen node AppNode.


    CPU_INT16S  err;
    CPU_INT08U  buffer[10] = { 'a','b','c','d','e','f','g','h','i', 0 };
    :
    err = CODirWrBuffer (&(AppNode.Dir), CO_DEV(0x1234, 0x56), buffer, 10);
    if (err != CO_ERR_NONE) {
        /* object [1234:56] is missing or error during writing */
    }
    :