diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e660fd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +bin/ diff --git a/CircularBuffer/.clang-format b/CircularBuffer/.clang-format deleted file mode 100644 index e4537cc..0000000 --- a/CircularBuffer/.clang-format +++ /dev/null @@ -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 -... - diff --git a/CircularBuffer/.vscode/launch.json b/CircularBuffer/.vscode/launch.json deleted file mode 100644 index 9e41c87..0000000 --- a/CircularBuffer/.vscode/launch.json +++ /dev/null @@ -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" - } - ] -} \ No newline at end of file diff --git a/CircularBuffer/CB-README.md b/CircularBuffer/CB-README.md deleted file mode 100644 index e69de29..0000000 diff --git a/CircularBuffer/bin/PCircularBuffer.o b/CircularBuffer/bin/PCircularBuffer.o deleted file mode 100644 index 0bba0a5..0000000 Binary files a/CircularBuffer/bin/PCircularBuffer.o and /dev/null differ diff --git a/CircularBuffer/bin/test.o b/CircularBuffer/bin/test.o deleted file mode 100644 index 0c5dec4..0000000 Binary files a/CircularBuffer/bin/test.o and /dev/null differ diff --git a/CircularBuffer/bin/tester.exe b/CircularBuffer/bin/tester.exe deleted file mode 100644 index 24bb072..0000000 Binary files a/CircularBuffer/bin/tester.exe and /dev/null differ diff --git a/CircularBuffer/examples/simple_circular_buffer_example.c b/CircularBuffer/examples/simple_circular_buffer_example.c deleted file mode 100644 index a3a04a7..0000000 --- a/CircularBuffer/examples/simple_circular_buffer_example.c +++ /dev/null @@ -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 -int main() -{ - - return 0; -} \ No newline at end of file diff --git a/CircularBuffer/test/test.c b/CircularBuffer/test/test.c deleted file mode 100644 index d1cd3b9..0000000 --- a/CircularBuffer/test/test.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -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; -} \ No newline at end of file diff --git a/Queue/build/Makefile b/Queue/build/Makefile deleted file mode 100644 index 8c95b83..0000000 --- a/Queue/build/Makefile +++ /dev/null @@ -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) diff --git a/Queue/inc/p_queue.h b/Queue/inc/p_queue.h deleted file mode 100644 index 10eb031..0000000 --- a/Queue/inc/p_queue.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __P_QUEUE_H__ -#define __P_QUEUE_H__ - -#include - -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 diff --git a/Queue/src/p_queue.c b/Queue/src/p_queue.c deleted file mode 100644 index ecf299a..0000000 --- a/Queue/src/p_queue.c +++ /dev/null @@ -1 +0,0 @@ -#include "p_queue.h" diff --git a/bin/p_cbuffer_example b/bin/p_cbuffer_example deleted file mode 100644 index cb6fcaa..0000000 Binary files a/bin/p_cbuffer_example and /dev/null differ diff --git a/bin/p_queue_example b/bin/p_queue_example deleted file mode 100644 index aaffed6..0000000 Binary files a/bin/p_queue_example and /dev/null differ diff --git a/old_cbuffer_Makefile b/old_cbuffer_Makefile deleted file mode 100644 index 26a4af0..0000000 --- a/old_cbuffer_Makefile +++ /dev/null @@ -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) - - -