diff --git a/.clang-format b/.clang-format index 18f134dc..83e4c880 100644 --- a/.clang-format +++ b/.clang-format @@ -2,20 +2,22 @@ Language: Cpp AccessModifierOffset: -2 AlignAfterOpenBracket: Align -AlignConsecutiveMacros: true AlignConsecutiveAssignments: false AlignConsecutiveDeclarations: false +AlignConsecutiveMacros: true AlignEscapedNewlines: Right AlignOperands: Align -AlignTrailingComments: true +AlignTrailingComments: + Kind: Always + OverEmptyLines: 0 AllowAllArgumentsOnNextLine: false AllowAllConstructorInitializersOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: Never AllowShortCaseLabelsOnASingleLine: false AllowShortFunctionsOnASingleLine: None -AllowShortLambdasOnASingleLine: None AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: None AllowShortLoopsOnASingleLine: false AlwaysBreakAfterDefinitionReturnType: None AlwaysBreakAfterReturnType: None @@ -28,29 +30,30 @@ BraceWrapping: AfterClass: false AfterControlStatement: false AfterEnum: false + AfterExternBlock: false AfterFunction: false AfterNamespace: false AfterObjCDeclaration: false AfterStruct: false AfterUnion: false - AfterExternBlock: false BeforeCatch: false BeforeElse: false IndentBraces: true SplitEmptyFunction: true - SplitEmptyRecord: true SplitEmptyNamespace: true + SplitEmptyRecord: true +BreakAfterAttributes: Never +BreakAfterJavaFieldAnnotations: false BreakBeforeBinaryOperators: None BreakBeforeBraces: Attach BreakBeforeInheritanceComma: false -BreakInheritanceList: BeforeColon BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false BreakConstructorInitializers: BeforeColon -BreakAfterJavaFieldAnnotations: false +BreakConstructorInitializersBeforeComma: false +BreakInheritanceList: BeforeColon BreakStringLiterals: true ColumnLimit: 140 -CommentPragmas: '^ IWYU pragma:' +CommentPragmas: "^ IWYU pragma:" CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 2 @@ -75,24 +78,26 @@ IncludeCategories: - Regex: '^(<|"(gtest|gmock|isl|json)/)' Priority: 3 SortPriority: 0 - - Regex: '.*' + - Regex: ".*" Priority: 1 SortPriority: 0 -IncludeIsMainRegex: '(Test)?$' -IncludeIsMainSourceRegex: '' +IncludeIsMainRegex: "(Test)?$" +IncludeIsMainSourceRegex: "" IndentAccessModifiers: false IndentCaseLabels: true IndentGotoLabels: true IndentPPDirectives: BeforeHash IndentWidth: 2 IndentWrappedFunctionNames: false -# Requires Clang >= 15, could also cause incorrect code formatting: -# InsertBraces: true +# Could lead to incorrect formatting, but I think that the tradeoff is worth it +InsertBraces: true +InsertNewlineAtEOF: true JavaScriptQuotes: Leave JavaScriptWrapImports: true KeepEmptyLinesAtTheStartOfBlocks: true -MacroBlockBegin: '' -MacroBlockEnd: '' +LineEnding: LF +MacroBlockBegin: "" +MacroBlockEnd: "" MaxEmptyLinesToKeep: 1 NamespaceIndentation: All PackConstructorInitializers: NextLine @@ -107,12 +112,14 @@ PenaltyReturnTypeOnItsOwnLine: 60 PointerAlignment: Left ReferenceAlignment: Pointer ReflowComments: true +RemoveSemicolon: true SeparateDefinitionBlocks: Always SortIncludes: false SortUsingDeclarations: true SpaceAfterCStyleCast: true SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: true +SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: true @@ -120,22 +127,19 @@ SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatementsExceptForEachMacros SpaceBeforeRangeBasedForLoopColon: true +SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false +SpacesInCStyleCastParentheses: false SpacesInConditionalStatement: false SpacesInContainerLiterals: false -SpacesInCStyleCastParentheses: false SpacesInParentheses: false SpacesInSquareBrackets: false -SpaceBeforeSquareBrackets: false -SpaceAroundPointerQualifiers: Default Standard: Latest StatementMacros: - Q_UNUSED - QT_REQUIRE_VERSION TabWidth: 8 -UseCRLF: false UseTab: Never -... diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 71c05fa2..0eea6767 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -2,18 +2,18 @@ name: Code formatting on: pull_request: - branches: [ main ] + branches: [main] paths: - - '**.cpp' - - '**.h' - - '!src/libs/**' - - '!src/FreeRTOS/**' + - "src/**.cpp" + - "src/**.h" + - "!src/libs/**" + - "!src/FreeRTOS/**" jobs: test-format: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 1000 @@ -23,48 +23,48 @@ jobs: - name: Install clang-format run: | sudo apt-get update - sudo apt-get -y install clang-format-14 + sudo apt-get -y install clang-format-16 - name: Check formatting run: tests/test-format.sh - name: Upload patches - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: Patches path: ./*.patch test-clang-tidy: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 container: image: infinitime/infinitime-build steps: - # This workaround fixes the error "unsafe repository (REPO is owned by someone else)". - # See https://github.com/actions/checkout/issues/760 and https://github.com/actions/checkout/issues/766 - # The fix in "actions/checkout@v2" was not sufficient as the build process also uses git (to get the current - # commit hash, for example). - - name: Workaround permission issues - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - name: Checkout source files - uses: actions/checkout@v3 - with: - submodules: recursive - fetch-depth: 1000 - - name: Fetch base branch - run: git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF" - - name: Install clang-tidy - run: | - apt-get update - apt-get -y install clang-tidy-14 - - name: Prepare environment - shell: bash - env: - SOURCES_DIR: . - run: | - . docker/build.sh - GetGcc - # I guess these already exist inside the docker? - #GetNrfSdk - #GetMcuBoot - CmakeGenerate - - run: tests/test-tidy.sh + # This workaround fixes the error "unsafe repository (REPO is owned by someone else)". + # See https://github.com/actions/checkout/issues/760 and https://github.com/actions/checkout/issues/766 + # The fix in "actions/checkout@v2" was not sufficient as the build process also uses git (to get the current + # commit hash, for example). + - name: Workaround permission issues + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" + - name: Checkout source files + uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 1000 + - name: Fetch base branch + run: git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF" + - name: Install clang-tidy + run: | + apt-get update + apt-get -y install clang-tidy-16 + - name: Prepare environment + shell: bash + env: + SOURCES_DIR: . + run: | + . docker/build.sh + GetGcc + # I guess these already exist inside the docker? + #GetNrfSdk + #GetMcuBoot + CmakeGenerate + - run: tests/test-tidy.sh diff --git a/hooks/pre-commit b/hooks/pre-commit index 60a01e34..78a00bae 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -6,7 +6,7 @@ if [ -z "$(command -v "git-$name")" ]; then name="$(basename -a $(find $(echo "$PATH" | tr ':' ' ') -maxdepth 1 -type f -executable -name 'git-clang-format*') | sort | tail -n 1 | sed 's/^git-//')" fi -minVersion="14.0.0" +minVersion="16.0.0" for file in $(find $(echo "$PATH" | tr ':' ' ') -maxdepth 1 -type f -executable -name 'clang-format*'); do curBin="$file" @@ -23,7 +23,7 @@ if [ -z "$name" ] || [ -z "$bin" ]; then exit 1 fi -args="--binary $bin -q --extensions cpp,h --style file --staged -- :!src/FreeRTOS :!src/libs" +args="--binary $bin -q --extensions cpp,h --style file --staged -- src :!src/FreeRTOS :!src/libs" changedFiles="$(git "$name" --diffstat $args)" git "$name" $args diff --git a/src/components/ble/AlertNotificationClient.cpp b/src/components/ble/AlertNotificationClient.cpp index e3bc9242..cba041c1 100644 --- a/src/components/ble/AlertNotificationClient.cpp +++ b/src/components/ble/AlertNotificationClient.cpp @@ -81,8 +81,9 @@ int AlertNotificationClient::OnCharacteristicsDiscoveryEvent(uint16_t connection NRF_LOG_INFO("ANS Characteristic discovery complete"); if (isCharacteristicDiscovered) { ble_gattc_disc_all_dscs(connectionHandle, newAlertHandle, ansEndHandle, OnAlertNotificationDescriptorDiscoveryEventCallback, this); - } else + } else { onServiceDiscovered(connectionHandle); + } } else { if (characteristic != nullptr && ble_uuid_cmp(&supportedNewAlertCategoryUuid.u, &characteristic->uuid.u) == 0) { NRF_LOG_INFO("ANS Characteristic discovered : supportedNewAlertCategoryUuid"); @@ -101,8 +102,9 @@ int AlertNotificationClient::OnCharacteristicsDiscoveryEvent(uint16_t connection } else if (characteristic != nullptr && ble_uuid_cmp(&controlPointUuid.u, &characteristic->uuid.u) == 0) { NRF_LOG_INFO("ANS Characteristic discovered : controlPointUuid"); controlPointHandle = characteristic->val_handle; - } else + } else { NRF_LOG_INFO("ANS Characteristic discovered : 0x%x", characteristic->val_handle); + } } return 0; } @@ -135,8 +137,9 @@ int AlertNotificationClient::OnDescriptorDiscoveryEventCallback(uint16_t connect } } } else { - if (!isDescriptorFound) + if (!isDescriptorFound) { onServiceDiscovered(connectionHandle); + } } return 0; } @@ -150,8 +153,9 @@ void AlertNotificationClient::OnNotification(ble_gap_event* event) { // Ignore notifications with empty message const auto packetLen = OS_MBUF_PKTLEN(event->notify_rx.om); - if (packetLen <= headerSize) + if (packetLen <= headerSize) { return; + } size_t bufferSize = std::min(packetLen + stringTerminatorSize, maxBufferSize); auto messageSize = std::min(maxMessageSize, (bufferSize - headerSize)); diff --git a/src/components/ble/BleClient.h b/src/components/ble/BleClient.h index 6067c15f..cdae9e42 100644 --- a/src/components/ble/BleClient.h +++ b/src/components/ble/BleClient.h @@ -9,4 +9,4 @@ namespace Pinetime { virtual void Discover(uint16_t connectionHandle, std::function lambda) = 0; }; } -} \ No newline at end of file +} diff --git a/src/components/ble/DfuService.cpp b/src/components/ble/DfuService.cpp index 2427513d..5b7e1f52 100644 --- a/src/components/ble/DfuService.cpp +++ b/src/components/ble/DfuService.cpp @@ -87,20 +87,23 @@ int DfuService::OnServiceData(uint16_t connectionHandle, uint16_t attributeHandl ble_gatts_find_chr(&serviceUuid.u, &revisionCharacteristicUuid.u, nullptr, &revisionCharacteristicHandle); if (attributeHandle == packetCharacteristicHandle) { - if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) + if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { return WritePacketHandler(connectionHandle, context->om); - else + } else { return 0; + } } else if (attributeHandle == controlPointCharacteristicHandle) { - if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) + if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) { return ControlPointHandler(connectionHandle, context->om); - else + } else { return 0; + } } else if (attributeHandle == revisionCharacteristicHandle) { - if (context->op == BLE_GATT_ACCESS_OP_READ_CHR) + if (context->op == BLE_GATT_ACCESS_OP_READ_CHR) { return SendDfuRevision(context->om); - else + } else { return 0; + } } else { NRF_LOG_INFO("[DFU] Unknown Characteristic : %d", attributeHandle); return 0; @@ -321,8 +324,9 @@ DfuService::NotificationManager::NotificationManager() { } bool DfuService::NotificationManager::AsyncSend(uint16_t connection, uint16_t charactHandle, uint8_t* data, size_t s) { - if (size != 0 || s > 10) + if (size != 0 || s > 10) { return false; + } connectionHandle = connection; characteristicHandle = charactHandle; @@ -353,8 +357,9 @@ void DfuService::NotificationManager::Reset() { } void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc) { - if (chunkSize != 20) + if (chunkSize != 20) { return; + } this->chunkSize = chunkSize; this->totalSize = totalSize; this->expectedCrc = expectedCrc; @@ -364,8 +369,9 @@ void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t exp } void DfuService::DfuImage::Append(uint8_t* data, size_t size) { - if (!ready) + if (!ready) { return; + } ASSERT(size <= 20); std::memcpy(tempBuffer + bufferWriteIndex, data, size); @@ -380,8 +386,9 @@ void DfuService::DfuImage::Append(uint8_t* data, size_t size) { if (bufferWriteIndex > 0 && totalWriteIndex + bufferWriteIndex == totalSize) { spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex); totalWriteIndex += bufferWriteIndex; - if (totalSize < maxSize) + if (totalSize < maxSize) { WriteMagicNumber(); + } } } @@ -417,8 +424,9 @@ bool DfuService::DfuImage::Validate() { if (first) { crc = ComputeCrc(tempBuffer, readSize, NULL); first = false; - } else + } else { crc = ComputeCrc(tempBuffer, readSize, &crc); + } currentOffset += readSize; } @@ -440,7 +448,8 @@ uint16_t DfuService::DfuImage::ComputeCrc(uint8_t const* p_data, uint32_t size, } bool DfuService::DfuImage::IsComplete() { - if (!ready) + if (!ready) { return false; + } return totalWriteIndex == totalSize; } diff --git a/src/components/ble/DfuService.h b/src/components/ble/DfuService.h index 6652cdc1..1c3ac1c8 100644 --- a/src/components/ble/DfuService.h +++ b/src/components/ble/DfuService.h @@ -159,4 +159,4 @@ namespace Pinetime { TimerHandle_t timeoutTimer; }; } -} \ No newline at end of file +} diff --git a/src/components/ble/HeartRateService.cpp b/src/components/ble/HeartRateService.cpp index d34dbf83..207ffc0e 100644 --- a/src/components/ble/HeartRateService.cpp +++ b/src/components/ble/HeartRateService.cpp @@ -57,8 +57,9 @@ int HeartRateService::OnHeartRateRequested(uint16_t attributeHandle, ble_gatt_ac } void HeartRateService::OnNewHeartRateValue(uint8_t heartRateValue) { - if (!heartRateMeasurementNotificationEnable) + if (!heartRateMeasurementNotificationEnable) { return; + } uint8_t buffer[2] = {0, heartRateValue}; // [0] = flags, [1] = hr value auto* om = ble_hs_mbuf_from_flat(buffer, 2); @@ -73,11 +74,13 @@ void HeartRateService::OnNewHeartRateValue(uint8_t heartRateValue) { } void HeartRateService::SubscribeNotification(uint16_t attributeHandle) { - if (attributeHandle == heartRateMeasurementHandle) + if (attributeHandle == heartRateMeasurementHandle) { heartRateMeasurementNotificationEnable = true; + } } void HeartRateService::UnsubscribeNotification(uint16_t attributeHandle) { - if (attributeHandle == heartRateMeasurementHandle) + if (attributeHandle == heartRateMeasurementHandle) { heartRateMeasurementNotificationEnable = false; + } } diff --git a/src/components/ble/MotionService.cpp b/src/components/ble/MotionService.cpp index 1626a5bf..5c730547 100644 --- a/src/components/ble/MotionService.cpp +++ b/src/components/ble/MotionService.cpp @@ -76,8 +76,9 @@ int MotionService::OnStepCountRequested(uint16_t attributeHandle, ble_gatt_acces } void MotionService::OnNewStepCountValue(uint32_t stepCount) { - if (!stepCountNoficationEnabled) + if (!stepCountNoficationEnabled) { return; + } uint32_t buffer = stepCount; auto* om = ble_hs_mbuf_from_flat(&buffer, 4); @@ -92,8 +93,9 @@ void MotionService::OnNewStepCountValue(uint32_t stepCount) { } void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) { - if (!motionValuesNoficationEnabled) + if (!motionValuesNoficationEnabled) { return; + } int16_t buffer[3] = {x, y, z}; auto* om = ble_hs_mbuf_from_flat(buffer, 3 * sizeof(int16_t)); @@ -108,17 +110,19 @@ void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) { } void MotionService::SubscribeNotification(uint16_t attributeHandle) { - if (attributeHandle == stepCountHandle) + if (attributeHandle == stepCountHandle) { stepCountNoficationEnabled = true; - else if (attributeHandle == motionValuesHandle) + } else if (attributeHandle == motionValuesHandle) { motionValuesNoficationEnabled = true; + } } void MotionService::UnsubscribeNotification(uint16_t attributeHandle) { - if (attributeHandle == stepCountHandle) + if (attributeHandle == stepCountHandle) { stepCountNoficationEnabled = false; - else if (attributeHandle == motionValuesHandle) + } else if (attributeHandle == motionValuesHandle) { motionValuesNoficationEnabled = false; + } } bool MotionService::IsMotionNotificationSubscribed() const { diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h index 597ef0cc..e1ec1583 100644 --- a/src/components/ble/NimbleController.h +++ b/src/components/ble/NimbleController.h @@ -57,26 +57,26 @@ namespace Pinetime { Pinetime::Controllers::MusicService& music() { return musicService; - }; + } Pinetime::Controllers::NavigationService& navigation() { return navService; - }; + } Pinetime::Controllers::AlertNotificationService& alertService() { return anService; - }; + } Pinetime::Controllers::SimpleWeatherService& weather() { return weatherService; - }; + } uint16_t connHandle(); void NotifyBatteryLevel(uint8_t level); void RestartFastAdv() { fastAdvCount = 0; - }; + } void EnableRadio(); void DisableRadio(); diff --git a/src/components/ble/NotificationManager.h b/src/components/ble/NotificationManager.h index 189a7e13..97abfc30 100644 --- a/src/components/ble/NotificationManager.h +++ b/src/components/ble/NotificationManager.h @@ -51,7 +51,7 @@ namespace Pinetime { static constexpr size_t MaximumMessageSize() { return MessageSize; - }; + } bool IsEmpty() const { return size == 0; diff --git a/src/components/ble/ServiceDiscovery.cpp b/src/components/ble/ServiceDiscovery.cpp index 03bcfeb4..2af6fe7c 100644 --- a/src/components/ble/ServiceDiscovery.cpp +++ b/src/components/ble/ServiceDiscovery.cpp @@ -29,4 +29,4 @@ void ServiceDiscovery::DiscoverNextService(uint16_t connectionHandle) { this->OnServiceDiscovered(connectionHandle); }; (*clientIterator)->Discover(connectionHandle, discoverNextService); -} \ No newline at end of file +} diff --git a/src/components/datetime/DateTimeController.cpp b/src/components/datetime/DateTimeController.cpp index 7f58c9b3..56e22139 100644 --- a/src/components/datetime/DateTimeController.cpp +++ b/src/components/datetime/DateTimeController.cpp @@ -114,8 +114,9 @@ void DateTime::UpdateTime(uint32_t systickCounter, bool forceUpdate) { // Notify new day to SystemTask if (hour == 0 and not isMidnightAlreadyNotified) { isMidnightAlreadyNotified = true; - if (systemTask != nullptr) + if (systemTask != nullptr) { systemTask->PushMessage(System::Messages::OnNewDay); + } } else if (hour != 0) { isMidnightAlreadyNotified = false; } diff --git a/src/components/firmwarevalidator/FirmwareValidator.cpp b/src/components/firmwarevalidator/FirmwareValidator.cpp index 5a63b6b4..c4e1b3e5 100644 --- a/src/components/firmwarevalidator/FirmwareValidator.cpp +++ b/src/components/firmwarevalidator/FirmwareValidator.cpp @@ -11,8 +11,9 @@ bool FirmwareValidator::IsValidated() const { } void FirmwareValidator::Validate() { - if (!IsValidated()) + if (!IsValidated()) { Pinetime::Drivers::InternalFlash::WriteWord(validBitAdress, validBitValue); + } } void FirmwareValidator::Reset() { diff --git a/src/components/heartrate/HeartRateController.h b/src/components/heartrate/HeartRateController.h index f66c79f8..2b511a0a 100644 --- a/src/components/heartrate/HeartRateController.h +++ b/src/components/heartrate/HeartRateController.h @@ -41,4 +41,4 @@ namespace Pinetime { Pinetime::Controllers::HeartRateService* service = nullptr; }; } -} \ No newline at end of file +} diff --git a/src/components/heartrate/Ppg.cpp b/src/components/heartrate/Ppg.cpp index efbed852..81ce2898 100644 --- a/src/components/heartrate/Ppg.cpp +++ b/src/components/heartrate/Ppg.cpp @@ -276,10 +276,12 @@ float Ppg::HeartRateAverage(float hr) { for (const float& value : dataAverage) { if (value > 0.0f) { avg += value; - if (value < min) + if (value < min) { min = value; - if (value > max) + } + if (value > max) { max = value; + } total++; } } diff --git a/src/components/rle/RleDecoder.cpp b/src/components/rle/RleDecoder.cpp index 19ebfec0..2c72c97b 100644 --- a/src/components/rle/RleDecoder.cpp +++ b/src/components/rle/RleDecoder.cpp @@ -28,9 +28,10 @@ void RleDecoder::DecodeNext(uint8_t* output, size_t maxBytes) { } processedCount = 0; - if (color == backgroundColor) + if (color == backgroundColor) { color = foregroundColor; - else + } else { color = backgroundColor; + } } } diff --git a/src/components/settings/Settings.h b/src/components/settings/Settings.h index 602de3a5..46c43d8d 100644 --- a/src/components/settings/Settings.h +++ b/src/components/settings/Settings.h @@ -65,158 +65,163 @@ namespace Pinetime { settingsChanged = true; } settings.watchFace = face; - }; + } Pinetime::Applications::WatchFace GetWatchFace() const { return settings.watchFace; - }; + } void SetChimeOption(ChimesOption chimeOption) { if (chimeOption != settings.chimesOption) { settingsChanged = true; } settings.chimesOption = chimeOption; - }; + } ChimesOption GetChimeOption() const { return settings.chimesOption; - }; + } void SetPTSColorTime(Colors colorTime) { - if (colorTime != settings.PTS.ColorTime) + if (colorTime != settings.PTS.ColorTime) { settingsChanged = true; + } settings.PTS.ColorTime = colorTime; - }; + } Colors GetPTSColorTime() const { return settings.PTS.ColorTime; - }; + } void SetPTSColorBar(Colors colorBar) { - if (colorBar != settings.PTS.ColorBar) + if (colorBar != settings.PTS.ColorBar) { settingsChanged = true; + } settings.PTS.ColorBar = colorBar; - }; + } Colors GetPTSColorBar() const { return settings.PTS.ColorBar; - }; + } void SetPTSColorBG(Colors colorBG) { - if (colorBG != settings.PTS.ColorBG) + if (colorBG != settings.PTS.ColorBG) { settingsChanged = true; + } settings.PTS.ColorBG = colorBG; - }; + } Colors GetPTSColorBG() const { return settings.PTS.ColorBG; - }; + } void SetInfineatShowSideCover(bool show) { if (show != settings.watchFaceInfineat.showSideCover) { settings.watchFaceInfineat.showSideCover = show; settingsChanged = true; } - }; + } bool GetInfineatShowSideCover() const { return settings.watchFaceInfineat.showSideCover; - }; + } void SetInfineatColorIndex(int index) { if (index != settings.watchFaceInfineat.colorIndex) { settings.watchFaceInfineat.colorIndex = index; settingsChanged = true; } - }; + } int GetInfineatColorIndex() const { return settings.watchFaceInfineat.colorIndex; - }; + } void SetPTSGaugeStyle(PTSGaugeStyle gaugeStyle) { - if (gaugeStyle != settings.PTS.gaugeStyle) + if (gaugeStyle != settings.PTS.gaugeStyle) { settingsChanged = true; + } settings.PTS.gaugeStyle = gaugeStyle; - }; + } PTSGaugeStyle GetPTSGaugeStyle() const { return settings.PTS.gaugeStyle; - }; + } void SetPTSWeather(PTSWeather weatherEnable) { - if (weatherEnable != settings.PTS.weatherEnable) + if (weatherEnable != settings.PTS.weatherEnable) { settingsChanged = true; + } settings.PTS.weatherEnable = weatherEnable; - }; + } PTSWeather GetPTSWeather() const { return settings.PTS.weatherEnable; - }; + } void SetAppMenu(uint8_t menu) { appMenu = menu; - }; + } uint8_t GetAppMenu() const { return appMenu; - }; + } void SetSettingsMenu(uint8_t menu) { settingsMenu = menu; - }; + } uint8_t GetSettingsMenu() const { return settingsMenu; - }; + } void SetClockType(ClockType clocktype) { if (clocktype != settings.clockType) { settingsChanged = true; } settings.clockType = clocktype; - }; + } ClockType GetClockType() const { return settings.clockType; - }; + } void SetWeatherFormat(WeatherFormat weatherFormat) { if (weatherFormat != settings.weatherFormat) { settingsChanged = true; } settings.weatherFormat = weatherFormat; - }; + } WeatherFormat GetWeatherFormat() const { return settings.weatherFormat; - }; + } void SetNotificationStatus(Notification status) { if (status != settings.notificationStatus) { settingsChanged = true; } settings.notificationStatus = status; - }; + } Notification GetNotificationStatus() const { return settings.notificationStatus; - }; + } void SetScreenTimeOut(uint32_t timeout) { if (timeout != settings.screenTimeOut) { settingsChanged = true; } settings.screenTimeOut = timeout; - }; + } uint32_t GetScreenTimeOut() const { return settings.screenTimeOut; - }; + } bool GetAlwaysOnDisplay() const { return settings.alwaysOnDisplay && GetNotificationStatus() != Notification::Sleep; - }; + } void SetAlwaysOnDisplaySetting(bool state) { if (state != settings.alwaysOnDisplay) { @@ -258,7 +263,7 @@ namespace Pinetime { break; } } - }; + } std::bitset<5> getWakeUpModes() const { return settings.wakeUpMode; @@ -273,30 +278,30 @@ namespace Pinetime { settingsChanged = true; } settings.brightLevel = level; - }; + } Controllers::BrightnessController::Levels GetBrightness() const { return settings.brightLevel; - }; + } void SetStepsGoal(uint32_t goal) { if (goal != settings.stepsGoal) { settingsChanged = true; } settings.stepsGoal = goal; - }; + } uint32_t GetStepsGoal() const { return settings.stepsGoal; - }; + } void SetBleRadioEnabled(bool enabled) { bleRadioEnabled = enabled; - }; + } bool GetBleRadioEnabled() const { return bleRadioEnabled; - }; + } private: Pinetime::Controllers::FS& fs; diff --git a/src/displayapp/Colors.h b/src/displayapp/Colors.h index 43e2b801..b33a0691 100644 --- a/src/displayapp/Colors.h +++ b/src/displayapp/Colors.h @@ -7,4 +7,4 @@ namespace Pinetime { namespace Applications { lv_color_t Convert(Controllers::Settings::Colors color); } -} \ No newline at end of file +} diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index ff43bb81..be49e83e 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -513,9 +513,9 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio std::find_if(userWatchFaces.begin(), userWatchFaces.end(), [this](const WatchFaceDescription& watchfaceDescription) { return watchfaceDescription.watchFace == settingsController.GetWatchFace(); }); - if (watchFace != userWatchFaces.end()) + if (watchFace != userWatchFaces.end()) { currentScreen.reset(watchFace->create(controllers)); - else { + } else { currentScreen.reset(userWatchFaces[0].create(controllers)); } settingsController.SetAppMenu(0); diff --git a/src/displayapp/DisplayAppRecovery.cpp b/src/displayapp/DisplayAppRecovery.cpp index bcb8db0e..431d30f9 100644 --- a/src/displayapp/DisplayAppRecovery.cpp +++ b/src/displayapp/DisplayAppRecovery.cpp @@ -31,8 +31,9 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd, void DisplayApp::Start() { msgQueue = xQueueCreate(queueSize, itemSize); - if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 512, this, 0, &taskHandle)) + if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 512, this, 0, &taskHandle)) { APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); + } } void DisplayApp::Process(void* instance) { diff --git a/src/displayapp/DisplayAppRecovery.h b/src/displayapp/DisplayAppRecovery.h index 162ff257..0848df50 100644 --- a/src/displayapp/DisplayAppRecovery.h +++ b/src/displayapp/DisplayAppRecovery.h @@ -66,7 +66,7 @@ namespace Pinetime { void Start(Pinetime::System::BootErrors) { Start(); - }; + } void PushMessage(Pinetime::Applications::Display::Messages msg); void Register(Pinetime::System::SystemTask* systemTask); diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp index c70a0856..8f7d81ae 100644 --- a/src/displayapp/LittleVgl.cpp +++ b/src/displayapp/LittleVgl.cpp @@ -176,9 +176,9 @@ void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) { toScroll = height; } - if (scrollOffset >= toScroll) + if (scrollOffset >= toScroll) { scrollOffset -= toScroll; - else { + } else { toScroll -= scrollOffset; scrollOffset = (totalNbLines) -toScroll; } diff --git a/src/displayapp/TouchEvents.h b/src/displayapp/TouchEvents.h index 6a37713a..0dce7885 100644 --- a/src/displayapp/TouchEvents.h +++ b/src/displayapp/TouchEvents.h @@ -5,4 +5,4 @@ namespace Pinetime { enum class TouchEvents { None, Tap, SwipeLeft, SwipeRight, SwipeUp, SwipeDown, LongTap, DoubleTap }; } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/Alarm.h b/src/displayapp/screens/Alarm.h index a875b275..8e5f431e 100644 --- a/src/displayapp/screens/Alarm.h +++ b/src/displayapp/screens/Alarm.h @@ -77,7 +77,7 @@ namespace Pinetime { controllers.settingsController.GetClockType(), *controllers.systemTask, controllers.motorController); - }; + } }; } } diff --git a/src/displayapp/screens/BatteryIcon.cpp b/src/displayapp/screens/BatteryIcon.cpp index 6194807d..403b423b 100644 --- a/src/displayapp/screens/BatteryIcon.cpp +++ b/src/displayapp/screens/BatteryIcon.cpp @@ -46,8 +46,9 @@ void BatteryIcon::SetColor(lv_color_t color) { } const char* BatteryIcon::GetPlugIcon(bool isCharging) { - if (isCharging) + if (isCharging) { return Symbols::plug; - else + } else { return ""; + } } diff --git a/src/displayapp/screens/Dice.cpp b/src/displayapp/screens/Dice.cpp index 302c5f3f..65e1b4f8 100644 --- a/src/displayapp/screens/Dice.cpp +++ b/src/displayapp/screens/Dice.cpp @@ -150,8 +150,9 @@ void Dice::Refresh() { Roll(); } - } else if (currentRollHysteresis > 0) + } else if (currentRollHysteresis > 0) { --currentRollHysteresis; + } } void Dice::Roll() { diff --git a/src/displayapp/screens/Dice.h b/src/displayapp/screens/Dice.h index da91657d..b76a9457 100644 --- a/src/displayapp/screens/Dice.h +++ b/src/displayapp/screens/Dice.h @@ -55,7 +55,7 @@ namespace Pinetime { static Screens::Screen* Create(AppControllers& controllers) { return new Screens::Dice(controllers.motionController, controllers.motorController, controllers.settingsController); - }; + } }; } } diff --git a/src/displayapp/screens/HeartRate.h b/src/displayapp/screens/HeartRate.h index 88b4918c..c464bf3b 100644 --- a/src/displayapp/screens/HeartRate.h +++ b/src/displayapp/screens/HeartRate.h @@ -47,7 +47,7 @@ namespace Pinetime { static Screens::Screen* Create(AppControllers& controllers) { return new Screens::HeartRate(controllers.heartRateController, *controllers.systemTask); - }; + } }; } } diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h index b1f9741a..c1a62e84 100644 --- a/src/displayapp/screens/InfiniPaint.h +++ b/src/displayapp/screens/InfiniPaint.h @@ -46,7 +46,7 @@ namespace Pinetime { static Screens::Screen* Create(AppControllers& controllers) { return new Screens::InfiniPaint(controllers.lvgl, controllers.motorController); - }; + } }; } } diff --git a/src/displayapp/screens/Metronome.h b/src/displayapp/screens/Metronome.h index fab7ff87..7e665d4f 100644 --- a/src/displayapp/screens/Metronome.h +++ b/src/displayapp/screens/Metronome.h @@ -46,7 +46,7 @@ namespace Pinetime { static Screens::Screen* Create(AppControllers& controllers) { return new Screens::Metronome(controllers.motorController, *controllers.systemTask); - }; + } }; } } diff --git a/src/displayapp/screens/Motion.h b/src/displayapp/screens/Motion.h index e13e068c..586d2769 100644 --- a/src/displayapp/screens/Motion.h +++ b/src/displayapp/screens/Motion.h @@ -40,7 +40,7 @@ namespace Pinetime { static Screens::Screen* Create(AppControllers& controllers) { return new Screens::Motion(controllers.motionController); - }; + } }; } } diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h index 52253321..58b2ecc0 100644 --- a/src/displayapp/screens/Music.h +++ b/src/displayapp/screens/Music.h @@ -93,7 +93,7 @@ namespace Pinetime { static Screens::Screen* Create(AppControllers& controllers) { return new Screens::Music(*controllers.musicService); - }; + } }; } } diff --git a/src/displayapp/screens/Navigation.h b/src/displayapp/screens/Navigation.h index 5c7a0429..1dd63fea 100644 --- a/src/displayapp/screens/Navigation.h +++ b/src/displayapp/screens/Navigation.h @@ -66,7 +66,7 @@ namespace Pinetime { static Screens::Screen* Create(AppControllers& controllers) { return new Screens::Navigation(*controllers.navigationService); - }; + } }; } } diff --git a/src/displayapp/screens/NotificationIcon.cpp b/src/displayapp/screens/NotificationIcon.cpp index 0e913ae7..60de0981 100644 --- a/src/displayapp/screens/NotificationIcon.cpp +++ b/src/displayapp/screens/NotificationIcon.cpp @@ -3,8 +3,9 @@ using namespace Pinetime::Applications::Screens; const char* NotificationIcon::GetIcon(bool newNotificationAvailable) { - if (newNotificationAvailable) + if (newNotificationAvailable) { return Symbols::info; - else + } else { return ""; -} \ No newline at end of file + } +} diff --git a/src/displayapp/screens/NotificationIcon.h b/src/displayapp/screens/NotificationIcon.h index dc34c3f0..961d27e6 100644 --- a/src/displayapp/screens/NotificationIcon.h +++ b/src/displayapp/screens/NotificationIcon.h @@ -9,4 +9,4 @@ namespace Pinetime { }; } } -} \ No newline at end of file +} diff --git a/src/displayapp/screens/Paddle.h b/src/displayapp/screens/Paddle.h index 586cccf4..3f23f0b9 100644 --- a/src/displayapp/screens/Paddle.h +++ b/src/displayapp/screens/Paddle.h @@ -56,7 +56,7 @@ namespace Pinetime { static Screens::Screen* Create(AppControllers& controllers) { return new Screens::Paddle(controllers.lvgl); - }; + } }; } } diff --git a/src/displayapp/screens/Steps.h b/src/displayapp/screens/Steps.h index 6443582f..800bbc53 100644 --- a/src/displayapp/screens/Steps.h +++ b/src/displayapp/screens/Steps.h @@ -50,7 +50,7 @@ namespace Pinetime { static Screens::Screen* Create(AppControllers& controllers) { return new Screens::Steps(controllers.motionController, controllers.settingsController); - }; + } }; } } diff --git a/src/displayapp/screens/StopWatch.h b/src/displayapp/screens/StopWatch.h index 55a178dc..ed988883 100644 --- a/src/displayapp/screens/StopWatch.h +++ b/src/displayapp/screens/StopWatch.h @@ -68,7 +68,7 @@ namespace Pinetime { static Screens::Screen* Create(AppControllers& controllers) { return new Screens::StopWatch(*controllers.systemTask); - }; + } }; } } diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index d265fddd..12f53d7a 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -180,6 +180,7 @@ std::unique_ptr SystemInfo::CreateScreen2() { extern int mallocFailedCount; extern int stackOverflowCount; + std::unique_ptr SystemInfo::CreateScreen3() { lv_mem_monitor_t mon; lv_mem_monitor(&mon); diff --git a/src/displayapp/screens/Timer.h b/src/displayapp/screens/Timer.h index 0cb2bb08..30d7ce30 100644 --- a/src/displayapp/screens/Timer.h +++ b/src/displayapp/screens/Timer.h @@ -56,6 +56,6 @@ namespace Pinetime::Applications { static Screens::Screen* Create(AppControllers& controllers) { return new Screens::Timer(controllers.timer); - }; + } }; } diff --git a/src/displayapp/screens/Twos.h b/src/displayapp/screens/Twos.h index 52449fd3..b6fb9148 100644 --- a/src/displayapp/screens/Twos.h +++ b/src/displayapp/screens/Twos.h @@ -44,7 +44,7 @@ namespace Pinetime { static Screens::Screen* Create(AppControllers& /*controllers*/) { return new Screens::Twos(); - }; + } }; } } diff --git a/src/displayapp/screens/WatchFaceAnalog.h b/src/displayapp/screens/WatchFaceAnalog.h index 958ff64d..ef3b65ed 100644 --- a/src/displayapp/screens/WatchFaceAnalog.h +++ b/src/displayapp/screens/WatchFaceAnalog.h @@ -99,7 +99,7 @@ namespace Pinetime { controllers.bleController, controllers.notificationManager, controllers.settingsController); - }; + } static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) { return true; diff --git a/src/displayapp/screens/WatchFaceCasioStyleG7710.h b/src/displayapp/screens/WatchFaceCasioStyleG7710.h index 0f46a692..885dfec3 100644 --- a/src/displayapp/screens/WatchFaceCasioStyleG7710.h +++ b/src/displayapp/screens/WatchFaceCasioStyleG7710.h @@ -116,7 +116,7 @@ namespace Pinetime { controllers.heartRateController, controllers.motionController, controllers.filesystem); - }; + } static bool IsAvailable(Pinetime::Controllers::FS& filesystem) { return Screens::WatchFaceCasioStyleG7710::IsAvailable(filesystem); diff --git a/src/displayapp/screens/WatchFaceDigital.h b/src/displayapp/screens/WatchFaceDigital.h index 7bb713cb..324dccf4 100644 --- a/src/displayapp/screens/WatchFaceDigital.h +++ b/src/displayapp/screens/WatchFaceDigital.h @@ -89,7 +89,7 @@ namespace Pinetime { controllers.heartRateController, controllers.motionController, *controllers.weatherController); - }; + } static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) { return true; diff --git a/src/displayapp/screens/WatchFaceInfineat.cpp b/src/displayapp/screens/WatchFaceInfineat.cpp index 4c6fc196..ecebb0b5 100644 --- a/src/displayapp/screens/WatchFaceInfineat.cpp +++ b/src/displayapp/screens/WatchFaceInfineat.cpp @@ -374,8 +374,9 @@ void WatchFaceInfineat::UpdateSelected(lv_obj_t* object, lv_event_t event) { } if (object == btnPrevColor) { colorIndex -= 1; - if (colorIndex < 0) + if (colorIndex < 0) { colorIndex = nColors - 1; + } settingsController.SetInfineatColorIndex(colorIndex); } if (object == btnNextColor || object == btnPrevColor) { diff --git a/src/displayapp/screens/WatchFaceInfineat.h b/src/displayapp/screens/WatchFaceInfineat.h index 55c43f98..c8a316c1 100644 --- a/src/displayapp/screens/WatchFaceInfineat.h +++ b/src/displayapp/screens/WatchFaceInfineat.h @@ -113,7 +113,7 @@ namespace Pinetime { controllers.settingsController, controllers.motionController, controllers.filesystem); - }; + } static bool IsAvailable(Pinetime::Controllers::FS& filesystem) { return Screens::WatchFaceInfineat::IsAvailable(filesystem); diff --git a/src/displayapp/screens/WatchFacePineTimeStyle.h b/src/displayapp/screens/WatchFacePineTimeStyle.h index 72537095..f12ad88f 100644 --- a/src/displayapp/screens/WatchFacePineTimeStyle.h +++ b/src/displayapp/screens/WatchFacePineTimeStyle.h @@ -134,7 +134,7 @@ namespace Pinetime { controllers.settingsController, controllers.motionController, *controllers.weatherController); - }; + } static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) { return true; diff --git a/src/displayapp/screens/WatchFaceTerminal.h b/src/displayapp/screens/WatchFaceTerminal.h index bf460866..c1729cc5 100644 --- a/src/displayapp/screens/WatchFaceTerminal.h +++ b/src/displayapp/screens/WatchFaceTerminal.h @@ -82,7 +82,7 @@ namespace Pinetime { controllers.settingsController, controllers.heartRateController, controllers.motionController); - }; + } static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) { return true; diff --git a/src/displayapp/screens/Weather.h b/src/displayapp/screens/Weather.h index 6975311e..6af624c5 100644 --- a/src/displayapp/screens/Weather.h +++ b/src/displayapp/screens/Weather.h @@ -50,7 +50,7 @@ namespace Pinetime { static Screens::Screen* Create(AppControllers& controllers) { return new Screens::Weather(controllers.settingsController, *controllers.weatherController); - }; + } }; } } diff --git a/src/displayapp/screens/settings/SettingBluetooth.cpp b/src/displayapp/screens/settings/SettingBluetooth.cpp index e4dc695c..a0d009d1 100644 --- a/src/displayapp/screens/settings/SettingBluetooth.cpp +++ b/src/displayapp/screens/settings/SettingBluetooth.cpp @@ -31,7 +31,7 @@ namespace { } } return optionArray; - }; + } } SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController) diff --git a/src/displayapp/widgets/Counter.cpp b/src/displayapp/widgets/Counter.cpp index b486e372..f6c9892d 100644 --- a/src/displayapp/widgets/Counter.cpp +++ b/src/displayapp/widgets/Counter.cpp @@ -42,7 +42,7 @@ void Counter::UpBtnPressed() { if (ValueChangedHandler != nullptr) { ValueChangedHandler(userData); } -}; +} void Counter::DownBtnPressed() { value--; @@ -54,7 +54,7 @@ void Counter::DownBtnPressed() { if (ValueChangedHandler != nullptr) { ValueChangedHandler(userData); } -}; +} void Counter::SetValue(int newValue) { value = newValue; diff --git a/src/displayapp/widgets/Counter.h b/src/displayapp/widgets/Counter.h index 825860b8..d69fad77 100644 --- a/src/displayapp/widgets/Counter.h +++ b/src/displayapp/widgets/Counter.h @@ -25,7 +25,7 @@ namespace Pinetime { lv_obj_t* GetObject() const { return counterContainer; - }; + } private: void UpdateLabel(); diff --git a/src/drivers/Bma421.cpp b/src/drivers/Bma421.cpp index 74d47d06..f9502905 100644 --- a/src/drivers/Bma421.cpp +++ b/src/drivers/Bma421.cpp @@ -45,12 +45,14 @@ Bma421::Bma421(TwiMaster& twiMaster, uint8_t twiAddress) : twiMaster {twiMaster} } void Bma421::Init() { - if (not isResetOk) + if (not isResetOk) { return; // Call SoftReset (and reset TWI device) first! + } auto ret = bma423_init(&bma); - if (ret != BMA4_OK) + if (ret != BMA4_OK) { return; + } switch (bma.chip_id) { case BMA423_CHIP_ID: @@ -65,32 +67,38 @@ void Bma421::Init() { } ret = bma423_write_config_file(&bma); - if (ret != BMA4_OK) + if (ret != BMA4_OK) { return; + } ret = bma4_set_interrupt_mode(BMA4_LATCH_MODE, &bma); - if (ret != BMA4_OK) + if (ret != BMA4_OK) { return; + } ret = bma423_feature_enable(BMA423_STEP_CNTR, 1, &bma); - if (ret != BMA4_OK) + if (ret != BMA4_OK) { return; + } ret = bma423_step_detector_enable(0, &bma); - if (ret != BMA4_OK) + if (ret != BMA4_OK) { return; + } ret = bma4_set_accel_enable(1, &bma); - if (ret != BMA4_OK) + if (ret != BMA4_OK) { return; + } accel_conf.odr = BMA4_OUTPUT_DATA_RATE_100HZ; accel_conf.range = BMA4_ACCEL_RANGE_2G; accel_conf.bandwidth = BMA4_ACCEL_NORMAL_AVG4; accel_conf.perf_mode = BMA4_CIC_AVG_MODE; ret = bma4_set_accel_config(&accel_conf, &bma); - if (ret != BMA4_OK) + if (ret != BMA4_OK) { return; + } isOk = true; } @@ -109,8 +117,9 @@ void Bma421::Write(uint8_t registerAddress, const uint8_t* data, size_t size) { } Bma421::Values Bma421::Process() { - if (not isOk) + if (not isOk) { return {}; + } struct bma4_accel rawData; struct bma4_accel data; bma4_read_accel_xyz(&rawData, &bma); diff --git a/src/drivers/Bma421.h b/src/drivers/Bma421.h index 5269f62b..9d0189e6 100644 --- a/src/drivers/Bma421.h +++ b/src/drivers/Bma421.h @@ -47,4 +47,4 @@ namespace Pinetime { DeviceTypes deviceType = DeviceTypes::Unknown; }; } -} \ No newline at end of file +} diff --git a/src/drivers/Bma421_C/bma4.h b/src/drivers/Bma421_C/bma4.h index 081dd4d8..3ea6f4b1 100644 --- a/src/drivers/Bma421_C/bma4.h +++ b/src/drivers/Bma421_C/bma4.h @@ -52,19 +52,19 @@ */ #ifndef BMA4_H__ -#define BMA4_H__ + #define BMA4_H__ /*********************************************************************/ /* header files */ -#include "bma4_defs.h" -#ifdef AKM9916 -#include "aux_akm9916.h" -#endif + #include "bma4_defs.h" + #ifdef AKM9916 + #include "aux_akm9916.h" + #endif -#ifdef BMM150 -#include "aux_bmm150.h" -#endif + #ifdef BMM150 + #include "aux_bmm150.h" + #endif /*********************************************************************/ /* (extern) variable declarations */ @@ -104,7 +104,7 @@ * affect the reference value of the parameter * (Better case don't change the reference value of the parameter) */ -int8_t bma4_init(struct bma4_dev *dev); +int8_t bma4_init(struct bma4_dev* dev); /** * \ingroup bma4 @@ -126,7 +126,7 @@ int8_t bma4_init(struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_write_config_file(struct bma4_dev *dev); +int8_t bma4_write_config_file(struct bma4_dev* dev); /** * \ingroup bma4 @@ -157,7 +157,7 @@ int8_t bma4_write_config_file(struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_write_regs(uint8_t addr, const uint8_t *data, uint32_t len, struct bma4_dev *dev); +int8_t bma4_write_regs(uint8_t addr, const uint8_t* data, uint32_t len, struct bma4_dev* dev); /*! * \ingroup bma4ApiRegisters @@ -181,7 +181,7 @@ int8_t bma4_write_regs(uint8_t addr, const uint8_t *data, uint32_t len, struct b * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_read_regs(uint8_t addr, uint8_t *data, uint32_t len, struct bma4_dev *dev); +int8_t bma4_read_regs(uint8_t addr, uint8_t* data, uint32_t len, struct bma4_dev* dev); /** * \ingroup bma4 @@ -232,7 +232,7 @@ int8_t bma4_read_regs(uint8_t addr, uint8_t *data, uint32_t len, struct bma4_dev * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_error_status(struct bma4_err_reg *err_reg, struct bma4_dev *dev); +int8_t bma4_get_error_status(struct bma4_err_reg* err_reg, struct bma4_dev* dev); /** * \ingroup bma4 @@ -267,7 +267,7 @@ int8_t bma4_get_error_status(struct bma4_err_reg *err_reg, struct bma4_dev *dev) * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_status(uint8_t *status, struct bma4_dev *dev); +int8_t bma4_get_status(uint8_t* status, struct bma4_dev* dev); /** * \ingroup bma4 @@ -295,7 +295,7 @@ int8_t bma4_get_status(uint8_t *status, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_read_accel_xyz(struct bma4_accel *accel, struct bma4_dev *dev); +int8_t bma4_read_accel_xyz(struct bma4_accel* accel, struct bma4_dev* dev); /** * \ingroup bma4 @@ -319,7 +319,7 @@ int8_t bma4_read_accel_xyz(struct bma4_accel *accel, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_sensor_time(uint32_t *sensor_time, struct bma4_dev *dev); +int8_t bma4_get_sensor_time(uint32_t* sensor_time, struct bma4_dev* dev); /** * \ingroup bma4 @@ -358,7 +358,7 @@ int8_t bma4_get_sensor_time(uint32_t *sensor_time, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_temperature(int32_t *temp, uint8_t temp_unit, struct bma4_dev *dev); +int8_t bma4_get_temperature(int32_t* temp, uint8_t temp_unit, struct bma4_dev* dev); /** * \ingroup bma4 @@ -426,7 +426,7 @@ int8_t bma4_get_temperature(int32_t *temp, uint8_t temp_unit, struct bma4_dev *d * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_accel_config(struct bma4_accel_config *accel, struct bma4_dev *dev); +int8_t bma4_get_accel_config(struct bma4_accel_config* accel, struct bma4_dev* dev); /*! * \ingroup bma4ApiAccel @@ -490,7 +490,7 @@ int8_t bma4_get_accel_config(struct bma4_accel_config *accel, struct bma4_dev *d * @retval < 0 -> Fail * */ -int8_t bma4_set_accel_config(const struct bma4_accel_config *accel, struct bma4_dev *dev); +int8_t bma4_set_accel_config(const struct bma4_accel_config* accel, struct bma4_dev* dev); /** * \ingroup bma4 @@ -517,7 +517,7 @@ int8_t bma4_set_accel_config(const struct bma4_accel_config *accel, struct bma4_ * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_advance_power_save(uint8_t adv_pwr_save, struct bma4_dev *dev); +int8_t bma4_set_advance_power_save(uint8_t adv_pwr_save, struct bma4_dev* dev); /*! * \ingroup bma4ApiAdvancedPowerMode @@ -539,7 +539,7 @@ int8_t bma4_set_advance_power_save(uint8_t adv_pwr_save, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_advance_power_save(uint8_t *adv_pwr_save, struct bma4_dev *dev); +int8_t bma4_get_advance_power_save(uint8_t* adv_pwr_save, struct bma4_dev* dev); /** * \ingroup bma4 @@ -566,7 +566,7 @@ int8_t bma4_get_advance_power_save(uint8_t *adv_pwr_save, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_fifo_self_wakeup(uint8_t fifo_self_wakeup, struct bma4_dev *dev); +int8_t bma4_set_fifo_self_wakeup(uint8_t fifo_self_wakeup, struct bma4_dev* dev); /*! * \ingroup bma4ApiFIFOSelfWakeUp @@ -588,7 +588,7 @@ int8_t bma4_set_fifo_self_wakeup(uint8_t fifo_self_wakeup, struct bma4_dev *dev) * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_fifo_self_wakeup(uint8_t *fifo_self_wake_up, struct bma4_dev *dev); +int8_t bma4_get_fifo_self_wakeup(uint8_t* fifo_self_wake_up, struct bma4_dev* dev); /** * \ingroup bma4 @@ -613,7 +613,7 @@ int8_t bma4_get_fifo_self_wakeup(uint8_t *fifo_self_wake_up, struct bma4_dev *de * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_accel_enable(uint8_t accel_en, struct bma4_dev *dev); +int8_t bma4_set_accel_enable(uint8_t accel_en, struct bma4_dev* dev); /*! * \ingroup bma4ApiAccelEnable @@ -631,7 +631,7 @@ int8_t bma4_set_accel_enable(uint8_t accel_en, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_accel_enable(uint8_t *accel_en, struct bma4_dev *dev); +int8_t bma4_get_accel_enable(uint8_t* accel_en, struct bma4_dev* dev); /** * \ingroup bma4 @@ -657,7 +657,7 @@ int8_t bma4_get_accel_enable(uint8_t *accel_en, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_mag_enable(uint8_t mag_en, struct bma4_dev *dev); +int8_t bma4_set_mag_enable(uint8_t mag_en, struct bma4_dev* dev); /*! * \ingroup bma4ApiMagEnable @@ -676,7 +676,7 @@ int8_t bma4_set_mag_enable(uint8_t mag_en, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_mag_enable(uint8_t *mag_en, struct bma4_dev *dev); +int8_t bma4_get_mag_enable(uint8_t* mag_en, struct bma4_dev* dev); /** * \ingroup bma4 @@ -709,7 +709,7 @@ int8_t bma4_get_mag_enable(uint8_t *mag_en, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_spi_interface(uint8_t *spi, struct bma4_dev *dev); +int8_t bma4_get_spi_interface(uint8_t* spi, struct bma4_dev* dev); /*! * \ingroup bma4ApiSpiInterface @@ -735,7 +735,7 @@ int8_t bma4_get_spi_interface(uint8_t *spi, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_spi_interface(uint8_t spi, struct bma4_dev *dev); +int8_t bma4_set_spi_interface(uint8_t spi, struct bma4_dev* dev); /** * \ingroup bma4 @@ -772,7 +772,7 @@ int8_t bma4_set_spi_interface(uint8_t spi, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_command_register(uint8_t command_reg, struct bma4_dev *dev); +int8_t bma4_set_command_register(uint8_t command_reg, struct bma4_dev* dev); /** * \ingroup bma4 @@ -794,7 +794,7 @@ int8_t bma4_set_command_register(uint8_t command_reg, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_i2c_device_addr(struct bma4_dev *dev); +int8_t bma4_set_i2c_device_addr(struct bma4_dev* dev); /** * \ingroup bma4 @@ -828,7 +828,7 @@ int8_t bma4_set_i2c_device_addr(struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_mag_manual_enable(uint8_t mag_manual, struct bma4_dev *dev); +int8_t bma4_set_mag_manual_enable(uint8_t mag_manual, struct bma4_dev* dev); /*! * \ingroup bma4ApiMagManualEnable @@ -856,7 +856,7 @@ int8_t bma4_set_mag_manual_enable(uint8_t mag_manual, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_mag_manual_enable(uint8_t *mag_manual, struct bma4_dev *dev); +int8_t bma4_get_mag_manual_enable(uint8_t* mag_manual, struct bma4_dev* dev); /** * \ingroup bma4 @@ -888,7 +888,7 @@ int8_t bma4_get_mag_manual_enable(uint8_t *mag_manual, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_aux_if_mode(uint8_t if_mode, struct bma4_dev *dev); +int8_t bma4_set_aux_if_mode(uint8_t if_mode, struct bma4_dev* dev); /** * \ingroup bma4 @@ -913,7 +913,7 @@ int8_t bma4_set_aux_if_mode(uint8_t if_mode, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_mag_read_addr(uint8_t *mag_read_addr, struct bma4_dev *dev); +int8_t bma4_get_mag_read_addr(uint8_t* mag_read_addr, struct bma4_dev* dev); /*! * \ingroup bma4ApiMagRead @@ -932,7 +932,7 @@ int8_t bma4_get_mag_read_addr(uint8_t *mag_read_addr, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_mag_read_addr(uint8_t mag_read_addr, struct bma4_dev *dev); +int8_t bma4_set_mag_read_addr(uint8_t mag_read_addr, struct bma4_dev* dev); /** * \ingroup bma4 @@ -957,7 +957,7 @@ int8_t bma4_set_mag_read_addr(uint8_t mag_read_addr, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_mag_write_addr(uint8_t *mag_write_addr, struct bma4_dev *dev); +int8_t bma4_get_mag_write_addr(uint8_t* mag_write_addr, struct bma4_dev* dev); /*! * \ingroup bma4ApiMagWrite @@ -976,7 +976,7 @@ int8_t bma4_get_mag_write_addr(uint8_t *mag_write_addr, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_mag_write_addr(uint8_t mag_write_addr, struct bma4_dev *dev); +int8_t bma4_set_mag_write_addr(uint8_t mag_write_addr, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1001,7 +1001,7 @@ int8_t bma4_set_mag_write_addr(uint8_t mag_write_addr, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_mag_write_data(uint8_t *mag_write_data, struct bma4_dev *dev); +int8_t bma4_get_mag_write_data(uint8_t* mag_write_data, struct bma4_dev* dev); /*! * \ingroup bma4ApiMagData @@ -1020,7 +1020,7 @@ int8_t bma4_get_mag_write_data(uint8_t *mag_write_data, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_mag_write_data(uint8_t mag_write_data, struct bma4_dev *dev); +int8_t bma4_set_mag_write_data(uint8_t mag_write_data, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1045,7 +1045,7 @@ int8_t bma4_set_mag_write_data(uint8_t mag_write_data, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_read_mag_xyzr(struct bma4_mag_xyzr *mag, struct bma4_dev *dev); +int8_t bma4_read_mag_xyzr(struct bma4_mag_xyzr* mag, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1069,7 +1069,7 @@ int8_t bma4_read_mag_xyzr(struct bma4_mag_xyzr *mag, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_mag_burst(uint8_t mag_burst, struct bma4_dev *dev); +int8_t bma4_set_mag_burst(uint8_t mag_burst, struct bma4_dev* dev); /*! * \ingroup bma4ApiMagBurst @@ -1086,7 +1086,7 @@ int8_t bma4_set_mag_burst(uint8_t mag_burst, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_mag_burst(uint8_t *mag_burst, struct bma4_dev *dev); +int8_t bma4_get_mag_burst(uint8_t* mag_burst, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1108,7 +1108,7 @@ int8_t bma4_get_mag_burst(uint8_t *mag_burst, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_read_fifo_data(struct bma4_fifo_frame *fifo, struct bma4_dev *dev); +int8_t bma4_read_fifo_data(struct bma4_fifo_frame* fifo, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1135,7 +1135,7 @@ int8_t bma4_read_fifo_data(struct bma4_fifo_frame *fifo, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_fifo_wm(uint16_t *fifo_wm, struct bma4_dev *dev); +int8_t bma4_get_fifo_wm(uint16_t* fifo_wm, struct bma4_dev* dev); /*! * \ingroup bma4ApiFIFOWM @@ -1155,7 +1155,7 @@ int8_t bma4_get_fifo_wm(uint16_t *fifo_wm, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_fifo_wm(uint16_t fifo_wm, struct bma4_dev *dev); +int8_t bma4_set_fifo_wm(uint16_t fifo_wm, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1188,7 +1188,7 @@ int8_t bma4_set_fifo_wm(uint16_t fifo_wm, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_accel_fifo_filter_data(uint8_t *accel_fifo_filter, struct bma4_dev *dev); +int8_t bma4_get_accel_fifo_filter_data(uint8_t* accel_fifo_filter, struct bma4_dev* dev); /*! * \ingroup bma4ApiAccelFIFOFilterData @@ -1215,7 +1215,7 @@ int8_t bma4_get_accel_fifo_filter_data(uint8_t *accel_fifo_filter, struct bma4_d * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_accel_fifo_filter_data(uint8_t accel_fifo_filter, struct bma4_dev *dev); +int8_t bma4_set_accel_fifo_filter_data(uint8_t accel_fifo_filter, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1240,7 +1240,7 @@ int8_t bma4_set_accel_fifo_filter_data(uint8_t accel_fifo_filter, struct bma4_de * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_fifo_down_accel(uint8_t *fifo_down, struct bma4_dev *dev); +int8_t bma4_get_fifo_down_accel(uint8_t* fifo_down, struct bma4_dev* dev); /*! * \ingroup bma4ApiAccelFIFOFilterData @@ -1258,7 +1258,7 @@ int8_t bma4_get_fifo_down_accel(uint8_t *fifo_down, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_fifo_down_accel(uint8_t fifo_down, struct bma4_dev *dev); +int8_t bma4_set_fifo_down_accel(uint8_t fifo_down, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1287,7 +1287,7 @@ int8_t bma4_set_fifo_down_accel(uint8_t fifo_down, struct bma4_dev *dev); * @retval < 0 -> Fail * */ -int8_t bma4_get_fifo_length(uint16_t *fifo_length, struct bma4_dev *dev); +int8_t bma4_get_fifo_length(uint16_t* fifo_length, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1327,7 +1327,7 @@ int8_t bma4_get_fifo_length(uint16_t *fifo_length, struct bma4_dev *dev); */ int8_t bma4_second_if_mag_compensate_xyz(struct bma4_mag_fifo_data mag_fifo_data, uint8_t mag_second_if, - const struct bma4_mag *compensated_mag_data); + const struct bma4_mag* compensated_mag_data); /** * \ingroup bma4 @@ -1363,7 +1363,7 @@ int8_t bma4_second_if_mag_compensate_xyz(struct bma4_mag_fifo_data mag_fifo_data * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_read_mag_xyz(const struct bma4_mag *mag, uint8_t sensor_select, const struct bma4_dev *dev); +int8_t bma4_read_mag_xyz(const struct bma4_mag* mag, uint8_t sensor_select, const struct bma4_dev* dev); /** * \ingroup bma4 @@ -1396,7 +1396,7 @@ int8_t bma4_read_mag_xyz(const struct bma4_mag *mag, uint8_t sensor_select, cons * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_if_mode(uint8_t *if_mode, struct bma4_dev *dev); +int8_t bma4_get_if_mode(uint8_t* if_mode, struct bma4_dev* dev); /*! * \ingroup bma4ApiIFMode @@ -1422,7 +1422,7 @@ int8_t bma4_get_if_mode(uint8_t *if_mode, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_if_mode(uint8_t if_mode, struct bma4_dev *dev); +int8_t bma4_set_if_mode(uint8_t if_mode, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1446,7 +1446,7 @@ int8_t bma4_set_if_mode(uint8_t if_mode, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_accel_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev); +int8_t bma4_get_accel_data_rdy(uint8_t* data_rdy, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1470,7 +1470,7 @@ int8_t bma4_get_accel_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_mag_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev); +int8_t bma4_get_mag_data_rdy(uint8_t* data_rdy, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1507,7 +1507,7 @@ int8_t bma4_get_mag_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_asic_status(struct bma4_asic_status *asic_status, struct bma4_dev *dev); +int8_t bma4_get_asic_status(struct bma4_asic_status* asic_status, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1540,7 +1540,7 @@ int8_t bma4_get_asic_status(struct bma4_asic_status *asic_status, struct bma4_de * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_offset_comp(uint8_t offset_en, struct bma4_dev *dev); +int8_t bma4_set_offset_comp(uint8_t offset_en, struct bma4_dev* dev); /*! * \ingroup bma4ApiOffsetComp @@ -1566,7 +1566,7 @@ int8_t bma4_set_offset_comp(uint8_t offset_en, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_get_offset_comp(uint8_t *offset_en, struct bma4_dev *dev); +int8_t bma4_get_offset_comp(uint8_t* offset_en, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1607,10 +1607,7 @@ int8_t bma4_get_offset_comp(uint8_t *offset_en, struct bma4_dev *dev); * @retval < 0 -> Fail * */ -int8_t bma4_extract_accel(struct bma4_accel *accel_data, - uint16_t *accel_length, - struct bma4_fifo_frame *fifo, - const struct bma4_dev *dev); +int8_t bma4_extract_accel(struct bma4_accel* accel_data, uint16_t* accel_length, struct bma4_fifo_frame* fifo, const struct bma4_dev* dev); /** * \ingroup bma4 @@ -1650,10 +1647,7 @@ int8_t bma4_extract_accel(struct bma4_accel *accel_data, * @retval < 0 -> Fail * */ -int8_t bma4_extract_mag(const struct bma4_mag *mag_data, - uint16_t *mag_length, - struct bma4_fifo_frame *fifo, - const struct bma4_dev *dev); +int8_t bma4_extract_mag(const struct bma4_mag* mag_data, uint16_t* mag_length, struct bma4_fifo_frame* fifo, const struct bma4_dev* dev); /** * \ingroup bma4 @@ -1686,7 +1680,7 @@ int8_t bma4_extract_mag(const struct bma4_mag *mag_data, * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_perform_accel_selftest(int8_t *result, struct bma4_dev *dev); +int8_t bma4_perform_accel_selftest(int8_t* result, struct bma4_dev* dev); /*! * \ingroup bma4ApiAccelSelftest @@ -1704,7 +1698,7 @@ int8_t bma4_perform_accel_selftest(int8_t *result, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_selftest_config(uint8_t sign, struct bma4_dev *dev); +int8_t bma4_selftest_config(uint8_t sign, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1749,7 +1743,7 @@ int8_t bma4_selftest_config(uint8_t sign, struct bma4_dev *dev); * @retval < 0 -> Fail * */ -int8_t bma4_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, struct bma4_dev *dev); +int8_t bma4_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, struct bma4_dev* dev); /*! * \ingroup bma4ApiInterrupt @@ -1776,7 +1770,7 @@ int8_t bma4_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, st * @retval < 0 -> Fail * */ -int8_t bma4_set_interrupt_mode(uint8_t mode, struct bma4_dev *dev); +int8_t bma4_set_interrupt_mode(uint8_t mode, struct bma4_dev* dev); /*! * \ingroup bma4ApiInterrupt @@ -1803,7 +1797,7 @@ int8_t bma4_set_interrupt_mode(uint8_t mode, struct bma4_dev *dev); * @retval < 0 -> Fail * */ -int8_t bma4_get_interrupt_mode(uint8_t *mode, struct bma4_dev *dev); +int8_t bma4_get_interrupt_mode(uint8_t* mode, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1853,7 +1847,7 @@ int8_t bma4_get_interrupt_mode(uint8_t *mode, struct bma4_dev *dev); * @retval < 0 -> Fail * */ -int8_t bma4_set_aux_mag_config(const struct bma4_aux_mag_config *aux_mag, struct bma4_dev *dev); +int8_t bma4_set_aux_mag_config(const struct bma4_aux_mag_config* aux_mag, struct bma4_dev* dev); /*! * \ingroup bma4ApiAuxMagConfig @@ -1898,7 +1892,7 @@ int8_t bma4_set_aux_mag_config(const struct bma4_aux_mag_config *aux_mag, struct * @retval < 0 -> Fail * */ -int8_t bma4_get_aux_mag_config(struct bma4_aux_mag_config *aux_mag, struct bma4_dev *dev); +int8_t bma4_get_aux_mag_config(struct bma4_aux_mag_config* aux_mag, struct bma4_dev* dev); /** * \ingroup bma4 @@ -1942,7 +1936,7 @@ int8_t bma4_get_aux_mag_config(struct bma4_aux_mag_config *aux_mag, struct bma4_ * @retval < 0 -> Fail * */ -int8_t bma4_set_fifo_config(uint8_t config, uint8_t enable, struct bma4_dev *dev); +int8_t bma4_set_fifo_config(uint8_t config, uint8_t enable, struct bma4_dev* dev); /*! * \ingroup bma4ApiFIFOConfig @@ -1979,7 +1973,7 @@ int8_t bma4_set_fifo_config(uint8_t config, uint8_t enable, struct bma4_dev *dev * @retval < 0 -> Fail * */ -int8_t bma4_get_fifo_config(uint8_t *fifo_config, struct bma4_dev *dev); +int8_t bma4_get_fifo_config(uint8_t* fifo_config, struct bma4_dev* dev); /** * \ingroup bma4 @@ -2039,8 +2033,7 @@ int8_t bma4_get_fifo_config(uint8_t *fifo_config, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma4_set_int_pin_config(const struct bma4_int_pin_config *int_pin_config, uint8_t int_line, - struct bma4_dev *dev); +int8_t bma4_set_int_pin_config(const struct bma4_int_pin_config* int_pin_config, uint8_t int_line, struct bma4_dev* dev); /*! * \ingroup bma4ApiIntConfig @@ -2092,7 +2085,7 @@ int8_t bma4_set_int_pin_config(const struct bma4_int_pin_config *int_pin_config, * @retval < 0 -> Fail * */ -int8_t bma4_get_int_pin_config(struct bma4_int_pin_config *int_pin_config, uint8_t int_line, struct bma4_dev *dev); +int8_t bma4_get_int_pin_config(struct bma4_int_pin_config* int_pin_config, uint8_t int_line, struct bma4_dev* dev); /** * \ingroup bma4 @@ -2116,7 +2109,7 @@ int8_t bma4_get_int_pin_config(struct bma4_int_pin_config *int_pin_config, uint8 * @retval < 0 -> Fail * */ -int8_t bma4_read_int_status(uint16_t *int_status, struct bma4_dev *dev); +int8_t bma4_read_int_status(uint16_t* int_status, struct bma4_dev* dev); /*! * \ingroup bma4ApiIntStatus @@ -2134,7 +2127,7 @@ int8_t bma4_read_int_status(uint16_t *int_status, struct bma4_dev *dev); * @retval < 0 -> Fail * */ -int8_t bma4_read_int_status_0(uint8_t *int_status_0, struct bma4_dev *dev); +int8_t bma4_read_int_status_0(uint8_t* int_status_0, struct bma4_dev* dev); /*! * \ingroup bma4ApiIntStatus @@ -2152,7 +2145,7 @@ int8_t bma4_read_int_status_0(uint8_t *int_status_0, struct bma4_dev *dev); * @retval < 0 -> Fail * */ -int8_t bma4_read_int_status_1(uint8_t *int_status_1, struct bma4_dev *dev); +int8_t bma4_read_int_status_1(uint8_t* int_status_1, struct bma4_dev* dev); /** * \ingroup bma4 @@ -2176,7 +2169,7 @@ int8_t bma4_read_int_status_1(uint8_t *int_status_1, struct bma4_dev *dev); * @retval < 0 -> Fail * */ -int8_t bma4_aux_interface_init(struct bma4_dev *dev); +int8_t bma4_aux_interface_init(struct bma4_dev* dev); /*! * \ingroup bma4ApiAux @@ -2197,7 +2190,7 @@ int8_t bma4_aux_interface_init(struct bma4_dev *dev); * @retval < 0 -> Fail * */ -int8_t bma4_aux_read(uint8_t aux_reg_addr, uint8_t *aux_data, uint16_t len, struct bma4_dev *dev); +int8_t bma4_aux_read(uint8_t aux_reg_addr, uint8_t* aux_data, uint16_t len, struct bma4_dev* dev); /*! * \ingroup bma4ApiAux @@ -2218,7 +2211,7 @@ int8_t bma4_aux_read(uint8_t aux_reg_addr, uint8_t *aux_data, uint16_t len, stru * @retval < 0 -> Fail * */ -int8_t bma4_aux_write(uint8_t aux_reg_addr, const uint8_t *aux_data, uint16_t len, struct bma4_dev *dev); +int8_t bma4_aux_write(uint8_t aux_reg_addr, const uint8_t* aux_data, uint16_t len, struct bma4_dev* dev); /** * \ingroup bma4 @@ -2241,7 +2234,7 @@ int8_t bma4_aux_write(uint8_t aux_reg_addr, const uint8_t *aux_data, uint16_t le * @retval < 0 -> Fail * */ -int8_t bma4_soft_reset(struct bma4_dev *dev); +int8_t bma4_soft_reset(struct bma4_dev* dev); /** * \ingroup bma4 @@ -2274,7 +2267,7 @@ int8_t bma4_soft_reset(struct bma4_dev *dev); * @retval Any non zero value -> Fail * */ -int8_t bma4_perform_accel_foc(const struct bma4_accel_foc_g_value *accel_g_value, struct bma4_dev *dev); +int8_t bma4_perform_accel_foc(const struct bma4_accel_foc_g_value* accel_g_value, struct bma4_dev* dev); #endif diff --git a/src/drivers/Bma421_C/bma423.h b/src/drivers/Bma421_C/bma423.h index b58e0d21..fba8efe9 100644 --- a/src/drivers/Bma421_C/bma423.h +++ b/src/drivers/Bma421_C/bma423.h @@ -51,131 +51,131 @@ extern "C" { #include "bma4.h" /**\name Chip ID of BMA423 sensor */ -#define BMA423_CHIP_ID UINT8_C(0x11) -#define BMA425_CHIP_ID UINT8_C(0x13) +#define BMA423_CHIP_ID UINT8_C(0x11) +#define BMA425_CHIP_ID UINT8_C(0x13) /**\ Configuration ID start position of BMA423 sensor */ -#define BMA423_CONFIG_ID_START_ADDR UINT8_C(66) +#define BMA423_CONFIG_ID_START_ADDR UINT8_C(66) /**\name Sensor feature size */ -#define BMA423_FEATURE_SIZE UINT8_C(70) -#define BMA423_ANY_MOT_LEN UINT8_C(4) +#define BMA423_FEATURE_SIZE UINT8_C(70) +#define BMA423_ANY_MOT_LEN UINT8_C(4) /**\name Feature offset address */ -#define BMA423_ANY_MOT_OFFSET UINT8_C(0x00) -#define BMA423_NO_MOT_OFFSET UINT8_C(0x04) -#define BMA423_STEP_CNTR_PARAM_OFFSET UINT8_C(0x08) -#define BMA423_STEP_CNTR_OFFSET UINT8_C(0x3A) -#define BMA423_SINGLE_TAP_OFFSET UINT8_C(0x3C) -#define BMA423_DOUBLE_TAP_OFFSET UINT8_C(0x3E) -#define BMA423_WRIST_WEAR_OFFSET UINT8_C(0x40) -#define BMA423_CONFIG_ID_OFFSET UINT8_C(0x42) -#define BMA423_AXES_REMAP_OFFSET UINT8_C(0x44) +#define BMA423_ANY_MOT_OFFSET UINT8_C(0x00) +#define BMA423_NO_MOT_OFFSET UINT8_C(0x04) +#define BMA423_STEP_CNTR_PARAM_OFFSET UINT8_C(0x08) +#define BMA423_STEP_CNTR_OFFSET UINT8_C(0x3A) +#define BMA423_SINGLE_TAP_OFFSET UINT8_C(0x3C) +#define BMA423_DOUBLE_TAP_OFFSET UINT8_C(0x3E) +#define BMA423_WRIST_WEAR_OFFSET UINT8_C(0x40) +#define BMA423_CONFIG_ID_OFFSET UINT8_C(0x42) +#define BMA423_AXES_REMAP_OFFSET UINT8_C(0x44) /**\name Read/Write Lengths */ -#define BMA423_RD_WR_MIN_LEN UINT8_C(2) -#define BMA423_NO_MOT_RD_WR_LEN (BMA423_ANY_MOT_LEN + BMA423_NO_MOT_OFFSET) +#define BMA423_RD_WR_MIN_LEN UINT8_C(2) +#define BMA423_NO_MOT_RD_WR_LEN (BMA423_ANY_MOT_LEN + BMA423_NO_MOT_OFFSET) /*! @name Mask definitions for major and minor config */ -#define BMA423_CONFIG_MAJOR_MSK UINT16_C(0X3C0) -#define BMA423_CONFIG_MINOR_MSK UINT8_C(0X1F) +#define BMA423_CONFIG_MAJOR_MSK UINT16_C(0X3C0) +#define BMA423_CONFIG_MINOR_MSK UINT8_C(0X1F) /*! @name Bit position for major config */ -#define BMA423_CONFIG_MAJOR_POS UINT8_C(0X06) +#define BMA423_CONFIG_MAJOR_POS UINT8_C(0X06) /**************************************************************/ /**\name Re-map Axes */ /**************************************************************/ -#define BMA423_X_AXIS_MASK UINT8_C(0x03) -#define BMA423_X_AXIS_SIGN_MASK UINT8_C(0x04) -#define BMA423_Y_AXIS_MASK UINT8_C(0x18) -#define BMA423_Y_AXIS_SIGN_MASK UINT8_C(0x20) -#define BMA423_Z_AXIS_MASK UINT8_C(0xC0) -#define BMA423_Z_AXIS_SIGN_MASK UINT8_C(0x01) +#define BMA423_X_AXIS_MASK UINT8_C(0x03) +#define BMA423_X_AXIS_SIGN_MASK UINT8_C(0x04) +#define BMA423_Y_AXIS_MASK UINT8_C(0x18) +#define BMA423_Y_AXIS_SIGN_MASK UINT8_C(0x20) +#define BMA423_Z_AXIS_MASK UINT8_C(0xC0) +#define BMA423_Z_AXIS_SIGN_MASK UINT8_C(0x01) /**************************************************************/ /**\name Step Counter/Detector/Activity */ /**************************************************************/ /**\name Step counter/activity enable macros */ -#define BMA423_STEP_CNTR_EN_MSK UINT8_C(0x10) -#define BMA423_STEP_ACT_EN_MSK UINT8_C(0x20) +#define BMA423_STEP_CNTR_EN_MSK UINT8_C(0x10) +#define BMA423_STEP_ACT_EN_MSK UINT8_C(0x20) /**\name Step counter water-mark macros */ -#define BMA423_STEP_CNTR_WM_MSK UINT16_C(0x03FF) +#define BMA423_STEP_CNTR_WM_MSK UINT16_C(0x03FF) /**\name Step counter reset macros */ -#define BMA423_STEP_CNTR_RST_POS UINT8_C(2) -#define BMA423_STEP_CNTR_RST_MSK UINT8_C(0x04) +#define BMA423_STEP_CNTR_RST_POS UINT8_C(2) +#define BMA423_STEP_CNTR_RST_MSK UINT8_C(0x04) /**\name Step detector enable macros */ -#define BMA423_STEP_DETECTOR_EN_POS UINT8_C(3) -#define BMA423_STEP_DETECTOR_EN_MSK UINT8_C(0x08) +#define BMA423_STEP_DETECTOR_EN_POS UINT8_C(3) +#define BMA423_STEP_DETECTOR_EN_MSK UINT8_C(0x08) /**\name Wrist-wear enable macros */ -#define BMA423_WRIST_WEAR_EN_MSK UINT8_C(0x01) +#define BMA423_WRIST_WEAR_EN_MSK UINT8_C(0x01) /**\name Step count output length*/ -#define BMA423_STEP_CNTR_DATA_SIZE UINT16_C(4) +#define BMA423_STEP_CNTR_DATA_SIZE UINT16_C(4) /**\name single tap enable macros */ -#define BMA423_SINGLE_TAP_EN_MSK UINT8_C(0x01) +#define BMA423_SINGLE_TAP_EN_MSK UINT8_C(0x01) /**\name double tap enable macros */ -#define BMA423_DOUBLE_TAP_EN_MSK UINT8_C(0x01) +#define BMA423_DOUBLE_TAP_EN_MSK UINT8_C(0x01) /**\name tap sensitivity macros */ -#define BMA423_TAP_SENS_POS UINT8_C(1) -#define BMA423_TAP_SENS_MSK UINT8_C(0x0E) +#define BMA423_TAP_SENS_POS UINT8_C(1) +#define BMA423_TAP_SENS_MSK UINT8_C(0x0E) /**\name Tap selection macro */ -#define BMA423_TAP_SEL_POS UINT8_C(4) -#define BMA423_TAP_SEL_MSK UINT8_C(0x10) +#define BMA423_TAP_SEL_POS UINT8_C(4) +#define BMA423_TAP_SEL_MSK UINT8_C(0x10) /**************************************************************/ /**\name Any/no Motion */ /**************************************************************/ /**\name Any/No motion threshold macros */ -#define BMA423_ANY_NO_MOT_THRES_MSK UINT16_C(0x07FF) +#define BMA423_ANY_NO_MOT_THRES_MSK UINT16_C(0x07FF) /**\name Any/No motion duration macros */ -#define BMA423_ANY_NO_MOT_DUR_MSK UINT16_C(0x1FFF) +#define BMA423_ANY_NO_MOT_DUR_MSK UINT16_C(0x1FFF) /**\name Any/No motion enable macros */ -#define BMA423_ANY_NO_MOT_AXIS_EN_POS UINT8_C(0x0D) -#define BMA423_ANY_NO_MOT_AXIS_EN_MSK UINT16_C(0xE000) +#define BMA423_ANY_NO_MOT_AXIS_EN_POS UINT8_C(0x0D) +#define BMA423_ANY_NO_MOT_AXIS_EN_MSK UINT16_C(0xE000) /**************************************************************/ /**\name User macros */ /**************************************************************/ /**\name Any-motion/No-motion axis enable macros */ -#define BMA423_X_AXIS_EN UINT8_C(0x01) -#define BMA423_Y_AXIS_EN UINT8_C(0x02) -#define BMA423_Z_AXIS_EN UINT8_C(0x04) -#define BMA423_EN_ALL_AXIS UINT8_C(0x07) -#define BMA423_DIS_ALL_AXIS UINT8_C(0x00) +#define BMA423_X_AXIS_EN UINT8_C(0x01) +#define BMA423_Y_AXIS_EN UINT8_C(0x02) +#define BMA423_Z_AXIS_EN UINT8_C(0x04) +#define BMA423_EN_ALL_AXIS UINT8_C(0x07) +#define BMA423_DIS_ALL_AXIS UINT8_C(0x00) /**\name Feature enable macros for the sensor */ -#define BMA423_STEP_CNTR UINT8_C(0x01) -#define BMA423_STEP_ACT UINT8_C(0x02) -#define BMA423_WRIST_WEAR UINT8_C(0x04) -#define BMA423_SINGLE_TAP UINT8_C(0x08) -#define BMA423_DOUBLE_TAP UINT8_C(0x10) +#define BMA423_STEP_CNTR UINT8_C(0x01) +#define BMA423_STEP_ACT UINT8_C(0x02) +#define BMA423_WRIST_WEAR UINT8_C(0x04) +#define BMA423_SINGLE_TAP UINT8_C(0x08) +#define BMA423_DOUBLE_TAP UINT8_C(0x10) /**\name Interrupt status macros */ -#define BMA423_SINGLE_TAP_INT UINT8_C(0x01) -#define BMA423_STEP_CNTR_INT UINT8_C(0x02) -#define BMA423_ACTIVITY_INT UINT8_C(0x04) -#define BMA423_WRIST_WEAR_INT UINT8_C(0x08) -#define BMA423_DOUBLE_TAP_INT UINT8_C(0x10) -#define BMA423_ANY_MOT_INT UINT8_C(0x20) -#define BMA423_NO_MOT_INT UINT8_C(0x40) -#define BMA423_ERROR_INT UINT8_C(0x80) +#define BMA423_SINGLE_TAP_INT UINT8_C(0x01) +#define BMA423_STEP_CNTR_INT UINT8_C(0x02) +#define BMA423_ACTIVITY_INT UINT8_C(0x04) +#define BMA423_WRIST_WEAR_INT UINT8_C(0x08) +#define BMA423_DOUBLE_TAP_INT UINT8_C(0x10) +#define BMA423_ANY_MOT_INT UINT8_C(0x20) +#define BMA423_NO_MOT_INT UINT8_C(0x40) +#define BMA423_ERROR_INT UINT8_C(0x80) /**\name Activity recognition macros */ -#define BMA423_USER_STATIONARY UINT8_C(0x00) -#define BMA423_USER_WALKING UINT8_C(0x01) -#define BMA423_USER_RUNNING UINT8_C(0x02) -#define BMA423_STATE_INVALID UINT8_C(0x03) +#define BMA423_USER_STATIONARY UINT8_C(0x00) +#define BMA423_USER_WALKING UINT8_C(0x01) +#define BMA423_USER_RUNNING UINT8_C(0x02) +#define BMA423_STATE_INVALID UINT8_C(0x03) /******************************************************************************/ /*! @name Structure Declarations */ @@ -184,123 +184,120 @@ extern "C" { /*! * @brief Any/No motion configuration */ -struct bma423_any_no_mot_config -{ - /*! Expressed in 50 Hz samples (20 ms) */ - uint16_t duration; +struct bma423_any_no_mot_config { + /*! Expressed in 50 Hz samples (20 ms) */ + uint16_t duration; - /*! Threshold value for Any-motion/No-motion detection in - * 5.11g format - */ - uint16_t threshold; + /*! Threshold value for Any-motion/No-motion detection in + * 5.11g format + */ + uint16_t threshold; - /*! To enable selected axes */ - uint8_t axes_en; + /*! To enable selected axes */ + uint8_t axes_en; }; /*! * @brief Axes re-mapping configuration */ -struct bma423_axes_remap -{ - /*! Re-mapped x-axis */ - uint8_t x_axis; +struct bma423_axes_remap { + /*! Re-mapped x-axis */ + uint8_t x_axis; - /*! Re-mapped y-axis */ - uint8_t y_axis; + /*! Re-mapped y-axis */ + uint8_t y_axis; - /*! Re-mapped z-axis */ - uint8_t z_axis; + /*! Re-mapped z-axis */ + uint8_t z_axis; - /*! Re-mapped x-axis sign */ - uint8_t x_axis_sign; + /*! Re-mapped x-axis sign */ + uint8_t x_axis_sign; - /*! Re-mapped y-axis sign */ - uint8_t y_axis_sign; + /*! Re-mapped y-axis sign */ + uint8_t y_axis_sign; - /*! Re-mapped z-axis sign */ - uint8_t z_axis_sign; + /*! Re-mapped z-axis sign */ + uint8_t z_axis_sign; }; /*! * @brief Step counter param settings */ -struct bma423_stepcounter_settings -{ - /*! Step Counter param 1 */ - uint16_t param1; +struct bma423_stepcounter_settings { + /*! Step Counter param 1 */ + uint16_t param1; - /*! Step Counter param 2 */ - uint16_t param2; + /*! Step Counter param 2 */ + uint16_t param2; - /*! Step Counter param 3 */ - uint16_t param3; + /*! Step Counter param 3 */ + uint16_t param3; - /*! Step Counter param 4 */ - uint16_t param4; + /*! Step Counter param 4 */ + uint16_t param4; - /*! Step Counter param 5 */ - uint16_t param5; + /*! Step Counter param 5 */ + uint16_t param5; - /*! Step Counter param 6 */ - uint16_t param6; + /*! Step Counter param 6 */ + uint16_t param6; - /*! Step Counter param 7 */ - uint16_t param7; + /*! Step Counter param 7 */ + uint16_t param7; - /*! Step Counter param 8 */ - uint16_t param8; + /*! Step Counter param 8 */ + uint16_t param8; - /*! Step Counter param 9 */ - uint16_t param9; + /*! Step Counter param 9 */ + uint16_t param9; - /*! Step Counter param 10 */ - uint16_t param10; + /*! Step Counter param 10 */ + uint16_t param10; - /*! Step Counter param 11 */ - uint16_t param11; + /*! Step Counter param 11 */ + uint16_t param11; - /*! Step Counter param 12 */ - uint16_t param12; + /*! Step Counter param 12 */ + uint16_t param12; - /*! Step Counter param 13 */ - uint16_t param13; + /*! Step Counter param 13 */ + uint16_t param13; - /*! Step Counter param 14 */ - uint16_t param14; + /*! Step Counter param 14 */ + uint16_t param14; - /*! Step Counter param 15 */ - uint16_t param15; + /*! Step Counter param 15 */ + uint16_t param15; - /*! Step Counter param 16 */ - uint16_t param16; + /*! Step Counter param 16 */ + uint16_t param16; - /*! Step Counter param 17 */ - uint16_t param17; + /*! Step Counter param 17 */ + uint16_t param17; - /*! Step Counter param 18 */ - uint16_t param18; + /*! Step Counter param 18 */ + uint16_t param18; - /*! Step Counter param 19 */ - uint16_t param19; + /*! Step Counter param 19 */ + uint16_t param19; - /*! Step Counter param 20 */ - uint16_t param20; + /*! Step Counter param 20 */ + uint16_t param20; - /*! Step Counter param 21 */ - uint16_t param21; + /*! Step Counter param 21 */ + uint16_t param21; - /*! Step Counter param 22 */ - uint16_t param22; + /*! Step Counter param 22 */ + uint16_t param22; - /*! Step Counter param 23 */ - uint16_t param23; + /*! Step Counter param 23 */ + uint16_t param23; - /*! Step Counter param 24 */ - uint16_t param24; + /*! Step Counter param 24 */ + uint16_t param24; - /*! Step Counter param 25 */ - uint16_t param25; + /*! Step Counter param 25 */ + uint16_t param25; }; /***************************************************************************/ @@ -330,7 +327,7 @@ struct bma423_stepcounter_settings * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_init(struct bma4_dev *dev); +int8_t bma423_init(struct bma4_dev* dev); /** * \ingroup bma423 @@ -353,7 +350,7 @@ int8_t bma423_init(struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_write_config_file(struct bma4_dev *dev); +int8_t bma423_write_config_file(struct bma4_dev* dev); /** * \ingroup bma423 @@ -376,7 +373,7 @@ int8_t bma423_write_config_file(struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_get_config_id(uint16_t *config_id, struct bma4_dev *dev); +int8_t bma423_get_config_id(uint16_t* config_id, struct bma4_dev* dev); /** * \ingroup bma423 @@ -434,7 +431,7 @@ int8_t bma423_get_config_id(uint16_t *config_id, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, struct bma4_dev *dev); +int8_t bma423_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, struct bma4_dev* dev); /** * \ingroup bma423 @@ -474,7 +471,7 @@ int8_t bma423_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_read_int_status(uint16_t *int_status, struct bma4_dev *dev); +int8_t bma423_read_int_status(uint16_t* int_status, struct bma4_dev* dev); /** * \ingroup bma423 @@ -516,7 +513,7 @@ int8_t bma423_read_int_status(uint16_t *int_status, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_feature_enable(uint8_t feature, uint8_t enable, struct bma4_dev *dev); +int8_t bma423_feature_enable(uint8_t feature, uint8_t enable, struct bma4_dev* dev); /** * \ingroup bma423 @@ -539,7 +536,7 @@ int8_t bma423_feature_enable(uint8_t feature, uint8_t enable, struct bma4_dev *d * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_set_remap_axes(const struct bma423_axes_remap *remap_data, struct bma4_dev *dev); +int8_t bma423_set_remap_axes(const struct bma423_axes_remap* remap_data, struct bma4_dev* dev); /*! * \ingroup bma423ApiRemap @@ -557,7 +554,7 @@ int8_t bma423_set_remap_axes(const struct bma423_axes_remap *remap_data, struct * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_get_remap_axes(struct bma423_axes_remap *remap_data, struct bma4_dev *dev); +int8_t bma423_get_remap_axes(struct bma423_axes_remap* remap_data, struct bma4_dev* dev); /** * \ingroup bma423 @@ -585,7 +582,7 @@ int8_t bma423_get_remap_axes(struct bma423_axes_remap *remap_data, struct bma4_d * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_step_counter_set_watermark(uint16_t step_counter_wm, struct bma4_dev *dev); +int8_t bma423_step_counter_set_watermark(uint16_t step_counter_wm, struct bma4_dev* dev); /*! * \ingroup bma423ApiStepC @@ -607,7 +604,7 @@ int8_t bma423_step_counter_set_watermark(uint16_t step_counter_wm, struct bma4_d * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_step_counter_get_watermark(uint16_t *step_counter_wm, struct bma4_dev *dev); +int8_t bma423_step_counter_get_watermark(uint16_t* step_counter_wm, struct bma4_dev* dev); /*! * \ingroup bma423ApiStepC @@ -623,7 +620,7 @@ int8_t bma423_step_counter_get_watermark(uint16_t *step_counter_wm, struct bma4_ * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_reset_step_counter(struct bma4_dev *dev); +int8_t bma423_reset_step_counter(struct bma4_dev* dev); /*! * \ingroup bma423ApiStepC @@ -642,7 +639,7 @@ int8_t bma423_reset_step_counter(struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_step_counter_output(uint32_t *step_count, struct bma4_dev *dev); +int8_t bma423_step_counter_output(uint32_t* step_count, struct bma4_dev* dev); /** * \ingroup bma423 @@ -676,7 +673,7 @@ int8_t bma423_step_counter_output(uint32_t *step_count, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_activity_output(uint8_t *activity, struct bma4_dev *dev); +int8_t bma423_activity_output(uint8_t* activity, struct bma4_dev* dev); /*! * \ingroup bma423ApiStepC @@ -695,7 +692,7 @@ int8_t bma423_activity_output(uint8_t *activity, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_stepcounter_get_parameter(struct bma423_stepcounter_settings *setting, struct bma4_dev *dev); +int8_t bma423_stepcounter_get_parameter(struct bma423_stepcounter_settings* setting, struct bma4_dev* dev); /*! * \ingroup bma423ApiStepC @@ -714,7 +711,7 @@ int8_t bma423_stepcounter_get_parameter(struct bma423_stepcounter_settings *sett * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_stepcounter_set_parameter(const struct bma423_stepcounter_settings *setting, struct bma4_dev *dev); +int8_t bma423_stepcounter_set_parameter(const struct bma423_stepcounter_settings* setting, struct bma4_dev* dev); /** * \ingroup bma421 @@ -746,7 +743,7 @@ int8_t bma423_stepcounter_set_parameter(const struct bma423_stepcounter_settings * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_step_detector_enable(uint8_t enable, struct bma4_dev *dev); +int8_t bma423_step_detector_enable(uint8_t enable, struct bma4_dev* dev); /** * \ingroup bma423 @@ -806,7 +803,7 @@ int8_t bma423_step_detector_enable(uint8_t enable, struct bma4_dev *dev); * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_set_any_mot_config(const struct bma423_any_no_mot_config *any_mot, struct bma4_dev *dev); +int8_t bma423_set_any_mot_config(const struct bma423_any_no_mot_config* any_mot, struct bma4_dev* dev); /*! * \ingroup bma423ApiAnyMot @@ -860,7 +857,7 @@ int8_t bma423_set_any_mot_config(const struct bma423_any_no_mot_config *any_mot, * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_get_any_mot_config(struct bma423_any_no_mot_config *any_mot, struct bma4_dev *dev); +int8_t bma423_get_any_mot_config(struct bma423_any_no_mot_config* any_mot, struct bma4_dev* dev); /** * \ingroup bma423 @@ -920,7 +917,7 @@ int8_t bma423_get_any_mot_config(struct bma423_any_no_mot_config *any_mot, struc * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_set_no_mot_config(const struct bma423_any_no_mot_config *no_mot, struct bma4_dev *dev); +int8_t bma423_set_no_mot_config(const struct bma423_any_no_mot_config* no_mot, struct bma4_dev* dev); /*! * \ingroup bma423ApiNomot @@ -974,7 +971,7 @@ int8_t bma423_set_no_mot_config(const struct bma423_any_no_mot_config *no_mot, s * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_get_no_mot_config(struct bma423_any_no_mot_config *no_mot, struct bma4_dev *dev); +int8_t bma423_get_no_mot_config(struct bma423_any_no_mot_config* no_mot, struct bma4_dev* dev); /** * \ingroup bma423 @@ -1006,7 +1003,7 @@ int8_t bma423_get_no_mot_config(struct bma423_any_no_mot_config *no_mot, struct * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_single_tap_set_sensitivity(uint8_t sensitivity, struct bma4_dev *dev); +int8_t bma423_single_tap_set_sensitivity(uint8_t sensitivity, struct bma4_dev* dev); /*! * \ingroup bma423ApiTap @@ -1032,7 +1029,7 @@ int8_t bma423_single_tap_set_sensitivity(uint8_t sensitivity, struct bma4_dev *d * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_double_tap_set_sensitivity(uint8_t sensitivity, struct bma4_dev *dev); +int8_t bma423_double_tap_set_sensitivity(uint8_t sensitivity, struct bma4_dev* dev); /*! * \ingroup bma423ApiTap @@ -1058,7 +1055,7 @@ int8_t bma423_double_tap_set_sensitivity(uint8_t sensitivity, struct bma4_dev *d * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_single_tap_get_sensitivity(uint8_t *sensitivity, struct bma4_dev *dev); +int8_t bma423_single_tap_get_sensitivity(uint8_t* sensitivity, struct bma4_dev* dev); /*! * \ingroup bma423ApiTap @@ -1084,7 +1081,7 @@ int8_t bma423_single_tap_get_sensitivity(uint8_t *sensitivity, struct bma4_dev * * @retval 0 -> Success * @retval < 0 -> Fail */ -int8_t bma423_double_tap_get_sensitivity(uint8_t *sensitivity, struct bma4_dev *dev); +int8_t bma423_double_tap_get_sensitivity(uint8_t* sensitivity, struct bma4_dev* dev); /** * \ingroup bma423 @@ -1107,7 +1104,7 @@ int8_t bma423_double_tap_get_sensitivity(uint8_t *sensitivity, struct bma4_dev * * @retval BMA4_OK - Success. * @retval BMA4_E_NULL_PTR - Error: Null pointer error */ -int8_t bma423_get_version_config(uint16_t *config_major, uint16_t *config_minor, struct bma4_dev *dev); +int8_t bma423_get_version_config(uint16_t* config_major, uint16_t* config_minor, struct bma4_dev* dev); #ifdef __cplusplus } diff --git a/src/drivers/Bma421_C/bma4_defs.h b/src/drivers/Bma421_C/bma4_defs.h index 45e49208..e257694f 100644 --- a/src/drivers/Bma421_C/bma4_defs.h +++ b/src/drivers/Bma421_C/bma4_defs.h @@ -45,11 +45,11 @@ /*********************************************************************/ /**\ header files */ #ifdef __KERNEL__ -#include + #include #else -#include -#include -#include + #include + #include + #include #endif /*********************************************************************/ @@ -57,619 +57,614 @@ #ifdef __KERNEL__ -#if (!defined(UINT8_C) && !defined(INT8_C)) -#define INT8_C(x) S8_C(x) -#define UINT8_C(x) U8_C(x) -#endif + #if (!defined(UINT8_C) && !defined(INT8_C)) + #define INT8_C(x) S8_C(x) + #define UINT8_C(x) U8_C(x) + #endif -#if (!defined(UINT16_C) && !defined(INT16_C)) -#define INT16_C(x) S16_C(x) -#define UINT16_C(x) U16_C(x) -#endif + #if (!defined(UINT16_C) && !defined(INT16_C)) + #define INT16_C(x) S16_C(x) + #define UINT16_C(x) U16_C(x) + #endif -#if (!defined(INT32_C) && !defined(UINT32_C)) -#define INT32_C(x) S32_C(x) -#define UINT32_C(x) U32_C(x) -#endif + #if (!defined(INT32_C) && !defined(UINT32_C)) + #define INT32_C(x) S32_C(x) + #define UINT32_C(x) U32_C(x) + #endif -#if (!defined(INT64_C) && !defined(UINT64_C)) -#define INT64_C(x) S64_C(x) -#define UINT64_C(x) U64_C(x) -#endif + #if (!defined(INT64_C) && !defined(UINT64_C)) + #define INT64_C(x) S64_C(x) + #define UINT64_C(x) U64_C(x) + #endif #else /* __KERNEL__ */ -#if (!defined(UINT8_C) && !defined(INT8_C)) -#define INT8_C(x) (x) -#define UINT8_C(x) (x##U) -#endif + #if (!defined(UINT8_C) && !defined(INT8_C)) + #define INT8_C(x) (x) + #define UINT8_C(x) (x##U) + #endif -#if (!defined(UINT16_C) && !defined(INT16_C)) -#define INT16_C(x) (x) -#define UINT16_C(x) (x##U) -#endif + #if (!defined(UINT16_C) && !defined(INT16_C)) + #define INT16_C(x) (x) + #define UINT16_C(x) (x##U) + #endif -#if (!defined(INT32_C) && !defined(UINT32_C)) -#define INT32_C(x) (x) -#define UINT32_C(x) (x##U) -#endif + #if (!defined(INT32_C) && !defined(UINT32_C)) + #define INT32_C(x) (x) + #define UINT32_C(x) (x##U) + #endif -#if (!defined(INT64_C) && !defined(UINT64_C)) -#define INT64_C(x) (x##LL) -#define UINT64_C(x) (x##ULL) -#endif + #if (!defined(INT64_C) && !defined(UINT64_C)) + #define INT64_C(x) (x##LL) + #define UINT64_C(x) (x##ULL) + #endif #endif /* __KERNEL__ */ /**\name CHIP ID ADDRESS*/ -#define BMA4_CHIP_ID_ADDR UINT8_C(0x00) +#define BMA4_CHIP_ID_ADDR UINT8_C(0x00) /**\name ERROR STATUS*/ -#define BMA4_ERROR_ADDR UINT8_C(0X02) +#define BMA4_ERROR_ADDR UINT8_C(0X02) /**\name STATUS REGISTER FOR SENSOR STATUS FLAG*/ -#define BMA4_STATUS_ADDR UINT8_C(0X03) +#define BMA4_STATUS_ADDR UINT8_C(0X03) /**\name AUX/ACCEL DATA BASE ADDRESS REGISTERS*/ -#define BMA4_DATA_0_ADDR UINT8_C(0X0A) -#define BMA4_DATA_8_ADDR UINT8_C(0X12) +#define BMA4_DATA_0_ADDR UINT8_C(0X0A) +#define BMA4_DATA_8_ADDR UINT8_C(0X12) /**\name SENSOR TIME REGISTERS*/ -#define BMA4_SENSORTIME_0_ADDR UINT8_C(0X18) +#define BMA4_SENSORTIME_0_ADDR UINT8_C(0X18) /**\name INTERRUPT/FEATURE STATUS REGISTERS*/ -#define BMA4_INT_STAT_0_ADDR UINT8_C(0X1C) +#define BMA4_INT_STAT_0_ADDR UINT8_C(0X1C) /**\name INTERRUPT/FEATURE STATUS REGISTERS*/ -#define BMA4_INT_STAT_1_ADDR UINT8_C(0X1D) +#define BMA4_INT_STAT_1_ADDR UINT8_C(0X1D) /**\name TEMPERATURE REGISTERS*/ -#define BMA4_TEMPERATURE_ADDR UINT8_C(0X22) +#define BMA4_TEMPERATURE_ADDR UINT8_C(0X22) /**\name FIFO REGISTERS*/ -#define BMA4_FIFO_LENGTH_0_ADDR UINT8_C(0X24) -#define BMA4_FIFO_DATA_ADDR UINT8_C(0X26) +#define BMA4_FIFO_LENGTH_0_ADDR UINT8_C(0X24) +#define BMA4_FIFO_DATA_ADDR UINT8_C(0X26) /**\name ACCEL CONFIG REGISTERS*/ -#define BMA4_ACCEL_CONFIG_ADDR UINT8_C(0X40) +#define BMA4_ACCEL_CONFIG_ADDR UINT8_C(0X40) /**\name ACCEL RANGE ADDRESS*/ -#define BMA4_ACCEL_RANGE_ADDR UINT8_C(0X41) +#define BMA4_ACCEL_RANGE_ADDR UINT8_C(0X41) /**\name AUX CONFIG REGISTERS*/ -#define BMA4_AUX_CONFIG_ADDR UINT8_C(0X44) +#define BMA4_AUX_CONFIG_ADDR UINT8_C(0X44) /**\name FIFO DOWN SAMPLING REGISTER ADDRESS FOR ACCEL*/ -#define BMA4_FIFO_DOWN_ADDR UINT8_C(0X45) +#define BMA4_FIFO_DOWN_ADDR UINT8_C(0X45) /**\name FIFO WATERMARK REGISTER ADDRESS*/ -#define BMA4_FIFO_WTM_0_ADDR UINT8_C(0X46) +#define BMA4_FIFO_WTM_0_ADDR UINT8_C(0X46) /**\name FIFO CONFIG REGISTERS*/ -#define BMA4_FIFO_CONFIG_0_ADDR UINT8_C(0X48) -#define BMA4_FIFO_CONFIG_1_ADDR UINT8_C(0X49) +#define BMA4_FIFO_CONFIG_0_ADDR UINT8_C(0X48) +#define BMA4_FIFO_CONFIG_1_ADDR UINT8_C(0X49) /**\name MAG INTERFACE REGISTERS*/ -#define BMA4_AUX_DEV_ID_ADDR UINT8_C(0X4B) -#define BMA4_AUX_IF_CONF_ADDR UINT8_C(0X4C) -#define BMA4_AUX_RD_ADDR UINT8_C(0X4D) -#define BMA4_AUX_WR_ADDR UINT8_C(0X4E) -#define BMA4_AUX_WR_DATA_ADDR UINT8_C(0X4F) +#define BMA4_AUX_DEV_ID_ADDR UINT8_C(0X4B) +#define BMA4_AUX_IF_CONF_ADDR UINT8_C(0X4C) +#define BMA4_AUX_RD_ADDR UINT8_C(0X4D) +#define BMA4_AUX_WR_ADDR UINT8_C(0X4E) +#define BMA4_AUX_WR_DATA_ADDR UINT8_C(0X4F) /**\name INTERRUPT ENABLE REGISTERS*/ -#define BMA4_INT1_IO_CTRL_ADDR UINT8_C(0X53) -#define BMA4_INT2_IO_CTRL_ADDR UINT8_C(0X54) +#define BMA4_INT1_IO_CTRL_ADDR UINT8_C(0X53) +#define BMA4_INT2_IO_CTRL_ADDR UINT8_C(0X54) /**\name LATCH DURATION REGISTERS*/ -#define BMA4_INTR_LATCH_ADDR UINT8_C(0X55) +#define BMA4_INTR_LATCH_ADDR UINT8_C(0X55) /**\name MAP INTERRUPT 1 and 2 REGISTERS*/ -#define BMA4_INT_MAP_1_ADDR UINT8_C(0X56) -#define BMA4_INT_MAP_2_ADDR UINT8_C(0X57) -#define BMA4_INT_MAP_DATA_ADDR UINT8_C(0x58) -#define BMA4_INIT_CTRL_ADDR UINT8_C(0x59) +#define BMA4_INT_MAP_1_ADDR UINT8_C(0X56) +#define BMA4_INT_MAP_2_ADDR UINT8_C(0X57) +#define BMA4_INT_MAP_DATA_ADDR UINT8_C(0x58) +#define BMA4_INIT_CTRL_ADDR UINT8_C(0x59) /**\name FEATURE CONFIG RELATED */ -#define BMA4_RESERVED_REG_5B_ADDR UINT8_C(0x5B) -#define BMA4_RESERVED_REG_5C_ADDR UINT8_C(0x5C) -#define BMA4_FEATURE_CONFIG_ADDR UINT8_C(0x5E) -#define BMA4_INTERNAL_ERROR UINT8_C(0x5F) +#define BMA4_RESERVED_REG_5B_ADDR UINT8_C(0x5B) +#define BMA4_RESERVED_REG_5C_ADDR UINT8_C(0x5C) +#define BMA4_FEATURE_CONFIG_ADDR UINT8_C(0x5E) +#define BMA4_INTERNAL_ERROR UINT8_C(0x5F) /**\name SERIAL INTERFACE SETTINGS REGISTER*/ -#define BMA4_IF_CONFIG_ADDR UINT8_C(0X6B) +#define BMA4_IF_CONFIG_ADDR UINT8_C(0X6B) /**\name SELF_TEST REGISTER*/ -#define BMA4_ACC_SELF_TEST_ADDR UINT8_C(0X6D) +#define BMA4_ACC_SELF_TEST_ADDR UINT8_C(0X6D) /**\name Macro to define accelerometer configuration value for FOC */ -#define BMA4_FOC_ACC_CONF_VAL UINT8_C(0xB7) +#define BMA4_FOC_ACC_CONF_VAL UINT8_C(0xB7) /**\name SPI,I2C SELECTION REGISTER*/ -#define BMA4_NV_CONFIG_ADDR UINT8_C(0x70) +#define BMA4_NV_CONFIG_ADDR UINT8_C(0x70) /**\name ACCEL OFFSET REGISTERS*/ -#define BMA4_OFFSET_0_ADDR UINT8_C(0X71) -#define BMA4_OFFSET_1_ADDR UINT8_C(0X72) -#define BMA4_OFFSET_2_ADDR UINT8_C(0X73) +#define BMA4_OFFSET_0_ADDR UINT8_C(0X71) +#define BMA4_OFFSET_1_ADDR UINT8_C(0X72) +#define BMA4_OFFSET_2_ADDR UINT8_C(0X73) /**\name POWER_CTRL REGISTER*/ -#define BMA4_POWER_CONF_ADDR UINT8_C(0x7C) -#define BMA4_POWER_CTRL_ADDR UINT8_C(0x7D) +#define BMA4_POWER_CONF_ADDR UINT8_C(0x7C) +#define BMA4_POWER_CTRL_ADDR UINT8_C(0x7D) /**\name COMMAND REGISTER*/ -#define BMA4_CMD_ADDR UINT8_C(0X7E) +#define BMA4_CMD_ADDR UINT8_C(0X7E) /**\name GPIO REGISTERS*/ -#define BMA4_STEP_CNT_OUT_0_ADDR UINT8_C(0x1E) -#define BMA4_HIGH_G_OUT_ADDR UINT8_C(0x1F) -#define BMA4_ACTIVITY_OUT_ADDR UINT8_C(0x27) -#define BMA4_ORIENTATION_OUT_ADDR UINT8_C(0x28) -#define BMA4_INTERNAL_STAT UINT8_C(0x2A) +#define BMA4_STEP_CNT_OUT_0_ADDR UINT8_C(0x1E) +#define BMA4_HIGH_G_OUT_ADDR UINT8_C(0x1F) +#define BMA4_ACTIVITY_OUT_ADDR UINT8_C(0x27) +#define BMA4_ORIENTATION_OUT_ADDR UINT8_C(0x28) +#define BMA4_INTERNAL_STAT UINT8_C(0x2A) /*! * @brief Block size for config write */ -#define BMA4_BLOCK_SIZE UINT8_C(32) +#define BMA4_BLOCK_SIZE UINT8_C(32) /**\name I2C slave address */ -#define BMA4_I2C_ADDR_PRIMARY UINT8_C(0x18) -#define BMA4_I2C_ADDR_SECONDARY UINT8_C(0x19) -#define BMA4_I2C_BMM150_ADDR UINT8_C(0x10) +#define BMA4_I2C_ADDR_PRIMARY UINT8_C(0x18) +#define BMA4_I2C_ADDR_SECONDARY UINT8_C(0x19) +#define BMA4_I2C_BMM150_ADDR UINT8_C(0x10) /**\name Interface selection macro */ -#define BMA4_SPI_WR_MASK UINT8_C(0x7F) -#define BMA4_SPI_RD_MASK UINT8_C(0x80) +#define BMA4_SPI_WR_MASK UINT8_C(0x7F) +#define BMA4_SPI_RD_MASK UINT8_C(0x80) /**\name Chip ID macros */ -#define BMA4_CHIP_ID_MIN UINT8_C(0x10) -#define BMA4_CHIP_ID_MAX UINT8_C(0x15) +#define BMA4_CHIP_ID_MIN UINT8_C(0x10) +#define BMA4_CHIP_ID_MAX UINT8_C(0x15) /**\name Auxiliary sensor selection macro */ -#define BMM150_SENSOR UINT8_C(1) -#define AKM9916_SENSOR UINT8_C(2) -#define BMA4_ASIC_INITIALIZED UINT8_C(0x01) +#define BMM150_SENSOR UINT8_C(1) +#define AKM9916_SENSOR UINT8_C(2) +#define BMA4_ASIC_INITIALIZED UINT8_C(0x01) /**\name Auxiliary sensor chip id macros */ -#define BMM150_CHIP_ID UINT8_C(0x32) +#define BMM150_CHIP_ID UINT8_C(0x32) /**\name Auxiliary sensor other macros */ -#define BMM150_POWER_CONTROL_REG UINT8_C(0x4B) -#define BMM150_POWER_MODE_REG UINT8_C(0x4C) +#define BMM150_POWER_CONTROL_REG UINT8_C(0x4B) +#define BMM150_POWER_MODE_REG UINT8_C(0x4C) /**\name CONSTANTS */ -#define BMA4_FIFO_CONFIG_LENGTH UINT8_C(2) -#define BMA4_ACCEL_CONFIG_LENGTH UINT8_C(2) -#define BMA4_FIFO_WM_LENGTH UINT8_C(2) -#define BMA4_NON_LATCH_MODE UINT8_C(0) -#define BMA4_LATCH_MODE UINT8_C(1) -#define BMA4_OPEN_DRAIN UINT8_C(1) -#define BMA4_PUSH_PULL UINT8_C(0) -#define BMA4_ACTIVE_HIGH UINT8_C(1) -#define BMA4_ACTIVE_LOW UINT8_C(0) -#define BMA4_EDGE_TRIGGER UINT8_C(1) -#define BMA4_LEVEL_TRIGGER UINT8_C(0) -#define BMA4_OUTPUT_ENABLE UINT8_C(1) -#define BMA4_OUTPUT_DISABLE UINT8_C(0) -#define BMA4_INPUT_ENABLE UINT8_C(1) -#define BMA4_INPUT_DISABLE UINT8_C(0) +#define BMA4_FIFO_CONFIG_LENGTH UINT8_C(2) +#define BMA4_ACCEL_CONFIG_LENGTH UINT8_C(2) +#define BMA4_FIFO_WM_LENGTH UINT8_C(2) +#define BMA4_NON_LATCH_MODE UINT8_C(0) +#define BMA4_LATCH_MODE UINT8_C(1) +#define BMA4_OPEN_DRAIN UINT8_C(1) +#define BMA4_PUSH_PULL UINT8_C(0) +#define BMA4_ACTIVE_HIGH UINT8_C(1) +#define BMA4_ACTIVE_LOW UINT8_C(0) +#define BMA4_EDGE_TRIGGER UINT8_C(1) +#define BMA4_LEVEL_TRIGGER UINT8_C(0) +#define BMA4_OUTPUT_ENABLE UINT8_C(1) +#define BMA4_OUTPUT_DISABLE UINT8_C(0) +#define BMA4_INPUT_ENABLE UINT8_C(1) +#define BMA4_INPUT_DISABLE UINT8_C(0) /**\name ACCEL RANGE CHECK*/ -#define BMA4_ACCEL_RANGE_2G UINT8_C(0) -#define BMA4_ACCEL_RANGE_4G UINT8_C(1) -#define BMA4_ACCEL_RANGE_8G UINT8_C(2) -#define BMA4_ACCEL_RANGE_16G UINT8_C(3) +#define BMA4_ACCEL_RANGE_2G UINT8_C(0) +#define BMA4_ACCEL_RANGE_4G UINT8_C(1) +#define BMA4_ACCEL_RANGE_8G UINT8_C(2) +#define BMA4_ACCEL_RANGE_16G UINT8_C(3) /**\name CONDITION CHECK FOR READING AND WRITING DATA*/ -#define BMA4_MAX_VALUE_FIFO_FILTER UINT8_C(1) -#define BMA4_MAX_VALUE_SPI3 UINT8_C(1) -#define BMA4_MAX_VALUE_SELFTEST_AMP UINT8_C(1) -#define BMA4_MAX_IF_MODE UINT8_C(3) -#define BMA4_MAX_VALUE_SELFTEST_SIGN UINT8_C(1) +#define BMA4_MAX_VALUE_FIFO_FILTER UINT8_C(1) +#define BMA4_MAX_VALUE_SPI3 UINT8_C(1) +#define BMA4_MAX_VALUE_SELFTEST_AMP UINT8_C(1) +#define BMA4_MAX_IF_MODE UINT8_C(3) +#define BMA4_MAX_VALUE_SELFTEST_SIGN UINT8_C(1) /**\name BUS READ AND WRITE LENGTH FOR MAG & ACCEL*/ -#define BMA4_MAG_TRIM_DATA_SIZE UINT8_C(16) -#define BMA4_MAG_XYZ_DATA_LENGTH UINT8_C(6) -#define BMA4_MAG_XYZR_DATA_LENGTH UINT8_C(8) -#define BMA4_ACCEL_DATA_LENGTH UINT8_C(6) -#define BMA4_FIFO_DATA_LENGTH UINT8_C(2) -#define BMA4_TEMP_DATA_SIZE UINT8_C(1) +#define BMA4_MAG_TRIM_DATA_SIZE UINT8_C(16) +#define BMA4_MAG_XYZ_DATA_LENGTH UINT8_C(6) +#define BMA4_MAG_XYZR_DATA_LENGTH UINT8_C(8) +#define BMA4_ACCEL_DATA_LENGTH UINT8_C(6) +#define BMA4_FIFO_DATA_LENGTH UINT8_C(2) +#define BMA4_TEMP_DATA_SIZE UINT8_C(1) /**\name TEMPERATURE CONSTANT */ -#define BMA4_OFFSET_TEMP UINT8_C(23) -#define BMA4_DEG UINT8_C(1) -#define BMA4_FAHREN UINT8_C(2) -#define BMA4_KELVIN UINT8_C(3) +#define BMA4_OFFSET_TEMP UINT8_C(23) +#define BMA4_DEG UINT8_C(1) +#define BMA4_FAHREN UINT8_C(2) +#define BMA4_KELVIN UINT8_C(3) /**\name DELAY DEFINITION IN MSEC*/ -#define BMA4_AUX_IF_DELAY UINT8_C(5) -#define BMA4_BMM150_WAKEUP_DELAY1 UINT8_C(2) -#define BMA4_BMM150_WAKEUP_DELAY2 UINT8_C(3) -#define BMA4_BMM150_WAKEUP_DELAY3 UINT8_C(1) -#define BMA4_GEN_READ_WRITE_DELAY UINT16_C(1000) -#define BMA4_AUX_COM_DELAY UINT16_C(10000) +#define BMA4_AUX_IF_DELAY UINT8_C(5) +#define BMA4_BMM150_WAKEUP_DELAY1 UINT8_C(2) +#define BMA4_BMM150_WAKEUP_DELAY2 UINT8_C(3) +#define BMA4_BMM150_WAKEUP_DELAY3 UINT8_C(1) +#define BMA4_GEN_READ_WRITE_DELAY UINT16_C(1000) +#define BMA4_AUX_COM_DELAY UINT16_C(10000) /**\name ARRAY PARAMETER DEFINITIONS*/ -#define BMA4_SENSOR_TIME_MSB_BYTE UINT8_C(2) -#define BMA4_SENSOR_TIME_XLSB_BYTE UINT8_C(1) -#define BMA4_SENSOR_TIME_LSB_BYTE UINT8_C(0) -#define BMA4_MAG_X_LSB_BYTE UINT8_C(0) -#define BMA4_MAG_X_MSB_BYTE UINT8_C(1) -#define BMA4_MAG_Y_LSB_BYTE UINT8_C(2) -#define BMA4_MAG_Y_MSB_BYTE UINT8_C(3) -#define BMA4_MAG_Z_LSB_BYTE UINT8_C(4) -#define BMA4_MAG_Z_MSB_BYTE UINT8_C(5) -#define BMA4_MAG_R_LSB_BYTE UINT8_C(6) -#define BMA4_MAG_R_MSB_BYTE UINT8_C(7) -#define BMA4_TEMP_BYTE UINT8_C(0) -#define BMA4_FIFO_LENGTH_MSB_BYTE UINT8_C(1) +#define BMA4_SENSOR_TIME_MSB_BYTE UINT8_C(2) +#define BMA4_SENSOR_TIME_XLSB_BYTE UINT8_C(1) +#define BMA4_SENSOR_TIME_LSB_BYTE UINT8_C(0) +#define BMA4_MAG_X_LSB_BYTE UINT8_C(0) +#define BMA4_MAG_X_MSB_BYTE UINT8_C(1) +#define BMA4_MAG_Y_LSB_BYTE UINT8_C(2) +#define BMA4_MAG_Y_MSB_BYTE UINT8_C(3) +#define BMA4_MAG_Z_LSB_BYTE UINT8_C(4) +#define BMA4_MAG_Z_MSB_BYTE UINT8_C(5) +#define BMA4_MAG_R_LSB_BYTE UINT8_C(6) +#define BMA4_MAG_R_MSB_BYTE UINT8_C(7) +#define BMA4_TEMP_BYTE UINT8_C(0) +#define BMA4_FIFO_LENGTH_MSB_BYTE UINT8_C(1) /*! @name To define success code */ -#define BMA4_OK INT8_C(0) +#define BMA4_OK INT8_C(0) /*! @name To define error codes */ -#define BMA4_E_NULL_PTR INT8_C(-1) -#define BMA4_E_COM_FAIL INT8_C(-2) -#define BMA4_E_DEV_NOT_FOUND INT8_C(-3) -#define BMA4_E_INVALID_SENSOR INT8_C(-4) -#define BMA4_E_CONFIG_STREAM_ERROR INT8_C(-5) -#define BMA4_E_SELF_TEST_FAIL INT8_C(-6) -#define BMA4_E_FOC_FAIL INT8_C(-7) -#define BMA4_E_OUT_OF_RANGE INT8_C(-8) -#define BMA4_E_INT_LINE_INVALID INT8_C(-9) -#define BMA4_E_RD_WR_LENGTH_INVALID INT8_C(-10) -#define BMA4_E_AUX_CONFIG_FAIL INT8_C(-11) -#define BMA4_E_SC_FIFO_HEADER_ERR INT8_C(-12) -#define BMA4_E_SC_FIFO_CONFIG_ERR INT8_C(-13) +#define BMA4_E_NULL_PTR INT8_C(-1) +#define BMA4_E_COM_FAIL INT8_C(-2) +#define BMA4_E_DEV_NOT_FOUND INT8_C(-3) +#define BMA4_E_INVALID_SENSOR INT8_C(-4) +#define BMA4_E_CONFIG_STREAM_ERROR INT8_C(-5) +#define BMA4_E_SELF_TEST_FAIL INT8_C(-6) +#define BMA4_E_FOC_FAIL INT8_C(-7) +#define BMA4_E_OUT_OF_RANGE INT8_C(-8) +#define BMA4_E_INT_LINE_INVALID INT8_C(-9) +#define BMA4_E_RD_WR_LENGTH_INVALID INT8_C(-10) +#define BMA4_E_AUX_CONFIG_FAIL INT8_C(-11) +#define BMA4_E_SC_FIFO_HEADER_ERR INT8_C(-12) +#define BMA4_E_SC_FIFO_CONFIG_ERR INT8_C(-13) /**\name UTILITY MACROS */ -#define BMA4_SET_LOW_BYTE UINT16_C(0x00FF) -#define BMA4_SET_HIGH_BYTE UINT16_C(0xFF00) -#define BMA4_SET_LOW_NIBBLE UINT8_C(0x0F) +#define BMA4_SET_LOW_BYTE UINT16_C(0x00FF) +#define BMA4_SET_HIGH_BYTE UINT16_C(0xFF00) +#define BMA4_SET_LOW_NIBBLE UINT8_C(0x0F) /* Macros used for Self test (BMA42X_VARIANT) */ /* Self-test: Resulting minimum difference signal in mg for BMA42X */ -#define BMA42X_ST_ACC_X_AXIS_SIGNAL_DIFF UINT16_C(400) -#define BMA42X_ST_ACC_Y_AXIS_SIGNAL_DIFF UINT16_C(800) -#define BMA42X_ST_ACC_Z_AXIS_SIGNAL_DIFF UINT16_C(400) +#define BMA42X_ST_ACC_X_AXIS_SIGNAL_DIFF UINT16_C(400) +#define BMA42X_ST_ACC_Y_AXIS_SIGNAL_DIFF UINT16_C(800) +#define BMA42X_ST_ACC_Z_AXIS_SIGNAL_DIFF UINT16_C(400) /* Macros used for Self test (BMA42X_B_VARIANT) */ /* Self-test: Resulting minimum difference signal in mg for BMA42X_B */ -#define BMA42X_B_ST_ACC_X_AXIS_SIGNAL_DIFF UINT16_C(1800) -#define BMA42X_B_ST_ACC_Y_AXIS_SIGNAL_DIFF UINT16_C(1800) -#define BMA42X_B_ST_ACC_Z_AXIS_SIGNAL_DIFF UINT16_C(1800) +#define BMA42X_B_ST_ACC_X_AXIS_SIGNAL_DIFF UINT16_C(1800) +#define BMA42X_B_ST_ACC_Y_AXIS_SIGNAL_DIFF UINT16_C(1800) +#define BMA42X_B_ST_ACC_Z_AXIS_SIGNAL_DIFF UINT16_C(1800) /* Macros used for Self test (BMA45X_VARIANT) */ /* Self-test: Resulting minimum difference signal in mg for BMA45X */ -#define BMA45X_ST_ACC_X_AXIS_SIGNAL_DIFF UINT16_C(1800) -#define BMA45X_ST_ACC_Y_AXIS_SIGNAL_DIFF UINT16_C(1800) -#define BMA45X_ST_ACC_Z_AXIS_SIGNAL_DIFF UINT16_C(1800) +#define BMA45X_ST_ACC_X_AXIS_SIGNAL_DIFF UINT16_C(1800) +#define BMA45X_ST_ACC_Y_AXIS_SIGNAL_DIFF UINT16_C(1800) +#define BMA45X_ST_ACC_Z_AXIS_SIGNAL_DIFF UINT16_C(1800) /**\name BOOLEAN TYPES*/ #ifndef TRUE -#define TRUE UINT8_C(0x01) + #define TRUE UINT8_C(0x01) #endif #ifndef FALSE -#define FALSE UINT8_C(0x00) + #define FALSE UINT8_C(0x00) #endif #ifndef NULL -#define NULL UINT8_C(0x00) + #define NULL UINT8_C(0x00) #endif /**\name ERROR STATUS POSITION AND MASK*/ -#define BMA4_FATAL_ERR_MSK UINT8_C(0x01) -#define BMA4_CMD_ERR_POS UINT8_C(1) -#define BMA4_CMD_ERR_MSK UINT8_C(0x02) -#define BMA4_ERR_CODE_POS UINT8_C(2) -#define BMA4_ERR_CODE_MSK UINT8_C(0x1C) -#define BMA4_FIFO_ERR_POS UINT8_C(6) -#define BMA4_FIFO_ERR_MSK UINT8_C(0x40) -#define BMA4_AUX_ERR_POS UINT8_C(7) -#define BMA4_AUX_ERR_MSK UINT8_C(0x80) +#define BMA4_FATAL_ERR_MSK UINT8_C(0x01) +#define BMA4_CMD_ERR_POS UINT8_C(1) +#define BMA4_CMD_ERR_MSK UINT8_C(0x02) +#define BMA4_ERR_CODE_POS UINT8_C(2) +#define BMA4_ERR_CODE_MSK UINT8_C(0x1C) +#define BMA4_FIFO_ERR_POS UINT8_C(6) +#define BMA4_FIFO_ERR_MSK UINT8_C(0x40) +#define BMA4_AUX_ERR_POS UINT8_C(7) +#define BMA4_AUX_ERR_MSK UINT8_C(0x80) /**\name NV_CONFIG POSITION AND MASK*/ /* NV_CONF Description - Reg Addr --> (0x70), Bit --> 3 */ -#define BMA4_NV_ACCEL_OFFSET_POS UINT8_C(3) -#define BMA4_NV_ACCEL_OFFSET_MSK UINT8_C(0x08) +#define BMA4_NV_ACCEL_OFFSET_POS UINT8_C(3) +#define BMA4_NV_ACCEL_OFFSET_MSK UINT8_C(0x08) /**\name MAG DATA XYZ POSITION AND MASK*/ -#define BMA4_DATA_MAG_X_LSB_POS UINT8_C(3) -#define BMA4_DATA_MAG_X_LSB_MSK UINT8_C(0xF8) -#define BMA4_DATA_MAG_Y_LSB_POS UINT8_C(3) -#define BMA4_DATA_MAG_Y_LSB_MSK UINT8_C(0xF8) -#define BMA4_DATA_MAG_Z_LSB_POS UINT8_C(1) -#define BMA4_DATA_MAG_Z_LSB_MSK UINT8_C(0xFE) -#define BMA4_DATA_MAG_R_LSB_POS UINT8_C(2) -#define BMA4_DATA_MAG_R_LSB_MSK UINT8_C(0xFC) +#define BMA4_DATA_MAG_X_LSB_POS UINT8_C(3) +#define BMA4_DATA_MAG_X_LSB_MSK UINT8_C(0xF8) +#define BMA4_DATA_MAG_Y_LSB_POS UINT8_C(3) +#define BMA4_DATA_MAG_Y_LSB_MSK UINT8_C(0xF8) +#define BMA4_DATA_MAG_Z_LSB_POS UINT8_C(1) +#define BMA4_DATA_MAG_Z_LSB_MSK UINT8_C(0xFE) +#define BMA4_DATA_MAG_R_LSB_POS UINT8_C(2) +#define BMA4_DATA_MAG_R_LSB_MSK UINT8_C(0xFC) /**\name ACCEL DATA READY POSITION AND MASK*/ -#define BMA4_STAT_DATA_RDY_ACCEL_POS UINT8_C(7) -#define BMA4_STAT_DATA_RDY_ACCEL_MSK UINT8_C(0x80) +#define BMA4_STAT_DATA_RDY_ACCEL_POS UINT8_C(7) +#define BMA4_STAT_DATA_RDY_ACCEL_MSK UINT8_C(0x80) /**\name MAG DATA READY POSITION AND MASK*/ -#define BMA4_STAT_DATA_RDY_MAG_POS UINT8_C(5) -#define BMA4_STAT_DATA_RDY_MAG_MSK UINT8_C(0x20) +#define BMA4_STAT_DATA_RDY_MAG_POS UINT8_C(5) +#define BMA4_STAT_DATA_RDY_MAG_MSK UINT8_C(0x20) /**\name ADVANCE POWER SAVE POSITION AND MASK*/ -#define BMA4_ADVANCE_POWER_SAVE_MSK UINT8_C(0x01) +#define BMA4_ADVANCE_POWER_SAVE_MSK UINT8_C(0x01) /**\name ACCELEROMETER ENABLE POSITION AND MASK*/ -#define BMA4_ACCEL_ENABLE_POS UINT8_C(2) -#define BMA4_ACCEL_ENABLE_MSK UINT8_C(0x04) +#define BMA4_ACCEL_ENABLE_POS UINT8_C(2) +#define BMA4_ACCEL_ENABLE_MSK UINT8_C(0x04) /**\name MAGNETOMETER ENABLE POSITION AND MASK*/ -#define BMA4_MAG_ENABLE_MSK UINT8_C(0x01) +#define BMA4_MAG_ENABLE_MSK UINT8_C(0x01) /**\name ACCEL CONFIGURATION POSITION AND MASK*/ -#define BMA4_ACCEL_ODR_MSK UINT8_C(0x0F) -#define BMA4_ACCEL_BW_POS UINT8_C(4) -#define BMA4_ACCEL_BW_MSK UINT8_C(0x70) -#define BMA4_ACCEL_RANGE_MSK UINT8_C(0x03) -#define BMA4_ACCEL_PERFMODE_POS UINT8_C(7) -#define BMA4_ACCEL_PERFMODE_MSK UINT8_C(0x80) +#define BMA4_ACCEL_ODR_MSK UINT8_C(0x0F) +#define BMA4_ACCEL_BW_POS UINT8_C(4) +#define BMA4_ACCEL_BW_MSK UINT8_C(0x70) +#define BMA4_ACCEL_RANGE_MSK UINT8_C(0x03) +#define BMA4_ACCEL_PERFMODE_POS UINT8_C(7) +#define BMA4_ACCEL_PERFMODE_MSK UINT8_C(0x80) /**\name MAG CONFIGURATION POSITION AND MASK*/ -#define BMA4_MAG_CONFIG_OFFSET_POS UINT8_C(4) -#define BMA4_MAG_CONFIG_OFFSET_LEN UINT8_C(4) -#define BMA4_MAG_CONFIG_OFFSET_MSK UINT8_C(0xF0) -#define BMA4_MAG_CONFIG_OFFSET_REG (BMA4_AUX_CONFIG_ADDR) +#define BMA4_MAG_CONFIG_OFFSET_POS UINT8_C(4) +#define BMA4_MAG_CONFIG_OFFSET_LEN UINT8_C(4) +#define BMA4_MAG_CONFIG_OFFSET_MSK UINT8_C(0xF0) +#define BMA4_MAG_CONFIG_OFFSET_REG (BMA4_AUX_CONFIG_ADDR) /**\name FIFO SELF WAKE UP POSITION AND MASK*/ -#define BMA4_FIFO_SELF_WAKE_UP_POS UINT8_C(1) -#define BMA4_FIFO_SELF_WAKE_UP_MSK UINT8_C(0x02) +#define BMA4_FIFO_SELF_WAKE_UP_POS UINT8_C(1) +#define BMA4_FIFO_SELF_WAKE_UP_MSK UINT8_C(0x02) /**\name FIFO BYTE COUNTER POSITION AND MASK*/ -#define BMA4_FIFO_BYTE_COUNTER_MSB_MSK UINT8_C(0x3F) +#define BMA4_FIFO_BYTE_COUNTER_MSB_MSK UINT8_C(0x3F) /**\name FIFO DATA POSITION AND MASK*/ -#define BMA4_FIFO_DATA_POS UINT8_C(0) -#define BMA4_FIFO_DATA_MSK UINT8_C(0xFF) +#define BMA4_FIFO_DATA_POS UINT8_C(0) +#define BMA4_FIFO_DATA_MSK UINT8_C(0xFF) /**\name FIFO FILTER FOR ACCEL POSITION AND MASK*/ -#define BMA4_FIFO_DOWN_ACCEL_POS UINT8_C(4) -#define BMA4_FIFO_DOWN_ACCEL_MSK UINT8_C(0x70) -#define BMA4_FIFO_FILTER_ACCEL_POS UINT8_C(7) -#define BMA4_FIFO_FILTER_ACCEL_MSK UINT8_C(0x80) +#define BMA4_FIFO_DOWN_ACCEL_POS UINT8_C(4) +#define BMA4_FIFO_DOWN_ACCEL_MSK UINT8_C(0x70) +#define BMA4_FIFO_FILTER_ACCEL_POS UINT8_C(7) +#define BMA4_FIFO_FILTER_ACCEL_MSK UINT8_C(0x80) /**\name FIFO HEADER DATA DEFINITIONS */ -#define BMA4_FIFO_HEAD_A UINT8_C(0x84) -#define BMA4_FIFO_HEAD_M UINT8_C(0x90) -#define BMA4_FIFO_HEAD_M_A UINT8_C(0x94) -#define BMA4_FIFO_HEAD_SENSOR_TIME UINT8_C(0x44) -#define BMA4_FIFO_HEAD_INPUT_CONFIG UINT8_C(0x48) -#define BMA4_FIFO_HEAD_SKIP_FRAME UINT8_C(0x40) -#define BMA4_FIFO_HEAD_OVER_READ_MSB UINT8_C(0x80) -#define BMA4_FIFO_HEAD_SAMPLE_DROP UINT8_C(0x50) +#define BMA4_FIFO_HEAD_A UINT8_C(0x84) +#define BMA4_FIFO_HEAD_M UINT8_C(0x90) +#define BMA4_FIFO_HEAD_M_A UINT8_C(0x94) +#define BMA4_FIFO_HEAD_SENSOR_TIME UINT8_C(0x44) +#define BMA4_FIFO_HEAD_INPUT_CONFIG UINT8_C(0x48) +#define BMA4_FIFO_HEAD_SKIP_FRAME UINT8_C(0x40) +#define BMA4_FIFO_HEAD_OVER_READ_MSB UINT8_C(0x80) +#define BMA4_FIFO_HEAD_SAMPLE_DROP UINT8_C(0x50) /**\name FIFO HEADERLESS MODE DATA ENABLE DEFINITIONS */ -#define BMA4_FIFO_M_A_ENABLE UINT8_C(0x60) -#define BMA4_FIFO_A_ENABLE UINT8_C(0x40) -#define BMA4_FIFO_M_ENABLE UINT8_C(0x20) +#define BMA4_FIFO_M_A_ENABLE UINT8_C(0x60) +#define BMA4_FIFO_A_ENABLE UINT8_C(0x40) +#define BMA4_FIFO_M_ENABLE UINT8_C(0x20) /**\name FIFO CONFIGURATION SELECTION */ -#define BMA4_FIFO_STOP_ON_FULL UINT8_C(0x01) -#define BMA4_FIFO_TIME UINT8_C(0x02) -#define BMA4_FIFO_TAG_INTR2 UINT8_C(0x04) -#define BMA4_FIFO_TAG_INTR1 UINT8_C(0x08) -#define BMA4_FIFO_HEADER UINT8_C(0x10) -#define BMA4_FIFO_MAG UINT8_C(0x20) -#define BMA4_FIFO_ACCEL UINT8_C(0x40) -#define BMA4_FIFO_ALL UINT8_C(0x7F) -#define BMA4_FIFO_CONFIG_0_MASK UINT8_C(0x03) -#define BMA4_FIFO_CONFIG_1_MASK UINT8_C(0xFC) +#define BMA4_FIFO_STOP_ON_FULL UINT8_C(0x01) +#define BMA4_FIFO_TIME UINT8_C(0x02) +#define BMA4_FIFO_TAG_INTR2 UINT8_C(0x04) +#define BMA4_FIFO_TAG_INTR1 UINT8_C(0x08) +#define BMA4_FIFO_HEADER UINT8_C(0x10) +#define BMA4_FIFO_MAG UINT8_C(0x20) +#define BMA4_FIFO_ACCEL UINT8_C(0x40) +#define BMA4_FIFO_ALL UINT8_C(0x7F) +#define BMA4_FIFO_CONFIG_0_MASK UINT8_C(0x03) +#define BMA4_FIFO_CONFIG_1_MASK UINT8_C(0xFC) /**\name FIFO FRAME COUNT DEFINITION */ -#define BMA4_FIFO_LSB_CONFIG_CHECK UINT8_C(0x00) -#define BMA4_FIFO_MSB_CONFIG_CHECK UINT8_C(0x80) -#define BMA4_FIFO_TAG_INTR_MASK UINT8_C(0xFC) +#define BMA4_FIFO_LSB_CONFIG_CHECK UINT8_C(0x00) +#define BMA4_FIFO_MSB_CONFIG_CHECK UINT8_C(0x80) +#define BMA4_FIFO_TAG_INTR_MASK UINT8_C(0xFC) /**\name FIFO DROPPED FRAME DEFINITION */ -#define BMA4_AUX_FIFO_DROP UINT8_C(0x04) -#define BMA4_ACCEL_AUX_FIFO_DROP UINT8_C(0x05) -#define BMA4_ACCEL_FIFO_DROP UINT8_C(0x01) +#define BMA4_AUX_FIFO_DROP UINT8_C(0x04) +#define BMA4_ACCEL_AUX_FIFO_DROP UINT8_C(0x05) +#define BMA4_ACCEL_FIFO_DROP UINT8_C(0x01) /**\name FIFO MAG DEFINITION*/ -#define BMA4_MA_FIFO_A_X_LSB UINT8_C(8) +#define BMA4_MA_FIFO_A_X_LSB UINT8_C(8) /**\name FIFO sensor time length definitions*/ -#define BMA4_SENSOR_TIME_LENGTH UINT8_C(3) +#define BMA4_SENSOR_TIME_LENGTH UINT8_C(3) /**\name FIFO LENGTH DEFINITION*/ -#define BMA4_FIFO_A_LENGTH UINT8_C(6) -#define BMA4_FIFO_M_LENGTH UINT8_C(8) -#define BMA4_FIFO_MA_LENGTH UINT8_C(14) +#define BMA4_FIFO_A_LENGTH UINT8_C(6) +#define BMA4_FIFO_M_LENGTH UINT8_C(8) +#define BMA4_FIFO_MA_LENGTH UINT8_C(14) /**\name MAG I2C ADDRESS SELECTION POSITION AND MASK*/ -#define BMA4_I2C_DEVICE_ADDR_POS UINT8_C(1) -#define BMA4_I2C_DEVICE_ADDR_MSK UINT8_C(0xFE) +#define BMA4_I2C_DEVICE_ADDR_POS UINT8_C(1) +#define BMA4_I2C_DEVICE_ADDR_MSK UINT8_C(0xFE) /**\name MAG CONFIGURATION FOR SECONDARY INTERFACE POSITION AND MASK*/ -#define BMA4_MAG_BURST_MSK UINT8_C(0x03) -#define BMA4_MAG_MANUAL_ENABLE_POS UINT8_C(7) -#define BMA4_MAG_MANUAL_ENABLE_MSK UINT8_C(0x80) -#define BMA4_READ_ADDR_MSK UINT8_C(0xFF) -#define BMA4_WRITE_ADDR_MSK UINT8_C(0xFF) -#define BMA4_WRITE_DATA_MSK UINT8_C(0xFF) +#define BMA4_MAG_BURST_MSK UINT8_C(0x03) +#define BMA4_MAG_MANUAL_ENABLE_POS UINT8_C(7) +#define BMA4_MAG_MANUAL_ENABLE_MSK UINT8_C(0x80) +#define BMA4_READ_ADDR_MSK UINT8_C(0xFF) +#define BMA4_WRITE_ADDR_MSK UINT8_C(0xFF) +#define BMA4_WRITE_DATA_MSK UINT8_C(0xFF) /**\name OUTPUT TYPE ENABLE POSITION AND MASK*/ -#define BMA4_INT_EDGE_CTRL_MASK UINT8_C(0x01) -#define BMA4_INT_EDGE_CTRL_POS UINT8_C(0x00) -#define BMA4_INT_LEVEL_MASK UINT8_C(0x02) -#define BMA4_INT_LEVEL_POS UINT8_C(0x01) -#define BMA4_INT_OPEN_DRAIN_MASK UINT8_C(0x04) -#define BMA4_INT_OPEN_DRAIN_POS UINT8_C(0x02) -#define BMA4_INT_OUTPUT_EN_MASK UINT8_C(0x08) -#define BMA4_INT_OUTPUT_EN_POS UINT8_C(0x03) -#define BMA4_INT_INPUT_EN_MASK UINT8_C(0x10) -#define BMA4_INT_INPUT_EN_POS UINT8_C(0x04) +#define BMA4_INT_EDGE_CTRL_MASK UINT8_C(0x01) +#define BMA4_INT_EDGE_CTRL_POS UINT8_C(0x00) +#define BMA4_INT_LEVEL_MASK UINT8_C(0x02) +#define BMA4_INT_LEVEL_POS UINT8_C(0x01) +#define BMA4_INT_OPEN_DRAIN_MASK UINT8_C(0x04) +#define BMA4_INT_OPEN_DRAIN_POS UINT8_C(0x02) +#define BMA4_INT_OUTPUT_EN_MASK UINT8_C(0x08) +#define BMA4_INT_OUTPUT_EN_POS UINT8_C(0x03) +#define BMA4_INT_INPUT_EN_MASK UINT8_C(0x10) +#define BMA4_INT_INPUT_EN_POS UINT8_C(0x04) /**\name IF CONFIG POSITION AND MASK*/ -#define BMA4_CONFIG_SPI3_MSK UINT8_C(0x01) -#define BMA4_IF_CONFIG_IF_MODE_POS UINT8_C(4) -#define BMA4_IF_CONFIG_IF_MODE_MSK UINT8_C(0x10) +#define BMA4_CONFIG_SPI3_MSK UINT8_C(0x01) +#define BMA4_IF_CONFIG_IF_MODE_POS UINT8_C(4) +#define BMA4_IF_CONFIG_IF_MODE_MSK UINT8_C(0x10) /**\name ACCEL SELF TEST POSITION AND MASK*/ -#define BMA4_ACCEL_SELFTEST_ENABLE_MSK UINT8_C(0x01) -#define BMA4_ACCEL_SELFTEST_SIGN_POS UINT8_C(2) -#define BMA4_ACCEL_SELFTEST_SIGN_MSK UINT8_C(0x04) -#define BMA4_SELFTEST_AMP_POS UINT8_C(3) -#define BMA4_SELFTEST_AMP_MSK UINT8_C(0x08) +#define BMA4_ACCEL_SELFTEST_ENABLE_MSK UINT8_C(0x01) +#define BMA4_ACCEL_SELFTEST_SIGN_POS UINT8_C(2) +#define BMA4_ACCEL_SELFTEST_SIGN_MSK UINT8_C(0x04) +#define BMA4_SELFTEST_AMP_POS UINT8_C(3) +#define BMA4_SELFTEST_AMP_MSK UINT8_C(0x08) /**\name ACCEL ODR */ -#define BMA4_OUTPUT_DATA_RATE_0_78HZ UINT8_C(0x01) -#define BMA4_OUTPUT_DATA_RATE_1_56HZ UINT8_C(0x02) -#define BMA4_OUTPUT_DATA_RATE_3_12HZ UINT8_C(0x03) -#define BMA4_OUTPUT_DATA_RATE_6_25HZ UINT8_C(0x04) -#define BMA4_OUTPUT_DATA_RATE_12_5HZ UINT8_C(0x05) -#define BMA4_OUTPUT_DATA_RATE_25HZ UINT8_C(0x06) -#define BMA4_OUTPUT_DATA_RATE_50HZ UINT8_C(0x07) -#define BMA4_OUTPUT_DATA_RATE_100HZ UINT8_C(0x08) -#define BMA4_OUTPUT_DATA_RATE_200HZ UINT8_C(0x09) -#define BMA4_OUTPUT_DATA_RATE_400HZ UINT8_C(0x0A) -#define BMA4_OUTPUT_DATA_RATE_800HZ UINT8_C(0x0B) -#define BMA4_OUTPUT_DATA_RATE_1600HZ UINT8_C(0x0C) +#define BMA4_OUTPUT_DATA_RATE_0_78HZ UINT8_C(0x01) +#define BMA4_OUTPUT_DATA_RATE_1_56HZ UINT8_C(0x02) +#define BMA4_OUTPUT_DATA_RATE_3_12HZ UINT8_C(0x03) +#define BMA4_OUTPUT_DATA_RATE_6_25HZ UINT8_C(0x04) +#define BMA4_OUTPUT_DATA_RATE_12_5HZ UINT8_C(0x05) +#define BMA4_OUTPUT_DATA_RATE_25HZ UINT8_C(0x06) +#define BMA4_OUTPUT_DATA_RATE_50HZ UINT8_C(0x07) +#define BMA4_OUTPUT_DATA_RATE_100HZ UINT8_C(0x08) +#define BMA4_OUTPUT_DATA_RATE_200HZ UINT8_C(0x09) +#define BMA4_OUTPUT_DATA_RATE_400HZ UINT8_C(0x0A) +#define BMA4_OUTPUT_DATA_RATE_800HZ UINT8_C(0x0B) +#define BMA4_OUTPUT_DATA_RATE_1600HZ UINT8_C(0x0C) /**\name ACCEL BANDWIDTH PARAMETER */ -#define BMA4_ACCEL_OSR4_AVG1 UINT8_C(0) -#define BMA4_ACCEL_OSR2_AVG2 UINT8_C(1) -#define BMA4_ACCEL_NORMAL_AVG4 UINT8_C(2) -#define BMA4_ACCEL_CIC_AVG8 UINT8_C(3) -#define BMA4_ACCEL_RES_AVG16 UINT8_C(4) -#define BMA4_ACCEL_RES_AVG32 UINT8_C(5) -#define BMA4_ACCEL_RES_AVG64 UINT8_C(6) -#define BMA4_ACCEL_RES_AVG128 UINT8_C(7) +#define BMA4_ACCEL_OSR4_AVG1 UINT8_C(0) +#define BMA4_ACCEL_OSR2_AVG2 UINT8_C(1) +#define BMA4_ACCEL_NORMAL_AVG4 UINT8_C(2) +#define BMA4_ACCEL_CIC_AVG8 UINT8_C(3) +#define BMA4_ACCEL_RES_AVG16 UINT8_C(4) +#define BMA4_ACCEL_RES_AVG32 UINT8_C(5) +#define BMA4_ACCEL_RES_AVG64 UINT8_C(6) +#define BMA4_ACCEL_RES_AVG128 UINT8_C(7) /**\name ACCEL PERFMODE PARAMETER */ -#define BMA4_CIC_AVG_MODE UINT8_C(0) -#define BMA4_CONTINUOUS_MODE UINT8_C(1) +#define BMA4_CIC_AVG_MODE UINT8_C(0) +#define BMA4_CONTINUOUS_MODE UINT8_C(1) /**\name MAG OFFSET */ -#define BMA4_MAG_OFFSET_MAX UINT8_C(0x00) +#define BMA4_MAG_OFFSET_MAX UINT8_C(0x00) /**\name ENABLE/DISABLE SELECTIONS */ -#define BMA4_X_AXIS UINT8_C(0) -#define BMA4_Y_AXIS UINT8_C(1) -#define BMA4_Z_AXIS UINT8_C(2) +#define BMA4_X_AXIS UINT8_C(0) +#define BMA4_Y_AXIS UINT8_C(1) +#define BMA4_Z_AXIS UINT8_C(2) /**\name SELF TEST*/ -#define BMA4_SELFTEST_PASS INT8_C(0) -#define BMA4_SELFTEST_FAIL INT8_C(1) +#define BMA4_SELFTEST_PASS INT8_C(0) +#define BMA4_SELFTEST_FAIL INT8_C(1) -#define BMA4_SELFTEST_DIFF_X_AXIS_FAILED INT8_C(1) -#define BMA4_SELFTEST_DIFF_Y_AXIS_FAILED INT8_C(2) -#define BMA4_SELFTEST_DIFF_Z_AXIS_FAILED INT8_C(3) -#define BMA4_SELFTEST_DIFF_X_AND_Y_AXIS_FAILED INT8_C(4) -#define BMA4_SELFTEST_DIFF_X_AND_Z_AXIS_FAILED INT8_C(5) -#define BMA4_SELFTEST_DIFF_Y_AND_Z_AXIS_FAILED INT8_C(6) -#define BMA4_SELFTEST_DIFF_X_Y_AND_Z_AXIS_FAILED INT8_C(7) +#define BMA4_SELFTEST_DIFF_X_AXIS_FAILED INT8_C(1) +#define BMA4_SELFTEST_DIFF_Y_AXIS_FAILED INT8_C(2) +#define BMA4_SELFTEST_DIFF_Z_AXIS_FAILED INT8_C(3) +#define BMA4_SELFTEST_DIFF_X_AND_Y_AXIS_FAILED INT8_C(4) +#define BMA4_SELFTEST_DIFF_X_AND_Z_AXIS_FAILED INT8_C(5) +#define BMA4_SELFTEST_DIFF_Y_AND_Z_AXIS_FAILED INT8_C(6) +#define BMA4_SELFTEST_DIFF_X_Y_AND_Z_AXIS_FAILED INT8_C(7) /**\name INTERRUPT MAPS */ -#define BMA4_INTR1_MAP UINT8_C(0) -#define BMA4_INTR2_MAP UINT8_C(1) +#define BMA4_INTR1_MAP UINT8_C(0) +#define BMA4_INTR2_MAP UINT8_C(1) /**\name INTERRUPT MASKS */ -#define BMA4_FIFO_FULL_INT UINT16_C(0x0100) -#define BMA4_FIFO_WM_INT UINT16_C(0x0200) -#define BMA4_DATA_RDY_INT UINT16_C(0x0400) -#define BMA4_MAG_DATA_RDY_INT UINT16_C(0x2000) -#define BMA4_ACCEL_DATA_RDY_INT UINT16_C(0x8000) +#define BMA4_FIFO_FULL_INT UINT16_C(0x0100) +#define BMA4_FIFO_WM_INT UINT16_C(0x0200) +#define BMA4_DATA_RDY_INT UINT16_C(0x0400) +#define BMA4_MAG_DATA_RDY_INT UINT16_C(0x2000) +#define BMA4_ACCEL_DATA_RDY_INT UINT16_C(0x8000) /**\name AKM POWER MODE SELECTION */ -#define BMA4_AKM_POWER_DOWN_MODE UINT8_C(0) -#define BMA4_AKM_SINGLE_MEAS_MODE UINT8_C(1) +#define BMA4_AKM_POWER_DOWN_MODE UINT8_C(0) +#define BMA4_AKM_SINGLE_MEAS_MODE UINT8_C(1) /**\name SECONDARY_MAG POWER MODE SELECTION */ -#define BMA4_MAG_FORCE_MODE UINT8_C(0) -#define BMA4_MAG_SUSPEND_MODE UINT8_C(1) +#define BMA4_MAG_FORCE_MODE UINT8_C(0) +#define BMA4_MAG_SUSPEND_MODE UINT8_C(1) /**\name MAG POWER MODE SELECTION */ -#define BMA4_FORCE_MODE UINT8_C(0) -#define BMA4_SUSPEND_MODE UINT8_C(1) +#define BMA4_FORCE_MODE UINT8_C(0) +#define BMA4_SUSPEND_MODE UINT8_C(1) /**\name ACCEL POWER MODE */ -#define BMA4_ACCEL_MODE_NORMAL UINT8_C(0x11) +#define BMA4_ACCEL_MODE_NORMAL UINT8_C(0x11) /**\name MAG POWER MODE */ -#define BMA4_MAG_MODE_SUSPEND UINT8_C(0x18) +#define BMA4_MAG_MODE_SUSPEND UINT8_C(0x18) /**\name ENABLE/DISABLE BIT VALUES */ -#define BMA4_ENABLE UINT8_C(0x01) -#define BMA4_DISABLE UINT8_C(0x00) +#define BMA4_ENABLE UINT8_C(0x01) +#define BMA4_DISABLE UINT8_C(0x00) /**\name DEFINITION USED FOR DIFFERENT WRITE */ -#define BMA4_MANUAL_DISABLE UINT8_C(0x00) -#define BMA4_MANUAL_ENABLE UINT8_C(0x01) -#define BMA4_ENABLE_MAG_IF_MODE UINT8_C(0x01) -#define BMA4_MAG_DATA_READ_REG UINT8_C(0x0A) -#define BMA4_BMM_POWER_MODE_REG UINT8_C(0x06) -#define BMA4_SEC_IF_NULL UINT8_C(0) -#define BMA4_SEC_IF_BMM150 UINT8_C(1) -#define BMA4_SEC_IF_AKM09916 UINT8_C(2) -#define BMA4_ENABLE_AUX_IF_MODE UINT8_C(0x01) +#define BMA4_MANUAL_DISABLE UINT8_C(0x00) +#define BMA4_MANUAL_ENABLE UINT8_C(0x01) +#define BMA4_ENABLE_MAG_IF_MODE UINT8_C(0x01) +#define BMA4_MAG_DATA_READ_REG UINT8_C(0x0A) +#define BMA4_BMM_POWER_MODE_REG UINT8_C(0x06) +#define BMA4_SEC_IF_NULL UINT8_C(0) +#define BMA4_SEC_IF_BMM150 UINT8_C(1) +#define BMA4_SEC_IF_AKM09916 UINT8_C(2) +#define BMA4_ENABLE_AUX_IF_MODE UINT8_C(0x01) /**\name SENSOR RESOLUTION */ -#define BMA4_12_BIT_RESOLUTION UINT8_C(12) -#define BMA4_14_BIT_RESOLUTION UINT8_C(14) -#define BMA4_16_BIT_RESOLUTION UINT8_C(16) +#define BMA4_12_BIT_RESOLUTION UINT8_C(12) +#define BMA4_14_BIT_RESOLUTION UINT8_C(14) +#define BMA4_16_BIT_RESOLUTION UINT8_C(16) /**\name FOC MACROS */ -#define BMA4_FOC_SAMPLE_LIMIT UINT8_C(128) -#define BMA4_MAX_NOISE_LIMIT(RANGE_VALUE) (RANGE_VALUE + UINT16_C(255)) -#define BMA4_MIN_NOISE_LIMIT(RANGE_VALUE) (RANGE_VALUE - UINT16_C(255)) +#define BMA4_FOC_SAMPLE_LIMIT UINT8_C(128) +#define BMA4_MAX_NOISE_LIMIT(RANGE_VALUE) (RANGE_VALUE + UINT16_C(255)) +#define BMA4_MIN_NOISE_LIMIT(RANGE_VALUE) (RANGE_VALUE - UINT16_C(255)) /*! for handling float temperature values */ -#define BMA4_SCALE_TEMP INT32_C(1000) +#define BMA4_SCALE_TEMP INT32_C(1000) /* BMA4_FAHREN_SCALED = 1.8 * 1000 */ -#define BMA4_FAHREN_SCALED INT32_C(1800) +#define BMA4_FAHREN_SCALED INT32_C(1800) /* BMA4_KELVIN_SCALED = 273.15 * 1000 */ -#define BMA4_KELVIN_SCALED INT32_C(273150) +#define BMA4_KELVIN_SCALED INT32_C(273150) /**\name MAP BURST READ LENGTHS */ -#define BMA4_AUX_READ_LEN_0 UINT8_C(0) -#define BMA4_AUX_READ_LEN_1 UINT8_C(1) -#define BMA4_AUX_READ_LEN_2 UINT8_C(2) -#define BMA4_AUX_READ_LEN_3 UINT8_C(3) +#define BMA4_AUX_READ_LEN_0 UINT8_C(0) +#define BMA4_AUX_READ_LEN_1 UINT8_C(1) +#define BMA4_AUX_READ_LEN_2 UINT8_C(2) +#define BMA4_AUX_READ_LEN_3 UINT8_C(3) -#define BMA4_CONFIG_STREAM_MESSAGE_MSK UINT8_C(0x0F) +#define BMA4_CONFIG_STREAM_MESSAGE_MSK UINT8_C(0x0F) -#define BMA4_SOFT_RESET UINT8_C(0XB6) +#define BMA4_SOFT_RESET UINT8_C(0XB6) -#define BMA4_MS_TO_US(X) (X * 1000) +#define BMA4_MS_TO_US(X) (X * 1000) #ifndef ABS -#define ABS(a) ((a) > 0 ? (a) : -(a)) /*!< Absolute value */ + #define ABS(a) ((a) > 0 ? (a) : -(a)) /*!< Absolute value */ #endif /**\name BIT SLICE GET AND SET FUNCTIONS */ -#define BMA4_GET_BITSLICE(regvar, bitname) \ - ((regvar & bitname##_MSK) >> bitname##_POS) +#define BMA4_GET_BITSLICE(regvar, bitname) ((regvar & bitname##_MSK) >> bitname##_POS) -#define BMA4_SET_BITSLICE(regvar, bitname, val) \ - ((regvar & ~bitname##_MSK) | \ - ((val << bitname##_POS) & bitname##_MSK)) +#define BMA4_SET_BITSLICE(regvar, bitname, val) ((regvar & ~bitname##_MSK) | ((val << bitname##_POS) & bitname##_MSK)) -#define BMA4_GET_DIFF(x, y) ((x) - (y)) +#define BMA4_GET_DIFF(x, y) ((x) - (y)) -#define BMA4_GET_LSB(var) (uint8_t)(var & BMA4_SET_LOW_BYTE) -#define BMA4_GET_MSB(var) (uint8_t)((var & BMA4_SET_HIGH_BYTE) >> 8) +#define BMA4_GET_LSB(var) (uint8_t)(var & BMA4_SET_LOW_BYTE) +#define BMA4_GET_MSB(var) (uint8_t)((var & BMA4_SET_HIGH_BYTE) >> 8) -#define BMA4_SET_BIT_VAL_0(reg_data, bitname) (reg_data & ~(bitname##_MSK)) +#define BMA4_SET_BIT_VAL_0(reg_data, bitname) (reg_data & ~(bitname##_MSK)) -#define BMA4_SET_BITS_POS_0(reg_data, bitname, data) \ - ((reg_data & ~(bitname##_MSK)) | \ - (data & bitname##_MSK)) +#define BMA4_SET_BITS_POS_0(reg_data, bitname, data) ((reg_data & ~(bitname##_MSK)) | (data & bitname##_MSK)) -#define BMA4_GET_BITS_POS_0(reg_data, bitname) (reg_data & (bitname##_MSK)) +#define BMA4_GET_BITS_POS_0(reg_data, bitname) (reg_data & (bitname##_MSK)) /** * BMA4_INTF_RET_TYPE is the read/write interface return type which can be overwritten by the build system. * The default is set to int8_t. */ #ifndef BMA4_INTF_RET_TYPE -#define BMA4_INTF_RET_TYPE int8_t + #define BMA4_INTF_RET_TYPE int8_t #endif /** @@ -678,7 +673,7 @@ * execution of the read/write functions */ #ifndef BMA4_INTF_RET_SUCCESS -#define BMA4_INTF_RET_SUCCESS INT8_C(0) + #define BMA4_INTF_RET_SUCCESS INT8_C(0) #endif /******************************************************************************/ @@ -699,7 +694,7 @@ * @retval != BMA4_INTF_RET_SUCCESS -> Failure Info * */ -typedef BMA4_INTF_RET_TYPE (*bma4_read_fptr_t)(uint8_t reg_addr, uint8_t *read_data, uint32_t len, void *intf_ptr); +typedef BMA4_INTF_RET_TYPE (*bma4_read_fptr_t)(uint8_t reg_addr, uint8_t* read_data, uint32_t len, void* intf_ptr); /*! * @brief Bus communication function pointer which should be mapped to @@ -716,8 +711,7 @@ typedef BMA4_INTF_RET_TYPE (*bma4_read_fptr_t)(uint8_t reg_addr, uint8_t *read_d * @retval != BMA4_INTF_RET_SUCCESS -> Failure Info * */ -typedef BMA4_INTF_RET_TYPE (*bma4_write_fptr_t)(uint8_t reg_addr, const uint8_t *read_data, uint32_t len, - void *intf_ptr); +typedef BMA4_INTF_RET_TYPE (*bma4_write_fptr_t)(uint8_t reg_addr, const uint8_t* read_data, uint32_t len, void* intf_ptr); /*! * @brief Delay function pointer which should be mapped to @@ -728,23 +722,16 @@ typedef BMA4_INTF_RET_TYPE (*bma4_write_fptr_t)(uint8_t reg_addr, const uint8_t * for interface related call backs * */ -typedef void (*bma4_delay_us_fptr_t)(uint32_t period, void *intf_ptr); +typedef void (*bma4_delay_us_fptr_t)(uint32_t period, void* intf_ptr); /******************************************************************************/ /*! @name Enum Declarations */ /******************************************************************************/ /*! @name Enum to define BMA4 variants */ -enum bma4_variant { - BMA42X_VARIANT = 1, - BMA42X_B_VARIANT, - BMA45X_VARIANT -}; +enum bma4_variant { BMA42X_VARIANT = 1, BMA42X_B_VARIANT, BMA45X_VARIANT }; /* Enumerator describing interfaces */ -enum bma4_intf { - BMA4_SPI_INTF, - BMA4_I2C_INTF -}; +enum bma4_intf { BMA4_SPI_INTF, BMA4_I2C_INTF }; /**\name STRUCTURE DEFINITIONS*/ @@ -752,393 +739,375 @@ enum bma4_intf { * @brief * This structure holds asic info. for feature configuration. */ -struct bma4_asic_data -{ - /* Feature config start addr (0-3 bits)*/ - uint8_t asic_lsb; +struct bma4_asic_data { + /* Feature config start addr (0-3 bits)*/ + uint8_t asic_lsb; - /* Feature config start addr (4-11 bits)*/ - uint8_t asic_msb; + /* Feature config start addr (4-11 bits)*/ + uint8_t asic_msb; }; /*! * @brief Auxiliary configuration structure for user settings */ -struct bma4_aux_config -{ - /*! Device address of auxiliary sensor */ - uint8_t aux_dev_addr; +struct bma4_aux_config { + /*! Device address of auxiliary sensor */ + uint8_t aux_dev_addr; - /*! To enable manual or auto mode */ - uint8_t manual_enable; + /*! To enable manual or auto mode */ + uint8_t manual_enable; - /*! No of bytes to be read at a time */ - uint8_t burst_read_length; + /*! No of bytes to be read at a time */ + uint8_t burst_read_length; - /*! Variable to set the auxiliary interface */ - uint8_t if_mode; + /*! Variable to set the auxiliary interface */ + uint8_t if_mode; }; /*! * @brief * This structure holds all relevant information about BMA4 */ -struct bma4_dev -{ - /*! Chip id of BMA4 */ - uint8_t chip_id; +struct bma4_dev { + /*! Chip id of BMA4 */ + uint8_t chip_id; - /*! Chip id of auxiliary sensor */ - uint8_t aux_chip_id; + /*! Chip id of auxiliary sensor */ + uint8_t aux_chip_id; - /*! Interface pointer */ - void *intf_ptr; + /*! Interface pointer */ + void* intf_ptr; - /*! Interface detail */ - enum bma4_intf intf; + /*! Interface detail */ + enum bma4_intf intf; - /*! Variable that holds error code */ - BMA4_INTF_RET_TYPE intf_rslt; + /*! Variable that holds error code */ + BMA4_INTF_RET_TYPE intf_rslt; - /*! Auxiliary sensor information */ - uint8_t aux_sensor; + /*! Auxiliary sensor information */ + uint8_t aux_sensor; - /*! Decide SPI or I2C read mechanism */ - uint8_t dummy_byte; + /*! Decide SPI or I2C read mechanism */ + uint8_t dummy_byte; - /*! Resolution for FOC */ - uint8_t resolution; + /*! Resolution for FOC */ + uint8_t resolution; - /*! Define the BMA4 variant BMA42X or BMA45X */ - enum bma4_variant variant; + /*! Define the BMA4 variant BMA42X or BMA45X */ + enum bma4_variant variant; - /*! Used to check mag manual/auto mode status - * int8_t mag_manual_enable; - */ + /*! Used to check mag manual/auto mode status + * int8_t mag_manual_enable; + */ - /*! Config stream data buffer address will be assigned*/ - const uint8_t *config_file_ptr; + /*! Config stream data buffer address will be assigned*/ + const uint8_t* config_file_ptr; - /*! Read/write length */ - uint16_t read_write_len; + /*! Read/write length */ + uint16_t read_write_len; - /*! Feature len */ - uint8_t feature_len; + /*! Feature len */ + uint8_t feature_len; - /*! Contains asic information */ - struct bma4_asic_data asic_data; + /*! Contains asic information */ + struct bma4_asic_data asic_data; - /*! Contains aux configuration settings */ - struct bma4_aux_config aux_config; + /*! Contains aux configuration settings */ + struct bma4_aux_config aux_config; - /*! Bus read function pointer */ - bma4_read_fptr_t bus_read; + /*! Bus read function pointer */ + bma4_read_fptr_t bus_read; - /*! Bus write function pointer */ - bma4_write_fptr_t bus_write; + /*! Bus write function pointer */ + bma4_write_fptr_t bus_write; - /*! Delay(in microsecond) function pointer */ - bma4_delay_us_fptr_t delay_us; + /*! Delay(in microsecond) function pointer */ + bma4_delay_us_fptr_t delay_us; - /*! Variable to store the size of config file */ - uint16_t config_size; + /*! Variable to store the size of config file */ + uint16_t config_size; - /*! Variable to store the status of performance mode */ - uint8_t perf_mode_status; + /*! Variable to store the status of performance mode */ + uint8_t perf_mode_status; }; /*! * @brief This structure holds the information for usage of * FIFO by the user. */ -struct bma4_fifo_frame -{ - /*! Data buffer of user defined length is to be mapped here */ - uint8_t *data; +struct bma4_fifo_frame { + /*! Data buffer of user defined length is to be mapped here */ + uint8_t* data; - /*! Number of bytes of FIFO to be read as specified by the user */ - uint16_t length; + /*! Number of bytes of FIFO to be read as specified by the user */ + uint16_t length; - /*! Enabling of the FIFO header to stream in header mode */ - uint8_t fifo_header_enable; + /*! Enabling of the FIFO header to stream in header mode */ + uint8_t fifo_header_enable; - /*! Streaming of the Accelerometer, Auxiliary - * sensor data or both in FIFO - */ - uint8_t fifo_data_enable; + /*! Streaming of the Accelerometer, Auxiliary + * sensor data or both in FIFO + */ + uint8_t fifo_data_enable; - /*! Will be equal to length when no more frames are there to parse */ - uint16_t accel_byte_start_idx; + /*! Will be equal to length when no more frames are there to parse */ + uint16_t accel_byte_start_idx; - /*! Will be equal to length when no more frames are there to parse */ - uint16_t mag_byte_start_idx; + /*! Will be equal to length when no more frames are there to parse */ + uint16_t mag_byte_start_idx; - /*! Will be equal to length when no more frames are there to parse */ - uint16_t sc_frame_byte_start_idx; + /*! Will be equal to length when no more frames are there to parse */ + uint16_t sc_frame_byte_start_idx; - /*! Value of FIFO sensor time time */ - uint32_t sensor_time; + /*! Value of FIFO sensor time time */ + uint32_t sensor_time; - /*! Value of Skipped frame counts */ - uint8_t skipped_frame_count; + /*! Value of Skipped frame counts */ + uint8_t skipped_frame_count; - /*! Value of accel dropped frame count */ - uint8_t accel_dropped_frame_count; + /*! Value of accel dropped frame count */ + uint8_t accel_dropped_frame_count; - /*! Value of mag dropped frame count */ - uint8_t mag_dropped_frame_count; + /*! Value of mag dropped frame count */ + uint8_t mag_dropped_frame_count; }; /*! * @brief Error Status structure */ -struct bma4_err_reg -{ - /*! Indicates fatal error */ - uint8_t fatal_err; +struct bma4_err_reg { + /*! Indicates fatal error */ + uint8_t fatal_err; - /*! Indicates command error */ - uint8_t cmd_err; + /*! Indicates command error */ + uint8_t cmd_err; - /*! Indicates error code */ - uint8_t err_code; + /*! Indicates error code */ + uint8_t err_code; - /*! Indicates fifo error */ - uint8_t fifo_err; + /*! Indicates fifo error */ + uint8_t fifo_err; - /*! Indicates mag error */ - uint8_t aux_err; + /*! Indicates mag error */ + uint8_t aux_err; }; /*! * @brief Asic Status structure */ -struct bma4_asic_status -{ - /*! Asic is in sleep/halt state */ - uint8_t sleep; +struct bma4_asic_status { + /*! Asic is in sleep/halt state */ + uint8_t sleep; - /*! Dedicated interrupt is set again before previous interrupt - * was acknowledged - */ - uint8_t irq_ovrn; + /*! Dedicated interrupt is set again before previous interrupt + * was acknowledged + */ + uint8_t irq_ovrn; - /*! Watchcell event detected (asic stopped) */ - uint8_t wc_event; + /*! Watchcell event detected (asic stopped) */ + uint8_t wc_event; - /*! Stream transfer has started and transactions are ongoing */ - uint8_t stream_transfer_active; + /*! Stream transfer has started and transactions are ongoing */ + uint8_t stream_transfer_active; }; /*! * @brief Interrupt Pin Configuration structure */ -struct bma4_int_pin_config -{ - /*! Trigger condition of interrupt pin */ - uint8_t edge_ctrl; +struct bma4_int_pin_config { + /*! Trigger condition of interrupt pin */ + uint8_t edge_ctrl; - /*! Level of interrupt pin */ - uint8_t lvl; + /*! Level of interrupt pin */ + uint8_t lvl; - /*! Behaviour of interrupt pin to open drain */ - uint8_t od; + /*! Behaviour of interrupt pin to open drain */ + uint8_t od; - /*! Output enable for interrupt pin */ - uint8_t output_en; + /*! Output enable for interrupt pin */ + uint8_t output_en; - /*! Input enable for interrupt pin */ - uint8_t input_en; + /*! Input enable for interrupt pin */ + uint8_t input_en; }; /*! * @brief Accelerometer configuration structure */ -struct bma4_accel_config -{ - /*! Output data rate in Hz */ - uint8_t odr; +struct bma4_accel_config { + /*! Output data rate in Hz */ + uint8_t odr; - /*! Bandwidth parameter, determines filter configuration */ - uint8_t bandwidth; + /*! Bandwidth parameter, determines filter configuration */ + uint8_t bandwidth; - /*! Filter performance mode */ - uint8_t perf_mode; + /*! Filter performance mode */ + uint8_t perf_mode; - /*! G-range */ - uint8_t range; + /*! G-range */ + uint8_t range; }; /*! * @brief Auxiliary magnetometer configuration structure */ -struct bma4_aux_mag_config -{ - /*! Poll rate for the sensor attached to the Magnetometer interface */ - uint8_t odr; +struct bma4_aux_mag_config { + /*! Poll rate for the sensor attached to the Magnetometer interface */ + uint8_t odr; - /*! Trigger-readout offset in units of 2.5 ms. - * If set to zero, the offset is maximum, i.e. after readout a trigger - * is issued immediately - */ - uint8_t offset; + /*! Trigger-readout offset in units of 2.5 ms. + * If set to zero, the offset is maximum, i.e. after readout a trigger + * is issued immediately + */ + uint8_t offset; }; /*! * @brief ASIC Config structure */ -struct bma4_asic_config -{ - /*! Enable/Disable ASIC Wake Up */ - uint8_t asic_en; +struct bma4_asic_config { + /*! Enable/Disable ASIC Wake Up */ + uint8_t asic_en; - /*! Configure stream_transfer/FIFO mode */ - uint8_t fifo_mode_en; + /*! Configure stream_transfer/FIFO mode */ + uint8_t fifo_mode_en; - /*! Mapping of instance RAM1 */ - uint8_t mem_conf_ram1; + /*! Mapping of instance RAM1 */ + uint8_t mem_conf_ram1; - /*! Mapping of instance RAM2 */ - uint8_t mem_conf_ram2; + /*! Mapping of instance RAM2 */ + uint8_t mem_conf_ram2; - /*! Mapping of instance RAM3 */ - uint8_t mem_conf_ram3; + /*! Mapping of instance RAM3 */ + uint8_t mem_conf_ram3; }; /*! * @brief bmm150 or akm09916 * magnetometer values structure */ -struct bma4_mag -{ - /*! BMM150 and AKM09916 X raw data */ - int32_t x; +struct bma4_mag { + /*! BMM150 and AKM09916 X raw data */ + int32_t x; - /*! BMM150 and AKM09916 Y raw data */ - int32_t y; + /*! BMM150 and AKM09916 Y raw data */ + int32_t y; - /*! BMM150 and AKM09916 Z raw data */ - int32_t z; + /*! BMM150 and AKM09916 Z raw data */ + int32_t z; }; /*! * @brief bmm150 xyz data structure */ -struct bma4_mag_xyzr -{ - /*! BMM150 X raw data */ - int16_t x; +struct bma4_mag_xyzr { + /*! BMM150 X raw data */ + int16_t x; - /*! BMM150 Y raw data */ - int16_t y; + /*! BMM150 Y raw data */ + int16_t y; - /*! BMM150 Z raw data */ - int16_t z; + /*! BMM150 Z raw data */ + int16_t z; - /*! BMM150 R raw data */ - uint16_t r; + /*! BMM150 R raw data */ + uint16_t r; }; /*! * @brief Accel xyz data structure */ -struct bma4_accel -{ - /*! Accel X data */ - int16_t x; +struct bma4_accel { + /*! Accel X data */ + int16_t x; - /*! Accel Y data */ - int16_t y; + /*! Accel Y data */ + int16_t y; - /*! Accel Z data */ - int16_t z; + /*! Accel Z data */ + int16_t z; }; /*! * @brief FIFO mag data structure */ -struct bma4_mag_fifo_data -{ - /*! The value of mag x LSB data */ - uint8_t mag_x_lsb; +struct bma4_mag_fifo_data { + /*! The value of mag x LSB data */ + uint8_t mag_x_lsb; - /*! The value of mag x MSB data */ - uint8_t mag_x_msb; + /*! The value of mag x MSB data */ + uint8_t mag_x_msb; - /*! The value of mag y LSB data */ - uint8_t mag_y_lsb; + /*! The value of mag y LSB data */ + uint8_t mag_y_lsb; - /*! The value of mag y MSB data */ - uint8_t mag_y_msb; + /*! The value of mag y MSB data */ + uint8_t mag_y_msb; - /*! The value of mag z LSB data */ - uint8_t mag_z_lsb; + /*! The value of mag z LSB data */ + uint8_t mag_z_lsb; - /*! The value of mag z MSB data */ - uint8_t mag_z_msb; + /*! The value of mag z MSB data */ + uint8_t mag_z_msb; - /*! The value of mag r for BMM150 Y2 for YAMAHA LSB data */ - uint8_t mag_r_y2_lsb; + /*! The value of mag r for BMM150 Y2 for YAMAHA LSB data */ + uint8_t mag_r_y2_lsb; - /*! The value of mag r for BMM150 Y2 for YAMAHA MSB data */ - uint8_t mag_r_y2_msb; + /*! The value of mag r for BMM150 Y2 for YAMAHA MSB data */ + uint8_t mag_r_y2_msb; }; /*! * @brief Accel self test difference data structure */ -struct bma4_selftest_delta_limit -{ - /*! Accel X data */ - int32_t x; +struct bma4_selftest_delta_limit { + /*! Accel X data */ + int32_t x; - /*! Accel Y data */ - int32_t y; + /*! Accel Y data */ + int32_t y; - /*! Accel Z data */ - int32_t z; + /*! Accel Z data */ + int32_t z; }; /*! @name Structure to enable an accel axis for FOC */ -struct bma4_accel_foc_g_value -{ - /* '0' to disable x-axis and '1' to enable x-axis */ - uint8_t x; +struct bma4_accel_foc_g_value { + /* '0' to disable x-axis and '1' to enable x-axis */ + uint8_t x; - /* '0' to disable y-axis and '1' to enable y-axis */ - uint8_t y; + /* '0' to disable y-axis and '1' to enable y-axis */ + uint8_t y; - /* '0' to disable z-axis and '1' to enable z-axis */ - uint8_t z; + /* '0' to disable z-axis and '1' to enable z-axis */ + uint8_t z; - /* '0' for positive input and '1' for negative input */ - uint8_t sign; + /* '0' for positive input and '1' for negative input */ + uint8_t sign; }; /*! @name Structure to store temporary accelerometer values */ -struct bma4_foc_temp_value -{ - /*! X data */ - int32_t x; +struct bma4_foc_temp_value { + /*! X data */ + int32_t x; - /*! Y data */ - int32_t y; + /*! Y data */ + int32_t y; - /*! Z data */ - int32_t z; + /*! Z data */ + int32_t z; }; /* Structure to store temporary axes data values */ -struct bma4_temp_axes_val -{ - /* X data */ - int32_t x; +struct bma4_temp_axes_val { + /* X data */ + int32_t x; - /* Y data */ - int32_t y; + /* Y data */ + int32_t y; - /* Z data */ - int32_t z; + /* Z data */ + int32_t z; }; #endif /* End of BMA4_DEFS_H__ */ diff --git a/src/drivers/BufferProvider.h b/src/drivers/BufferProvider.h index 53571133..7d4509c6 100644 --- a/src/drivers/BufferProvider.h +++ b/src/drivers/BufferProvider.h @@ -9,4 +9,4 @@ namespace Pinetime { virtual bool GetNextBuffer(uint8_t** buffer, size_t& size) = 0; }; } -} \ No newline at end of file +} diff --git a/src/drivers/Hrs3300.cpp b/src/drivers/Hrs3300.cpp index a4b72479..deee36f6 100644 --- a/src/drivers/Hrs3300.cpp +++ b/src/drivers/Hrs3300.cpp @@ -103,14 +103,16 @@ Hrs3300::PackedHrsAls Hrs3300::ReadHrsAls() { void Hrs3300::WriteRegister(uint8_t reg, uint8_t data) { auto ret = twiMaster.Write(twiAddress, reg, &data, 1); - if (ret != TwiMaster::ErrorCodes::NoError) + if (ret != TwiMaster::ErrorCodes::NoError) { NRF_LOG_INFO("WRITE ERROR"); + } } uint8_t Hrs3300::ReadRegister(uint8_t reg) { uint8_t value; auto ret = twiMaster.Read(twiAddress, reg, &value, 1); - if (ret != TwiMaster::ErrorCodes::NoError) + if (ret != TwiMaster::ErrorCodes::NoError) { NRF_LOG_INFO("READ ERROR"); + } return value; } diff --git a/src/drivers/InternalFlash.h b/src/drivers/InternalFlash.h index 3a3c79dc..9156b735 100644 --- a/src/drivers/InternalFlash.h +++ b/src/drivers/InternalFlash.h @@ -13,4 +13,4 @@ namespace Pinetime { static inline void Wait(); }; } -} \ No newline at end of file +} diff --git a/src/drivers/SpiMaster.cpp b/src/drivers/SpiMaster.cpp index 19422ef3..827fa09e 100644 --- a/src/drivers/SpiMaster.cpp +++ b/src/drivers/SpiMaster.cpp @@ -181,8 +181,9 @@ void SpiMaster::PrepareRx(const uint32_t bufferAddress, const size_t size) { } bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size, const std::function& preTransactionHook) { - if (data == nullptr) + if (data == nullptr) { return false; + } auto ok = xSemaphoreTake(mutex, portMAX_DELAY); ASSERT(ok == true); diff --git a/src/drivers/SpiNorFlash.cpp b/src/drivers/SpiNorFlash.cpp index 3bc45cca..18d42ede 100644 --- a/src/drivers/SpiNorFlash.cpp +++ b/src/drivers/SpiNorFlash.cpp @@ -92,13 +92,15 @@ void SpiNorFlash::SectorErase(uint32_t sectorAddress) { static_cast(sectorAddress)}; WriteEnable(); - while (!WriteEnabled()) + while (!WriteEnabled()) { vTaskDelay(1); + } spi.Read(reinterpret_cast(&cmd), cmdSize, nullptr, 0); - while (WriteInProgress()) + while (WriteInProgress()) { vTaskDelay(1); + } } uint8_t SpiNorFlash::ReadSecurityRegister() { @@ -132,13 +134,15 @@ void SpiNorFlash::Write(uint32_t address, const uint8_t* buffer, size_t size) { static_cast(addr)}; WriteEnable(); - while (!WriteEnabled()) + while (!WriteEnabled()) { vTaskDelay(1); + } spi.WriteCmdAndBuffer(cmd, cmdSize, b, toWrite); - while (WriteInProgress()) + while (WriteInProgress()) { vTaskDelay(1); + } addr += toWrite; b += toWrite; diff --git a/src/logging/Logger.h b/src/logging/Logger.h index 093a9420..d76f434e 100644 --- a/src/logging/Logger.h +++ b/src/logging/Logger.h @@ -8,4 +8,4 @@ namespace Pinetime { virtual void Resume() = 0; }; } -} \ No newline at end of file +} diff --git a/src/main.h b/src/main.h index 4475dc8b..67e06b87 100644 --- a/src/main.h +++ b/src/main.h @@ -8,4 +8,4 @@ void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action void DebounceTimerCallback(TimerHandle_t xTimer); extern int mallocFailedCount; -extern int stackOverflowCount; \ No newline at end of file +extern int stackOverflowCount; diff --git a/src/recoveryLoader.cpp b/src/recoveryLoader.cpp index fc9ab76c..4d6a2096 100644 --- a/src/recoveryLoader.cpp +++ b/src/recoveryLoader.cpp @@ -152,8 +152,9 @@ int main(void) { logger.Init(); nrf_drv_clock_init(); - if (pdPASS != xTaskCreate(Process, "MAIN", 512, nullptr, 0, &taskHandle)) + if (pdPASS != xTaskCreate(Process, "MAIN", 512, nullptr, 0, &taskHandle)) { APP_ERROR_HANDLER(NRF_ERROR_NO_MEM); + } vTaskStartScheduler(); diff --git a/src/systemtask/SystemMonitor.cpp b/src/systemtask/SystemMonitor.cpp index 8696c8ce..c3887ad2 100644 --- a/src/systemtask/SystemMonitor.cpp +++ b/src/systemtask/SystemMonitor.cpp @@ -12,10 +12,11 @@ void Pinetime::System::SystemMonitor::Process() { auto nb = uxTaskGetSystemState(tasksStatus, 10, nullptr); for (uint32_t i = 0; i < nb; i++) { NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark); - if (tasksStatus[i].usStackHighWaterMark < 20) + if (tasksStatus[i].usStackHighWaterMark < 20) { NRF_LOG_INFO("WARNING!!! Task %s task is nearly full, only %dB available", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark * 4); + } } lastTick = xTaskGetTickCount(); } diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index fc4e8f7e..d0e00330 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -401,7 +401,7 @@ void SystemTask::GoToRunning() { } state = SystemTaskState::Running; -}; +} void SystemTask::GoToSleep() { if (IsSleeping()) { @@ -415,7 +415,7 @@ void SystemTask::GoToSleep() { heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::GoToSleep); state = SystemTaskState::GoingToSleep; -}; +} void SystemTask::UpdateMotion() { if (IsSleeping() && !(settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) || diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 8a4e5954..05236e45 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -85,7 +85,7 @@ namespace Pinetime { Pinetime::Controllers::NimbleController& nimble() { return nimbleController; - }; + } bool IsSleeping() const { return state != SystemTaskState::Running; diff --git a/tests/test-format.sh b/tests/test-format.sh index 693377b9..377dc816 100755 --- a/tests/test-format.sh +++ b/tests/test-format.sh @@ -20,7 +20,7 @@ do *.cpp|*.h) echo Checking "$file" PATCH="$(basename "$file").patch" - git clang-format-14 -q --style file --diff "$GITHUB_BASE_REF" "$file" > "$PATCH" + git clang-format-16 -q --style file --diff "$GITHUB_BASE_REF" "$file" > "$PATCH" if [ -s "$PATCH" ] then printf "\033[31mError:\033[0m Formatting error in %s\n" "$file" diff --git a/tests/test-tidy.sh b/tests/test-tidy.sh index 522f6e2a..dab9efc7 100755 --- a/tests/test-tidy.sh +++ b/tests/test-tidy.sh @@ -17,7 +17,7 @@ do src/libs/*|src/FreeRTOS/*) continue ;; *.cpp|*.h) echo "::group::$file" - clang-tidy-14 -p build "$file" || true + clang-tidy-16 -p build "$file" || true echo "::endgroup::" esac done