[Horus / Taranis] S.PORT telemetry now uses the DMA. I think the buffer could be reduced, 512bytes seems really big
This commit is contained in:
+11
-6
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -36,7 +36,8 @@ class Fifo
|
||||
widx = ridx = 0;
|
||||
}
|
||||
|
||||
void push(T element) {
|
||||
void push(T element)
|
||||
{
|
||||
uint32_t next = (widx+1) & (N-1);
|
||||
if (next != ridx) {
|
||||
fifo[widx] = element;
|
||||
@@ -44,7 +45,8 @@ class Fifo
|
||||
}
|
||||
}
|
||||
|
||||
bool pop(T & element) {
|
||||
bool pop(T & element)
|
||||
{
|
||||
if (isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -55,16 +57,19 @@ class Fifo
|
||||
}
|
||||
}
|
||||
|
||||
bool isEmpty() {
|
||||
bool isEmpty()
|
||||
{
|
||||
return (ridx == widx);
|
||||
}
|
||||
|
||||
bool isFull() {
|
||||
bool isFull()
|
||||
{
|
||||
uint32_t next = (widx+1) & (N-1);
|
||||
return (next == ridx);
|
||||
}
|
||||
|
||||
void flush() {
|
||||
void flush()
|
||||
{
|
||||
while (!isEmpty()) {};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user