mirror of
https://github.com/InfiniTimeOrg/InfiniTime.git
synced 2024-10-22 15:11:51 +02:00
Merge 88e5c641fa
into 8598142c27
This commit is contained in:
commit
7556d77025
|
@ -2,20 +2,22 @@
|
||||||
Language: Cpp
|
Language: Cpp
|
||||||
AccessModifierOffset: -2
|
AccessModifierOffset: -2
|
||||||
AlignAfterOpenBracket: Align
|
AlignAfterOpenBracket: Align
|
||||||
AlignConsecutiveMacros: true
|
|
||||||
AlignConsecutiveAssignments: false
|
AlignConsecutiveAssignments: false
|
||||||
AlignConsecutiveDeclarations: false
|
AlignConsecutiveDeclarations: false
|
||||||
|
AlignConsecutiveMacros: true
|
||||||
AlignEscapedNewlines: Right
|
AlignEscapedNewlines: Right
|
||||||
AlignOperands: Align
|
AlignOperands: Align
|
||||||
AlignTrailingComments: true
|
AlignTrailingComments:
|
||||||
|
Kind: Always
|
||||||
|
OverEmptyLines: 0
|
||||||
AllowAllArgumentsOnNextLine: false
|
AllowAllArgumentsOnNextLine: false
|
||||||
AllowAllConstructorInitializersOnNextLine: true
|
AllowAllConstructorInitializersOnNextLine: true
|
||||||
AllowAllParametersOfDeclarationOnNextLine: false
|
AllowAllParametersOfDeclarationOnNextLine: false
|
||||||
AllowShortBlocksOnASingleLine: Never
|
AllowShortBlocksOnASingleLine: Never
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
AllowShortFunctionsOnASingleLine: None
|
AllowShortFunctionsOnASingleLine: None
|
||||||
AllowShortLambdasOnASingleLine: None
|
|
||||||
AllowShortIfStatementsOnASingleLine: Never
|
AllowShortIfStatementsOnASingleLine: Never
|
||||||
|
AllowShortLambdasOnASingleLine: None
|
||||||
AllowShortLoopsOnASingleLine: false
|
AllowShortLoopsOnASingleLine: false
|
||||||
AlwaysBreakAfterDefinitionReturnType: None
|
AlwaysBreakAfterDefinitionReturnType: None
|
||||||
AlwaysBreakAfterReturnType: None
|
AlwaysBreakAfterReturnType: None
|
||||||
|
@ -28,29 +30,30 @@ BraceWrapping:
|
||||||
AfterClass: false
|
AfterClass: false
|
||||||
AfterControlStatement: false
|
AfterControlStatement: false
|
||||||
AfterEnum: false
|
AfterEnum: false
|
||||||
|
AfterExternBlock: false
|
||||||
AfterFunction: false
|
AfterFunction: false
|
||||||
AfterNamespace: false
|
AfterNamespace: false
|
||||||
AfterObjCDeclaration: false
|
AfterObjCDeclaration: false
|
||||||
AfterStruct: false
|
AfterStruct: false
|
||||||
AfterUnion: false
|
AfterUnion: false
|
||||||
AfterExternBlock: false
|
|
||||||
BeforeCatch: false
|
BeforeCatch: false
|
||||||
BeforeElse: false
|
BeforeElse: false
|
||||||
IndentBraces: true
|
IndentBraces: true
|
||||||
SplitEmptyFunction: true
|
SplitEmptyFunction: true
|
||||||
SplitEmptyRecord: true
|
|
||||||
SplitEmptyNamespace: true
|
SplitEmptyNamespace: true
|
||||||
|
SplitEmptyRecord: true
|
||||||
|
BreakAfterAttributes: Never
|
||||||
|
BreakAfterJavaFieldAnnotations: false
|
||||||
BreakBeforeBinaryOperators: None
|
BreakBeforeBinaryOperators: None
|
||||||
BreakBeforeBraces: Attach
|
BreakBeforeBraces: Attach
|
||||||
BreakBeforeInheritanceComma: false
|
BreakBeforeInheritanceComma: false
|
||||||
BreakInheritanceList: BeforeColon
|
|
||||||
BreakBeforeTernaryOperators: true
|
BreakBeforeTernaryOperators: true
|
||||||
BreakConstructorInitializersBeforeComma: false
|
|
||||||
BreakConstructorInitializers: BeforeColon
|
BreakConstructorInitializers: BeforeColon
|
||||||
BreakAfterJavaFieldAnnotations: false
|
BreakConstructorInitializersBeforeComma: false
|
||||||
|
BreakInheritanceList: BeforeColon
|
||||||
BreakStringLiterals: true
|
BreakStringLiterals: true
|
||||||
ColumnLimit: 140
|
ColumnLimit: 140
|
||||||
CommentPragmas: '^ IWYU pragma:'
|
CommentPragmas: "^ IWYU pragma:"
|
||||||
CompactNamespaces: false
|
CompactNamespaces: false
|
||||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
ConstructorInitializerIndentWidth: 2
|
ConstructorInitializerIndentWidth: 2
|
||||||
|
@ -75,24 +78,26 @@ IncludeCategories:
|
||||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
||||||
Priority: 3
|
Priority: 3
|
||||||
SortPriority: 0
|
SortPriority: 0
|
||||||
- Regex: '.*'
|
- Regex: ".*"
|
||||||
Priority: 1
|
Priority: 1
|
||||||
SortPriority: 0
|
SortPriority: 0
|
||||||
IncludeIsMainRegex: '(Test)?$'
|
IncludeIsMainRegex: "(Test)?$"
|
||||||
IncludeIsMainSourceRegex: ''
|
IncludeIsMainSourceRegex: ""
|
||||||
IndentAccessModifiers: false
|
IndentAccessModifiers: false
|
||||||
IndentCaseLabels: true
|
IndentCaseLabels: true
|
||||||
IndentGotoLabels: true
|
IndentGotoLabels: true
|
||||||
IndentPPDirectives: BeforeHash
|
IndentPPDirectives: BeforeHash
|
||||||
IndentWidth: 2
|
IndentWidth: 2
|
||||||
IndentWrappedFunctionNames: false
|
IndentWrappedFunctionNames: false
|
||||||
# Requires Clang >= 15, could also cause incorrect code formatting:
|
# Could lead to incorrect formatting, but I think that the tradeoff is worth it
|
||||||
# InsertBraces: true
|
InsertBraces: true
|
||||||
|
InsertNewlineAtEOF: true
|
||||||
JavaScriptQuotes: Leave
|
JavaScriptQuotes: Leave
|
||||||
JavaScriptWrapImports: true
|
JavaScriptWrapImports: true
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: true
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
MacroBlockBegin: ''
|
LineEnding: LF
|
||||||
MacroBlockEnd: ''
|
MacroBlockBegin: ""
|
||||||
|
MacroBlockEnd: ""
|
||||||
MaxEmptyLinesToKeep: 1
|
MaxEmptyLinesToKeep: 1
|
||||||
NamespaceIndentation: All
|
NamespaceIndentation: All
|
||||||
PackConstructorInitializers: NextLine
|
PackConstructorInitializers: NextLine
|
||||||
|
@ -107,12 +112,14 @@ PenaltyReturnTypeOnItsOwnLine: 60
|
||||||
PointerAlignment: Left
|
PointerAlignment: Left
|
||||||
ReferenceAlignment: Pointer
|
ReferenceAlignment: Pointer
|
||||||
ReflowComments: true
|
ReflowComments: true
|
||||||
|
RemoveSemicolon: true
|
||||||
SeparateDefinitionBlocks: Always
|
SeparateDefinitionBlocks: Always
|
||||||
SortIncludes: false
|
SortIncludes: false
|
||||||
SortUsingDeclarations: true
|
SortUsingDeclarations: true
|
||||||
SpaceAfterCStyleCast: true
|
SpaceAfterCStyleCast: true
|
||||||
SpaceAfterLogicalNot: false
|
SpaceAfterLogicalNot: false
|
||||||
SpaceAfterTemplateKeyword: true
|
SpaceAfterTemplateKeyword: true
|
||||||
|
SpaceAroundPointerQualifiers: Default
|
||||||
SpaceBeforeAssignmentOperators: true
|
SpaceBeforeAssignmentOperators: true
|
||||||
SpaceBeforeCaseColon: false
|
SpaceBeforeCaseColon: false
|
||||||
SpaceBeforeCpp11BracedList: true
|
SpaceBeforeCpp11BracedList: true
|
||||||
|
@ -120,22 +127,19 @@ SpaceBeforeCtorInitializerColon: true
|
||||||
SpaceBeforeInheritanceColon: true
|
SpaceBeforeInheritanceColon: true
|
||||||
SpaceBeforeParens: ControlStatementsExceptForEachMacros
|
SpaceBeforeParens: ControlStatementsExceptForEachMacros
|
||||||
SpaceBeforeRangeBasedForLoopColon: true
|
SpaceBeforeRangeBasedForLoopColon: true
|
||||||
|
SpaceBeforeSquareBrackets: false
|
||||||
SpaceInEmptyBlock: false
|
SpaceInEmptyBlock: false
|
||||||
SpaceInEmptyParentheses: false
|
SpaceInEmptyParentheses: false
|
||||||
SpacesBeforeTrailingComments: 1
|
SpacesBeforeTrailingComments: 1
|
||||||
SpacesInAngles: false
|
SpacesInAngles: false
|
||||||
|
SpacesInCStyleCastParentheses: false
|
||||||
SpacesInConditionalStatement: false
|
SpacesInConditionalStatement: false
|
||||||
SpacesInContainerLiterals: false
|
SpacesInContainerLiterals: false
|
||||||
SpacesInCStyleCastParentheses: false
|
|
||||||
SpacesInParentheses: false
|
SpacesInParentheses: false
|
||||||
SpacesInSquareBrackets: false
|
SpacesInSquareBrackets: false
|
||||||
SpaceBeforeSquareBrackets: false
|
|
||||||
SpaceAroundPointerQualifiers: Default
|
|
||||||
Standard: Latest
|
Standard: Latest
|
||||||
StatementMacros:
|
StatementMacros:
|
||||||
- Q_UNUSED
|
- Q_UNUSED
|
||||||
- QT_REQUIRE_VERSION
|
- QT_REQUIRE_VERSION
|
||||||
TabWidth: 8
|
TabWidth: 8
|
||||||
UseCRLF: false
|
|
||||||
UseTab: Never
|
UseTab: Never
|
||||||
...
|
|
||||||
|
|
78
.github/workflows/format.yml
vendored
78
.github/workflows/format.yml
vendored
|
@ -2,18 +2,18 @@ name: Code formatting
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [main]
|
||||||
paths:
|
paths:
|
||||||
- '**.cpp'
|
- "src/**.cpp"
|
||||||
- '**.h'
|
- "src/**.h"
|
||||||
- '!src/libs/**'
|
- "!src/libs/**"
|
||||||
- '!src/FreeRTOS/**'
|
- "!src/FreeRTOS/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-format:
|
test-format:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1000
|
fetch-depth: 1000
|
||||||
|
|
||||||
|
@ -23,48 +23,48 @@ jobs:
|
||||||
- name: Install clang-format
|
- name: Install clang-format
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -y install clang-format-14
|
sudo apt-get -y install clang-format-16
|
||||||
|
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
run: tests/test-format.sh
|
run: tests/test-format.sh
|
||||||
|
|
||||||
- name: Upload patches
|
- name: Upload patches
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
name: Patches
|
name: Patches
|
||||||
path: ./*.patch
|
path: ./*.patch
|
||||||
test-clang-tidy:
|
test-clang-tidy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
container:
|
container:
|
||||||
image: infinitime/infinitime-build
|
image: infinitime/infinitime-build
|
||||||
steps:
|
steps:
|
||||||
# This workaround fixes the error "unsafe repository (REPO is owned by someone else)".
|
# 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
|
# 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
|
# The fix in "actions/checkout@v2" was not sufficient as the build process also uses git (to get the current
|
||||||
# commit hash, for example).
|
# commit hash, for example).
|
||||||
- name: Workaround permission issues
|
- name: Workaround permission issues
|
||||||
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||||
- name: Checkout source files
|
- name: Checkout source files
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
fetch-depth: 1000
|
fetch-depth: 1000
|
||||||
- name: Fetch base branch
|
- name: Fetch base branch
|
||||||
run: git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF"
|
run: git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF"
|
||||||
- name: Install clang-tidy
|
- name: Install clang-tidy
|
||||||
run: |
|
run: |
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get -y install clang-tidy-14
|
apt-get -y install clang-tidy-16
|
||||||
- name: Prepare environment
|
- name: Prepare environment
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
SOURCES_DIR: .
|
SOURCES_DIR: .
|
||||||
run: |
|
run: |
|
||||||
. docker/build.sh
|
. docker/build.sh
|
||||||
GetGcc
|
GetGcc
|
||||||
# I guess these already exist inside the docker?
|
# I guess these already exist inside the docker?
|
||||||
#GetNrfSdk
|
#GetNrfSdk
|
||||||
#GetMcuBoot
|
#GetMcuBoot
|
||||||
CmakeGenerate
|
CmakeGenerate
|
||||||
- run: tests/test-tidy.sh
|
- run: tests/test-tidy.sh
|
||||||
|
|
|
@ -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-//')"
|
name="$(basename -a $(find $(echo "$PATH" | tr ':' ' ') -maxdepth 1 -type f -executable -name 'git-clang-format*') | sort | tail -n 1 | sed 's/^git-//')"
|
||||||
fi
|
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
|
for file in $(find $(echo "$PATH" | tr ':' ' ') -maxdepth 1 -type f -executable -name 'clang-format*'); do
|
||||||
curBin="$file"
|
curBin="$file"
|
||||||
|
@ -23,7 +23,7 @@ if [ -z "$name" ] || [ -z "$bin" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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)"
|
changedFiles="$(git "$name" --diffstat $args)"
|
||||||
git "$name" $args
|
git "$name" $args
|
||||||
|
|
|
@ -81,8 +81,9 @@ int AlertNotificationClient::OnCharacteristicsDiscoveryEvent(uint16_t connection
|
||||||
NRF_LOG_INFO("ANS Characteristic discovery complete");
|
NRF_LOG_INFO("ANS Characteristic discovery complete");
|
||||||
if (isCharacteristicDiscovered) {
|
if (isCharacteristicDiscovered) {
|
||||||
ble_gattc_disc_all_dscs(connectionHandle, newAlertHandle, ansEndHandle, OnAlertNotificationDescriptorDiscoveryEventCallback, this);
|
ble_gattc_disc_all_dscs(connectionHandle, newAlertHandle, ansEndHandle, OnAlertNotificationDescriptorDiscoveryEventCallback, this);
|
||||||
} else
|
} else {
|
||||||
onServiceDiscovered(connectionHandle);
|
onServiceDiscovered(connectionHandle);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (characteristic != nullptr && ble_uuid_cmp(&supportedNewAlertCategoryUuid.u, &characteristic->uuid.u) == 0) {
|
if (characteristic != nullptr && ble_uuid_cmp(&supportedNewAlertCategoryUuid.u, &characteristic->uuid.u) == 0) {
|
||||||
NRF_LOG_INFO("ANS Characteristic discovered : supportedNewAlertCategoryUuid");
|
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) {
|
} else if (characteristic != nullptr && ble_uuid_cmp(&controlPointUuid.u, &characteristic->uuid.u) == 0) {
|
||||||
NRF_LOG_INFO("ANS Characteristic discovered : controlPointUuid");
|
NRF_LOG_INFO("ANS Characteristic discovered : controlPointUuid");
|
||||||
controlPointHandle = characteristic->val_handle;
|
controlPointHandle = characteristic->val_handle;
|
||||||
} else
|
} else {
|
||||||
NRF_LOG_INFO("ANS Characteristic discovered : 0x%x", characteristic->val_handle);
|
NRF_LOG_INFO("ANS Characteristic discovered : 0x%x", characteristic->val_handle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -135,8 +137,9 @@ int AlertNotificationClient::OnDescriptorDiscoveryEventCallback(uint16_t connect
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!isDescriptorFound)
|
if (!isDescriptorFound) {
|
||||||
onServiceDiscovered(connectionHandle);
|
onServiceDiscovered(connectionHandle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -150,8 +153,9 @@ void AlertNotificationClient::OnNotification(ble_gap_event* event) {
|
||||||
|
|
||||||
// Ignore notifications with empty message
|
// Ignore notifications with empty message
|
||||||
const auto packetLen = OS_MBUF_PKTLEN(event->notify_rx.om);
|
const auto packetLen = OS_MBUF_PKTLEN(event->notify_rx.om);
|
||||||
if (packetLen <= headerSize)
|
if (packetLen <= headerSize) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
size_t bufferSize = std::min(packetLen + stringTerminatorSize, maxBufferSize);
|
size_t bufferSize = std::min(packetLen + stringTerminatorSize, maxBufferSize);
|
||||||
auto messageSize = std::min(maxMessageSize, (bufferSize - headerSize));
|
auto messageSize = std::min(maxMessageSize, (bufferSize - headerSize));
|
||||||
|
|
|
@ -9,4 +9,4 @@ namespace Pinetime {
|
||||||
virtual void Discover(uint16_t connectionHandle, std::function<void(uint16_t)> lambda) = 0;
|
virtual void Discover(uint16_t connectionHandle, std::function<void(uint16_t)> lambda) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,20 +87,23 @@ int DfuService::OnServiceData(uint16_t connectionHandle, uint16_t attributeHandl
|
||||||
ble_gatts_find_chr(&serviceUuid.u, &revisionCharacteristicUuid.u, nullptr, &revisionCharacteristicHandle);
|
ble_gatts_find_chr(&serviceUuid.u, &revisionCharacteristicUuid.u, nullptr, &revisionCharacteristicHandle);
|
||||||
|
|
||||||
if (attributeHandle == packetCharacteristicHandle) {
|
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);
|
return WritePacketHandler(connectionHandle, context->om);
|
||||||
else
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
} else if (attributeHandle == controlPointCharacteristicHandle) {
|
} 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);
|
return ControlPointHandler(connectionHandle, context->om);
|
||||||
else
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
} else if (attributeHandle == revisionCharacteristicHandle) {
|
} 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);
|
return SendDfuRevision(context->om);
|
||||||
else
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
NRF_LOG_INFO("[DFU] Unknown Characteristic : %d", attributeHandle);
|
NRF_LOG_INFO("[DFU] Unknown Characteristic : %d", attributeHandle);
|
||||||
return 0;
|
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) {
|
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;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
connectionHandle = connection;
|
connectionHandle = connection;
|
||||||
characteristicHandle = charactHandle;
|
characteristicHandle = charactHandle;
|
||||||
|
@ -353,8 +357,9 @@ void DfuService::NotificationManager::Reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc) {
|
void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc) {
|
||||||
if (chunkSize != 20)
|
if (chunkSize != 20) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
this->chunkSize = chunkSize;
|
this->chunkSize = chunkSize;
|
||||||
this->totalSize = totalSize;
|
this->totalSize = totalSize;
|
||||||
this->expectedCrc = expectedCrc;
|
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) {
|
void DfuService::DfuImage::Append(uint8_t* data, size_t size) {
|
||||||
if (!ready)
|
if (!ready) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
ASSERT(size <= 20);
|
ASSERT(size <= 20);
|
||||||
|
|
||||||
std::memcpy(tempBuffer + bufferWriteIndex, data, size);
|
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) {
|
if (bufferWriteIndex > 0 && totalWriteIndex + bufferWriteIndex == totalSize) {
|
||||||
spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex);
|
spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex);
|
||||||
totalWriteIndex += bufferWriteIndex;
|
totalWriteIndex += bufferWriteIndex;
|
||||||
if (totalSize < maxSize)
|
if (totalSize < maxSize) {
|
||||||
WriteMagicNumber();
|
WriteMagicNumber();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,8 +424,9 @@ bool DfuService::DfuImage::Validate() {
|
||||||
if (first) {
|
if (first) {
|
||||||
crc = ComputeCrc(tempBuffer, readSize, NULL);
|
crc = ComputeCrc(tempBuffer, readSize, NULL);
|
||||||
first = false;
|
first = false;
|
||||||
} else
|
} else {
|
||||||
crc = ComputeCrc(tempBuffer, readSize, &crc);
|
crc = ComputeCrc(tempBuffer, readSize, &crc);
|
||||||
|
}
|
||||||
currentOffset += readSize;
|
currentOffset += readSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -440,7 +448,8 @@ uint16_t DfuService::DfuImage::ComputeCrc(uint8_t const* p_data, uint32_t size,
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DfuService::DfuImage::IsComplete() {
|
bool DfuService::DfuImage::IsComplete() {
|
||||||
if (!ready)
|
if (!ready) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return totalWriteIndex == totalSize;
|
return totalWriteIndex == totalSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -159,4 +159,4 @@ namespace Pinetime {
|
||||||
TimerHandle_t timeoutTimer;
|
TimerHandle_t timeoutTimer;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,9 @@ int HeartRateService::OnHeartRateRequested(uint16_t attributeHandle, ble_gatt_ac
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateService::OnNewHeartRateValue(uint8_t heartRateValue) {
|
void HeartRateService::OnNewHeartRateValue(uint8_t heartRateValue) {
|
||||||
if (!heartRateMeasurementNotificationEnable)
|
if (!heartRateMeasurementNotificationEnable) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t buffer[2] = {0, heartRateValue}; // [0] = flags, [1] = hr value
|
uint8_t buffer[2] = {0, heartRateValue}; // [0] = flags, [1] = hr value
|
||||||
auto* om = ble_hs_mbuf_from_flat(buffer, 2);
|
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) {
|
void HeartRateService::SubscribeNotification(uint16_t attributeHandle) {
|
||||||
if (attributeHandle == heartRateMeasurementHandle)
|
if (attributeHandle == heartRateMeasurementHandle) {
|
||||||
heartRateMeasurementNotificationEnable = true;
|
heartRateMeasurementNotificationEnable = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeartRateService::UnsubscribeNotification(uint16_t attributeHandle) {
|
void HeartRateService::UnsubscribeNotification(uint16_t attributeHandle) {
|
||||||
if (attributeHandle == heartRateMeasurementHandle)
|
if (attributeHandle == heartRateMeasurementHandle) {
|
||||||
heartRateMeasurementNotificationEnable = false;
|
heartRateMeasurementNotificationEnable = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,8 +76,9 @@ int MotionService::OnStepCountRequested(uint16_t attributeHandle, ble_gatt_acces
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionService::OnNewStepCountValue(uint32_t stepCount) {
|
void MotionService::OnNewStepCountValue(uint32_t stepCount) {
|
||||||
if (!stepCountNoficationEnabled)
|
if (!stepCountNoficationEnabled) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t buffer = stepCount;
|
uint32_t buffer = stepCount;
|
||||||
auto* om = ble_hs_mbuf_from_flat(&buffer, 4);
|
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) {
|
void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) {
|
||||||
if (!motionValuesNoficationEnabled)
|
if (!motionValuesNoficationEnabled) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int16_t buffer[3] = {x, y, z};
|
int16_t buffer[3] = {x, y, z};
|
||||||
auto* om = ble_hs_mbuf_from_flat(buffer, 3 * sizeof(int16_t));
|
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) {
|
void MotionService::SubscribeNotification(uint16_t attributeHandle) {
|
||||||
if (attributeHandle == stepCountHandle)
|
if (attributeHandle == stepCountHandle) {
|
||||||
stepCountNoficationEnabled = true;
|
stepCountNoficationEnabled = true;
|
||||||
else if (attributeHandle == motionValuesHandle)
|
} else if (attributeHandle == motionValuesHandle) {
|
||||||
motionValuesNoficationEnabled = true;
|
motionValuesNoficationEnabled = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MotionService::UnsubscribeNotification(uint16_t attributeHandle) {
|
void MotionService::UnsubscribeNotification(uint16_t attributeHandle) {
|
||||||
if (attributeHandle == stepCountHandle)
|
if (attributeHandle == stepCountHandle) {
|
||||||
stepCountNoficationEnabled = false;
|
stepCountNoficationEnabled = false;
|
||||||
else if (attributeHandle == motionValuesHandle)
|
} else if (attributeHandle == motionValuesHandle) {
|
||||||
motionValuesNoficationEnabled = false;
|
motionValuesNoficationEnabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotionService::IsMotionNotificationSubscribed() const {
|
bool MotionService::IsMotionNotificationSubscribed() const {
|
||||||
|
|
|
@ -57,26 +57,26 @@ namespace Pinetime {
|
||||||
|
|
||||||
Pinetime::Controllers::MusicService& music() {
|
Pinetime::Controllers::MusicService& music() {
|
||||||
return musicService;
|
return musicService;
|
||||||
};
|
}
|
||||||
|
|
||||||
Pinetime::Controllers::NavigationService& navigation() {
|
Pinetime::Controllers::NavigationService& navigation() {
|
||||||
return navService;
|
return navService;
|
||||||
};
|
}
|
||||||
|
|
||||||
Pinetime::Controllers::AlertNotificationService& alertService() {
|
Pinetime::Controllers::AlertNotificationService& alertService() {
|
||||||
return anService;
|
return anService;
|
||||||
};
|
}
|
||||||
|
|
||||||
Pinetime::Controllers::SimpleWeatherService& weather() {
|
Pinetime::Controllers::SimpleWeatherService& weather() {
|
||||||
return weatherService;
|
return weatherService;
|
||||||
};
|
}
|
||||||
|
|
||||||
uint16_t connHandle();
|
uint16_t connHandle();
|
||||||
void NotifyBatteryLevel(uint8_t level);
|
void NotifyBatteryLevel(uint8_t level);
|
||||||
|
|
||||||
void RestartFastAdv() {
|
void RestartFastAdv() {
|
||||||
fastAdvCount = 0;
|
fastAdvCount = 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
void EnableRadio();
|
void EnableRadio();
|
||||||
void DisableRadio();
|
void DisableRadio();
|
||||||
|
|
|
@ -51,7 +51,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static constexpr size_t MaximumMessageSize() {
|
static constexpr size_t MaximumMessageSize() {
|
||||||
return MessageSize;
|
return MessageSize;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool IsEmpty() const {
|
bool IsEmpty() const {
|
||||||
return size == 0;
|
return size == 0;
|
||||||
|
|
|
@ -29,4 +29,4 @@ void ServiceDiscovery::DiscoverNextService(uint16_t connectionHandle) {
|
||||||
this->OnServiceDiscovered(connectionHandle);
|
this->OnServiceDiscovered(connectionHandle);
|
||||||
};
|
};
|
||||||
(*clientIterator)->Discover(connectionHandle, discoverNextService);
|
(*clientIterator)->Discover(connectionHandle, discoverNextService);
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,8 +114,9 @@ void DateTime::UpdateTime(uint32_t systickCounter, bool forceUpdate) {
|
||||||
// Notify new day to SystemTask
|
// Notify new day to SystemTask
|
||||||
if (hour == 0 and not isMidnightAlreadyNotified) {
|
if (hour == 0 and not isMidnightAlreadyNotified) {
|
||||||
isMidnightAlreadyNotified = true;
|
isMidnightAlreadyNotified = true;
|
||||||
if (systemTask != nullptr)
|
if (systemTask != nullptr) {
|
||||||
systemTask->PushMessage(System::Messages::OnNewDay);
|
systemTask->PushMessage(System::Messages::OnNewDay);
|
||||||
|
}
|
||||||
} else if (hour != 0) {
|
} else if (hour != 0) {
|
||||||
isMidnightAlreadyNotified = false;
|
isMidnightAlreadyNotified = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,9 @@ bool FirmwareValidator::IsValidated() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FirmwareValidator::Validate() {
|
void FirmwareValidator::Validate() {
|
||||||
if (!IsValidated())
|
if (!IsValidated()) {
|
||||||
Pinetime::Drivers::InternalFlash::WriteWord(validBitAdress, validBitValue);
|
Pinetime::Drivers::InternalFlash::WriteWord(validBitAdress, validBitValue);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FirmwareValidator::Reset() {
|
void FirmwareValidator::Reset() {
|
||||||
|
|
|
@ -41,4 +41,4 @@ namespace Pinetime {
|
||||||
Pinetime::Controllers::HeartRateService* service = nullptr;
|
Pinetime::Controllers::HeartRateService* service = nullptr;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -276,10 +276,12 @@ float Ppg::HeartRateAverage(float hr) {
|
||||||
for (const float& value : dataAverage) {
|
for (const float& value : dataAverage) {
|
||||||
if (value > 0.0f) {
|
if (value > 0.0f) {
|
||||||
avg += value;
|
avg += value;
|
||||||
if (value < min)
|
if (value < min) {
|
||||||
min = value;
|
min = value;
|
||||||
if (value > max)
|
}
|
||||||
|
if (value > max) {
|
||||||
max = value;
|
max = value;
|
||||||
|
}
|
||||||
total++;
|
total++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,10 @@ void RleDecoder::DecodeNext(uint8_t* output, size_t maxBytes) {
|
||||||
}
|
}
|
||||||
processedCount = 0;
|
processedCount = 0;
|
||||||
|
|
||||||
if (color == backgroundColor)
|
if (color == backgroundColor) {
|
||||||
color = foregroundColor;
|
color = foregroundColor;
|
||||||
else
|
} else {
|
||||||
color = backgroundColor;
|
color = backgroundColor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,158 +65,163 @@ namespace Pinetime {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
settings.watchFace = face;
|
settings.watchFace = face;
|
||||||
};
|
}
|
||||||
|
|
||||||
Pinetime::Applications::WatchFace GetWatchFace() const {
|
Pinetime::Applications::WatchFace GetWatchFace() const {
|
||||||
return settings.watchFace;
|
return settings.watchFace;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetChimeOption(ChimesOption chimeOption) {
|
void SetChimeOption(ChimesOption chimeOption) {
|
||||||
if (chimeOption != settings.chimesOption) {
|
if (chimeOption != settings.chimesOption) {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
settings.chimesOption = chimeOption;
|
settings.chimesOption = chimeOption;
|
||||||
};
|
}
|
||||||
|
|
||||||
ChimesOption GetChimeOption() const {
|
ChimesOption GetChimeOption() const {
|
||||||
return settings.chimesOption;
|
return settings.chimesOption;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetPTSColorTime(Colors colorTime) {
|
void SetPTSColorTime(Colors colorTime) {
|
||||||
if (colorTime != settings.PTS.ColorTime)
|
if (colorTime != settings.PTS.ColorTime) {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
|
}
|
||||||
settings.PTS.ColorTime = colorTime;
|
settings.PTS.ColorTime = colorTime;
|
||||||
};
|
}
|
||||||
|
|
||||||
Colors GetPTSColorTime() const {
|
Colors GetPTSColorTime() const {
|
||||||
return settings.PTS.ColorTime;
|
return settings.PTS.ColorTime;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetPTSColorBar(Colors colorBar) {
|
void SetPTSColorBar(Colors colorBar) {
|
||||||
if (colorBar != settings.PTS.ColorBar)
|
if (colorBar != settings.PTS.ColorBar) {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
|
}
|
||||||
settings.PTS.ColorBar = colorBar;
|
settings.PTS.ColorBar = colorBar;
|
||||||
};
|
}
|
||||||
|
|
||||||
Colors GetPTSColorBar() const {
|
Colors GetPTSColorBar() const {
|
||||||
return settings.PTS.ColorBar;
|
return settings.PTS.ColorBar;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetPTSColorBG(Colors colorBG) {
|
void SetPTSColorBG(Colors colorBG) {
|
||||||
if (colorBG != settings.PTS.ColorBG)
|
if (colorBG != settings.PTS.ColorBG) {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
|
}
|
||||||
settings.PTS.ColorBG = colorBG;
|
settings.PTS.ColorBG = colorBG;
|
||||||
};
|
}
|
||||||
|
|
||||||
Colors GetPTSColorBG() const {
|
Colors GetPTSColorBG() const {
|
||||||
return settings.PTS.ColorBG;
|
return settings.PTS.ColorBG;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetInfineatShowSideCover(bool show) {
|
void SetInfineatShowSideCover(bool show) {
|
||||||
if (show != settings.watchFaceInfineat.showSideCover) {
|
if (show != settings.watchFaceInfineat.showSideCover) {
|
||||||
settings.watchFaceInfineat.showSideCover = show;
|
settings.watchFaceInfineat.showSideCover = show;
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
bool GetInfineatShowSideCover() const {
|
bool GetInfineatShowSideCover() const {
|
||||||
return settings.watchFaceInfineat.showSideCover;
|
return settings.watchFaceInfineat.showSideCover;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetInfineatColorIndex(int index) {
|
void SetInfineatColorIndex(int index) {
|
||||||
if (index != settings.watchFaceInfineat.colorIndex) {
|
if (index != settings.watchFaceInfineat.colorIndex) {
|
||||||
settings.watchFaceInfineat.colorIndex = index;
|
settings.watchFaceInfineat.colorIndex = index;
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
int GetInfineatColorIndex() const {
|
int GetInfineatColorIndex() const {
|
||||||
return settings.watchFaceInfineat.colorIndex;
|
return settings.watchFaceInfineat.colorIndex;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetPTSGaugeStyle(PTSGaugeStyle gaugeStyle) {
|
void SetPTSGaugeStyle(PTSGaugeStyle gaugeStyle) {
|
||||||
if (gaugeStyle != settings.PTS.gaugeStyle)
|
if (gaugeStyle != settings.PTS.gaugeStyle) {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
|
}
|
||||||
settings.PTS.gaugeStyle = gaugeStyle;
|
settings.PTS.gaugeStyle = gaugeStyle;
|
||||||
};
|
}
|
||||||
|
|
||||||
PTSGaugeStyle GetPTSGaugeStyle() const {
|
PTSGaugeStyle GetPTSGaugeStyle() const {
|
||||||
return settings.PTS.gaugeStyle;
|
return settings.PTS.gaugeStyle;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetPTSWeather(PTSWeather weatherEnable) {
|
void SetPTSWeather(PTSWeather weatherEnable) {
|
||||||
if (weatherEnable != settings.PTS.weatherEnable)
|
if (weatherEnable != settings.PTS.weatherEnable) {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
|
}
|
||||||
settings.PTS.weatherEnable = weatherEnable;
|
settings.PTS.weatherEnable = weatherEnable;
|
||||||
};
|
}
|
||||||
|
|
||||||
PTSWeather GetPTSWeather() const {
|
PTSWeather GetPTSWeather() const {
|
||||||
return settings.PTS.weatherEnable;
|
return settings.PTS.weatherEnable;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetAppMenu(uint8_t menu) {
|
void SetAppMenu(uint8_t menu) {
|
||||||
appMenu = menu;
|
appMenu = menu;
|
||||||
};
|
}
|
||||||
|
|
||||||
uint8_t GetAppMenu() const {
|
uint8_t GetAppMenu() const {
|
||||||
return appMenu;
|
return appMenu;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetSettingsMenu(uint8_t menu) {
|
void SetSettingsMenu(uint8_t menu) {
|
||||||
settingsMenu = menu;
|
settingsMenu = menu;
|
||||||
};
|
}
|
||||||
|
|
||||||
uint8_t GetSettingsMenu() const {
|
uint8_t GetSettingsMenu() const {
|
||||||
return settingsMenu;
|
return settingsMenu;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetClockType(ClockType clocktype) {
|
void SetClockType(ClockType clocktype) {
|
||||||
if (clocktype != settings.clockType) {
|
if (clocktype != settings.clockType) {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
settings.clockType = clocktype;
|
settings.clockType = clocktype;
|
||||||
};
|
}
|
||||||
|
|
||||||
ClockType GetClockType() const {
|
ClockType GetClockType() const {
|
||||||
return settings.clockType;
|
return settings.clockType;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetWeatherFormat(WeatherFormat weatherFormat) {
|
void SetWeatherFormat(WeatherFormat weatherFormat) {
|
||||||
if (weatherFormat != settings.weatherFormat) {
|
if (weatherFormat != settings.weatherFormat) {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
settings.weatherFormat = weatherFormat;
|
settings.weatherFormat = weatherFormat;
|
||||||
};
|
}
|
||||||
|
|
||||||
WeatherFormat GetWeatherFormat() const {
|
WeatherFormat GetWeatherFormat() const {
|
||||||
return settings.weatherFormat;
|
return settings.weatherFormat;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetNotificationStatus(Notification status) {
|
void SetNotificationStatus(Notification status) {
|
||||||
if (status != settings.notificationStatus) {
|
if (status != settings.notificationStatus) {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
settings.notificationStatus = status;
|
settings.notificationStatus = status;
|
||||||
};
|
}
|
||||||
|
|
||||||
Notification GetNotificationStatus() const {
|
Notification GetNotificationStatus() const {
|
||||||
return settings.notificationStatus;
|
return settings.notificationStatus;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetScreenTimeOut(uint32_t timeout) {
|
void SetScreenTimeOut(uint32_t timeout) {
|
||||||
if (timeout != settings.screenTimeOut) {
|
if (timeout != settings.screenTimeOut) {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
settings.screenTimeOut = timeout;
|
settings.screenTimeOut = timeout;
|
||||||
};
|
}
|
||||||
|
|
||||||
uint32_t GetScreenTimeOut() const {
|
uint32_t GetScreenTimeOut() const {
|
||||||
return settings.screenTimeOut;
|
return settings.screenTimeOut;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool GetAlwaysOnDisplay() const {
|
bool GetAlwaysOnDisplay() const {
|
||||||
return settings.alwaysOnDisplay && GetNotificationStatus() != Notification::Sleep;
|
return settings.alwaysOnDisplay && GetNotificationStatus() != Notification::Sleep;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetAlwaysOnDisplaySetting(bool state) {
|
void SetAlwaysOnDisplaySetting(bool state) {
|
||||||
if (state != settings.alwaysOnDisplay) {
|
if (state != settings.alwaysOnDisplay) {
|
||||||
|
@ -258,7 +263,7 @@ namespace Pinetime {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
std::bitset<5> getWakeUpModes() const {
|
std::bitset<5> getWakeUpModes() const {
|
||||||
return settings.wakeUpMode;
|
return settings.wakeUpMode;
|
||||||
|
@ -273,30 +278,30 @@ namespace Pinetime {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
settings.brightLevel = level;
|
settings.brightLevel = level;
|
||||||
};
|
}
|
||||||
|
|
||||||
Controllers::BrightnessController::Levels GetBrightness() const {
|
Controllers::BrightnessController::Levels GetBrightness() const {
|
||||||
return settings.brightLevel;
|
return settings.brightLevel;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetStepsGoal(uint32_t goal) {
|
void SetStepsGoal(uint32_t goal) {
|
||||||
if (goal != settings.stepsGoal) {
|
if (goal != settings.stepsGoal) {
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
}
|
}
|
||||||
settings.stepsGoal = goal;
|
settings.stepsGoal = goal;
|
||||||
};
|
}
|
||||||
|
|
||||||
uint32_t GetStepsGoal() const {
|
uint32_t GetStepsGoal() const {
|
||||||
return settings.stepsGoal;
|
return settings.stepsGoal;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SetBleRadioEnabled(bool enabled) {
|
void SetBleRadioEnabled(bool enabled) {
|
||||||
bleRadioEnabled = enabled;
|
bleRadioEnabled = enabled;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool GetBleRadioEnabled() const {
|
bool GetBleRadioEnabled() const {
|
||||||
return bleRadioEnabled;
|
return bleRadioEnabled;
|
||||||
};
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Pinetime::Controllers::FS& fs;
|
Pinetime::Controllers::FS& fs;
|
||||||
|
|
|
@ -7,4 +7,4 @@ namespace Pinetime {
|
||||||
namespace Applications {
|
namespace Applications {
|
||||||
lv_color_t Convert(Controllers::Settings::Colors color);
|
lv_color_t Convert(Controllers::Settings::Colors color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,9 +513,9 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
|
||||||
std::find_if(userWatchFaces.begin(), userWatchFaces.end(), [this](const WatchFaceDescription& watchfaceDescription) {
|
std::find_if(userWatchFaces.begin(), userWatchFaces.end(), [this](const WatchFaceDescription& watchfaceDescription) {
|
||||||
return watchfaceDescription.watchFace == settingsController.GetWatchFace();
|
return watchfaceDescription.watchFace == settingsController.GetWatchFace();
|
||||||
});
|
});
|
||||||
if (watchFace != userWatchFaces.end())
|
if (watchFace != userWatchFaces.end()) {
|
||||||
currentScreen.reset(watchFace->create(controllers));
|
currentScreen.reset(watchFace->create(controllers));
|
||||||
else {
|
} else {
|
||||||
currentScreen.reset(userWatchFaces[0].create(controllers));
|
currentScreen.reset(userWatchFaces[0].create(controllers));
|
||||||
}
|
}
|
||||||
settingsController.SetAppMenu(0);
|
settingsController.SetAppMenu(0);
|
||||||
|
|
|
@ -31,8 +31,9 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
|
||||||
|
|
||||||
void DisplayApp::Start() {
|
void DisplayApp::Start() {
|
||||||
msgQueue = xQueueCreate(queueSize, itemSize);
|
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);
|
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayApp::Process(void* instance) {
|
void DisplayApp::Process(void* instance) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
void Start(Pinetime::System::BootErrors) {
|
void Start(Pinetime::System::BootErrors) {
|
||||||
Start();
|
Start();
|
||||||
};
|
}
|
||||||
|
|
||||||
void PushMessage(Pinetime::Applications::Display::Messages msg);
|
void PushMessage(Pinetime::Applications::Display::Messages msg);
|
||||||
void Register(Pinetime::System::SystemTask* systemTask);
|
void Register(Pinetime::System::SystemTask* systemTask);
|
||||||
|
|
|
@ -176,9 +176,9 @@ void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
|
||||||
toScroll = height;
|
toScroll = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scrollOffset >= toScroll)
|
if (scrollOffset >= toScroll) {
|
||||||
scrollOffset -= toScroll;
|
scrollOffset -= toScroll;
|
||||||
else {
|
} else {
|
||||||
toScroll -= scrollOffset;
|
toScroll -= scrollOffset;
|
||||||
scrollOffset = (totalNbLines) -toScroll;
|
scrollOffset = (totalNbLines) -toScroll;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,4 +5,4 @@ namespace Pinetime {
|
||||||
|
|
||||||
enum class TouchEvents { None, Tap, SwipeLeft, SwipeRight, SwipeUp, SwipeDown, LongTap, DoubleTap };
|
enum class TouchEvents { None, Tap, SwipeLeft, SwipeRight, SwipeUp, SwipeDown, LongTap, DoubleTap };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace Pinetime {
|
||||||
controllers.settingsController.GetClockType(),
|
controllers.settingsController.GetClockType(),
|
||||||
*controllers.systemTask,
|
*controllers.systemTask,
|
||||||
controllers.motorController);
|
controllers.motorController);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,9 @@ void BatteryIcon::SetColor(lv_color_t color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* BatteryIcon::GetPlugIcon(bool isCharging) {
|
const char* BatteryIcon::GetPlugIcon(bool isCharging) {
|
||||||
if (isCharging)
|
if (isCharging) {
|
||||||
return Symbols::plug;
|
return Symbols::plug;
|
||||||
else
|
} else {
|
||||||
return "";
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,8 +150,9 @@ void Dice::Refresh() {
|
||||||
|
|
||||||
Roll();
|
Roll();
|
||||||
}
|
}
|
||||||
} else if (currentRollHysteresis > 0)
|
} else if (currentRollHysteresis > 0) {
|
||||||
--currentRollHysteresis;
|
--currentRollHysteresis;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dice::Roll() {
|
void Dice::Roll() {
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Dice(controllers.motionController, controllers.motorController, controllers.settingsController);
|
return new Screens::Dice(controllers.motionController, controllers.motorController, controllers.settingsController);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::HeartRate(controllers.heartRateController, *controllers.systemTask);
|
return new Screens::HeartRate(controllers.heartRateController, *controllers.systemTask);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::InfiniPaint(controllers.lvgl, controllers.motorController);
|
return new Screens::InfiniPaint(controllers.lvgl, controllers.motorController);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Metronome(controllers.motorController, *controllers.systemTask);
|
return new Screens::Metronome(controllers.motorController, *controllers.systemTask);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Motion(controllers.motionController);
|
return new Screens::Motion(controllers.motionController);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Music(*controllers.musicService);
|
return new Screens::Music(*controllers.musicService);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Navigation(*controllers.navigationService);
|
return new Screens::Navigation(*controllers.navigationService);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,9 @@
|
||||||
using namespace Pinetime::Applications::Screens;
|
using namespace Pinetime::Applications::Screens;
|
||||||
|
|
||||||
const char* NotificationIcon::GetIcon(bool newNotificationAvailable) {
|
const char* NotificationIcon::GetIcon(bool newNotificationAvailable) {
|
||||||
if (newNotificationAvailable)
|
if (newNotificationAvailable) {
|
||||||
return Symbols::info;
|
return Symbols::info;
|
||||||
else
|
} else {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -9,4 +9,4 @@ namespace Pinetime {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Paddle(controllers.lvgl);
|
return new Screens::Paddle(controllers.lvgl);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Steps(controllers.motionController, controllers.settingsController);
|
return new Screens::Steps(controllers.motionController, controllers.settingsController);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::StopWatch(*controllers.systemTask);
|
return new Screens::StopWatch(*controllers.systemTask);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,6 +180,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
|
||||||
|
|
||||||
extern int mallocFailedCount;
|
extern int mallocFailedCount;
|
||||||
extern int stackOverflowCount;
|
extern int stackOverflowCount;
|
||||||
|
|
||||||
std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
|
std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
|
||||||
lv_mem_monitor_t mon;
|
lv_mem_monitor_t mon;
|
||||||
lv_mem_monitor(&mon);
|
lv_mem_monitor(&mon);
|
||||||
|
|
|
@ -56,6 +56,6 @@ namespace Pinetime::Applications {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Timer(controllers.timer);
|
return new Screens::Timer(controllers.timer);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& /*controllers*/) {
|
static Screens::Screen* Create(AppControllers& /*controllers*/) {
|
||||||
return new Screens::Twos();
|
return new Screens::Twos();
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ namespace Pinetime {
|
||||||
controllers.bleController,
|
controllers.bleController,
|
||||||
controllers.notificationManager,
|
controllers.notificationManager,
|
||||||
controllers.settingsController);
|
controllers.settingsController);
|
||||||
};
|
}
|
||||||
|
|
||||||
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
|
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -116,7 +116,7 @@ namespace Pinetime {
|
||||||
controllers.heartRateController,
|
controllers.heartRateController,
|
||||||
controllers.motionController,
|
controllers.motionController,
|
||||||
controllers.filesystem);
|
controllers.filesystem);
|
||||||
};
|
}
|
||||||
|
|
||||||
static bool IsAvailable(Pinetime::Controllers::FS& filesystem) {
|
static bool IsAvailable(Pinetime::Controllers::FS& filesystem) {
|
||||||
return Screens::WatchFaceCasioStyleG7710::IsAvailable(filesystem);
|
return Screens::WatchFaceCasioStyleG7710::IsAvailable(filesystem);
|
||||||
|
|
|
@ -89,7 +89,7 @@ namespace Pinetime {
|
||||||
controllers.heartRateController,
|
controllers.heartRateController,
|
||||||
controllers.motionController,
|
controllers.motionController,
|
||||||
*controllers.weatherController);
|
*controllers.weatherController);
|
||||||
};
|
}
|
||||||
|
|
||||||
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
|
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -374,8 +374,9 @@ void WatchFaceInfineat::UpdateSelected(lv_obj_t* object, lv_event_t event) {
|
||||||
}
|
}
|
||||||
if (object == btnPrevColor) {
|
if (object == btnPrevColor) {
|
||||||
colorIndex -= 1;
|
colorIndex -= 1;
|
||||||
if (colorIndex < 0)
|
if (colorIndex < 0) {
|
||||||
colorIndex = nColors - 1;
|
colorIndex = nColors - 1;
|
||||||
|
}
|
||||||
settingsController.SetInfineatColorIndex(colorIndex);
|
settingsController.SetInfineatColorIndex(colorIndex);
|
||||||
}
|
}
|
||||||
if (object == btnNextColor || object == btnPrevColor) {
|
if (object == btnNextColor || object == btnPrevColor) {
|
||||||
|
|
|
@ -113,7 +113,7 @@ namespace Pinetime {
|
||||||
controllers.settingsController,
|
controllers.settingsController,
|
||||||
controllers.motionController,
|
controllers.motionController,
|
||||||
controllers.filesystem);
|
controllers.filesystem);
|
||||||
};
|
}
|
||||||
|
|
||||||
static bool IsAvailable(Pinetime::Controllers::FS& filesystem) {
|
static bool IsAvailable(Pinetime::Controllers::FS& filesystem) {
|
||||||
return Screens::WatchFaceInfineat::IsAvailable(filesystem);
|
return Screens::WatchFaceInfineat::IsAvailable(filesystem);
|
||||||
|
|
|
@ -134,7 +134,7 @@ namespace Pinetime {
|
||||||
controllers.settingsController,
|
controllers.settingsController,
|
||||||
controllers.motionController,
|
controllers.motionController,
|
||||||
*controllers.weatherController);
|
*controllers.weatherController);
|
||||||
};
|
}
|
||||||
|
|
||||||
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
|
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -82,7 +82,7 @@ namespace Pinetime {
|
||||||
controllers.settingsController,
|
controllers.settingsController,
|
||||||
controllers.heartRateController,
|
controllers.heartRateController,
|
||||||
controllers.motionController);
|
controllers.motionController);
|
||||||
};
|
}
|
||||||
|
|
||||||
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
|
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
static Screens::Screen* Create(AppControllers& controllers) {
|
static Screens::Screen* Create(AppControllers& controllers) {
|
||||||
return new Screens::Weather(controllers.settingsController, *controllers.weatherController);
|
return new Screens::Weather(controllers.settingsController, *controllers.weatherController);
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return optionArray;
|
return optionArray;
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
|
||||||
|
|
|
@ -42,7 +42,7 @@ void Counter::UpBtnPressed() {
|
||||||
if (ValueChangedHandler != nullptr) {
|
if (ValueChangedHandler != nullptr) {
|
||||||
ValueChangedHandler(userData);
|
ValueChangedHandler(userData);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
void Counter::DownBtnPressed() {
|
void Counter::DownBtnPressed() {
|
||||||
value--;
|
value--;
|
||||||
|
@ -54,7 +54,7 @@ void Counter::DownBtnPressed() {
|
||||||
if (ValueChangedHandler != nullptr) {
|
if (ValueChangedHandler != nullptr) {
|
||||||
ValueChangedHandler(userData);
|
ValueChangedHandler(userData);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
void Counter::SetValue(int newValue) {
|
void Counter::SetValue(int newValue) {
|
||||||
value = newValue;
|
value = newValue;
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
lv_obj_t* GetObject() const {
|
lv_obj_t* GetObject() const {
|
||||||
return counterContainer;
|
return counterContainer;
|
||||||
};
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void UpdateLabel();
|
void UpdateLabel();
|
||||||
|
|
|
@ -45,12 +45,14 @@ Bma421::Bma421(TwiMaster& twiMaster, uint8_t twiAddress) : twiMaster {twiMaster}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Bma421::Init() {
|
void Bma421::Init() {
|
||||||
if (not isResetOk)
|
if (not isResetOk) {
|
||||||
return; // Call SoftReset (and reset TWI device) first!
|
return; // Call SoftReset (and reset TWI device) first!
|
||||||
|
}
|
||||||
|
|
||||||
auto ret = bma423_init(&bma);
|
auto ret = bma423_init(&bma);
|
||||||
if (ret != BMA4_OK)
|
if (ret != BMA4_OK) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (bma.chip_id) {
|
switch (bma.chip_id) {
|
||||||
case BMA423_CHIP_ID:
|
case BMA423_CHIP_ID:
|
||||||
|
@ -65,32 +67,38 @@ void Bma421::Init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = bma423_write_config_file(&bma);
|
ret = bma423_write_config_file(&bma);
|
||||||
if (ret != BMA4_OK)
|
if (ret != BMA4_OK) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ret = bma4_set_interrupt_mode(BMA4_LATCH_MODE, &bma);
|
ret = bma4_set_interrupt_mode(BMA4_LATCH_MODE, &bma);
|
||||||
if (ret != BMA4_OK)
|
if (ret != BMA4_OK) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ret = bma423_feature_enable(BMA423_STEP_CNTR, 1, &bma);
|
ret = bma423_feature_enable(BMA423_STEP_CNTR, 1, &bma);
|
||||||
if (ret != BMA4_OK)
|
if (ret != BMA4_OK) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ret = bma423_step_detector_enable(0, &bma);
|
ret = bma423_step_detector_enable(0, &bma);
|
||||||
if (ret != BMA4_OK)
|
if (ret != BMA4_OK) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ret = bma4_set_accel_enable(1, &bma);
|
ret = bma4_set_accel_enable(1, &bma);
|
||||||
if (ret != BMA4_OK)
|
if (ret != BMA4_OK) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
accel_conf.odr = BMA4_OUTPUT_DATA_RATE_100HZ;
|
accel_conf.odr = BMA4_OUTPUT_DATA_RATE_100HZ;
|
||||||
accel_conf.range = BMA4_ACCEL_RANGE_2G;
|
accel_conf.range = BMA4_ACCEL_RANGE_2G;
|
||||||
accel_conf.bandwidth = BMA4_ACCEL_NORMAL_AVG4;
|
accel_conf.bandwidth = BMA4_ACCEL_NORMAL_AVG4;
|
||||||
accel_conf.perf_mode = BMA4_CIC_AVG_MODE;
|
accel_conf.perf_mode = BMA4_CIC_AVG_MODE;
|
||||||
ret = bma4_set_accel_config(&accel_conf, &bma);
|
ret = bma4_set_accel_config(&accel_conf, &bma);
|
||||||
if (ret != BMA4_OK)
|
if (ret != BMA4_OK) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
isOk = true;
|
isOk = true;
|
||||||
}
|
}
|
||||||
|
@ -109,8 +117,9 @@ void Bma421::Write(uint8_t registerAddress, const uint8_t* data, size_t size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Bma421::Values Bma421::Process() {
|
Bma421::Values Bma421::Process() {
|
||||||
if (not isOk)
|
if (not isOk) {
|
||||||
return {};
|
return {};
|
||||||
|
}
|
||||||
struct bma4_accel rawData;
|
struct bma4_accel rawData;
|
||||||
struct bma4_accel data;
|
struct bma4_accel data;
|
||||||
bma4_read_accel_xyz(&rawData, &bma);
|
bma4_read_accel_xyz(&rawData, &bma);
|
||||||
|
|
|
@ -47,4 +47,4 @@ namespace Pinetime {
|
||||||
DeviceTypes deviceType = DeviceTypes::Unknown;
|
DeviceTypes deviceType = DeviceTypes::Unknown;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,19 +52,19 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BMA4_H__
|
#ifndef BMA4_H__
|
||||||
#define BMA4_H__
|
#define BMA4_H__
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* header files */
|
/* header files */
|
||||||
|
|
||||||
#include "bma4_defs.h"
|
#include "bma4_defs.h"
|
||||||
#ifdef AKM9916
|
#ifdef AKM9916
|
||||||
#include "aux_akm9916.h"
|
#include "aux_akm9916.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BMM150
|
#ifdef BMM150
|
||||||
#include "aux_bmm150.h"
|
#include "aux_bmm150.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* (extern) variable declarations */
|
/* (extern) variable declarations */
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
* affect the reference value of the parameter
|
* affect the reference value of the parameter
|
||||||
* (Better case don't change 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
|
* \ingroup bma4
|
||||||
|
@ -126,7 +126,7 @@ int8_t bma4_init(struct bma4_dev *dev);
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma4
|
||||||
|
@ -157,7 +157,7 @@ int8_t bma4_write_config_file(struct bma4_dev *dev);
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma4
|
||||||
|
@ -295,7 +295,7 @@ int8_t bma4_get_status(uint8_t *status, struct bma4_dev *dev);
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma4ApiAccel
|
||||||
|
@ -490,7 +490,7 @@ int8_t bma4_get_accel_config(struct bma4_accel_config *accel, struct bma4_dev *d
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma4ApiSpiInterface
|
||||||
|
@ -735,7 +735,7 @@ int8_t bma4_get_spi_interface(uint8_t *spi, struct bma4_dev *dev);
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma4
|
||||||
|
@ -772,7 +772,7 @@ int8_t bma4_set_spi_interface(uint8_t spi, struct bma4_dev *dev);
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma4
|
||||||
|
@ -828,7 +828,7 @@ int8_t bma4_set_i2c_device_addr(struct bma4_dev *dev);
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma4
|
||||||
|
@ -1287,7 +1287,7 @@ int8_t bma4_set_fifo_down_accel(uint8_t fifo_down, struct bma4_dev *dev);
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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,
|
int8_t bma4_second_if_mag_compensate_xyz(struct bma4_mag_fifo_data mag_fifo_data,
|
||||||
uint8_t mag_second_if,
|
uint8_t mag_second_if,
|
||||||
const struct bma4_mag *compensated_mag_data);
|
const struct bma4_mag* compensated_mag_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup bma4
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma4
|
||||||
|
@ -1607,10 +1607,7 @@ int8_t bma4_get_offset_comp(uint8_t *offset_en, struct bma4_dev *dev);
|
||||||
* @retval < 0 -> Fail
|
* @retval < 0 -> Fail
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int8_t bma4_extract_accel(struct bma4_accel *accel_data,
|
int8_t bma4_extract_accel(struct bma4_accel* accel_data, uint16_t* accel_length, struct bma4_fifo_frame* fifo, const struct bma4_dev* dev);
|
||||||
uint16_t *accel_length,
|
|
||||||
struct bma4_fifo_frame *fifo,
|
|
||||||
const struct bma4_dev *dev);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup bma4
|
* \ingroup bma4
|
||||||
|
@ -1650,10 +1647,7 @@ int8_t bma4_extract_accel(struct bma4_accel *accel_data,
|
||||||
* @retval < 0 -> Fail
|
* @retval < 0 -> Fail
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int8_t bma4_extract_mag(const struct bma4_mag *mag_data,
|
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);
|
||||||
uint16_t *mag_length,
|
|
||||||
struct bma4_fifo_frame *fifo,
|
|
||||||
const struct bma4_dev *dev);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup bma4
|
* \ingroup bma4
|
||||||
|
@ -1686,7 +1680,7 @@ int8_t bma4_extract_mag(const struct bma4_mag *mag_data,
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma4ApiAccelSelftest
|
||||||
|
@ -1704,7 +1698,7 @@ int8_t bma4_perform_accel_selftest(int8_t *result, struct bma4_dev *dev);
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma4
|
||||||
|
@ -1749,7 +1743,7 @@ int8_t bma4_selftest_config(uint8_t sign, struct bma4_dev *dev);
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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
|
* @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
|
* \ingroup bma4ApiInterrupt
|
||||||
|
@ -1803,7 +1797,7 @@ int8_t bma4_set_interrupt_mode(uint8_t mode, struct bma4_dev *dev);
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma4
|
||||||
|
@ -1853,7 +1847,7 @@ int8_t bma4_get_interrupt_mode(uint8_t *mode, struct bma4_dev *dev);
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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
|
* @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
|
* \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
|
* @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
|
* \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
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @retval < 0 -> Fail
|
||||||
*/
|
*/
|
||||||
int8_t bma4_set_int_pin_config(const struct bma4_int_pin_config *int_pin_config, uint8_t int_line,
|
int8_t bma4_set_int_pin_config(const struct bma4_int_pin_config* int_pin_config, uint8_t int_line, struct bma4_dev* dev);
|
||||||
struct bma4_dev *dev);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \ingroup bma4ApiIntConfig
|
* \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
|
* @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
|
* \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
|
* @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
|
* \ingroup bma4ApiIntStatus
|
||||||
|
@ -2134,7 +2127,7 @@ int8_t bma4_read_int_status(uint16_t *int_status, struct bma4_dev *dev);
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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
|
* @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
|
* \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
|
* @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
|
* \ingroup bma4ApiAux
|
||||||
|
@ -2197,7 +2190,7 @@ int8_t bma4_aux_interface_init(struct bma4_dev *dev);
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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
|
* @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
|
* \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
|
* @retval < 0 -> Fail
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int8_t bma4_soft_reset(struct bma4_dev *dev);
|
int8_t bma4_soft_reset(struct bma4_dev* dev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup bma4
|
* \ingroup bma4
|
||||||
|
@ -2274,7 +2267,7 @@ int8_t bma4_soft_reset(struct bma4_dev *dev);
|
||||||
* @retval Any non zero value -> Fail
|
* @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
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -51,131 +51,131 @@ extern "C" {
|
||||||
#include "bma4.h"
|
#include "bma4.h"
|
||||||
|
|
||||||
/**\name Chip ID of BMA423 sensor */
|
/**\name Chip ID of BMA423 sensor */
|
||||||
#define BMA423_CHIP_ID UINT8_C(0x11)
|
#define BMA423_CHIP_ID UINT8_C(0x11)
|
||||||
#define BMA425_CHIP_ID UINT8_C(0x13)
|
#define BMA425_CHIP_ID UINT8_C(0x13)
|
||||||
|
|
||||||
/**\ Configuration ID start position of BMA423 sensor */
|
/**\ 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 */
|
/**\name Sensor feature size */
|
||||||
#define BMA423_FEATURE_SIZE UINT8_C(70)
|
#define BMA423_FEATURE_SIZE UINT8_C(70)
|
||||||
#define BMA423_ANY_MOT_LEN UINT8_C(4)
|
#define BMA423_ANY_MOT_LEN UINT8_C(4)
|
||||||
|
|
||||||
/**\name Feature offset address */
|
/**\name Feature offset address */
|
||||||
#define BMA423_ANY_MOT_OFFSET UINT8_C(0x00)
|
#define BMA423_ANY_MOT_OFFSET UINT8_C(0x00)
|
||||||
#define BMA423_NO_MOT_OFFSET UINT8_C(0x04)
|
#define BMA423_NO_MOT_OFFSET UINT8_C(0x04)
|
||||||
#define BMA423_STEP_CNTR_PARAM_OFFSET UINT8_C(0x08)
|
#define BMA423_STEP_CNTR_PARAM_OFFSET UINT8_C(0x08)
|
||||||
#define BMA423_STEP_CNTR_OFFSET UINT8_C(0x3A)
|
#define BMA423_STEP_CNTR_OFFSET UINT8_C(0x3A)
|
||||||
#define BMA423_SINGLE_TAP_OFFSET UINT8_C(0x3C)
|
#define BMA423_SINGLE_TAP_OFFSET UINT8_C(0x3C)
|
||||||
#define BMA423_DOUBLE_TAP_OFFSET UINT8_C(0x3E)
|
#define BMA423_DOUBLE_TAP_OFFSET UINT8_C(0x3E)
|
||||||
#define BMA423_WRIST_WEAR_OFFSET UINT8_C(0x40)
|
#define BMA423_WRIST_WEAR_OFFSET UINT8_C(0x40)
|
||||||
#define BMA423_CONFIG_ID_OFFSET UINT8_C(0x42)
|
#define BMA423_CONFIG_ID_OFFSET UINT8_C(0x42)
|
||||||
#define BMA423_AXES_REMAP_OFFSET UINT8_C(0x44)
|
#define BMA423_AXES_REMAP_OFFSET UINT8_C(0x44)
|
||||||
|
|
||||||
/**\name Read/Write Lengths */
|
/**\name Read/Write Lengths */
|
||||||
#define BMA423_RD_WR_MIN_LEN UINT8_C(2)
|
#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_NO_MOT_RD_WR_LEN (BMA423_ANY_MOT_LEN + BMA423_NO_MOT_OFFSET)
|
||||||
|
|
||||||
/*! @name Mask definitions for major and minor config */
|
/*! @name Mask definitions for major and minor config */
|
||||||
#define BMA423_CONFIG_MAJOR_MSK UINT16_C(0X3C0)
|
#define BMA423_CONFIG_MAJOR_MSK UINT16_C(0X3C0)
|
||||||
#define BMA423_CONFIG_MINOR_MSK UINT8_C(0X1F)
|
#define BMA423_CONFIG_MINOR_MSK UINT8_C(0X1F)
|
||||||
|
|
||||||
/*! @name Bit position for major config */
|
/*! @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 */
|
/**\name Re-map Axes */
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
#define BMA423_X_AXIS_MASK UINT8_C(0x03)
|
#define BMA423_X_AXIS_MASK UINT8_C(0x03)
|
||||||
#define BMA423_X_AXIS_SIGN_MASK UINT8_C(0x04)
|
#define BMA423_X_AXIS_SIGN_MASK UINT8_C(0x04)
|
||||||
#define BMA423_Y_AXIS_MASK UINT8_C(0x18)
|
#define BMA423_Y_AXIS_MASK UINT8_C(0x18)
|
||||||
#define BMA423_Y_AXIS_SIGN_MASK UINT8_C(0x20)
|
#define BMA423_Y_AXIS_SIGN_MASK UINT8_C(0x20)
|
||||||
#define BMA423_Z_AXIS_MASK UINT8_C(0xC0)
|
#define BMA423_Z_AXIS_MASK UINT8_C(0xC0)
|
||||||
#define BMA423_Z_AXIS_SIGN_MASK UINT8_C(0x01)
|
#define BMA423_Z_AXIS_SIGN_MASK UINT8_C(0x01)
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/**\name Step Counter/Detector/Activity */
|
/**\name Step Counter/Detector/Activity */
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/**\name Step counter/activity enable macros */
|
/**\name Step counter/activity enable macros */
|
||||||
#define BMA423_STEP_CNTR_EN_MSK UINT8_C(0x10)
|
#define BMA423_STEP_CNTR_EN_MSK UINT8_C(0x10)
|
||||||
#define BMA423_STEP_ACT_EN_MSK UINT8_C(0x20)
|
#define BMA423_STEP_ACT_EN_MSK UINT8_C(0x20)
|
||||||
|
|
||||||
/**\name Step counter water-mark macros */
|
/**\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 */
|
/**\name Step counter reset macros */
|
||||||
#define BMA423_STEP_CNTR_RST_POS UINT8_C(2)
|
#define BMA423_STEP_CNTR_RST_POS UINT8_C(2)
|
||||||
#define BMA423_STEP_CNTR_RST_MSK UINT8_C(0x04)
|
#define BMA423_STEP_CNTR_RST_MSK UINT8_C(0x04)
|
||||||
|
|
||||||
/**\name Step detector enable macros */
|
/**\name Step detector enable macros */
|
||||||
#define BMA423_STEP_DETECTOR_EN_POS UINT8_C(3)
|
#define BMA423_STEP_DETECTOR_EN_POS UINT8_C(3)
|
||||||
#define BMA423_STEP_DETECTOR_EN_MSK UINT8_C(0x08)
|
#define BMA423_STEP_DETECTOR_EN_MSK UINT8_C(0x08)
|
||||||
|
|
||||||
/**\name Wrist-wear enable macros */
|
/**\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*/
|
/**\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 */
|
/**\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 */
|
/**\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 */
|
/**\name tap sensitivity macros */
|
||||||
#define BMA423_TAP_SENS_POS UINT8_C(1)
|
#define BMA423_TAP_SENS_POS UINT8_C(1)
|
||||||
#define BMA423_TAP_SENS_MSK UINT8_C(0x0E)
|
#define BMA423_TAP_SENS_MSK UINT8_C(0x0E)
|
||||||
|
|
||||||
/**\name Tap selection macro */
|
/**\name Tap selection macro */
|
||||||
#define BMA423_TAP_SEL_POS UINT8_C(4)
|
#define BMA423_TAP_SEL_POS UINT8_C(4)
|
||||||
#define BMA423_TAP_SEL_MSK UINT8_C(0x10)
|
#define BMA423_TAP_SEL_MSK UINT8_C(0x10)
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/**\name Any/no Motion */
|
/**\name Any/no Motion */
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/**\name Any/No motion threshold macros */
|
/**\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 */
|
/**\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 */
|
/**\name Any/No motion enable macros */
|
||||||
#define BMA423_ANY_NO_MOT_AXIS_EN_POS UINT8_C(0x0D)
|
#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_MSK UINT16_C(0xE000)
|
||||||
|
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/**\name User macros */
|
/**\name User macros */
|
||||||
/**************************************************************/
|
/**************************************************************/
|
||||||
/**\name Any-motion/No-motion axis enable macros */
|
/**\name Any-motion/No-motion axis enable macros */
|
||||||
#define BMA423_X_AXIS_EN UINT8_C(0x01)
|
#define BMA423_X_AXIS_EN UINT8_C(0x01)
|
||||||
#define BMA423_Y_AXIS_EN UINT8_C(0x02)
|
#define BMA423_Y_AXIS_EN UINT8_C(0x02)
|
||||||
#define BMA423_Z_AXIS_EN UINT8_C(0x04)
|
#define BMA423_Z_AXIS_EN UINT8_C(0x04)
|
||||||
#define BMA423_EN_ALL_AXIS UINT8_C(0x07)
|
#define BMA423_EN_ALL_AXIS UINT8_C(0x07)
|
||||||
#define BMA423_DIS_ALL_AXIS UINT8_C(0x00)
|
#define BMA423_DIS_ALL_AXIS UINT8_C(0x00)
|
||||||
|
|
||||||
/**\name Feature enable macros for the sensor */
|
/**\name Feature enable macros for the sensor */
|
||||||
#define BMA423_STEP_CNTR UINT8_C(0x01)
|
#define BMA423_STEP_CNTR UINT8_C(0x01)
|
||||||
#define BMA423_STEP_ACT UINT8_C(0x02)
|
#define BMA423_STEP_ACT UINT8_C(0x02)
|
||||||
#define BMA423_WRIST_WEAR UINT8_C(0x04)
|
#define BMA423_WRIST_WEAR UINT8_C(0x04)
|
||||||
#define BMA423_SINGLE_TAP UINT8_C(0x08)
|
#define BMA423_SINGLE_TAP UINT8_C(0x08)
|
||||||
#define BMA423_DOUBLE_TAP UINT8_C(0x10)
|
#define BMA423_DOUBLE_TAP UINT8_C(0x10)
|
||||||
|
|
||||||
/**\name Interrupt status macros */
|
/**\name Interrupt status macros */
|
||||||
#define BMA423_SINGLE_TAP_INT UINT8_C(0x01)
|
#define BMA423_SINGLE_TAP_INT UINT8_C(0x01)
|
||||||
#define BMA423_STEP_CNTR_INT UINT8_C(0x02)
|
#define BMA423_STEP_CNTR_INT UINT8_C(0x02)
|
||||||
#define BMA423_ACTIVITY_INT UINT8_C(0x04)
|
#define BMA423_ACTIVITY_INT UINT8_C(0x04)
|
||||||
#define BMA423_WRIST_WEAR_INT UINT8_C(0x08)
|
#define BMA423_WRIST_WEAR_INT UINT8_C(0x08)
|
||||||
#define BMA423_DOUBLE_TAP_INT UINT8_C(0x10)
|
#define BMA423_DOUBLE_TAP_INT UINT8_C(0x10)
|
||||||
#define BMA423_ANY_MOT_INT UINT8_C(0x20)
|
#define BMA423_ANY_MOT_INT UINT8_C(0x20)
|
||||||
#define BMA423_NO_MOT_INT UINT8_C(0x40)
|
#define BMA423_NO_MOT_INT UINT8_C(0x40)
|
||||||
#define BMA423_ERROR_INT UINT8_C(0x80)
|
#define BMA423_ERROR_INT UINT8_C(0x80)
|
||||||
|
|
||||||
/**\name Activity recognition macros */
|
/**\name Activity recognition macros */
|
||||||
#define BMA423_USER_STATIONARY UINT8_C(0x00)
|
#define BMA423_USER_STATIONARY UINT8_C(0x00)
|
||||||
#define BMA423_USER_WALKING UINT8_C(0x01)
|
#define BMA423_USER_WALKING UINT8_C(0x01)
|
||||||
#define BMA423_USER_RUNNING UINT8_C(0x02)
|
#define BMA423_USER_RUNNING UINT8_C(0x02)
|
||||||
#define BMA423_STATE_INVALID UINT8_C(0x03)
|
#define BMA423_STATE_INVALID UINT8_C(0x03)
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/*! @name Structure Declarations */
|
/*! @name Structure Declarations */
|
||||||
|
@ -184,123 +184,120 @@ extern "C" {
|
||||||
/*!
|
/*!
|
||||||
* @brief Any/No motion configuration
|
* @brief Any/No motion configuration
|
||||||
*/
|
*/
|
||||||
struct bma423_any_no_mot_config
|
struct bma423_any_no_mot_config {
|
||||||
{
|
/*! Expressed in 50 Hz samples (20 ms) */
|
||||||
/*! Expressed in 50 Hz samples (20 ms) */
|
uint16_t duration;
|
||||||
uint16_t duration;
|
|
||||||
|
|
||||||
/*! Threshold value for Any-motion/No-motion detection in
|
/*! Threshold value for Any-motion/No-motion detection in
|
||||||
* 5.11g format
|
* 5.11g format
|
||||||
*/
|
*/
|
||||||
uint16_t threshold;
|
uint16_t threshold;
|
||||||
|
|
||||||
/*! To enable selected axes */
|
/*! To enable selected axes */
|
||||||
uint8_t axes_en;
|
uint8_t axes_en;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Axes re-mapping configuration
|
* @brief Axes re-mapping configuration
|
||||||
*/
|
*/
|
||||||
struct bma423_axes_remap
|
struct bma423_axes_remap {
|
||||||
{
|
/*! Re-mapped x-axis */
|
||||||
/*! Re-mapped x-axis */
|
uint8_t x_axis;
|
||||||
uint8_t x_axis;
|
|
||||||
|
|
||||||
/*! Re-mapped y-axis */
|
/*! Re-mapped y-axis */
|
||||||
uint8_t y_axis;
|
uint8_t y_axis;
|
||||||
|
|
||||||
/*! Re-mapped z-axis */
|
/*! Re-mapped z-axis */
|
||||||
uint8_t z_axis;
|
uint8_t z_axis;
|
||||||
|
|
||||||
/*! Re-mapped x-axis sign */
|
/*! Re-mapped x-axis sign */
|
||||||
uint8_t x_axis_sign;
|
uint8_t x_axis_sign;
|
||||||
|
|
||||||
/*! Re-mapped y-axis sign */
|
/*! Re-mapped y-axis sign */
|
||||||
uint8_t y_axis_sign;
|
uint8_t y_axis_sign;
|
||||||
|
|
||||||
/*! Re-mapped z-axis sign */
|
/*! Re-mapped z-axis sign */
|
||||||
uint8_t z_axis_sign;
|
uint8_t z_axis_sign;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Step counter param settings
|
* @brief Step counter param settings
|
||||||
*/
|
*/
|
||||||
struct bma423_stepcounter_settings
|
struct bma423_stepcounter_settings {
|
||||||
{
|
/*! Step Counter param 1 */
|
||||||
/*! Step Counter param 1 */
|
uint16_t param1;
|
||||||
uint16_t param1;
|
|
||||||
|
|
||||||
/*! Step Counter param 2 */
|
/*! Step Counter param 2 */
|
||||||
uint16_t param2;
|
uint16_t param2;
|
||||||
|
|
||||||
/*! Step Counter param 3 */
|
/*! Step Counter param 3 */
|
||||||
uint16_t param3;
|
uint16_t param3;
|
||||||
|
|
||||||
/*! Step Counter param 4 */
|
/*! Step Counter param 4 */
|
||||||
uint16_t param4;
|
uint16_t param4;
|
||||||
|
|
||||||
/*! Step Counter param 5 */
|
/*! Step Counter param 5 */
|
||||||
uint16_t param5;
|
uint16_t param5;
|
||||||
|
|
||||||
/*! Step Counter param 6 */
|
/*! Step Counter param 6 */
|
||||||
uint16_t param6;
|
uint16_t param6;
|
||||||
|
|
||||||
/*! Step Counter param 7 */
|
/*! Step Counter param 7 */
|
||||||
uint16_t param7;
|
uint16_t param7;
|
||||||
|
|
||||||
/*! Step Counter param 8 */
|
/*! Step Counter param 8 */
|
||||||
uint16_t param8;
|
uint16_t param8;
|
||||||
|
|
||||||
/*! Step Counter param 9 */
|
/*! Step Counter param 9 */
|
||||||
uint16_t param9;
|
uint16_t param9;
|
||||||
|
|
||||||
/*! Step Counter param 10 */
|
/*! Step Counter param 10 */
|
||||||
uint16_t param10;
|
uint16_t param10;
|
||||||
|
|
||||||
/*! Step Counter param 11 */
|
/*! Step Counter param 11 */
|
||||||
uint16_t param11;
|
uint16_t param11;
|
||||||
|
|
||||||
/*! Step Counter param 12 */
|
/*! Step Counter param 12 */
|
||||||
uint16_t param12;
|
uint16_t param12;
|
||||||
|
|
||||||
/*! Step Counter param 13 */
|
/*! Step Counter param 13 */
|
||||||
uint16_t param13;
|
uint16_t param13;
|
||||||
|
|
||||||
/*! Step Counter param 14 */
|
/*! Step Counter param 14 */
|
||||||
uint16_t param14;
|
uint16_t param14;
|
||||||
|
|
||||||
/*! Step Counter param 15 */
|
/*! Step Counter param 15 */
|
||||||
uint16_t param15;
|
uint16_t param15;
|
||||||
|
|
||||||
/*! Step Counter param 16 */
|
/*! Step Counter param 16 */
|
||||||
uint16_t param16;
|
uint16_t param16;
|
||||||
|
|
||||||
/*! Step Counter param 17 */
|
/*! Step Counter param 17 */
|
||||||
uint16_t param17;
|
uint16_t param17;
|
||||||
|
|
||||||
/*! Step Counter param 18 */
|
/*! Step Counter param 18 */
|
||||||
uint16_t param18;
|
uint16_t param18;
|
||||||
|
|
||||||
/*! Step Counter param 19 */
|
/*! Step Counter param 19 */
|
||||||
uint16_t param19;
|
uint16_t param19;
|
||||||
|
|
||||||
/*! Step Counter param 20 */
|
/*! Step Counter param 20 */
|
||||||
uint16_t param20;
|
uint16_t param20;
|
||||||
|
|
||||||
/*! Step Counter param 21 */
|
/*! Step Counter param 21 */
|
||||||
uint16_t param21;
|
uint16_t param21;
|
||||||
|
|
||||||
/*! Step Counter param 22 */
|
/*! Step Counter param 22 */
|
||||||
uint16_t param22;
|
uint16_t param22;
|
||||||
|
|
||||||
/*! Step Counter param 23 */
|
/*! Step Counter param 23 */
|
||||||
uint16_t param23;
|
uint16_t param23;
|
||||||
|
|
||||||
/*! Step Counter param 24 */
|
/*! Step Counter param 24 */
|
||||||
uint16_t param24;
|
uint16_t param24;
|
||||||
|
|
||||||
/*! Step Counter param 25 */
|
/*! Step Counter param 25 */
|
||||||
uint16_t param25;
|
uint16_t param25;
|
||||||
};
|
};
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
@ -330,7 +327,7 @@ struct bma423_stepcounter_settings
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @retval < 0 -> Fail
|
||||||
*/
|
*/
|
||||||
int8_t bma423_init(struct bma4_dev *dev);
|
int8_t bma423_init(struct bma4_dev* dev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup bma423
|
* \ingroup bma423
|
||||||
|
@ -353,7 +350,7 @@ int8_t bma423_init(struct bma4_dev *dev);
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma423
|
||||||
|
@ -376,7 +373,7 @@ int8_t bma423_write_config_file(struct bma4_dev *dev);
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma423ApiStepC
|
||||||
|
@ -642,7 +639,7 @@ int8_t bma423_reset_step_counter(struct bma4_dev *dev);
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma423ApiStepC
|
||||||
|
@ -695,7 +692,7 @@ int8_t bma423_activity_output(uint8_t *activity, struct bma4_dev *dev);
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma423ApiStepC
|
||||||
|
@ -714,7 +711,7 @@ int8_t bma423_stepcounter_get_parameter(struct bma423_stepcounter_settings *sett
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma421
|
||||||
|
@ -746,7 +743,7 @@ int8_t bma423_stepcounter_set_parameter(const struct bma423_stepcounter_settings
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma423
|
||||||
|
@ -806,7 +803,7 @@ int8_t bma423_step_detector_enable(uint8_t enable, struct bma4_dev *dev);
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \ingroup bma423ApiTap
|
||||||
|
@ -1084,7 +1081,7 @@ int8_t bma423_single_tap_get_sensitivity(uint8_t *sensitivity, struct bma4_dev *
|
||||||
* @retval 0 -> Success
|
* @retval 0 -> Success
|
||||||
* @retval < 0 -> Fail
|
* @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
|
* \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_OK - Success.
|
||||||
* @retval BMA4_E_NULL_PTR - Error: Null pointer error
|
* @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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -9,4 +9,4 @@ namespace Pinetime {
|
||||||
virtual bool GetNextBuffer(uint8_t** buffer, size_t& size) = 0;
|
virtual bool GetNextBuffer(uint8_t** buffer, size_t& size) = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,14 +103,16 @@ Hrs3300::PackedHrsAls Hrs3300::ReadHrsAls() {
|
||||||
|
|
||||||
void Hrs3300::WriteRegister(uint8_t reg, uint8_t data) {
|
void Hrs3300::WriteRegister(uint8_t reg, uint8_t data) {
|
||||||
auto ret = twiMaster.Write(twiAddress, reg, &data, 1);
|
auto ret = twiMaster.Write(twiAddress, reg, &data, 1);
|
||||||
if (ret != TwiMaster::ErrorCodes::NoError)
|
if (ret != TwiMaster::ErrorCodes::NoError) {
|
||||||
NRF_LOG_INFO("WRITE ERROR");
|
NRF_LOG_INFO("WRITE ERROR");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Hrs3300::ReadRegister(uint8_t reg) {
|
uint8_t Hrs3300::ReadRegister(uint8_t reg) {
|
||||||
uint8_t value;
|
uint8_t value;
|
||||||
auto ret = twiMaster.Read(twiAddress, reg, &value, 1);
|
auto ret = twiMaster.Read(twiAddress, reg, &value, 1);
|
||||||
if (ret != TwiMaster::ErrorCodes::NoError)
|
if (ret != TwiMaster::ErrorCodes::NoError) {
|
||||||
NRF_LOG_INFO("READ ERROR");
|
NRF_LOG_INFO("READ ERROR");
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,4 +13,4 @@ namespace Pinetime {
|
||||||
static inline void Wait();
|
static inline void Wait();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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<void()>& preTransactionHook) {
|
bool SpiMaster::Write(uint8_t pinCsn, const uint8_t* data, size_t size, const std::function<void()>& preTransactionHook) {
|
||||||
if (data == nullptr)
|
if (data == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
auto ok = xSemaphoreTake(mutex, portMAX_DELAY);
|
auto ok = xSemaphoreTake(mutex, portMAX_DELAY);
|
||||||
ASSERT(ok == true);
|
ASSERT(ok == true);
|
||||||
|
|
||||||
|
|
|
@ -92,13 +92,15 @@ void SpiNorFlash::SectorErase(uint32_t sectorAddress) {
|
||||||
static_cast<uint8_t>(sectorAddress)};
|
static_cast<uint8_t>(sectorAddress)};
|
||||||
|
|
||||||
WriteEnable();
|
WriteEnable();
|
||||||
while (!WriteEnabled())
|
while (!WriteEnabled()) {
|
||||||
vTaskDelay(1);
|
vTaskDelay(1);
|
||||||
|
}
|
||||||
|
|
||||||
spi.Read(reinterpret_cast<uint8_t*>(&cmd), cmdSize, nullptr, 0);
|
spi.Read(reinterpret_cast<uint8_t*>(&cmd), cmdSize, nullptr, 0);
|
||||||
|
|
||||||
while (WriteInProgress())
|
while (WriteInProgress()) {
|
||||||
vTaskDelay(1);
|
vTaskDelay(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t SpiNorFlash::ReadSecurityRegister() {
|
uint8_t SpiNorFlash::ReadSecurityRegister() {
|
||||||
|
@ -132,13 +134,15 @@ void SpiNorFlash::Write(uint32_t address, const uint8_t* buffer, size_t size) {
|
||||||
static_cast<uint8_t>(addr)};
|
static_cast<uint8_t>(addr)};
|
||||||
|
|
||||||
WriteEnable();
|
WriteEnable();
|
||||||
while (!WriteEnabled())
|
while (!WriteEnabled()) {
|
||||||
vTaskDelay(1);
|
vTaskDelay(1);
|
||||||
|
}
|
||||||
|
|
||||||
spi.WriteCmdAndBuffer(cmd, cmdSize, b, toWrite);
|
spi.WriteCmdAndBuffer(cmd, cmdSize, b, toWrite);
|
||||||
|
|
||||||
while (WriteInProgress())
|
while (WriteInProgress()) {
|
||||||
vTaskDelay(1);
|
vTaskDelay(1);
|
||||||
|
}
|
||||||
|
|
||||||
addr += toWrite;
|
addr += toWrite;
|
||||||
b += toWrite;
|
b += toWrite;
|
||||||
|
|
|
@ -8,4 +8,4 @@ namespace Pinetime {
|
||||||
virtual void Resume() = 0;
|
virtual void Resume() = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,4 +8,4 @@ void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action
|
||||||
void DebounceTimerCallback(TimerHandle_t xTimer);
|
void DebounceTimerCallback(TimerHandle_t xTimer);
|
||||||
|
|
||||||
extern int mallocFailedCount;
|
extern int mallocFailedCount;
|
||||||
extern int stackOverflowCount;
|
extern int stackOverflowCount;
|
||||||
|
|
|
@ -152,8 +152,9 @@ int main(void) {
|
||||||
logger.Init();
|
logger.Init();
|
||||||
nrf_drv_clock_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);
|
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
|
||||||
|
}
|
||||||
|
|
||||||
vTaskStartScheduler();
|
vTaskStartScheduler();
|
||||||
|
|
||||||
|
|
|
@ -12,10 +12,11 @@ void Pinetime::System::SystemMonitor::Process() {
|
||||||
auto nb = uxTaskGetSystemState(tasksStatus, 10, nullptr);
|
auto nb = uxTaskGetSystemState(tasksStatus, 10, nullptr);
|
||||||
for (uint32_t i = 0; i < nb; i++) {
|
for (uint32_t i = 0; i < nb; i++) {
|
||||||
NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark);
|
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",
|
NRF_LOG_INFO("WARNING!!! Task %s task is nearly full, only %dB available",
|
||||||
tasksStatus[i].pcTaskName,
|
tasksStatus[i].pcTaskName,
|
||||||
tasksStatus[i].usStackHighWaterMark * 4);
|
tasksStatus[i].usStackHighWaterMark * 4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lastTick = xTaskGetTickCount();
|
lastTick = xTaskGetTickCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -401,7 +401,7 @@ void SystemTask::GoToRunning() {
|
||||||
}
|
}
|
||||||
|
|
||||||
state = SystemTaskState::Running;
|
state = SystemTaskState::Running;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SystemTask::GoToSleep() {
|
void SystemTask::GoToSleep() {
|
||||||
if (IsSleeping()) {
|
if (IsSleeping()) {
|
||||||
|
@ -415,7 +415,7 @@ void SystemTask::GoToSleep() {
|
||||||
heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::GoToSleep);
|
heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::GoToSleep);
|
||||||
|
|
||||||
state = SystemTaskState::GoingToSleep;
|
state = SystemTaskState::GoingToSleep;
|
||||||
};
|
}
|
||||||
|
|
||||||
void SystemTask::UpdateMotion() {
|
void SystemTask::UpdateMotion() {
|
||||||
if (IsSleeping() && !(settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) ||
|
if (IsSleeping() && !(settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) ||
|
||||||
|
|
|
@ -85,7 +85,7 @@ namespace Pinetime {
|
||||||
|
|
||||||
Pinetime::Controllers::NimbleController& nimble() {
|
Pinetime::Controllers::NimbleController& nimble() {
|
||||||
return nimbleController;
|
return nimbleController;
|
||||||
};
|
}
|
||||||
|
|
||||||
bool IsSleeping() const {
|
bool IsSleeping() const {
|
||||||
return state != SystemTaskState::Running;
|
return state != SystemTaskState::Running;
|
||||||
|
|
|
@ -20,7 +20,7 @@ do
|
||||||
*.cpp|*.h)
|
*.cpp|*.h)
|
||||||
echo Checking "$file"
|
echo Checking "$file"
|
||||||
PATCH="$(basename "$file").patch"
|
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" ]
|
if [ -s "$PATCH" ]
|
||||||
then
|
then
|
||||||
printf "\033[31mError:\033[0m Formatting error in %s\n" "$file"
|
printf "\033[31mError:\033[0m Formatting error in %s\n" "$file"
|
||||||
|
|
|
@ -17,7 +17,7 @@ do
|
||||||
src/libs/*|src/FreeRTOS/*) continue ;;
|
src/libs/*|src/FreeRTOS/*) continue ;;
|
||||||
*.cpp|*.h)
|
*.cpp|*.h)
|
||||||
echo "::group::$file"
|
echo "::group::$file"
|
||||||
clang-tidy-14 -p build "$file" || true
|
clang-tidy-16 -p build "$file" || true
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue