Skip to content

Commit

Permalink
Add missing macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
msuevern committed Nov 17, 2023
1 parent 14ba419 commit 8e7c0a4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ls-bus-guide/headers/fmi3LsBusUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,30 @@ typedef struct
} \
while (0)

/**
* \brief Checks whether the buffer variable is empty.
*
* \param[in] BufferInfo Pointer to variable of type \ref fmi3LsBusUtilBufferInfo.
*/
#define FMI3_LS_BUS_BUFFER_IS_EMPTY(BufferInfo) \
((BufferInfo)->writePos == (BufferInfo)->start ? fmi3True : fmi3False)

/**
* \brief Returns the start address of the buffer variable.
*
* \param[in] BufferInfo Pointer to variable of type \ref fmi3LsBusUtilBufferInfo.
*/
#define FMI3_LS_BUS_BUFFER_START(BufferInfo) \
((BufferInfo)->start)

/**
* \brief Returns the actual length of the buffer variable beginning from the start address.
*
* \param[in] BufferInfo Pointer to variable of type \ref fmi3LsBusUtilBufferInfo.
*/
#define FMI3_LS_BUS_BUFFER_LENGTH(BufferInfo) \
((BufferInfo)->writePos - (BufferInfo)->start)

/**
* \brief Writes data to a buffer variable. Existing data will be overwritten.
*
Expand Down

0 comments on commit 8e7c0a4

Please sign in to comment.