- /** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed\r
- * by entering an atomic lock on the buffer while the IN and OUT locations are fetched, so that\r
- * the buffer cannot be modified while the computation takes place. This value should be cached\r
- * when reading out the contents of the buffer, so that as small a time as possible is spent\r
- * in an atomic lock.\r
+ /** Retrieves the free space in a particular buffer. This value is computed by entering an atomic lock\r
+ * on the buffer, so that the buffer cannot be modified while the computation takes place.\r
+ *\r
+ * \note The value returned by this function is guaranteed to only be the maximum number of bytes\r
+ * free in the given buffer; this value may change as other threads write new data, thus\r
+ * the returned number should be used only to determine how many successive writes may safely\r
+ * be performed on the buffer when there is a single writer thread.\r
+ *\r
+ * \param[in] Buffer Pointer to a ring buffer structure whose free count is to be computed.\r
+ *\r
+ * \return Number of free bytes in the buffer.\r
+ */\r
+ static inline uint16_t RingBuffer_GetFreeCount(RingBuffer_t* const Buffer)\r
+ {\r
+ return (Buffer->Size - RingBuffer_GetCount(Buffer));\r
+ }\r
+\r
+ /** Retrieves the current number of bytes stored in a particular buffer. This value is computed\r
+ * by entering an atomic lock on the buffer, so that the buffer cannot be modified while the\r
+ * computation takes place. This value should be cached when reading out the contents of the buffer,\r
+ * so that as small a time as possible is spent in an atomic lock.\r