CAN DragonEmSA
functionCAN Traffic

EmSACAN_GetTxQueueDepth

Prototype

emsacan_result_t EmSACAN_GetTxQueueDepth(
    emsacan_handle_t Handle,
    uint8_t ChannelNumber,
    uint32_t *pDepth );

Description

Returns the number of CAN frames currently queued in the hardware TX ring buffer for a port.

Parameters

ParameterDirectionTypeDescription
Handleinemsacan_handle_tSession handle from EmSACAN_Connect.
ChannelNumberinuint8_tZero-based port index (0 … NumberofChannels−1).
pDepthoutuint32_tReceives the depth (number of queued frames).

Example

uint32_t depth = 0;
if (EmSACAN_GetTxQueueDepth(handle, 0, &depth) == EMSACAN_OK)
{
    if (depth > 100)
        { /* slow down transmission */ }
}

See also