Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mtsas mtsas thermostat_fan_demo--fan mtsas ... more
NOTE: MTS-Utils has moved to GitHub. This version will not be updated. For updates, go to the GitHub version.
Diff: MTSCircularBuffer.cpp
- Revision:
- 13:4709c2dfcd11
- Parent:
- 6:fca9bc67b15f
--- a/MTSCircularBuffer.cpp Mon Mar 23 16:37:56 2015 -0500
+++ b/MTSCircularBuffer.cpp Mon Jun 08 15:30:12 2015 -0500
@@ -20,8 +20,10 @@
if (readIndex == bufferSize) {
readIndex = 0;
}
+ __disable_irq();
data[i++] = buffer[readIndex++];
bytes--;
+ __enable_irq();
checkThreshold();
}
return i;
@@ -35,8 +37,10 @@
if (readIndex == bufferSize) {
readIndex = 0;
}
+ __disable_irq();
data = buffer[readIndex++];
bytes--;
+ __enable_irq();
checkThreshold();
return 1;
}
@@ -48,8 +52,10 @@
if(writeIndex == bufferSize) {
writeIndex = 0;
}
+ __disable_irq();
buffer[writeIndex++] = data[i++];
bytes++;
+ __enable_irq();
checkThreshold();
}
return i;
@@ -63,8 +69,10 @@
if(writeIndex == bufferSize) {
writeIndex = 0;
}
+ __disable_irq();
buffer[writeIndex++] = data;
bytes++;
+ __enable_irq();
checkThreshold();
return 1;
}