Data collection core that utilises the nine ring buffer. Intended as the base of other data collection projects

Revision:
3:ba7863bdf478
Parent:
2:8587554a1f52
--- a/nine_ring/nine_ring.cpp	Sat Jul 11 17:32:02 2015 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-#include "mbed.h"
-#include "nine_ring.h"
-/*
-J.J.Trinder, based on original code for midi projects 199X
-updateded sometime to the MBED
-
-Yeh its atad klunky, it works and is useful to explain things to people...
-*/
-#define _PC
-NRing::NRing()
-{
-   ring_init();
-}
-
-
-
-/*======================================================================*/
-/* implementation of Ringbuffer                     */
-/*======================================================================*/
-void NRing::ring_init(void)
-{
-    inIndex = 0;
-    inCount = 0;
-}
-
-/*======================================================================*/
-/* RingWriteToBuffer                     */
-/*======================================================================*/
-//add critical section ie disable interrupts while fiddling with buffers
-int NRing::RingWriteToBuffer(long n)
-{
-   // printf("WriteInBuffer%d",inCount);
-__disable_irq();    // Disable Interrupts
- 
-// do something that can't be interrupted
-   opBuffer[inIndex] = n;
-    inCount++;
-    inIndex++;
-    if (inIndex >= buff_size)
-        inIndex = 0;
-   
- 
-__enable_irq();     // Enable Interrupts 
-  //printf("ZWriteInBuffer%d\n",inCount);       
-    return 0;
-}
-
-
-//todo fix this as we dont want to do this
-/*======================================================================*/
-/* return current count of stuff in buffer           */
-/*======================================================================*/
-int NRing::ring_count()
-{
-   // printf("InCount %d",inCount);
-    return (inCount);
-}
-
-
-//todo fix this as we dont want to do this
-/*======================================================================*/
-/* Output whats remaining....            */
-/*======================================================================*/
-long NRing::get_next()
-{
-   
-    long toSend;
-#ifdef _PC
-    printf("\nCall in %x out %x count %x",inIndex,outIndex, inCount);
-#endif
-    if (inCount == 0)
-        return -1;     /* nowt to send */
-    __disable_irq();    // Disable Interrupts    
-    toSend = opBuffer[outIndex];
-
-#ifdef _PC
-    printf(" <%i> ",toSend);
-#endif
- 
-    inCount--;
-    outIndex++;
-    if (outIndex >=buff_size)
-        outIndex = 0;
-    __enable_irq();     // Enable Interrupts       
-    return toSend;
-}
-