Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing macros. #91

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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