summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChristian Pointner <equinox@mur.at>2012-06-13 22:52:24 +0000
committerChristian Pointner <equinox@mur.at>2012-06-13 22:52:24 +0000
commitc0894504ebce3becfa74c480e09b16c8e8aa4fb5 (patch)
tree72c0db49a1bee782c4d082d279f8a21b5171a478 /tools
parentbetter but not there yet.. (diff)
cleanup
git-svn-id: https://svn.spreadspace.org/mur.sat@528 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'tools')
-rw-r--r--tools/idm-ringbuffer/ringbuffer.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/tools/idm-ringbuffer/ringbuffer.c b/tools/idm-ringbuffer/ringbuffer.c
index 5fd65b4..2910d6c 100644
--- a/tools/idm-ringbuffer/ringbuffer.c
+++ b/tools/idm-ringbuffer/ringbuffer.c
@@ -58,7 +58,8 @@ BOOL underrun = TRUE;
BOOL currentByteLoaded = FALSE;
char spiData = 0;
-void incrementWriteIdx() {
+void incrementWriteIdx()
+{
if (!overrun) {
writePtr++;
writePtr = writePtr > bufferEnd ? bufferStart : writePtr;
@@ -69,7 +70,8 @@ void incrementWriteIdx() {
}
}
-void incrementReadIdx() {
+void incrementReadIdx()
+{
if(!underrun) {
readPtr++;
readPtr = readPtr > bufferEnd ? bufferStart : readPtr;
@@ -80,20 +82,21 @@ void incrementReadIdx() {
}
}
-void beginRead() {
- if (!underrun) {
- spiData = *readPtr;
- printf("SPI out: %02x\n", (int)spiData);
- }
+void beginRead()
+{
+ spiData = underrun ? 0 : *readPtr;
+ printf("SPI Buf: %02x\n", (int)spiData);
currentByteLoaded = TRUE;
}
-void endRead() {
+void endRead()
+{
currentByteLoaded = FALSE;
incrementReadIdx();
}
-void storeSample() {
+void storeSample()
+{
static char value = 0;
if (!overrun) {
*writePtr = ++value;
@@ -101,7 +104,8 @@ void storeSample() {
}
}
-void triggerByteTransferred() {
+void triggerByteTransferred()
+{
if (spiData == 0) {
endRead();
beginRead();