diff --git a/.clang-format b/.clang-format index 5a684951..ae441d63 100644 --- a/.clang-format +++ b/.clang-format @@ -2,19 +2,22 @@ BasedOnStyle: LLVM AccessModifierOffset: -4 AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: None +AlignConsecutiveAssignments: true +AlignConsecutiveMacros: true +AlignEscapedNewlines: Left AlignOperands: DontAlign AllowAllArgumentsOnNextLine: false AllowAllConstructorInitializersOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: Always -AllowShortCaseLabelsOnASingleLine: true +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: All AllowShortIfStatementsOnASingleLine: Never AllowShortLambdasOnASingleLine: All AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None -AlwaysBreakTemplateDeclarations: MultiLine +AlwaysBreakTemplateDeclarations: Yes BreakBeforeBraces: Custom BraceWrapping: AfterCaseLabel: false @@ -29,13 +32,18 @@ BraceWrapping: IndentBraces: false SplitEmptyFunction: false SplitEmptyRecord: true +BinPackArguments: false +BinPackParameters: true BreakBeforeBinaryOperators: NonAssignment BreakBeforeTernaryOperators: false BreakConstructorInitializers: BeforeColon BreakInheritanceList: BeforeColon -ColumnLimit: 0 +ColumnLimit: 120 CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false ContinuationIndentWidth: 4 +FixNamespaceComments: true +IncludeBlocks: Preserve IndentCaseLabels: false IndentPPDirectives: BeforeHash IndentWidth: 4 @@ -45,10 +53,12 @@ NamespaceIndentation: None ObjCSpaceAfterProperty: false ObjCSpaceBeforeProtocolList: true PointerAlignment: Left -ReflowComments: false +ReflowComments: true +SortIncludes: true +SortUsingDeclarations: true SpaceAfterCStyleCast: true SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: false +SpaceAfterTemplateKeyword: true SpaceBeforeAssignmentOperators: true SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true @@ -56,12 +66,11 @@ SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 0 +SpacesBeforeTrailingComments: 1 SpacesInAngles: false -SpacesInCStyleCastParentheses: false SpacesInContainerLiterals: false +SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false TabWidth: 4 UseTab: Never -AlignEscapedNewlines: Left diff --git a/include/core/dev/BitmapFonts.hpp b/include/core/dev/BitmapFonts.hpp index 343f700a..a89ca815 100644 --- a/include/core/dev/BitmapFonts.hpp +++ b/include/core/dev/BitmapFonts.hpp @@ -4,485 +4,485 @@ #include /** -* BitMapFont is a class that holds a representation of a bitmap font. The class can hold multiple fonts, however + * BitMapFont is a class that holds a representation of a bitmap font. The class can hold multiple fonts, however * currently it is only holding a single 4x6 font. -*/ + */ class BitmapFont { public: constexpr static const uint8_t font6x13[235][14]{ - {0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0001 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0002 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0003 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0004 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0005 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0006 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0007 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0008 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0009 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+000A - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+000B - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+000C - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+000D - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+000E - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+000F - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0010 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0011 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0012 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0013 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0014 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0015 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0016 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0017 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0018 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0019 - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+001A - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+001B - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+001C - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+001D - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+001E - {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+001F - {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: space - {0x0, 0x0, 0xFC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0}, // Character: exclam - {0x0, 0x1C, 0x0, 0x1C, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: quotedbl - {0xA0, 0xF8, 0xA0, 0xF8, 0xA0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x3, 0x0}, // Character: numbersign - {0x30, 0x48, 0xFC, 0x48, 0x88, 0x0, 0x0, 0x0, 0x2, 0x2, 0x7, 0x2, 0x1}, // Character: dollar - {0x8, 0x94, 0x48, 0x30, 0xC, 0x0, 0x0, 0x0, 0x6, 0x1, 0x2, 0x5, 0x2}, // Character: percent - {0xB0, 0x48, 0xB0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x3, 0x5}, // Character: ampersand - {0x0, 0x0, 0x1C, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: quotesingle - {0x0, 0xF0, 0xC, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x6, 0x8, 0x0}, // Character: parenleft - {0x0, 0x2, 0xC, 0xF0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x6, 0x1, 0x0}, // Character: parenright - {0x28, 0x10, 0x7C, 0x10, 0x28, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: asterisk - {0x40, 0x40, 0xF0, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, // Character: plus - {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x6, 0x2, 0x0}, // Character: comma - {0x40, 0x40, 0x40, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: hyphen - {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0xE, 0x4, 0x0}, // Character: period - {0x0, 0x80, 0x40, 0x30, 0xC, 0x0, 0x0, 0x0, 0x6, 0x1, 0x0, 0x0, 0x0}, // Character: slash - {0xF0, 0x8, 0x4, 0x8, 0xF0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x4, 0x2, 0x1}, // Character: zero - {0x10, 0x8, 0xFC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x4, 0x7, 0x4, 0x4}, // Character: one - {0x18, 0x4, 0x84, 0x44, 0x38, 0x0, 0x0, 0x0, 0x6, 0x5, 0x4, 0x4, 0x4}, // Character: two - {0x4, 0x44, 0x64, 0x54, 0x8C, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x4, 0x3}, // Character: three - {0x80, 0x60, 0x10, 0xFC, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x7, 0x1}, // Character: four - {0x7C, 0x44, 0x24, 0x24, 0xC4, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x4, 0x3}, // Character: five - {0xF8, 0x44, 0x44, 0x44, 0x88, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: six - {0x4, 0x4, 0xC4, 0x34, 0xC, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0}, // Character: seven - {0xB8, 0x44, 0x44, 0x44, 0xB8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: eight - {0x38, 0x44, 0x44, 0x44, 0xF8, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x4, 0x3}, // Character: nine - {0x0, 0x20, 0x70, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0xE, 0x4, 0x0}, // Character: colon - {0x0, 0x20, 0x70, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x6, 0x2, 0x0}, // Character: semicolon - {0x40, 0xA0, 0x10, 0x8, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x4}, // Character: less - {0x20, 0x20, 0x20, 0x20, 0x20, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1}, // Character: equal - {0x4, 0x8, 0x10, 0xA0, 0x40, 0x0, 0x0, 0x0, 0x4, 0x2, 0x1, 0x0, 0x0}, // Character: greater - {0x18, 0x4, 0x84, 0x44, 0x38, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0}, // Character: question - {0xF8, 0x4, 0xC4, 0x24, 0xF8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x5, 0x5, 0x4}, // Character: at - {0xF0, 0x88, 0x84, 0x88, 0xF0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: A - {0x4, 0xFC, 0x44, 0x44, 0xB8, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x4, 0x3}, // Character: B - {0xF8, 0x4, 0x4, 0x4, 0x8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: C - {0x4, 0xFC, 0x4, 0x4, 0xF8, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x4, 0x3}, // Character: D - {0xFC, 0x44, 0x44, 0x44, 0x4, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x4}, // Character: E - {0xFC, 0x44, 0x44, 0x44, 0x4, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x0}, // Character: F - {0xF8, 0x4, 0x4, 0x84, 0x88, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: G - {0xFC, 0x40, 0x40, 0x40, 0xFC, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: H - {0x0, 0x4, 0xFC, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: I - {0x0, 0x0, 0x4, 0xFC, 0x4, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x3, 0x0}, // Character: J - {0xFC, 0x40, 0xA0, 0x10, 0xC, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x1, 0x6}, // Character: K - {0xFC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x4}, // Character: L - {0xFC, 0x10, 0x60, 0x10, 0xFC, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: M - {0xFC, 0x18, 0x60, 0x80, 0xFC, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x1, 0x7}, // Character: N - {0xF8, 0x4, 0x4, 0x4, 0xF8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: O - {0xFC, 0x44, 0x44, 0x44, 0x38, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x0}, // Character: P - {0xF8, 0x4, 0x4, 0x4, 0xF8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x6, 0x4, 0xB}, // Character: Q - {0xFC, 0x44, 0xC4, 0x44, 0x38, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x1, 0x6}, // Character: R - {0x38, 0x44, 0x44, 0x44, 0x88, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x4, 0x3}, // Character: S - {0x4, 0x4, 0xFC, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0}, // Character: T - {0xFC, 0x0, 0x0, 0x0, 0xFC, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: U - {0x3C, 0xC0, 0x0, 0xC0, 0x3C, 0x0, 0x0, 0x0, 0x0, 0x1, 0x6, 0x1, 0x0}, // Character: V - {0xFC, 0x0, 0xC0, 0x0, 0xFC, 0x0, 0x0, 0x0, 0x3, 0x4, 0x3, 0x4, 0x3}, // Character: W - {0xC, 0xB0, 0x40, 0xB0, 0xC, 0x0, 0x0, 0x0, 0x6, 0x1, 0x0, 0x1, 0x6}, // Character: X - {0xC, 0x30, 0xC0, 0x30, 0xC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0}, // Character: Y - {0x4, 0x84, 0x44, 0x34, 0xC, 0x0, 0x0, 0x0, 0x6, 0x5, 0x4, 0x4, 0x4}, // Character: Z - {0x0, 0xFE, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0x8, 0x8, 0x0}, // Character: bracketleft - {0xC, 0x30, 0x40, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x6}, // Character: backslash - {0x0, 0x2, 0x2, 0xFE, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, 0xF, 0x0}, // Character: bracketright - {0x10, 0x8, 0x4, 0x8, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: asciicircum - {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, 0x8, 0x8, 0x8}, // Character: underscore - {0x0, 0x0, 0x2, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: grave - {0x0, 0xA0, 0xA0, 0xA0, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: a - {0xFC, 0x20, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x3}, // Character: b - {0xC0, 0x20, 0x20, 0x20, 0x40, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: c - {0xC0, 0x20, 0x20, 0x20, 0xFC, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x7}, // Character: d - {0xC0, 0xA0, 0xA0, 0xA0, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: e - {0x40, 0xF8, 0x44, 0x44, 0x8, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0}, // Character: f - {0xC0, 0x20, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x9, 0x12, 0x12, 0x12, 0xF},// Character: g - {0xFC, 0x40, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: h - {0x0, 0x20, 0xE8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: i - {0x0, 0x0, 0x20, 0xE8, 0x0, 0x0, 0x0, 0x0, 0xC, 0x10, 0x10, 0xF, 0x0}, // Character: j - {0xFC, 0x80, 0x40, 0x20, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x1, 0x2, 0x4}, // Character: k - {0x0, 0x4, 0xFC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: l - {0xE0, 0x20, 0xC0, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x3, 0x0, 0x7}, // Character: m - {0xE0, 0x40, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: n - {0xC0, 0x20, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: o - {0xE0, 0x20, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x1F, 0x2, 0x2, 0x2, 0x1}, // Character: p - {0xC0, 0x20, 0x20, 0x20, 0xE0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x2, 0x2, 0x1F}, // Character: q - {0xE0, 0x40, 0x20, 0x20, 0x40, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x0}, // Character: r - {0x40, 0xA0, 0xA0, 0x20, 0x40, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x5, 0x2}, // Character: s - {0x20, 0xF8, 0x20, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2}, // Character: t - {0xE0, 0x0, 0x0, 0x0, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: u - {0xE0, 0x0, 0x0, 0x0, 0xE0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x3, 0x0}, // Character: v - {0xE0, 0x0, 0x80, 0x0, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x3, 0x4, 0x3}, // Character: w - {0x20, 0x40, 0x80, 0x40, 0x20, 0x0, 0x0, 0x0, 0x4, 0x2, 0x1, 0x2, 0x4}, // Character: x - {0xE0, 0x0, 0x0, 0x0, 0xE0, 0x0, 0x0, 0x0, 0x9, 0x12, 0x12, 0x11, 0xF}, // Character: y - {0x20, 0x20, 0xA0, 0x60, 0x20, 0x0, 0x0, 0x0, 0x6, 0x5, 0x4, 0x4, 0x4}, // Character: z - {0x40, 0x40, 0xBC, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x8, 0x8}, // Character: braceleft - {0x0, 0x0, 0xFC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0}, // Character: bar - {0x2, 0x2, 0xBC, 0x40, 0x40, 0x0, 0x0, 0x0, 0x8, 0x8, 0x7, 0x0, 0x0}, // Character: braceright - {0x18, 0x4, 0x8, 0x10, 0xC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: asciitilde - {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: space - {0x0, 0x0, 0xF4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0}, // Character: exclamdown - {0xF0, 0x8, 0xFC, 0x8, 0x90, 0x0, 0x0, 0x0, 0x0, 0x1, 0x3, 0x1, 0x0}, // Character: cent - {0x40, 0xF8, 0x44, 0x4, 0x8, 0x0, 0x0, 0x0, 0x4, 0x3, 0x4, 0x4, 0x2}, // Character: sterling - {0x10, 0xE0, 0x20, 0xE0, 0x10, 0x0, 0x0, 0x0, 0x2, 0x1, 0x1, 0x1, 0x2}, // Character: currency - {0x4C, 0x70, 0xC0, 0x70, 0x4C, 0x0, 0x0, 0x0, 0x1, 0x1, 0x7, 0x1, 0x1}, // Character: yen - {0x0, 0x0, 0xBC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0}, // Character: brokenbar - {0x0, 0x6C, 0x92, 0x92, 0x64, 0x0, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x3}, // Character: section - {0x0, 0x6, 0x0, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: dieresis - {0xFC, 0x72, 0x8A, 0x52, 0xFC, 0x0, 0x0, 0x0, 0x1, 0x2, 0x2, 0x2, 0x1}, // Character: copyright - {0x20, 0x54, 0x54, 0x54, 0x78, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1}, // Character: ordfeminine - {0xC0, 0x20, 0xD0, 0x20, 0x10, 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x1, 0x2}, // Character: guillemotleft - {0x40, 0x40, 0x40, 0x40, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1}, // Character: logicalnot - {0x0, 0x40, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: hyphen - {0xFC, 0xFA, 0x4A, 0xB2, 0xFC, 0x0, 0x0, 0x0, 0x1, 0x2, 0x2, 0x2, 0x1}, // Character: registered - {0x4, 0x4, 0x4, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: macron - {0x0, 0x18, 0x24, 0x24, 0x18, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: degree - {0x20, 0x20, 0xF8, 0x20, 0x20, 0x0, 0x0, 0x0, 0x2, 0x2, 0x2, 0x2, 0x2}, // Character: plusminus - {0x24, 0x32, 0x2C, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: twosuperior - {0x24, 0x2A, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: threesuperior - {0x0, 0x0, 0x4, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: acute - {0xE0, 0x0, 0x0, 0x0, 0xE0, 0x0, 0x0, 0x0, 0x1F, 0x4, 0x4, 0x2, 0x7}, // Character: mu - {0x78, 0xFC, 0xFC, 0x4, 0xFC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x7}, // Character: paragraph - {0x0, 0x0, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: periodcentered - {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x8, 0x0}, // Character: cedilla - {0x24, 0x3E, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: onesuperior - {0x38, 0x44, 0x44, 0x44, 0x38, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1}, // Character: ordmasculine - {0x10, 0x20, 0xD0, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x2, 0x1, 0x2, 0x1, 0x0}, // Character: guillemotright - {0x24, 0x3E, 0x20, 0x80, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x2, 0x7}, // Character: onequarter - {0x24, 0x3E, 0xA0, 0x40, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x6, 0x5}, // Character: onehalf - {0x24, 0x4A, 0x34, 0x80, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x2, 0x7}, // Character: threequarters - {0x80, 0x40, 0x34, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: questiondown - {0xC0, 0x22, 0x14, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Agrave - {0xC0, 0x20, 0x14, 0x22, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Aacute - {0xC0, 0x24, 0x12, 0x22, 0xC4, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Acircumflex - {0xC0, 0x24, 0x12, 0x24, 0xC2, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Atilde - {0xC0, 0x26, 0x10, 0x26, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Adieresis - {0xC0, 0x24, 0x1A, 0x24, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Aring - {0xF8, 0x84, 0xF8, 0x44, 0x4, 0x0, 0x0, 0x0, 0x7, 0x0, 0x7, 0x4, 0x4}, // Character: AE - {0xF8, 0x4, 0x4, 0x4, 0x8, 0x0, 0x0, 0x0, 0x3, 0x14, 0xC, 0x4, 0x2}, // Character: Ccedilla - {0xF0, 0x92, 0x94, 0x90, 0x10, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x4}, // Character: Egrave - {0xF0, 0x90, 0x94, 0x92, 0x10, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x4}, // Character: Eacute - {0xF0, 0x94, 0x92, 0x92, 0x14, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x4}, // Character: Ecircumflex - {0xF0, 0x96, 0x90, 0x96, 0x10, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x4}, // Character: Edieresis - {0x0, 0x12, 0xF4, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: Igrave - {0x0, 0x10, 0xF4, 0x12, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: Iacute - {0x0, 0x14, 0xF2, 0x12, 0x4, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: Icircumflex - {0x0, 0x16, 0xF0, 0x16, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: Idieresis - {0x44, 0xFC, 0x44, 0x4, 0xF8, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x4, 0x3}, // Character: Eth - {0xF0, 0x44, 0x82, 0x4, 0xF2, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x1, 0x7}, // Character: Ntilde - {0xE0, 0x12, 0x14, 0x10, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Ograve - {0xE0, 0x10, 0x14, 0x12, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Oacute - {0xE0, 0x14, 0x12, 0x12, 0xE4, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Ocircumflex - {0xE0, 0x14, 0x12, 0x14, 0xE2, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Otilde - {0xE0, 0x16, 0x10, 0x16, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Odieresis - {0x20, 0x40, 0x80, 0x40, 0x20, 0x0, 0x0, 0x0, 0x2, 0x1, 0x0, 0x1, 0x2}, // Character: multiply - {0xF8, 0x4, 0xE4, 0x1C, 0xFA, 0x0, 0x0, 0x0, 0xB, 0x7, 0x4, 0x4, 0x3}, // Character: Oslash - {0xF0, 0x2, 0x4, 0x0, 0xF0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Ugrave - {0xF0, 0x0, 0x4, 0x2, 0xF0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Uacute - {0xF0, 0x4, 0x2, 0x2, 0xF4, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Ucircumflex - {0xF0, 0x6, 0x0, 0x6, 0xF0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Udieresis - {0x30, 0x40, 0x84, 0x42, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0}, // Character: Yacute - {0xFC, 0x88, 0x88, 0x88, 0x70, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x0}, // Character: Thorn - {0xF8, 0x4, 0x64, 0x98, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x4, 0x4, 0x3}, // Character: germandbls - {0x0, 0xA4, 0xA8, 0xA0, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: agrave - {0x0, 0xA0, 0xA8, 0xA4, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: aacute - {0x0, 0xA8, 0xA4, 0xA4, 0xC8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: acircumflex - {0x0, 0xA8, 0xA4, 0xA8, 0xC4, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: atilde - {0x0, 0xAC, 0xA0, 0xAC, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: adieresis - {0x0, 0xA4, 0xAA, 0xAA, 0xC4, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: aring - {0x0, 0xA0, 0xE0, 0xA0, 0x40, 0x0, 0x0, 0x0, 0x3, 0x4, 0x3, 0x4, 0x2}, // Character: ae - {0xC0, 0x20, 0x20, 0x20, 0x40, 0x0, 0x0, 0x0, 0x3, 0x14, 0xC, 0x4, 0x2}, // Character: ccedilla - {0xC0, 0xA4, 0xA8, 0xA0, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: egrave - {0xC0, 0xA0, 0xA8, 0xA4, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: eacute - {0xC0, 0xA8, 0xA4, 0xA4, 0xC8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: ecircumflex - {0xC0, 0xAC, 0xA0, 0xAC, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: edieresis - {0x0, 0x24, 0xE8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: igrave - {0x0, 0x20, 0xE8, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: iacute - {0x0, 0x28, 0xE4, 0x4, 0x8, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: icircumflex - {0x0, 0x2C, 0xE0, 0xC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: idieresis - {0xC0, 0x2A, 0x2C, 0x32, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: eth - {0xE0, 0x48, 0x24, 0x28, 0xC4, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: ntilde - {0xC0, 0x24, 0x28, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: ograve - {0xC0, 0x20, 0x28, 0x24, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: oacute - {0xC0, 0x28, 0x24, 0x24, 0xC8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: ocircumflex - {0xC0, 0x28, 0x24, 0x28, 0xC4, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: otilde - {0xC0, 0x2C, 0x20, 0x2C, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: odieresis - {0x40, 0x40, 0x58, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0}, // Character: divide - {0xC0, 0x20, 0xA0, 0x60, 0xD0, 0x0, 0x0, 0x0, 0xB, 0x6, 0x5, 0x4, 0x3}, // Character: oslash - {0xE0, 0x4, 0x8, 0x0, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: ugrave - {0xE0, 0x0, 0x8, 0x4, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: uacute - {0xE0, 0x8, 0x4, 0x4, 0xE8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: ucircumflex - {0xE0, 0xC, 0x0, 0xC, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: udieresis - {0xE0, 0x0, 0x8, 0x4, 0xE0, 0x0, 0x0, 0x0, 0x9, 0x12, 0x12, 0x11, 0xF}, // Character: yacute - {0xF8, 0x40, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x1F, 0x2, 0x4, 0x4, 0x3}, // Character: thorn - {0xE0, 0xC, 0x0, 0xC, 0xE0, 0x0, 0x0, 0x0, 0x9, 0x12, 0x12, 0x11, 0xF}, // Character: ydieresis - {0xE2, 0x92, 0x8A, 0x92, 0xE2, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: Amacron - {0x8, 0xA8, 0xA8, 0xA8, 0xC8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: amacron - {0xC2, 0x24, 0x14, 0x24, 0xC2, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Abreve - {0x4, 0xA8, 0xA8, 0xA8, 0xC4, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: abreve - {0xF0, 0x88, 0x84, 0x88, 0xF0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0xF}, // Character: Aogonek - {0x0, 0xA0, 0xA0, 0xA0, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0xF}, // Character: aogonek - {0xE0, 0x10, 0x14, 0x12, 0x20, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: Cacute - {0xC0, 0x20, 0x28, 0x24, 0x40, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: cacute - {0xE0, 0x14, 0x12, 0x12, 0x24, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: Ccircumflex - {0xC0, 0x28, 0x24, 0x24, 0x48, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: ccircumflex - {0xE0, 0x10, 0x16, 0x10, 0x20, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: Cdotaccent + {0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0001 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0002 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0003 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0004 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0005 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0006 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0007 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0008 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0009 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+000A + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+000B + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+000C + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+000D + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+000E + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+000F + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0010 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0011 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0012 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0013 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0014 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0015 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0016 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0017 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0018 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+0019 + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+001A + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+001B + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+001C + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+001D + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+001E + {0x00, 0x00, 0x00, 0x00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // U+001F + {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: space + {0x0, 0x0, 0xFC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0}, // Character: exclam + {0x0, 0x1C, 0x0, 0x1C, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: quotedbl + {0xA0, 0xF8, 0xA0, 0xF8, 0xA0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x3, 0x0}, // Character: numbersign + {0x30, 0x48, 0xFC, 0x48, 0x88, 0x0, 0x0, 0x0, 0x2, 0x2, 0x7, 0x2, 0x1}, // Character: dollar + {0x8, 0x94, 0x48, 0x30, 0xC, 0x0, 0x0, 0x0, 0x6, 0x1, 0x2, 0x5, 0x2}, // Character: percent + {0xB0, 0x48, 0xB0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x3, 0x5}, // Character: ampersand + {0x0, 0x0, 0x1C, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: quotesingle + {0x0, 0xF0, 0xC, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x6, 0x8, 0x0}, // Character: parenleft + {0x0, 0x2, 0xC, 0xF0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x6, 0x1, 0x0}, // Character: parenright + {0x28, 0x10, 0x7C, 0x10, 0x28, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: asterisk + {0x40, 0x40, 0xF0, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0}, // Character: plus + {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x6, 0x2, 0x0}, // Character: comma + {0x40, 0x40, 0x40, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: hyphen + {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0xE, 0x4, 0x0}, // Character: period + {0x0, 0x80, 0x40, 0x30, 0xC, 0x0, 0x0, 0x0, 0x6, 0x1, 0x0, 0x0, 0x0}, // Character: slash + {0xF0, 0x8, 0x4, 0x8, 0xF0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x4, 0x2, 0x1}, // Character: zero + {0x10, 0x8, 0xFC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x4, 0x7, 0x4, 0x4}, // Character: one + {0x18, 0x4, 0x84, 0x44, 0x38, 0x0, 0x0, 0x0, 0x6, 0x5, 0x4, 0x4, 0x4}, // Character: two + {0x4, 0x44, 0x64, 0x54, 0x8C, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x4, 0x3}, // Character: three + {0x80, 0x60, 0x10, 0xFC, 0x0, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x7, 0x1}, // Character: four + {0x7C, 0x44, 0x24, 0x24, 0xC4, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x4, 0x3}, // Character: five + {0xF8, 0x44, 0x44, 0x44, 0x88, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: six + {0x4, 0x4, 0xC4, 0x34, 0xC, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0}, // Character: seven + {0xB8, 0x44, 0x44, 0x44, 0xB8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: eight + {0x38, 0x44, 0x44, 0x44, 0xF8, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x4, 0x3}, // Character: nine + {0x0, 0x20, 0x70, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0xE, 0x4, 0x0}, // Character: colon + {0x0, 0x20, 0x70, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x6, 0x2, 0x0}, // Character: semicolon + {0x40, 0xA0, 0x10, 0x8, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x4}, // Character: less + {0x20, 0x20, 0x20, 0x20, 0x20, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1}, // Character: equal + {0x4, 0x8, 0x10, 0xA0, 0x40, 0x0, 0x0, 0x0, 0x4, 0x2, 0x1, 0x0, 0x0}, // Character: greater + {0x18, 0x4, 0x84, 0x44, 0x38, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5, 0x0, 0x0}, // Character: question + {0xF8, 0x4, 0xC4, 0x24, 0xF8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x5, 0x5, 0x4}, // Character: at + {0xF0, 0x88, 0x84, 0x88, 0xF0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: A + {0x4, 0xFC, 0x44, 0x44, 0xB8, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x4, 0x3}, // Character: B + {0xF8, 0x4, 0x4, 0x4, 0x8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: C + {0x4, 0xFC, 0x4, 0x4, 0xF8, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x4, 0x3}, // Character: D + {0xFC, 0x44, 0x44, 0x44, 0x4, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x4}, // Character: E + {0xFC, 0x44, 0x44, 0x44, 0x4, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x0}, // Character: F + {0xF8, 0x4, 0x4, 0x84, 0x88, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: G + {0xFC, 0x40, 0x40, 0x40, 0xFC, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: H + {0x0, 0x4, 0xFC, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: I + {0x0, 0x0, 0x4, 0xFC, 0x4, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x3, 0x0}, // Character: J + {0xFC, 0x40, 0xA0, 0x10, 0xC, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x1, 0x6}, // Character: K + {0xFC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x4}, // Character: L + {0xFC, 0x10, 0x60, 0x10, 0xFC, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: M + {0xFC, 0x18, 0x60, 0x80, 0xFC, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x1, 0x7}, // Character: N + {0xF8, 0x4, 0x4, 0x4, 0xF8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: O + {0xFC, 0x44, 0x44, 0x44, 0x38, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x0}, // Character: P + {0xF8, 0x4, 0x4, 0x4, 0xF8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x6, 0x4, 0xB}, // Character: Q + {0xFC, 0x44, 0xC4, 0x44, 0x38, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x1, 0x6}, // Character: R + {0x38, 0x44, 0x44, 0x44, 0x88, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x4, 0x3}, // Character: S + {0x4, 0x4, 0xFC, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0}, // Character: T + {0xFC, 0x0, 0x0, 0x0, 0xFC, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: U + {0x3C, 0xC0, 0x0, 0xC0, 0x3C, 0x0, 0x0, 0x0, 0x0, 0x1, 0x6, 0x1, 0x0}, // Character: V + {0xFC, 0x0, 0xC0, 0x0, 0xFC, 0x0, 0x0, 0x0, 0x3, 0x4, 0x3, 0x4, 0x3}, // Character: W + {0xC, 0xB0, 0x40, 0xB0, 0xC, 0x0, 0x0, 0x0, 0x6, 0x1, 0x0, 0x1, 0x6}, // Character: X + {0xC, 0x30, 0xC0, 0x30, 0xC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0}, // Character: Y + {0x4, 0x84, 0x44, 0x34, 0xC, 0x0, 0x0, 0x0, 0x6, 0x5, 0x4, 0x4, 0x4}, // Character: Z + {0x0, 0xFE, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0xF, 0x8, 0x8, 0x0}, // Character: bracketleft + {0xC, 0x30, 0x40, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x6}, // Character: backslash + {0x0, 0x2, 0x2, 0xFE, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, 0xF, 0x0}, // Character: bracketright + {0x10, 0x8, 0x4, 0x8, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: asciicircum + {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x8, 0x8, 0x8, 0x8, 0x8}, // Character: underscore + {0x0, 0x0, 0x2, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: grave + {0x0, 0xA0, 0xA0, 0xA0, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: a + {0xFC, 0x20, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x3}, // Character: b + {0xC0, 0x20, 0x20, 0x20, 0x40, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: c + {0xC0, 0x20, 0x20, 0x20, 0xFC, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x7}, // Character: d + {0xC0, 0xA0, 0xA0, 0xA0, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: e + {0x40, 0xF8, 0x44, 0x44, 0x8, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0}, // Character: f + {0xC0, 0x20, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x9, 0x12, 0x12, 0x12, 0xF}, // Character: g + {0xFC, 0x40, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: h + {0x0, 0x20, 0xE8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: i + {0x0, 0x0, 0x20, 0xE8, 0x0, 0x0, 0x0, 0x0, 0xC, 0x10, 0x10, 0xF, 0x0}, // Character: j + {0xFC, 0x80, 0x40, 0x20, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x1, 0x2, 0x4}, // Character: k + {0x0, 0x4, 0xFC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: l + {0xE0, 0x20, 0xC0, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x3, 0x0, 0x7}, // Character: m + {0xE0, 0x40, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: n + {0xC0, 0x20, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: o + {0xE0, 0x20, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x1F, 0x2, 0x2, 0x2, 0x1}, // Character: p + {0xC0, 0x20, 0x20, 0x20, 0xE0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x2, 0x2, 0x1F}, // Character: q + {0xE0, 0x40, 0x20, 0x20, 0x40, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x0}, // Character: r + {0x40, 0xA0, 0xA0, 0x20, 0x40, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x5, 0x2}, // Character: s + {0x20, 0xF8, 0x20, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2}, // Character: t + {0xE0, 0x0, 0x0, 0x0, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: u + {0xE0, 0x0, 0x0, 0x0, 0xE0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x3, 0x0}, // Character: v + {0xE0, 0x0, 0x80, 0x0, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x3, 0x4, 0x3}, // Character: w + {0x20, 0x40, 0x80, 0x40, 0x20, 0x0, 0x0, 0x0, 0x4, 0x2, 0x1, 0x2, 0x4}, // Character: x + {0xE0, 0x0, 0x0, 0x0, 0xE0, 0x0, 0x0, 0x0, 0x9, 0x12, 0x12, 0x11, 0xF}, // Character: y + {0x20, 0x20, 0xA0, 0x60, 0x20, 0x0, 0x0, 0x0, 0x6, 0x5, 0x4, 0x4, 0x4}, // Character: z + {0x40, 0x40, 0xBC, 0x2, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x8, 0x8}, // Character: braceleft + {0x0, 0x0, 0xFC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0}, // Character: bar + {0x2, 0x2, 0xBC, 0x40, 0x40, 0x0, 0x0, 0x0, 0x8, 0x8, 0x7, 0x0, 0x0}, // Character: braceright + {0x18, 0x4, 0x8, 0x10, 0xC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: asciitilde + {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: space + {0x0, 0x0, 0xF4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0}, // Character: exclamdown + {0xF0, 0x8, 0xFC, 0x8, 0x90, 0x0, 0x0, 0x0, 0x0, 0x1, 0x3, 0x1, 0x0}, // Character: cent + {0x40, 0xF8, 0x44, 0x4, 0x8, 0x0, 0x0, 0x0, 0x4, 0x3, 0x4, 0x4, 0x2}, // Character: sterling + {0x10, 0xE0, 0x20, 0xE0, 0x10, 0x0, 0x0, 0x0, 0x2, 0x1, 0x1, 0x1, 0x2}, // Character: currency + {0x4C, 0x70, 0xC0, 0x70, 0x4C, 0x0, 0x0, 0x0, 0x1, 0x1, 0x7, 0x1, 0x1}, // Character: yen + {0x0, 0x0, 0xBC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0}, // Character: brokenbar + {0x0, 0x6C, 0x92, 0x92, 0x64, 0x0, 0x0, 0x0, 0x0, 0x2, 0x4, 0x4, 0x3}, // Character: section + {0x0, 0x6, 0x0, 0x6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: dieresis + {0xFC, 0x72, 0x8A, 0x52, 0xFC, 0x0, 0x0, 0x0, 0x1, 0x2, 0x2, 0x2, 0x1}, // Character: copyright + {0x20, 0x54, 0x54, 0x54, 0x78, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1}, // Character: ordfeminine + {0xC0, 0x20, 0xD0, 0x20, 0x10, 0x0, 0x0, 0x0, 0x0, 0x1, 0x2, 0x1, 0x2}, // Character: guillemotleft + {0x40, 0x40, 0x40, 0x40, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1}, // Character: logicalnot + {0x0, 0x40, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: hyphen + {0xFC, 0xFA, 0x4A, 0xB2, 0xFC, 0x0, 0x0, 0x0, 0x1, 0x2, 0x2, 0x2, 0x1}, // Character: registered + {0x4, 0x4, 0x4, 0x4, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: macron + {0x0, 0x18, 0x24, 0x24, 0x18, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: degree + {0x20, 0x20, 0xF8, 0x20, 0x20, 0x0, 0x0, 0x0, 0x2, 0x2, 0x2, 0x2, 0x2}, // Character: plusminus + {0x24, 0x32, 0x2C, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: twosuperior + {0x24, 0x2A, 0x14, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: threesuperior + {0x0, 0x0, 0x4, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: acute + {0xE0, 0x0, 0x0, 0x0, 0xE0, 0x0, 0x0, 0x0, 0x1F, 0x4, 0x4, 0x2, 0x7}, // Character: mu + {0x78, 0xFC, 0xFC, 0x4, 0xFC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x7}, // Character: paragraph + {0x0, 0x0, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: periodcentered + {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, 0x8, 0x0}, // Character: cedilla + {0x24, 0x3E, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, // Character: onesuperior + {0x38, 0x44, 0x44, 0x44, 0x38, 0x0, 0x0, 0x0, 0x1, 0x1, 0x1, 0x1, 0x1}, // Character: ordmasculine + {0x10, 0x20, 0xD0, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x2, 0x1, 0x2, 0x1, 0x0}, // Character: guillemotright + {0x24, 0x3E, 0x20, 0x80, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x2, 0x7}, // Character: onequarter + {0x24, 0x3E, 0xA0, 0x40, 0x80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x6, 0x5}, // Character: onehalf + {0x24, 0x4A, 0x34, 0x80, 0xC0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x2, 0x7}, // Character: threequarters + {0x80, 0x40, 0x34, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: questiondown + {0xC0, 0x22, 0x14, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Agrave + {0xC0, 0x20, 0x14, 0x22, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Aacute + {0xC0, 0x24, 0x12, 0x22, 0xC4, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Acircumflex + {0xC0, 0x24, 0x12, 0x24, 0xC2, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Atilde + {0xC0, 0x26, 0x10, 0x26, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Adieresis + {0xC0, 0x24, 0x1A, 0x24, 0xC0, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Aring + {0xF8, 0x84, 0xF8, 0x44, 0x4, 0x0, 0x0, 0x0, 0x7, 0x0, 0x7, 0x4, 0x4}, // Character: AE + {0xF8, 0x4, 0x4, 0x4, 0x8, 0x0, 0x0, 0x0, 0x3, 0x14, 0xC, 0x4, 0x2}, // Character: Ccedilla + {0xF0, 0x92, 0x94, 0x90, 0x10, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x4}, // Character: Egrave + {0xF0, 0x90, 0x94, 0x92, 0x10, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x4}, // Character: Eacute + {0xF0, 0x94, 0x92, 0x92, 0x14, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x4}, // Character: Ecircumflex + {0xF0, 0x96, 0x90, 0x96, 0x10, 0x0, 0x0, 0x0, 0x7, 0x4, 0x4, 0x4, 0x4}, // Character: Edieresis + {0x0, 0x12, 0xF4, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: Igrave + {0x0, 0x10, 0xF4, 0x12, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: Iacute + {0x0, 0x14, 0xF2, 0x12, 0x4, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: Icircumflex + {0x0, 0x16, 0xF0, 0x16, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: Idieresis + {0x44, 0xFC, 0x44, 0x4, 0xF8, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x4, 0x3}, // Character: Eth + {0xF0, 0x44, 0x82, 0x4, 0xF2, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x1, 0x7}, // Character: Ntilde + {0xE0, 0x12, 0x14, 0x10, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Ograve + {0xE0, 0x10, 0x14, 0x12, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Oacute + {0xE0, 0x14, 0x12, 0x12, 0xE4, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Ocircumflex + {0xE0, 0x14, 0x12, 0x14, 0xE2, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Otilde + {0xE0, 0x16, 0x10, 0x16, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Odieresis + {0x20, 0x40, 0x80, 0x40, 0x20, 0x0, 0x0, 0x0, 0x2, 0x1, 0x0, 0x1, 0x2}, // Character: multiply + {0xF8, 0x4, 0xE4, 0x1C, 0xFA, 0x0, 0x0, 0x0, 0xB, 0x7, 0x4, 0x4, 0x3}, // Character: Oslash + {0xF0, 0x2, 0x4, 0x0, 0xF0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Ugrave + {0xF0, 0x0, 0x4, 0x2, 0xF0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Uacute + {0xF0, 0x4, 0x2, 0x2, 0xF4, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Ucircumflex + {0xF0, 0x6, 0x0, 0x6, 0xF0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: Udieresis + {0x30, 0x40, 0x84, 0x42, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0}, // Character: Yacute + {0xFC, 0x88, 0x88, 0x88, 0x70, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x0}, // Character: Thorn + {0xF8, 0x4, 0x64, 0x98, 0x0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x4, 0x4, 0x3}, // Character: germandbls + {0x0, 0xA4, 0xA8, 0xA0, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: agrave + {0x0, 0xA0, 0xA8, 0xA4, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: aacute + {0x0, 0xA8, 0xA4, 0xA4, 0xC8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: acircumflex + {0x0, 0xA8, 0xA4, 0xA8, 0xC4, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: atilde + {0x0, 0xAC, 0xA0, 0xAC, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: adieresis + {0x0, 0xA4, 0xAA, 0xAA, 0xC4, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: aring + {0x0, 0xA0, 0xE0, 0xA0, 0x40, 0x0, 0x0, 0x0, 0x3, 0x4, 0x3, 0x4, 0x2}, // Character: ae + {0xC0, 0x20, 0x20, 0x20, 0x40, 0x0, 0x0, 0x0, 0x3, 0x14, 0xC, 0x4, 0x2}, // Character: ccedilla + {0xC0, 0xA4, 0xA8, 0xA0, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: egrave + {0xC0, 0xA0, 0xA8, 0xA4, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: eacute + {0xC0, 0xA8, 0xA4, 0xA4, 0xC8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: ecircumflex + {0xC0, 0xAC, 0xA0, 0xAC, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: edieresis + {0x0, 0x24, 0xE8, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: igrave + {0x0, 0x20, 0xE8, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: iacute + {0x0, 0x28, 0xE4, 0x4, 0x8, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: icircumflex + {0x0, 0x2C, 0xE0, 0xC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4, 0x7, 0x4, 0x0}, // Character: idieresis + {0xC0, 0x2A, 0x2C, 0x32, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: eth + {0xE0, 0x48, 0x24, 0x28, 0xC4, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: ntilde + {0xC0, 0x24, 0x28, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: ograve + {0xC0, 0x20, 0x28, 0x24, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: oacute + {0xC0, 0x28, 0x24, 0x24, 0xC8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: ocircumflex + {0xC0, 0x28, 0x24, 0x28, 0xC4, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: otilde + {0xC0, 0x2C, 0x20, 0x2C, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x3}, // Character: odieresis + {0x40, 0x40, 0x58, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0}, // Character: divide + {0xC0, 0x20, 0xA0, 0x60, 0xD0, 0x0, 0x0, 0x0, 0xB, 0x6, 0x5, 0x4, 0x3}, // Character: oslash + {0xE0, 0x4, 0x8, 0x0, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: ugrave + {0xE0, 0x0, 0x8, 0x4, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: uacute + {0xE0, 0x8, 0x4, 0x4, 0xE8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: ucircumflex + {0xE0, 0xC, 0x0, 0xC, 0xE0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: udieresis + {0xE0, 0x0, 0x8, 0x4, 0xE0, 0x0, 0x0, 0x0, 0x9, 0x12, 0x12, 0x11, 0xF}, // Character: yacute + {0xF8, 0x40, 0x20, 0x20, 0xC0, 0x0, 0x0, 0x0, 0x1F, 0x2, 0x4, 0x4, 0x3}, // Character: thorn + {0xE0, 0xC, 0x0, 0xC, 0xE0, 0x0, 0x0, 0x0, 0x9, 0x12, 0x12, 0x11, 0xF}, // Character: ydieresis + {0xE2, 0x92, 0x8A, 0x92, 0xE2, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0x7}, // Character: Amacron + {0x8, 0xA8, 0xA8, 0xA8, 0xC8, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: amacron + {0xC2, 0x24, 0x14, 0x24, 0xC2, 0x0, 0x0, 0x0, 0x7, 0x1, 0x1, 0x1, 0x7}, // Character: Abreve + {0x4, 0xA8, 0xA8, 0xA8, 0xC4, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0x7}, // Character: abreve + {0xF0, 0x88, 0x84, 0x88, 0xF0, 0x0, 0x0, 0x0, 0x7, 0x0, 0x0, 0x0, 0xF}, // Character: Aogonek + {0x0, 0xA0, 0xA0, 0xA0, 0xC0, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x2, 0xF}, // Character: aogonek + {0xE0, 0x10, 0x14, 0x12, 0x20, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: Cacute + {0xC0, 0x20, 0x28, 0x24, 0x40, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: cacute + {0xE0, 0x14, 0x12, 0x12, 0x24, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: Ccircumflex + {0xC0, 0x28, 0x24, 0x24, 0x48, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: ccircumflex + {0xE0, 0x10, 0x16, 0x10, 0x20, 0x0, 0x0, 0x0, 0x3, 0x4, 0x4, 0x4, 0x2}, // Character: Cdotaccent }; constexpr static const uint8_t font4x6[235][8]{ - {0x00, 0x00, 0x00, 0x00},// U+0000 (nul) - {0x00, 0x00, 0x00, 0x00},// U+0001 - {0x00, 0x00, 0x00, 0x00},// U+0002 - {0x00, 0x00, 0x00, 0x00},// U+0003 - {0x00, 0x00, 0x00, 0x00},// U+0004 - {0x00, 0x00, 0x00, 0x00},// U+0005 - {0x00, 0x00, 0x00, 0x00},// U+0006 - {0x00, 0x00, 0x00, 0x00},// U+0007 - {0x00, 0x00, 0x00, 0x00},// U+0008 - {0x00, 0x00, 0x00, 0x00},// U+0009 - {0x00, 0x00, 0x00, 0x00},// U+000A - {0x00, 0x00, 0x00, 0x00},// U+000B - {0x00, 0x00, 0x00, 0x00},// U+000C - {0x00, 0x00, 0x00, 0x00},// U+000D - {0x00, 0x00, 0x00, 0x00},// U+000E - {0x00, 0x00, 0x00, 0x00},// U+000F - {0x00, 0x00, 0x00, 0x00},// U+0010 - {0x00, 0x00, 0x00, 0x00},// U+0011 - {0x00, 0x00, 0x00, 0x00},// U+0012 - {0x00, 0x00, 0x00, 0x00},// U+0013 - {0x00, 0x00, 0x00, 0x00},// U+0014 - {0x00, 0x00, 0x00, 0x00},// U+0015 - {0x00, 0x00, 0x00, 0x00},// U+0016 - {0x00, 0x00, 0x00, 0x00},// U+0017 - {0x00, 0x00, 0x00, 0x00},// U+0018 - {0x00, 0x00, 0x00, 0x00},// U+0019 - {0x00, 0x00, 0x00, 0x00},// U+001A - {0x00, 0x00, 0x00, 0x00},// U+001B - {0x00, 0x00, 0x00, 0x00},// U+001C - {0x00, 0x00, 0x00, 0x00},// U+001D - {0x00, 0x00, 0x00, 0x00},// U+001E - {0x00, 0x00, 0x00, 0x00},// U+001F - {0x0, 0x0, 0x0, 0x0}, // Character: space - {0x17, 0x0, 0x0, 0x0}, // Character: exclam - {0xC, 0x0, 0xC, 0x0}, // Character: quotedbl - {0x1F, 0xA, 0x1F, 0x0}, // Character: numbersign - {0xA, 0x1F, 0x5, 0x0}, // Character: dollar - {0x9, 0x4, 0x12, 0x0}, // Character: percent - {0xF, 0x17, 0x1C, 0x0}, // Character: ampersand - {0xC, 0x0, 0x0, 0x0}, // Character: quotesingle - {0xE, 0x11, 0x0, 0x0}, // Character: parenleft - {0x11, 0xE, 0x0, 0x0}, // Character: parenright - {0xA, 0x4, 0xA, 0x0}, // Character: asterisk - {0x4, 0xE, 0x4, 0x0}, // Character: plus - {0x8, 0x4, 0x0, 0x0}, // Character: comma - {0x4, 0x4, 0x4, 0x0}, // Character: hyphen - {0x4, 0x0, 0x0, 0x0}, // Character: period - {0x18, 0x4, 0x3, 0x0}, // Character: slash - {0x1E, 0x11, 0xF, 0x0}, // Character: zero - {0x2, 0x1F, 0x0, 0x0}, // Character: one - {0x19, 0x15, 0x12, 0x0}, // Character: two - {0x11, 0x15, 0xA, 0x0}, // Character: three - {0x7, 0x4, 0x1F, 0x0}, // Character: four - {0x17, 0x15, 0x9, 0x0}, // Character: five - {0x1E, 0x15, 0x1D, 0x0}, // Character: six - {0x19, 0x5, 0x3, 0x0}, // Character: seven - {0x1F, 0x15, 0x1F, 0x0}, // Character: eight - {0x17, 0x15, 0xF, 0x0}, // Character: nine - {0xA, 0x0, 0x0, 0x0}, // Character: colon - {0x10, 0xA, 0x0, 0x0}, // Character: semicolon - {0x4, 0xA, 0x11, 0x0}, // Character: less - {0xA, 0xA, 0xA, 0x0}, // Character: equal - {0x11, 0xA, 0x4, 0x0}, // Character: greater - {0x1, 0x15, 0x3, 0x0}, // Character: question - {0xE, 0x15, 0x16, 0x0}, // Character: at - {0x1E, 0x5, 0x1E, 0x0}, // Character: A - {0x1F, 0x15, 0xA, 0x0}, // Character: B - {0xE, 0x11, 0x11, 0x0}, // Character: C - {0x1F, 0x11, 0xE, 0x0}, // Character: D - {0x1F, 0x15, 0x15, 0x0}, // Character: E - {0x1F, 0x5, 0x5, 0x0}, // Character: F - {0xE, 0x15, 0x1D, 0x0}, // Character: G - {0x1F, 0x4, 0x1F, 0x0}, // Character: H - {0x11, 0x1F, 0x11, 0x0}, // Character: I - {0x8, 0x10, 0xF, 0x0}, // Character: J - {0x1F, 0x4, 0x1B, 0x0}, // Character: K - {0x1F, 0x10, 0x10, 0x0}, // Character: L - {0x1F, 0x6, 0x1F, 0x0}, // Character: M - {0x1F, 0xE, 0x1F, 0x0}, // Character: N - {0xE, 0x11, 0xE, 0x0}, // Character: O - {0x1F, 0x5, 0x2, 0x0}, // Character: P - {0xE, 0x19, 0x1E, 0x0}, // Character: Q - {0x1F, 0xD, 0x16, 0x0}, // Character: R - {0x12, 0x15, 0x9, 0x0}, // Character: S - {0x1, 0x1F, 0x1, 0x0}, // Character: T - {0xF, 0x10, 0x1F, 0x0}, // Character: U - {0x7, 0x18, 0x7, 0x0}, // Character: V - {0x1F, 0xC, 0x1F, 0x0}, // Character: W - {0x1B, 0x4, 0x1B, 0x0}, // Character: X - {0x3, 0x1C, 0x3, 0x0}, // Character: Y - {0x19, 0x15, 0x13, 0x0}, // Character: Z - {0x1F, 0x11, 0x11, 0x0}, // Character: bracketleft - {0x2, 0x4, 0x8, 0x0}, // Character: backslash - {0x11, 0x11, 0x1F, 0x0}, // Character: bracketright - {0x8, 0x4, 0x8, 0x0}, // Character: asciicircum - {0x4, 0x4, 0x4, 0x0}, // Character: underscore - {0x4, 0x8, 0x0, 0x0}, // Character: grave - {0x1A, 0x16, 0x1C, 0x0}, // Character: a - {0x1F, 0x12, 0xC, 0x0}, // Character: b - {0xC, 0x12, 0x12, 0x0}, // Character: c - {0xC, 0x12, 0x1F, 0x0}, // Character: d - {0xC, 0x1A, 0x16, 0x0}, // Character: e - {0x4, 0x1E, 0x5, 0x0}, // Character: f - {0x6, 0x15, 0xF, 0x0}, // Character: g - {0x1F, 0x2, 0x1C, 0x0}, // Character: h - {0x1D, 0x0, 0x0, 0x0}, // Character: i - {0x10, 0x20, 0x1D, 0x0}, // Character: j - {0x1F, 0xC, 0x12, 0x0}, // Character: k - {0x11, 0x1F, 0x10, 0x0}, // Character: l - {0x1E, 0xE, 0x1E, 0x0}, // Character: m - {0x1E, 0x2, 0x1C, 0x0}, // Character: n - {0xC, 0x12, 0xC, 0x0}, // Character: o - {0x1F, 0x9, 0x6, 0x0}, // Character: p - {0x6, 0x9, 0x1F, 0x0}, // Character: q - {0x1C, 0x2, 0x2, 0x0}, // Character: r - {0x14, 0x1E, 0xA, 0x0}, // Character: s - {0x2, 0x1F, 0x12, 0x0}, // Character: t - {0xE, 0x10, 0x1E, 0x0}, // Character: u - {0xE, 0x18, 0xE, 0x0}, // Character: v - {0x1E, 0x1C, 0x1E, 0x0}, // Character: w - {0x12, 0xC, 0x12, 0x0}, // Character: x - {0x3, 0x14, 0xF, 0x0}, // Character: y - {0x1A, 0x1E, 0x16, 0x0}, // Character: z - {0x4, 0x1B, 0x11, 0x0}, // Character: braceleft - {0x1B, 0x0, 0x0, 0x0}, // Character: bar - {0x11, 0x1B, 0x4, 0x0}, // Character: braceright - {0x8, 0xC, 0x4, 0x0}, // Character: asciitilde - {0x1D, 0x0, 0x0, 0x0}, // Character: exclamdown - {0xE, 0x1B, 0xA, 0x0}, // Character: cent - {0x14, 0x1F, 0x15, 0x0}, // Character: sterling - {0x15, 0xE, 0x15, 0x0}, // Character: currency - {0xB, 0x1C, 0xB, 0x0}, // Character: yen - {0x1B, 0x0, 0x0, 0x0}, // Character: brokenbar - {0x14, 0x1B, 0x5, 0x0}, // Character: section - {0x4, 0x0, 0x4, 0x0}, // Character: dieresis - {0x4, 0xA, 0xA, 0x0}, // Character: copyright - {0x16, 0x15, 0x17, 0x0}, // Character: ordfeminine - {0x4, 0xA, 0x0, 0x0}, // Character: guillemotleft - {0x4, 0x4, 0xC, 0x0}, // Character: logicalnot - {0x4, 0x4, 0x0, 0x0}, // Character: softhyphen - {0xE, 0x6, 0x8, 0x0}, // Character: registered - {0x4, 0x4, 0x4, 0x0}, // Character: macron - {0x4, 0xA, 0x4, 0x0}, // Character: degree - {0x12, 0x17, 0x12, 0x0}, // Character: plusminus - {0x2, 0xE, 0x8, 0x0}, // Character: twosuperior - {0xA, 0xE, 0xE, 0x0}, // Character: threesuperior - {0x8, 0x4, 0x0, 0x0}, // Character: acute - {0x1F, 0x8, 0x7, 0x0}, // Character: mu - {0x2, 0x1D, 0x1F, 0x0}, // Character: paragraph - {0xE, 0xE, 0xE, 0x0}, // Character: periodcentered - {0x8, 0xA, 0x4, 0x0}, // Character: cedilla - {0xE, 0x0, 0x0, 0x0}, // Character: onesuperior - {0x12, 0x15, 0x12, 0x0}, // Character: ordmasculine - {0xA, 0x4, 0x0, 0x0}, // Character: guillemotright - {0x3, 0x8, 0x18, 0x0}, // Character: onequarter - {0xB, 0x18, 0x10, 0x0}, // Character: onehalf - {0x3, 0xB, 0x18, 0x0}, // Character: threequarters - {0x18, 0x15, 0x10, 0x0}, // Character: questiondown - {0x18, 0xD, 0x1A, 0x0}, // Character: Agrave - {0x1A, 0xD, 0x18, 0x0}, // Character: Aacute - {0x19, 0xD, 0x19, 0x0}, // Character: Acircumflex - {0x1A, 0xF, 0x19, 0x0}, // Character: Atilde - {0x1D, 0xA, 0x1D, 0x0}, // Character: Adieresis - {0x1F, 0xB, 0x1C, 0x0}, // Character: Aring - {0x1E, 0x1F, 0x15, 0x0}, // Character: AE - {0x6, 0x29, 0x19, 0x0}, // Character: Ccedilla - {0x1C, 0x1D, 0x16, 0x0}, // Character: Egrave - {0x1E, 0x1D, 0x14, 0x0}, // Character: Eacute - {0x1D, 0x1D, 0x15, 0x0}, // Character: Ecircumflex - {0x1D, 0x1C, 0x15, 0x0}, // Character: Edieresis - {0x14, 0x1D, 0x16, 0x0}, // Character: Igrave - {0x16, 0x1D, 0x14, 0x0}, // Character: Iacute - {0x15, 0x1D, 0x15, 0x0}, // Character: Icircumflex - {0x15, 0x1C, 0x15, 0x0}, // Character: Idieresis - {0x1F, 0x15, 0xE, 0x0}, // Character: Eth - {0x1D, 0xB, 0x1E, 0x0}, // Character: Ntilde - {0x1C, 0x15, 0x1E, 0x0}, // Character: Ograve - {0x1E, 0x15, 0x1C, 0x0}, // Character: Oacute - {0x1D, 0x15, 0x1D, 0x0}, // Character: Ocircumflex - {0x1D, 0x17, 0x1E, 0x0}, // Character: Otilde - {0x1D, 0x14, 0x1D, 0x0}, // Character: Odieresis - {0xA, 0x4, 0xA, 0x0}, // Character: multiply - {0x1E, 0x15, 0xF, 0x0}, // Character: Oslash - {0x1D, 0x12, 0x1C, 0x0}, // Character: Ugrave - {0x1C, 0x12, 0x1D, 0x0}, // Character: Uacute - {0x1D, 0x11, 0x1D, 0x0}, // Character: Ucircumflex - {0x1D, 0x10, 0x1D, 0x0}, // Character: Udieresis - {0xC, 0x1A, 0xD, 0x0}, // Character: Yacute - {0x1F, 0xA, 0xE, 0x0}, // Character: Thorn - {0x3E, 0x15, 0xB, 0x0}, // Character: germandbls - {0x18, 0x15, 0x1E, 0x0}, // Character: agrave - {0x1A, 0x15, 0x1C, 0x0}, // Character: aacute - {0x19, 0x15, 0x1D, 0x0}, // Character: acircumflex - {0x1A, 0x17, 0x1D, 0x0}, // Character: atilde - {0x19, 0x14, 0x1D, 0x0}, // Character: adieresis - {0x18, 0x17, 0x1F, 0x0}, // Character: aring - {0x1C, 0x1E, 0xE, 0x0}, // Character: ae - {0x2, 0x15, 0xD, 0x0}, // Character: ccedilla - {0x8, 0x1D, 0x1E, 0x0}, // Character: egrave - {0xA, 0x1D, 0x1C, 0x0}, // Character: eacute - {0x9, 0x1D, 0x1D, 0x0}, // Character: ecircumflex - {0x9, 0x1C, 0x1D, 0x0}, // Character: edieresis - {0x1D, 0x2, 0x0, 0x0}, // Character: igrave - {0x2, 0x1D, 0x0, 0x0}, // Character: iacute - {0x1, 0x1D, 0x1, 0x0}, // Character: icircumflex - {0x1, 0x1C, 0x1, 0x0}, // Character: idieresis - {0xA, 0x17, 0x1D, 0x0}, // Character: eth - {0x1D, 0x7, 0x1A, 0x0}, // Character: ntilde - {0x8, 0x15, 0xA, 0x0}, // Character: ograve - {0xA, 0x15, 0x8, 0x0}, // Character: oacute - {0x9, 0x15, 0x9, 0x0}, // Character: ocircumflex - {0x9, 0x17, 0xA, 0x0}, // Character: otilde - {0x9, 0x14, 0x9, 0x0}, // Character: odieresis - {0x4, 0x15, 0x4, 0x0}, // Character: divide - {0x1C, 0x16, 0xE, 0x0}, // Character: oslash - {0xD, 0x12, 0x1C, 0x0}, // Character: ugrave - {0xC, 0x12, 0x1D, 0x0}, // Character: uacute - {0xD, 0x11, 0x1D, 0x0}, // Character: ucircumflex - {0xD, 0x10, 0x1D, 0x0}, // Character: udieresis - {0x4, 0x2A, 0x1D, 0x0}, // Character: yacute - {0x1F, 0xA, 0x4, 0x0}, // Character: thorn - {0x5, 0x28, 0x1D, 0x0}, // Character: ydieresis - {0x0, 0x0, 0x0, 0x0}, // Character: gcircumflex - {0xE, 0x1F, 0x15, 0x0}, // Character: OE - {0x1C, 0x1E, 0x16, 0x0}, // Character: oe - {0x15, 0x1E, 0xB, 0x0}, // Character: Scaron - {0x15, 0x1E, 0xB, 0x0}, // Character: scaron - {0x5, 0x18, 0x5, 0x0}, // Character: Ydieresis - {0x1B, 0x1E, 0x17, 0x0}, // Character: Zcaron - {0x1B, 0x1E, 0x17, 0x0}, // Character: zcaron - {0x0, 0x0, 0x0, 0x0}, // Character: uni0EA4 - {0x0, 0x0, 0x0, 0x0}, // Character: uni13A0 - {0x4, 0x0, 0x0, 0x0}, // Character: bullet - {0x4, 0x0, 0x4, 0x0}, // Character: ellipsis - {0xE, 0x1F, 0x17, 0x0}, // Character: Euro + {0x00, 0x00, 0x00, 0x00}, // U+0000 (nul) + {0x00, 0x00, 0x00, 0x00}, // U+0001 + {0x00, 0x00, 0x00, 0x00}, // U+0002 + {0x00, 0x00, 0x00, 0x00}, // U+0003 + {0x00, 0x00, 0x00, 0x00}, // U+0004 + {0x00, 0x00, 0x00, 0x00}, // U+0005 + {0x00, 0x00, 0x00, 0x00}, // U+0006 + {0x00, 0x00, 0x00, 0x00}, // U+0007 + {0x00, 0x00, 0x00, 0x00}, // U+0008 + {0x00, 0x00, 0x00, 0x00}, // U+0009 + {0x00, 0x00, 0x00, 0x00}, // U+000A + {0x00, 0x00, 0x00, 0x00}, // U+000B + {0x00, 0x00, 0x00, 0x00}, // U+000C + {0x00, 0x00, 0x00, 0x00}, // U+000D + {0x00, 0x00, 0x00, 0x00}, // U+000E + {0x00, 0x00, 0x00, 0x00}, // U+000F + {0x00, 0x00, 0x00, 0x00}, // U+0010 + {0x00, 0x00, 0x00, 0x00}, // U+0011 + {0x00, 0x00, 0x00, 0x00}, // U+0012 + {0x00, 0x00, 0x00, 0x00}, // U+0013 + {0x00, 0x00, 0x00, 0x00}, // U+0014 + {0x00, 0x00, 0x00, 0x00}, // U+0015 + {0x00, 0x00, 0x00, 0x00}, // U+0016 + {0x00, 0x00, 0x00, 0x00}, // U+0017 + {0x00, 0x00, 0x00, 0x00}, // U+0018 + {0x00, 0x00, 0x00, 0x00}, // U+0019 + {0x00, 0x00, 0x00, 0x00}, // U+001A + {0x00, 0x00, 0x00, 0x00}, // U+001B + {0x00, 0x00, 0x00, 0x00}, // U+001C + {0x00, 0x00, 0x00, 0x00}, // U+001D + {0x00, 0x00, 0x00, 0x00}, // U+001E + {0x00, 0x00, 0x00, 0x00}, // U+001F + {0x0, 0x0, 0x0, 0x0}, // Character: space + {0x17, 0x0, 0x0, 0x0}, // Character: exclam + {0xC, 0x0, 0xC, 0x0}, // Character: quotedbl + {0x1F, 0xA, 0x1F, 0x0}, // Character: numbersign + {0xA, 0x1F, 0x5, 0x0}, // Character: dollar + {0x9, 0x4, 0x12, 0x0}, // Character: percent + {0xF, 0x17, 0x1C, 0x0}, // Character: ampersand + {0xC, 0x0, 0x0, 0x0}, // Character: quotesingle + {0xE, 0x11, 0x0, 0x0}, // Character: parenleft + {0x11, 0xE, 0x0, 0x0}, // Character: parenright + {0xA, 0x4, 0xA, 0x0}, // Character: asterisk + {0x4, 0xE, 0x4, 0x0}, // Character: plus + {0x8, 0x4, 0x0, 0x0}, // Character: comma + {0x4, 0x4, 0x4, 0x0}, // Character: hyphen + {0x4, 0x0, 0x0, 0x0}, // Character: period + {0x18, 0x4, 0x3, 0x0}, // Character: slash + {0x1E, 0x11, 0xF, 0x0}, // Character: zero + {0x2, 0x1F, 0x0, 0x0}, // Character: one + {0x19, 0x15, 0x12, 0x0}, // Character: two + {0x11, 0x15, 0xA, 0x0}, // Character: three + {0x7, 0x4, 0x1F, 0x0}, // Character: four + {0x17, 0x15, 0x9, 0x0}, // Character: five + {0x1E, 0x15, 0x1D, 0x0}, // Character: six + {0x19, 0x5, 0x3, 0x0}, // Character: seven + {0x1F, 0x15, 0x1F, 0x0}, // Character: eight + {0x17, 0x15, 0xF, 0x0}, // Character: nine + {0xA, 0x0, 0x0, 0x0}, // Character: colon + {0x10, 0xA, 0x0, 0x0}, // Character: semicolon + {0x4, 0xA, 0x11, 0x0}, // Character: less + {0xA, 0xA, 0xA, 0x0}, // Character: equal + {0x11, 0xA, 0x4, 0x0}, // Character: greater + {0x1, 0x15, 0x3, 0x0}, // Character: question + {0xE, 0x15, 0x16, 0x0}, // Character: at + {0x1E, 0x5, 0x1E, 0x0}, // Character: A + {0x1F, 0x15, 0xA, 0x0}, // Character: B + {0xE, 0x11, 0x11, 0x0}, // Character: C + {0x1F, 0x11, 0xE, 0x0}, // Character: D + {0x1F, 0x15, 0x15, 0x0}, // Character: E + {0x1F, 0x5, 0x5, 0x0}, // Character: F + {0xE, 0x15, 0x1D, 0x0}, // Character: G + {0x1F, 0x4, 0x1F, 0x0}, // Character: H + {0x11, 0x1F, 0x11, 0x0}, // Character: I + {0x8, 0x10, 0xF, 0x0}, // Character: J + {0x1F, 0x4, 0x1B, 0x0}, // Character: K + {0x1F, 0x10, 0x10, 0x0}, // Character: L + {0x1F, 0x6, 0x1F, 0x0}, // Character: M + {0x1F, 0xE, 0x1F, 0x0}, // Character: N + {0xE, 0x11, 0xE, 0x0}, // Character: O + {0x1F, 0x5, 0x2, 0x0}, // Character: P + {0xE, 0x19, 0x1E, 0x0}, // Character: Q + {0x1F, 0xD, 0x16, 0x0}, // Character: R + {0x12, 0x15, 0x9, 0x0}, // Character: S + {0x1, 0x1F, 0x1, 0x0}, // Character: T + {0xF, 0x10, 0x1F, 0x0}, // Character: U + {0x7, 0x18, 0x7, 0x0}, // Character: V + {0x1F, 0xC, 0x1F, 0x0}, // Character: W + {0x1B, 0x4, 0x1B, 0x0}, // Character: X + {0x3, 0x1C, 0x3, 0x0}, // Character: Y + {0x19, 0x15, 0x13, 0x0}, // Character: Z + {0x1F, 0x11, 0x11, 0x0}, // Character: bracketleft + {0x2, 0x4, 0x8, 0x0}, // Character: backslash + {0x11, 0x11, 0x1F, 0x0}, // Character: bracketright + {0x8, 0x4, 0x8, 0x0}, // Character: asciicircum + {0x4, 0x4, 0x4, 0x0}, // Character: underscore + {0x4, 0x8, 0x0, 0x0}, // Character: grave + {0x1A, 0x16, 0x1C, 0x0}, // Character: a + {0x1F, 0x12, 0xC, 0x0}, // Character: b + {0xC, 0x12, 0x12, 0x0}, // Character: c + {0xC, 0x12, 0x1F, 0x0}, // Character: d + {0xC, 0x1A, 0x16, 0x0}, // Character: e + {0x4, 0x1E, 0x5, 0x0}, // Character: f + {0x6, 0x15, 0xF, 0x0}, // Character: g + {0x1F, 0x2, 0x1C, 0x0}, // Character: h + {0x1D, 0x0, 0x0, 0x0}, // Character: i + {0x10, 0x20, 0x1D, 0x0}, // Character: j + {0x1F, 0xC, 0x12, 0x0}, // Character: k + {0x11, 0x1F, 0x10, 0x0}, // Character: l + {0x1E, 0xE, 0x1E, 0x0}, // Character: m + {0x1E, 0x2, 0x1C, 0x0}, // Character: n + {0xC, 0x12, 0xC, 0x0}, // Character: o + {0x1F, 0x9, 0x6, 0x0}, // Character: p + {0x6, 0x9, 0x1F, 0x0}, // Character: q + {0x1C, 0x2, 0x2, 0x0}, // Character: r + {0x14, 0x1E, 0xA, 0x0}, // Character: s + {0x2, 0x1F, 0x12, 0x0}, // Character: t + {0xE, 0x10, 0x1E, 0x0}, // Character: u + {0xE, 0x18, 0xE, 0x0}, // Character: v + {0x1E, 0x1C, 0x1E, 0x0}, // Character: w + {0x12, 0xC, 0x12, 0x0}, // Character: x + {0x3, 0x14, 0xF, 0x0}, // Character: y + {0x1A, 0x1E, 0x16, 0x0}, // Character: z + {0x4, 0x1B, 0x11, 0x0}, // Character: braceleft + {0x1B, 0x0, 0x0, 0x0}, // Character: bar + {0x11, 0x1B, 0x4, 0x0}, // Character: braceright + {0x8, 0xC, 0x4, 0x0}, // Character: asciitilde + {0x1D, 0x0, 0x0, 0x0}, // Character: exclamdown + {0xE, 0x1B, 0xA, 0x0}, // Character: cent + {0x14, 0x1F, 0x15, 0x0}, // Character: sterling + {0x15, 0xE, 0x15, 0x0}, // Character: currency + {0xB, 0x1C, 0xB, 0x0}, // Character: yen + {0x1B, 0x0, 0x0, 0x0}, // Character: brokenbar + {0x14, 0x1B, 0x5, 0x0}, // Character: section + {0x4, 0x0, 0x4, 0x0}, // Character: dieresis + {0x4, 0xA, 0xA, 0x0}, // Character: copyright + {0x16, 0x15, 0x17, 0x0}, // Character: ordfeminine + {0x4, 0xA, 0x0, 0x0}, // Character: guillemotleft + {0x4, 0x4, 0xC, 0x0}, // Character: logicalnot + {0x4, 0x4, 0x0, 0x0}, // Character: softhyphen + {0xE, 0x6, 0x8, 0x0}, // Character: registered + {0x4, 0x4, 0x4, 0x0}, // Character: macron + {0x4, 0xA, 0x4, 0x0}, // Character: degree + {0x12, 0x17, 0x12, 0x0}, // Character: plusminus + {0x2, 0xE, 0x8, 0x0}, // Character: twosuperior + {0xA, 0xE, 0xE, 0x0}, // Character: threesuperior + {0x8, 0x4, 0x0, 0x0}, // Character: acute + {0x1F, 0x8, 0x7, 0x0}, // Character: mu + {0x2, 0x1D, 0x1F, 0x0}, // Character: paragraph + {0xE, 0xE, 0xE, 0x0}, // Character: periodcentered + {0x8, 0xA, 0x4, 0x0}, // Character: cedilla + {0xE, 0x0, 0x0, 0x0}, // Character: onesuperior + {0x12, 0x15, 0x12, 0x0}, // Character: ordmasculine + {0xA, 0x4, 0x0, 0x0}, // Character: guillemotright + {0x3, 0x8, 0x18, 0x0}, // Character: onequarter + {0xB, 0x18, 0x10, 0x0}, // Character: onehalf + {0x3, 0xB, 0x18, 0x0}, // Character: threequarters + {0x18, 0x15, 0x10, 0x0}, // Character: questiondown + {0x18, 0xD, 0x1A, 0x0}, // Character: Agrave + {0x1A, 0xD, 0x18, 0x0}, // Character: Aacute + {0x19, 0xD, 0x19, 0x0}, // Character: Acircumflex + {0x1A, 0xF, 0x19, 0x0}, // Character: Atilde + {0x1D, 0xA, 0x1D, 0x0}, // Character: Adieresis + {0x1F, 0xB, 0x1C, 0x0}, // Character: Aring + {0x1E, 0x1F, 0x15, 0x0}, // Character: AE + {0x6, 0x29, 0x19, 0x0}, // Character: Ccedilla + {0x1C, 0x1D, 0x16, 0x0}, // Character: Egrave + {0x1E, 0x1D, 0x14, 0x0}, // Character: Eacute + {0x1D, 0x1D, 0x15, 0x0}, // Character: Ecircumflex + {0x1D, 0x1C, 0x15, 0x0}, // Character: Edieresis + {0x14, 0x1D, 0x16, 0x0}, // Character: Igrave + {0x16, 0x1D, 0x14, 0x0}, // Character: Iacute + {0x15, 0x1D, 0x15, 0x0}, // Character: Icircumflex + {0x15, 0x1C, 0x15, 0x0}, // Character: Idieresis + {0x1F, 0x15, 0xE, 0x0}, // Character: Eth + {0x1D, 0xB, 0x1E, 0x0}, // Character: Ntilde + {0x1C, 0x15, 0x1E, 0x0}, // Character: Ograve + {0x1E, 0x15, 0x1C, 0x0}, // Character: Oacute + {0x1D, 0x15, 0x1D, 0x0}, // Character: Ocircumflex + {0x1D, 0x17, 0x1E, 0x0}, // Character: Otilde + {0x1D, 0x14, 0x1D, 0x0}, // Character: Odieresis + {0xA, 0x4, 0xA, 0x0}, // Character: multiply + {0x1E, 0x15, 0xF, 0x0}, // Character: Oslash + {0x1D, 0x12, 0x1C, 0x0}, // Character: Ugrave + {0x1C, 0x12, 0x1D, 0x0}, // Character: Uacute + {0x1D, 0x11, 0x1D, 0x0}, // Character: Ucircumflex + {0x1D, 0x10, 0x1D, 0x0}, // Character: Udieresis + {0xC, 0x1A, 0xD, 0x0}, // Character: Yacute + {0x1F, 0xA, 0xE, 0x0}, // Character: Thorn + {0x3E, 0x15, 0xB, 0x0}, // Character: germandbls + {0x18, 0x15, 0x1E, 0x0}, // Character: agrave + {0x1A, 0x15, 0x1C, 0x0}, // Character: aacute + {0x19, 0x15, 0x1D, 0x0}, // Character: acircumflex + {0x1A, 0x17, 0x1D, 0x0}, // Character: atilde + {0x19, 0x14, 0x1D, 0x0}, // Character: adieresis + {0x18, 0x17, 0x1F, 0x0}, // Character: aring + {0x1C, 0x1E, 0xE, 0x0}, // Character: ae + {0x2, 0x15, 0xD, 0x0}, // Character: ccedilla + {0x8, 0x1D, 0x1E, 0x0}, // Character: egrave + {0xA, 0x1D, 0x1C, 0x0}, // Character: eacute + {0x9, 0x1D, 0x1D, 0x0}, // Character: ecircumflex + {0x9, 0x1C, 0x1D, 0x0}, // Character: edieresis + {0x1D, 0x2, 0x0, 0x0}, // Character: igrave + {0x2, 0x1D, 0x0, 0x0}, // Character: iacute + {0x1, 0x1D, 0x1, 0x0}, // Character: icircumflex + {0x1, 0x1C, 0x1, 0x0}, // Character: idieresis + {0xA, 0x17, 0x1D, 0x0}, // Character: eth + {0x1D, 0x7, 0x1A, 0x0}, // Character: ntilde + {0x8, 0x15, 0xA, 0x0}, // Character: ograve + {0xA, 0x15, 0x8, 0x0}, // Character: oacute + {0x9, 0x15, 0x9, 0x0}, // Character: ocircumflex + {0x9, 0x17, 0xA, 0x0}, // Character: otilde + {0x9, 0x14, 0x9, 0x0}, // Character: odieresis + {0x4, 0x15, 0x4, 0x0}, // Character: divide + {0x1C, 0x16, 0xE, 0x0}, // Character: oslash + {0xD, 0x12, 0x1C, 0x0}, // Character: ugrave + {0xC, 0x12, 0x1D, 0x0}, // Character: uacute + {0xD, 0x11, 0x1D, 0x0}, // Character: ucircumflex + {0xD, 0x10, 0x1D, 0x0}, // Character: udieresis + {0x4, 0x2A, 0x1D, 0x0}, // Character: yacute + {0x1F, 0xA, 0x4, 0x0}, // Character: thorn + {0x5, 0x28, 0x1D, 0x0}, // Character: ydieresis + {0x0, 0x0, 0x0, 0x0}, // Character: gcircumflex + {0xE, 0x1F, 0x15, 0x0}, // Character: OE + {0x1C, 0x1E, 0x16, 0x0}, // Character: oe + {0x15, 0x1E, 0xB, 0x0}, // Character: Scaron + {0x15, 0x1E, 0xB, 0x0}, // Character: scaron + {0x5, 0x18, 0x5, 0x0}, // Character: Ydieresis + {0x1B, 0x1E, 0x17, 0x0}, // Character: Zcaron + {0x1B, 0x1E, 0x17, 0x0}, // Character: zcaron + {0x0, 0x0, 0x0, 0x0}, // Character: uni0EA4 + {0x0, 0x0, 0x0, 0x0}, // Character: uni13A0 + {0x4, 0x0, 0x0, 0x0}, // Character: bullet + {0x4, 0x0, 0x4, 0x0}, // Character: ellipsis + {0xE, 0x1F, 0x17, 0x0}, // Character: Euro }; }; -#endif//EVT_BITMAPFONTS_HPP +#endif // EVT_BITMAPFONTS_HPP diff --git a/include/core/dev/Encoder.hpp b/include/core/dev/Encoder.hpp index d5b30d19..3c618b6a 100644 --- a/include/core/dev/Encoder.hpp +++ b/include/core/dev/Encoder.hpp @@ -73,7 +73,7 @@ class Encoder { /** counter for how many updates have occurred since the encoder was moved */ int8_t currentRelPos; - //INTERRUPT RELATED VARIABLES + // INTERRUPT RELATED VARIABLES /** the change since the last update was called, updated in the interrupt handler */ int64_t interruptChange = 0; /** the most recent time in milliseconds since the last interrupt on pin A */ @@ -99,16 +99,18 @@ class Encoder { bool changePosition(int64_t change); /** - * Handles the interrupt generated by pin a. If two interrupts occur too soon after one another the second is ignored. + * Handles the interrupt generated by pin a. If two interrupts occur too soon after one another the second is + * ignored. */ void aInterruptHandler(); /** - * Handles the interrupt generated by pin b. If two interrupts occur too soon after one another the second is ignored. + * Handles the interrupt generated by pin b. If two interrupts occur too soon after one another the second is + * ignored. */ void bInterruptHandler(); +}; -};// namespace core::DEV -}// namespace core::DEV +} // namespace core::DEV #endif diff --git a/include/core/dev/IWDG.hpp b/include/core/dev/IWDG.hpp index 9f2d896e..4397c6ae 100644 --- a/include/core/dev/IWDG.hpp +++ b/include/core/dev/IWDG.hpp @@ -20,6 +20,6 @@ class IWDG { virtual void refresh() = 0; }; -}// namespace core::DEV +} // namespace core::DEV #endif diff --git a/include/core/dev/LCD.hpp b/include/core/dev/LCD.hpp index 516ff9dd..fdc6d4af 100644 --- a/include/core/dev/LCD.hpp +++ b/include/core/dev/LCD.hpp @@ -8,26 +8,26 @@ #include #include -#define ADCSELECT 0xA0 -#define DISPLAYOFF 0xAE -#define COMDIRSCAN 0xC8 -#define LCDBIASET 0xA2 -#define POWERCONTROLSET 0x2F -#define RESRATIOSET 0x26 +#define ADCSELECT 0xA0 +#define DISPLAYOFF 0xAE +#define COMDIRSCAN 0xC8 +#define LCDBIASET 0xA2 +#define POWERCONTROLSET 0x2F +#define RESRATIOSET 0x26 #define ELECTRONICVOLCOMMAND 0x81 -#define ELECTRONICVOLVALUE 0x11 -#define DISPLAYON 0xAF -#define DISPLAYOFF 0xAE +#define ELECTRONICVOLVALUE 0x11 +#define DISPLAYON 0xAF +#define DISPLAYOFF 0xAE -#define MAX_SECTIONS 12 -#define MAX_SECTION_HEIGHT 8 +#define MAX_SECTIONS 12 +#define MAX_SECTION_HEIGHT 8 #define MAX_SECTION_PER_ROW 3 namespace core::DEV { /** -* This class represents the structure to command a GLCD with -* a ST7565 controller. -*/ + * This class represents the structure to command a GLCD with + * a ST7565 controller. + */ class LCD { public: /** @@ -49,15 +49,16 @@ class LCD { LCD(core::IO::GPIO& regSelect, core::IO::GPIO& reset, core::IO::SPI& spi); /** - * Constructor for the LCD class - * - * @param[in] regSelect Register select pin - * @param[in] reset Reset pin - * @param[in] spi SPI class for communication - * @param[in] numberOfSections number of sections that the display will show - * @param[in] sectionsPerRow number of sections per row to display - */ - LCD(core::IO::GPIO& regSelect, core::IO::GPIO& reset, core::IO::SPI& spi, uint8_t numberOfSections, uint8_t sectionsPerRow); + * Constructor for the LCD class + * + * @param[in] regSelect Register select pin + * @param[in] reset Reset pin + * @param[in] spi SPI class for communication + * @param[in] numberOfSections number of sections that the display will show + * @param[in] sectionsPerRow number of sections per row to display + */ + LCD(core::IO::GPIO& regSelect, core::IO::GPIO& reset, core::IO::SPI& spi, uint8_t numberOfSections, + uint8_t sectionsPerRow); /** * Writes data to the LCD @@ -184,7 +185,7 @@ class LCD { core::IO::GPIO& reset; /** Chip select pin for the LCD */ - //core::IO::GPIO& chipSelect; // TODO: Need to figure out purpose of this + // core::IO::GPIO& chipSelect; // TODO: Need to figure out purpose of this /** SPI port for the LCD controller */ core::IO::SPI& spi; @@ -203,6 +204,6 @@ class LCD { }; }; -}// namespace core::DEV +} // namespace core::DEV #endif diff --git a/include/core/dev/LED.hpp b/include/core/dev/LED.hpp index 6dadbe35..c34202b0 100644 --- a/include/core/dev/LED.hpp +++ b/include/core/dev/LED.hpp @@ -12,7 +12,7 @@ class LED { */ enum class ActiveState { HIGH = 0u, - LOW = 1u + LOW = 1u }; /** @@ -42,6 +42,6 @@ class LED { ActiveState activeState; }; -}// namespace core::DEV +} // namespace core::DEV #endif diff --git a/include/core/dev/MCUTimer.hpp b/include/core/dev/MCUTimer.hpp index b192acf0..c3024318 100644 --- a/include/core/dev/MCUTimer.hpp +++ b/include/core/dev/MCUTimer.hpp @@ -75,6 +75,6 @@ TIM_TypeDef* getTIM(MCUTimer mcuTimer) { return timPeriph; } -}// namespace core::DEV +} // namespace core::DEV -#endif//_EVT_MCUTIMER_HPP_ +#endif //_EVT_MCUTIMER_HPP_ diff --git a/include/core/dev/RTC.hpp b/include/core/dev/RTC.hpp index b3586564..f2ab6a6d 100644 --- a/include/core/dev/RTC.hpp +++ b/include/core/dev/RTC.hpp @@ -33,6 +33,6 @@ class RTC { virtual void setTime(core::time::TimeStamp& time) = 0; }; -}// namespace core::DEV +} // namespace core::DEV #endif diff --git a/include/core/dev/RTCTimer.hpp b/include/core/dev/RTCTimer.hpp index 63c381b6..1799eb53 100644 --- a/include/core/dev/RTCTimer.hpp +++ b/include/core/dev/RTCTimer.hpp @@ -76,6 +76,6 @@ class RTCTimer : public Timer { bool bTimerStopped; }; -}// namespace core::DEV +} // namespace core::DEV -#endif//EVT_TIMER_H +#endif // EVT_TIMER_H diff --git a/include/core/dev/Thermistor.hpp b/include/core/dev/Thermistor.hpp index 2ab86341..35fd37d5 100644 --- a/include/core/dev/Thermistor.hpp +++ b/include/core/dev/Thermistor.hpp @@ -44,6 +44,6 @@ class Thermistor { uint32_t (*conversion)(uint32_t); }; -}// namespace core::DEV +} // namespace core::DEV #endif diff --git a/include/core/dev/Timer.hpp b/include/core/dev/Timer.hpp index 84671d51..5ba88085 100644 --- a/include/core/dev/Timer.hpp +++ b/include/core/dev/Timer.hpp @@ -41,6 +41,6 @@ class Timer { virtual void setPeriod(uint32_t clockPeriod) = 0; }; -}// namespace core::DEV +} // namespace core::DEV -#endif//EVT_TIMER_HPP +#endif // EVT_TIMER_HPP diff --git a/include/core/dev/button.hpp b/include/core/dev/button.hpp index c75deecc..0d9fa45a 100644 --- a/include/core/dev/button.hpp +++ b/include/core/dev/button.hpp @@ -43,7 +43,7 @@ class Button { /** The GPIO state that means the button is being pressed */ IO::GPIO::State pressedState; +}; -};// namespace core::DEV -}// namespace core::DEV +} // namespace core::DEV #endif diff --git a/include/core/dev/platform/f3xx/IWDGf3xx.hpp b/include/core/dev/platform/f3xx/IWDGf3xx.hpp index 4e71e221..6b81eb8c 100644 --- a/include/core/dev/platform/f3xx/IWDGf3xx.hpp +++ b/include/core/dev/platform/f3xx/IWDGf3xx.hpp @@ -34,6 +34,6 @@ class IWDGf3xx : public IWDG { bool isActive = false; }; -}// namespace core::DEV +} // namespace core::DEV #endif diff --git a/include/core/dev/platform/f3xx/RTCf3xx.hpp b/include/core/dev/platform/f3xx/RTCf3xx.hpp index 2c906450..d66ef20f 100644 --- a/include/core/dev/platform/f3xx/RTCf3xx.hpp +++ b/include/core/dev/platform/f3xx/RTCf3xx.hpp @@ -31,6 +31,6 @@ class RTCf3xx : public RTC { RTC_HandleTypeDef halRTC; }; -}// namespace core::DEV +} // namespace core::DEV #endif diff --git a/include/core/dev/platform/f3xx/Timerf3xx.hpp b/include/core/dev/platform/f3xx/Timerf3xx.hpp index 3624668d..e12a0b4e 100644 --- a/include/core/dev/platform/f3xx/Timerf3xx.hpp +++ b/include/core/dev/platform/f3xx/Timerf3xx.hpp @@ -52,6 +52,6 @@ class Timerf3xx : public Timer { void initTimer(TIM_TypeDef* timerPeripheral, uint32_t clockPeriod); }; -}// namespace core::DEV +} // namespace core::DEV -#endif//_EVT_TIMER3xx_H +#endif //_EVT_TIMER3xx_H diff --git a/include/core/dev/platform/f4xx/IWDGf4xx.hpp b/include/core/dev/platform/f4xx/IWDGf4xx.hpp index c06c3ac7..666357ae 100644 --- a/include/core/dev/platform/f4xx/IWDGf4xx.hpp +++ b/include/core/dev/platform/f4xx/IWDGf4xx.hpp @@ -34,6 +34,6 @@ class IWDGf4xx : public IWDG { bool isActive = false; }; -}// namespace core::DEV +} // namespace core::DEV -#endif//EVT_IWDGF4XX_HPP +#endif // EVT_IWDGF4XX_HPP diff --git a/include/core/dev/platform/f4xx/RTCf4xx.hpp b/include/core/dev/platform/f4xx/RTCf4xx.hpp index cd5dc0c0..30bf3d55 100644 --- a/include/core/dev/platform/f4xx/RTCf4xx.hpp +++ b/include/core/dev/platform/f4xx/RTCf4xx.hpp @@ -31,6 +31,6 @@ class RTCf4xx : public RTC { RTC_HandleTypeDef halRTC; }; -}// namespace core::DEV +} // namespace core::DEV #endif diff --git a/include/core/dev/storage/EEPROM.hpp b/include/core/dev/storage/EEPROM.hpp index 3904bd54..edca2a70 100644 --- a/include/core/dev/storage/EEPROM.hpp +++ b/include/core/dev/storage/EEPROM.hpp @@ -113,6 +113,7 @@ class EEPROM { */ virtual void writeWords(uint8_t address, uint32_t* dataArr, uint8_t numWords) = 0; }; -}// namespace core::DEV -#endif//EVT_EEPROM_HPP +} // namespace core::DEV + +#endif // EVT_EEPROM_HPP diff --git a/include/core/dev/storage/M24C32.hpp b/include/core/dev/storage/M24C32.hpp index 7669fa41..0b3d980d 100644 --- a/include/core/dev/storage/M24C32.hpp +++ b/include/core/dev/storage/M24C32.hpp @@ -56,6 +56,7 @@ class M24C32 : public EEPROM { /** I2C instance to be used for I2C communication */ IO::I2C& i2c; }; -}// namespace core::DEV -#endif//EVT_M24C32 +} // namespace core::DEV + +#endif // EVT_M24C32 diff --git a/include/core/io/ADC.hpp b/include/core/io/ADC.hpp index db0000c4..7594f94c 100644 --- a/include/core/io/ADC.hpp +++ b/include/core/io/ADC.hpp @@ -48,6 +48,6 @@ class ADC { Pin pin; }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/CAN.hpp b/include/core/io/CAN.hpp index a25891c6..25c45c4e 100644 --- a/include/core/io/CAN.hpp +++ b/include/core/io/CAN.hpp @@ -34,9 +34,9 @@ class CAN { * interface. */ enum class CANStatus { - OK = 0, + OK = 0, TIMEOUT = 1, - ERROR = 2 + ERROR = 2 }; /** @@ -94,7 +94,7 @@ class CAN { * Instantiates a new CAN filter using the 16-bit ID-Mask mode. If a filter bank * that is already in use is provided, the existing filter will be overwritten. * A second pair of filter Id and mask can be given to the same filter bank. - * + * * @param[in] filterExplicitId 11-bit identifier that must be an exact match to pass * @param[in] filterMask 16-bit mask where [1] means care and [0] means don't care * @param[in] filterBank value between 0-13 where the filter info is stored @@ -105,7 +105,7 @@ class CAN { /** * Enable or disable a filter that lets through any CAN messages that, following the CANopen * standard, begin with the Emergency code of 001 - * + * * @param[in] state Enum passed to set filter functional state * @return The status associated with setting the energency filter state */ @@ -144,6 +144,7 @@ class CAN { /** If CAN should operate in loop back mode */ bool loopbackEnabled; }; -}// namespace core::IO + +} // namespace core::IO #endif diff --git a/include/core/io/CANDevice.hpp b/include/core/io/CANDevice.hpp index 0dfc6620..aba8a80c 100644 --- a/include/core/io/CANDevice.hpp +++ b/include/core/io/CANDevice.hpp @@ -26,11 +26,11 @@ class CANDevice { virtual uint8_t getNumElements() = 0; /** - * Get the device's node ID - * - * @return The node ID of the can device. + * Get the device's node ID + * + * @return The node ID of the can device. */ virtual uint8_t getNodeID() = 0; }; -#endif//EVT_CANDEVICE_HPP +#endif // EVT_CANDEVICE_HPP diff --git a/include/core/io/CANOpenMacros.hpp b/include/core/io/CANOpenMacros.hpp index 99f1abd2..a741aed8 100644 --- a/include/core/io/CANOpenMacros.hpp +++ b/include/core/io/CANOpenMacros.hpp @@ -1,22 +1,22 @@ #ifndef EVT_CANOPENMACROS_HPP #define EVT_CANOPENMACROS_HPP -#define RECEIVE_PDO_TRIGGER_SYNC 0x00 +#define RECEIVE_PDO_TRIGGER_SYNC 0x00 #define RECEIVE_PDO_TRIGGER_ASYNC 0xFE #define TRANSMIT_PDO_TRIGGER_TIMER 0xFE -#define PDO_MAPPING_UNSIGNED8 8 +#define PDO_MAPPING_UNSIGNED8 8 #define PDO_MAPPING_UNSIGNED16 16 #define PDO_MAPPING_UNSIGNED32 32 #define PDO_MAPPING_UNSIGNED64 64 #define TRANSMIT_PDO_INHIBIT_TIME_DISABLE 0x00 -// TODO: I don't like importing co_core into a macros file. We should discuss importing all the types we need individually. +// TODO: I don't like importing co_core into a macros file. We should discuss importing all the types we need +// individually. #include "co_core.h" -// TODO: Re-enable clang formatting. // Clang was removed because it adds unnecessary tabs in front of the following macros. // clang-format off /** @@ -30,28 +30,27 @@ #define MANDATORY_IDENTIFICATION_ENTRIES_1000_1014 \ { \ /* Device Type */ \ - .Key = CO_KEY(0x1000, 0x00, CO_OBJ_____R_), \ + .Key = CO_KEY(0x1000, 0x00, CO_OBJ_____R_), \ .Type = CO_TUNSIGNED32, \ .Data = (CO_DATA) 0x00, \ }, \ { \ /* Error Register */ \ - .Key = CO_KEY(0x1001, 0x00, CO_OBJ_____R_), \ + .Key = CO_KEY(0x1001, 0x00, CO_OBJ_____R_), \ .Type = CO_TUNSIGNED8, \ .Data = (CO_DATA) 0x00, \ }, \ { \ /* COB-ID SYNC-message */ \ - .Key = CO_KEY(0x1005, 0x00, CO_OBJ_DN__R_), \ + .Key = CO_KEY(0x1005, 0x00, CO_OBJ_DN__R_), \ .Type = CO_TUNSIGNED32, \ .Data = (CO_DATA) 0x80, \ }, \ { /* COB-ID EMCY */ \ - .Key = CO_KEY(0x1014, 0x00, CO_OBJ__N__R_), \ + .Key = CO_KEY(0x1014, 0x00, CO_OBJ__N__R_), \ .Type = CO_TEMCY_ID, \ .Data = (CO_DATA) 0x80, \ } -// clang-format on // TODO: Implement a heartbeat consumer @@ -62,14 +61,13 @@ * * @param INTERVAL (integer) the milli-second interval for heartbeats. */ -#define HEARTBEAT_PRODUCER_1017(INTERVAL) \ - { \ - .Key = CO_KEY(0x1017, 0x00, CO_OBJ_D___R_), \ - .Type = CO_THB_PROD, \ - .Data = (CO_DATA) INTERVAL, \ +#define HEARTBEAT_PRODUCER_1017(INTERVAL) \ + { \ + .Key = CO_KEY(0x1017, 0x00, CO_OBJ_D___R_), \ + .Type = CO_THB_PROD, \ + .Data = (CO_DATA) INTERVAL, \ } -// clang-format off /** * This macro helps create the object dictionary entry for the 0x1018 key, * also known as the Identity Object. This is used to identify the device @@ -80,30 +78,30 @@ #define IDENTITY_OBJECT_1018 \ { \ /* Object Start Key */ \ - .Key = CO_KEY(0x1018, 0x00, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1018, 0x00, CO_OBJ_D___R_), \ .Type = CO_TUNSIGNED8, \ .Data = (CO_DATA) 0x04, \ }, \ { \ /* Vendor ID */ \ - .Key = CO_KEY(0x1018, 0x01, CO_OBJ_____R_), \ + .Key = CO_KEY(0x1018, 0x01, CO_OBJ_____R_), \ .Type = CO_TUNSIGNED8, \ .Data = (CO_DATA) 0x00, \ }, \ { \ /* Product Code */ \ - .Key = CO_KEY(0x1018, 0x02, CO_OBJ_____R_), \ + .Key = CO_KEY(0x1018, 0x02, CO_OBJ_____R_), \ .Type = CO_TUNSIGNED8, \ .Data = (CO_DATA) 0x00, \ }, \ { \ /* Revision Number */ \ - .Key = CO_KEY(0x1018, 0x03, CO_OBJ_____R_), \ + .Key = CO_KEY(0x1018, 0x03, CO_OBJ_____R_), \ .Type = CO_TUNSIGNED8, \ .Data = (CO_DATA) 0x00, \ }, \ { /* Serial Number */ \ - .Key = CO_KEY(0x1018, 0x04, CO_OBJ_____R_), \ + .Key = CO_KEY(0x1018, 0x04, CO_OBJ_____R_), \ .Type = CO_TUNSIGNED8, \ .Data = (CO_DATA) 0x00, \ } @@ -113,22 +111,22 @@ * object dictionary. This lives at the key 0x1200 with 2 sub indices. * The SDO configuration is the same across all of our boards so this * macro has no parameters. -*/ + */ #define SDO_CONFIGURATION_1200 \ { \ /* Communication Object SDO Server */ \ - .Key = CO_KEY(0x1200, 0x00, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1200, 0x00, CO_OBJ_D___R_), \ .Type = CO_TUNSIGNED32, \ .Data = (CO_DATA) 0x02, \ }, \ { \ /* SDO Server Request COBID */ \ - .Key = CO_KEY(0x1200, 0x01, CO_OBJ__N__R_), \ + .Key = CO_KEY(0x1200, 0x01, CO_OBJ__N__R_), \ .Type = CO_TUNSIGNED32, \ .Data = (CO_DATA) CO_COBID_SDO_REQUEST(), \ }, \ { /* SDO Server Response COBID */ \ - .Key = CO_KEY(0x1200, 0x02, CO_OBJ__N__R_), \ + .Key = CO_KEY(0x1200, 0x02, CO_OBJ__N__R_), \ .Type = CO_TUNSIGNED32, \ .Data = (CO_DATA) CO_COBID_SDO_RESPONSE(), \ } @@ -143,23 +141,24 @@ * @param RPDO_NUMBER (integer) the RPDO number this settings object is for. * @param TPDO_NUMBER (integer) the number for the TPDO that this RPDO receives from * @param TPDO_NODE_ID (hex) the ID of the CAN Node to receive a TPDO from - * @param TRANSMISSION_TYPE (hex) the type of transmission to make. You should use RECEIVE_PDO_TRIGGER_SYNC or RECEIVE_PDO_TRIGGER_ASYNC. -*/ + * @param TRANSMISSION_TYPE (hex) the type of transmission to make. You should use RECEIVE_PDO_TRIGGER_SYNC or + * RECEIVE_PDO_TRIGGER_ASYNC. + */ #define RECEIVE_PDO_SETTINGS_OBJECT_140X(RPDO_NUMBER, TPDO_NUMBER, TPDO_NODE_ID, TRANSMISSION_TYPE) \ { \ /* RPDO #N Settings Object */ \ - .Key = CO_KEY(0x1400 + RPDO_NUMBER, 0x00, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1400 + RPDO_NUMBER, 0x00, CO_OBJ_D___R_), \ .Type = CO_TUNSIGNED8, \ .Data = (CO_DATA) 0x02, \ }, \ { \ /* COB-ID used by TPDO 180h + TPDO Node-ID*/ \ - .Key = CO_KEY(0x1400 + RPDO_NUMBER, 0x01, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1400 + RPDO_NUMBER, 0x01, CO_OBJ_D___R_), \ .Type = CO_TPDO_ID, \ .Data = (CO_DATA) CO_COBID_TPDO_DEFAULT(TPDO_NUMBER) + TPDO_NODE_ID, \ }, \ { /* Transmission type */ \ - .Key = CO_KEY(0x1400 + RPDO_NUMBER, 0x02, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1400 + RPDO_NUMBER, 0x02, CO_OBJ_D___R_), \ .Type = CO_TPDO_TYPE, \ .Data = (CO_DATA) TRANSMISSION_TYPE, \ } @@ -179,7 +178,7 @@ */ #define RECEIVE_PDO_MAPPING_START_KEY_16XX(RPDO_NUMBER, NUMBER_OF_SUB_INDICES) \ { \ - .Key = CO_KEY(0x1600 + RPDO_NUMBER, 0x00, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1600 + RPDO_NUMBER, 0x00, CO_OBJ_D___R_), \ .Type = CO_TUNSIGNED8, \ .Data = (CO_DATA) NUMBER_OF_SUB_INDICES, \ } @@ -193,11 +192,12 @@ * * @param RPDO_NUMBER (integer) the RPDO number that this entry is associated with. * @param SUB_INDEX (integer) the sub index in the greater RPDO MAPPING Object. - * @param DATA_SIZE (integer) the size in bits of the data that this entry corresponds to. You should use the PDO_MAPPING_UNSIGNEDX definitions for these sizes. + * @param DATA_SIZE (integer) the size in bits of the data that this entry corresponds to. You should use the + * PDO_MAPPING_UNSIGNEDX definitions for these sizes. */ #define RECEIVE_PDO_MAPPING_ENTRY_16XX(RPDO_NUMBER, SUB_INDEX, DATA_SIZE) \ { \ - .Key = CO_KEY(0x1600 + RPDO_NUMBER, SUB_INDEX, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1600 + RPDO_NUMBER, SUB_INDEX, CO_OBJ_D___R_), \ .Type = CO_TUNSIGNED32, \ .Data = (CO_DATA) CO_LINK(0x2100 + RPDO_NUMBER, 0x00 + SUB_INDEX, DATA_SIZE), \ } @@ -208,37 +208,38 @@ * * @param TPDO_NUMBER (integer) the TPDO number this settings object is for. * @param TRANSMISSION_TYPE (hex) the type of transmission to make. You should use TRANSMIT_PDO_TRIGGER_TIMER. - * @param INHIBIT_TIME (integer) The amount of time (in 100μs increments) that must pass before another TPDO message can be sent. + * @param INHIBIT_TIME (integer) The amount of time (in 100μs increments) that must pass before another TPDO message can + * be sent. * @param INTERVAL (integer) the time trigger (in ms) that the TPDO sends on (0 = disable). * -*/ + */ #define TRANSMIT_PDO_SETTINGS_OBJECT_18XX(TPDO_NUMBER, TRANSMISSION_TYPE, INHIBIT_TIME, INTERVAL) \ { \ /* TPDO #N Settings Object */ \ - .Key = CO_KEY(0x1800 + TPDO_NUMBER, 0x00, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1800 + TPDO_NUMBER, 0x00, CO_OBJ_D___R_), \ .Type = CO_TUNSIGNED8, \ .Data = (CO_DATA) 0x05, \ }, \ { \ /* COB-ID used by TPDO 180h+TPDO Node-ID*/ \ - .Key = CO_KEY(0x1800 + TPDO_NUMBER, 0x01, CO_OBJ_DN__R_), \ + .Key = CO_KEY(0x1800 + TPDO_NUMBER, 0x01, CO_OBJ_DN__R_), \ .Type = CO_TPDO_ID, \ .Data = (CO_DATA) CO_COBID_TPDO_DEFAULT(TPDO_NUMBER), \ }, \ { \ /* Transmission type */ \ - .Key = CO_KEY(0x1800 + TPDO_NUMBER, 0x02, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1800 + TPDO_NUMBER, 0x02, CO_OBJ_D___R_), \ .Type = CO_TPDO_TYPE, \ .Data = (CO_DATA) TRANSMISSION_TYPE, \ }, \ { \ /* Inhibit time with LSB 100us (0=disable) */ \ - .Key = CO_KEY(0x1800 + TPDO_NUMBER, 0x03, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1800 + TPDO_NUMBER, 0x03, CO_OBJ_D___R_), \ .Type = CO_TUNSIGNED16, \ .Data = (CO_DATA) INHIBIT_TIME, \ }, \ { /* Event timer LSB 1ms (0=disable) */ \ - .Key = CO_KEY(0x1800 + TPDO_NUMBER, 0x05, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1800 + TPDO_NUMBER, 0x05, CO_OBJ_D___R_), \ .Type = CO_TPDO_EVENT, \ .Data = (CO_DATA) INTERVAL, \ } @@ -257,7 +258,7 @@ */ #define TRANSMIT_PDO_MAPPING_START_KEY_1AXX(TPDO_NUMBER, NUMBER_OF_SUB_INDICES) \ { \ - .Key = CO_KEY(0x1A00 + TPDO_NUMBER, 0x00, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1A00 + TPDO_NUMBER, 0x00, CO_OBJ_D___R_), \ .Type = CO_TUNSIGNED8, \ .Data = (CO_DATA) NUMBER_OF_SUB_INDICES, \ } @@ -271,11 +272,12 @@ * * @param RPDO_NUMBER (integer) the TPDO number that this entry is associated with. * @param SUB_INDEX (integer) the sub index in the greater TPDO MAPPING Object. - * @param DATA_SIZE (integer) the size in bits of the data that this entry corresponds to. You should use the PDO_MAPPING_UNSIGNEDX definitions for these sizes. + * @param DATA_SIZE (integer) the size in bits of the data that this entry corresponds to. You should use the + * PDO_MAPPING_UNSIGNEDX definitions for these sizes. */ #define TRANSMIT_PDO_MAPPING_ENTRY_1AXX(TPDO_NUMBER, SUB_INDEX, DATA_SIZE) \ { \ - .Key = CO_KEY(0x1A00 + TPDO_NUMBER, SUB_INDEX, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x1A00 + TPDO_NUMBER, SUB_INDEX, CO_OBJ_D___R_), \ .Type = CO_TUNSIGNED32, \ .Data = (CO_DATA) CO_LINK(0x2100 + TPDO_NUMBER, 0x00 + SUB_INDEX, DATA_SIZE), \ } @@ -291,7 +293,7 @@ */ #define DATA_LINK_START_KEY_21XX(PDO_NUMBER, NUMBER_OF_SUB_INDICES) \ { \ - .Key = CO_KEY(0x2100 + PDO_NUMBER, 0, CO_OBJ_D___R_), \ + .Key = CO_KEY(0x2100 + PDO_NUMBER, 0, CO_OBJ_D___R_), \ .Type = CO_TUNSIGNED8, \ .Data = (CO_DATA) NUMBER_OF_SUB_INDICES, \ } @@ -305,15 +307,17 @@ * * @param PDO_NUMBER (integer) the PDO number that this data link is associated with * @param SUB_INDEX (integer) the sub index in the great Data Link section. - * @param DATA_TYPE (CO_T...) type of the data that is being linked too. You should use the CANOpen definitions for types here. - * @param DATA_POINTER (pointer) a pointer to a piece of data that this data link will connect to. Please provide this as a pointer using the &variableName syntax. This macro does not automatically add the & + * @param DATA_TYPE (CO_T...) type of the data that is being linked too. You should use the CANOpen definitions for + * types here. + * @param DATA_POINTER (pointer) a pointer to a piece of data that this data link will connect to. Please provide this + * as a pointer using the &variableName syntax. This macro does not automatically add the & */ #define DATA_LINK_21XX(PDO_NUMBER, SUB_INDEX, DATA_TYPE, DATA_POINTER) \ { \ - .Key = CO_KEY(0x2100 + PDO_NUMBER, SUB_INDEX, CO_OBJ____PRW), \ + .Key = CO_KEY(0x2100 + PDO_NUMBER, SUB_INDEX, CO_OBJ____PRW), \ .Type = DATA_TYPE, \ .Data = (CO_DATA) DATA_POINTER, \ } // clang-format on -#endif//EVT_CANOPENMACROS_HPP +#endif // EVT_CANOPENMACROS_HPP diff --git a/include/core/io/CANopen.hpp b/include/core/io/CANopen.hpp index c2b0a86f..50cc6905 100644 --- a/include/core/io/CANopen.hpp +++ b/include/core/io/CANopen.hpp @@ -15,7 +15,7 @@ #include #include -//Allows for resizable CANOpen queue if needed +// Allows for resizable CANOpen queue if needed #ifndef CANOPEN_QUEUE_SIZE #define CANOPEN_QUEUE_SIZE 150 #endif @@ -31,8 +31,7 @@ namespace core::IO { * @param[in] messageQueue Queue that will be read from for receiveing CAN messages * @param[out] canDriver The CANopen stack driver to populate */ -void getCANopenCANDriver(CAN* can, - types::FixedQueue* messageQueue, +void getCANopenCANDriver(CAN* can, types::FixedQueue* messageQueue, CO_IF_CAN_DRV* canDriver); /** @@ -69,7 +68,9 @@ void getCANopenNVMDriver(CO_IF_NVM_DRV* nvmDriver); * @param timerDriver[in,out] the timer driver. * @param canDriver[in,out] the general CAN driver. */ -void initializeCANopenDriver(types::FixedQueue* canOpenQueue, IO::CAN* can, core::DEV::Timer* timer, CO_IF_DRV* canStackDriver, CO_IF_NVM_DRV* nvmDriver, CO_IF_TIMER_DRV* timerDriver, CO_IF_CAN_DRV* canDriver); +void initializeCANopenDriver(types::FixedQueue* canOpenQueue, IO::CAN* can, + core::DEV::Timer* timer, CO_IF_DRV* canStackDriver, CO_IF_NVM_DRV* nvmDriver, + CO_IF_TIMER_DRV* timerDriver, CO_IF_CAN_DRV* canDriver); /** * This function initializes a CO_NODE by taking in the CANDevice, @@ -82,7 +83,8 @@ void initializeCANopenDriver(types::FixedQueue #include -//Allows for resizable CAN queue if needed +// Allows for resizable CAN queue if needed #ifndef CAN_MESSAGE_QUEUE_SIZE #define CAN_MESSAGE_QUEUE_SIZE 100 #endif @@ -43,7 +43,7 @@ class CANf3xx : public CAN { * For the STM32f3xx this involves attempting to startup the CAN * interface. This could cause an error in the case of invalid * parameters. - * + * * @param[in] autoBusOff Indicates the state halCAN.Init.AutoBusOff should be in * * @return CANStatus::OK on success, CANStatus::ERROR otherwise @@ -99,6 +99,6 @@ class CANf3xx : public CAN { core::types::FixedQueue messageQueue; }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/platform/f3xx/GPIOf3xx.hpp b/include/core/io/platform/f3xx/GPIOf3xx.hpp index 821dbf0b..18201d60 100644 --- a/include/core/io/platform/f3xx/GPIOf3xx.hpp +++ b/include/core/io/platform/f3xx/GPIOf3xx.hpp @@ -47,13 +47,13 @@ class GPIOf3xx : public GPIO { * Possible values for Mode, Pull, and Speed can be found in "stm32f3xx_hal_gpio.h" * @param alternate gpio alternate function selection */ - static void gpioStateInit(GPIO_InitTypeDef* targetGpio, Pin* pins, - uint8_t numOfPins, uint32_t mode, uint32_t pull, + static void gpioStateInit(GPIO_InitTypeDef* targetGpio, Pin* pins, uint8_t numOfPins, uint32_t mode, uint32_t pull, uint32_t speed, uint8_t alternate = 0x0DU); private: // See stm32f3xx_hal_gpio -> GPIO_mode for info on derivations constexpr static int GPIO_MODE_IT_SHIFT = 20; + constexpr static uint32_t GPIO_TRIGGER_INTERRUPT_BASE = GPIO_MODE_IT_RISING & ~(1 << GPIO_MODE_IT_SHIFT); /// Pin representing the underlying HAL pin identifer @@ -62,6 +62,6 @@ class GPIOf3xx : public GPIO { GPIO_TypeDef* port; }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/platform/f3xx/I2Cf3xx.hpp b/include/core/io/platform/f3xx/I2Cf3xx.hpp index c6a54dea..a2c15e39 100644 --- a/include/core/io/platform/f3xx/I2Cf3xx.hpp +++ b/include/core/io/platform/f3xx/I2Cf3xx.hpp @@ -32,21 +32,15 @@ class I2Cf3xx : public I2C { I2C::I2CStatus read(uint8_t addr, uint8_t* bytes, uint8_t length) override; - I2C::I2CStatus writeMemReg(uint8_t addr, uint32_t memAddress, - uint8_t byte, uint16_t memAddSize, + I2C::I2CStatus writeMemReg(uint8_t addr, uint32_t memAddress, uint8_t byte, uint16_t memAddSize, uint8_t maxWriteTime) override; - I2C::I2CStatus readMemReg(uint8_t addr, uint32_t memAddress, - uint8_t* byte, - uint16_t memAddSize) override; + I2C::I2CStatus readMemReg(uint8_t addr, uint32_t memAddress, uint8_t* byte, uint16_t memAddSize) override; - I2C::I2CStatus writeMemReg(uint8_t addr, uint32_t memAddress, - uint8_t* bytes, uint8_t size, - uint16_t memAddSize, + I2C::I2CStatus writeMemReg(uint8_t addr, uint32_t memAddress, uint8_t* bytes, uint8_t size, uint16_t memAddSize, uint8_t maxWriteTime) override; - I2C::I2CStatus readMemReg(uint8_t addr, uint32_t memAddress, - uint8_t* bytes, uint8_t size, + I2C::I2CStatus readMemReg(uint8_t addr, uint32_t memAddress, uint8_t* bytes, uint8_t size, uint16_t memAddSize) override; private: @@ -64,6 +58,6 @@ class I2Cf3xx : public I2C { static I2C::I2CStatus halToI2CStatus(HAL_StatusTypeDef halStatus); }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/platform/f3xx/PWMf3xx.hpp b/include/core/io/platform/f3xx/PWMf3xx.hpp index 02b6945b..a49d0e3d 100644 --- a/include/core/io/platform/f3xx/PWMf3xx.hpp +++ b/include/core/io/platform/f3xx/PWMf3xx.hpp @@ -35,6 +35,6 @@ class PWMf3xx : public PWM { TIM_OC_InitTypeDef halChannel; }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/platform/f3xx/SPIf3xx.hpp b/include/core/io/platform/f3xx/SPIf3xx.hpp index d220d964..0ecfe08d 100644 --- a/include/core/io/platform/f3xx/SPIf3xx.hpp +++ b/include/core/io/platform/f3xx/SPIf3xx.hpp @@ -89,6 +89,6 @@ class SPIf3xx : public SPI { SPIStatus halToSPIStatus(HAL_StatusTypeDef halStatus); }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/platform/f3xx/UARTf3xx.hpp b/include/core/io/platform/f3xx/UARTf3xx.hpp index ecc0f96e..ea8c3d0b 100644 --- a/include/core/io/platform/f3xx/UARTf3xx.hpp +++ b/include/core/io/platform/f3xx/UARTf3xx.hpp @@ -22,8 +22,7 @@ class UARTf3xx : public UART { */ UARTf3xx(Pin txPin, Pin rxPin, uint32_t baudrate, bool isSwapped); void setBaudrate(uint32_t baudrate) override; - void setFormat(WordLength wordLength = WordLength::EIGHT, - Parity parity = Parity::NONE, + void setFormat(WordLength wordLength = WordLength::EIGHT, Parity parity = Parity::NONE, NumStopBits numStopBits = NumStopBits::ONE) override; void sendBreak() override; @@ -48,6 +47,6 @@ class UARTf3xx : public UART { UART_HandleTypeDef halUART; }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/platform/f4xx/ADCf4xx.hpp b/include/core/io/platform/f4xx/ADCf4xx.hpp index e94c7c49..75602ed7 100644 --- a/include/core/io/platform/f4xx/ADCf4xx.hpp +++ b/include/core/io/platform/f4xx/ADCf4xx.hpp @@ -61,6 +61,6 @@ class ADCf4xx : public ADC { void addChannel(uint8_t rank); }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/platform/f4xx/GPIOf4xx.hpp b/include/core/io/platform/f4xx/GPIOf4xx.hpp index ba804bf1..7e87a977 100644 --- a/include/core/io/platform/f4xx/GPIOf4xx.hpp +++ b/include/core/io/platform/f4xx/GPIOf4xx.hpp @@ -46,13 +46,12 @@ class GPIOf4xx : public GPIO { * Possible values for Mode, Pull, and Speed can be found in "stm32f4xx_hal_gpio.h" * @param alternate gpio alternate function selection */ - static void gpioStateInit(GPIO_InitTypeDef* targetGpio, Pin* pins, - uint8_t numOfPins, uint32_t mode, uint32_t pull, + static void gpioStateInit(GPIO_InitTypeDef* targetGpio, Pin* pins, uint8_t numOfPins, uint32_t mode, uint32_t pull, uint32_t speed, uint8_t alternate = 0x0DU); private: // See stm32f4xx_hal_gpio -> GPIO_mode for info on derivations - constexpr static int GPIO_MODE_IT_SHIFT = 20; + constexpr static int GPIO_MODE_IT_SHIFT = 20; constexpr static uint32_t GPIO_TRIGGER_INTERRUPT_BASE = GPIO_MODE_IT_RISING & ~(1 << GPIO_MODE_IT_SHIFT); /// Pin representing the underlying HAL pin identifer @@ -61,6 +60,6 @@ class GPIOf4xx : public GPIO { GPIO_TypeDef* port; }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/platform/f4xx/I2Cf4xx.hpp b/include/core/io/platform/f4xx/I2Cf4xx.hpp index dfecfa5c..7472ab66 100644 --- a/include/core/io/platform/f4xx/I2Cf4xx.hpp +++ b/include/core/io/platform/f4xx/I2Cf4xx.hpp @@ -32,21 +32,15 @@ class I2Cf4xx : public I2C { I2C::I2CStatus read(uint8_t addr, uint8_t* bytes, uint8_t length) override; - I2C::I2CStatus writeMemReg(uint8_t addr, uint32_t memAddress, - uint8_t byte, uint16_t memAddSize, + I2C::I2CStatus writeMemReg(uint8_t addr, uint32_t memAddress, uint8_t byte, uint16_t memAddSize, uint8_t maxWriteTime) override; - I2C::I2CStatus readMemReg(uint8_t addr, uint32_t memAddress, - uint8_t* byte, - uint16_t memAddSize) override; + I2C::I2CStatus readMemReg(uint8_t addr, uint32_t memAddress, uint8_t* byte, uint16_t memAddSize) override; - I2C::I2CStatus writeMemReg(uint8_t addr, uint32_t memAddress, - uint8_t* bytes, uint8_t size, - uint16_t memAddSize, + I2C::I2CStatus writeMemReg(uint8_t addr, uint32_t memAddress, uint8_t* bytes, uint8_t size, uint16_t memAddSize, uint8_t maxWriteTime) override; - I2C::I2CStatus readMemReg(uint8_t addr, uint32_t memAddress, - uint8_t* bytes, uint8_t size, + I2C::I2CStatus readMemReg(uint8_t addr, uint32_t memAddress, uint8_t* bytes, uint8_t size, uint16_t memAddSize) override; private: @@ -64,6 +58,6 @@ class I2Cf4xx : public I2C { static I2C::I2CStatus halToI2CStatus(HAL_StatusTypeDef halStatus); }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/platform/f4xx/PWMf4xx.hpp b/include/core/io/platform/f4xx/PWMf4xx.hpp index 10bab213..95b28c3c 100644 --- a/include/core/io/platform/f4xx/PWMf4xx.hpp +++ b/include/core/io/platform/f4xx/PWMf4xx.hpp @@ -35,6 +35,6 @@ class PWMf4xx : public PWM { TIM_OC_InitTypeDef halChannel; }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/platform/f4xx/SPIf4xx.hpp b/include/core/io/platform/f4xx/SPIf4xx.hpp index 26143e04..fe64792a 100644 --- a/include/core/io/platform/f4xx/SPIf4xx.hpp +++ b/include/core/io/platform/f4xx/SPIf4xx.hpp @@ -87,6 +87,6 @@ class SPIf4xx : public SPI { SPIStatus halToSPIStatus(HAL_StatusTypeDef halStatus); }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/platform/f4xx/UARTf4xx.hpp b/include/core/io/platform/f4xx/UARTf4xx.hpp index 0c122505..4d8bcd17 100644 --- a/include/core/io/platform/f4xx/UARTf4xx.hpp +++ b/include/core/io/platform/f4xx/UARTf4xx.hpp @@ -21,8 +21,7 @@ class UARTf4xx : public UART { void setBaudrate(uint32_t baudrate); - void setFormat(WordLength wordLength = WordLength::EIGHT, - Parity parity = Parity::NONE, + void setFormat(WordLength wordLength = WordLength::EIGHT, Parity parity = Parity::NONE, NumStopBits numStopBits = NumStopBits::ONE); void sendBreak(); @@ -51,5 +50,5 @@ class UARTf4xx : public UART { /// HAL representation of the UART UART_HandleTypeDef halUART; }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/io/types/CANMessage.hpp b/include/core/io/types/CANMessage.hpp index 2d79655e..1ceca762 100644 --- a/include/core/io/types/CANMessage.hpp +++ b/include/core/io/types/CANMessage.hpp @@ -99,6 +99,6 @@ class CANMessage { bool isExtended; }; -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/manager.hpp b/include/core/manager.hpp index 89a727a3..bb5c6fbd 100644 --- a/include/core/manager.hpp +++ b/include/core/manager.hpp @@ -61,10 +61,10 @@ namespace core::platform { /** -* Initialize the low level components of the system. This is highly -* platform specific and usually involves clock setup and other peripheral -* init logic. -*/ + * Initialize the low level components of the system. This is highly + * platform specific and usually involves clock setup and other peripheral + * init logic. + */ void init() { #ifdef STM32F3xx stm32f3xx_init(); @@ -74,16 +74,16 @@ void init() { #endif } -}// namespace core::platform +} // namespace core::platform namespace core::DEV { /** -* Get an instance of an IWDG -* -* @param ms Time in milliseconds before the IWDG triggers a reset -* must be a value between 8 and 32768 ms. -*/ + * Get an instance of an IWDG + * + * @param ms Time in milliseconds before the IWDG triggers a reset + * must be a value between 8 and 32768 ms. + */ #ifdef IWDG_SUPPORTED IWDG& getIWDG(uint32_t ms) { #ifdef STM32F3xx @@ -103,8 +103,8 @@ IWDG& getIWDG(uint32_t ms) { #endif /** -* Get an instance of an RTC -*/ + * Get an instance of an RTC + */ #ifdef RTC_SUPPORTED RTC& getRTC() { #ifdef STM32F3xx @@ -119,7 +119,7 @@ RTC& getRTC() { #endif #ifdef MCU_SUPPORTED -template +template Timer& getTimer(uint32_t clockPeriod) { #ifdef STM32F3xx static Timerf3xx timer(getTIM(mcuTimer), clockPeriod); @@ -128,17 +128,17 @@ Timer& getTimer(uint32_t clockPeriod) { } #endif -}// namespace core::DEV +} // namespace core::DEV namespace core::IO { /** -* Get an instance of an ADC channel -* -* @param[in] pin The pin to use with the ADC -*/ + * Get an instance of an ADC channel + * + * @param[in] pin The pin to use with the ADC + */ #ifdef ADC_SUPPORTED -template +template ADC& getADC() { #ifdef STM32F4xx static ADCf4xx adc(pin); @@ -152,13 +152,13 @@ ADC& getADC() { #endif /** -* Get an instance of a CAN interface. -* -* @param[in] txPin CAN pin for transmitting messages -* @param[in] rxPin CAN pin for receiving messages -*/ + * Get an instance of a CAN interface. + * + * @param[in] txPin CAN pin for transmitting messages + * @param[in] rxPin CAN pin for receiving messages + */ #ifdef CAN_SUPPORTED -template +template CAN& getCAN(bool loopbackEnabled = false) { #ifdef STM32F3xx static CANf3xx can(txPin, rxPin, loopbackEnabled); @@ -172,16 +172,15 @@ CAN& getCAN(bool loopbackEnabled = false) { #endif /** -* Get an instance of a GPIO pin. -* -* @param[in] pin The pin to attach to the GPIO -* @param[in] direction The direction, either input or output -* @param[in] pull The direction of the internal pull resistor -*/ + * Get an instance of a GPIO pin. + * + * @param[in] pin The pin to attach to the GPIO + * @param[in] direction The direction, either input or output + * @param[in] pull The direction of the internal pull resistor + */ #ifdef GPIO_SUPPORTED -template -GPIO& getGPIO(GPIO::Direction direction = GPIO::Direction::OUTPUT, - GPIO::Pull pull = GPIO::Pull::PULL_DOWN) { +template +GPIO& getGPIO(GPIO::Direction direction = GPIO::Direction::OUTPUT, GPIO::Pull pull = GPIO::Pull::PULL_DOWN) { #ifdef STM32F3xx static GPIOf3xx gpioPin(pin, direction, pull); return gpioPin; @@ -194,13 +193,13 @@ GPIO& getGPIO(GPIO::Direction direction = GPIO::Direction::OUTPUT, #endif /** -* Get an I2C master interface. -* -* @param[in] scl The I2C clock pin -* @param[in] sda The I2C data pin -*/ + * Get an I2C master interface. + * + * @param[in] scl The I2C clock pin + * @param[in] sda The I2C data pin + */ #ifdef I2C_SUPPORTED -template +template I2C& getI2C() { #ifdef STM32F3xx static I2Cf3xx i2c(scl, sda); @@ -214,12 +213,12 @@ I2C& getI2C() { #endif /** -* Get an instance of a PWM pin. -* -* @param[in] pin The pin to attach to the PWM. -*/ + * Get an instance of a PWM pin. + * + * @param[in] pin The pin to attach to the PWM. + */ #ifdef PWM_SUPPORTED -template +template PWM& getPWM() { #ifdef STM32F3xx static PWMf3xx pwm(pin); @@ -233,15 +232,15 @@ PWM& getPWM() { #endif /** -* Get an instance of a UART. -* -* @param[in] txPin The transmit pin for the UART -* @param[in] rxPin The receive pin for the UART -* @param[in] baudrate The baudrate to operate at -* @param[in] isSwapped Whether TX and RX should be swapped; defaults to false + * Get an instance of a UART. + * + * @param[in] txPin The transmit pin for the UART + * @param[in] rxPin The receive pin for the UART + * @param[in] baudrate The baudrate to operate at + * @param[in] isSwapped Whether TX and RX should be swapped; defaults to false */ #ifdef UART_SUPPORTED -template +template UART& getUART(uint32_t baudrate, bool isSwapped = false) { #ifdef STM32F3xx static UARTf3xx uart(txPin, rxPin, baudrate, isSwapped); @@ -255,16 +254,16 @@ UART& getUART(uint32_t baudrate, bool isSwapped = false) { #endif /** -* Get an instance of a SPI driver. -* -* @tparam sckPin Serial clock pin -* @tparam mosiPin Master out, slave in pin -* @tparam misoPin Master in, slave out pin -* @param CSPins Array of chip select pins -* @param pinLength Number of chip select pins in the array -*/ + * Get an instance of a SPI driver. + * + * @tparam sckPin Serial clock pin + * @tparam mosiPin Master out, slave in pin + * @tparam misoPin Master in, slave out pin + * @param CSPins Array of chip select pins + * @param pinLength Number of chip select pins in the array + */ #ifdef SPI_SUPPORTED -template +template SPI& getSPI(GPIO* CSPins[], uint8_t pinLength) { #ifdef STM32F3xx static SPIf3xx spi(CSPins, pinLength, sckPin, mosiPin, misoPin); @@ -277,14 +276,14 @@ SPI& getSPI(GPIO* CSPins[], uint8_t pinLength) { } /** -* Get an instance of a write-only SPI driver. -* -* @tparam sckPin Serial clock pin -* @tparam mosiPin Master out, slave in pin -* @param CSPins Array of chip select pins -* @param pinLength Number of chip select pins in the array -*/ -template + * Get an instance of a write-only SPI driver. + * + * @tparam sckPin Serial clock pin + * @tparam mosiPin Master out, slave in pin + * @param CSPins Array of chip select pins + * @param pinLength Number of chip select pins in the array + */ +template SPI& getSPI(GPIO* CSPins[], uint8_t pinLength) { #ifdef STM32F3xx static SPIf3xx spi(CSPins, pinLength, sckPin, mosiPin); @@ -293,6 +292,6 @@ SPI& getSPI(GPIO* CSPins[], uint8_t pinLength) { } #endif -}// namespace core::IO +} // namespace core::IO #endif diff --git a/include/core/platform/f3xx/stm32f3xx.hpp b/include/core/platform/f3xx/stm32f3xx.hpp index fee5faee..b8b6205b 100644 --- a/include/core/platform/f3xx/stm32f3xx.hpp +++ b/include/core/platform/f3xx/stm32f3xx.hpp @@ -9,10 +9,10 @@ namespace core::platform { constexpr uint32_t CLK_SPEED = 8000000; // Interrupt Priority Mappings. 0 is high and 15 is low -constexpr uint32_t CAN_INTERRUPT_PRIORITY = 4; -constexpr uint32_t ADC_INTERRUPT_PRIORITY = 5; +constexpr uint32_t CAN_INTERRUPT_PRIORITY = 4; +constexpr uint32_t ADC_INTERRUPT_PRIORITY = 5; constexpr uint32_t TIMER_INTERRUPT_PRIORITY = 9; -constexpr uint32_t GPIO_INTERRUPT_PRIORITY = 10; +constexpr uint32_t GPIO_INTERRUPT_PRIORITY = 10; /** * Handles system level initialization of the STM32F302x8. This makes a @@ -21,5 +21,5 @@ constexpr uint32_t GPIO_INTERRUPT_PRIORITY = 10; */ void stm32f3xx_init(); -}// namespace core::platform +} // namespace core::platform #endif diff --git a/include/core/platform/f4xx/stm32f4xx.hpp b/include/core/platform/f4xx/stm32f4xx.hpp index 06b58a9d..06e87d1b 100644 --- a/include/core/platform/f4xx/stm32f4xx.hpp +++ b/include/core/platform/f4xx/stm32f4xx.hpp @@ -7,10 +7,10 @@ namespace core::platform { constexpr uint32_t CLK_SPEED = 8000000; // Interrupt Priority Mappings. 0 is high and 15 is low -constexpr uint32_t CAN_INTERRUPT_PRIORITY = 4; -constexpr uint32_t ADC_INTERRUPT_PRIORITY = 5; +constexpr uint32_t CAN_INTERRUPT_PRIORITY = 4; +constexpr uint32_t ADC_INTERRUPT_PRIORITY = 5; constexpr uint32_t TIMER_INTERRUPT_PRIORITY = 9; -constexpr uint32_t GPIO_INTERRUPT_PRIORITY = 10; +constexpr uint32_t GPIO_INTERRUPT_PRIORITY = 10; /** * Handles system level initialization of the STM32F4xx. This makes a @@ -20,5 +20,5 @@ constexpr uint32_t GPIO_INTERRUPT_PRIORITY = 10; void stm32f4xx_init(); void Error_Handler(void); -}// namespace core::platform +} // namespace core::platform #endif diff --git a/include/core/utils/bits.hpp b/include/core/utils/bits.hpp index c535a17e..3fce76b4 100644 --- a/include/core/utils/bits.hpp +++ b/include/core/utils/bits.hpp @@ -15,9 +15,7 @@ * @param data The number to get the high byte from * @return The high order byte */ -constexpr static inline uint8_t getHighByte(uint16_t data) { - return static_cast((data & 0xFF00) >> 8); -} +constexpr static inline uint8_t getHighByte(uint16_t data) { return static_cast((data & 0xFF00) >> 8); } /** * Get the low byte from the number. @@ -25,9 +23,7 @@ constexpr static inline uint8_t getHighByte(uint16_t data) { * @param data The number to get the low byte from * @return The low order byte */ -constexpr static inline uint8_t getLowByte(uint16_t data) { - return static_cast(data & 0x00FF); -} +constexpr static inline uint8_t getLowByte(uint16_t data) { return static_cast(data & 0x00FF); } // 32 bit operations /** @@ -66,8 +62,6 @@ constexpr static inline uint8_t getMiddleLowByte(uint32_t data) { * @param data The number to get the lowest byte from. * @return The lowest order byte */ -constexpr static inline uint8_t getLowestByte(uint32_t data) { - return static_cast((data & 0x000000FF)); -} +constexpr static inline uint8_t getLowestByte(uint32_t data) { return static_cast((data & 0x000000FF)); } #endif diff --git a/include/core/utils/log.hpp b/include/core/utils/log.hpp index 4d730fcd..b96cb551 100644 --- a/include/core/utils/log.hpp +++ b/include/core/utils/log.hpp @@ -12,13 +12,13 @@ namespace core::log { class Logger { public: /** - * The level at which messages should be logged - */ + * The level at which messages should be logged + */ enum class LogLevel { - DEBUG = 0u, - INFO = 1u, + DEBUG = 0u, + INFO = 1u, WARNING = 2u, - ERROR = 3u, + ERROR = 3u, }; /** @@ -65,6 +65,7 @@ class Logger { // creating a new one each time this header is included /** Global Logger instance */ extern Logger LOGGER; -}// namespace core::log -#endif// INCLUDE_EVT_UTILS_LOG_HPP_ +} // namespace core::log + +#endif // INCLUDE_EVT_UTILS_LOG_HPP_ diff --git a/include/core/utils/time.hpp b/include/core/utils/time.hpp index 0249f2b0..a115e8ad 100644 --- a/include/core/utils/time.hpp +++ b/include/core/utils/time.hpp @@ -54,5 +54,6 @@ struct TimeStamp { */ uint8_t second; }; -}// namespace core::time + +} // namespace core::time #endif diff --git a/include/core/utils/types/FixedQueue.hpp b/include/core/utils/types/FixedQueue.hpp index fa964cfe..e2c3d9f1 100644 --- a/include/core/utils/types/FixedQueue.hpp +++ b/include/core/utils/types/FixedQueue.hpp @@ -20,7 +20,7 @@ namespace core::types { -template +template class FixedQueue { public: /** @@ -32,11 +32,11 @@ class FixedQueue { * Defaults to false */ FixedQueue(bool withOverwrite = false) { - this->maxCapacity = maxSize; - this->front = &elements[0]; - this->back = &elements[0]; - this->end = &elements[maxCapacity]; - this->size = 0; + this->maxCapacity = maxSize; + this->front = &elements[0]; + this->back = &elements[0]; + this->end = &elements[maxCapacity]; + this->size = 0; this->withOverwrite = withOverwrite; } @@ -103,18 +103,14 @@ class FixedQueue { * * @return True if the queue is full, false otherwise. */ - bool isFull() { - return size == maxCapacity; - } + bool isFull() { return size == maxCapacity; } /** * Get is the queue is empty. * * @return True if the queue is empty, false otherwise. */ - bool isEmpty() { - return size == 0; - } + bool isEmpty() { return size == 0; } /** * Check to see if an element can be inserted. If overwritting is enabled, @@ -123,9 +119,7 @@ class FixedQueue { * * @return True if the queue is not full or if overwritting is enabled. */ - bool canInsert() { - return withOverwrite || !isFull(); - } + bool canInsert() { return withOverwrite || !isFull(); } private: /** The elements stored in the queue */ @@ -147,6 +141,6 @@ class FixedQueue { bool withOverwrite; }; -}// namespace core::types +} // namespace core::types #endif diff --git a/samples/adc/multi_adc.cpp b/samples/adc/multi_adc.cpp index 5fd042f5..2a4a7830 100644 --- a/samples/adc/multi_adc.cpp +++ b/samples/adc/multi_adc.cpp @@ -8,7 +8,7 @@ #include #include -namespace IO = core::IO; +namespace IO = core::IO; namespace time = core::time; int main() { diff --git a/samples/adc/single_adc.cpp b/samples/adc/single_adc.cpp index 1495fec9..7b8c28ef 100644 --- a/samples/adc/single_adc.cpp +++ b/samples/adc/single_adc.cpp @@ -8,7 +8,7 @@ #include #include -namespace IO = core::IO; +namespace IO = core::IO; namespace time = core::time; int main() { diff --git a/samples/blink/main.cpp b/samples/blink/main.cpp index 4e648319..f0376e58 100644 --- a/samples/blink/main.cpp +++ b/samples/blink/main.cpp @@ -12,8 +12,8 @@ #include #include -namespace IO = core::IO; -namespace DEV = core::DEV; +namespace IO = core::IO; +namespace DEV = core::DEV; namespace time = core::time; int main() { diff --git a/samples/button/main.cpp b/samples/button/main.cpp index c1225772..e4181977 100644 --- a/samples/button/main.cpp +++ b/samples/button/main.cpp @@ -4,8 +4,8 @@ #include #include -namespace DEV = core::DEV; -namespace IO = core::IO; +namespace DEV = core::DEV; +namespace IO = core::IO; namespace time = core::time; int main() { @@ -13,8 +13,8 @@ int main() { core::platform::init(); // Setup UART - IO::UART& uart = IO::getUART(9600); - IO::GPIO& ledGPIO = IO::getGPIO(); + IO::UART& uart = IO::getUART(9600); + IO::GPIO& ledGPIO = IO::getGPIO(); IO::GPIO& buttonGPIO = IO::getGPIO(); DEV::LED led(ledGPIO, DEV::LED::ActiveState::HIGH); diff --git a/samples/button_debounce/main.cpp b/samples/button_debounce/main.cpp index 43a91da6..ef884926 100644 --- a/samples/button_debounce/main.cpp +++ b/samples/button_debounce/main.cpp @@ -4,8 +4,8 @@ #include #include -namespace DEV = core::DEV; -namespace IO = core::IO; +namespace DEV = core::DEV; +namespace IO = core::IO; namespace time = core::time; int main() { @@ -13,9 +13,9 @@ int main() { core::platform::init(); // Setup UART - IO::UART& uart = IO::getUART(9600); - IO::GPIO& ledGPIO = IO::getGPIO(); - IO::GPIO& buttonGPIO = IO::getGPIO(); + IO::UART& uart = IO::getUART(9600); + IO::GPIO& ledGPIO = IO::getGPIO(); + IO::GPIO& buttonGPIO = IO::getGPIO(); uint32_t debounceStart = time::millis(); DEV::LED led(ledGPIO, DEV::LED::ActiveState::HIGH); diff --git a/samples/can/back_and_forth/main.cpp b/samples/can/back_and_forth/main.cpp index bd9d956b..1ce546a8 100644 --- a/samples/can/back_and_forth/main.cpp +++ b/samples/can/back_and_forth/main.cpp @@ -9,7 +9,7 @@ #include #include -namespace IO = core::IO; +namespace IO = core::IO; namespace time = core::time; void canIRQHandler(IO::CANMessage& message, void* priv) { @@ -31,7 +31,7 @@ int main() { core::platform::init(); // Get CAN instance with loopback enabled - IO::CAN& can = IO::getCAN(); + IO::CAN& can = IO::getCAN(); IO::UART& uart = IO::getUART(9600); can.addIRQHandler(canIRQHandler, &uart); diff --git a/samples/can/loopback/main.cpp b/samples/can/loopback/main.cpp index 337a49ff..074b047f 100644 --- a/samples/can/loopback/main.cpp +++ b/samples/can/loopback/main.cpp @@ -8,7 +8,7 @@ #include #include -namespace IO = core::IO; +namespace IO = core::IO; namespace time = core::time; int main() { @@ -16,7 +16,7 @@ int main() { core::platform::init(); // Get CAN instance with loopback enabled - IO::CAN& can = IO::getCAN(true); + IO::CAN& can = IO::getCAN(true); IO::UART& uart = IO::getUART(9600); uint8_t payload[] = {0xDE, 0xAD, 0xBE, 0xBE, 0xEF, 0x00, 0x01, 0x02}; diff --git a/samples/canopen/canopen_rpdo/RPDOCanNode.cpp b/samples/canopen/canopen_rpdo/RPDOCanNode.cpp index c316d9db..4eb014fa 100644 --- a/samples/canopen/canopen_rpdo/RPDOCanNode.cpp +++ b/samples/canopen/canopen_rpdo/RPDOCanNode.cpp @@ -5,29 +5,15 @@ RPDOCanNode::RPDOCanNode() { sampleDataB = 0; } -CO_OBJ_T* RPDOCanNode::getObjectDictionary() { - return &objectDictionary[0]; -} +CO_OBJ_T* RPDOCanNode::getObjectDictionary() { return &objectDictionary[0]; } -uint8_t RPDOCanNode::getNumElements() { - return OBJECT_DICTIONARY_SIZE + 1; -} +uint8_t RPDOCanNode::getNumElements() { return OBJECT_DICTIONARY_SIZE + 1; } -void RPDOCanNode::setSampleDataA(uint8_t newValue) { - this->sampleDataA = newValue; -} +void RPDOCanNode::setSampleDataA(uint8_t newValue) { this->sampleDataA = newValue; } -uint8_t RPDOCanNode::getSampleDataA() { - return sampleDataA; -} +uint8_t RPDOCanNode::getSampleDataA() { return sampleDataA; } -void RPDOCanNode::setSampleDataB(uint16_t newValue) { - this->sampleDataB = newValue; -} +void RPDOCanNode::setSampleDataB(uint16_t newValue) { this->sampleDataB = newValue; } -uint16_t RPDOCanNode::getSampleDataB() { - return sampleDataB; -} -uint8_t RPDOCanNode::getNodeID() { - return NODE_ID; -} +uint16_t RPDOCanNode::getSampleDataB() { return sampleDataB; } +uint8_t RPDOCanNode::getNodeID() { return NODE_ID; } diff --git a/samples/canopen/canopen_rpdo/RPDOCanNode.hpp b/samples/canopen/canopen_rpdo/RPDOCanNode.hpp index 89d6fcae..d6d9cb1a 100644 --- a/samples/canopen/canopen_rpdo/RPDOCanNode.hpp +++ b/samples/canopen/canopen_rpdo/RPDOCanNode.hpp @@ -52,9 +52,9 @@ class RPDOCanNode : public CANDevice { uint8_t getNumElements() override; /** - * Get the device's node ID - * - * @return The node ID of the can device. + * Get the device's node ID + * + * @return The node ID of the can device. */ uint8_t getNodeID() override; diff --git a/samples/canopen/canopen_rpdo/main.cpp b/samples/canopen/canopen_rpdo/main.cpp index 788fae44..1139dc3a 100644 --- a/samples/canopen/canopen_rpdo/main.cpp +++ b/samples/canopen/canopen_rpdo/main.cpp @@ -16,8 +16,8 @@ #include "RPDOCanNode.hpp" -namespace IO = core::IO; -namespace DEV = core::DEV; +namespace IO = core::IO; +namespace DEV = core::DEV; namespace time = core::time; /////////////////////////////////////////////////////////////////////////////// @@ -42,7 +42,7 @@ IO::UART& uart = IO::getUART(9600); void canInterrupt(IO::CANMessage& message, void* priv) { auto* queue = (core::types::FixedQueue*) priv; - //print out raw received data + // print out raw received data uart.printf("Got RAW message from %X of length %d with data: ", message.getId(), message.getDataLength()); uint8_t* data = message.getPayload(); for (int i = 0; i < message.getDataLength(); i++) { @@ -62,7 +62,7 @@ int main() { // Initialize the timer DEV::Timer& timer = DEV::getTimer(100); - //create the RPDO node + // create the RPDO node RPDOCanNode testCanNode; /////////////////////////////////////////////////////////////////////////// @@ -96,7 +96,7 @@ int main() { // Attempt to join the CAN network IO::CAN::CANStatus result = can.connect(); - //test that the board is connected to the can network + // test that the board is connected to the can network if (result != IO::CAN::CANStatus::OK) { uart.printf("Failed to connect to CAN network\r\n"); return 1; @@ -113,17 +113,17 @@ int main() { time::wait(500); - //print any CANopen errors + // print any CANopen errors uart.printf("Error: %d\r\n", CONodeGetErr(&canNode)); /////////////////////////////////////////////////////////////////////////// // Main loop /////////////////////////////////////////////////////////////////////////// - uint8_t lastVal1 = 0; + uint8_t lastVal1 = 0; uint16_t lastVal2 = 0; while (1) { - //Print new value when changed over CAN + // Print new value when changed over CAN if (lastVal1 != testCanNode.getSampleDataA() || lastVal2 != testCanNode.getSampleDataB()) { lastVal1 = testCanNode.getSampleDataA(); lastVal2 = testCanNode.getSampleDataB(); diff --git a/samples/canopen/canopen_sample/TestCanNode.cpp b/samples/canopen/canopen_sample/TestCanNode.cpp index 5862f372..2e11d2d8 100644 --- a/samples/canopen/canopen_sample/TestCanNode.cpp +++ b/samples/canopen/canopen_sample/TestCanNode.cpp @@ -1,24 +1,12 @@ #include "TestCanNode.hpp" -TestCanNode::TestCanNode() { - sampleData = 0; -} +TestCanNode::TestCanNode() { sampleData = 0; } -void TestCanNode::setSampleData(uint8_t newValue) { - this->sampleData = newValue; -} +void TestCanNode::setSampleData(uint8_t newValue) { this->sampleData = newValue; } -uint8_t TestCanNode::getSampleData() { - return sampleData; -} +uint8_t TestCanNode::getSampleData() { return sampleData; } -CO_OBJ_T* TestCanNode::getObjectDictionary() { - return &objectDictionary[0]; -} +CO_OBJ_T* TestCanNode::getObjectDictionary() { return &objectDictionary[0]; } -uint8_t TestCanNode::getNumElements() { - return OBJECT_DICTIONARY_SIZE; -} -uint8_t TestCanNode::getNodeID() { - return NODE_ID; -} +uint8_t TestCanNode::getNumElements() { return OBJECT_DICTIONARY_SIZE; } +uint8_t TestCanNode::getNodeID() { return NODE_ID; } diff --git a/samples/canopen/canopen_sample/TestCanNode.hpp b/samples/canopen/canopen_sample/TestCanNode.hpp index cbf6fc38..13fdbfa8 100644 --- a/samples/canopen/canopen_sample/TestCanNode.hpp +++ b/samples/canopen/canopen_sample/TestCanNode.hpp @@ -50,9 +50,9 @@ class TestCanNode : public CANDevice { uint8_t getNumElements() override; /** - * Get the device's node ID - * - * @return The node ID of the can device. + * Get the device's node ID + * + * @return The node ID of the can device. */ uint8_t getNodeID() override; diff --git a/samples/canopen/canopen_sample/main.cpp b/samples/canopen/canopen_sample/main.cpp index 1b2c19af..43cbd7a3 100644 --- a/samples/canopen/canopen_sample/main.cpp +++ b/samples/canopen/canopen_sample/main.cpp @@ -20,8 +20,8 @@ #include "TestCanNode.hpp" -namespace IO = core::IO; -namespace DEV = core::DEV; +namespace IO = core::IO; +namespace DEV = core::DEV; namespace time = core::time; /////////////////////////////////////////////////////////////////////////////// @@ -88,7 +88,7 @@ int main() { // Attempt to join the CAN network IO::CAN::CANStatus result = can.connect(); - //test that the board is connected to the can network + // test that the board is connected to the can network if (result != IO::CAN::CANStatus::OK) { uart.printf("Failed to connect to CAN network\r\n"); return 1; @@ -105,7 +105,7 @@ int main() { time::wait(500); - //print any CANopen errors + // print any CANopen errors uart.printf("Error: %d\r\n", CONodeGetErr(&canNode)); /////////////////////////////////////////////////////////////////////////// diff --git a/samples/canopen/canopen_tpdo/TPDOCanNode.cpp b/samples/canopen/canopen_tpdo/TPDOCanNode.cpp index 9034b849..f28cc040 100644 --- a/samples/canopen/canopen_tpdo/TPDOCanNode.cpp +++ b/samples/canopen/canopen_tpdo/TPDOCanNode.cpp @@ -5,21 +5,13 @@ TPDOCanNode::TPDOCanNode() { sampleDataB = 1; } -void TPDOCanNode::setSampleDataA(uint8_t newValue) { - this->sampleDataA = newValue; -} +void TPDOCanNode::setSampleDataA(uint8_t newValue) { this->sampleDataA = newValue; } -uint8_t TPDOCanNode::getSampleDataA() { - return sampleDataA; -} +uint8_t TPDOCanNode::getSampleDataA() { return sampleDataA; } -void TPDOCanNode::setSampleDataB(uint16_t newValue) { - this->sampleDataB = newValue; -} +void TPDOCanNode::setSampleDataB(uint16_t newValue) { this->sampleDataB = newValue; } -uint16_t TPDOCanNode::getSampleDataB() { - return sampleDataB; -} +uint16_t TPDOCanNode::getSampleDataB() { return sampleDataB; } void TPDOCanNode::update() { sampleDataA++; @@ -28,14 +20,8 @@ void TPDOCanNode::update() { } } -CO_OBJ_T* TPDOCanNode::getObjectDictionary() { - return &objectDictionary[0]; -} +CO_OBJ_T* TPDOCanNode::getObjectDictionary() { return &objectDictionary[0]; } -uint8_t TPDOCanNode::getNumElements() { - return OBJECT_DICTIONARY_SIZE; -} +uint8_t TPDOCanNode::getNumElements() { return OBJECT_DICTIONARY_SIZE; } -uint8_t TPDOCanNode::getNodeID() { - return NODE_ID; -} +uint8_t TPDOCanNode::getNodeID() { return NODE_ID; } diff --git a/samples/canopen/canopen_tpdo/TPDOCanNode.hpp b/samples/canopen/canopen_tpdo/TPDOCanNode.hpp index cfaa632f..b8a34fa0 100644 --- a/samples/canopen/canopen_tpdo/TPDOCanNode.hpp +++ b/samples/canopen/canopen_tpdo/TPDOCanNode.hpp @@ -5,93 +5,93 @@ #include /** -* Representation of the CAN node. Handles constructing the object -* dictionary and other baseline settings. The idea is that each "board" -* will have a specific object dictionary associated with it. The object -* dictionary itself will also need to have information on "data of interest". -* For example, a temperature management system may to expose water pump -* flow rate in the object dictionary. -*/ + * Representation of the CAN node. Handles constructing the object + * dictionary and other baseline settings. The idea is that each "board" + * will have a specific object dictionary associated with it. The object + * dictionary itself will also need to have information on "data of interest". + * For example, a temperature management system may to expose water pump + * flow rate in the object dictionary. + */ class TPDOCanNode : public CANDevice { public: TPDOCanNode(); /** - * Expose a way to programmatically update the sampleData. - * - * An example use case could be temperature data that is collected - * then stored in this object. Under the hood, the object dictionary - * has the address of the temperature data, so the triggered PDO - * would also effectively be updated. - * - * @param newValue[in] The value to set sample data to - */ + * Expose a way to programmatically update the sampleData. + * + * An example use case could be temperature data that is collected + * then stored in this object. Under the hood, the object dictionary + * has the address of the temperature data, so the triggered PDO + * would also effectively be updated. + * + * @param newValue[in] The value to set sample data to + */ void setSampleDataA(uint8_t newValue); void setSampleDataB(uint16_t newValue); /** - * Get the contained sample data - * - * @return The value of the sample data - */ + * Get the contained sample data + * + * @return The value of the sample data + */ uint8_t getSampleDataA(); uint16_t getSampleDataB(); /** - * increments counters up - */ + * increments counters up + */ void update(); /** - * Get a pointer to the start of the object dictionary - * - * @return Pointer to the start of the object dictionary - */ + * Get a pointer to the start of the object dictionary + * + * @return Pointer to the start of the object dictionary + */ CO_OBJ_T* getObjectDictionary() override; /** - * Get the number of elements in the object dictionary. - * - * @return The number of elements in the object dictionary - */ + * Get the number of elements in the object dictionary. + * + * @return The number of elements in the object dictionary + */ uint8_t getNumElements() override; /** - * Get the device's node ID - * - * @return The node ID of the can device. + * Get the device's node ID + * + * @return The node ID of the can device. */ uint8_t getNodeID() override; /** - * Get the device's node ID - * - * @return The node ID of the can device. + * Get the device's node ID + * + * @return The node ID of the can device. */ static constexpr uint8_t NODE_ID = 1; private: /** - * This sample data will be exposed over CAN through the object - * dictionary. The address of the variable will be included in the - * object dictionary and can be updated via SDO via a CANopen client. - * This device will then broadcast the value via a triggered PDO. - */ + * This sample data will be exposed over CAN through the object + * dictionary. The address of the variable will be included in the + * object dictionary and can be updated via SDO via a CANopen client. + * This device will then broadcast the value via a triggered PDO. + */ uint8_t sampleDataA; uint16_t sampleDataB; /** - * Have to know the size of the object dictionary for initialization - * process. - */ + * Have to know the size of the object dictionary for initialization + * process. + */ static constexpr uint8_t OBJECT_DICTIONARY_SIZE = 24; /** - * The object dictionary itself. Will be populated by this object during - * construction. - * - * The plus one is for the special "end of dictionary" marker. - */ + * The object dictionary itself. Will be populated by this object during + * construction. + * + * The plus one is for the special "end of dictionary" marker. + */ CO_OBJ_T objectDictionary[OBJECT_DICTIONARY_SIZE + 1] = { MANDATORY_IDENTIFICATION_ENTRIES_1000_1014, HEARTBEAT_PRODUCER_1017(2000), diff --git a/samples/canopen/canopen_tpdo/main.cpp b/samples/canopen/canopen_tpdo/main.cpp index 00d8668a..6b10df9d 100644 --- a/samples/canopen/canopen_tpdo/main.cpp +++ b/samples/canopen/canopen_tpdo/main.cpp @@ -14,8 +14,8 @@ #include "TPDOCanNode.hpp" -namespace IO = core::IO; -namespace DEV = core::DEV; +namespace IO = core::IO; +namespace DEV = core::DEV; namespace time = core::time; /////////////////////////////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ IO::UART& uart = IO::getUART(9600); void canInterrupt(IO::CANMessage& message, void* priv) { auto* queue = (core::types::FixedQueue*) priv; - //print out raw received data + // print out raw received data uart.printf("Got RAW message from %X of length %d with data: ", message.getId(), message.getDataLength()); uint8_t* data = message.getPayload(); for (int i = 0; i < message.getDataLength(); i++) { @@ -53,7 +53,7 @@ void canInterrupt(IO::CANMessage& message, void* priv) { queue->append(message); } -//setup a TPDO event handler to print the raw TPDO message when sending +// setup a TPDO event handler to print the raw TPDO message when sending extern "C" void COPdoTransmit(CO_IF_FRM* frm) { uart.printf("Sending PDO as 0x%X with length %d and data: ", frm->Identifier, frm->DLC); uint8_t* data = frm->Data; @@ -68,7 +68,7 @@ int main() { // Initialize system core::platform::init(); - //create the TPDO node + // create the TPDO node TPDOCanNode testCanNode; DEV::Timer& timer = DEV::getTimer(100); @@ -103,7 +103,7 @@ int main() { // Attempt to join the CAN network IO::CAN::CANStatus result = can.connect(); - //test that the board is connected to the can network + // test that the board is connected to the can network if (result != IO::CAN::CANStatus::OK) { uart.printf("Failed to connect to CAN network\r\n"); return 1; @@ -120,17 +120,17 @@ int main() { time::wait(500); - //print any CANopen errors + // print any CANopen errors uart.printf("Error: %d\r\n", CONodeGetErr(&canNode)); /////////////////////////////////////////////////////////////////////////// // Main loop /////////////////////////////////////////////////////////////////////////// - uint8_t lastVal1 = 0; + uint8_t lastVal1 = 0; uint16_t lastVal2 = 0; while (1) { - //increment node values + // increment node values testCanNode.update(); if (lastVal1 != testCanNode.getSampleDataA() || lastVal2 != testCanNode.getSampleDataB()) { lastVal1 = testCanNode.getSampleDataA(); diff --git a/samples/eeprom/main.cpp b/samples/eeprom/main.cpp index 9963267b..a2fff308 100644 --- a/samples/eeprom/main.cpp +++ b/samples/eeprom/main.cpp @@ -9,22 +9,23 @@ #include #include -namespace IO = core::IO; +namespace IO = core::IO; namespace DEV = core::DEV; /** * The address of the EEPROM listening for reads/writes * Set up for M24C23 with all enable values set to 0 - * Docs can be found here: https://www.st.com/content/ccc/resource/technical/document/datasheet/80/4e/8c/54/f2/63/4c/4a/CD00001012.pdf/files/CD00001012.pdf/jcr:content/translations/en.CD00001012.pdf + * Docs can be found here: + * https://www.st.com/content/ccc/resource/technical/document/datasheet/80/4e/8c/54/f2/63/4c/4a/CD00001012.pdf/files/CD00001012.pdf/jcr:content/translations/en.CD00001012.pdf */ constexpr uint8_t I2C_SLAVE_ADDR = 0x50; -constexpr uint8_t BYTE_ADDRESS = 0x00; -constexpr uint8_t HALF_WORD_ADDRESS = 0x01; -constexpr uint8_t WORD_ADDRESS = 0x03; -constexpr uint8_t BYTE_ARR_ADDRESS = 0x07; +constexpr uint8_t BYTE_ADDRESS = 0x00; +constexpr uint8_t HALF_WORD_ADDRESS = 0x01; +constexpr uint8_t WORD_ADDRESS = 0x03; +constexpr uint8_t BYTE_ARR_ADDRESS = 0x07; constexpr uint8_t HALF_WORD_ARR_ADDRESS = 0x09; -constexpr uint8_t WORD_ARR_ADDRESS = 0x13; +constexpr uint8_t WORD_ARR_ADDRESS = 0x13; /** * NOTE: This address is picked to highlight a potential issue. The EEPROM @@ -32,26 +33,26 @@ constexpr uint8_t WORD_ARR_ADDRESS = 0x13; * to write beyound the page size will cause a wrap around of writing. This * issue should now be address in the EVT-core driver. */ -constexpr uint8_t PAGE_BREAK_EXAMPLE_ADDRESS = 0x3C; -constexpr uint8_t PAGE_BREAK_EXAMPLE_LENGTH = 7; +constexpr uint8_t PAGE_BREAK_EXAMPLE_ADDRESS = 0x3C; +constexpr uint8_t PAGE_BREAK_EXAMPLE_LENGTH = 7; uint8_t PAGE_BREAK_EXAMPLE_DATA[PAGE_BREAK_EXAMPLE_LENGTH] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; -constexpr uint8_t BYTE_DATA = 0xaa; -constexpr uint16_t HALF_WORD_DATA = 0xabcd; -constexpr uint32_t WORD_DATA = 0xfedcba98; -constexpr uint8_t BYTE_ARR_LENGTH = 2; -uint8_t BYTE_ARR_DATA[BYTE_ARR_LENGTH] = {0xab, 0xba}; -constexpr uint8_t HALF_WORD_ARR_LENGTH = 2; +constexpr uint8_t BYTE_DATA = 0xaa; +constexpr uint16_t HALF_WORD_DATA = 0xabcd; +constexpr uint32_t WORD_DATA = 0xfedcba98; +constexpr uint8_t BYTE_ARR_LENGTH = 2; +uint8_t BYTE_ARR_DATA[BYTE_ARR_LENGTH] = {0xab, 0xba}; +constexpr uint8_t HALF_WORD_ARR_LENGTH = 2; uint16_t HALF_WORD_ARR_DATA[HALF_WORD_ARR_LENGTH] = {0xbbbb, 0xcccc}; -constexpr uint8_t WORD_ARR_LENGTH = 2; -uint32_t WORD_ARR_DATA[WORD_ARR_LENGTH] = {0x01234567, 0x89abcdef}; +constexpr uint8_t WORD_ARR_LENGTH = 2; +uint32_t WORD_ARR_DATA[WORD_ARR_LENGTH] = {0x01234567, 0x89abcdef}; int main() { // Initialize system core::platform::init(); - IO::I2C& i2c = IO::getI2C(); - IO::UART& uart = IO::getUART(9600); + IO::I2C& i2c = IO::getI2C(); + IO::UART& uart = IO::getUART(9600); DEV::M24C32 eeprom = DEV::M24C32(I2C_SLAVE_ADDR, i2c); uart.printf("Starting EEPROM test\n\r"); diff --git a/samples/encoder/main.cpp b/samples/encoder/main.cpp index e536cf39..736082c0 100644 --- a/samples/encoder/main.cpp +++ b/samples/encoder/main.cpp @@ -2,7 +2,7 @@ * This example demonstrates how to utilize the encoder object, * Two pins are used to read the encoder values via interrupts * Static wrappers are necessary for the encoder to handle the pin interrupts -*/ + */ #include #include @@ -11,22 +11,22 @@ #include #include -namespace IO = core::IO; -namespace DEV = core::DEV; +namespace IO = core::IO; +namespace DEV = core::DEV; namespace time = core::time; -namespace log = core::log; +namespace log = core::log; constexpr IO::Pin A_PIN = IO::Pin::PA_8; constexpr IO::Pin B_PIN = IO::Pin::PA_9; int main() { - //Init platform + // Init platform core::platform::init(); IO::UART& uart = IO::getUART(9600, true); uart.printf("\n\rSTARTING ENCODER TEST\n\r"); - //init logger + // init logger log::LOGGER.setUART(&uart); log::LOGGER.setLogLevel(log::Logger::LogLevel::DEBUG); @@ -36,15 +36,16 @@ int main() { DEV::Encoder encoder(pinA, pinB, 18, 0, true); while (1) { - //ENCODER MUST BE UPDATED EACH LOOP - //Read the position of the encoder, which for this example will be in the range [0, 18] + // ENCODER MUST BE UPDATED EACH LOOP + // Read the position of the encoder, which for this example will be in the range [0, 18] uint64_t position = encoder.getPosition(); - //PRINT VALUES (only enable one at a time) - //uart.printf("\r Encoder Change: %d ", change); + // PRINT VALUES (only enable one at a time) + // uart.printf("\r Encoder Change: %d ", change); uart.printf("\rPosition: %d ", position); - //The wait simulates a loop that is doing other processing, because that will affect how often the output is read + // The wait simulates a loop that is doing other processing, because that will affect how often the output is + // read time::wait(1000); } } diff --git a/samples/gpio_interrupt/main.cpp b/samples/gpio_interrupt/main.cpp index 8b465606..6e0e4016 100644 --- a/samples/gpio_interrupt/main.cpp +++ b/samples/gpio_interrupt/main.cpp @@ -9,7 +9,7 @@ namespace IO = core::IO; -constexpr int BAUD_RATE = 9600; +constexpr int BAUD_RATE = 9600; constexpr IO::Pin INTERRUPT_PIN = IO::Pin::PC_3; IO::UART* uart; @@ -32,10 +32,8 @@ int main() { uart = &IO::getUART(BAUD_RATE); // Set the GPIO interrupt - IO::GPIO& interruptGPIO = IO::getGPIO( - IO::GPIO::Direction::INPUT); - interruptGPIO.registerIRQ(IO::GPIO::TriggerEdge::RISING_FALLING, - risingEdgeHandler, nullptr); + IO::GPIO& interruptGPIO = IO::getGPIO(IO::GPIO::Direction::INPUT); + interruptGPIO.registerIRQ(IO::GPIO::TriggerEdge::RISING_FALLING, risingEdgeHandler, nullptr); uart->printf("\n\rWaiting for interrupts...\n\r"); diff --git a/samples/i2c/main.cpp b/samples/i2c/main.cpp index 71e07b18..1cb42779 100644 --- a/samples/i2c/main.cpp +++ b/samples/i2c/main.cpp @@ -12,7 +12,7 @@ #include #include -namespace IO = core::IO; +namespace IO = core::IO; namespace time = core::time; /** The address of the arduino listening for I2C requests */ @@ -26,7 +26,7 @@ int main() { // Initialize system core::platform::init(); - IO::I2C& i2c = IO::getI2C(); + IO::I2C& i2c = IO::getI2C(); IO::UART& uart = IO::getUART(9600); uart.printf("Starting I2C test\n\r"); @@ -38,8 +38,7 @@ int main() { uint8_t oValue; IO::I2C::I2CStatus status = i2c.readReg(I2C_SLAVE_ADDR, O_REGISTER, &oValue); if (status != IO::I2C::I2CStatus::OK) { - uart.printf("Failed read 'o' register with I2C::I2CStatus: %d\n\r", - status); + uart.printf("Failed read 'o' register with I2C::I2CStatus: %d\n\r", status); break; } @@ -49,8 +48,7 @@ int main() { uint8_t kValue; status = i2c.readReg(I2C_SLAVE_ADDR, K_REGISTER, &kValue); if (status != IO::I2C::I2CStatus::OK) { - uart.printf("Failed read 'k' register with I2C::I2CStatus: %d\n\r", - status); + uart.printf("Failed read 'k' register with I2C::I2CStatus: %d\n\r", status); break; } diff --git a/samples/iwdg/main.cpp b/samples/iwdg/main.cpp index 9249d779..1d011139 100644 --- a/samples/iwdg/main.cpp +++ b/samples/iwdg/main.cpp @@ -5,8 +5,8 @@ #include #include -namespace IO = core::IO; -namespace DEV = core::DEV; +namespace IO = core::IO; +namespace DEV = core::DEV; namespace time = core::time; int main() { diff --git a/samples/lcd/basic/main.cpp b/samples/lcd/basic/main.cpp index 400eaa44..145b43ca 100644 --- a/samples/lcd/basic/main.cpp +++ b/samples/lcd/basic/main.cpp @@ -9,8 +9,8 @@ #include #include -namespace DEV = core::DEV; -namespace IO = core::IO; +namespace DEV = core::DEV; +namespace IO = core::IO; namespace time = core::time; constexpr uint32_t SPI_SPEED = SPI_SPEED_500KHZ; @@ -28,7 +28,8 @@ int main() { // Uses HUDL 1.0 Pins IO::GPIO& regSelect = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); - IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + devices[0] = &IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); devices[0]->writePin(IO::GPIO::State::HIGH); @@ -43,12 +44,13 @@ int main() { lcd.initLCD(); lcd.clearLCD(); - const char* text = R"( !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~)"; + const char* text = + R"( !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~)"; lcd.writeText(text, 0, 0, core::DEV::LCD::SMALL, true); uint8_t ball[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - uint8_t col = 0; - uint8_t page = 4; + uint8_t col = 0; + uint8_t page = 4; lcd.displayBitMapInArea(ball, 8, 1, page, col); diff --git a/samples/lcd/lcd-alphabet/main.cpp b/samples/lcd/lcd-alphabet/main.cpp index c2b5ef29..6169aa33 100644 --- a/samples/lcd/lcd-alphabet/main.cpp +++ b/samples/lcd/lcd-alphabet/main.cpp @@ -1,14 +1,14 @@ /** -* Sample code for displaying the Alphabet on an LCD. -*/ + * Sample code for displaying the Alphabet on an LCD. + */ #include #include #include #include -namespace DEV = core::DEV; -namespace IO = core::IO; +namespace DEV = core::DEV; +namespace IO = core::IO; namespace time = core::time; constexpr uint32_t SPI_SPEED = SPI_SPEED_500KHZ; @@ -26,7 +26,8 @@ int main() { // Uses HUDL 1.0 Pins IO::GPIO& regSelect = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); - IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + devices[0] = &IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); devices[0]->writePin(IO::GPIO::State::HIGH); @@ -41,7 +42,8 @@ int main() { lcd.initLCD(); lcd.clearLCD(); - const char* text = R"( !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~)"; + const char* text = + R"( !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~)"; lcd.writeText(text, 0, 0, core::DEV::LCD::SMALL, true); return 0; diff --git a/samples/lcd/lcd-ball/main.cpp b/samples/lcd/lcd-ball/main.cpp index 3667d995..8495499e 100644 --- a/samples/lcd/lcd-ball/main.cpp +++ b/samples/lcd/lcd-ball/main.cpp @@ -1,6 +1,6 @@ /** -* Sample code for displaying a moving ball animation on an LCD. -*/ + * Sample code for displaying a moving ball animation on an LCD. + */ #include #include @@ -8,8 +8,8 @@ #include #include -namespace DEV = core::DEV; -namespace IO = core::IO; +namespace DEV = core::DEV; +namespace IO = core::IO; namespace time = core::time; constexpr uint32_t SPI_SPEED = SPI_SPEED_500KHZ; @@ -27,7 +27,8 @@ int main() { // Uses HUDL 1.0 Pins IO::GPIO& regSelect = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); - IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + devices[0] = &IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); devices[0]->writePin(IO::GPIO::State::HIGH); @@ -43,8 +44,8 @@ int main() { lcd.clearLCD(); uint8_t ball[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - uint8_t col = 0; - uint8_t page = 0; + uint8_t col = 0; + uint8_t page = 0; lcd.displayBitMapInArea(ball, 8, 1, page, col); diff --git a/samples/lcd/lcd-counter/main.cpp b/samples/lcd/lcd-counter/main.cpp index d15ffb1d..79bdd299 100644 --- a/samples/lcd/lcd-counter/main.cpp +++ b/samples/lcd/lcd-counter/main.cpp @@ -1,6 +1,6 @@ /** -* Sample code for displaying a counting number on the LCD display. -*/ + * Sample code for displaying a counting number on the LCD display. + */ #include #include @@ -9,8 +9,8 @@ #include #include -namespace DEV = core::DEV; -namespace IO = core::IO; +namespace DEV = core::DEV; +namespace IO = core::IO; namespace time = core::time; constexpr uint32_t SPI_SPEED = SPI_SPEED_500KHZ; @@ -28,7 +28,8 @@ int main() { // Uses HUDL 1.0 Pins IO::GPIO& regSelect = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); - IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + devices[0] = &IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); devices[0]->writePin(IO::GPIO::State::HIGH); diff --git a/samples/lcd/lcd-evt-logo/main.cpp b/samples/lcd/lcd-evt-logo/main.cpp index 1b9b67c5..80bd3dc1 100644 --- a/samples/lcd/lcd-evt-logo/main.cpp +++ b/samples/lcd/lcd-evt-logo/main.cpp @@ -1,6 +1,6 @@ /** -* Sample code for displaying EVT logo onto an LCD display. -*/ + * Sample code for displaying EVT logo onto an LCD display. + */ #include #include @@ -12,8 +12,8 @@ * Sample code for displaying EVT logo onto an LCD display */ -namespace DEV = core::DEV; -namespace IO = core::IO; +namespace DEV = core::DEV; +namespace IO = core::IO; namespace time = core::time; constexpr uint32_t SPI_SPEED = SPI_SPEED_500KHZ; @@ -23,70 +23,60 @@ constexpr uint8_t deviceCount = 1; IO::GPIO* devices[deviceCount]; unsigned char evtBitMap[1024] = { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x3F, 0x3F, 0x3F, - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, - 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, - 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xF7, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, - 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x18, 0x1F, - 0x1F, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1F, - 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, - 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, - 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x9F, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x01, 0x00, 0x00, - 0x00, 0x00, 0xC0, 0xF8, 0xFE, 0xFF, 0xFF, 0x3F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, - 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFB, 0xF8, 0xF8, 0x78, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, - 0xF8, 0xFF, 0xFF, 0x3F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, - 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xF3, 0xF0, 0xF0, - 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x0F, 0x07, 0x01, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF0, 0xF0, - 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFC, 0xFF, 0xFF, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, - 0xF8, 0xF8, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x1F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, - 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x9F, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, - 0x01, 0x01, 0x00, 0xC0, 0xE0, 0xE0, 0xF0, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0xE0, 0xFE, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xF1, - 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, - 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF8, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, - 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, + 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x80, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF8, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xF0, 0xF0, 0xF0, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0xF0, 0xF0, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x18, + 0x1F, 0x1F, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x7F, 0x3F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x9F, 0xFF, 0xFF, 0xFF, + 0x7F, 0x1F, 0x01, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF8, 0xFE, 0xFF, 0xFF, 0x3F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFB, 0xF8, 0xF8, 0x78, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xFF, 0xFF, 0x3F, + 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, + 0xF8, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xF3, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xC0, 0x00, + 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x1F, 0x0F, 0x07, 0x01, 0x00, 0x00, 0x80, 0xC0, 0xE0, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xFC, 0xFF, 0xFF, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, + 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, + 0x1F, 0x1F, 0x9F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x03, 0x01, 0x01, 0x00, 0xC0, 0xE0, 0xE0, 0xF0, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0x7F, 0x3F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0xE0, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xF7, 0xF1, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF8, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF8, 0xFC, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF7, 0xF0, 0xF0, + 0xF0, 0xF0, 0xF0, 0xF0, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; int main() { // Initialize system @@ -97,7 +87,8 @@ int main() { // Uses HUDL 1.0 Pins IO::GPIO& regSelect = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); - IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + devices[0] = &IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); devices[0]->writePin(IO::GPIO::State::HIGH); diff --git a/samples/lcd/lcd-more-sections/main.cpp b/samples/lcd/lcd-more-sections/main.cpp index 4a0be979..d8650357 100644 --- a/samples/lcd/lcd-more-sections/main.cpp +++ b/samples/lcd/lcd-more-sections/main.cpp @@ -1,6 +1,6 @@ /** -* Sample code for display data on an LCD with more than the default sections -*/ + * Sample code for display data on an LCD with more than the default sections + */ #include #include @@ -9,8 +9,8 @@ #include #include -namespace DEV = core::DEV; -namespace IO = core::IO; +namespace DEV = core::DEV; +namespace IO = core::IO; namespace time = core::time; constexpr uint32_t SPI_SPEED = SPI_SPEED_500KHZ; @@ -28,7 +28,8 @@ int main() { // Uses HUDL 1.0 Pins IO::GPIO& regSelect = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); - IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + devices[0] = &IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); devices[0]->writePin(IO::GPIO::State::HIGH); diff --git a/samples/lcd/lcd-segment/main.cpp b/samples/lcd/lcd-segment/main.cpp index 313e3168..9658f2f3 100644 --- a/samples/lcd/lcd-segment/main.cpp +++ b/samples/lcd/lcd-segment/main.cpp @@ -1,6 +1,6 @@ /** -* Sample code for displaying a segmented display on an LCD. -*/ + * Sample code for displaying a segmented display on an LCD. + */ #include @@ -10,8 +10,8 @@ #include #include -namespace DEV = core::DEV; -namespace IO = core::IO; +namespace DEV = core::DEV; +namespace IO = core::IO; namespace time = core::time; constexpr uint32_t SPI_SPEED = SPI_SPEED_500KHZ; @@ -29,7 +29,8 @@ int main() { // Uses HUDL 1.0 Pins IO::GPIO& regSelect = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); - IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + IO::GPIO& reset = IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); + devices[0] = &IO::getGPIO(core::IO::GPIO::Direction::OUTPUT); devices[0]->writePin(IO::GPIO::State::HIGH); diff --git a/samples/log/main.cpp b/samples/log/main.cpp index f8812a0e..ee73fb91 100644 --- a/samples/log/main.cpp +++ b/samples/log/main.cpp @@ -10,7 +10,7 @@ #include #include -namespace IO = core::IO; +namespace IO = core::IO; namespace log = core::log; namespace DEV = core::DEV; @@ -36,8 +36,6 @@ int main() { // Attempt to log a statement at each log level log::LOGGER.log(log::Logger::LogLevel::DEBUG, "Log 0"); log::LOGGER.log(log::Logger::LogLevel::INFO, "Log 1"); - log::LOGGER.log(log::Logger::LogLevel::WARNING, - "Log 2 - %x", sampleData); - log::LOGGER.log(log::Logger::LogLevel::ERROR, - "Log 3 - %d", sampleData); + log::LOGGER.log(log::Logger::LogLevel::WARNING, "Log 2 - %x", sampleData); + log::LOGGER.log(log::Logger::LogLevel::ERROR, "Log 3 - %d", sampleData); } diff --git a/samples/millis/main.cpp b/samples/millis/main.cpp index 03b250e7..e7e3effa 100644 --- a/samples/millis/main.cpp +++ b/samples/millis/main.cpp @@ -9,8 +9,8 @@ #include #include -namespace IO = core::IO; -namespace DEV = core::DEV; +namespace IO = core::IO; +namespace DEV = core::DEV; namespace time = core::time; int main() { diff --git a/samples/pwm/main.cpp b/samples/pwm/main.cpp index 445e8cf3..b23e4302 100644 --- a/samples/pwm/main.cpp +++ b/samples/pwm/main.cpp @@ -6,7 +6,7 @@ #include #include -namespace IO = core::IO; +namespace IO = core::IO; namespace time = core::time; int main() { diff --git a/samples/queue/main.cpp b/samples/queue/main.cpp index 6da624f1..704efee7 100644 --- a/samples/queue/main.cpp +++ b/samples/queue/main.cpp @@ -10,7 +10,7 @@ #include #include -namespace IO = core::IO; +namespace IO = core::IO; namespace types = core::types; /** @@ -37,9 +37,7 @@ class TestClass { } // For easier debugging - void print(IO::UART* uart) { - uart->printf("TestClass(a = %d, b = %d, c = %d)", a, b, c); - } + void print(IO::UART* uart) { uart->printf("TestClass(a = %d, b = %d, c = %d)", a, b, c); } }; int main() { @@ -80,8 +78,7 @@ int main() { // Try to pop from empty queue int value; - uart.printf("numberQueue.pop() success ? ->%d\r\n", - numberQueue.pop(&value)); + uart.printf("numberQueue.pop() success ? ->%d\r\n", numberQueue.pop(&value)); /////////////////////////////////////////////////////////////////////////// // Test a queue of numbers, with overwritting @@ -94,10 +91,8 @@ int main() { uart.printf("numberQueueOverwrite.append(%d)\n\r", i); numberQueueOverwrite.append(i); } - uart.printf("numberQueueOverwrite.isFull() -> %d\r\n", - numberQueueOverwrite.isFull()); - uart.printf("numberQueueOverwrite.canInsert() -> %d\r\n", - numberQueueOverwrite.canInsert()); + uart.printf("numberQueueOverwrite.isFull() -> %d\r\n", numberQueueOverwrite.isFull()); + uart.printf("numberQueueOverwrite.canInsert() -> %d\r\n", numberQueueOverwrite.canInsert()); // Add ten more numbers for (int i = 10; i < 20; i++) { diff --git a/samples/read_write/main.cpp b/samples/read_write/main.cpp index 3b9901a5..6d4c60fe 100644 --- a/samples/read_write/main.cpp +++ b/samples/read_write/main.cpp @@ -9,8 +9,8 @@ #include #include -namespace IO = core::IO; -namespace DEV = core::DEV; +namespace IO = core::IO; +namespace DEV = core::DEV; namespace time = core::time; int main() { @@ -18,8 +18,7 @@ int main() { core::platform::init(); // Setup the GPIO input pin - IO::GPIO& inputGPIO = IO::getGPIO( - IO::GPIO::Direction::INPUT); + IO::GPIO& inputGPIO = IO::getGPIO(IO::GPIO::Direction::INPUT); // Setup the GPIO output pin IO::GPIO& ledGPIO = IO::getGPIO(); diff --git a/samples/rtc/main.cpp b/samples/rtc/main.cpp index deeded7c..0aa5a5dc 100644 --- a/samples/rtc/main.cpp +++ b/samples/rtc/main.cpp @@ -6,8 +6,8 @@ #include #include -namespace IO = core::IO; -namespace DEV = core::DEV; +namespace IO = core::IO; +namespace DEV = core::DEV; namespace time = core::time; int main() { @@ -19,11 +19,11 @@ int main() { // Start RTC and set the default time time::TimeStamp time; - time.year = 24; + time.year = 24; time.month = 4; - time.day = 8; + time.day = 8; - time.hour = 19; + time.hour = 19; time.minute = 23; time.second = 55; @@ -37,9 +37,7 @@ int main() { while (1) { rtc.getTime(time); - uart.printf("%d/%d/%d %d:%d:%d\r\n", - time.day, time.month, time.year, - time.hour, time.minute, time.second); + uart.printf("%d/%d/%d %d:%d:%d\r\n", time.day, time.month, time.year, time.hour, time.minute, time.second); epochTime = rtc.getTime(); uart.printf("Timestamp since Epoch: %d\r\n\r\n", epochTime); diff --git a/samples/rtc_timer/main.cpp b/samples/rtc_timer/main.cpp index 6ab12a9b..2634958e 100644 --- a/samples/rtc_timer/main.cpp +++ b/samples/rtc_timer/main.cpp @@ -3,7 +3,7 @@ #include -namespace IO = core::IO; +namespace IO = core::IO; namespace DEV = core::DEV; int main() { @@ -11,7 +11,7 @@ int main() { IO::UART& uart = IO::getUART(9600); - //Specific implementation of DEV::RTC, clock type can vary + // Specific implementation of DEV::RTC, clock type can vary DEV::RTC& clock = DEV::getRTC(); DEV::RTCTimer timer(clock, 5000); @@ -23,10 +23,10 @@ int main() { time::wait(1000); uart.printf("Stopped...\r\n"); timer.stopTimer(); - uart.printf("Current time: %d\r\n", timer.getTime());// should be same + uart.printf("Current time: %d\r\n", timer.getTime()); // should be same uart.printf("Waiting...\r\n"); time::wait(1000); - uart.printf("Current time: %d\r\n", timer.getTime());// should be same + uart.printf("Current time: %d\r\n", timer.getTime()); // should be same timer.startTimer(); while (1) { diff --git a/samples/rtos/dynamic-threads/main.cpp b/samples/rtos/dynamic-threads/main.cpp index ed6f8b53..e5911de0 100644 --- a/samples/rtos/dynamic-threads/main.cpp +++ b/samples/rtos/dynamic-threads/main.cpp @@ -11,17 +11,17 @@ #include #include -///Namespaces -namespace IO = core::IO; -namespace DEV = core::DEV; +/// Namespaces +namespace IO = core::IO; +namespace DEV = core::DEV; namespace time = core::time; -///Defines -#define DEMO_STACK_SIZE 1024 -#define DEMO_QUEUE_SIZE 100 +/// Defines +#define DEMO_STACK_SIZE 1024 +#define DEMO_QUEUE_SIZE 100 #define TX_APP_MEM_POOL_SIZE 6536 -///Variables +/// Variables static UCHAR tx_byte_pool_buffer[TX_APP_MEM_POOL_SIZE]; static TX_BYTE_POOL tx_app_byte_pool; TX_QUEUE queue_0; @@ -31,7 +31,7 @@ const int ThreadNum = 2; TX_THREAD generator; TX_THREAD event; -///Function Prototypes +/// Function Prototypes void generator_entry(ULONG thread_input); void worker_entry(ULONG thread_input); void event_entry(ULONG thread_input); @@ -48,11 +48,19 @@ ThreadData dataArray[ThreadNum + 1]; void ThreadCreator(TX_BYTE_POOL* byte_pool, TX_THREAD* thread, EntryFunction thread_entry, ULONG thread_input) { IO::UART& uart = IO::getUART(9600); - char* pointer = static_cast(TX_NULL); + char* pointer = static_cast(TX_NULL); tx_byte_allocate(byte_pool, (void**) &pointer, DEMO_STACK_SIZE, TX_NO_WAIT); - ULONG status = tx_thread_create(thread, "dynamic thread", thread_entry, thread_input, pointer, - DEMO_STACK_SIZE, 1, 1, TX_NO_TIME_SLICE, TX_AUTO_START); + ULONG status = tx_thread_create(thread, + "dynamic thread", + thread_entry, + thread_input, + pointer, + DEMO_STACK_SIZE, + 1, + 1, + TX_NO_TIME_SLICE, + TX_AUTO_START); if (status != TX_SUCCESS) { uart.printf("\n\rThread not be created %lu\n\r", status); @@ -67,14 +75,14 @@ void tx_application_define(void* first_unused_memory) { void* memory_ptr; IO::UART& uart = IO::getUART(9600); - if (tx_byte_pool_create(&tx_app_byte_pool, "Tx App memory pool", tx_byte_pool_buffer, TX_APP_MEM_POOL_SIZE) != TX_SUCCESS) { + if (tx_byte_pool_create(&tx_app_byte_pool, "Tx App memory pool", tx_byte_pool_buffer, TX_APP_MEM_POOL_SIZE) + != TX_SUCCESS) { uart.printf("\n\rByte pool could not be created\n\r"); } else { - memory_ptr = (void*) &tx_app_byte_pool; + memory_ptr = (void*) &tx_app_byte_pool; TX_BYTE_POOL* byte_pool = (TX_BYTE_POOL*) memory_ptr; - tx_queue_create(&queue_0, "queue 0", TX_1_ULONG, tx_byte_pool_buffer, - DEMO_QUEUE_SIZE * sizeof(ULONG)); + tx_queue_create(&queue_0, "queue 0", TX_1_ULONG, tx_byte_pool_buffer, DEMO_QUEUE_SIZE * sizeof(ULONG)); tx_semaphore_create(&semaphore_0, "counting semaphore 0", 1); @@ -103,12 +111,12 @@ int main() { return 0; } -ULONG global_count = 0;//Times a random number has been sent and received -ULONG global_sum = 0; //Sum of random numbers +ULONG global_count = 0; // Times a random number has been sent and received +ULONG global_sum = 0; // Sum of random numbers ULONG generator_count = 0; -ULONG generator_sum = 0; +ULONG generator_sum = 0; -///Function declarations +/// Function declarations void generator_entry(ULONG thread_input) { // Setup UART IO::UART& uart = IO::getUART(9600); @@ -144,25 +152,33 @@ void generator_entry(ULONG thread_input) { "\tcount: %lu\r\n" "\tsum: %lu\r\n" "\taverage: %lu\r\n", - global_count, global_sum, global_sum / global_count); + global_count, + global_sum, + global_sum / global_count); uart.printf("Generator:\r\n" "\tcount: %lu\r\n" "\tsum: %lu\r\n" "\taverage: %lu\r\n", - generator_count, generator_sum, generator_sum / generator_count); + generator_count, + generator_sum, + generator_sum / generator_count); uart.printf("Worker 1:\r\n" "\tsum: %lu\r\n" "\tcount: %lu\r\n" "\taverage: %lu\r\n", - data1->sum, data1->count, data1->sum / data1->count); + data1->sum, + data1->count, + data1->sum / data1->count); uart.printf("Worker 2:\r\n" "\tsum: %lu\r\n" "\tcount: %lu\r\n" "\taverage: %lu\r\n\r\n", - data2->sum, data2->count, data2->sum / data2->count); + data2->sum, + data2->count, + data2->sum / data2->count); } tx_semaphore_put(&semaphore_0); tx_thread_sleep(TX_TIMER_TICKS_PER_SECOND * 1); @@ -183,8 +199,7 @@ void worker_entry(ULONG thread_input) { while (1) { /* Retrieve a message from the queue. */ - queue_status = tx_queue_receive(&queue_0, &received_message, - TX_WAIT_FOREVER); + queue_status = tx_queue_receive(&queue_0, &received_message, TX_WAIT_FOREVER); /* Get the semaphore with suspension. */ tx_semaphore_get(&semaphore_0, TX_WAIT_FOREVER); @@ -205,7 +220,10 @@ void worker_entry(ULONG thread_input) { "\tcount: %lu\r\n" "\tsum: %lu\r\n" "\r\n", - thread_input + 1, received_message, data->count, data->sum); + thread_input + 1, + received_message, + data->count, + data->sum); tx_semaphore_put(&semaphore_0); tx_thread_sleep(TX_TIMER_TICKS_PER_SECOND * 1); diff --git a/samples/rtos/threadx-demo/main.cpp b/samples/rtos/threadx-demo/main.cpp index e1c3d0ac..45912ab2 100644 --- a/samples/rtos/threadx-demo/main.cpp +++ b/samples/rtos/threadx-demo/main.cpp @@ -10,20 +10,20 @@ #include #include -///Namespaces -namespace IO = core::IO; -namespace DEV = core::DEV; +/// Namespaces +namespace IO = core::IO; +namespace DEV = core::DEV; namespace time = core::time; -//Needs custom data type -//Look into entry argument when creating a thread when determining what thread it is +// Needs custom data type +// Look into entry argument when creating a thread when determining what thread it is -///Defines -#define DEMO_STACK_SIZE 1024 -#define DEMO_QUEUE_SIZE 100 +/// Defines +#define DEMO_STACK_SIZE 1024 +#define DEMO_QUEUE_SIZE 100 #define TX_APP_MEM_POOL_SIZE 6536 -///Variables +/// Variables static UCHAR tx_byte_pool_buffer[TX_APP_MEM_POOL_SIZE]; static TX_BYTE_POOL tx_app_byte_pool; @@ -35,18 +35,19 @@ TX_QUEUE queue_0; TX_SEMAPHORE semaphore_0; TX_EVENT_FLAGS_GROUP event_flags_0; -///Function Prototypes +/// Function Prototypes void thread_0_entry(ULONG thread_input); void thread_1_entry(ULONG thread_input); void thread_2_entry(ULONG thread_input); void thread_3_entry(ULONG thread_input); -//Merged tx_application_define and App_ThreadX_Init functions +// Merged tx_application_define and App_ThreadX_Init functions VOID tx_application_define(VOID* first_unused_memory) { VOID* memory_ptr; IO::UART& uart = IO::getUART(9600); - if (tx_byte_pool_create(&tx_app_byte_pool, "Tx App memory pool", tx_byte_pool_buffer, TX_APP_MEM_POOL_SIZE) != TX_SUCCESS) { + if (tx_byte_pool_create(&tx_app_byte_pool, "Tx App memory pool", tx_byte_pool_buffer, TX_APP_MEM_POOL_SIZE) + != TX_SUCCESS) { uart.printf("\n\rByte pool could not be created\n\r"); } else { @@ -61,33 +62,64 @@ VOID tx_application_define(VOID* first_unused_memory) { tx_byte_allocate(byte_pool, (VOID**) &pointer, DEMO_STACK_SIZE, TX_NO_WAIT); /* Create the main thread 0. */ - tx_thread_create(&thread_0, "thread 0", thread_0_entry, 0, pointer, - DEMO_STACK_SIZE, 1, 1, TX_NO_TIME_SLICE, TX_AUTO_START); + tx_thread_create(&thread_0, + "thread 0", + thread_0_entry, + 0, + pointer, + DEMO_STACK_SIZE, + 1, + 1, + TX_NO_TIME_SLICE, + TX_AUTO_START); /* Allocate the stack for thread 1. */ tx_byte_allocate(byte_pool, (VOID**) &pointer, DEMO_STACK_SIZE, TX_NO_WAIT); /* Create the main thread 1. */ - tx_thread_create(&thread_1, "thread 1", thread_1_entry, 0, pointer, - DEMO_STACK_SIZE, 1, 1, TX_NO_TIME_SLICE, TX_AUTO_START); + tx_thread_create(&thread_1, + "thread 1", + thread_1_entry, + 0, + pointer, + DEMO_STACK_SIZE, + 1, + 1, + TX_NO_TIME_SLICE, + TX_AUTO_START); /* Allocate the stack for thread 2. */ tx_byte_allocate(byte_pool, (VOID**) &pointer, DEMO_STACK_SIZE, TX_NO_WAIT); /* Create the main thread 2. */ - tx_thread_create(&thread_2, "thread 2", thread_2_entry, 0, pointer, - DEMO_STACK_SIZE, 1, 1, TX_NO_TIME_SLICE, TX_AUTO_START); + tx_thread_create(&thread_2, + "thread 2", + thread_2_entry, + 0, + pointer, + DEMO_STACK_SIZE, + 1, + 1, + TX_NO_TIME_SLICE, + TX_AUTO_START); /* Allocate the stack for thread 3. */ tx_byte_allocate(byte_pool, (VOID**) &pointer, DEMO_STACK_SIZE, TX_NO_WAIT); /* Create the main thread 3. */ - tx_thread_create(&thread_3, "thread 3", thread_3_entry, 0, pointer, - DEMO_STACK_SIZE, 1, 1, TX_NO_TIME_SLICE, TX_AUTO_START); + tx_thread_create(&thread_3, + "thread 3", + thread_3_entry, + 0, + pointer, + DEMO_STACK_SIZE, + 1, + 1, + TX_NO_TIME_SLICE, + TX_AUTO_START); /* Create the message queue shared by all threads. */ - tx_queue_create(&queue_0, "queue 0", TX_1_ULONG, pointer, - DEMO_QUEUE_SIZE * sizeof(ULONG)); + tx_queue_create(&queue_0, "queue 0", TX_1_ULONG, pointer, DEMO_QUEUE_SIZE * sizeof(ULONG)); /* Create the semaphore used by all threads. */ tx_semaphore_create(&semaphore_0, "counting semaphore 0", 1); @@ -111,16 +143,16 @@ int main() { return 0; } -ULONG global_count = 0;//Times a random number has been sent and received -ULONG global_sum = 0; //Sum of random numbers +ULONG global_count = 0; // Times a random number has been sent and received +ULONG global_sum = 0; // Sum of random numbers ULONG thread0_count = 0; -ULONG thread0_sum = 0; +ULONG thread0_sum = 0; ULONG thread1_count = 0; -ULONG thread1_sum = 0; +ULONG thread1_sum = 0; ULONG thread2_count = 0; -ULONG thread2_sum = 0; +ULONG thread2_sum = 0; -///Function declarations +/// Function declarations void thread_0_entry(ULONG thread_input) { // Setup UART IO::UART& uart = IO::getUART(9600); @@ -153,23 +185,31 @@ void thread_0_entry(ULONG thread_input) { uart.printf("Global count: %lu\r\n" "Global sum: %lu\r\n" "Global average: %lu\r\n", - global_count, global_sum, global_sum / global_count); + global_count, + global_sum, + global_sum / global_count); uart.printf("Thread 0 count: %lu\r\n" "Thread 0 sum: %lu\r\n" "Thread 0 average: %lu\r\n", - thread0_count, thread0_sum, thread0_sum / thread0_count); + thread0_count, + thread0_sum, + thread0_sum / thread0_count); uart.printf("Thread 1 count: %lu\r\n" "Thread 1 sum: %lu\r\n" "Thread 1 average: %lu\r\n", - thread1_count, thread1_sum, thread1_sum / thread1_count); + thread1_count, + thread1_sum, + thread1_sum / thread1_count); uart.printf("Thread 2 count: %lu\r\n" "Thread 2 sum: %lu\r\n" "Thread 2 average: %lu\r\n" "\r\n", - thread2_count, thread2_sum, thread2_sum / thread2_count); + thread2_count, + thread2_sum, + thread2_sum / thread2_count); } semaphore_status = tx_semaphore_put(&semaphore_0); @@ -190,8 +230,7 @@ void thread_1_entry(ULONG thread_input) { while (1) { /* Retrieve a message from the queue. */ - queue_status = tx_queue_receive(&queue_0, &received_message, - TX_WAIT_FOREVER); + queue_status = tx_queue_receive(&queue_0, &received_message, TX_WAIT_FOREVER); /* Get the semaphore with suspension. */ semaphore_status = tx_semaphore_get(&semaphore_0, TX_WAIT_FOREVER); @@ -211,7 +250,9 @@ void thread_1_entry(ULONG thread_input) { "Thread 1 count: %lu\r\n" "Thread 1 sum: %lu\r\n" "\r\n", - received_message, thread1_count, thread1_sum); + received_message, + thread1_count, + thread1_sum); semaphore_status = tx_semaphore_put(&semaphore_0); tx_thread_sleep(TX_TIMER_TICKS_PER_SECOND * 1); @@ -231,8 +272,7 @@ void thread_2_entry(ULONG thread_input) { while (1) { /* Retrieve a message from the queue. */ - queue_status = tx_queue_receive(&queue_0, &received_message, - TX_WAIT_FOREVER); + queue_status = tx_queue_receive(&queue_0, &received_message, TX_WAIT_FOREVER); /* Get the semaphore with suspension. */ semaphore_status = tx_semaphore_get(&semaphore_0, TX_WAIT_FOREVER); @@ -252,7 +292,9 @@ void thread_2_entry(ULONG thread_input) { "Thread 2 count: %lu\r\n" "Thread 2 sum: %lu\r\n" "\r\n", - received_message, thread2_count, thread2_sum); + received_message, + thread2_count, + thread2_sum); semaphore_status = tx_semaphore_put(&semaphore_0); tx_thread_sleep(TX_TIMER_TICKS_PER_SECOND * 1); diff --git a/samples/spi/ADXL345/main.cpp b/samples/spi/ADXL345/main.cpp index 4812bc33..e80ba5f7 100644 --- a/samples/spi/ADXL345/main.cpp +++ b/samples/spi/ADXL345/main.cpp @@ -9,15 +9,15 @@ #include #include -namespace IO = core::IO; +namespace IO = core::IO; namespace time = core::time; -constexpr uint32_t SPI_SPEED = SPI_SPEED_62KHZ;// 62.5KHz +constexpr uint32_t SPI_SPEED = SPI_SPEED_62KHZ; // 62.5KHz constexpr uint8_t deviceCount = 1; -#define ADXL345_REG_POWER_CTL 0x2D//R/W 00000000 Power-saving features control ---- -#define ADXL345_REG_DATAY0 0x34 //R 00000000 Y-Axis Data 0 +#define ADXL345_REG_POWER_CTL 0x2D // R/W 00000000 Power-saving features control ---- +#define ADXL345_REG_DATAY0 0x34 // R 00000000 Y-Axis Data 0 IO::GPIO* devices[deviceCount]; @@ -42,7 +42,7 @@ int main() { uart.printf("SPI readReg Error!\n\r"); } - uart.printf("device ID: 0x%X, %d\n\r", byte, byte == 0xE5);//should be 0xE5 + uart.printf("device ID: 0x%X, %d\n\r", byte, byte == 0xE5); // should be 0xE5 time::wait(500); } spi.writeReg(0, ADXL345_REG_POWER_CTL, 0x08); diff --git a/samples/spi/SPI_With_Arduino/main.cpp b/samples/spi/SPI_With_Arduino/main.cpp index 5321d485..2538a057 100644 --- a/samples/spi/SPI_With_Arduino/main.cpp +++ b/samples/spi/SPI_With_Arduino/main.cpp @@ -9,19 +9,19 @@ #include #include -namespace IO = core::IO; +namespace IO = core::IO; namespace time = core::time; -constexpr uint32_t SPI_SPEED = SPI_SPEED_4MHZ;// 4MHz +constexpr uint32_t SPI_SPEED = SPI_SPEED_4MHZ; // 4MHz /** The address of the arduino listening for I2C requests */ -constexpr uint8_t SINGLE_BYTE = 0x10; -constexpr uint8_t READ_MULTIPLE_BYTE = 0x11; -uint8_t BYTE_MULTIPLE[] = {0x40, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F}; +constexpr uint8_t SINGLE_BYTE = 0x10; +constexpr uint8_t READ_MULTIPLE_BYTE = 0x11; +uint8_t BYTE_MULTIPLE[] = {0x40, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F}; constexpr uint8_t BYTE_MULTIPLE_LENGTH = 9; -constexpr uint8_t WRITE_REG = 0x20; -constexpr uint8_t WRITE_REG_BYTE = 0xF3; -constexpr uint8_t READ_REG = 0x28; +constexpr uint8_t WRITE_REG = 0x20; +constexpr uint8_t WRITE_REG_BYTE = 0xF3; +constexpr uint8_t READ_REG = 0x28; constexpr uint8_t deviceCount = 1; diff --git a/samples/thermistor/main.cpp b/samples/thermistor/main.cpp index 72ecd964..f51a2867 100644 --- a/samples/thermistor/main.cpp +++ b/samples/thermistor/main.cpp @@ -7,8 +7,8 @@ #include #include -namespace IO = core::IO; -namespace DEV = core::DEV; +namespace IO = core::IO; +namespace DEV = core::DEV; namespace time = core::time; /** @@ -16,9 +16,7 @@ namespace time = core::time; * function will look like. In actuality, this will be determined through * testing/reading the thermistor datasheet. */ -uint32_t convert(uint32_t voltage) { - return voltage / 2; -} +uint32_t convert(uint32_t voltage) { return voltage / 2; } int main() { core::platform::init(); @@ -38,10 +36,8 @@ int main() { uart.printf("Starting thermistor test\r\n"); while (1) { - uart.printf("Temperature: %dmC\r\n", - static_cast(thermistor.getTempCelcius())); - uart.printf("Voltage: %dV\r\n", - static_cast(thermistor.getRawADC())); + uart.printf("Temperature: %dmC\r\n", static_cast(thermistor.getTempCelcius())); + uart.printf("Voltage: %dV\r\n", static_cast(thermistor.getRawADC())); time::wait(100); } } diff --git a/samples/timer/main.cpp b/samples/timer/main.cpp index 38f43903..b91dfb40 100644 --- a/samples/timer/main.cpp +++ b/samples/timer/main.cpp @@ -6,7 +6,7 @@ #include #include -namespace IO = core::IO; +namespace IO = core::IO; namespace DEV = core::DEV; IO::GPIO* ledGPIO; @@ -15,20 +15,20 @@ IO::GPIO* interruptGPIOStopStart; IO::GPIO* reloadGPIO; void timer2IRQHandler(void* htim) { - IO::GPIO::State state = ledGPIO->readPin(); + IO::GPIO::State state = ledGPIO->readPin(); IO::GPIO::State toggleState = state == IO::GPIO::State::HIGH ? IO::GPIO::State::LOW : IO::GPIO::State::HIGH; ledGPIO->writePin(toggleState); interruptGPIO2Hz->writePin(toggleState); } void timer15IRQHandler(void* htim) { - IO::GPIO::State state = interruptGPIOStopStart->readPin(); + IO::GPIO::State state = interruptGPIOStopStart->readPin(); IO::GPIO::State toggleState = state == IO::GPIO::State::HIGH ? IO::GPIO::State::LOW : IO::GPIO::State::HIGH; interruptGPIOStopStart->writePin(toggleState); } void timer16IRQHandler(void* htim) { - IO::GPIO::State state = reloadGPIO->readPin(); + IO::GPIO::State state = reloadGPIO->readPin(); IO::GPIO::State toggleState = state == IO::GPIO::State::HIGH ? IO::GPIO::State::LOW : IO::GPIO::State::HIGH; reloadGPIO->writePin(toggleState); } @@ -38,13 +38,13 @@ int main() { core::platform::init(); // Setup GPIO - ledGPIO = &IO::getGPIO(); - interruptGPIO2Hz = &IO::getGPIO(IO::GPIO::Direction::OUTPUT); + ledGPIO = &IO::getGPIO(); + interruptGPIO2Hz = &IO::getGPIO(IO::GPIO::Direction::OUTPUT); interruptGPIOStopStart = &IO::getGPIO(IO::GPIO::Direction::OUTPUT); - reloadGPIO = &IO::getGPIO(IO::GPIO::Direction::OUTPUT); + reloadGPIO = &IO::getGPIO(IO::GPIO::Direction::OUTPUT); // Setup the Timer - DEV::Timer& timer2 = DEV::getTimer(500); + DEV::Timer& timer2 = DEV::getTimer(500); DEV::Timer& timer15 = DEV::getTimer(100); DEV::Timer& timer16 = DEV::getTimer(200); diff --git a/src/core/dev/Encoder.cpp b/src/core/dev/Encoder.cpp index e7fb4ec9..efb672e3 100644 --- a/src/core/dev/Encoder.cpp +++ b/src/core/dev/Encoder.cpp @@ -7,7 +7,7 @@ Encoder::Encoder(IO::GPIO& a, IO::GPIO& b, uint32_t range, uint32_t initialPosit if (position > range) { position = range; } - //setting instance variables + // setting instance variables currentRelPos = readPinValues(); a.registerIRQ(IO::GPIO::TriggerEdge::RISING_FALLING, aInterruptHandlerWrapper, this); b.registerIRQ(IO::GPIO::TriggerEdge::RISING_FALLING, bInterruptHandlerWrapper, this); @@ -31,29 +31,32 @@ void Encoder::aInterruptHandler() { int8_t change; switch (currentRelPos) { case 0: - change = 1; + change = 1; currentRelPos = 1; break; case 1: - change = -1; + change = -1; currentRelPos = 0; break; case 2: - change = 1; + change = 1; currentRelPos = 3; break; case 3: - change = -1; + change = -1; currentRelPos = 2; break; } interruptChange += change; lastAInterruptTime = time::millis(); - log::LOGGER.log(log::Logger::LogLevel::DEBUG, "aInterrupt Called, " - "\n\r\tCalculated Position: %d" - "\n\r\tActual Position: %d" - "\n\r\tChange: %d", - currentRelPos, readPinValues(), change); + log::LOGGER.log(log::Logger::LogLevel::DEBUG, + "aInterrupt Called, " + "\n\r\tCalculated Position: %d" + "\n\r\tActual Position: %d" + "\n\r\tChange: %d", + currentRelPos, + readPinValues(), + change); } void Encoder::bInterruptHandler() { @@ -64,36 +67,39 @@ void Encoder::bInterruptHandler() { int8_t change; switch (currentRelPos) { case 0: - change = -1; + change = -1; currentRelPos = 3; break; case 1: - change = 1; + change = 1; currentRelPos = 2; break; case 2: - change = -1; + change = -1; currentRelPos = 1; break; case 3: - change = 1; + change = 1; currentRelPos = 0; break; } interruptChange += change; lastBInterruptTime = time::millis(); - log::LOGGER.log(log::Logger::LogLevel::DEBUG, "bInterrupt Called, " - "\n\r\tCalculated Position: %d" - "\n\r\tActual Position: %d" - "\n\r\tChange: %d", - currentRelPos, readPinValues(), change); + log::LOGGER.log(log::Logger::LogLevel::DEBUG, + "bInterrupt Called, " + "\n\r\tCalculated Position: %d" + "\n\r\tActual Position: %d" + "\n\r\tChange: %d", + currentRelPos, + readPinValues(), + change); } uint32_t Encoder::getPosition() { - int64_t change = interruptChange; + int64_t change = interruptChange; interruptChange = 0; changePosition(change); - //in case of triggers desyncing the relative position + // in case of triggers desyncing the relative position currentRelPos = readPinValues(); return position; } @@ -110,7 +116,7 @@ void Encoder::setRangeAndPosition(uint32_t newRange, uint32_t newPosition) { int8_t Encoder::readPinValues() { bool aPos = (bool) a.readPin(); bool bPos = (bool) b.readPin(); - //calculating and returning the position + // calculating and returning the position if (aPos == 0 && bPos == 0) { return 0; } else if (aPos == 1 && bPos == 0) { @@ -124,7 +130,7 @@ int8_t Encoder::readPinValues() { bool Encoder::changePosition(int64_t change) { change %= (int64_t) (range + 1); - bool hitCap = false; + bool hitCap = false; int64_t newPosition = (int64_t) position; newPosition += change; if (newPosition < 0) { @@ -135,7 +141,7 @@ bool Encoder::changePosition(int64_t change) { } hitCap = true; } else if (newPosition > (int64_t) range) { - //Position reached cap + // Position reached cap if (rollOver) { position = (uint32_t) newPosition - 1 - range; } else { @@ -148,4 +154,4 @@ bool Encoder::changePosition(int64_t change) { return hitCap; } -}// namespace core::DEV +} // namespace core::DEV diff --git a/src/core/dev/LCD.cpp b/src/core/dev/LCD.cpp index 4187eb69..60e0e733 100644 --- a/src/core/dev/LCD.cpp +++ b/src/core/dev/LCD.cpp @@ -8,10 +8,11 @@ LCD::LCD(IO::GPIO& regSelect, IO::GPIO& reset, IO::SPI& spi) : regSelect(regSele this->reset.writePin(core::IO::GPIO::State::LOW); this->numberOfSections = 9; - this->sectionsPerRow = 3; + this->sectionsPerRow = 3; } -LCD::LCD(IO::GPIO& regSelect, IO::GPIO& reset, IO::SPI& spi, uint8_t numberOfSections, uint8_t sectionsPerRow) : regSelect(regSelect), reset(reset), spi(spi) { +LCD::LCD(IO::GPIO& regSelect, IO::GPIO& reset, IO::SPI& spi, uint8_t numberOfSections, uint8_t sectionsPerRow) + : regSelect(regSelect), reset(reset), spi(spi) { this->regSelect.writePin(core::IO::GPIO::State::LOW); this->reset.writePin(core::IO::GPIO::State::LOW); if (sectionsPerRow > MAX_SECTION_PER_ROW) { @@ -23,21 +24,21 @@ LCD::LCD(IO::GPIO& regSelect, IO::GPIO& reset, IO::SPI& spi, uint8_t numberOfSec } this->numberOfSections = numberOfSections; - this->sectionsPerRow = sectionsPerRow; + this->sectionsPerRow = sectionsPerRow; } void LCD::initLCD() { this->reset.writePin(core::IO::GPIO::State::HIGH); core::time::wait(100); - this->commandWrite(ADCSELECT); // ADC select - this->commandWrite(DISPLAYOFF); // Display OFF - this->commandWrite(COMDIRSCAN); // COM direction scan - this->commandWrite(LCDBIASET); // LCD bias set - this->commandWrite(POWERCONTROLSET); // Power Control set - this->commandWrite(RESRATIOSET); // Resistor Ratio Set - this->commandWrite(ELECTRONICVOLCOMMAND);// Electronic Volume Command (set contrast) Double Byte: 1 of 2 - this->commandWrite(ELECTRONICVOLVALUE); // Electronic Volume value (contrast value) Double Byte: 2 of 2 - this->commandWrite(DISPLAYON); // Display ON + this->commandWrite(ADCSELECT); // ADC select + this->commandWrite(DISPLAYOFF); // Display OFF + this->commandWrite(COMDIRSCAN); // COM direction scan + this->commandWrite(LCDBIASET); // LCD bias set + this->commandWrite(POWERCONTROLSET); // Power Control set + this->commandWrite(RESRATIOSET); // Resistor Ratio Set + this->commandWrite(ELECTRONICVOLCOMMAND); // Electronic Volume Command (set contrast) Double Byte: 1 of 2 + this->commandWrite(ELECTRONICVOLVALUE); // Electronic Volume value (contrast value) Double Byte: 2 of 2 + this->commandWrite(DISPLAYON); // Display ON } void LCD::dataWrite(uint8_t data) { @@ -55,14 +56,14 @@ void LCD::commandWrite(uint8_t data) { } void LCD::driveColumn(uint8_t page, uint8_t colUp, uint8_t colLow, uint8_t data) { - this->commandWrite(0x40); // Line to start writing on (0 -> 64) moves set bits with it DO NOT CHANGE - this->commandWrite(0xB0 + page); // Writes the page address (4 bits, 8 rows selected by values 0-7 ) - this->commandWrite(0x10 + colUp); // Writes the first 4 bits of the column select (out of 8 bits) - this->commandWrite(0x00 + colLow);// Writes the second 4 bits of the column select (out) + this->commandWrite(0x40); // Line to start writing on (0 -> 64) moves set bits with it DO NOT CHANGE + this->commandWrite(0xB0 + page); // Writes the page address (4 bits, 8 rows selected by values 0-7 ) + this->commandWrite(0x10 + colUp); // Writes the first 4 bits of the column select (out of 8 bits) + this->commandWrite(0x00 + colLow); // Writes the second 4 bits of the column select (out) this->dataWrite(data); - this->commandWrite(0xAF);// Finish Writing + this->commandWrite(0xAF); // Finish Writing /* * writes 8 vertical bits based on value between 0-255 based on bits set ex: 01001100(0x4C) is * |WHITE| @@ -77,17 +78,17 @@ void LCD::driveColumn(uint8_t page, uint8_t colUp, uint8_t colLow, uint8_t data) } void LCD::clearLCD() { - uint8_t page = 0xB0;// The starting page - - this->commandWrite(0x40); // Display start address + 0x40 - for (uint8_t i = 0; i < 8; i++) { // 64 pixel display / 8 pixels per page = 8 pages - this->commandWrite(page); // Send page address - this->commandWrite(0x10); // Column address upper 4 bits + 0x10 - this->commandWrite(0x00); // Column address lower 4 bits + 0x00 - for (uint8_t j = 0; j < screenSizeX; j++) {// 128 columns wide - this->dataWrite(0x00); // Write clear pixels + uint8_t page = 0xB0; // The starting page + + this->commandWrite(0x40); // Display start address + 0x40 + for (uint8_t i = 0; i < 8; i++) { // 64 pixel display / 8 pixels per page = 8 pages + this->commandWrite(page); // Send page address + this->commandWrite(0x10); // Column address upper 4 bits + 0x10 + this->commandWrite(0x00); // Column address lower 4 bits + 0x00 + for (uint8_t j = 0; j < screenSizeX; j++) { // 128 columns wide + this->dataWrite(0x00); // Write clear pixels } - page++;// After 128 columns, go to next page + page++; // After 128 columns, go to next page } this->commandWrite(0xAF); } @@ -99,33 +100,33 @@ void LCD::clearArea(uint8_t width, uint8_t numPages, uint8_t page, uint8_t colum uint8_t columnUpperAddress = (column & 0xf0) >> 4; uint8_t columnLowerAddress = (column & 0x0f); - this->commandWrite(0x40); // Display start address + 0x40 - for (uint8_t i = 0; i < numPages; i++) { // 64 pixel display / 8 pixels per page = 8 pages - this->commandWrite(0xB0 + page); // Send page address - this->commandWrite(0x10 + columnUpperAddress);// Column address upper 4 bits + 0x10 - this->commandWrite(0x00 + columnLowerAddress);// Column address lower 4 bits + 0x00 + this->commandWrite(0x40); // Display start address + 0x40 + for (uint8_t i = 0; i < numPages; i++) { // 64 pixel display / 8 pixels per page = 8 pages + this->commandWrite(0xB0 + page); // Send page address + this->commandWrite(0x10 + columnUpperAddress); // Column address upper 4 bits + 0x10 + this->commandWrite(0x00 + columnLowerAddress); // Column address lower 4 bits + 0x00 for (uint8_t j = 0; j < width; j++) { - this->dataWrite(0x00);// Write Clear Pixels + this->dataWrite(0x00); // Write Clear Pixels } - page++;// After 128 columns, go to next page + page++; // After 128 columns, go to next page } - this->commandWrite(0xAF);// Finish Writing + this->commandWrite(0xAF); // Finish Writing } void LCD::setEntireScreenBitMap(const uint8_t* bitMap) { uint8_t page = 0xB0; - this->commandWrite(0x40); //Display start address + 0x40 - for (uint8_t i = 0; i < 8; i++) { //64 pixel display / 8 pixels per page = 8 pages - this->commandWrite(page); //send page address - this->commandWrite(0x10); //column address upper 4 bits + 0x10 - this->commandWrite(0x00); //column address lower 4 bits + 0x00 - for (uint8_t j = 0; j < 128; j++) {//128 columns wide - this->dataWrite(*bitMap); //write pixels from bitmap - bitMap++; // Advance the bitmap pointer by one. This means we can just grab the last one the next loop. + this->commandWrite(0x40); // Display start address + 0x40 + for (uint8_t i = 0; i < 8; i++) { // 64 pixel display / 8 pixels per page = 8 pages + this->commandWrite(page); // send page address + this->commandWrite(0x10); // column address upper 4 bits + 0x10 + this->commandWrite(0x00); // column address lower 4 bits + 0x00 + for (uint8_t j = 0; j < 128; j++) { // 128 columns wide + this->dataWrite(*bitMap); // write pixels from bitmap + bitMap++; // Advance the bitmap pointer by one. This means we can just grab the last one the next loop. } - page++;//after 128 columns, go to next page + page++; // after 128 columns, go to next page } this->commandWrite(0xAF); } @@ -137,20 +138,20 @@ void LCD::displayBitMapInArea(uint8_t* bitMap, uint8_t bitMapWidth, uint8_t numP uint8_t columnUpperAddress = (column & 0xf0) >> 4; uint8_t columnLowerAddress = (column & 0x0f); - this->commandWrite(0x40); //Display start address + 0x40 - for (uint8_t i = 0; i < numPages; i++) { // 64 pixel display / 8 pixels per page = 8 pages - this->commandWrite(0xB0 + page); // Send page address - this->commandWrite(0x10 + columnUpperAddress);// Column address upper 4 bits + 0x10 - this->commandWrite(0x00 + columnLowerAddress);// Column address lower 4 bits + 0x00 + this->commandWrite(0x40); // Display start address + 0x40 + for (uint8_t i = 0; i < numPages; i++) { // 64 pixel display / 8 pixels per page = 8 pages + this->commandWrite(0xB0 + page); // Send page address + this->commandWrite(0x10 + columnUpperAddress); // Column address upper 4 bits + 0x10 + this->commandWrite(0x00 + columnLowerAddress); // Column address lower 4 bits + 0x00 for (uint8_t j = 0; j < bitMapWidth; j++) { - this->dataWrite(*bitMap);// Write pixels from bitmap - bitMap++; // Advance the bitmap pointer by one. This means we can just grab the last one the next loop. + this->dataWrite(*bitMap); // Write pixels from bitmap + bitMap++; // Advance the bitmap pointer by one. This means we can just grab the last one the next loop. } - page++;// After 128 columns, go to next page + page++; // After 128 columns, go to next page } - this->commandWrite(0xAF);// Finish writing + this->commandWrite(0xAF); // Finish writing } void LCD::setDefaultSections(char* const newSectionTitles[9]) { @@ -161,21 +162,22 @@ void LCD::setDefaultSections(char* const newSectionTitles[9]) { void LCD::setNewSections(uint8_t newNumberOfSections, uint8_t newSectionsPerRow, char* const newSectionTitles[9]) { numberOfSections = newNumberOfSections; - sectionsPerRow = newSectionsPerRow; + sectionsPerRow = newSectionsPerRow; for (uint8_t x = 0; x < numberOfSections; x++) { this->sectionTitles[x] = newSectionTitles[x]; } } void LCD::displaySectionHeaders() { - uint8_t page = 0; - uint8_t column = 0; + uint8_t page = 0; + uint8_t column = 0; uint8_t rowCounter = 0; uint8_t sectionWidth = screenSizeX / sectionsPerRow; for (auto title : sectionTitles) { - uint8_t length = strlen(title) * 4;// The length of the text, multiply by 4 because each character is 4 pixels wide. + uint8_t length = + strlen(title) * 4; // The length of the text, multiply by 4 because each character is 4 pixels wide. uint8_t padding = (sectionWidth - length) / 2; column += padding; @@ -191,7 +193,7 @@ void LCD::displaySectionHeaders() { rowCounter++; if (rowCounter >= sectionsPerRow) { rowCounter = 0; - column = 0; + column = 0; page += 3; } @@ -203,18 +205,19 @@ void LCD::displaySectionHeaders() { } void LCD::setTextForSection(uint8_t section, const char* text) { - uint8_t sectionWidth = screenSizeX / sectionsPerRow; - uint8_t adjustedSection = section + 1; // Adjust the section so the following math operates correctly. - uint8_t sectionRow = section / sectionsPerRow;// Calculate the correct row for the section + uint8_t sectionWidth = screenSizeX / sectionsPerRow; + uint8_t adjustedSection = section + 1; // Adjust the section so the following math operates correctly. + uint8_t sectionRow = section / sectionsPerRow; // Calculate the correct row for the section - uint8_t sectionPage = (sectionRow * 3) + 1; - uint8_t sectionColumn = (adjustedSection - (sectionRow * sectionsPerRow) - 1) * sectionWidth;// Calculate what the column # for the section is. + uint8_t sectionPage = (sectionRow * 3) + 1; + uint8_t sectionColumn = (adjustedSection - (sectionRow * sectionsPerRow) - 1) + * sectionWidth; // Calculate what the column # for the section is. // Clear the sections area so text is not written over old text. clearArea(sectionWidth, 1, sectionPage, sectionColumn); // Calculate the padding to center the text in the section - uint8_t length = strlen(text) * 4; + uint8_t length = strlen(text) * 4; uint8_t padding = (sectionWidth - length) / 2; sectionColumn += padding; @@ -272,7 +275,7 @@ void LCD::writeText(const char* text, uint8_t page, uint8_t column, LCD::FontSiz } break; } - column += characterWidth;// Advance the column for the next character. + column += characterWidth; // Advance the column for the next character. // If we need to wrap text, move the page forward and the column to 0. if (wrapText && column >= screenSizeX) { @@ -281,4 +284,4 @@ void LCD::writeText(const char* text, uint8_t page, uint8_t column, LCD::FontSiz } } } -}// namespace core::DEV +} // namespace core::DEV diff --git a/src/core/dev/LED.cpp b/src/core/dev/LED.cpp index b7e6e55c..2b51772d 100644 --- a/src/core/dev/LED.cpp +++ b/src/core/dev/LED.cpp @@ -2,8 +2,7 @@ namespace core::DEV { -LED::LED(core::IO::GPIO& gpio, LED::ActiveState activeState) - : gpio(gpio) { +LED::LED(core::IO::GPIO& gpio, LED::ActiveState activeState) : gpio(gpio) { this->setState(core::IO::GPIO::State::LOW); } @@ -30,4 +29,4 @@ void LED::setState(core::IO::GPIO::State state) { } } -}// namespace core::DEV +} // namespace core::DEV diff --git a/src/core/dev/RTCTimer.cpp b/src/core/dev/RTCTimer.cpp index a622c427..7c6589fe 100644 --- a/src/core/dev/RTCTimer.cpp +++ b/src/core/dev/RTCTimer.cpp @@ -15,7 +15,7 @@ RTCTimer::RTCTimer(RTC& r, uint32_t clock) : rtc(r) { } void RTCTimer::startTimer() { - startTime = rtc.getTime(); + startTime = rtc.getTime(); bTimerStopped = false; } @@ -25,21 +25,15 @@ void RTCTimer::stopTimer() { } void RTCTimer::reloadTimer() { - time = 0; - startTime = rtc.getTime(); + time = 0; + startTime = rtc.getTime(); bTimerStopped = false; } -void RTCTimer::setPeriod(uint32_t clock) { - clockPeriod = clock / 1000; -} +void RTCTimer::setPeriod(uint32_t clock) { clockPeriod = clock / 1000; } -uint32_t RTCTimer::getTime() { - return bTimerStopped ? time : time + rtc.getTime() - startTime; -} +uint32_t RTCTimer::getTime() { return bTimerStopped ? time : time + rtc.getTime() - startTime; } -bool RTCTimer::hasGoneOff() { - return getTime() >= clockPeriod; -} +bool RTCTimer::hasGoneOff() { return getTime() >= clockPeriod; } -}// namespace core::DEV +} // namespace core::DEV diff --git a/src/core/dev/Thermistor.cpp b/src/core/dev/Thermistor.cpp index 146020f0..64df9503 100644 --- a/src/core/dev/Thermistor.cpp +++ b/src/core/dev/Thermistor.cpp @@ -2,16 +2,10 @@ namespace core::DEV { -Thermistor::Thermistor(core::IO::ADC& adc, uint32_t (*conversion)(uint32_t)) : adc(adc), - conversion(conversion) { -} +Thermistor::Thermistor(core::IO::ADC& adc, uint32_t (*conversion)(uint32_t)) : adc(adc), conversion(conversion) {} -uint32_t Thermistor::getTempCelcius() { - return conversion(adc.readRaw()); -} +uint32_t Thermistor::getTempCelcius() { return conversion(adc.readRaw()); } -uint32_t Thermistor::getRawADC() { - return adc.readRaw(); -} +uint32_t Thermistor::getRawADC() { return adc.readRaw(); } -}// namespace core::DEV +} // namespace core::DEV diff --git a/src/core/dev/button.cpp b/src/core/dev/button.cpp index 960df470..6baa9a8b 100644 --- a/src/core/dev/button.cpp +++ b/src/core/dev/button.cpp @@ -6,9 +6,7 @@ Button::Button(IO::GPIO& gpio, IO::GPIO::State pressedState) : gpio(gpio), press this->timeSinceLastPress = 0; } -IO::GPIO::State Button::getState() { - return this->gpio.readPin(); -} +IO::GPIO::State Button::getState() { return this->gpio.readPin(); } bool Button::debounce(uint32_t debounceTime) { if (time::millis() - this->timeSinceLastPress > debounceTime) { @@ -21,4 +19,4 @@ bool Button::debounce(uint32_t debounceTime) { return false; } -}// namespace core::DEV \ No newline at end of file +} // namespace core::DEV \ No newline at end of file diff --git a/src/core/dev/platform/f3xx/IWDGf3xx.cpp b/src/core/dev/platform/f3xx/IWDGf3xx.cpp index cb33f12d..751a48a7 100644 --- a/src/core/dev/platform/f3xx/IWDGf3xx.cpp +++ b/src/core/dev/platform/f3xx/IWDGf3xx.cpp @@ -5,14 +5,15 @@ namespace core::DEV { // According to a time formula in the documentation with the set prescaler, // the ratio of counter ticks to milliseconds should be about 1:8. In testing, // we found this to have an error of about 1 second -IWDGf3xx::IWDGf3xx(uint32_t ms) : halIWDG{ - IWDG1, - { - IWDG_PRESCALER_256, - ms / 8 - 1, - ms / 8 - 1, - }, - } {} +IWDGf3xx::IWDGf3xx(uint32_t ms) + : halIWDG{ + IWDG1, + { + IWDG_PRESCALER_256, + ms / 8 - 1, + ms / 8 - 1, + }, + } {} void IWDGf3xx::init() { HAL_IWDG_Init(&halIWDG); @@ -25,4 +26,4 @@ void IWDGf3xx::refresh() { } } -}// namespace core::DEV +} // namespace core::DEV diff --git a/src/core/dev/platform/f3xx/RTCf3xx.cpp b/src/core/dev/platform/f3xx/RTCf3xx.cpp index 9e7e155a..4c7bfe38 100644 --- a/src/core/dev/platform/f3xx/RTCf3xx.cpp +++ b/src/core/dev/platform/f3xx/RTCf3xx.cpp @@ -6,30 +6,31 @@ namespace time = core::time; namespace core::DEV { constexpr int asynchPrediv = 127; -constexpr int synchPrediv = 255; - -RTCf3xx::RTCf3xx() : halRTC{ - RTC1, - { - // Numbers generated from STMCubeMX - RTC_HOURFORMAT_24, - asynchPrediv, - synchPrediv, - RTC_OUTPUT_DISABLE, - RTC_OUTPUT_TYPE_PUSHPULL, - RTC_OUTPUT_POLARITY_HIGH, - }, - } { +constexpr int synchPrediv = 255; + +RTCf3xx::RTCf3xx() + : halRTC{ + RTC1, + { + // Numbers generated from STMCubeMX + RTC_HOURFORMAT_24, + asynchPrediv, + synchPrediv, + RTC_OUTPUT_DISABLE, + RTC_OUTPUT_TYPE_PUSHPULL, + RTC_OUTPUT_POLARITY_HIGH, + }, + } { RCC_OscInitTypeDef RCC_OscInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; // Initialize the peripherals PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; // Set the clock to LSE - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE; - RCC_OscInitStruct.LSEState = RCC_LSE_ON; + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE; + RCC_OscInitStruct.LSEState = RCC_LSE_ON; PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE; HAL_RCC_OscConfig(&RCC_OscInitStruct); @@ -48,27 +49,27 @@ void RTCf3xx::getTime(core::time::TimeStamp& time) { // Get clock time information HAL_RTC_GetTime(&halRTC, &rtcTime, RTC_FORMAT_BIN); - time.hour = rtcTime.Hours; + time.hour = rtcTime.Hours; time.minute = rtcTime.Minutes; time.second = rtcTime.Seconds; // Get date information HAL_RTC_GetDate(&halRTC, &rtcDate, RTC_FORMAT_BIN); - time.year = 2000 + rtcDate.Year; + time.year = 2000 + rtcDate.Year; time.month = rtcDate.Month; - time.day = rtcDate.Date; + time.day = rtcDate.Date; } uint32_t RTCf3xx::getTime() { time::TimeStamp ts{}; getTime(ts); - uint32_t y = ts.year; - uint32_t m = ts.month; - uint32_t d = ts.day; - uint32_t h = ts.hour; + uint32_t y = ts.year; + uint32_t m = ts.month; + uint32_t d = ts.day; + uint32_t h = ts.hour; uint32_t min = ts.minute; - uint32_t s = ts.second; + uint32_t s = ts.second; // Get number of days since epoch // This algorithm is used to convert a date/time to an epoch. @@ -78,7 +79,7 @@ uint32_t RTCf3xx::getTime() { const uint32_t yoe = static_cast(y - era * 400); const uint32_t doy = (153 * (m + (m > 2 ? -3 : 9)) + 2) / 5 + d - 1; const uint32_t doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; - uint32_t time = era * 146097 + static_cast(doe) - 719468; + uint32_t time = era * 146097 + static_cast(doe) - 719468; // Convert to seconds time *= 86400; @@ -94,15 +95,15 @@ void RTCf3xx::setTime(core::time::TimeStamp& time) { RTC_TimeTypeDef rtcTime; rtcDate.WeekDay = time.day; - rtcDate.Month = static_cast(time.month); - rtcDate.Date = time.day; - rtcDate.Year = time.year % 100; + rtcDate.Month = static_cast(time.month); + rtcDate.Date = time.day; + rtcDate.Year = time.year % 100; // RTC struct for the time - rtcTime.Hours = time.hour; - rtcTime.Minutes = time.minute; - rtcTime.TimeFormat = RTC_HOURFORMAT_24; - rtcTime.Seconds = time.second; + rtcTime.Hours = time.hour; + rtcTime.Minutes = time.minute; + rtcTime.TimeFormat = RTC_HOURFORMAT_24; + rtcTime.Seconds = time.second; rtcTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; rtcTime.StoreOperation = RTC_STOREOPERATION_RESET; @@ -110,4 +111,4 @@ void RTCf3xx::setTime(core::time::TimeStamp& time) { HAL_RTC_SetTime(&halRTC, &rtcTime, RTC_FORMAT_BIN); } -}// namespace core::DEV +} // namespace core::DEV diff --git a/src/core/dev/platform/f3xx/Timerf3xx.cpp b/src/core/dev/platform/f3xx/Timerf3xx.cpp index e7a3d77a..8f994f3d 100644 --- a/src/core/dev/platform/f3xx/Timerf3xx.cpp +++ b/src/core/dev/platform/f3xx/Timerf3xx.cpp @@ -6,7 +6,7 @@ TIM_HandleTypeDef halTimers[4]; void (*timerInterruptHandlers[4])(void* htim) = {nullptr}; enum class timerInterruptIndex { - TIM2_IDX = 0u, + TIM2_IDX = 0u, TIM15_IDX = 1u, TIM16_IDX = 2u, TIM17_IDX = 3u @@ -31,7 +31,7 @@ extern "C" void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim) { __HAL_RCC_TIM17_CLK_ENABLE(); irqNum = TIM17_IRQn; } else { - return;// Should never reach, but if an invalid peripheral is passed in then simply return + return; // Should never reach, but if an invalid peripheral is passed in then simply return } HAL_NVIC_SetPriority(irqNum, core::platform::TIMER_INTERRUPT_PRIORITY, 0); @@ -55,27 +55,19 @@ extern "C" void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim) { __HAL_RCC_TIM17_CLK_DISABLE(); irqNum = TIM17_IRQn; } else { - return;// Should never reach, but if an invalid peripheral is passed in then simply return + return; // Should never reach, but if an invalid peripheral is passed in then simply return } HAL_NVIC_DisableIRQ(irqNum); } -extern "C" void TIM2_IRQHandler(void) { - HAL_TIM_IRQHandler(&halTimers[getTimerInterruptIndex(TIM2)]); -} +extern "C" void TIM2_IRQHandler(void) { HAL_TIM_IRQHandler(&halTimers[getTimerInterruptIndex(TIM2)]); } -extern "C" void TIM15_IRQHandler(void) { - HAL_TIM_IRQHandler(&halTimers[getTimerInterruptIndex(TIM15)]); -} +extern "C" void TIM15_IRQHandler(void) { HAL_TIM_IRQHandler(&halTimers[getTimerInterruptIndex(TIM15)]); } -extern "C" void TIM16_IRQHandler(void) { - HAL_TIM_IRQHandler(&halTimers[getTimerInterruptIndex(TIM16)]); -} +extern "C" void TIM16_IRQHandler(void) { HAL_TIM_IRQHandler(&halTimers[getTimerInterruptIndex(TIM16)]); } -extern "C" void TIM17_IRQHandler(void) { - HAL_TIM_IRQHandler(&halTimers[getTimerInterruptIndex(TIM17)]); -} +extern "C" void TIM17_IRQHandler(void) { HAL_TIM_IRQHandler(&halTimers[getTimerInterruptIndex(TIM17)]); } extern "C" void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef* htim) { uint8_t interruptIdx = getTimerInterruptIndex(htim->Instance); @@ -117,26 +109,26 @@ Timerf3xx::Timerf3xx(TIM_TypeDef* timerPeripheral, uint32_t clockPeriod) { void Timerf3xx::initTimer(TIM_TypeDef* timerPeripheral, uint32_t clockPeriod) { this->clockPeriod = clockPeriod; - auto& htim = halTimers[getTimerInterruptIndex(timerPeripheral)]; + auto& htim = halTimers[getTimerInterruptIndex(timerPeripheral)]; - htim.Instance = timerPeripheral; - uint32_t prescaler = core::platform::CLK_SPEED / 1000; - htim.Init.Prescaler = prescaler;// Sets f_CK_PSC to 1000 Hz + htim.Instance = timerPeripheral; + uint32_t prescaler = core::platform::CLK_SPEED / 1000; + htim.Init.Prescaler = prescaler; // Sets f_CK_PSC to 1000 Hz // Allows period increments of 1 ms with max of 2^(32) ms. - htim.Init.CounterMode = TIM_COUNTERMODE_UP; - htim.Init.Period = clockPeriod; - htim.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; + htim.Init.CounterMode = TIM_COUNTERMODE_UP; + htim.Init.Period = clockPeriod; + htim.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; htim.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; HAL_TIM_Base_Init(&htim); - TIM_ClockConfigTypeDef clockConfig = {0}; + TIM_ClockConfigTypeDef clockConfig = {0}; TIM_MasterConfigTypeDef masterConfig = {0}; clockConfig.ClockSource = TIM_CLOCKSOURCE_INTERNAL; HAL_TIM_ConfigClockSource(&htim, &clockConfig); masterConfig.MasterOutputTrigger = TIM_TRGO_RESET; - masterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; + masterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; HAL_TIMEx_MasterConfigSynchronization(&htim, &masterConfig); } @@ -147,12 +139,10 @@ void Timerf3xx::startTimer(void (*irqHandler)(void* htim)) { startTimer(); } -void Timerf3xx::stopTimer() { - HAL_TIM_Base_Stop_IT(this->halTimer); -} +void Timerf3xx::stopTimer() { HAL_TIM_Base_Stop_IT(this->halTimer); } void Timerf3xx::startTimer() { - stopTimer();// Stop timer in case it was already running + stopTimer(); // Stop timer in case it was already running auto htim = this->halTimer; // Clear the interrupt flag so interrupt doesn't trigger immediately @@ -161,11 +151,11 @@ void Timerf3xx::startTimer() { } void Timerf3xx::reloadTimer() { - this->halTimer->Instance->CNT &= ~(0xFFFFFFFF);// Clear the Counter register to reset the timer + this->halTimer->Instance->CNT &= ~(0xFFFFFFFF); // Clear the Counter register to reset the timer } void Timerf3xx::setPeriod(uint32_t clockPeriod) { stopTimer(); initTimer(this->halTimer->Instance, clockPeriod); } -}// namespace core::DEV +} // namespace core::DEV diff --git a/src/core/dev/platform/f4xx/IWDGf4xx.cpp b/src/core/dev/platform/f4xx/IWDGf4xx.cpp index ffc74b2b..015ad806 100644 --- a/src/core/dev/platform/f4xx/IWDGf4xx.cpp +++ b/src/core/dev/platform/f4xx/IWDGf4xx.cpp @@ -5,13 +5,14 @@ namespace core::DEV { // According to a time formula in the documentation with the set prescaler, // the ratio of counter ticks to milliseconds should be about 1:8. In testing, // we found this to have an error of about 1 second -IWDGf4xx::IWDGf4xx(uint32_t ms) : halIWDG{ - IWDG1, - { - IWDG_PRESCALER_256, - ms / 8 - 1, - }, - } {} +IWDGf4xx::IWDGf4xx(uint32_t ms) + : halIWDG{ + IWDG1, + { + IWDG_PRESCALER_256, + ms / 8 - 1, + }, + } {} void IWDGf4xx::init() { HAL_IWDG_Init(&halIWDG); @@ -24,4 +25,4 @@ void IWDGf4xx::refresh() { } } -}// namespace core::DEV +} // namespace core::DEV diff --git a/src/core/dev/platform/f4xx/RTCf4xx.cpp b/src/core/dev/platform/f4xx/RTCf4xx.cpp index 3c3a3c73..8c53d269 100644 --- a/src/core/dev/platform/f4xx/RTCf4xx.cpp +++ b/src/core/dev/platform/f4xx/RTCf4xx.cpp @@ -6,30 +6,31 @@ namespace time = core::time; namespace core::DEV { constexpr int asynchPrediv = 127; -constexpr int synchPrediv = 255; - -RTCf4xx::RTCf4xx() : halRTC{ - RTC1, - { - // Numbers generated from STMCubeMX - RTC_HOURFORMAT_24, - asynchPrediv, - synchPrediv, - RTC_OUTPUT_DISABLE, - RTC_OUTPUT_TYPE_PUSHPULL, - RTC_OUTPUT_POLARITY_HIGH, - }, - } { +constexpr int synchPrediv = 255; + +RTCf4xx::RTCf4xx() + : halRTC{ + RTC1, + { + // Numbers generated from STMCubeMX + RTC_HOURFORMAT_24, + asynchPrediv, + synchPrediv, + RTC_OUTPUT_DISABLE, + RTC_OUTPUT_TYPE_PUSHPULL, + RTC_OUTPUT_POLARITY_HIGH, + }, + } { RCC_OscInitTypeDef RCC_OscInitStruct; RCC_PeriphCLKInitTypeDef PeriphClkInitStruct; // Initialize the peripherals PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_RTC; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE; // Set the clock to LSE - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE; - RCC_OscInitStruct.LSEState = RCC_LSE_ON; + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_LSE; + RCC_OscInitStruct.LSEState = RCC_LSE_ON; PeriphClkInitStruct.RTCClockSelection = RCC_RTCCLKSOURCE_LSE; HAL_RCC_OscConfig(&RCC_OscInitStruct); @@ -48,27 +49,27 @@ void RTCf4xx::getTime(core::time::TimeStamp& time) { // Get clock time information HAL_RTC_GetTime(&halRTC, &rtcTime, RTC_FORMAT_BIN); - time.hour = rtcTime.Hours; + time.hour = rtcTime.Hours; time.minute = rtcTime.Minutes; time.second = rtcTime.Seconds; // Get date information HAL_RTC_GetDate(&halRTC, &rtcDate, RTC_FORMAT_BIN); - time.year = 2000 + rtcDate.Year; + time.year = 2000 + rtcDate.Year; time.month = rtcDate.Month; - time.day = rtcDate.Date; + time.day = rtcDate.Date; } uint32_t RTCf4xx::getTime() { time::TimeStamp ts{}; getTime(ts); - uint32_t y = ts.year; - uint32_t m = ts.month; - uint32_t d = ts.day; - uint32_t h = ts.hour; + uint32_t y = ts.year; + uint32_t m = ts.month; + uint32_t d = ts.day; + uint32_t h = ts.hour; uint32_t min = ts.minute; - uint32_t s = ts.second; + uint32_t s = ts.second; // Get number of days since epoch // This algorithm is used to convert a date/time to an epoch. @@ -78,7 +79,7 @@ uint32_t RTCf4xx::getTime() { const uint32_t yoe = static_cast(y - era * 400); const uint32_t doy = (153 * (m + (m > 2 ? -3 : 9)) + 2) / 5 + d - 1; const uint32_t doe = yoe * 365 + yoe / 4 - yoe / 100 + doy; - uint32_t time = era * 146097 + static_cast(doe) - 719468; + uint32_t time = era * 146097 + static_cast(doe) - 719468; // Convert to seconds time *= 86400; @@ -94,15 +95,15 @@ void RTCf4xx::setTime(core::time::TimeStamp& time) { RTC_TimeTypeDef rtcTime; rtcDate.WeekDay = time.day; - rtcDate.Month = static_cast(time.month); - rtcDate.Date = time.day; - rtcDate.Year = time.year % 100; + rtcDate.Month = static_cast(time.month); + rtcDate.Date = time.day; + rtcDate.Year = time.year % 100; // RTC struct for the time - rtcTime.Hours = time.hour; - rtcTime.Minutes = time.minute; - rtcTime.TimeFormat = RTC_HOURFORMAT_24; - rtcTime.Seconds = time.second; + rtcTime.Hours = time.hour; + rtcTime.Minutes = time.minute; + rtcTime.TimeFormat = RTC_HOURFORMAT_24; + rtcTime.Seconds = time.second; rtcTime.DayLightSaving = RTC_DAYLIGHTSAVING_NONE; rtcTime.StoreOperation = RTC_STOREOPERATION_RESET; @@ -110,4 +111,4 @@ void RTCf4xx::setTime(core::time::TimeStamp& time) { HAL_RTC_SetTime(&halRTC, &rtcTime, RTC_FORMAT_BIN); } -}// namespace core::DEV +} // namespace core::DEV diff --git a/src/core/dev/storage/M24C32.cpp b/src/core/dev/storage/M24C32.cpp index a1cd6b86..689fe915 100644 --- a/src/core/dev/storage/M24C32.cpp +++ b/src/core/dev/storage/M24C32.cpp @@ -26,7 +26,7 @@ uint32_t M24C32::readWord(uint32_t address) { void M24C32::readBytes(uint32_t address, uint8_t* buffer, uint8_t numBytes) { uint16_t currentAddress = address; - uint8_t bytesRead = 0; + uint8_t bytesRead = 0; uint8_t* currentBufferPtr = buffer; @@ -76,7 +76,7 @@ void M24C32::writeWord(uint32_t address, uint32_t data) { void M24C32::writeBytes(uint32_t address, uint8_t* dataArr, uint8_t numBytes) { uint16_t currentAddress = address; - uint8_t bytesWritten = 0; + uint8_t bytesWritten = 0; uint8_t* currentBufferPtr = dataArr; @@ -85,7 +85,12 @@ void M24C32::writeBytes(uint32_t address, uint8_t* dataArr, uint8_t numBytes) { uint8_t bytesToWrite = maxBytes > numBytes ? numBytes : maxBytes; - i2c.writeMemReg(i2cSlaveAddress, currentAddress, currentBufferPtr, bytesToWrite, MEM_ADDRESS_SIZE, MAX_WRITE_TIME); + i2c.writeMemReg(i2cSlaveAddress, + currentAddress, + currentBufferPtr, + bytesToWrite, + MEM_ADDRESS_SIZE, + MAX_WRITE_TIME); bytesWritten += bytesToWrite; currentAddress += bytesWritten; currentBufferPtr = &dataArr[bytesWritten]; @@ -101,4 +106,4 @@ void M24C32::writeWords(uint8_t address, uint32_t* dataArr, uint8_t numWords) { auto* tempDataArr = reinterpret_cast(dataArr); writeBytes(address, tempDataArr, numWords * 4); } -}// namespace core::DEV +} // namespace core::DEV diff --git a/src/core/io/ADC.cpp b/src/core/io/ADC.cpp index 3e4595de..7812878e 100644 --- a/src/core/io/ADC.cpp +++ b/src/core/io/ADC.cpp @@ -2,8 +2,6 @@ namespace core::IO { -ADC::ADC(Pin pin) { - this->pin = pin; -} +ADC::ADC(Pin pin) { this->pin = pin; } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/CAN.cpp b/src/core/io/CAN.cpp index 9e58183a..856b69fe 100644 --- a/src/core/io/CAN.cpp +++ b/src/core/io/CAN.cpp @@ -4,16 +4,14 @@ namespace core::IO { -CAN::CAN(Pin txPin, Pin rxPin, bool loopbackEnabled) : txPin(txPin), - rxPin(rxPin), - loopbackEnabled(loopbackEnabled) { +CAN::CAN(Pin txPin, Pin rxPin, bool loopbackEnabled) : txPin(txPin), rxPin(rxPin), loopbackEnabled(loopbackEnabled) { this->handler = nullptr; - this->priv = nullptr; + this->priv = nullptr; } void CAN::addIRQHandler(void (*handler)(CANMessage&, void*), void* priv) { this->handler = handler; - this->priv = priv; + this->priv = priv; } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/CANopen.cpp b/src/core/io/CANopen.cpp index a19f885c..21b1816d 100644 --- a/src/core/io/CANopen.cpp +++ b/src/core/io/CANopen.cpp @@ -31,7 +31,7 @@ uint8_t testerStorage[MAX_SIZE]; // Queue that stores the CAN messages to send to the CANopen parser core::types::FixedQueue* canQueue; -}// namespace +} // namespace /////////////////////////////////////////////////////////////////////////////// // Forward declarations of CANopen stack CAN functions @@ -61,59 +61,61 @@ static uint32_t nvmRead(uint32_t start, uint8_t* buffer, uint32_t size); static uint32_t nvmWrite(uint32_t start, uint8_t* buffer, uint32_t size); namespace core::IO { -void getCANopenCANDriver(IO::CAN* canInf, - core::types::FixedQueue* messageQueue, +void getCANopenCANDriver(IO::CAN* canInf, core::types::FixedQueue* messageQueue, CO_IF_CAN_DRV* canDriver) { - __evt_core_can__ = canInf; - canQueue = messageQueue; - canDriver->Init = canInit; + __evt_core_can__ = canInf; + canQueue = messageQueue; + canDriver->Init = canInit; canDriver->Enable = canEnable; - canDriver->Read = canRead; - canDriver->Send = canSend; - canDriver->Reset = canReset; - canDriver->Close = canClose; + canDriver->Read = canRead; + canDriver->Send = canSend; + canDriver->Reset = canReset; + canDriver->Close = canClose; } void getCANopenTimerDriver(DEV::Timer* timerIntf, CO_IF_TIMER_DRV* timerDriver) { __evt_core_can_timer__ = timerIntf; - timerDriver->Init = timerInit; + timerDriver->Init = timerInit; timerDriver->Reload = timerReload; - timerDriver->Delay = timerDelay; - timerDriver->Stop = timerStop; - timerDriver->Start = timerStart; + timerDriver->Delay = timerDelay; + timerDriver->Stop = timerStop; + timerDriver->Start = timerStart; timerDriver->Update = timerUpdate; } void getCANopenNVMDriver(CO_IF_NVM_DRV* nvmDriver) { - nvmDriver->Init = nvmInit; - nvmDriver->Read = nvmRead; + nvmDriver->Init = nvmInit; + nvmDriver->Read = nvmRead; nvmDriver->Write = nvmWrite; } -void initializeCANopenDriver(types::FixedQueue* canOpenQueue, IO::CAN* can, core::DEV::Timer* timer, CO_IF_DRV* canStackDriver, CO_IF_NVM_DRV* nvmDriver, CO_IF_TIMER_DRV* timerDriver, CO_IF_CAN_DRV* canDriver) { +void initializeCANopenDriver(types::FixedQueue* canOpenQueue, IO::CAN* can, + core::DEV::Timer* timer, CO_IF_DRV* canStackDriver, CO_IF_NVM_DRV* nvmDriver, + CO_IF_TIMER_DRV* timerDriver, CO_IF_CAN_DRV* canDriver) { IO::getCANopenCANDriver(can, canOpenQueue, canDriver); IO::getCANopenTimerDriver(timer, timerDriver); IO::getCANopenNVMDriver(nvmDriver); - canStackDriver->Can = canDriver; + canStackDriver->Can = canDriver; canStackDriver->Timer = timerDriver; - canStackDriver->Nvm = nvmDriver; + canStackDriver->Nvm = nvmDriver; } -void initializeCANopenNode(CO_NODE* canNode, CANDevice* canDevice, CO_IF_DRV* canStackDriver, uint8_t sdoBuffer[CO_SSDO_N * CO_SDO_BUF_BYTE], CO_TMR_MEM appTmrMem[16]) { - //setup CANopen Node +void initializeCANopenNode(CO_NODE* canNode, CANDevice* canDevice, CO_IF_DRV* canStackDriver, + uint8_t sdoBuffer[CO_SSDO_N * CO_SDO_BUF_BYTE], CO_TMR_MEM appTmrMem[16]) { + // setup CANopen Node CO_NODE_SPEC canSpec = { - .NodeId = canDevice->getNodeID(), + .NodeId = canDevice->getNodeID(), .Baudrate = IO::CAN::DEFAULT_BAUD, - .Dict = canDevice->getObjectDictionary(), - .DictLen = canDevice->getNumElements(), + .Dict = canDevice->getObjectDictionary(), + .DictLen = canDevice->getNumElements(), .EmcyCode = NULL, - .TmrMem = appTmrMem, - .TmrNum = 16, - .TmrFreq = 100, - .Drv = canStackDriver, - .SdoBuf = reinterpret_cast(&sdoBuffer[0]), + .TmrMem = appTmrMem, + .TmrNum = 16, + .TmrFreq = 100, + .Drv = canStackDriver, + .SdoBuf = reinterpret_cast(&sdoBuffer[0]), }; CONodeInit(canNode, &canSpec); @@ -129,7 +131,7 @@ void processCANopenNode(CO_NODE* canNode) { COTmrProcess(&canNode->Tmr); } -}// namespace core::IO +} // namespace core::IO /////////////////////////////////////////////////////////////////////////////// // Implementation of CANopen stack CAN drivers @@ -138,8 +140,7 @@ void processCANopenNode(CO_NODE* canNode) { * Initialize the CAN driver. This doesn't do anything since the CAN interface * should be passed into `getCANopenDriver` pre-initialized. */ -static void canInit(void) { -} +static void canInit(void) {} /** * Enable the CAN driver at the specific baudrate. Again this doesn't @@ -175,10 +176,10 @@ static int16_t canRead(CO_IF_FRM* frm) { // No message if (!canQueue->pop(&message)) - return ((int16_t) 0);// This should be 0 according to CANopen's COIfCanRead + return ((int16_t) 0); // This should be 0 according to CANopen's COIfCanRead frm->Identifier = message.getId(); - frm->DLC = message.getDataLength(); + frm->DLC = message.getDataLength(); // Copy contents into payload buffer for (int i = 0; i < message.getDataLength(); i++) { frm->Data[i] = message.getPayload()[i]; @@ -190,14 +191,12 @@ static int16_t canRead(CO_IF_FRM* frm) { /** * Reset the CAN interface. This does nothing at the moment. */ -static void canReset(void) { -} +static void canReset(void) {} /** * Close the CAN connection. This does nothing at the moment. */ -static void canClose(void) { -} +static void canClose(void) {} /////////////////////////////////////////////////////////////////////////////// // Implementations of CANopen stack timer functions @@ -206,9 +205,7 @@ static void canClose(void) { /** * Interrupt handler for the timer, updates that the timer has gone off */ -void timerHandler(void* halTim) { - timerCounter++; -} +void timerHandler(void* halTim) { timerCounter++; } /** * Initiailize the timer driver. @@ -222,8 +219,8 @@ static void timerReload(uint32_t reload) { __evt_core_can_timer__->stopTimer(); __evt_core_can_timer__->setPeriod(10); __evt_core_can_timer__->startTimer(timerHandler); - timerCounter = 0; - timerRunning = true; + timerCounter = 0; + timerRunning = true; counterTarget = reload; } @@ -247,9 +244,7 @@ static uint8_t timerUpdate(void) { /** * Get the difference between the current value and the target value */ -static uint32_t timerDelay(void) { - return timerCounter > counterTarget ? 0 : counterTarget - timerCounter; -} +static uint32_t timerDelay(void) { return timerCounter > counterTarget ? 0 : counterTarget - timerCounter; } /** * Stop the timer, currently does nothing. @@ -266,8 +261,7 @@ static void timerStop(void) { /** * Initialize the NVM driver, does nothing */ -static void nvmInit(void) { -} +static void nvmInit(void) {} /** * Read from the temporary buffer diff --git a/src/core/io/GPIO.cpp b/src/core/io/GPIO.cpp index 818bad87..15e9f4db 100644 --- a/src/core/io/GPIO.cpp +++ b/src/core/io/GPIO.cpp @@ -3,14 +3,12 @@ namespace core::IO { // Setup instance variables -GPIO::GPIO(Pin pin) { - this->pin = pin; -} +GPIO::GPIO(Pin pin) { this->pin = pin; } GPIO::GPIO(Pin pin, Direction direction, Pull pull) { - this->pin = pin; + this->pin = pin; this->direction = direction; - this->pull = pull; + this->pull = pull; } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/I2C.cpp b/src/core/io/I2C.cpp index 010857da..ee160b00 100644 --- a/src/core/io/I2C.cpp +++ b/src/core/io/I2C.cpp @@ -33,8 +33,7 @@ I2C::I2CStatus I2C::readReg(uint8_t addr, uint8_t reg, uint8_t* output) { return read(addr, output); } -I2C::I2CStatus I2C::writeReg(uint8_t addr, uint8_t* reg, uint8_t regLength, - uint8_t* bytes, uint8_t length) { +I2C::I2CStatus I2C::writeReg(uint8_t addr, uint8_t* reg, uint8_t regLength, uint8_t* bytes, uint8_t length) { I2C_RETURN_IF_ERR(write(addr, reg, regLength)); return write(addr, bytes, length); } @@ -45,8 +44,7 @@ I2C::I2CStatus I2C::writeReg(uint8_t addr, uint8_t* reg, uint8_t regLength, * of 8 bytes starting with the MSB. Reading the response is also done, * starting with the LSB. */ -I2C::I2CStatus I2C::readReg(uint8_t addr, uint8_t* reg, uint8_t regLength, - uint8_t* bytes, uint8_t length) { +I2C::I2CStatus I2C::readReg(uint8_t addr, uint8_t* reg, uint8_t regLength, uint8_t* bytes, uint8_t length) { // Write out register address I2C_RETURN_IF_ERR(write(addr, reg, regLength)); @@ -56,4 +54,4 @@ I2C::I2CStatus I2C::readReg(uint8_t addr, uint8_t* reg, uint8_t regLength, return I2C::I2CStatus::OK; } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/PWM.cpp b/src/core/io/PWM.cpp index d2d00a0f..7b378088 100644 --- a/src/core/io/PWM.cpp +++ b/src/core/io/PWM.cpp @@ -3,9 +3,9 @@ namespace core::IO { PWM::PWM(Pin pin) { - this->pin = pin; + this->pin = pin; this->dutyCycle = 0; - this->period = 0; + this->period = 0; } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/SPI.cpp b/src/core/io/SPI.cpp index 86cb6f01..24185ce1 100644 --- a/src/core/io/SPI.cpp +++ b/src/core/io/SPI.cpp @@ -1,6 +1,6 @@ #include -#define CONCAT(a, b) CONCAT_INNER(a, b) +#define CONCAT(a, b) CONCAT_INNER(a, b) #define CONCAT_INNER(a, b) a##b #define SPI_CHECK(functionCall) \ @@ -10,10 +10,8 @@ namespace core::IO { -SPI::SPI(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin, Pin misoPin) : sckPin(sckPin), - mosiPin(mosiPin), - misoPin(misoPin), - CSPinsLength(pinLength) { +SPI::SPI(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin, Pin misoPin) + : sckPin(sckPin), mosiPin(mosiPin), misoPin(misoPin), CSPinsLength(pinLength) { if (pinLength >= MAX_PINS) { CSPinsLength = MAX_PINS; } @@ -22,11 +20,10 @@ SPI::SPI(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin, Pin misoPin } } -SPI::SPI(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin) : sckPin(sckPin), - mosiPin(mosiPin), - // There is no MISO pin - misoPin(static_cast(0)), - CSPinsLength(pinLength) { +SPI::SPI(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin) + : sckPin(sckPin), mosiPin(mosiPin), + // There is no MISO pin + misoPin(static_cast(0)), CSPinsLength(pinLength) { if (pinLength >= MAX_PINS) { CSPinsLength = MAX_PINS; } @@ -107,4 +104,4 @@ SPI::SPIStatus SPI::readReg(uint8_t device, uint8_t reg, uint8_t* bytes, uint8_t return transmitSuccess ? SPIStatus::OK : SPIStatus::ERROR; } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/UART.cpp b/src/core/io/UART.cpp index 7c144df5..b43b31eb 100644 --- a/src/core/io/UART.cpp +++ b/src/core/io/UART.cpp @@ -6,17 +6,17 @@ namespace core::IO { UART::UART(Pin txPin, Pin rxPin, uint32_t baudrate) { - this->txPin = txPin; - this->rxPin = rxPin; + this->txPin = txPin; + this->rxPin = rxPin; this->baudrate = baudrate; } char* UART::gets(char* buf, size_t size) { - char ret = '\0'; + char ret = '\0'; size_t buf_index = 0; memset(buf, 0, size); - while (ret != '\r' && ret != '\n' && ret != '\4') {// '\4' is EOF + while (ret != '\r' && ret != '\n' && ret != '\4') { // '\4' is EOF ret = getc(); // Check if backspace key is entered @@ -27,8 +27,7 @@ char* UART::gets(char* buf, size_t size) { putc(' '); putc('\b'); } - } else if (buf_index < (size - 1) - && ret != '\r' && ret != '\n' && ret != '\4') { + } else if (buf_index < (size - 1) && ret != '\r' && ret != '\n' && ret != '\4') { buf[buf_index++] = ret; putc(ret); } @@ -37,4 +36,4 @@ char* UART::gets(char* buf, size_t size) { return buf; } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f3xx/ADCf3xx.cpp b/src/core/io/platform/f3xx/ADCf3xx.cpp index 5dfdfb0a..c5b00cf8 100644 --- a/src/core/io/platform/f3xx/ADCf3xx.cpp +++ b/src/core/io/platform/f3xx/ADCf3xx.cpp @@ -14,7 +14,7 @@ namespace { DMA_HandleTypeDef* dmaHandle; ADC_HandleTypeDef* adcHandle; -}// namespace +} // namespace extern "C" void DMA1_Channel1_IRQHandler(void) { HAL_DMA_IRQHandler(dmaHandle); @@ -58,8 +58,7 @@ ADCf3xx::ADCf3xx(Pin pin) : ADC(pin) { addChannel(rank); initDMA(); - HAL_ADC_Start_DMA(&halADC, reinterpret_cast(&buffer[0]), - rank); + HAL_ADC_Start_DMA(&halADC, reinterpret_cast(&buffer[0]), rank); rank++; } @@ -84,25 +83,26 @@ float ADCf3xx::readPercentage() { } void ADCf3xx::initADC(uint8_t num_channels) { - halADC.Instance = ADC1;// Only ADC the F3 supports + halADC.Instance = ADC1; // Only ADC the F3 supports // TODO: Figure out ADC calibration - halADC.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV1;// Use AHB clock (8MHz) w/o division for ADC clock - halADC.Init.Resolution = ADC_RESOLUTION_12B; - halADC.Init.DataAlign = ADC_DATAALIGN_RIGHT; - halADC.Init.ScanConvMode = ADC_SCAN_ENABLE; - halADC.Init.EOCSelection = ADC_EOC_SEQ_CONV; - halADC.Init.LowPowerAutoWait = DISABLE;// Wait for the previous value to be written by DMA before beginning - // next transfer. Not recommended for DMA. - halADC.Init.ContinuousConvMode = ENABLE; - halADC.Init.NbrOfConversion = num_channels; + halADC.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV1; // Use AHB clock (8MHz) w/o division for ADC clock + halADC.Init.Resolution = ADC_RESOLUTION_12B; + halADC.Init.DataAlign = ADC_DATAALIGN_RIGHT; + halADC.Init.ScanConvMode = ADC_SCAN_ENABLE; + halADC.Init.EOCSelection = ADC_EOC_SEQ_CONV; + halADC.Init.LowPowerAutoWait = DISABLE; // Wait for the previous value to be written by DMA before beginning + // next transfer. Not recommended for DMA. + halADC.Init.ContinuousConvMode = ENABLE; + halADC.Init.NbrOfConversion = num_channels; halADC.Init.DiscontinuousConvMode = DISABLE; - halADC.Init.NbrOfDiscConversion = 1;// Parameter discarded when Discontinuous Conv Mode is Disabled - halADC.Init.ExternalTrigConv = ADC_SOFTWARE_START; - halADC.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;// Parameter discared when set to ADC_SOFTWARE_START + halADC.Init.NbrOfDiscConversion = 1; // Parameter discarded when Discontinuous Conv Mode is Disabled + halADC.Init.ExternalTrigConv = ADC_SOFTWARE_START; + halADC.Init.ExternalTrigConvEdge = + ADC_EXTERNALTRIGCONVEDGE_NONE; // Parameter discared when set to ADC_SOFTWARE_START halADC.Init.DMAContinuousRequests = ENABLE; - halADC.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN; + halADC.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN; __HAL_RCC_ADC1_CLK_ENABLE(); HAL_ADC_Init(&halADC); @@ -114,14 +114,14 @@ void ADCf3xx::initDMA() { // TODO: Add some way of selecting the next available DMA channel // Ideally we would have a "DMA" class dedicated to DMA resource // allocation. - halDMA.Instance = DMA1_Channel1; - halDMA.Init.Direction = DMA_PERIPH_TO_MEMORY; - halDMA.Init.PeriphInc = DMA_PINC_DISABLE; - halDMA.Init.MemInc = DMA_MINC_ENABLE; + halDMA.Instance = DMA1_Channel1; + halDMA.Init.Direction = DMA_PERIPH_TO_MEMORY; + halDMA.Init.PeriphInc = DMA_PINC_DISABLE; + halDMA.Init.MemInc = DMA_MINC_ENABLE; halDMA.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; - halDMA.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; - halDMA.Init.Mode = DMA_CIRCULAR; - halDMA.Init.Priority = DMA_PRIORITY_VERY_HIGH; + halDMA.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; + halDMA.Init.Mode = DMA_CIRCULAR; + halDMA.Init.Priority = DMA_PRIORITY_VERY_HIGH; HAL_DMA_Init(&halDMA); @@ -133,11 +133,10 @@ void ADCf3xx::initDMA() { void ADCf3xx::addChannel(uint8_t rank) { GPIO_InitTypeDef gpioInit; - Pin myPins[] = {pin}; + Pin myPins[] = {pin}; uint8_t numOfPins = 1; - GPIOf3xx::gpioStateInit(&gpioInit, myPins, numOfPins, GPIO_MODE_ANALOG, - GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH); + GPIOf3xx::gpioStateInit(&gpioInit, myPins, numOfPins, GPIO_MODE_ANALOG, GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH); ADC_ChannelConfTypeDef adcChannel; @@ -188,20 +187,20 @@ void ADCf3xx::addChannel(uint8_t rank) { adcChannel.Channel = ADC_CHANNEL_15; break; default: - break;// Should never get here + break; // Should never get here } // Subtract 1 because rank starts at 1 channels[rank - 1] = pin; - adcChannel.Rank = rank; + adcChannel.Rank = rank; adcChannel.SamplingTime = ADC_SAMPLETIME_601CYCLES_5; - adcChannel.Offset = 0; - adcChannel.SingleDiff = ADC_SINGLE_ENDED; + adcChannel.Offset = 0; + adcChannel.SingleDiff = ADC_SINGLE_ENDED; adcChannel.OffsetNumber = ADC_OFFSET_NONE; - adcChannel.Offset = 0x000; + adcChannel.Offset = 0x000; HAL_ADC_ConfigChannel(&halADC, &adcChannel); } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f3xx/CANf3xx.cpp b/src/core/io/platform/f3xx/CANf3xx.cpp index 856d9692..5f4313ea 100644 --- a/src/core/io/platform/f3xx/CANf3xx.cpp +++ b/src/core/io/platform/f3xx/CANf3xx.cpp @@ -28,11 +28,9 @@ core::IO::CANf3xx* canIntf; // variable above. CAN_HandleTypeDef* hcan; -}// namespace +} // namespace -extern "C" void CAN_RX0_IRQHandler(void) { - HAL_CAN_IRQHandler(hcan); -} +extern "C" void CAN_RX0_IRQHandler(void) { HAL_CAN_IRQHandler(hcan); } /** * Interrupt handler for incoming CAN messages. The messages are added to @@ -49,7 +47,7 @@ extern "C" void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef* hcan) { // Construct the CANmessage bool isExtended = rxHeader.IDE == CAN_ID_EXT; - uint32_t id = isExtended ? rxHeader.ExtId : rxHeader.StdId; + uint32_t id = isExtended ? rxHeader.ExtId : rxHeader.StdId; core::IO::CANMessage message(id, rxHeader.DLC, payload, isExtended); // Check to see if a user defined IRQ has been provided @@ -62,41 +60,45 @@ extern "C" void HAL_CAN_RxFifo0MsgPendingCallback(CAN_HandleTypeDef* hcan) { namespace core::IO { -CANf3xx::CANf3xx(Pin txPin, Pin rxPin, bool loopbackEnabled) - : CAN(txPin, rxPin, loopbackEnabled) { +CANf3xx::CANf3xx(Pin txPin, Pin rxPin, bool loopbackEnabled) : CAN(txPin, rxPin, loopbackEnabled) { // Setup GPIO GPIO_InitTypeDef gpioInit = {0}; - Pin canPins[] = {txPin, rxPin}; - uint8_t numOfPins = 2; - GPIOf3xx::gpioStateInit(&gpioInit, canPins, numOfPins, GPIO_MODE_AF_OD, - GPIO_PULLUP, GPIO_SPEED_FREQ_HIGH, GPIO_AF9_CAN); + Pin canPins[] = {txPin, rxPin}; + uint8_t numOfPins = 2; + GPIOf3xx::gpioStateInit(&gpioInit, + canPins, + numOfPins, + GPIO_MODE_AF_OD, + GPIO_PULLUP, + GPIO_SPEED_FREQ_HIGH, + GPIO_AF9_CAN); } CAN::CANStatus CANf3xx::connect(bool autoBusOff) { // Initialize HAL CAN // Bit timing values calculated from the website // http://www.bittiming.can-wiki.info/ - uint32_t mode = loopbackEnabled ? CAN_MODE_LOOPBACK : CAN_MODE_NORMAL; - halCAN.Instance = CAN1; - halCAN.Init.Prescaler = 1; - halCAN.Init.Mode = mode; - halCAN.Init.SyncJumpWidth = CAN_SJW_1TQ; - halCAN.Init.TimeSeg1 = CAN_BS1_13TQ; - halCAN.Init.TimeSeg2 = CAN_BS2_2TQ; + uint32_t mode = loopbackEnabled ? CAN_MODE_LOOPBACK : CAN_MODE_NORMAL; + halCAN.Instance = CAN1; + halCAN.Init.Prescaler = 1; + halCAN.Init.Mode = mode; + halCAN.Init.SyncJumpWidth = CAN_SJW_1TQ; + halCAN.Init.TimeSeg1 = CAN_BS1_13TQ; + halCAN.Init.TimeSeg2 = CAN_BS2_2TQ; halCAN.Init.TimeTriggeredMode = DISABLE; if (autoBusOff) { halCAN.Init.AutoBusOff = ENABLE; } else { halCAN.Init.AutoBusOff = DISABLE; } - halCAN.Init.AutoWakeUp = DISABLE; - halCAN.Init.AutoRetransmission = DISABLE; - halCAN.Init.ReceiveFifoLocked = DISABLE; + halCAN.Init.AutoWakeUp = DISABLE; + halCAN.Init.AutoRetransmission = DISABLE; + halCAN.Init.ReceiveFifoLocked = DISABLE; halCAN.Init.TransmitFifoPriority = DISABLE; // Setup global variables - hcan = &this->halCAN; + hcan = &this->halCAN; canIntf = this; __HAL_RCC_CAN1_CLK_ENABLE(); @@ -109,15 +111,15 @@ CAN::CANStatus CANf3xx::connect(bool autoBusOff) { // By default - filter that accepts all incoming messages CAN_FilterTypeDef defaultFilter; - defaultFilter.FilterIdHigh = 0; - defaultFilter.FilterIdLow = 0; - defaultFilter.FilterMaskIdHigh = 0x0000; - defaultFilter.FilterMaskIdLow = 0xFFFF; + defaultFilter.FilterIdHigh = 0; + defaultFilter.FilterIdLow = 0; + defaultFilter.FilterMaskIdHigh = 0x0000; + defaultFilter.FilterMaskIdLow = 0xFFFF; defaultFilter.FilterFIFOAssignment = CAN_FILTER_FIFO0; - defaultFilter.FilterBank = 0; - defaultFilter.FilterMode = CAN_FILTERMODE_IDMASK; - defaultFilter.FilterScale = CAN_FILTERSCALE_16BIT; - defaultFilter.FilterActivation = ENABLE; + defaultFilter.FilterBank = 0; + defaultFilter.FilterMode = CAN_FILTERMODE_IDMASK; + defaultFilter.FilterScale = CAN_FILTERSCALE_16BIT; + defaultFilter.FilterActivation = ENABLE; if (HAL_CAN_ConfigFilter(&halCAN, &defaultFilter) != HAL_OK) { return CANStatus::ERROR; @@ -138,7 +140,7 @@ CAN::CANStatus CANf3xx::disconnect() { } CAN::CANStatus CANf3xx::transmit(CANMessage& message) { - CAN_TxHeaderTypeDef txHeader = {0}; + CAN_TxHeaderTypeDef txHeader = {0}; uint8_t payload[CANMessage::CAN_MAX_PAYLOAD_SIZE] = {0}; uint32_t mailbox = CAN_TX_MAILBOX0; @@ -150,8 +152,8 @@ CAN::CANStatus CANf3xx::transmit(CANMessage& message) { txHeader.StdId = message.getId(); txHeader.IDE = message.isCANExtended() ? CAN_ID_EXT : CAN_ID_STD; // TODO: Consider having remote setting be part of CAN message - txHeader.RTR = CAN_RTR_DATA; - txHeader.DLC = message.getDataLength(); + txHeader.RTR = CAN_RTR_DATA; + txHeader.DLC = message.getDataLength(); txHeader.TransmitGlobalTime = DISABLE; // Copy over bytes @@ -207,15 +209,15 @@ CAN::CANStatus CANf3xx::receive(CANMessage* message, bool blocking) { CAN::CANStatus CANf3xx::addCANFilter(uint16_t filterExplicitId, uint16_t filterMask, uint8_t filterBank) { CAN_FilterTypeDef newFilter; - newFilter.FilterIdHigh = filterExplicitId << 5;//must shift 11-bits to MSB of 16-bits - newFilter.FilterIdLow = 0; - newFilter.FilterMaskIdHigh = filterMask; - newFilter.FilterMaskIdLow = 0xFFFF;//block off second filter with all 1s + newFilter.FilterIdHigh = filterExplicitId << 5; // must shift 11-bits to MSB of 16-bits + newFilter.FilterIdLow = 0; + newFilter.FilterMaskIdHigh = filterMask; + newFilter.FilterMaskIdLow = 0xFFFF; // block off second filter with all 1s newFilter.FilterFIFOAssignment = CAN_FILTER_FIFO0; - newFilter.FilterBank = filterBank; - newFilter.FilterMode = CAN_FILTERMODE_IDMASK; - newFilter.FilterScale = CAN_FILTERSCALE_16BIT; - newFilter.FilterActivation = ENABLE; + newFilter.FilterBank = filterBank; + newFilter.FilterMode = CAN_FILTERMODE_IDMASK; + newFilter.FilterScale = CAN_FILTERSCALE_16BIT; + newFilter.FilterActivation = ENABLE; if (HAL_CAN_ConfigFilter(&halCAN, &newFilter) != HAL_OK) { return CANStatus::ERROR; @@ -226,15 +228,15 @@ CAN::CANStatus CANf3xx::addCANFilter(uint16_t filterExplicitId, uint16_t filterM CAN::CANStatus CANf3xx::enableEmergencyFilter(uint32_t state) { CAN_FilterTypeDef emergencyFilter; - emergencyFilter.FilterIdHigh = 0x1000;//only 0001 (emergency code) allowed - emergencyFilter.FilterIdLow = 0; - emergencyFilter.FilterMaskIdHigh = 0xF000;//1111000000000000 Only looking for 4-bit code - emergencyFilter.FilterMaskIdLow = 0xFFFF; //block off second filter with all 1s + emergencyFilter.FilterIdHigh = 0x1000; // only 0001 (emergency code) allowed + emergencyFilter.FilterIdLow = 0; + emergencyFilter.FilterMaskIdHigh = 0xF000; // 1111000000000000 Only looking for 4-bit code + emergencyFilter.FilterMaskIdLow = 0xFFFF; // block off second filter with all 1s emergencyFilter.FilterFIFOAssignment = CAN_FILTER_FIFO0; - emergencyFilter.FilterBank = 1; - emergencyFilter.FilterMode = CAN_FILTERMODE_IDMASK; - emergencyFilter.FilterScale = CAN_FILTERSCALE_16BIT; - emergencyFilter.FilterActivation = state; + emergencyFilter.FilterBank = 1; + emergencyFilter.FilterMode = CAN_FILTERMODE_IDMASK; + emergencyFilter.FilterScale = CAN_FILTERSCALE_16BIT; + emergencyFilter.FilterActivation = state; if (HAL_CAN_ConfigFilter(&halCAN, &emergencyFilter) != HAL_OK) { return CANStatus::ERROR; @@ -254,4 +256,4 @@ bool CANf3xx::triggerIRQ(CANMessage& message) { return true; } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f3xx/GPIOf3xx.cpp b/src/core/io/platform/f3xx/GPIOf3xx.cpp index 42d91336..e79bfb66 100644 --- a/src/core/io/platform/f3xx/GPIOf3xx.cpp +++ b/src/core/io/platform/f3xx/GPIOf3xx.cpp @@ -10,24 +10,14 @@ #include void (*INTERRUPT_HANDLERS[16])(core::IO::GPIO* pin, void* priv) = {nullptr}; -core::IO::GPIO* INTERRUPT_GPIOS[16] = {nullptr}; -void* INTERRUPT_ARGS[16] = {nullptr}; - -extern "C" void EXTI0_IRQHandler(void) { - HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0); -} -extern "C" void EXTI1_IRQHandler(void) { - HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1); -} -extern "C" void EXTI2_TSC_IRQHandler(void) { - HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2); -} -extern "C" void EXTI3_IRQHandler(void) { - HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_3); -} -extern "C" void EXTI4_IRQHandler(void) { - HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_4); -} +core::IO::GPIO* INTERRUPT_GPIOS[16] = {nullptr}; +void* INTERRUPT_ARGS[16] = {nullptr}; + +extern "C" void EXTI0_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0); } +extern "C" void EXTI1_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1); } +extern "C" void EXTI2_TSC_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2); } +extern "C" void EXTI3_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_3); } +extern "C" void EXTI4_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_4); } extern "C" void EXTI9_5_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_5); HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_6); @@ -47,7 +37,7 @@ extern "C" void EXTI15_10_IRQHandler(void) { extern "C" void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { uint16_t tmpPin = GPIO_Pin; - uint8_t count = 0; + uint8_t count = 0; while ((tmpPin & 0x0001) == 0) { tmpPin = tmpPin >> 1; @@ -60,14 +50,15 @@ extern "C" void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { namespace core::IO { -GPIOf3xx::GPIOf3xx(Pin pin, GPIO::Direction direction, Pull pull) - : GPIO(pin, direction, pull) { +GPIOf3xx::GPIOf3xx(Pin pin, GPIO::Direction direction, Pull pull) : GPIO(pin, direction, pull) { GPIO_InitTypeDef gpioInit; - Pin myPins[] = {pin}; + Pin myPins[] = {pin}; uint8_t numOfPins = 1; - gpioStateInit(&gpioInit, myPins, numOfPins, + gpioStateInit(&gpioInit, + myPins, + numOfPins, static_cast(direction), static_cast(pull), GPIO_SPEED_FREQ_HIGH); @@ -89,11 +80,11 @@ GPIOf3xx::GPIOf3xx(Pin pin, GPIO::Direction direction, Pull pull) this->port = GPIOF; break; default: - break;// Should never get here + break; // Should never get here } this->halPin = 1 << (static_cast(this->pin) & 0x0F); - this->writePin(GPIO::State::LOW);// Output set low by default + this->writePin(GPIO::State::LOW); // Output set low by default } void GPIOf3xx::setDirection(GPIO::Direction direction) { @@ -101,27 +92,27 @@ void GPIOf3xx::setDirection(GPIO::Direction direction) { } void GPIOf3xx::writePin(GPIO::State state) { - HAL_GPIO_WritePin(this->port, this->halPin, - static_cast(state)); + HAL_GPIO_WritePin(this->port, this->halPin, static_cast(state)); } -GPIO::State GPIOf3xx::readPin() { - return static_cast(HAL_GPIO_ReadPin(this->port, this->halPin)); -} +GPIO::State GPIOf3xx::readPin() { return static_cast(HAL_GPIO_ReadPin(this->port, this->halPin)); } void GPIOf3xx::registerIRQ(TriggerEdge edge, void (*irqHandler)(GPIO* pin, void* priv), void* priv) { GPIO_InitTypeDef gpioInit; - Pin myPins[] = {pin}; + Pin myPins[] = {pin}; uint8_t numOfPins = 1; - gpioStateInit(&gpioInit, myPins, numOfPins, + gpioStateInit(&gpioInit, + myPins, + numOfPins, GPIOf3xx::GPIO_TRIGGER_INTERRUPT_BASE | (static_cast(edge) << GPIO_MODE_IT_SHIFT), - GPIO_PULLDOWN, GPIO_SPEED_FREQ_HIGH); + GPIO_PULLDOWN, + GPIO_SPEED_FREQ_HIGH); - auto pin_index = static_cast(this->pin) & 0x0F; + auto pin_index = static_cast(this->pin) & 0x0F; INTERRUPT_HANDLERS[pin_index] = irqHandler; - INTERRUPT_GPIOS[pin_index] = this; - INTERRUPT_ARGS[pin_index] = priv; + INTERRUPT_GPIOS[pin_index] = this; + INTERRUPT_ARGS[pin_index] = priv; IRQn_Type irqNum; switch (this->halPin) { @@ -157,22 +148,20 @@ void GPIOf3xx::registerIRQ(TriggerEdge edge, void (*irqHandler)(GPIO* pin, void* break; default: - return;// Shouldn't get here + return; // Shouldn't get here } HAL_NVIC_SetPriority(irqNum, core::platform::GPIO_INTERRUPT_PRIORITY, 0); HAL_NVIC_EnableIRQ(irqNum); } -void GPIOf3xx::gpioStateInit(GPIO_InitTypeDef* targetGpio, Pin* pins, - uint8_t numOfPins, uint32_t mode, uint32_t pull, +void GPIOf3xx::gpioStateInit(GPIO_InitTypeDef* targetGpio, Pin* pins, uint8_t numOfPins, uint32_t mode, uint32_t pull, uint32_t speed, uint8_t alternate) { if (numOfPins == 2) { - targetGpio->Pin = - static_cast(1 << (static_cast(pins[0]) & 0x0F)) | static_cast(1 << (static_cast(pins[1]) & 0x0F)); + targetGpio->Pin = static_cast(1 << (static_cast(pins[0]) & 0x0F)) + | static_cast(1 << (static_cast(pins[1]) & 0x0F)); } else { - targetGpio->Pin = - static_cast(1 << (static_cast(pins[0]) & 0x0F)); + targetGpio->Pin = static_cast(1 << (static_cast(pins[0]) & 0x0F)); } targetGpio->Mode = mode; @@ -209,8 +198,8 @@ void GPIOf3xx::gpioStateInit(GPIO_InitTypeDef* targetGpio, Pin* pins, HAL_GPIO_Init(GPIOF, targetGpio); break; default: - break;// Should never get here + break; // Should never get here } } } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f3xx/I2Cf3xx.cpp b/src/core/io/platform/f3xx/I2Cf3xx.cpp index 3a5d8ace..35eefe52 100644 --- a/src/core/io/platform/f3xx/I2Cf3xx.cpp +++ b/src/core/io/platform/f3xx/I2Cf3xx.cpp @@ -89,7 +89,7 @@ static void getInstance(uint8_t portID, I2C_TypeDef** instance, uint8_t* altId) #ifdef STM32F334x8 *instance = I2C1; - *altId = GPIO_AF4_I2C1; + *altId = GPIO_AF4_I2C1; if (!(__HAL_RCC_I2C1_IS_CLK_ENABLED())) __HAL_RCC_I2C1_CLK_ENABLE(); #endif @@ -102,39 +102,34 @@ I2Cf3xx::I2Cf3xx(Pin sclPin, Pin sdaPin) : I2C(sclPin, sdaPin) { uint8_t portId = getPortID(sclPin); getInstance(portId, &halI2C.Instance, &altId); - Pin i2cPins[] = {sclPin, sdaPin}; + Pin i2cPins[] = {sclPin, sdaPin}; uint8_t numOfPins = 2; - GPIOf3xx::gpioStateInit(&gpioInit, i2cPins, numOfPins, GPIO_MODE_AF_OD, - GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, altId); + GPIOf3xx::gpioStateInit(&gpioInit, i2cPins, numOfPins, GPIO_MODE_AF_OD, GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, altId); // 8MHz = 0x00310309; 16MHz = 0x10320309; 48MHz = 0x50330309 halI2C.Init.Timing = 0x00310309; // Timing Register Layout(Bits): [PRESC(4)][RESERVED(4)] // [SCLDEL(4)][SDADEL(4)] // [SCLH(8)][SCLL(8)] - halI2C.Init.OwnAddress1 = 0; - halI2C.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; - halI2C.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; - halI2C.Init.OwnAddress2 = 0; + halI2C.Init.OwnAddress1 = 0; + halI2C.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; + halI2C.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; + halI2C.Init.OwnAddress2 = 0; halI2C.Init.OwnAddress2Masks = I2C_OA2_NOMASK; - halI2C.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE; - halI2C.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; + halI2C.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE; + halI2C.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; HAL_I2C_Init(&halI2C); } I2C::I2CStatus I2Cf3xx::write(uint8_t addr, uint8_t byte) { - HAL_StatusTypeDef status = HAL_I2C_Master_Transmit(&halI2C, addr << 1, - &byte, 1, - EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = HAL_I2C_Master_Transmit(&halI2C, addr << 1, &byte, 1, EVT_I2C_TIMEOUT); return halToI2CStatus(status); } I2C::I2CStatus I2Cf3xx::read(uint8_t addr, uint8_t* output) { - HAL_StatusTypeDef status = HAL_I2C_Master_Receive(&halI2C, addr << 1, - output, 1, - EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = HAL_I2C_Master_Receive(&halI2C, addr << 1, output, 1, EVT_I2C_TIMEOUT); return halToI2CStatus(status); } @@ -143,9 +138,7 @@ I2C::I2CStatus I2Cf3xx::read(uint8_t addr, uint8_t* output) { * this via the HAL. */ I2C::I2CStatus I2Cf3xx::write(uint8_t addr, uint8_t* bytes, uint8_t length) { - HAL_StatusTypeDef status = HAL_I2C_Master_Transmit(&halI2C, addr << 1, - bytes, length, - EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = HAL_I2C_Master_Transmit(&halI2C, addr << 1, bytes, length, EVT_I2C_TIMEOUT); return halToI2CStatus(status); } @@ -154,54 +147,39 @@ I2C::I2CStatus I2Cf3xx::write(uint8_t addr, uint8_t* bytes, uint8_t length) { * this via the HAL. */ I2C::I2CStatus I2Cf3xx::read(uint8_t addr, uint8_t* bytes, uint8_t length) { - HAL_StatusTypeDef status = HAL_I2C_Master_Receive(&halI2C, addr << 1, - bytes, length, - EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = HAL_I2C_Master_Receive(&halI2C, addr << 1, bytes, length, EVT_I2C_TIMEOUT); return halToI2CStatus(status); } -I2C::I2CStatus I2Cf3xx::writeMemReg(uint8_t addr, uint32_t memAddress, - uint8_t byte, uint16_t memAddSize, +I2C::I2CStatus I2Cf3xx::writeMemReg(uint8_t addr, uint32_t memAddress, uint8_t byte, uint16_t memAddSize, uint8_t maxWriteTime) { uint16_t memAddress16 = memAddress; - HAL_StatusTypeDef status = HAL_I2C_Mem_Write(&halI2C, addr << 1, - memAddress16, memAddSize, - &byte, 1, EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = + HAL_I2C_Mem_Write(&halI2C, addr << 1, memAddress16, memAddSize, &byte, 1, EVT_I2C_TIMEOUT); HAL_Delay(maxWriteTime); return halToI2CStatus(status); } -I2C::I2CStatus I2Cf3xx::readMemReg(uint8_t addr, uint32_t memAddress, - uint8_t* byte, - uint16_t memAddSize) { - uint16_t memAddress16 = memAddress; - HAL_StatusTypeDef status = HAL_I2C_Mem_Read(&halI2C, addr << 1, - memAddress16, memAddSize, byte, - 1, EVT_I2C_TIMEOUT); +I2C::I2CStatus I2Cf3xx::readMemReg(uint8_t addr, uint32_t memAddress, uint8_t* byte, uint16_t memAddSize) { + uint16_t memAddress16 = memAddress; + HAL_StatusTypeDef status = HAL_I2C_Mem_Read(&halI2C, addr << 1, memAddress16, memAddSize, byte, 1, EVT_I2C_TIMEOUT); return halToI2CStatus(status); } -I2C::I2CStatus I2Cf3xx::writeMemReg(uint8_t addr, uint32_t memAddress, - uint8_t* bytes, uint8_t size, - uint16_t memAddSize, - uint8_t maxWriteTime) { +I2C::I2CStatus I2Cf3xx::writeMemReg(uint8_t addr, uint32_t memAddress, uint8_t* bytes, uint8_t size, + uint16_t memAddSize, uint8_t maxWriteTime) { uint16_t memAddress16 = memAddress; - HAL_StatusTypeDef status = HAL_I2C_Mem_Write(&halI2C, addr << 1, - memAddress16, memAddSize, - bytes, size, - EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = + HAL_I2C_Mem_Write(&halI2C, addr << 1, memAddress16, memAddSize, bytes, size, EVT_I2C_TIMEOUT); HAL_Delay(maxWriteTime); return halToI2CStatus(status); } -I2C::I2CStatus I2Cf3xx::readMemReg(uint8_t addr, uint32_t memAddress, - uint8_t* bytes, uint8_t size, +I2C::I2CStatus I2Cf3xx::readMemReg(uint8_t addr, uint32_t memAddress, uint8_t* bytes, uint8_t size, uint16_t memAddSize) { uint16_t memAddress16 = memAddress; - HAL_StatusTypeDef status = HAL_I2C_Mem_Read(&halI2C, addr << 1, - memAddress16, memAddSize, - bytes, size, - EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = + HAL_I2C_Mem_Read(&halI2C, addr << 1, memAddress16, memAddSize, bytes, size, EVT_I2C_TIMEOUT); return halToI2CStatus(status); } @@ -221,4 +199,4 @@ I2C::I2CStatus I2Cf3xx::halToI2CStatus(HAL_StatusTypeDef halStatus) { } } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f3xx/PWMf3xx.cpp b/src/core/io/platform/f3xx/PWMf3xx.cpp index 0285a0ae..6e8d1b02 100644 --- a/src/core/io/platform/f3xx/PWMf3xx.cpp +++ b/src/core/io/platform/f3xx/PWMf3xx.cpp @@ -13,30 +13,29 @@ namespace core::IO { * @param channel The channel to assign to * @param alternateFunction The GPIO identifier for the function of the pin */ -static void getInstance(Pin pin, TIM_TypeDef** instance, uint32_t* channel, - uint32_t* alternateFunction) { +static void getInstance(Pin pin, TIM_TypeDef** instance, uint32_t* channel, uint32_t* alternateFunction) { switch (pin) { #if defined(STM32F302x8) case Pin::PA_0: - *instance = TIM2; - *channel = TIM_CHANNEL_1; + *instance = TIM2; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM2; break; // complementary channel //////////////////////////////////////////// case Pin::PA_1: - *instance = TIM15; - *channel = TIM_CHANNEL_1; + *instance = TIM15; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF9_TIM15; break; case Pin::PA_2: - *instance = TIM15; - *channel = TIM_CHANNEL_1; + *instance = TIM15; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF9_TIM15; break; case Pin::PA_3: - *instance = TIM15; - *channel = TIM_CHANNEL_2; + *instance = TIM15; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF3_TIM15; break; ///////////////////////////////////////////////////////////// @@ -46,374 +45,374 @@ static void getInstance(Pin pin, TIM_TypeDef** instance, uint32_t* channel, // *alternateFunction = GPIO_AF2_TIM3; // break; case Pin::PA_5: - *instance = TIM2; - *channel = TIM_CHANNEL_1; + *instance = TIM2; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF10_TIM2; break; case Pin::PA_8: - *instance = TIM1; - *channel = TIM_CHANNEL_1; + *instance = TIM1; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF6_TIM1; break; case Pin::PA_6: - *instance = TIM16; - *channel = TIM_CHANNEL_1; + *instance = TIM16; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM16; break; case Pin::PA_7: - *instance = TIM17; - *channel = TIM_CHANNEL_1; + *instance = TIM17; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM17; break; case Pin::PA_9: - *instance = TIM1; - *channel = TIM_CHANNEL_2; + *instance = TIM1; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF6_TIM1; break; case Pin::PA_10: - *instance = TIM1; - *channel = TIM_CHANNEL_3; + *instance = TIM1; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF6_TIM1; break; case Pin::PA_11: - *instance = TIM1; - *channel = TIM_CHANNEL_4; + *instance = TIM1; + *channel = TIM_CHANNEL_4; *alternateFunction = GPIO_AF11_TIM1; break; case Pin::PA_12: - *instance = TIM16; - *channel = TIM_CHANNEL_1; + *instance = TIM16; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM16; break; // complementary channel case Pin::PA_13: - *instance = TIM16; - *channel = TIM_CHANNEL_1; + *instance = TIM16; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM16; break; case Pin::PA_15: - *instance = TIM2; - *channel = TIM_CHANNEL_1; + *instance = TIM2; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF10_TIM2; break; // complementary channel case Pin::PB_0: - *instance = TIM1; - *channel = TIM_CHANNEL_2; + *instance = TIM1; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF6_TIM1; break; // complementary channel case Pin::PB_1: - *instance = TIM1; - *channel = TIM_CHANNEL_3; + *instance = TIM1; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF6_TIM1; break; case Pin::PB_3: - *instance = TIM2; - *channel = TIM_CHANNEL_2; + *instance = TIM2; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF1_TIM2; case Pin::PB_4: - *instance = TIM16; - *channel = TIM_CHANNEL_1; + *instance = TIM16; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM16; break; case Pin::PB_5: - *instance = TIM17; - *channel = TIM_CHANNEL_1; + *instance = TIM17; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF10_TIM17; break; // complementary channel case Pin::PB_6: - *instance = TIM16; - *channel = TIM_CHANNEL_1; + *instance = TIM16; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM16; break; // complementary channel case Pin::PB_7: - *instance = TIM17; - *channel = TIM_CHANNEL_1; + *instance = TIM17; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM17; break; case Pin::PB_8: - *instance = TIM16; - *channel = TIM_CHANNEL_1; + *instance = TIM16; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM16; break; case Pin::PB_9: - *instance = TIM17; - *channel = TIM_CHANNEL_1; + *instance = TIM17; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM17; break; case Pin::PB_10: - *instance = TIM2; - *channel = TIM_CHANNEL_3; + *instance = TIM2; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF1_TIM2; break; case Pin::PB_11: - *instance = TIM2; - *channel = TIM_CHANNEL_4; + *instance = TIM2; + *channel = TIM_CHANNEL_4; *alternateFunction = GPIO_AF1_TIM2; break; // complementation channel case Pin::PB_13: - *instance = TIM1; - *channel = TIM_CHANNEL_1; + *instance = TIM1; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF6_TIM1; break; case Pin::PB_14: - *instance = TIM15; - *channel = TIM_CHANNEL_1; + *instance = TIM15; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM15; break; case Pin::PB_15: - *instance = TIM15; - *channel = TIM_CHANNEL_2; + *instance = TIM15; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF1_TIM15; break; case Pin::PC_0: - *instance = TIM1; - *channel = TIM_CHANNEL_1; + *instance = TIM1; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF2_TIM1; break; case Pin::PC_1: - *instance = TIM1; - *channel = TIM_CHANNEL_2; + *instance = TIM1; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF2_TIM1; break; case Pin::PC_2: - *instance = TIM1; - *channel = TIM_CHANNEL_3; + *instance = TIM1; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF2_TIM1; break; case Pin::PC_3: - *instance = TIM1; - *channel = TIM_CHANNEL_4; + *instance = TIM1; + *channel = TIM_CHANNEL_4; *alternateFunction = GPIO_AF2_TIM1; break; // complementary channel case Pin::PC_13: - *instance = TIM1; - *channel = TIM_CHANNEL_1; + *instance = TIM1; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF4_TIM1; break; // complementary channel case Pin::PF_0: - *instance = TIM1; - *channel = TIM_CHANNEL_3; + *instance = TIM1; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF6_TIM1; break; #elif defined(STM32F334x8) case Pin::PA_0: - *instance = TIM2; - *channel = TIM_CHANNEL_1; + *instance = TIM2; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM2; break; // complementary channel case Pin::PA_1: - *instance = TIM15; - *channel = TIM_CHANNEL_1; + *instance = TIM15; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF2_TIM15; break; - //PWM not shown for PA_2 - PA_5 - // case Pin::PA_2: - // *instance = TIM15; - // *channel = TIM_CHANNEL_1; - // *alternateFunction = GPIO_AF1_TIM15; - // break; - // case Pin::PA_3: - // *instance = TIM15; - // *channel = TIM_CHANNEL_2; - // *alternateFunction = GPIO_AF2_TIM15; - // break; - // case Pin:: PA_4: - // *instance = TIM3; - // *channel = TIM_CHANNEL_2; - // *alternateFunction = GPIO_AF2_TIM3; - // break; - // case Pin::PA_5: - // *instance = TIM2; - // *channel = TIM_CHANNEL_1; - // *alternateFunction = GPIO_AF10_TIM2; - // break; + // PWM not shown for PA_2 - PA_5 + // case Pin::PA_2: + // *instance = TIM15; + // *channel = TIM_CHANNEL_1; + // *alternateFunction = GPIO_AF1_TIM15; + // break; + // case Pin::PA_3: + // *instance = TIM15; + // *channel = TIM_CHANNEL_2; + // *alternateFunction = GPIO_AF2_TIM15; + // break; + // case Pin:: PA_4: + // *instance = TIM3; + // *channel = TIM_CHANNEL_2; + // *alternateFunction = GPIO_AF2_TIM3; + // break; + // case Pin::PA_5: + // *instance = TIM2; + // *channel = TIM_CHANNEL_1; + // *alternateFunction = GPIO_AF10_TIM2; + // break; case Pin::PA_8: - *instance = TIM1; - *channel = TIM_CHANNEL_1; + *instance = TIM1; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF6_TIM1; break; case Pin::PA_6: - *instance = TIM16; - *channel = TIM_CHANNEL_1; + *instance = TIM16; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM16; break; case Pin::PA_7: - *instance = TIM17; - *channel = TIM_CHANNEL_1; + *instance = TIM17; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM17; break; case Pin::PA_9: - *instance = TIM1; - *channel = TIM_CHANNEL_2; + *instance = TIM1; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF6_TIM1; break; case Pin::PA_10: - *instance = TIM1; - *channel = TIM_CHANNEL_3; + *instance = TIM1; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF6_TIM1; break; case Pin::PA_11: - *instance = TIM1; - *channel = TIM_CHANNEL_4; + *instance = TIM1; + *channel = TIM_CHANNEL_4; *alternateFunction = GPIO_AF11_TIM1; break; case Pin::PA_12: - *instance = TIM16; - *channel = TIM_CHANNEL_1; + *instance = TIM16; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM16; break; // complementary channel case Pin::PA_13: - *instance = TIM16; - *channel = TIM_CHANNEL_1; + *instance = TIM16; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM16; break; case Pin::PA_15: - *instance = TIM2; - *channel = TIM_CHANNEL_1; + *instance = TIM2; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM2; break; // complementary channel case Pin::PB_0: - *instance = TIM1; - *channel = TIM_CHANNEL_2; + *instance = TIM1; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF6_TIM1; break; // complementary channel case Pin::PB_1: - *instance = TIM1; - *channel = TIM_CHANNEL_3; + *instance = TIM1; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF6_TIM1; break; case Pin::PB_3: - *instance = TIM2; - *channel = TIM_CHANNEL_2; + *instance = TIM2; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF1_TIM2; break; case Pin::PB_4: - *instance = TIM16; - *channel = TIM_CHANNEL_1; + *instance = TIM16; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM16; break; case Pin::PB_5: - *instance = TIM17; - *channel = TIM_CHANNEL_1; + *instance = TIM17; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF10_TIM17; break; // complementary channel case Pin::PB_6: - *instance = TIM16; - *channel = TIM_CHANNEL_1; + *instance = TIM16; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM16; break; // complementary channel case Pin::PB_7: - *instance = TIM17; - *channel = TIM_CHANNEL_1; + *instance = TIM17; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM17; break; case Pin::PB_8: - *instance = TIM16; - *channel = TIM_CHANNEL_1; + *instance = TIM16; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM16; break; case Pin::PB_9: - *instance = TIM17; - *channel = TIM_CHANNEL_1; + *instance = TIM17; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM17; break; case Pin::PB_10: - *instance = TIM2; - *channel = TIM_CHANNEL_3; + *instance = TIM2; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF1_TIM2; break; case Pin::PB_11: - *instance = TIM2; - *channel = TIM_CHANNEL_4; + *instance = TIM2; + *channel = TIM_CHANNEL_4; *alternateFunction = GPIO_AF1_TIM2; break; // complementary channel case Pin::PB_13: - *instance = TIM1; - *channel = TIM_CHANNEL_1; + *instance = TIM1; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF6_TIM1; break; case Pin::PB_14: - *instance = TIM15; - *channel = TIM_CHANNEL_1; + *instance = TIM15; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM15; break; case Pin::PB_15: - *instance = TIM15; - *channel = TIM_CHANNEL_2; + *instance = TIM15; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF1_TIM15; break; case Pin::PC_0: - *instance = TIM1; - *channel = TIM_CHANNEL_1; + *instance = TIM1; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF2_TIM1; break; case Pin::PC_1: - *instance = TIM1; - *channel = TIM_CHANNEL_2; + *instance = TIM1; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF2_TIM1; break; case Pin::PC_2: - *instance = TIM1; - *channel = TIM_CHANNEL_3; + *instance = TIM1; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF2_TIM1; break; case Pin::PC_3: - *instance = TIM1; - *channel = TIM_CHANNEL_4; + *instance = TIM1; + *channel = TIM_CHANNEL_4; *alternateFunction = GPIO_AF2_TIM1; break; - //PWM not shown for PC_6 - PC_9 - // case Pin::PC_6: - // *instance = TIM3; - // *channel = TIM_CHANNEL_1; - // *alternateFunction = GPIO_AF2_TIM3; - // break; - // case Pin::PC_7 : - // *instance = TIM3; - // *channel = TIM_CHANNEL_1; - // *alternateFunction = GPIO_AF10_TIM3; - // break; - // case Pin::PC_8: - // *instance = TIM3; - // *channel = TIM_CHANNEL_3; - // *alternateFunction = GPIO_AF2_TIM3; - // break; - // case Pin::PC_9: - // *instance = TIM3; - // *channel = TIM_CHANNEL_4; - // *alternateFunction = GPIO_AF10_TIM3; - // break; - // complementary channel + // PWM not shown for PC_6 - PC_9 + // case Pin::PC_6: + // *instance = TIM3; + // *channel = TIM_CHANNEL_1; + // *alternateFunction = GPIO_AF2_TIM3; + // break; + // case Pin::PC_7 : + // *instance = TIM3; + // *channel = TIM_CHANNEL_1; + // *alternateFunction = GPIO_AF10_TIM3; + // break; + // case Pin::PC_8: + // *instance = TIM3; + // *channel = TIM_CHANNEL_3; + // *alternateFunction = GPIO_AF2_TIM3; + // break; + // case Pin::PC_9: + // *instance = TIM3; + // *channel = TIM_CHANNEL_4; + // *alternateFunction = GPIO_AF10_TIM3; + // break; + // complementary channel case Pin::PC_13: - *instance = TIM1; - *channel = TIM_CHANNEL_1; + *instance = TIM1; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF4_TIM1; break; // complementary channel case Pin::PF_0: - *instance = TIM1; - *channel = TIM_CHANNEL_3; + *instance = TIM1; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF6_TIM1; break; #endif default: - *instance = NULL; - *channel = -1; + *instance = NULL; + *channel = -1; *alternateFunction = -1; } } @@ -434,41 +433,45 @@ PWMf3xx::PWMf3xx(Pin pin) : PWM(pin) { } else if (instance == TIM17) { __HAL_RCC_TIM17_CLK_ENABLE(); } - //TODO:Investigate Timer 3 on 334 - // } else if (instance == TIM3) { - // __HAL_RCC_TIM3_CLK_ENABLE(); - // } + // TODO:Investigate Timer 3 on 334 + // } else if (instance == TIM3) { + // __HAL_RCC_TIM3_CLK_ENABLE(); + // } TIM_BreakDeadTimeConfigTypeDef sBreakDeadTimeConfig = {0}; - halTIM.Instance = instance; - halTIM.Init.Prescaler = 0; - halTIM.Init.CounterMode = TIM_COUNTERMODE_UP; - halTIM.Init.Period = 0; - halTIM.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; + halTIM.Instance = instance; + halTIM.Init.Prescaler = 0; + halTIM.Init.CounterMode = TIM_COUNTERMODE_UP; + halTIM.Init.Period = 0; + halTIM.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; halTIM.Init.RepetitionCounter = 0; halTIM.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; HAL_TIM_Base_Init(&halTIM); HAL_TIM_PWM_Init(&halTIM); - sBreakDeadTimeConfig.OffStateRunMode = TIM_OSSR_DISABLE; + sBreakDeadTimeConfig.OffStateRunMode = TIM_OSSR_DISABLE; sBreakDeadTimeConfig.OffStateIDLEMode = TIM_OSSI_DISABLE; - sBreakDeadTimeConfig.LockLevel = TIM_LOCKLEVEL_OFF; - sBreakDeadTimeConfig.DeadTime = 0; - sBreakDeadTimeConfig.BreakState = TIM_BREAK_DISABLE; - sBreakDeadTimeConfig.BreakPolarity = TIM_BREAKPOLARITY_HIGH; - sBreakDeadTimeConfig.BreakFilter = 0; - sBreakDeadTimeConfig.AutomaticOutput = TIM_AUTOMATICOUTPUT_DISABLE; + sBreakDeadTimeConfig.LockLevel = TIM_LOCKLEVEL_OFF; + sBreakDeadTimeConfig.DeadTime = 0; + sBreakDeadTimeConfig.BreakState = TIM_BREAK_DISABLE; + sBreakDeadTimeConfig.BreakPolarity = TIM_BREAKPOLARITY_HIGH; + sBreakDeadTimeConfig.BreakFilter = 0; + sBreakDeadTimeConfig.AutomaticOutput = TIM_AUTOMATICOUTPUT_DISABLE; HAL_TIMEx_ConfigBreakDeadTime(&halTIM, &sBreakDeadTimeConfig); // Setup GPIO pin for PMW GPIO_InitTypeDef gpioInit = {0}; - Pin myPins[] = {pin}; - uint8_t numOfPins = 1; + Pin myPins[] = {pin}; + uint8_t numOfPins = 1; - GPIOf3xx::gpioStateInit(&gpioInit, myPins, numOfPins, GPIO_MODE_AF_PP, - GPIO_NOPULL, GPIO_SPEED_FREQ_LOW, + GPIOf3xx::gpioStateInit(&gpioInit, + myPins, + numOfPins, + GPIO_MODE_AF_PP, + GPIO_NOPULL, + GPIO_SPEED_FREQ_LOW, alternateFunction); } @@ -476,13 +479,13 @@ void PWMf3xx::setDutyCycle(uint32_t dutyCycle) { this->dutyCycle = dutyCycle; TIM_OC_InitTypeDef sConfigOC = {0}; - sConfigOC.OCMode = TIM_OCMODE_PWM1; - sConfigOC.Pulse = dutyCycle * halTIM.Init.Period / 100; - sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; - sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH; - sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; - sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET; - sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET; + sConfigOC.OCMode = TIM_OCMODE_PWM1; + sConfigOC.Pulse = dutyCycle * halTIM.Init.Period / 100; + sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; + sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH; + sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; + sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET; + sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET; HAL_TIM_PWM_Stop(&halTIM, halTIMChannelID); HAL_TIM_PWM_ConfigChannel(&halTIM, &sConfigOC, halTIMChannelID); @@ -498,7 +501,7 @@ void PWMf3xx::setPeriod(uint32_t period) { HAL_TIM_PWM_Stop(&halTIM, halTIMChannelID); uint32_t autoReload; - uint32_t prescaler = -1; + uint32_t prescaler = -1; uint64_t clockFrequency = HAL_RCC_GetSysClockFreq(); // Required loop in order to determine a prescaler which will bring the @@ -508,7 +511,7 @@ void PWMf3xx::setPeriod(uint32_t period) { autoReload = period * clockFrequency / (prescaler + 1) / 1000000 - 1; } while (autoReload > 65535); - halTIM.Init.Period = autoReload; + halTIM.Init.Period = autoReload; halTIM.Init.Prescaler = prescaler; HAL_TIM_Base_Init(&halTIM); HAL_TIM_PWM_Start(&halTIM, halTIMChannelID); @@ -517,12 +520,8 @@ void PWMf3xx::setPeriod(uint32_t period) { setDutyCycle(this->dutyCycle); } -uint32_t PWMf3xx::getDutyCycle() { - return dutyCycle; -} +uint32_t PWMf3xx::getDutyCycle() { return dutyCycle; } -uint32_t PWMf3xx::getPeriod() { - return period; -} +uint32_t PWMf3xx::getPeriod() { return period; } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f3xx/SPIf3xx.cpp b/src/core/io/platform/f3xx/SPIf3xx.cpp index 45c65b38..11025b2c 100644 --- a/src/core/io/platform/f3xx/SPIf3xx.cpp +++ b/src/core/io/platform/f3xx/SPIf3xx.cpp @@ -92,12 +92,13 @@ uint8_t SPIf3xx::getSCKPortID(Pin sckPin) { #endif } -SPIf3xx::SPIf3xx(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin, Pin misoPin) : SPI(CSPins, pinLength, sckPin, mosiPin, misoPin) { - uint8_t mosiPort = getMOSIPortID(mosiPin); - uint8_t misoPort = getMISOPortID(misoPin); - uint8_t sckPort = getSCKPortID(sckPin); +SPIf3xx::SPIf3xx(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin, Pin misoPin) + : SPI(CSPins, pinLength, sckPin, mosiPin, misoPin) { + uint8_t mosiPort = getMOSIPortID(mosiPin); + uint8_t misoPort = getMISOPortID(misoPin); + uint8_t sckPort = getSCKPortID(sckPin); GPIO_InitTypeDef GPIOInit = {0}; - uint8_t altId = 0x00U; + uint8_t altId = 0x00U; if (mosiPort == misoPort && misoPort == sckPort) { switch (mosiPort) { @@ -133,36 +134,46 @@ SPIf3xx::SPIf3xx(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin, Pin // gpioStateInit only supports initializing up to 2 pins, so this must be done // init mosiPin and misoPin - Pin spiPins[] = {mosiPin, misoPin}; + Pin spiPins[] = {mosiPin, misoPin}; uint8_t numOfPins = 2; - GPIOf3xx::gpioStateInit(&GPIOInit, spiPins, numOfPins, GPIO_MODE_AF_PP, - GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, altId); + GPIOf3xx::gpioStateInit(&GPIOInit, + spiPins, + numOfPins, + GPIO_MODE_AF_PP, + GPIO_NOPULL, + GPIO_SPEED_FREQ_HIGH, + altId); // init sckPin spiPins[0] = sckPin; - numOfPins = 1; - GPIOf3xx::gpioStateInit(&GPIOInit, spiPins, numOfPins, GPIO_MODE_AF_PP, - GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, altId); - - halSPI.Init.Mode = SPI_MODE_MASTER; + numOfPins = 1; + GPIOf3xx::gpioStateInit(&GPIOInit, + spiPins, + numOfPins, + GPIO_MODE_AF_PP, + GPIO_NOPULL, + GPIO_SPEED_FREQ_HIGH, + altId); + + halSPI.Init.Mode = SPI_MODE_MASTER; halSPI.Init.Direction = SPI_DIRECTION_2LINES; - halSPI.Init.DataSize = SPI_DATASIZE_8BIT; + halSPI.Init.DataSize = SPI_DATASIZE_8BIT; // advanced settings - halSPI.Init.TIMode = SPI_TIMODE_DISABLE; + halSPI.Init.TIMode = SPI_TIMODE_DISABLE; halSPI.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; - halSPI.Init.CRCPolynomial = 7; - halSPI.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE; - halSPI.Init.NSSPMode = SPI_NSS_PULSE_DISABLE; - halSPI.Init.NSS = SPI_NSS_SOFT; + halSPI.Init.CRCPolynomial = 7; + halSPI.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE; + halSPI.Init.NSSPMode = SPI_NSS_PULSE_DISABLE; + halSPI.Init.NSS = SPI_NSS_SOFT; } } SPIf3xx::SPIf3xx(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin) : SPI(CSPins, pinLength, sckPin, mosiPin) { - uint8_t mosiPort = getMOSIPortID(mosiPin); - uint8_t sckPort = getSCKPortID(sckPin); + uint8_t mosiPort = getMOSIPortID(mosiPin); + uint8_t sckPort = getSCKPortID(sckPin); GPIO_InitTypeDef GPIOInit = {0}; - uint8_t altId = 0x00U; + uint8_t altId = 0x00U; if (mosiPort == sckPort) { switch (mosiPort) { @@ -195,23 +206,28 @@ SPIf3xx::SPIf3xx(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin) : S break; } - Pin spiPins[] = {mosiPin, sckPin}; + Pin spiPins[] = {mosiPin, sckPin}; uint8_t numOfPins = 2; - GPIOf3xx::gpioStateInit(&GPIOInit, spiPins, numOfPins, GPIO_MODE_AF_PP, - GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, altId); + GPIOf3xx::gpioStateInit(&GPIOInit, + spiPins, + numOfPins, + GPIO_MODE_AF_PP, + GPIO_NOPULL, + GPIO_SPEED_FREQ_HIGH, + altId); - halSPI.Init.Mode = SPI_MODE_MASTER; + halSPI.Init.Mode = SPI_MODE_MASTER; halSPI.Init.Direction = SPI_DIRECTION_1LINE; - halSPI.Init.DataSize = SPI_DATASIZE_8BIT; + halSPI.Init.DataSize = SPI_DATASIZE_8BIT; // advanced settings - halSPI.Init.TIMode = SPI_TIMODE_DISABLE; + halSPI.Init.TIMode = SPI_TIMODE_DISABLE; halSPI.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; - halSPI.Init.CRCPolynomial = 7; - halSPI.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE; - halSPI.Init.NSSPMode = SPI_NSS_PULSE_DISABLE; - halSPI.Init.NSS = SPI_NSS_SOFT; + halSPI.Init.CRCPolynomial = 7; + halSPI.Init.CRCLength = SPI_CRC_LENGTH_DATASIZE; + halSPI.Init.NSSPMode = SPI_NSS_PULSE_DISABLE; + halSPI.Init.NSS = SPI_NSS_SOFT; } } @@ -220,19 +236,19 @@ void SPIf3xx::configureSPI(uint32_t baudRate, SPIMode mode, bool firstBitMSB) { switch (mode) { case IO::SPI::SPIMode::SPI_MODE0: halSPI.Init.CLKPolarity = SPI_POLARITY_LOW; - halSPI.Init.CLKPhase = SPI_PHASE_1EDGE; + halSPI.Init.CLKPhase = SPI_PHASE_1EDGE; break; case IO::SPI::SPIMode::SPI_MODE1: halSPI.Init.CLKPolarity = SPI_POLARITY_LOW; - halSPI.Init.CLKPhase = SPI_PHASE_2EDGE; + halSPI.Init.CLKPhase = SPI_PHASE_2EDGE; break; case IO::SPI::SPIMode::SPI_MODE2: halSPI.Init.CLKPolarity = SPI_POLARITY_HIGH; - halSPI.Init.CLKPhase = SPI_PHASE_1EDGE; + halSPI.Init.CLKPhase = SPI_PHASE_1EDGE; break; case IO::SPI::SPIMode::SPI_MODE3: halSPI.Init.CLKPolarity = SPI_POLARITY_HIGH; - halSPI.Init.CLKPhase = SPI_PHASE_2EDGE; + halSPI.Init.CLKPhase = SPI_PHASE_2EDGE; break; default: log::LOGGER.log(log::Logger::LogLevel::ERROR, "Invalid SPI Mode"); @@ -316,11 +332,15 @@ SPI::SPIStatus SPIf3xx::read(uint8_t* bytes, uint8_t length) { */ SPI::SPIStatus SPIf3xx::halToSPIStatus(HAL_StatusTypeDef halStatus) { switch (halStatus) { - case HAL_OK: return SPIStatus::OK; - case HAL_ERROR: return SPIStatus::ERROR; - case HAL_BUSY: return SPIStatus::BUSY; - case HAL_TIMEOUT: return SPIStatus::TIMEOUT; + case HAL_OK: + return SPIStatus::OK; + case HAL_ERROR: + return SPIStatus::ERROR; + case HAL_BUSY: + return SPIStatus::BUSY; + case HAL_TIMEOUT: + return SPIStatus::TIMEOUT; } } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f3xx/UARTf3xx.cpp b/src/core/io/platform/f3xx/UARTf3xx.cpp index 244812d6..7c75329f 100644 --- a/src/core/io/platform/f3xx/UARTf3xx.cpp +++ b/src/core/io/platform/f3xx/UARTf3xx.cpp @@ -15,12 +15,10 @@ namespace log = core::log; namespace core::IO { -UARTf3xx::UARTf3xx(Pin txPin, Pin rxPin, uint32_t baudrate, bool isSwapped) - : UART(txPin, rxPin, baudrate), - halUART{} { +UARTf3xx::UARTf3xx(Pin txPin, Pin rxPin, uint32_t baudrate, bool isSwapped) : UART(txPin, rxPin, baudrate), halUART{} { GPIO_InitTypeDef gpioInit; - Pin myPins[] = {txPin, rxPin}; + Pin myPins[] = {txPin, rxPin}; uint8_t numOfPins = 2; uint8_t alt_id; @@ -83,20 +81,19 @@ UARTf3xx::UARTf3xx(Pin txPin, Pin rxPin, uint32_t baudrate, bool isSwapped) break; } - GPIOf3xx::gpioStateInit(&gpioInit, myPins, numOfPins, GPIO_MODE_AF_PP, - GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, alt_id); + GPIOf3xx::gpioStateInit(&gpioInit, myPins, numOfPins, GPIO_MODE_AF_PP, GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, alt_id); - halUART.Init.BaudRate = baudrate; - halUART.Init.WordLength = UART_WORDLENGTH_8B; - halUART.Init.StopBits = UART_STOPBITS_1; - halUART.Init.Parity = UART_PARITY_NONE; - halUART.Init.HwFlowCtl = UART_HWCONTROL_NONE; - halUART.Init.Mode = UART_MODE_TX_RX; + halUART.Init.BaudRate = baudrate; + halUART.Init.WordLength = UART_WORDLENGTH_8B; + halUART.Init.StopBits = UART_STOPBITS_1; + halUART.Init.Parity = UART_PARITY_NONE; + halUART.Init.HwFlowCtl = UART_HWCONTROL_NONE; + halUART.Init.Mode = UART_MODE_TX_RX; halUART.Init.OverSampling = UART_OVERSAMPLING_16; if (isSwapped) { halUART.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_SWAP_INIT; - halUART.AdvancedInit.Swap = UART_ADVFEATURE_SWAP_ENABLE; + halUART.AdvancedInit.Swap = UART_ADVFEATURE_SWAP_ENABLE; } HAL_UART_Init(&halUART); @@ -104,27 +101,20 @@ UARTf3xx::UARTf3xx(Pin txPin, Pin rxPin, uint32_t baudrate, bool isSwapped) void UARTf3xx::setBaudrate(uint32_t baudrate) { this->halUART.Init.BaudRate = baudrate; - this->baudrate = baudrate; + this->baudrate = baudrate; } -void UARTf3xx::setFormat(WordLength wordLength, Parity parity, - NumStopBits numStopBits) { +void UARTf3xx::setFormat(WordLength wordLength, Parity parity, NumStopBits numStopBits) { halUART.Init.WordLength = static_cast(wordLength); - halUART.Init.Parity = static_cast(parity); - halUART.Init.Parity = static_cast(numStopBits); + halUART.Init.Parity = static_cast(parity); + halUART.Init.Parity = static_cast(numStopBits); } -void UARTf3xx::sendBreak() { - HAL_LIN_SendBreak(&halUART); -} +void UARTf3xx::sendBreak() { HAL_LIN_SendBreak(&halUART); } -bool UARTf3xx::isReadable() { - return halUART.pRxBuffPtr != nullptr; -} +bool UARTf3xx::isReadable() { return halUART.pRxBuffPtr != nullptr; } -bool UARTf3xx::isWritable() { - return halUART.pTxBuffPtr == nullptr; -} +bool UARTf3xx::isWritable() { return halUART.pTxBuffPtr == nullptr; } void UARTf3xx::putc(char c) { auto* data = reinterpret_cast(&c); @@ -140,8 +130,7 @@ void UARTf3xx::puts(const char* s) { char UARTf3xx::getc() { uint8_t c; - while (HAL_UART_Receive(&halUART, &c, 1, EVT_UART_TIMEOUT) == HAL_TIMEOUT) { - } + while (HAL_UART_Receive(&halUART, &c, 1, EVT_UART_TIMEOUT) == HAL_TIMEOUT) {} return static_cast(c); } @@ -152,27 +141,18 @@ void UARTf3xx::printf(const char* format, ...) { char string[200]; auto* data = reinterpret_cast(&string); if (0 < vsprintf(string, format, args)) { - HAL_UART_Transmit(&halUART, data, - strlen(string), EVT_UART_TIMEOUT); + HAL_UART_Transmit(&halUART, data, strlen(string), EVT_UART_TIMEOUT); } va_end(args); } -void UARTf3xx::write(uint8_t byte) { - putc(static_cast(byte)); -} +void UARTf3xx::write(uint8_t byte) { putc(static_cast(byte)); } -uint8_t UARTf3xx::read() { - return static_cast(getc()); -} +uint8_t UARTf3xx::read() { return static_cast(getc()); } -void UARTf3xx::writeBytes(uint8_t* bytes, size_t size) { - HAL_UART_Transmit(&halUART, bytes, size, EVT_UART_TIMEOUT); -} +void UARTf3xx::writeBytes(uint8_t* bytes, size_t size) { HAL_UART_Transmit(&halUART, bytes, size, EVT_UART_TIMEOUT); } -void UARTf3xx::readBytes(uint8_t* bytes, size_t size) { - HAL_UART_Receive(&halUART, bytes, size, EVT_UART_TIMEOUT); -} +void UARTf3xx::readBytes(uint8_t* bytes, size_t size) { HAL_UART_Receive(&halUART, bytes, size, EVT_UART_TIMEOUT); } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f4xx/ADCf4xx.cpp b/src/core/io/platform/f4xx/ADCf4xx.cpp index 9ae13f0b..7be2c5ac 100644 --- a/src/core/io/platform/f4xx/ADCf4xx.cpp +++ b/src/core/io/platform/f4xx/ADCf4xx.cpp @@ -56,8 +56,7 @@ ADCf4xx::ADCf4xx(Pin pin) : ADC(pin) { initDMA(); - HAL_ADC_Start_DMA(&halADC, reinterpret_cast(&buffer[0]), - rank); + HAL_ADC_Start_DMA(&halADC, reinterpret_cast(&buffer[0]), rank); rank++; } @@ -84,34 +83,34 @@ float ADCf4xx::readPercentage() { void ADCf4xx::initADC(uint8_t num_channels) { /** Configure the global features of the ADC (Clock, Resolution, Data * Alignment and number of conversion) - */ - halADC.Instance = ADC1; - halADC.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2; - halADC.Init.Resolution = ADC_RESOLUTION_12B; - halADC.Init.ScanConvMode = ENABLE; - halADC.Init.ContinuousConvMode = ENABLE; + */ + halADC.Instance = ADC1; + halADC.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV2; + halADC.Init.Resolution = ADC_RESOLUTION_12B; + halADC.Init.ScanConvMode = ENABLE; + halADC.Init.ContinuousConvMode = ENABLE; halADC.Init.DiscontinuousConvMode = DISABLE; - halADC.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; - halADC.Init.ExternalTrigConv = ADC_SOFTWARE_START; - halADC.Init.DataAlign = ADC_DATAALIGN_RIGHT; - halADC.Init.NbrOfConversion = num_channels; + halADC.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE; + halADC.Init.ExternalTrigConv = ADC_SOFTWARE_START; + halADC.Init.DataAlign = ADC_DATAALIGN_RIGHT; + halADC.Init.NbrOfConversion = num_channels; halADC.Init.DMAContinuousRequests = ENABLE; - halADC.Init.EOCSelection = ADC_EOC_SEQ_CONV; + halADC.Init.EOCSelection = ADC_EOC_SEQ_CONV; __HAL_RCC_ADC1_CLK_ENABLE(); HAL_ADC_Init(&halADC); } void ADCf4xx::initDMA() { - halDMA.Instance = DMA2_Stream0; - halDMA.Init.Direction = DMA_PERIPH_TO_MEMORY; - halDMA.Init.PeriphInc = DMA_PINC_DISABLE; - halDMA.Init.MemInc = DMA_MINC_ENABLE; + halDMA.Instance = DMA2_Stream0; + halDMA.Init.Direction = DMA_PERIPH_TO_MEMORY; + halDMA.Init.PeriphInc = DMA_PINC_DISABLE; + halDMA.Init.MemInc = DMA_MINC_ENABLE; halDMA.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; - halDMA.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; - halDMA.Init.Mode = DMA_CIRCULAR; - halDMA.Init.Priority = DMA_PRIORITY_VERY_HIGH; - halDMA.Init.FIFOMode = DMA_FIFOMODE_DISABLE; + halDMA.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; + halDMA.Init.Mode = DMA_CIRCULAR; + halDMA.Init.Priority = DMA_PRIORITY_VERY_HIGH; + halDMA.Init.FIFOMode = DMA_FIFOMODE_DISABLE; HAL_DMA_Init(&halDMA); __HAL_LINKDMA(&halADC, DMA_Handle, halDMA); @@ -119,11 +118,10 @@ void ADCf4xx::initDMA() { void ADCf4xx::addChannel(uint8_t rank) { GPIO_InitTypeDef gpioInit; - Pin myPins[] = {pin}; + Pin myPins[] = {pin}; uint8_t numOfPins = 1; - GPIOf4xx::gpioStateInit(&gpioInit, myPins, numOfPins, GPIO_MODE_ANALOG, - GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH); + GPIOf4xx::gpioStateInit(&gpioInit, myPins, numOfPins, GPIO_MODE_ANALOG, GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH); ADC_ChannelConfTypeDef adcChannel; @@ -177,18 +175,18 @@ void ADCf4xx::addChannel(uint8_t rank) { adcChannel.Channel = ADC_CHANNEL_15; break; default: - break;// Should never get here + break; // Should never get here } // Subtract 1 because rank starts at 1 channels[rank - 1] = pin; - adcChannel.Rank = rank; + adcChannel.Rank = rank; adcChannel.SamplingTime = ADC_SAMPLETIME_480CYCLES; - adcChannel.Offset = 0; - adcChannel.Offset = 0x000; + adcChannel.Offset = 0; + adcChannel.Offset = 0x000; HAL_ADC_ConfigChannel(&halADC, &adcChannel); } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f4xx/GPIOf4xx.cpp b/src/core/io/platform/f4xx/GPIOf4xx.cpp index c7fb3d0c..2cc4dccb 100644 --- a/src/core/io/platform/f4xx/GPIOf4xx.cpp +++ b/src/core/io/platform/f4xx/GPIOf4xx.cpp @@ -8,24 +8,14 @@ #include void (*INTERRUPT_HANDLERS[16])(core::IO::GPIO* pin, void* priv) = {nullptr}; -core::IO::GPIO* INTERRUPT_GPIOS[16] = {nullptr}; -void* INTERRUPT_ARGS[16] = {nullptr}; - -extern "C" void EXTI0_IRQHandler(void) { - HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0); -} -extern "C" void EXTI1_IRQHandler(void) { - HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1); -} -extern "C" void EXTI2_TSC_IRQHandler(void) { - HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2); -} -extern "C" void EXTI3_IRQHandler(void) { - HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_3); -} -extern "C" void EXTI4_IRQHandler(void) { - HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_4); -} +core::IO::GPIO* INTERRUPT_GPIOS[16] = {nullptr}; +void* INTERRUPT_ARGS[16] = {nullptr}; + +extern "C" void EXTI0_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0); } +extern "C" void EXTI1_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1); } +extern "C" void EXTI2_TSC_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2); } +extern "C" void EXTI3_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_3); } +extern "C" void EXTI4_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_4); } extern "C" void EXTI9_5_IRQHandler(void) { HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_5); HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_6); @@ -45,7 +35,7 @@ extern "C" void EXTI15_10_IRQHandler(void) { extern "C" void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { uint16_t tmpPin = GPIO_Pin; - uint8_t count = 0; + uint8_t count = 0; while ((tmpPin & 0x0001) == 0) { tmpPin = tmpPin >> 1; @@ -58,17 +48,21 @@ extern "C" void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) { namespace core::IO { -GPIOf4xx::GPIOf4xx(Pin pin, GPIO::Direction direction, Pull pull) - : GPIO(pin, direction, pull) { +GPIOf4xx::GPIOf4xx(Pin pin, GPIO::Direction direction, Pull pull) : GPIO(pin, direction, pull) { GPIO_InitTypeDef gpioInit; - Pin myPins[] = {pin}; + Pin myPins[] = {pin}; uint8_t numOfPins = 1; - gpioStateInit(&gpioInit, myPins, numOfPins, - static_cast(direction), static_cast(pull), GPIO_PULLDOWN, GPIO_SPEED_FREQ_HIGH); + gpioStateInit(&gpioInit, + myPins, + numOfPins, + static_cast(direction), + static_cast(pull), + GPIO_PULLDOWN, + GPIO_SPEED_FREQ_HIGH); - //TODO: double check that this actually applies to F4xx the same way it does to F3xx + // TODO: double check that this actually applies to F4xx the same way it does to F3xx switch ((static_cast(pin) & 0xF0) >> 4) { case 0x0: this->port = GPIOA; @@ -86,11 +80,11 @@ GPIOf4xx::GPIOf4xx(Pin pin, GPIO::Direction direction, Pull pull) this->port = GPIOF; break; default: - break;// Should never get here + break; // Should never get here } this->halPin = 1 << (static_cast(this->pin) & 0x0F); - this->writePin(GPIO::State::LOW);// Output set low by default + this->writePin(GPIO::State::LOW); // Output set low by default } void GPIOf4xx::setDirection(GPIO::Direction direction) { @@ -98,30 +92,30 @@ void GPIOf4xx::setDirection(GPIO::Direction direction) { } void GPIOf4xx::writePin(GPIO::State state) { - HAL_GPIO_WritePin(this->port, this->halPin, - static_cast(state)); + HAL_GPIO_WritePin(this->port, this->halPin, static_cast(state)); } -GPIO::State GPIOf4xx::readPin() { - return static_cast(HAL_GPIO_ReadPin(this->port, this->halPin)); -} +GPIO::State GPIOf4xx::readPin() { return static_cast(HAL_GPIO_ReadPin(this->port, this->halPin)); } void GPIOf4xx::registerIRQ(TriggerEdge edge, void (*irqHandler)(GPIO* pin, void* priv), void* priv) { GPIO_InitTypeDef gpioInit; - Pin myPins[] = {pin}; + Pin myPins[] = {pin}; uint8_t numOfPins = 1; - gpioStateInit(&gpioInit, myPins, numOfPins, + gpioStateInit(&gpioInit, + myPins, + numOfPins, GPIOf4xx::GPIO_TRIGGER_INTERRUPT_BASE | (static_cast(edge) << GPIO_MODE_IT_SHIFT), - GPIO_PULLDOWN, GPIO_SPEED_FREQ_HIGH); + GPIO_PULLDOWN, + GPIO_SPEED_FREQ_HIGH); - auto pin_index = static_cast(this->pin) & 0x0F; + auto pin_index = static_cast(this->pin) & 0x0F; INTERRUPT_HANDLERS[pin_index] = irqHandler; - INTERRUPT_GPIOS[pin_index] = this; - INTERRUPT_ARGS[pin_index] = priv; + INTERRUPT_GPIOS[pin_index] = this; + INTERRUPT_ARGS[pin_index] = priv; IRQn_Type irqNum; - //TODO: double check that this actually applies to F4xx the same way it does to F3xx + // TODO: double check that this actually applies to F4xx the same way it does to F3xx switch (this->halPin) { case GPIO_PIN_0: irqNum = EXTI0_IRQn; @@ -155,22 +149,20 @@ void GPIOf4xx::registerIRQ(TriggerEdge edge, void (*irqHandler)(GPIO* pin, void* break; default: - return;// Shouldn't get here + return; // Shouldn't get here } HAL_NVIC_SetPriority(irqNum, core::platform::GPIO_INTERRUPT_PRIORITY, 0); HAL_NVIC_EnableIRQ(irqNum); } -void GPIOf4xx::gpioStateInit(GPIO_InitTypeDef* targetGpio, Pin* pins, - uint8_t numOfPins, uint32_t mode, uint32_t pull, +void GPIOf4xx::gpioStateInit(GPIO_InitTypeDef* targetGpio, Pin* pins, uint8_t numOfPins, uint32_t mode, uint32_t pull, uint32_t speed, uint8_t alternate) { if (numOfPins == 2) { - targetGpio->Pin = - static_cast(1 << (static_cast(pins[0]) & 0x0F)) | static_cast(1 << (static_cast(pins[1]) & 0x0F)); + targetGpio->Pin = static_cast(1 << (static_cast(pins[0]) & 0x0F)) + | static_cast(1 << (static_cast(pins[1]) & 0x0F)); } else { - targetGpio->Pin = - static_cast(1 << (static_cast(pins[0]) & 0x0F)); + targetGpio->Pin = static_cast(1 << (static_cast(pins[0]) & 0x0F)); } targetGpio->Mode = mode; @@ -207,8 +199,8 @@ void GPIOf4xx::gpioStateInit(GPIO_InitTypeDef* targetGpio, Pin* pins, HAL_GPIO_Init(GPIOF, targetGpio); break; default: - break;// Should never get here + break; // Should never get here } } } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f4xx/I2Cf4xx.cpp b/src/core/io/platform/f4xx/I2Cf4xx.cpp index 6a6313a6..ef065fc7 100644 --- a/src/core/io/platform/f4xx/I2Cf4xx.cpp +++ b/src/core/io/platform/f4xx/I2Cf4xx.cpp @@ -5,7 +5,7 @@ #include -//namespace log = core::log; +// namespace log = core::log; namespace core::IO { @@ -75,12 +75,11 @@ I2Cf4xx::I2Cf4xx(Pin sclPin, Pin sdaPin) : I2C(sclPin, sdaPin) { uint8_t portId = getPortID(sclPin); getInstance(portId, &halI2C.Instance, &altId); - Pin i2cPins[2] = {sclPin, sdaPin}; + Pin i2cPins[2] = {sclPin, sdaPin}; uint8_t numOfPins = 2; // TODO: CHECK GPIO STATES IN HAL CODE - GPIOf4xx::gpioStateInit(&gpioInit, i2cPins, numOfPins, GPIO_MODE_AF_OD, - GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, altId); + GPIOf4xx::gpioStateInit(&gpioInit, i2cPins, numOfPins, GPIO_MODE_AF_OD, GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, altId); /* // 8MHz = 0x00310309; 16MHz = 0x10320309; 48MHz = 0x50330309 @@ -91,30 +90,26 @@ halI2C.Init.Timing = 0x00310309; // Timing Register Layout(Bits): [PRESC(4)][RESERVED(4)] // [SCLDEL(4)][SDADEL(4)] // [SCLH(8)][SCLL(8)] - halI2C.Init.DutyCycle = I2C_DUTYCYCLE_2; - halI2C.Init.OwnAddress1 = 0; - halI2C.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; + halI2C.Init.DutyCycle = I2C_DUTYCYCLE_2; + halI2C.Init.OwnAddress1 = 0; + halI2C.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; halI2C.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; - halI2C.Init.OwnAddress2 = 0; + halI2C.Init.OwnAddress2 = 0; // part of F3 but not F4??? // halI2C.Init.OwnAddress2Masks = I2C_OA2_NOMASK; halI2C.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE; - halI2C.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; + halI2C.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; HAL_I2C_Init(&halI2C); } I2C::I2CStatus I2Cf4xx::write(uint8_t addr, uint8_t byte) { - HAL_StatusTypeDef status = HAL_I2C_Master_Transmit(&halI2C, addr << 1, - &byte, 1, - EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = HAL_I2C_Master_Transmit(&halI2C, addr << 1, &byte, 1, EVT_I2C_TIMEOUT); return halToI2CStatus(status); } I2C::I2CStatus I2Cf4xx::read(uint8_t addr, uint8_t* output) { - HAL_StatusTypeDef status = HAL_I2C_Master_Receive(&halI2C, addr << 1, - output, 1, - EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = HAL_I2C_Master_Receive(&halI2C, addr << 1, output, 1, EVT_I2C_TIMEOUT); return halToI2CStatus(status); } @@ -123,9 +118,7 @@ I2C::I2CStatus I2Cf4xx::read(uint8_t addr, uint8_t* output) { * this via the HAL. */ I2C::I2CStatus I2Cf4xx::write(uint8_t addr, uint8_t* bytes, uint8_t length) { - HAL_StatusTypeDef status = HAL_I2C_Master_Transmit(&halI2C, addr << 1, - bytes, length, - EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = HAL_I2C_Master_Transmit(&halI2C, addr << 1, bytes, length, EVT_I2C_TIMEOUT); return halToI2CStatus(status); } @@ -134,54 +127,39 @@ I2C::I2CStatus I2Cf4xx::write(uint8_t addr, uint8_t* bytes, uint8_t length) { * this via the HAL. */ I2C::I2CStatus I2Cf4xx::read(uint8_t addr, uint8_t* bytes, uint8_t length) { - HAL_StatusTypeDef status = HAL_I2C_Master_Receive(&halI2C, addr << 1, - bytes, length, - EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = HAL_I2C_Master_Receive(&halI2C, addr << 1, bytes, length, EVT_I2C_TIMEOUT); return halToI2CStatus(status); } -I2C::I2CStatus I2Cf4xx::writeMemReg(uint8_t addr, uint32_t memAddress, - uint8_t byte, uint16_t memAddSize, +I2C::I2CStatus I2Cf4xx::writeMemReg(uint8_t addr, uint32_t memAddress, uint8_t byte, uint16_t memAddSize, uint8_t maxWriteTime) { uint16_t memAddress16 = memAddress; - HAL_StatusTypeDef status = HAL_I2C_Mem_Write(&halI2C, addr << 1, - memAddress16, memAddSize, - &byte, 1, EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = + HAL_I2C_Mem_Write(&halI2C, addr << 1, memAddress16, memAddSize, &byte, 1, EVT_I2C_TIMEOUT); HAL_Delay(maxWriteTime); return halToI2CStatus(status); } -I2C::I2CStatus I2Cf4xx::readMemReg(uint8_t addr, uint32_t memAddress, - uint8_t* byte, - uint16_t memAddSize) { - uint16_t memAddress16 = memAddress; - HAL_StatusTypeDef status = HAL_I2C_Mem_Read(&halI2C, addr << 1, - memAddress16, memAddSize, byte, - 1, EVT_I2C_TIMEOUT); +I2C::I2CStatus I2Cf4xx::readMemReg(uint8_t addr, uint32_t memAddress, uint8_t* byte, uint16_t memAddSize) { + uint16_t memAddress16 = memAddress; + HAL_StatusTypeDef status = HAL_I2C_Mem_Read(&halI2C, addr << 1, memAddress16, memAddSize, byte, 1, EVT_I2C_TIMEOUT); return halToI2CStatus(status); } -I2C::I2CStatus I2Cf4xx::writeMemReg(uint8_t addr, uint32_t memAddress, - uint8_t* bytes, uint8_t size, - uint16_t memAddSize, - uint8_t maxWriteTime) { +I2C::I2CStatus I2Cf4xx::writeMemReg(uint8_t addr, uint32_t memAddress, uint8_t* bytes, uint8_t size, + uint16_t memAddSize, uint8_t maxWriteTime) { uint16_t memAddress16 = memAddress; - HAL_StatusTypeDef status = HAL_I2C_Mem_Write(&halI2C, addr << 1, - memAddress16, memAddSize, - bytes, size, - EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = + HAL_I2C_Mem_Write(&halI2C, addr << 1, memAddress16, memAddSize, bytes, size, EVT_I2C_TIMEOUT); HAL_Delay(maxWriteTime); return halToI2CStatus(status); } -I2C::I2CStatus I2Cf4xx::readMemReg(uint8_t addr, uint32_t memAddress, - uint8_t* bytes, uint8_t size, +I2C::I2CStatus I2Cf4xx::readMemReg(uint8_t addr, uint32_t memAddress, uint8_t* bytes, uint8_t size, uint16_t memAddSize) { uint16_t memAddress16 = memAddress; - HAL_StatusTypeDef status = HAL_I2C_Mem_Read(&halI2C, addr << 1, - memAddress16, memAddSize, - bytes, size, - EVT_I2C_TIMEOUT); + HAL_StatusTypeDef status = + HAL_I2C_Mem_Read(&halI2C, addr << 1, memAddress16, memAddSize, bytes, size, EVT_I2C_TIMEOUT); return halToI2CStatus(status); } @@ -201,4 +179,4 @@ I2C::I2CStatus I2Cf4xx::halToI2CStatus(HAL_StatusTypeDef halStatus) { } } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f4xx/PWMf4xx.cpp b/src/core/io/platform/f4xx/PWMf4xx.cpp index fcf45843..46f94460 100644 --- a/src/core/io/platform/f4xx/PWMf4xx.cpp +++ b/src/core/io/platform/f4xx/PWMf4xx.cpp @@ -12,99 +12,98 @@ namespace core::IO { * @param channel The channel to assign to * @param alternateFunction The GPIO identifier for the function of the pin */ -static void getInstance(Pin pin, TIM_TypeDef** instance, uint32_t* channel, - uint32_t* alternateFunction) { +static void getInstance(Pin pin, TIM_TypeDef** instance, uint32_t* channel, uint32_t* alternateFunction) { switch (pin) { // TIMER 1 case Pin::PA_8: - *instance = TIM1; - *channel = TIM_CHANNEL_1; + *instance = TIM1; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM1; break; case Pin::PA_9: - *instance = TIM1; - *channel = TIM_CHANNEL_2; + *instance = TIM1; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF1_TIM1; break; case Pin::PA_10: - *instance = TIM1; - *channel = TIM_CHANNEL_3; + *instance = TIM1; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF1_TIM1; break; case Pin::PA_11: - *instance = TIM1; - *channel = TIM_CHANNEL_4; + *instance = TIM1; + *channel = TIM_CHANNEL_4; *alternateFunction = GPIO_AF1_TIM1; break; // TIMER 2 case Pin::PA_0: - *instance = TIM2; - *channel = TIM_CHANNEL_1; + *instance = TIM2; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF1_TIM2; break; case Pin::PA_1: - *instance = TIM2; - *channel = TIM_CHANNEL_2; + *instance = TIM2; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF1_TIM2; break; case Pin::PA_2: - *instance = TIM2; - *channel = TIM_CHANNEL_3; + *instance = TIM2; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF1_TIM2; break; case Pin::PA_3: - *instance = TIM2; - *channel = TIM_CHANNEL_4; + *instance = TIM2; + *channel = TIM_CHANNEL_4; *alternateFunction = GPIO_AF1_TIM2; break; // TIMER 3 case Pin::PC_6: - *instance = TIM3; - *channel = TIM_CHANNEL_1; + *instance = TIM3; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF2_TIM3; break; case Pin::PC_7: - *instance = TIM3; - *channel = TIM_CHANNEL_2; + *instance = TIM3; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF2_TIM3; break; case Pin::PC_8: - *instance = TIM3; - *channel = TIM_CHANNEL_3; + *instance = TIM3; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF2_TIM3; break; case Pin::PC_9: - *instance = TIM3; - *channel = TIM_CHANNEL_4; + *instance = TIM3; + *channel = TIM_CHANNEL_4; *alternateFunction = GPIO_AF2_TIM3; break; // TIMER 4 case Pin::PB_6: - *instance = TIM4; - *channel = TIM_CHANNEL_1; + *instance = TIM4; + *channel = TIM_CHANNEL_1; *alternateFunction = GPIO_AF2_TIM4; break; case Pin::PB_7: - *instance = TIM4; - *channel = TIM_CHANNEL_2; + *instance = TIM4; + *channel = TIM_CHANNEL_2; *alternateFunction = GPIO_AF2_TIM4; break; case Pin::PB_8: - *instance = TIM4; - *channel = TIM_CHANNEL_3; + *instance = TIM4; + *channel = TIM_CHANNEL_3; *alternateFunction = GPIO_AF2_TIM4; break; case Pin::PB_9: - *instance = TIM4; - *channel = TIM_CHANNEL_4; + *instance = TIM4; + *channel = TIM_CHANNEL_4; *alternateFunction = GPIO_AF2_TIM4; break; default: - *instance = NULL; - *channel = -1; + *instance = NULL; + *channel = -1; *alternateFunction = -1; } } @@ -126,34 +125,38 @@ PWMf4xx::PWMf4xx(Pin pin) : PWM(pin) { TIM_BreakDeadTimeConfigTypeDef sBreakDeadTimeConfig = {0}; - halTIM.Instance = instance; - halTIM.Init.Prescaler = 0; - halTIM.Init.CounterMode = TIM_COUNTERMODE_UP; - halTIM.Init.Period = 0; - halTIM.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; + halTIM.Instance = instance; + halTIM.Init.Prescaler = 0; + halTIM.Init.CounterMode = TIM_COUNTERMODE_UP; + halTIM.Init.Period = 0; + halTIM.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1; halTIM.Init.RepetitionCounter = 0; halTIM.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE; HAL_TIM_Base_Init(&halTIM); HAL_TIM_PWM_Init(&halTIM); - sBreakDeadTimeConfig.OffStateRunMode = TIM_OSSR_DISABLE; + sBreakDeadTimeConfig.OffStateRunMode = TIM_OSSR_DISABLE; sBreakDeadTimeConfig.OffStateIDLEMode = TIM_OSSI_DISABLE; - sBreakDeadTimeConfig.LockLevel = TIM_LOCKLEVEL_OFF; - sBreakDeadTimeConfig.DeadTime = 0; - sBreakDeadTimeConfig.BreakState = TIM_BREAK_DISABLE; - sBreakDeadTimeConfig.BreakPolarity = TIM_BREAKPOLARITY_HIGH; - sBreakDeadTimeConfig.BreakFilter = 0; - sBreakDeadTimeConfig.AutomaticOutput = TIM_AUTOMATICOUTPUT_DISABLE; + sBreakDeadTimeConfig.LockLevel = TIM_LOCKLEVEL_OFF; + sBreakDeadTimeConfig.DeadTime = 0; + sBreakDeadTimeConfig.BreakState = TIM_BREAK_DISABLE; + sBreakDeadTimeConfig.BreakPolarity = TIM_BREAKPOLARITY_HIGH; + sBreakDeadTimeConfig.BreakFilter = 0; + sBreakDeadTimeConfig.AutomaticOutput = TIM_AUTOMATICOUTPUT_DISABLE; HAL_TIMEx_ConfigBreakDeadTime(&halTIM, &sBreakDeadTimeConfig); // Setup GPIO pin for PMW GPIO_InitTypeDef gpioInit = {0}; - Pin myPins[] = {pin}; - uint8_t numOfPins = 1; - - GPIOf4xx::gpioStateInit(&gpioInit, myPins, numOfPins, GPIO_MODE_AF_PP, - GPIO_NOPULL, GPIO_SPEED_FREQ_LOW, + Pin myPins[] = {pin}; + uint8_t numOfPins = 1; + + GPIOf4xx::gpioStateInit(&gpioInit, + myPins, + numOfPins, + GPIO_MODE_AF_PP, + GPIO_NOPULL, + GPIO_SPEED_FREQ_LOW, alternateFunction); } @@ -161,13 +164,13 @@ void PWMf4xx::setDutyCycle(uint32_t dutyCycle) { this->dutyCycle = dutyCycle; TIM_OC_InitTypeDef sConfigOC = {0}; - sConfigOC.OCMode = TIM_OCMODE_PWM1; - sConfigOC.Pulse = dutyCycle * halTIM.Init.Period / 100; - sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; - sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH; - sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; - sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET; - sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET; + sConfigOC.OCMode = TIM_OCMODE_PWM1; + sConfigOC.Pulse = dutyCycle * halTIM.Init.Period / 100; + sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH; + sConfigOC.OCNPolarity = TIM_OCNPOLARITY_HIGH; + sConfigOC.OCFastMode = TIM_OCFAST_DISABLE; + sConfigOC.OCIdleState = TIM_OCIDLESTATE_RESET; + sConfigOC.OCNIdleState = TIM_OCNIDLESTATE_RESET; HAL_TIM_PWM_Stop(&halTIM, halTIMChannelID); HAL_TIM_PWM_ConfigChannel(&halTIM, &sConfigOC, halTIMChannelID); @@ -183,7 +186,7 @@ void PWMf4xx::setPeriod(uint32_t period) { HAL_TIM_PWM_Stop(&halTIM, halTIMChannelID); uint32_t autoReload; - uint32_t prescaler = -1; + uint32_t prescaler = -1; uint64_t clockFrequency = HAL_RCC_GetSysClockFreq(); // Required loop in order to determine a prescaler which will bring the @@ -193,7 +196,7 @@ void PWMf4xx::setPeriod(uint32_t period) { autoReload = period * clockFrequency / (prescaler + 1) / 1000000 - 1; } while (autoReload > 65535); - halTIM.Init.Period = autoReload; + halTIM.Init.Period = autoReload; halTIM.Init.Prescaler = prescaler; HAL_TIM_Base_Init(&halTIM); HAL_TIM_PWM_Start(&halTIM, halTIMChannelID); @@ -202,12 +205,8 @@ void PWMf4xx::setPeriod(uint32_t period) { setDutyCycle(this->dutyCycle); } -uint32_t PWMf4xx::getDutyCycle() { - return dutyCycle; -} +uint32_t PWMf4xx::getDutyCycle() { return dutyCycle; } -uint32_t PWMf4xx::getPeriod() { - return period; -} +uint32_t PWMf4xx::getPeriod() { return period; } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f4xx/SPIf4xx.cpp b/src/core/io/platform/f4xx/SPIf4xx.cpp index 75b80183..edc4c5cd 100644 --- a/src/core/io/platform/f4xx/SPIf4xx.cpp +++ b/src/core/io/platform/f4xx/SPIf4xx.cpp @@ -74,12 +74,13 @@ uint8_t SPIf4xx::getSCKPortID(Pin sckPin) { #endif } -SPIf4xx::SPIf4xx(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin, Pin misoPin) : SPI(CSPins, pinLength, sckPin, mosiPin, misoPin) { - uint8_t mosiPort = getMOSIPortID(mosiPin); - uint8_t misoPort = getMISOPortID(misoPin); - uint8_t sckPort = getSCKPortID(sckPin); +SPIf4xx::SPIf4xx(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin, Pin misoPin) + : SPI(CSPins, pinLength, sckPin, mosiPin, misoPin) { + uint8_t mosiPort = getMOSIPortID(mosiPin); + uint8_t misoPort = getMISOPortID(misoPin); + uint8_t sckPort = getSCKPortID(sckPin); GPIO_InitTypeDef GPIOInit = {0}; - uint8_t altId = 0x00U; + uint8_t altId = 0x00U; if (mosiPort == misoPort && misoPort == sckPort) { switch (mosiPort) { @@ -113,34 +114,44 @@ SPIf4xx::SPIf4xx(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin, Pin // gpioStateInit only supports initializing up to 2 pins, so this must be done // init mosiPin and misoPin - Pin spiPins[] = {mosiPin, misoPin}; + Pin spiPins[] = {mosiPin, misoPin}; uint8_t numOfPins = 2; - GPIOf4xx::gpioStateInit(&GPIOInit, spiPins, numOfPins, GPIO_MODE_AF_PP, - GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, altId); + GPIOf4xx::gpioStateInit(&GPIOInit, + spiPins, + numOfPins, + GPIO_MODE_AF_PP, + GPIO_NOPULL, + GPIO_SPEED_FREQ_HIGH, + altId); // init sckPin spiPins[0] = sckPin; - numOfPins = 1; - GPIOf4xx::gpioStateInit(&GPIOInit, spiPins, numOfPins, GPIO_MODE_AF_PP, - GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, altId); - - halSPI.Init.Mode = SPI_MODE_MASTER; + numOfPins = 1; + GPIOf4xx::gpioStateInit(&GPIOInit, + spiPins, + numOfPins, + GPIO_MODE_AF_PP, + GPIO_NOPULL, + GPIO_SPEED_FREQ_HIGH, + altId); + + halSPI.Init.Mode = SPI_MODE_MASTER; halSPI.Init.Direction = SPI_DIRECTION_2LINES; - halSPI.Init.DataSize = SPI_DATASIZE_8BIT; + halSPI.Init.DataSize = SPI_DATASIZE_8BIT; // advanced settings - halSPI.Init.TIMode = SPI_TIMODE_DISABLE; + halSPI.Init.TIMode = SPI_TIMODE_DISABLE; halSPI.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; - halSPI.Init.CRCPolynomial = 7; - halSPI.Init.NSS = SPI_NSS_SOFT; + halSPI.Init.CRCPolynomial = 7; + halSPI.Init.NSS = SPI_NSS_SOFT; } } SPIf4xx::SPIf4xx(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin) : SPI(CSPins, pinLength, sckPin, mosiPin) { - uint8_t mosiPort = getMOSIPortID(mosiPin); - uint8_t sckPort = getSCKPortID(sckPin); + uint8_t mosiPort = getMOSIPortID(mosiPin); + uint8_t sckPort = getSCKPortID(sckPin); GPIO_InitTypeDef GPIOInit = {0}; - uint8_t altId = 0x00U; + uint8_t altId = 0x00U; if (mosiPort == sckPort) { switch (mosiPort) { @@ -171,21 +182,26 @@ SPIf4xx::SPIf4xx(GPIO* CSPins[], uint8_t pinLength, Pin sckPin, Pin mosiPin) : S break; } - Pin spiPins[] = {mosiPin, sckPin}; + Pin spiPins[] = {mosiPin, sckPin}; uint8_t numOfPins = 2; - GPIOf4xx::gpioStateInit(&GPIOInit, spiPins, numOfPins, GPIO_MODE_AF_PP, - GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, altId); + GPIOf4xx::gpioStateInit(&GPIOInit, + spiPins, + numOfPins, + GPIO_MODE_AF_PP, + GPIO_NOPULL, + GPIO_SPEED_FREQ_HIGH, + altId); - halSPI.Init.Mode = SPI_MODE_MASTER; + halSPI.Init.Mode = SPI_MODE_MASTER; halSPI.Init.Direction = SPI_DIRECTION_1LINE; - halSPI.Init.DataSize = SPI_DATASIZE_8BIT; + halSPI.Init.DataSize = SPI_DATASIZE_8BIT; // advanced settings - halSPI.Init.TIMode = SPI_TIMODE_DISABLE; + halSPI.Init.TIMode = SPI_TIMODE_DISABLE; halSPI.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; - halSPI.Init.CRCPolynomial = 7; - halSPI.Init.NSS = SPI_NSS_SOFT; + halSPI.Init.CRCPolynomial = 7; + halSPI.Init.NSS = SPI_NSS_SOFT; } } @@ -194,19 +210,19 @@ void SPIf4xx::configureSPI(uint32_t baudRate, SPIMode mode, bool firstBitMSB) { switch (mode) { case IO::SPI::SPIMode::SPI_MODE0: halSPI.Init.CLKPolarity = SPI_POLARITY_LOW; - halSPI.Init.CLKPhase = SPI_PHASE_1EDGE; + halSPI.Init.CLKPhase = SPI_PHASE_1EDGE; break; case IO::SPI::SPIMode::SPI_MODE1: halSPI.Init.CLKPolarity = SPI_POLARITY_LOW; - halSPI.Init.CLKPhase = SPI_PHASE_2EDGE; + halSPI.Init.CLKPhase = SPI_PHASE_2EDGE; break; case IO::SPI::SPIMode::SPI_MODE2: halSPI.Init.CLKPolarity = SPI_POLARITY_HIGH; - halSPI.Init.CLKPhase = SPI_PHASE_1EDGE; + halSPI.Init.CLKPhase = SPI_PHASE_1EDGE; break; case IO::SPI::SPIMode::SPI_MODE3: halSPI.Init.CLKPolarity = SPI_POLARITY_HIGH; - halSPI.Init.CLKPhase = SPI_PHASE_2EDGE; + halSPI.Init.CLKPhase = SPI_PHASE_2EDGE; break; default: log::LOGGER.log(log::Logger::LogLevel::ERROR, "Invalid SPI Mode"); @@ -290,11 +306,15 @@ SPI::SPIStatus SPIf4xx::read(uint8_t* bytes, uint8_t length) { */ SPI::SPIStatus SPIf4xx::halToSPIStatus(HAL_StatusTypeDef halStatus) { switch (halStatus) { - case HAL_OK: return SPIStatus::OK; - case HAL_ERROR: return SPIStatus::ERROR; - case HAL_BUSY: return SPIStatus::BUSY; - case HAL_TIMEOUT: return SPIStatus::TIMEOUT; + case HAL_OK: + return SPIStatus::OK; + case HAL_ERROR: + return SPIStatus::ERROR; + case HAL_BUSY: + return SPIStatus::BUSY; + case HAL_TIMEOUT: + return SPIStatus::TIMEOUT; } } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/platform/f4xx/UARTf4xx.cpp b/src/core/io/platform/f4xx/UARTf4xx.cpp index 3d33c8a5..9bc3d2e7 100644 --- a/src/core/io/platform/f4xx/UARTf4xx.cpp +++ b/src/core/io/platform/f4xx/UARTf4xx.cpp @@ -12,11 +12,10 @@ namespace core::IO { -UARTf4xx::UARTf4xx(Pin txPin, Pin rxPin, uint32_t baudrate, bool isSwapped) - : UART(txPin, rxPin, baudrate) { +UARTf4xx::UARTf4xx(Pin txPin, Pin rxPin, uint32_t baudrate, bool isSwapped) : UART(txPin, rxPin, baudrate) { GPIO_InitTypeDef gpioInit; - Pin myPins[] = {txPin, rxPin}; + Pin myPins[] = {txPin, rxPin}; uint8_t numOfPins = 2; uint8_t alt_id; @@ -75,15 +74,14 @@ UARTf4xx::UARTf4xx(Pin txPin, Pin rxPin, uint32_t baudrate, bool isSwapped) break; } - GPIOf4xx::gpioStateInit(&gpioInit, myPins, numOfPins, GPIO_MODE_AF_PP, - GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, alt_id); + GPIOf4xx::gpioStateInit(&gpioInit, myPins, numOfPins, GPIO_MODE_AF_PP, GPIO_NOPULL, GPIO_SPEED_FREQ_HIGH, alt_id); - halUART.Init.BaudRate = baudrate; - halUART.Init.WordLength = UART_WORDLENGTH_8B; - halUART.Init.StopBits = UART_STOPBITS_1; - halUART.Init.Parity = UART_PARITY_NONE; - halUART.Init.HwFlowCtl = UART_HWCONTROL_NONE; - halUART.Init.Mode = UART_MODE_TX_RX; + halUART.Init.BaudRate = baudrate; + halUART.Init.WordLength = UART_WORDLENGTH_8B; + halUART.Init.StopBits = UART_STOPBITS_1; + halUART.Init.Parity = UART_PARITY_NONE; + halUART.Init.HwFlowCtl = UART_HWCONTROL_NONE; + halUART.Init.Mode = UART_MODE_TX_RX; halUART.Init.OverSampling = UART_OVERSAMPLING_16; HAL_UART_Init(&halUART); @@ -91,27 +89,20 @@ UARTf4xx::UARTf4xx(Pin txPin, Pin rxPin, uint32_t baudrate, bool isSwapped) void UARTf4xx::setBaudrate(uint32_t baudrate) { this->halUART.Init.BaudRate = baudrate; - this->baudrate = baudrate; + this->baudrate = baudrate; } -void UARTf4xx::setFormat(WordLength wordLength, Parity parity, - NumStopBits numStopBits) { +void UARTf4xx::setFormat(WordLength wordLength, Parity parity, NumStopBits numStopBits) { halUART.Init.WordLength = static_cast(wordLength); - halUART.Init.Parity = static_cast(parity); - halUART.Init.Parity = static_cast(numStopBits); + halUART.Init.Parity = static_cast(parity); + halUART.Init.Parity = static_cast(numStopBits); } -void UARTf4xx::sendBreak() { - HAL_LIN_SendBreak(&halUART); -} +void UARTf4xx::sendBreak() { HAL_LIN_SendBreak(&halUART); } -bool UARTf4xx::isReadable() { - return halUART.pRxBuffPtr != NULL; -} +bool UARTf4xx::isReadable() { return halUART.pRxBuffPtr != NULL; } -bool UARTf4xx::isWritable() { - return halUART.pTxBuffPtr == NULL; -} +bool UARTf4xx::isWritable() { return halUART.pTxBuffPtr == NULL; } void UARTf4xx::putc(char c) { uint8_t* data = reinterpret_cast(&c); @@ -127,8 +118,7 @@ void UARTf4xx::puts(const char* s) { char UARTf4xx::getc() { uint8_t c; - while (HAL_UART_Receive(&halUART, &c, 1, EVT_UART_TIMEOUT) == HAL_TIMEOUT) { - } + while (HAL_UART_Receive(&halUART, &c, 1, EVT_UART_TIMEOUT) == HAL_TIMEOUT) {} return static_cast(c); } @@ -139,27 +129,18 @@ void UARTf4xx::printf(const char* format, ...) { char string[200]; uint8_t* data = reinterpret_cast(&string); if (0 < vsprintf(string, format, args)) { - HAL_UART_Transmit(&halUART, data, - strlen(string), EVT_UART_TIMEOUT); + HAL_UART_Transmit(&halUART, data, strlen(string), EVT_UART_TIMEOUT); } va_end(args); } -void UARTf4xx::write(uint8_t byte) { - putc(static_cast(byte)); -} +void UARTf4xx::write(uint8_t byte) { putc(static_cast(byte)); } -uint8_t UARTf4xx::read() { - return static_cast(getc()); -} +uint8_t UARTf4xx::read() { return static_cast(getc()); } -void UARTf4xx::writeBytes(uint8_t* bytes, size_t size) { - HAL_UART_Transmit(&halUART, bytes, size, EVT_UART_TIMEOUT); -} +void UARTf4xx::writeBytes(uint8_t* bytes, size_t size) { HAL_UART_Transmit(&halUART, bytes, size, EVT_UART_TIMEOUT); } -void UARTf4xx::readBytes(uint8_t* bytes, size_t size) { - HAL_UART_Receive(&halUART, bytes, size, EVT_UART_TIMEOUT); -} +void UARTf4xx::readBytes(uint8_t* bytes, size_t size) { HAL_UART_Receive(&halUART, bytes, size, EVT_UART_TIMEOUT); } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/io/types/CANMessage.cpp b/src/core/io/types/CANMessage.cpp index 8c78db4f..2a5cca2b 100644 --- a/src/core/io/types/CANMessage.cpp +++ b/src/core/io/types/CANMessage.cpp @@ -9,9 +9,7 @@ CANMessage::CANMessage(uint32_t id, uint8_t dataLength, uint8_t* payload, bool i this->id = id; // TODO: Should include way to notify user of invalid CAN frame, // to be added to error manager later. - this->dataLength = dataLength <= CAN_MAX_PAYLOAD_SIZE ? - dataLength : - CAN_MAX_PAYLOAD_SIZE; + this->dataLength = dataLength <= CAN_MAX_PAYLOAD_SIZE ? dataLength : CAN_MAX_PAYLOAD_SIZE; // Copy contents of provided payload into message's payload for (int i = 0; i < this->dataLength; i++) @@ -21,43 +19,29 @@ CANMessage::CANMessage(uint32_t id, uint8_t dataLength, uint8_t* payload, bool i } CANMessage::CANMessage() { - this->id = 0; + this->id = 0; this->dataLength = 0; } -uint32_t CANMessage::getId() { - return id; -} +uint32_t CANMessage::getId() { return id; } -uint8_t CANMessage::getDataLength() { - return dataLength; -} +uint8_t CANMessage::getDataLength() { return dataLength; } -uint8_t* CANMessage::getPayload() { - return &payload[0]; -} +uint8_t* CANMessage::getPayload() { return &payload[0]; } -void CANMessage::setId(uint32_t id) { - this->id = id; -} +void CANMessage::setId(uint32_t id) { this->id = id; } -void CANMessage::setDataLength(uint8_t size) { - this->dataLength = size; -} +void CANMessage::setDataLength(uint8_t size) { this->dataLength = size; } -void CANMessage::setPayload(const uint8_t* payload) { - std::memcpy(this->payload, payload, CAN_MAX_PAYLOAD_SIZE); -} +void CANMessage::setPayload(const uint8_t* payload) { std::memcpy(this->payload, payload, CAN_MAX_PAYLOAD_SIZE); } CANMessage& CANMessage::operator=(const CANMessage& other) { - this->id = other.id; + this->id = other.id; this->dataLength = other.dataLength; this->setPayload(other.payload); return *this; } -bool CANMessage::isCANExtended() { - return this->isExtended; -} +bool CANMessage::isCANExtended() { return this->isExtended; } -}// namespace core::IO +} // namespace core::IO diff --git a/src/core/platform/f3xx/stm32f302x8.cpp b/src/core/platform/f3xx/stm32f302x8.cpp index e2ec1112..dcd7481f 100644 --- a/src/core/platform/f3xx/stm32f302x8.cpp +++ b/src/core/platform/f3xx/stm32f302x8.cpp @@ -8,27 +8,26 @@ namespace core::platform { void stm32f3xx_init() { HAL_Init(); - RCC_OscInitTypeDef RCC_OscInitStruct = {0}; - RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; /** Initializes the RCC Oscillators according to the specified parameters - * in the RCC_OscInitTypeDef structure. - */ - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; - RCC_OscInitStruct.HSIState = RCC_HSI_ON; + * in the RCC_OscInitTypeDef structure. + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; - RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; - RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL4;// PLL CLK at 8 * 4 = 32 MHz + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL4; // PLL CLK at 8 * 4 = 32 MHz HAL_RCC_OscConfig(&RCC_OscInitStruct); /** Initializes the CPU, AHB and APB buses clocks - */ - RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK - | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; - RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;// SYSCLK at 8 MHz (HSI CLK) - RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI; // SYSCLK at 8 MHz (HSI CLK) + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; @@ -46,4 +45,4 @@ void stm32f3xx_init() { SysTick_Handler(); } -}// namespace core::platform +} // namespace core::platform diff --git a/src/core/platform/f4xx/stm32f446xx.cpp b/src/core/platform/f4xx/stm32f446xx.cpp index 3aae1106..fcfde603 100644 --- a/src/core/platform/f4xx/stm32f446xx.cpp +++ b/src/core/platform/f4xx/stm32f446xx.cpp @@ -10,28 +10,28 @@ namespace core::platform { void stm32f4xx_init() { HAL_Init(); - RCC_OscInitTypeDef RCC_OscInitStruct = {0}; - RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; + RCC_OscInitTypeDef RCC_OscInitStruct = {0}; + RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; /** Configure the main internal regulator output voltage - */ + */ __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3); /** Initializes the RCC Oscillators according to the specified parameters - * in the RCC_OscInitTypeDef structure. - */ - RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; - RCC_OscInitStruct.HSIState = RCC_HSI_ON; + * in the RCC_OscInitTypeDef structure. + */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; + RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; - RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; - RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; - RCC_OscInitStruct.PLL.PLLM = 8; - RCC_OscInitStruct.PLL.PLLN = 50; - RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; - RCC_OscInitStruct.PLL.PLLQ = 2; - RCC_OscInitStruct.PLL.PLLR = 2; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; + RCC_OscInitStruct.PLL.PLLM = 8; + RCC_OscInitStruct.PLL.PLLN = 50; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; + RCC_OscInitStruct.PLL.PLLQ = 2; + RCC_OscInitStruct.PLL.PLLR = 2; HAL_RCC_OscConfig(&RCC_OscInitStruct); // if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) // { @@ -39,11 +39,10 @@ void stm32f4xx_init() { // } /** Initializes the CPU, AHB and APB buses clocks - */ - RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK - | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; - RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;// SYSCLK at 8 MHz (HSI CLK) - RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; // SYSCLK at 8 MHz (HSI CLK) + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1) != HAL_OK) { @@ -69,4 +68,4 @@ void Error_Handler(void) { /* USER CODE END Error_Handler_Debug */ } -}// namespace core::platform +} // namespace core::platform diff --git a/src/core/utils/log.cpp b/src/core/utils/log.cpp index 05978451..84e5850e 100644 --- a/src/core/utils/log.cpp +++ b/src/core/utils/log.cpp @@ -17,10 +17,10 @@ void Logger::setUART(IO::UART* loggingUART) { } /** -* Set the minimum log level to be displayed by the logger -* -* @param level[in] Minimum log level to be displayed by the logger -*/ + * Set the minimum log level to be displayed by the logger + * + * @param level[in] Minimum log level to be displayed by the logger + */ void Logger::setLogLevel(Logger::LogLevel level) { #ifdef EVT_CORE_LOG_ENABLE minLevel = level; @@ -92,4 +92,4 @@ void Logger::log(LogLevel level, const char* format, ...) { } Logger LOGGER; -}// namespace core::log +} // namespace core::log diff --git a/src/core/utils/platform/f3xx/timef3xx.cpp b/src/core/utils/platform/f3xx/timef3xx.cpp index ffe64d5e..4b88e5b6 100644 --- a/src/core/utils/platform/f3xx/timef3xx.cpp +++ b/src/core/utils/platform/f3xx/timef3xx.cpp @@ -27,7 +27,5 @@ void wait(uint32_t ms) { /** * Reads the system ticks from HAL_GetTicks */ -uint32_t millis() { - return HAL_GetTick(); -} -}// namespace core::time +uint32_t millis() { return HAL_GetTick(); } +} // namespace core::time diff --git a/src/core/utils/platform/f4xx/timef4xx.cpp b/src/core/utils/platform/f4xx/timef4xx.cpp index 07edd170..625587ff 100644 --- a/src/core/utils/platform/f4xx/timef4xx.cpp +++ b/src/core/utils/platform/f4xx/timef4xx.cpp @@ -1,7 +1,7 @@ /** -* STMF3xx implementation of the time functionality. This code is designed -* only to run on the STMF3xx. -*/ + * STMF3xx implementation of the time functionality. This code is designed + * only to run on the STMF3xx. + */ #include #include @@ -11,16 +11,12 @@ namespace core::time { /** -* Calls HAL wait, assumes HAL_Init() has been called -*/ -void wait(uint32_t ms) { - HAL_Delay(ms); -} + * Calls HAL wait, assumes HAL_Init() has been called + */ +void wait(uint32_t ms) { HAL_Delay(ms); } /** -* Reads the system ticks from HAL_GetTicks -*/ -uint32_t millis() { - return HAL_GetTick(); -} -}// namespace core::time + * Reads the system ticks from HAL_GetTicks + */ +uint32_t millis() { return HAL_GetTick(); } +} // namespace core::time