From b67f9f366902ae62d55195f4a4be88d209fb64fe Mon Sep 17 00:00:00 2001
From: Dean Camera <dean@fourwalledcubicle.com>
Date: Sun, 12 Dec 2010 16:39:46 +0000
Subject: [PATCH] Added new RingBuffer_Peek() function to the lightweight ring
 buffer headers.

---
 LUFA/ManPages/ChangeLog.txt                     |  1 +
 LUFA/ManPages/FutureChanges.txt                 |  1 +
 Projects/Benito/Lib/LightweightRingBuff.h       | 11 +++++++++++
 Projects/USBtoSerial/Lib/LightweightRingBuff.h  | 11 +++++++++++
 Projects/XPLAINBridge/Lib/LightweightRingBuff.h | 11 +++++++++++
 5 files changed, 35 insertions(+)

diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt
index d213b1b3a..bb2757fda 100644
--- a/LUFA/ManPages/ChangeLog.txt
+++ b/LUFA/ManPages/ChangeLog.txt
@@ -13,6 +13,7 @@
   *  - Library Applications:
   *   - Added new incomplete MIDIToneGenerator project
   *   - Added ability to write protect Mass Storage disk write operations from the host OS
+  *   - Added new RingBuffer_Peek() function to the lightweight ring buffer headers
   *
   *  <b>Changed:</b>
   *  - Core:
diff --git a/LUFA/ManPages/FutureChanges.txt b/LUFA/ManPages/FutureChanges.txt
index aee1f1799..7ae15aa0b 100644
--- a/LUFA/ManPages/FutureChanges.txt
+++ b/LUFA/ManPages/FutureChanges.txt
@@ -34,6 +34,7 @@
   *      -# Finish StandaloneProgrammer project
   *      -# Arduino Uno compatible USB-MIDI, USB-HID
   *      -# Make Webserver project work in RNDIS device mode
+  *      -# Make rescue clock always active on U4, U6 and U7 targets in AVRISP-MKII Clone project
   *  - Ports
   *      -# AVR32 UC3B series microcontrollers
   *      -# Atmel ARM7 series microcontrollers
diff --git a/Projects/Benito/Lib/LightweightRingBuff.h b/Projects/Benito/Lib/LightweightRingBuff.h
index 56da8398f..cddf97f6a 100644
--- a/Projects/Benito/Lib/LightweightRingBuff.h
+++ b/Projects/Benito/Lib/LightweightRingBuff.h
@@ -196,5 +196,16 @@
 			return Data;
 		}
 
+		/** Returns the next element stored in the ring buffer, without removing it.
+		 *
+		 *  \param[in,out] Buffer  Pointer to a ring buffer structure to retrieve from
+		 *
+		 *  \return Next data element stored in the buffer
+		 */
+		static inline RingBuff_Data_t RingBuffer_Peek(RingBuff_t* const Buffer)
+		{
+			return *Buffer->Out;
+		}
+
 #endif
 
diff --git a/Projects/USBtoSerial/Lib/LightweightRingBuff.h b/Projects/USBtoSerial/Lib/LightweightRingBuff.h
index 56da8398f..cddf97f6a 100644
--- a/Projects/USBtoSerial/Lib/LightweightRingBuff.h
+++ b/Projects/USBtoSerial/Lib/LightweightRingBuff.h
@@ -196,5 +196,16 @@
 			return Data;
 		}
 
+		/** Returns the next element stored in the ring buffer, without removing it.
+		 *
+		 *  \param[in,out] Buffer  Pointer to a ring buffer structure to retrieve from
+		 *
+		 *  \return Next data element stored in the buffer
+		 */
+		static inline RingBuff_Data_t RingBuffer_Peek(RingBuff_t* const Buffer)
+		{
+			return *Buffer->Out;
+		}
+
 #endif
 
diff --git a/Projects/XPLAINBridge/Lib/LightweightRingBuff.h b/Projects/XPLAINBridge/Lib/LightweightRingBuff.h
index 0205fe467..b19291caf 100644
--- a/Projects/XPLAINBridge/Lib/LightweightRingBuff.h
+++ b/Projects/XPLAINBridge/Lib/LightweightRingBuff.h
@@ -196,5 +196,16 @@
 			return Data;
 		}
 
+		/** Returns the next element stored in the ring buffer, without removing it.
+		 *
+		 *  \param[in,out] Buffer  Pointer to a ring buffer structure to retrieve from
+		 *
+		 *  \return Next data element stored in the buffer
+		 */
+		static inline RingBuff_Data_t RingBuffer_Peek(RingBuff_t* const Buffer)
+		{
+			return *Buffer->Out;
+		}
+
 #endif
 
-- 
GitLab