[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:
Bertrand Songis
2016-03-18 21:49:06 +01:00
parent e810367284
commit 5cb6884ab3
20 changed files with 492 additions and 252 deletions
+11 -6
View File
@@ -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()) {};
}