cleaning up repo
parent
e4bc7f9946
commit
9804c4b906
@ -0,0 +1 @@
|
|||||||
|
bin/
|
@ -1,178 +0,0 @@
|
|||||||
---
|
|
||||||
Language: Cpp
|
|
||||||
# BasedOnStyle: Microsoft
|
|
||||||
AccessModifierOffset: -2
|
|
||||||
AlignAfterOpenBracket: Align
|
|
||||||
AlignArrayOfStructures: None
|
|
||||||
AlignConsecutiveMacros: None
|
|
||||||
AlignConsecutiveAssignments: None
|
|
||||||
AlignConsecutiveBitFields: None
|
|
||||||
AlignConsecutiveDeclarations: None
|
|
||||||
AlignEscapedNewlines: Right
|
|
||||||
AlignOperands: Align
|
|
||||||
AlignTrailingComments: true
|
|
||||||
AllowAllArgumentsOnNextLine: true
|
|
||||||
AllowAllConstructorInitializersOnNextLine: true
|
|
||||||
AllowAllParametersOfDeclarationOnNextLine: true
|
|
||||||
AllowShortEnumsOnASingleLine: false
|
|
||||||
AllowShortBlocksOnASingleLine: Never
|
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
|
||||||
AllowShortFunctionsOnASingleLine: None
|
|
||||||
AllowShortLambdasOnASingleLine: All
|
|
||||||
AllowShortIfStatementsOnASingleLine: Never
|
|
||||||
AllowShortLoopsOnASingleLine: false
|
|
||||||
AlwaysBreakAfterDefinitionReturnType: None
|
|
||||||
AlwaysBreakAfterReturnType: None
|
|
||||||
AlwaysBreakBeforeMultilineStrings: false
|
|
||||||
AlwaysBreakTemplateDeclarations: MultiLine
|
|
||||||
AttributeMacros:
|
|
||||||
- __capability
|
|
||||||
BinPackArguments: true
|
|
||||||
BinPackParameters: true
|
|
||||||
BraceWrapping:
|
|
||||||
AfterCaseLabel: false
|
|
||||||
AfterClass: true
|
|
||||||
AfterControlStatement: Always
|
|
||||||
AfterEnum: true
|
|
||||||
AfterFunction: true
|
|
||||||
AfterNamespace: true
|
|
||||||
AfterObjCDeclaration: true
|
|
||||||
AfterStruct: true
|
|
||||||
AfterUnion: false
|
|
||||||
AfterExternBlock: true
|
|
||||||
BeforeCatch: true
|
|
||||||
BeforeElse: true
|
|
||||||
BeforeLambdaBody: false
|
|
||||||
BeforeWhile: false
|
|
||||||
IndentBraces: false
|
|
||||||
SplitEmptyFunction: true
|
|
||||||
SplitEmptyRecord: true
|
|
||||||
SplitEmptyNamespace: true
|
|
||||||
BreakBeforeBinaryOperators: None
|
|
||||||
BreakBeforeConceptDeclarations: true
|
|
||||||
BreakBeforeBraces: Custom
|
|
||||||
BreakBeforeInheritanceComma: false
|
|
||||||
BreakInheritanceList: BeforeColon
|
|
||||||
BreakBeforeTernaryOperators: true
|
|
||||||
BreakConstructorInitializersBeforeComma: false
|
|
||||||
BreakConstructorInitializers: BeforeColon
|
|
||||||
BreakAfterJavaFieldAnnotations: false
|
|
||||||
BreakStringLiterals: true
|
|
||||||
ColumnLimit: 120
|
|
||||||
CommentPragmas: '^ IWYU pragma:'
|
|
||||||
CompactNamespaces: false
|
|
||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: false
|
|
||||||
ConstructorInitializerIndentWidth: 4
|
|
||||||
ContinuationIndentWidth: 4
|
|
||||||
Cpp11BracedListStyle: true
|
|
||||||
DeriveLineEnding: true
|
|
||||||
DerivePointerAlignment: false
|
|
||||||
DisableFormat: false
|
|
||||||
EmptyLineAfterAccessModifier: Never
|
|
||||||
EmptyLineBeforeAccessModifier: LogicalBlock
|
|
||||||
ExperimentalAutoDetectBinPacking: false
|
|
||||||
FixNamespaceComments: true
|
|
||||||
ForEachMacros:
|
|
||||||
- foreach
|
|
||||||
- Q_FOREACH
|
|
||||||
- BOOST_FOREACH
|
|
||||||
IfMacros:
|
|
||||||
- KJ_IF_MAYBE
|
|
||||||
IncludeBlocks: Preserve
|
|
||||||
IncludeCategories:
|
|
||||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
|
||||||
Priority: 2
|
|
||||||
SortPriority: 0
|
|
||||||
CaseSensitive: false
|
|
||||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
|
||||||
Priority: 3
|
|
||||||
SortPriority: 0
|
|
||||||
CaseSensitive: false
|
|
||||||
- Regex: '.*'
|
|
||||||
Priority: 1
|
|
||||||
SortPriority: 0
|
|
||||||
CaseSensitive: false
|
|
||||||
IncludeIsMainRegex: '(Test)?$'
|
|
||||||
IncludeIsMainSourceRegex: ''
|
|
||||||
IndentAccessModifiers: false
|
|
||||||
IndentCaseLabels: false
|
|
||||||
IndentCaseBlocks: false
|
|
||||||
IndentGotoLabels: true
|
|
||||||
IndentPPDirectives: None
|
|
||||||
IndentExternBlock: AfterExternBlock
|
|
||||||
IndentRequires: false
|
|
||||||
IndentWidth: 4
|
|
||||||
IndentWrappedFunctionNames: false
|
|
||||||
InsertTrailingCommas: None
|
|
||||||
JavaScriptQuotes: Leave
|
|
||||||
JavaScriptWrapImports: true
|
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
|
||||||
LambdaBodyIndentation: Signature
|
|
||||||
MacroBlockBegin: ''
|
|
||||||
MacroBlockEnd: ''
|
|
||||||
MaxEmptyLinesToKeep: 1
|
|
||||||
NamespaceIndentation: None
|
|
||||||
ObjCBinPackProtocolList: Auto
|
|
||||||
ObjCBlockIndentWidth: 2
|
|
||||||
ObjCBreakBeforeNestedBlockParam: true
|
|
||||||
ObjCSpaceAfterProperty: false
|
|
||||||
ObjCSpaceBeforeProtocolList: true
|
|
||||||
PenaltyBreakAssignment: 2
|
|
||||||
PenaltyBreakBeforeFirstCallParameter: 19
|
|
||||||
PenaltyBreakComment: 300
|
|
||||||
PenaltyBreakFirstLessLess: 120
|
|
||||||
PenaltyBreakString: 1000
|
|
||||||
PenaltyBreakTemplateDeclaration: 10
|
|
||||||
PenaltyExcessCharacter: 1000000
|
|
||||||
PenaltyReturnTypeOnItsOwnLine: 1000
|
|
||||||
PenaltyIndentedWhitespace: 0
|
|
||||||
PointerAlignment: Right
|
|
||||||
PPIndentWidth: -1
|
|
||||||
ReferenceAlignment: Pointer
|
|
||||||
ReflowComments: true
|
|
||||||
ShortNamespaceLines: 1
|
|
||||||
SortIncludes: CaseSensitive
|
|
||||||
SortJavaStaticImport: Before
|
|
||||||
SortUsingDeclarations: true
|
|
||||||
SpaceAfterCStyleCast: false
|
|
||||||
SpaceAfterLogicalNot: false
|
|
||||||
SpaceAfterTemplateKeyword: true
|
|
||||||
SpaceBeforeAssignmentOperators: true
|
|
||||||
SpaceBeforeCaseColon: false
|
|
||||||
SpaceBeforeCpp11BracedList: false
|
|
||||||
SpaceBeforeCtorInitializerColon: true
|
|
||||||
SpaceBeforeInheritanceColon: true
|
|
||||||
SpaceBeforeParens: ControlStatements
|
|
||||||
SpaceAroundPointerQualifiers: Default
|
|
||||||
SpaceBeforeRangeBasedForLoopColon: true
|
|
||||||
SpaceInEmptyBlock: false
|
|
||||||
SpaceInEmptyParentheses: false
|
|
||||||
SpacesBeforeTrailingComments: 1
|
|
||||||
SpacesInAngles: Never
|
|
||||||
SpacesInConditionalStatement: false
|
|
||||||
SpacesInContainerLiterals: true
|
|
||||||
SpacesInCStyleCastParentheses: false
|
|
||||||
SpacesInLineCommentPrefix:
|
|
||||||
Minimum: 1
|
|
||||||
Maximum: -1
|
|
||||||
SpacesInParentheses: false
|
|
||||||
SpacesInSquareBrackets: false
|
|
||||||
SpaceBeforeSquareBrackets: false
|
|
||||||
BitFieldColonSpacing: Both
|
|
||||||
Standard: Latest
|
|
||||||
StatementAttributeLikeMacros:
|
|
||||||
- Q_EMIT
|
|
||||||
StatementMacros:
|
|
||||||
- Q_UNUSED
|
|
||||||
- QT_REQUIRE_VERSION
|
|
||||||
TabWidth: 4
|
|
||||||
UseCRLF: false
|
|
||||||
UseTab: Always
|
|
||||||
WhitespaceSensitiveMacros:
|
|
||||||
- STRINGIZE
|
|
||||||
- PP_STRINGIZE
|
|
||||||
- BOOST_PP_STRINGIZE
|
|
||||||
- NS_SWIFT_NAME
|
|
||||||
- CF_SWIFT_NAME
|
|
||||||
...
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
// Use IntelliSense to learn about possible attributes.
|
|
||||||
// Hover to view descriptions of existing attributes.
|
|
||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "gcc.exe build and debug active file",
|
|
||||||
"type": "cppdbg",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "${fileDirname}\\${fileBasenameNoExtension}.exe",
|
|
||||||
"args": [],
|
|
||||||
"stopAtEntry": false,
|
|
||||||
"cwd": "${workspaceFolder}",
|
|
||||||
"environment": [],
|
|
||||||
"externalConsole": false,
|
|
||||||
"MIMode": "gdb",
|
|
||||||
"miDebuggerPath": "C:\\msys64\\mingw64\\bin\\gdb.exe",
|
|
||||||
"setupCommands": [
|
|
||||||
{
|
|
||||||
"description": "Enable pretty-printing for gdb",
|
|
||||||
"text": "-enable-pretty-printing",
|
|
||||||
"ignoreFailures": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"preLaunchTask": "gcc.exe build active file"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
(WORK IN PROGRESS)
|
|
||||||
Penguin's Circular Buffer Example -- Turning a noisy bell curve into a less noisy bell curve
|
|
||||||
|
|
||||||
Here's an example of using the circular buffer library for sensor data:
|
|
||||||
|
|
||||||
Let's say I have a sensor that gives me temperature at 1khz (using ideals so it is exactly 1khz)
|
|
||||||
If this sensor was only giving me raw analog data, I might want to do some processing on these values
|
|
||||||
so that I can make sure the values are as clean as possible. The more samples we have, the closer we are to the actual value.
|
|
||||||
The faster we gather samples, the closer we get to representing our data in realtime.
|
|
||||||
|
|
||||||
Using the sample rate, I can decide on a sampling window (in seconds) and an OSR (Oversampling Rate). The larger the buffer size, the more memory I need, so
|
|
||||||
it is useful to find a happy medium between a large buffer and clean values.
|
|
||||||
|
|
||||||
A sampling window is the window of time in which we can accept values for an average value. Depending on your application,
|
|
||||||
a sampling window may need to be extremely small or maybe not so small. A rocket going extremely fast using
|
|
||||||
some sensor for real time controls will want an extremely small sampling window as well as a lot of measurements for
|
|
||||||
both clean, near noiseless data and as close to realtime data as possible.
|
|
||||||
|
|
||||||
The sampling windows is usually an engineering requirement given that can match the sampling rate of the sensor with the following:
|
|
||||||
sampling window (in seconds) = 1 / frequency
|
|
||||||
Here, the OSR is simply 1.
|
|
||||||
|
|
||||||
So at 1khz sample rate, let's say I decide I only need a 0.125 second sample window and I want to clean up some noisy data.
|
|
||||||
We can now use this equation:
|
|
||||||
OSR = frequency * sample window (in seconds)
|
|
||||||
|
|
||||||
All of these have ignored real world slowdowns like the time it takes to do math on lower end hardware, interrupts slightly delaying the math, etc
|
|
||||||
Without wanting to do some hard analysis on whatever hardware we're using, I usually take my frequency and half it to ensure timing requirements are met, like so:
|
|
||||||
|
|
||||||
OSR = frequency / 2 * sample window
|
|
||||||
|
|
||||||
Please note: In applications that require real real-time data, this is not a good way of doing things.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <PCircularBuffer.h>
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
const uint16_t maxlength = 16;
|
|
||||||
double my_buffer[maxlength];
|
|
||||||
p_cb_double data;
|
|
||||||
p_cb_double_init(&data, my_buffer, 16);
|
|
||||||
|
|
||||||
for(int x = 0; x < 32; x++)
|
|
||||||
{
|
|
||||||
if( x < 16)
|
|
||||||
{
|
|
||||||
printf("[%02d] Before: %02lf\t", x, data.buffer[x]);
|
|
||||||
data.push(&data, (double)x);
|
|
||||||
printf("[%02d] After: %02lf\r\n", x, data.buffer[x]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf("[%02d] Before: %02lf\t", x - 16, data.buffer[x - 16]);
|
|
||||||
data.push(&data, (double)x);
|
|
||||||
printf("[%02d] After: %02lf\r\n", x - 16, data.buffer[x - 16]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
PRJNAME=pqueue
|
|
||||||
PRJOUT=lib$(PRJNAME).a
|
|
||||||
|
|
||||||
TESTSOUT=$(PRJNAME)_tests
|
|
||||||
EXAMPLESOUT=$(PRJNAME)_example
|
|
||||||
CC=gcc
|
|
||||||
SIZE=size
|
|
||||||
MK_DIR=mkdir -p
|
|
||||||
|
|
||||||
CFLAGS=\
|
|
||||||
-Wall \
|
|
||||||
-DDEBUG \
|
|
||||||
-std=gnu11 \
|
|
||||||
-ffunctions-sections \
|
|
||||||
-O3 \
|
|
||||||
-g3
|
|
||||||
|
|
||||||
|
|
||||||
ARFLAGS=\
|
|
||||||
|
|
||||||
# Core Stuff
|
|
||||||
CORE_SUB_DIRS=src
|
|
||||||
CORE_INC_DIRS=\
|
|
||||||
-I../cfg \
|
|
||||||
-I../inc
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
TESTS_SUB_DIRS=\
|
|
||||||
test/src
|
|
||||||
|
|
||||||
TESTS_INC_DIRS=\
|
|
||||||
-I../tests/inc \
|
|
||||||
-I../test/cfg
|
|
||||||
|
|
||||||
# Examples
|
|
||||||
EXAMPLES_SUB_DIRS=\
|
|
||||||
EXAMPLES_INC_DIRS=\
|
|
||||||
|
|
||||||
.PHONY: all tests examples clean
|
|
||||||
|
|
||||||
all: $(CORE_SUB_DIRS) $(PRJOUT)
|
|
||||||
tests: all $(TESTS_SUB_DIRS) $(TESTSOUT)
|
|
||||||
examples: all $(EXAMPLES_SUB_DIRS) $(EXAMPLESOUT)
|
|
||||||
|
|
||||||
$(PRJOUT): $(CORE_OBJS)
|
|
||||||
$(AR) $(CORE_INC_DIRS) $(CFLAGS) $(ARFLAGS) $@ $<
|
|
||||||
|
|
||||||
$(TESTSOUT): $(TEST_OBJS)
|
|
||||||
$(CC) $(CFLAGS) -o $< $(TEST_OBJS)
|
|
||||||
|
|
||||||
$(EXAMPLESOUT)
|
|
@ -1,20 +0,0 @@
|
|||||||
#ifndef __P_QUEUE_H__
|
|
||||||
#define __P_QUEUE_H__
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
typedef enum PB_Q_STATUS {
|
|
||||||
PB_Q_GOOD = 0,
|
|
||||||
PB_Q_BAD = 1, // generic bad
|
|
||||||
PB_Q_BAD_LENGTH = 2,
|
|
||||||
PB_Q_NULL_BUFFER = 3,
|
|
||||||
PB_Q_NULL_QUEUE = 4
|
|
||||||
} PB_Q_STATUS;
|
|
||||||
|
|
||||||
typedef struct p_queue {
|
|
||||||
uint8_t *elements;
|
|
||||||
ssize_t len;
|
|
||||||
|
|
||||||
} p_queue;
|
|
||||||
|
|
||||||
#endif
|
|
@ -1 +0,0 @@
|
|||||||
#include "p_queue.h"
|
|
Binary file not shown.
Binary file not shown.
@ -1,54 +0,0 @@
|
|||||||
PRJNAME=pcbuffer
|
|
||||||
PRJOUT=lib$(PRJNAME).a
|
|
||||||
|
|
||||||
TESTSOUT=$(PRJNAME)_tests
|
|
||||||
EXAMPLESOUT=$(PRJNAME)_example
|
|
||||||
CC=gcc
|
|
||||||
SIZE=size
|
|
||||||
MK_DIR=mkdir -p
|
|
||||||
|
|
||||||
CFLAGS=\
|
|
||||||
-Wall \
|
|
||||||
-DDEBUG \
|
|
||||||
-std=gnu11 \
|
|
||||||
-ffunctions-sections \
|
|
||||||
-O3 \
|
|
||||||
-g3
|
|
||||||
|
|
||||||
|
|
||||||
ARFLAGS=\
|
|
||||||
|
|
||||||
# Core Stuff
|
|
||||||
CORE_SUB_DIRS=src
|
|
||||||
CORE_INC_DIRS=\
|
|
||||||
-I../cfg \
|
|
||||||
-I../inc
|
|
||||||
|
|
||||||
# Tests
|
|
||||||
TESTS_SUB_DIRS=\
|
|
||||||
test/src
|
|
||||||
|
|
||||||
TESTS_INC_DIRS=\
|
|
||||||
-I../tests/inc \
|
|
||||||
-I../test/cfg
|
|
||||||
|
|
||||||
# Examples
|
|
||||||
EXAMPLES_SUB_DIRS=\
|
|
||||||
EXAMPLES_INC_DIRS=\
|
|
||||||
|
|
||||||
.PHONY: all tests examples clean
|
|
||||||
|
|
||||||
all: $(CORE_SUB_DIRS) $(PRJOUT)
|
|
||||||
tests: all $(TESTS_SUB_DIRS) $(TESTSOUT)
|
|
||||||
examples: all $(EXAMPLES_SUB_DIRS) $(EXAMPLESOUT)
|
|
||||||
|
|
||||||
$(PRJOUT): $(CORE_OBJS)
|
|
||||||
$(AR) $(CORE_INC_DIRS) $(CFLAGS) $(ARFLAGS) $@ $<
|
|
||||||
|
|
||||||
$(TESTSOUT): $(TEST_OBJS)
|
|
||||||
$(CC) $(CFLAGS) -o $< $(TEST_OBJS)
|
|
||||||
|
|
||||||
$(EXAMPLESOUT)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue