Compare commits

...

2 commits

Author SHA1 Message Date
FintasticMan 88e5c641fa
clang-format: Update to 16 2024-10-10 12:09:20 +02:00
NeroBurner 8598142c27
Remove unused submodule QCBOR (#2138)
Some checks failed
CI / build-firmware (push) Successful in 5m57s
CI / build-simulator (push) Failing after 3s
CI / get-base-ref-size (push) Has been skipped
CI / Compare build size (push) Has been skipped
The submodule isn't used anymore. Remove the submodule reference
completely.
2024-10-09 20:26:08 +02:00
73 changed files with 1107 additions and 1094 deletions

View file

@ -2,20 +2,22 @@
Language: Cpp
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments: true
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLambdasOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: None
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
@ -28,29 +30,30 @@ BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: true
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
SplitEmptyRecord: true
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakConstructorInitializersBeforeComma: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 140
CommentPragmas: '^ IWYU pragma:'
CommentPragmas: "^ IWYU pragma:"
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 2
@ -75,24 +78,26 @@ IncludeCategories:
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
- Regex: '.*'
- Regex: ".*"
Priority: 1
SortPriority: 0
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IncludeIsMainRegex: "(Test)?$"
IncludeIsMainSourceRegex: ""
IndentAccessModifiers: false
IndentCaseLabels: true
IndentGotoLabels: true
IndentPPDirectives: BeforeHash
IndentWidth: 2
IndentWrappedFunctionNames: false
# Requires Clang >= 15, could also cause incorrect code formatting:
# InsertBraces: true
# Could lead to incorrect formatting, but I think that the tradeoff is worth it
InsertBraces: true
InsertNewlineAtEOF: true
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
LineEnding: LF
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PackConstructorInitializers: NextLine
@ -107,12 +112,14 @@ PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReferenceAlignment: Pointer
ReflowComments: true
RemoveSemicolon: true
SeparateDefinitionBlocks: Always
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
@ -120,22 +127,19 @@ SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatementsExceptForEachMacros
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
SpaceAroundPointerQualifiers: Default
Standard: Latest
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
...

View file

@ -2,18 +2,18 @@ name: Code formatting
on:
pull_request:
branches: [ main ]
branches: [main]
paths:
- '**.cpp'
- '**.h'
- '!src/libs/**'
- '!src/FreeRTOS/**'
- "src/**.cpp"
- "src/**.h"
- "!src/libs/**"
- "!src/FreeRTOS/**"
jobs:
test-format:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 1000
@ -23,48 +23,48 @@ jobs:
- name: Install clang-format
run: |
sudo apt-get update
sudo apt-get -y install clang-format-14
sudo apt-get -y install clang-format-16
- name: Check formatting
run: tests/test-format.sh
- name: Upload patches
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: Patches
path: ./*.patch
test-clang-tidy:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
container:
image: infinitime/infinitime-build
steps:
# This workaround fixes the error "unsafe repository (REPO is owned by someone else)".
# See https://github.com/actions/checkout/issues/760 and https://github.com/actions/checkout/issues/766
# The fix in "actions/checkout@v2" was not sufficient as the build process also uses git (to get the current
# commit hash, for example).
- name: Workaround permission issues
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Checkout source files
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 1000
- name: Fetch base branch
run: git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF"
- name: Install clang-tidy
run: |
apt-get update
apt-get -y install clang-tidy-14
- name: Prepare environment
shell: bash
env:
SOURCES_DIR: .
run: |
. docker/build.sh
GetGcc
# I guess these already exist inside the docker?
#GetNrfSdk
#GetMcuBoot
CmakeGenerate
- run: tests/test-tidy.sh
# This workaround fixes the error "unsafe repository (REPO is owned by someone else)".
# See https://github.com/actions/checkout/issues/760 and https://github.com/actions/checkout/issues/766
# The fix in "actions/checkout@v2" was not sufficient as the build process also uses git (to get the current
# commit hash, for example).
- name: Workaround permission issues
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Checkout source files
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1000
- name: Fetch base branch
run: git fetch origin "$GITHUB_BASE_REF":"$GITHUB_BASE_REF"
- name: Install clang-tidy
run: |
apt-get update
apt-get -y install clang-tidy-16
- name: Prepare environment
shell: bash
env:
SOURCES_DIR: .
run: |
. docker/build.sh
GetGcc
# I guess these already exist inside the docker?
#GetNrfSdk
#GetMcuBoot
CmakeGenerate
- run: tests/test-tidy.sh

3
.gitmodules vendored
View file

@ -4,9 +4,6 @@
[submodule "src/libs/littlefs"]
path = src/libs/littlefs
url = https://github.com/littlefs-project/littlefs.git
[submodule "src/libs/QCBOR"]
path = src/libs/QCBOR
url = https://github.com/laurencelundblade/QCBOR.git
[submodule "src/libs/arduinoFFT"]
path = src/libs/arduinoFFT
url = https://github.com/kosme/arduinoFFT.git

View file

@ -6,7 +6,7 @@ if [ -z "$(command -v "git-$name")" ]; then
name="$(basename -a $(find $(echo "$PATH" | tr ':' ' ') -maxdepth 1 -type f -executable -name 'git-clang-format*') | sort | tail -n 1 | sed 's/^git-//')"
fi
minVersion="14.0.0"
minVersion="16.0.0"
for file in $(find $(echo "$PATH" | tr ':' ' ') -maxdepth 1 -type f -executable -name 'clang-format*'); do
curBin="$file"
@ -23,7 +23,7 @@ if [ -z "$name" ] || [ -z "$bin" ]; then
exit 1
fi
args="--binary $bin -q --extensions cpp,h --style file --staged -- :!src/FreeRTOS :!src/libs"
args="--binary $bin -q --extensions cpp,h --style file --staged -- src :!src/FreeRTOS :!src/libs"
changedFiles="$(git "$name" --diffstat $args)"
git "$name" $args

View file

@ -81,8 +81,9 @@ int AlertNotificationClient::OnCharacteristicsDiscoveryEvent(uint16_t connection
NRF_LOG_INFO("ANS Characteristic discovery complete");
if (isCharacteristicDiscovered) {
ble_gattc_disc_all_dscs(connectionHandle, newAlertHandle, ansEndHandle, OnAlertNotificationDescriptorDiscoveryEventCallback, this);
} else
} else {
onServiceDiscovered(connectionHandle);
}
} else {
if (characteristic != nullptr && ble_uuid_cmp(&supportedNewAlertCategoryUuid.u, &characteristic->uuid.u) == 0) {
NRF_LOG_INFO("ANS Characteristic discovered : supportedNewAlertCategoryUuid");
@ -101,8 +102,9 @@ int AlertNotificationClient::OnCharacteristicsDiscoveryEvent(uint16_t connection
} else if (characteristic != nullptr && ble_uuid_cmp(&controlPointUuid.u, &characteristic->uuid.u) == 0) {
NRF_LOG_INFO("ANS Characteristic discovered : controlPointUuid");
controlPointHandle = characteristic->val_handle;
} else
} else {
NRF_LOG_INFO("ANS Characteristic discovered : 0x%x", characteristic->val_handle);
}
}
return 0;
}
@ -135,8 +137,9 @@ int AlertNotificationClient::OnDescriptorDiscoveryEventCallback(uint16_t connect
}
}
} else {
if (!isDescriptorFound)
if (!isDescriptorFound) {
onServiceDiscovered(connectionHandle);
}
}
return 0;
}
@ -150,8 +153,9 @@ void AlertNotificationClient::OnNotification(ble_gap_event* event) {
// Ignore notifications with empty message
const auto packetLen = OS_MBUF_PKTLEN(event->notify_rx.om);
if (packetLen <= headerSize)
if (packetLen <= headerSize) {
return;
}
size_t bufferSize = std::min(packetLen + stringTerminatorSize, maxBufferSize);
auto messageSize = std::min(maxMessageSize, (bufferSize - headerSize));

View file

@ -9,4 +9,4 @@ namespace Pinetime {
virtual void Discover(uint16_t connectionHandle, std::function<void(uint16_t)> lambda) = 0;
};
}
}
}

View file

@ -87,20 +87,23 @@ int DfuService::OnServiceData(uint16_t connectionHandle, uint16_t attributeHandl
ble_gatts_find_chr(&serviceUuid.u, &revisionCharacteristicUuid.u, nullptr, &revisionCharacteristicHandle);
if (attributeHandle == packetCharacteristicHandle) {
if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR)
if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
return WritePacketHandler(connectionHandle, context->om);
else
} else {
return 0;
}
} else if (attributeHandle == controlPointCharacteristicHandle) {
if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR)
if (context->op == BLE_GATT_ACCESS_OP_WRITE_CHR) {
return ControlPointHandler(connectionHandle, context->om);
else
} else {
return 0;
}
} else if (attributeHandle == revisionCharacteristicHandle) {
if (context->op == BLE_GATT_ACCESS_OP_READ_CHR)
if (context->op == BLE_GATT_ACCESS_OP_READ_CHR) {
return SendDfuRevision(context->om);
else
} else {
return 0;
}
} else {
NRF_LOG_INFO("[DFU] Unknown Characteristic : %d", attributeHandle);
return 0;
@ -321,8 +324,9 @@ DfuService::NotificationManager::NotificationManager() {
}
bool DfuService::NotificationManager::AsyncSend(uint16_t connection, uint16_t charactHandle, uint8_t* data, size_t s) {
if (size != 0 || s > 10)
if (size != 0 || s > 10) {
return false;
}
connectionHandle = connection;
characteristicHandle = charactHandle;
@ -353,8 +357,9 @@ void DfuService::NotificationManager::Reset() {
}
void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc) {
if (chunkSize != 20)
if (chunkSize != 20) {
return;
}
this->chunkSize = chunkSize;
this->totalSize = totalSize;
this->expectedCrc = expectedCrc;
@ -364,8 +369,9 @@ void DfuService::DfuImage::Init(size_t chunkSize, size_t totalSize, uint16_t exp
}
void DfuService::DfuImage::Append(uint8_t* data, size_t size) {
if (!ready)
if (!ready) {
return;
}
ASSERT(size <= 20);
std::memcpy(tempBuffer + bufferWriteIndex, data, size);
@ -380,8 +386,9 @@ void DfuService::DfuImage::Append(uint8_t* data, size_t size) {
if (bufferWriteIndex > 0 && totalWriteIndex + bufferWriteIndex == totalSize) {
spiNorFlash.Write(writeOffset + totalWriteIndex, tempBuffer, bufferWriteIndex);
totalWriteIndex += bufferWriteIndex;
if (totalSize < maxSize)
if (totalSize < maxSize) {
WriteMagicNumber();
}
}
}
@ -417,8 +424,9 @@ bool DfuService::DfuImage::Validate() {
if (first) {
crc = ComputeCrc(tempBuffer, readSize, NULL);
first = false;
} else
} else {
crc = ComputeCrc(tempBuffer, readSize, &crc);
}
currentOffset += readSize;
}
@ -440,7 +448,8 @@ uint16_t DfuService::DfuImage::ComputeCrc(uint8_t const* p_data, uint32_t size,
}
bool DfuService::DfuImage::IsComplete() {
if (!ready)
if (!ready) {
return false;
}
return totalWriteIndex == totalSize;
}

View file

@ -159,4 +159,4 @@ namespace Pinetime {
TimerHandle_t timeoutTimer;
};
}
}
}

View file

@ -57,8 +57,9 @@ int HeartRateService::OnHeartRateRequested(uint16_t attributeHandle, ble_gatt_ac
}
void HeartRateService::OnNewHeartRateValue(uint8_t heartRateValue) {
if (!heartRateMeasurementNotificationEnable)
if (!heartRateMeasurementNotificationEnable) {
return;
}
uint8_t buffer[2] = {0, heartRateValue}; // [0] = flags, [1] = hr value
auto* om = ble_hs_mbuf_from_flat(buffer, 2);
@ -73,11 +74,13 @@ void HeartRateService::OnNewHeartRateValue(uint8_t heartRateValue) {
}
void HeartRateService::SubscribeNotification(uint16_t attributeHandle) {
if (attributeHandle == heartRateMeasurementHandle)
if (attributeHandle == heartRateMeasurementHandle) {
heartRateMeasurementNotificationEnable = true;
}
}
void HeartRateService::UnsubscribeNotification(uint16_t attributeHandle) {
if (attributeHandle == heartRateMeasurementHandle)
if (attributeHandle == heartRateMeasurementHandle) {
heartRateMeasurementNotificationEnable = false;
}
}

View file

@ -76,8 +76,9 @@ int MotionService::OnStepCountRequested(uint16_t attributeHandle, ble_gatt_acces
}
void MotionService::OnNewStepCountValue(uint32_t stepCount) {
if (!stepCountNoficationEnabled)
if (!stepCountNoficationEnabled) {
return;
}
uint32_t buffer = stepCount;
auto* om = ble_hs_mbuf_from_flat(&buffer, 4);
@ -92,8 +93,9 @@ void MotionService::OnNewStepCountValue(uint32_t stepCount) {
}
void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) {
if (!motionValuesNoficationEnabled)
if (!motionValuesNoficationEnabled) {
return;
}
int16_t buffer[3] = {x, y, z};
auto* om = ble_hs_mbuf_from_flat(buffer, 3 * sizeof(int16_t));
@ -108,17 +110,19 @@ void MotionService::OnNewMotionValues(int16_t x, int16_t y, int16_t z) {
}
void MotionService::SubscribeNotification(uint16_t attributeHandle) {
if (attributeHandle == stepCountHandle)
if (attributeHandle == stepCountHandle) {
stepCountNoficationEnabled = true;
else if (attributeHandle == motionValuesHandle)
} else if (attributeHandle == motionValuesHandle) {
motionValuesNoficationEnabled = true;
}
}
void MotionService::UnsubscribeNotification(uint16_t attributeHandle) {
if (attributeHandle == stepCountHandle)
if (attributeHandle == stepCountHandle) {
stepCountNoficationEnabled = false;
else if (attributeHandle == motionValuesHandle)
} else if (attributeHandle == motionValuesHandle) {
motionValuesNoficationEnabled = false;
}
}
bool MotionService::IsMotionNotificationSubscribed() const {

View file

@ -57,26 +57,26 @@ namespace Pinetime {
Pinetime::Controllers::MusicService& music() {
return musicService;
};
}
Pinetime::Controllers::NavigationService& navigation() {
return navService;
};
}
Pinetime::Controllers::AlertNotificationService& alertService() {
return anService;
};
}
Pinetime::Controllers::SimpleWeatherService& weather() {
return weatherService;
};
}
uint16_t connHandle();
void NotifyBatteryLevel(uint8_t level);
void RestartFastAdv() {
fastAdvCount = 0;
};
}
void EnableRadio();
void DisableRadio();

View file

@ -51,7 +51,7 @@ namespace Pinetime {
static constexpr size_t MaximumMessageSize() {
return MessageSize;
};
}
bool IsEmpty() const {
return size == 0;

View file

@ -29,4 +29,4 @@ void ServiceDiscovery::DiscoverNextService(uint16_t connectionHandle) {
this->OnServiceDiscovered(connectionHandle);
};
(*clientIterator)->Discover(connectionHandle, discoverNextService);
}
}

View file

@ -114,8 +114,9 @@ void DateTime::UpdateTime(uint32_t systickCounter, bool forceUpdate) {
// Notify new day to SystemTask
if (hour == 0 and not isMidnightAlreadyNotified) {
isMidnightAlreadyNotified = true;
if (systemTask != nullptr)
if (systemTask != nullptr) {
systemTask->PushMessage(System::Messages::OnNewDay);
}
} else if (hour != 0) {
isMidnightAlreadyNotified = false;
}

View file

@ -11,8 +11,9 @@ bool FirmwareValidator::IsValidated() const {
}
void FirmwareValidator::Validate() {
if (!IsValidated())
if (!IsValidated()) {
Pinetime::Drivers::InternalFlash::WriteWord(validBitAdress, validBitValue);
}
}
void FirmwareValidator::Reset() {

View file

@ -41,4 +41,4 @@ namespace Pinetime {
Pinetime::Controllers::HeartRateService* service = nullptr;
};
}
}
}

View file

@ -276,10 +276,12 @@ float Ppg::HeartRateAverage(float hr) {
for (const float& value : dataAverage) {
if (value > 0.0f) {
avg += value;
if (value < min)
if (value < min) {
min = value;
if (value > max)
}
if (value > max) {
max = value;
}
total++;
}
}

View file

@ -28,9 +28,10 @@ void RleDecoder::DecodeNext(uint8_t* output, size_t maxBytes) {
}
processedCount = 0;
if (color == backgroundColor)
if (color == backgroundColor) {
color = foregroundColor;
else
} else {
color = backgroundColor;
}
}
}

View file

@ -65,158 +65,163 @@ namespace Pinetime {
settingsChanged = true;
}
settings.watchFace = face;
};
}
Pinetime::Applications::WatchFace GetWatchFace() const {
return settings.watchFace;
};
}
void SetChimeOption(ChimesOption chimeOption) {
if (chimeOption != settings.chimesOption) {
settingsChanged = true;
}
settings.chimesOption = chimeOption;
};
}
ChimesOption GetChimeOption() const {
return settings.chimesOption;
};
}
void SetPTSColorTime(Colors colorTime) {
if (colorTime != settings.PTS.ColorTime)
if (colorTime != settings.PTS.ColorTime) {
settingsChanged = true;
}
settings.PTS.ColorTime = colorTime;
};
}
Colors GetPTSColorTime() const {
return settings.PTS.ColorTime;
};
}
void SetPTSColorBar(Colors colorBar) {
if (colorBar != settings.PTS.ColorBar)
if (colorBar != settings.PTS.ColorBar) {
settingsChanged = true;
}
settings.PTS.ColorBar = colorBar;
};
}
Colors GetPTSColorBar() const {
return settings.PTS.ColorBar;
};
}
void SetPTSColorBG(Colors colorBG) {
if (colorBG != settings.PTS.ColorBG)
if (colorBG != settings.PTS.ColorBG) {
settingsChanged = true;
}
settings.PTS.ColorBG = colorBG;
};
}
Colors GetPTSColorBG() const {
return settings.PTS.ColorBG;
};
}
void SetInfineatShowSideCover(bool show) {
if (show != settings.watchFaceInfineat.showSideCover) {
settings.watchFaceInfineat.showSideCover = show;
settingsChanged = true;
}
};
}
bool GetInfineatShowSideCover() const {
return settings.watchFaceInfineat.showSideCover;
};
}
void SetInfineatColorIndex(int index) {
if (index != settings.watchFaceInfineat.colorIndex) {
settings.watchFaceInfineat.colorIndex = index;
settingsChanged = true;
}
};
}
int GetInfineatColorIndex() const {
return settings.watchFaceInfineat.colorIndex;
};
}
void SetPTSGaugeStyle(PTSGaugeStyle gaugeStyle) {
if (gaugeStyle != settings.PTS.gaugeStyle)
if (gaugeStyle != settings.PTS.gaugeStyle) {
settingsChanged = true;
}
settings.PTS.gaugeStyle = gaugeStyle;
};
}
PTSGaugeStyle GetPTSGaugeStyle() const {
return settings.PTS.gaugeStyle;
};
}
void SetPTSWeather(PTSWeather weatherEnable) {
if (weatherEnable != settings.PTS.weatherEnable)
if (weatherEnable != settings.PTS.weatherEnable) {
settingsChanged = true;
}
settings.PTS.weatherEnable = weatherEnable;
};
}
PTSWeather GetPTSWeather() const {
return settings.PTS.weatherEnable;
};
}
void SetAppMenu(uint8_t menu) {
appMenu = menu;
};
}
uint8_t GetAppMenu() const {
return appMenu;
};
}
void SetSettingsMenu(uint8_t menu) {
settingsMenu = menu;
};
}
uint8_t GetSettingsMenu() const {
return settingsMenu;
};
}
void SetClockType(ClockType clocktype) {
if (clocktype != settings.clockType) {
settingsChanged = true;
}
settings.clockType = clocktype;
};
}
ClockType GetClockType() const {
return settings.clockType;
};
}
void SetWeatherFormat(WeatherFormat weatherFormat) {
if (weatherFormat != settings.weatherFormat) {
settingsChanged = true;
}
settings.weatherFormat = weatherFormat;
};
}
WeatherFormat GetWeatherFormat() const {
return settings.weatherFormat;
};
}
void SetNotificationStatus(Notification status) {
if (status != settings.notificationStatus) {
settingsChanged = true;
}
settings.notificationStatus = status;
};
}
Notification GetNotificationStatus() const {
return settings.notificationStatus;
};
}
void SetScreenTimeOut(uint32_t timeout) {
if (timeout != settings.screenTimeOut) {
settingsChanged = true;
}
settings.screenTimeOut = timeout;
};
}
uint32_t GetScreenTimeOut() const {
return settings.screenTimeOut;
};
}
bool GetAlwaysOnDisplay() const {
return settings.alwaysOnDisplay && GetNotificationStatus() != Notification::Sleep;
};
}
void SetAlwaysOnDisplaySetting(bool state) {
if (state != settings.alwaysOnDisplay) {
@ -258,7 +263,7 @@ namespace Pinetime {
break;
}
}
};
}
std::bitset<5> getWakeUpModes() const {
return settings.wakeUpMode;
@ -273,30 +278,30 @@ namespace Pinetime {
settingsChanged = true;
}
settings.brightLevel = level;
};
}
Controllers::BrightnessController::Levels GetBrightness() const {
return settings.brightLevel;
};
}
void SetStepsGoal(uint32_t goal) {
if (goal != settings.stepsGoal) {
settingsChanged = true;
}
settings.stepsGoal = goal;
};
}
uint32_t GetStepsGoal() const {
return settings.stepsGoal;
};
}
void SetBleRadioEnabled(bool enabled) {
bleRadioEnabled = enabled;
};
}
bool GetBleRadioEnabled() const {
return bleRadioEnabled;
};
}
private:
Pinetime::Controllers::FS& fs;

View file

@ -7,4 +7,4 @@ namespace Pinetime {
namespace Applications {
lv_color_t Convert(Controllers::Settings::Colors color);
}
}
}

View file

@ -513,9 +513,9 @@ void DisplayApp::LoadScreen(Apps app, DisplayApp::FullRefreshDirections directio
std::find_if(userWatchFaces.begin(), userWatchFaces.end(), [this](const WatchFaceDescription& watchfaceDescription) {
return watchfaceDescription.watchFace == settingsController.GetWatchFace();
});
if (watchFace != userWatchFaces.end())
if (watchFace != userWatchFaces.end()) {
currentScreen.reset(watchFace->create(controllers));
else {
} else {
currentScreen.reset(userWatchFaces[0].create(controllers));
}
settingsController.SetAppMenu(0);

View file

@ -31,8 +31,9 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
void DisplayApp::Start() {
msgQueue = xQueueCreate(queueSize, itemSize);
if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 512, this, 0, &taskHandle))
if (pdPASS != xTaskCreate(DisplayApp::Process, "displayapp", 512, this, 0, &taskHandle)) {
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
}
void DisplayApp::Process(void* instance) {

View file

@ -66,7 +66,7 @@ namespace Pinetime {
void Start(Pinetime::System::BootErrors) {
Start();
};
}
void PushMessage(Pinetime::Applications::Display::Messages msg);
void Register(Pinetime::System::SystemTask* systemTask);

View file

@ -176,9 +176,9 @@ void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
toScroll = height;
}
if (scrollOffset >= toScroll)
if (scrollOffset >= toScroll) {
scrollOffset -= toScroll;
else {
} else {
toScroll -= scrollOffset;
scrollOffset = (totalNbLines) -toScroll;
}

View file

@ -5,4 +5,4 @@ namespace Pinetime {
enum class TouchEvents { None, Tap, SwipeLeft, SwipeRight, SwipeUp, SwipeDown, LongTap, DoubleTap };
}
}
}

View file

@ -77,7 +77,7 @@ namespace Pinetime {
controllers.settingsController.GetClockType(),
*controllers.systemTask,
controllers.motorController);
};
}
};
}
}

View file

@ -46,8 +46,9 @@ void BatteryIcon::SetColor(lv_color_t color) {
}
const char* BatteryIcon::GetPlugIcon(bool isCharging) {
if (isCharging)
if (isCharging) {
return Symbols::plug;
else
} else {
return "";
}
}

View file

@ -150,8 +150,9 @@ void Dice::Refresh() {
Roll();
}
} else if (currentRollHysteresis > 0)
} else if (currentRollHysteresis > 0) {
--currentRollHysteresis;
}
}
void Dice::Roll() {

View file

@ -55,7 +55,7 @@ namespace Pinetime {
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Dice(controllers.motionController, controllers.motorController, controllers.settingsController);
};
}
};
}
}

View file

@ -47,7 +47,7 @@ namespace Pinetime {
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::HeartRate(controllers.heartRateController, *controllers.systemTask);
};
}
};
}
}

View file

@ -46,7 +46,7 @@ namespace Pinetime {
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::InfiniPaint(controllers.lvgl, controllers.motorController);
};
}
};
}
}

View file

@ -46,7 +46,7 @@ namespace Pinetime {
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Metronome(controllers.motorController, *controllers.systemTask);
};
}
};
}
}

View file

@ -40,7 +40,7 @@ namespace Pinetime {
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Motion(controllers.motionController);
};
}
};
}
}

View file

@ -93,7 +93,7 @@ namespace Pinetime {
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Music(*controllers.musicService);
};
}
};
}
}

View file

@ -66,7 +66,7 @@ namespace Pinetime {
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Navigation(*controllers.navigationService);
};
}
};
}
}

View file

@ -3,8 +3,9 @@
using namespace Pinetime::Applications::Screens;
const char* NotificationIcon::GetIcon(bool newNotificationAvailable) {
if (newNotificationAvailable)
if (newNotificationAvailable) {
return Symbols::info;
else
} else {
return "";
}
}
}

View file

@ -9,4 +9,4 @@ namespace Pinetime {
};
}
}
}
}

View file

@ -56,7 +56,7 @@ namespace Pinetime {
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Paddle(controllers.lvgl);
};
}
};
}
}

View file

@ -50,7 +50,7 @@ namespace Pinetime {
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Steps(controllers.motionController, controllers.settingsController);
};
}
};
}
}

View file

@ -68,7 +68,7 @@ namespace Pinetime {
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::StopWatch(*controllers.systemTask);
};
}
};
}
}

View file

@ -180,6 +180,7 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
extern int mallocFailedCount;
extern int stackOverflowCount;
std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
lv_mem_monitor_t mon;
lv_mem_monitor(&mon);

View file

@ -56,6 +56,6 @@ namespace Pinetime::Applications {
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Timer(controllers.timer);
};
}
};
}

View file

@ -44,7 +44,7 @@ namespace Pinetime {
static Screens::Screen* Create(AppControllers& /*controllers*/) {
return new Screens::Twos();
};
}
};
}
}

View file

@ -99,7 +99,7 @@ namespace Pinetime {
controllers.bleController,
controllers.notificationManager,
controllers.settingsController);
};
}
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
return true;

View file

@ -116,7 +116,7 @@ namespace Pinetime {
controllers.heartRateController,
controllers.motionController,
controllers.filesystem);
};
}
static bool IsAvailable(Pinetime::Controllers::FS& filesystem) {
return Screens::WatchFaceCasioStyleG7710::IsAvailable(filesystem);

View file

@ -89,7 +89,7 @@ namespace Pinetime {
controllers.heartRateController,
controllers.motionController,
*controllers.weatherController);
};
}
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
return true;

View file

@ -374,8 +374,9 @@ void WatchFaceInfineat::UpdateSelected(lv_obj_t* object, lv_event_t event) {
}
if (object == btnPrevColor) {
colorIndex -= 1;
if (colorIndex < 0)
if (colorIndex < 0) {
colorIndex = nColors - 1;
}
settingsController.SetInfineatColorIndex(colorIndex);
}
if (object == btnNextColor || object == btnPrevColor) {

View file

@ -113,7 +113,7 @@ namespace Pinetime {
controllers.settingsController,
controllers.motionController,
controllers.filesystem);
};
}
static bool IsAvailable(Pinetime::Controllers::FS& filesystem) {
return Screens::WatchFaceInfineat::IsAvailable(filesystem);

View file

@ -134,7 +134,7 @@ namespace Pinetime {
controllers.settingsController,
controllers.motionController,
*controllers.weatherController);
};
}
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
return true;

View file

@ -82,7 +82,7 @@ namespace Pinetime {
controllers.settingsController,
controllers.heartRateController,
controllers.motionController);
};
}
static bool IsAvailable(Pinetime::Controllers::FS& /*filesystem*/) {
return true;

View file

@ -50,7 +50,7 @@ namespace Pinetime {
static Screens::Screen* Create(AppControllers& controllers) {
return new Screens::Weather(controllers.settingsController, *controllers.weatherController);
};
}
};
}
}

View file

@ -31,7 +31,7 @@ namespace {
}
}
return optionArray;
};
}
}
SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)

View file

@ -42,7 +42,7 @@ void Counter::UpBtnPressed() {
if (ValueChangedHandler != nullptr) {
ValueChangedHandler(userData);
}
};
}
void Counter::DownBtnPressed() {
value--;
@ -54,7 +54,7 @@ void Counter::DownBtnPressed() {
if (ValueChangedHandler != nullptr) {
ValueChangedHandler(userData);
}
};
}
void Counter::SetValue(int newValue) {
value = newValue;

View file

@ -25,7 +25,7 @@ namespace Pinetime {
lv_obj_t* GetObject() const {
return counterContainer;
};
}
private:
void UpdateLabel();

View file

@ -45,12 +45,14 @@ Bma421::Bma421(TwiMaster& twiMaster, uint8_t twiAddress) : twiMaster {twiMaster}
}
void Bma421::Init() {
if (not isResetOk)
if (not isResetOk) {
return; // Call SoftReset (and reset TWI device) first!
}
auto ret = bma423_init(&bma);
if (ret != BMA4_OK)
if (ret != BMA4_OK) {
return;
}
switch (bma.chip_id) {
case BMA423_CHIP_ID:
@ -65,32 +67,38 @@ void Bma421::Init() {
}
ret = bma423_write_config_file(&bma);
if (ret != BMA4_OK)
if (ret != BMA4_OK) {
return;
}
ret = bma4_set_interrupt_mode(BMA4_LATCH_MODE, &bma);
if (ret != BMA4_OK)
if (ret != BMA4_OK) {
return;
}
ret = bma423_feature_enable(BMA423_STEP_CNTR, 1, &bma);
if (ret != BMA4_OK)
if (ret != BMA4_OK) {
return;
}
ret = bma423_step_detector_enable(0, &bma);
if (ret != BMA4_OK)
if (ret != BMA4_OK) {
return;
}
ret = bma4_set_accel_enable(1, &bma);
if (ret != BMA4_OK)
if (ret != BMA4_OK) {
return;
}
accel_conf.odr = BMA4_OUTPUT_DATA_RATE_100HZ;
accel_conf.range = BMA4_ACCEL_RANGE_2G;
accel_conf.bandwidth = BMA4_ACCEL_NORMAL_AVG4;
accel_conf.perf_mode = BMA4_CIC_AVG_MODE;
ret = bma4_set_accel_config(&accel_conf, &bma);
if (ret != BMA4_OK)
if (ret != BMA4_OK) {
return;
}
isOk = true;
}
@ -109,8 +117,9 @@ void Bma421::Write(uint8_t registerAddress, const uint8_t* data, size_t size) {
}
Bma421::Values Bma421::Process() {
if (not isOk)
if (not isOk) {
return {};
}
struct bma4_accel rawData;
struct bma4_accel data;
bma4_read_accel_xyz(&rawData, &bma);

View file

@ -47,4 +47,4 @@ namespace Pinetime {
DeviceTypes deviceType = DeviceTypes::Unknown;
};
}
}
}

View file

@ -52,19 +52,19 @@
*/
#ifndef BMA4_H__
#define BMA4_H__
#define BMA4_H__
/*********************************************************************/
/* header files */
#include "bma4_defs.h"
#ifdef AKM9916
#include "aux_akm9916.h"
#endif
#include "bma4_defs.h"
#ifdef AKM9916
#include "aux_akm9916.h"
#endif
#ifdef BMM150
#include "aux_bmm150.h"
#endif
#ifdef BMM150
#include "aux_bmm150.h"
#endif
/*********************************************************************/
/* (extern) variable declarations */
@ -104,7 +104,7 @@
* affect the reference value of the parameter
* (Better case don't change the reference value of the parameter)
*/
int8_t bma4_init(struct bma4_dev *dev);
int8_t bma4_init(struct bma4_dev* dev);
/**
* \ingroup bma4
@ -126,7 +126,7 @@ int8_t bma4_init(struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_write_config_file(struct bma4_dev *dev);
int8_t bma4_write_config_file(struct bma4_dev* dev);
/**
* \ingroup bma4
@ -157,7 +157,7 @@ int8_t bma4_write_config_file(struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_write_regs(uint8_t addr, const uint8_t *data, uint32_t len, struct bma4_dev *dev);
int8_t bma4_write_regs(uint8_t addr, const uint8_t* data, uint32_t len, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiRegisters
@ -181,7 +181,7 @@ int8_t bma4_write_regs(uint8_t addr, const uint8_t *data, uint32_t len, struct b
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_read_regs(uint8_t addr, uint8_t *data, uint32_t len, struct bma4_dev *dev);
int8_t bma4_read_regs(uint8_t addr, uint8_t* data, uint32_t len, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -232,7 +232,7 @@ int8_t bma4_read_regs(uint8_t addr, uint8_t *data, uint32_t len, struct bma4_dev
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_error_status(struct bma4_err_reg *err_reg, struct bma4_dev *dev);
int8_t bma4_get_error_status(struct bma4_err_reg* err_reg, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -267,7 +267,7 @@ int8_t bma4_get_error_status(struct bma4_err_reg *err_reg, struct bma4_dev *dev)
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_status(uint8_t *status, struct bma4_dev *dev);
int8_t bma4_get_status(uint8_t* status, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -295,7 +295,7 @@ int8_t bma4_get_status(uint8_t *status, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_read_accel_xyz(struct bma4_accel *accel, struct bma4_dev *dev);
int8_t bma4_read_accel_xyz(struct bma4_accel* accel, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -319,7 +319,7 @@ int8_t bma4_read_accel_xyz(struct bma4_accel *accel, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_sensor_time(uint32_t *sensor_time, struct bma4_dev *dev);
int8_t bma4_get_sensor_time(uint32_t* sensor_time, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -358,7 +358,7 @@ int8_t bma4_get_sensor_time(uint32_t *sensor_time, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_temperature(int32_t *temp, uint8_t temp_unit, struct bma4_dev *dev);
int8_t bma4_get_temperature(int32_t* temp, uint8_t temp_unit, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -426,7 +426,7 @@ int8_t bma4_get_temperature(int32_t *temp, uint8_t temp_unit, struct bma4_dev *d
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_accel_config(struct bma4_accel_config *accel, struct bma4_dev *dev);
int8_t bma4_get_accel_config(struct bma4_accel_config* accel, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiAccel
@ -490,7 +490,7 @@ int8_t bma4_get_accel_config(struct bma4_accel_config *accel, struct bma4_dev *d
* @retval < 0 -> Fail
*
*/
int8_t bma4_set_accel_config(const struct bma4_accel_config *accel, struct bma4_dev *dev);
int8_t bma4_set_accel_config(const struct bma4_accel_config* accel, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -517,7 +517,7 @@ int8_t bma4_set_accel_config(const struct bma4_accel_config *accel, struct bma4_
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_advance_power_save(uint8_t adv_pwr_save, struct bma4_dev *dev);
int8_t bma4_set_advance_power_save(uint8_t adv_pwr_save, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiAdvancedPowerMode
@ -539,7 +539,7 @@ int8_t bma4_set_advance_power_save(uint8_t adv_pwr_save, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_advance_power_save(uint8_t *adv_pwr_save, struct bma4_dev *dev);
int8_t bma4_get_advance_power_save(uint8_t* adv_pwr_save, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -566,7 +566,7 @@ int8_t bma4_get_advance_power_save(uint8_t *adv_pwr_save, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_fifo_self_wakeup(uint8_t fifo_self_wakeup, struct bma4_dev *dev);
int8_t bma4_set_fifo_self_wakeup(uint8_t fifo_self_wakeup, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiFIFOSelfWakeUp
@ -588,7 +588,7 @@ int8_t bma4_set_fifo_self_wakeup(uint8_t fifo_self_wakeup, struct bma4_dev *dev)
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_fifo_self_wakeup(uint8_t *fifo_self_wake_up, struct bma4_dev *dev);
int8_t bma4_get_fifo_self_wakeup(uint8_t* fifo_self_wake_up, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -613,7 +613,7 @@ int8_t bma4_get_fifo_self_wakeup(uint8_t *fifo_self_wake_up, struct bma4_dev *de
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_accel_enable(uint8_t accel_en, struct bma4_dev *dev);
int8_t bma4_set_accel_enable(uint8_t accel_en, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiAccelEnable
@ -631,7 +631,7 @@ int8_t bma4_set_accel_enable(uint8_t accel_en, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_accel_enable(uint8_t *accel_en, struct bma4_dev *dev);
int8_t bma4_get_accel_enable(uint8_t* accel_en, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -657,7 +657,7 @@ int8_t bma4_get_accel_enable(uint8_t *accel_en, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_mag_enable(uint8_t mag_en, struct bma4_dev *dev);
int8_t bma4_set_mag_enable(uint8_t mag_en, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiMagEnable
@ -676,7 +676,7 @@ int8_t bma4_set_mag_enable(uint8_t mag_en, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_mag_enable(uint8_t *mag_en, struct bma4_dev *dev);
int8_t bma4_get_mag_enable(uint8_t* mag_en, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -709,7 +709,7 @@ int8_t bma4_get_mag_enable(uint8_t *mag_en, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_spi_interface(uint8_t *spi, struct bma4_dev *dev);
int8_t bma4_get_spi_interface(uint8_t* spi, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiSpiInterface
@ -735,7 +735,7 @@ int8_t bma4_get_spi_interface(uint8_t *spi, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_spi_interface(uint8_t spi, struct bma4_dev *dev);
int8_t bma4_set_spi_interface(uint8_t spi, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -772,7 +772,7 @@ int8_t bma4_set_spi_interface(uint8_t spi, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_command_register(uint8_t command_reg, struct bma4_dev *dev);
int8_t bma4_set_command_register(uint8_t command_reg, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -794,7 +794,7 @@ int8_t bma4_set_command_register(uint8_t command_reg, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_i2c_device_addr(struct bma4_dev *dev);
int8_t bma4_set_i2c_device_addr(struct bma4_dev* dev);
/**
* \ingroup bma4
@ -828,7 +828,7 @@ int8_t bma4_set_i2c_device_addr(struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_mag_manual_enable(uint8_t mag_manual, struct bma4_dev *dev);
int8_t bma4_set_mag_manual_enable(uint8_t mag_manual, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiMagManualEnable
@ -856,7 +856,7 @@ int8_t bma4_set_mag_manual_enable(uint8_t mag_manual, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_mag_manual_enable(uint8_t *mag_manual, struct bma4_dev *dev);
int8_t bma4_get_mag_manual_enable(uint8_t* mag_manual, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -888,7 +888,7 @@ int8_t bma4_get_mag_manual_enable(uint8_t *mag_manual, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_aux_if_mode(uint8_t if_mode, struct bma4_dev *dev);
int8_t bma4_set_aux_if_mode(uint8_t if_mode, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -913,7 +913,7 @@ int8_t bma4_set_aux_if_mode(uint8_t if_mode, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_mag_read_addr(uint8_t *mag_read_addr, struct bma4_dev *dev);
int8_t bma4_get_mag_read_addr(uint8_t* mag_read_addr, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiMagRead
@ -932,7 +932,7 @@ int8_t bma4_get_mag_read_addr(uint8_t *mag_read_addr, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_mag_read_addr(uint8_t mag_read_addr, struct bma4_dev *dev);
int8_t bma4_set_mag_read_addr(uint8_t mag_read_addr, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -957,7 +957,7 @@ int8_t bma4_set_mag_read_addr(uint8_t mag_read_addr, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_mag_write_addr(uint8_t *mag_write_addr, struct bma4_dev *dev);
int8_t bma4_get_mag_write_addr(uint8_t* mag_write_addr, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiMagWrite
@ -976,7 +976,7 @@ int8_t bma4_get_mag_write_addr(uint8_t *mag_write_addr, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_mag_write_addr(uint8_t mag_write_addr, struct bma4_dev *dev);
int8_t bma4_set_mag_write_addr(uint8_t mag_write_addr, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1001,7 +1001,7 @@ int8_t bma4_set_mag_write_addr(uint8_t mag_write_addr, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_mag_write_data(uint8_t *mag_write_data, struct bma4_dev *dev);
int8_t bma4_get_mag_write_data(uint8_t* mag_write_data, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiMagData
@ -1020,7 +1020,7 @@ int8_t bma4_get_mag_write_data(uint8_t *mag_write_data, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_mag_write_data(uint8_t mag_write_data, struct bma4_dev *dev);
int8_t bma4_set_mag_write_data(uint8_t mag_write_data, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1045,7 +1045,7 @@ int8_t bma4_set_mag_write_data(uint8_t mag_write_data, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_read_mag_xyzr(struct bma4_mag_xyzr *mag, struct bma4_dev *dev);
int8_t bma4_read_mag_xyzr(struct bma4_mag_xyzr* mag, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1069,7 +1069,7 @@ int8_t bma4_read_mag_xyzr(struct bma4_mag_xyzr *mag, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_mag_burst(uint8_t mag_burst, struct bma4_dev *dev);
int8_t bma4_set_mag_burst(uint8_t mag_burst, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiMagBurst
@ -1086,7 +1086,7 @@ int8_t bma4_set_mag_burst(uint8_t mag_burst, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_mag_burst(uint8_t *mag_burst, struct bma4_dev *dev);
int8_t bma4_get_mag_burst(uint8_t* mag_burst, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1108,7 +1108,7 @@ int8_t bma4_get_mag_burst(uint8_t *mag_burst, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_read_fifo_data(struct bma4_fifo_frame *fifo, struct bma4_dev *dev);
int8_t bma4_read_fifo_data(struct bma4_fifo_frame* fifo, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1135,7 +1135,7 @@ int8_t bma4_read_fifo_data(struct bma4_fifo_frame *fifo, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_fifo_wm(uint16_t *fifo_wm, struct bma4_dev *dev);
int8_t bma4_get_fifo_wm(uint16_t* fifo_wm, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiFIFOWM
@ -1155,7 +1155,7 @@ int8_t bma4_get_fifo_wm(uint16_t *fifo_wm, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_fifo_wm(uint16_t fifo_wm, struct bma4_dev *dev);
int8_t bma4_set_fifo_wm(uint16_t fifo_wm, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1188,7 +1188,7 @@ int8_t bma4_set_fifo_wm(uint16_t fifo_wm, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_accel_fifo_filter_data(uint8_t *accel_fifo_filter, struct bma4_dev *dev);
int8_t bma4_get_accel_fifo_filter_data(uint8_t* accel_fifo_filter, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiAccelFIFOFilterData
@ -1215,7 +1215,7 @@ int8_t bma4_get_accel_fifo_filter_data(uint8_t *accel_fifo_filter, struct bma4_d
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_accel_fifo_filter_data(uint8_t accel_fifo_filter, struct bma4_dev *dev);
int8_t bma4_set_accel_fifo_filter_data(uint8_t accel_fifo_filter, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1240,7 +1240,7 @@ int8_t bma4_set_accel_fifo_filter_data(uint8_t accel_fifo_filter, struct bma4_de
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_fifo_down_accel(uint8_t *fifo_down, struct bma4_dev *dev);
int8_t bma4_get_fifo_down_accel(uint8_t* fifo_down, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiAccelFIFOFilterData
@ -1258,7 +1258,7 @@ int8_t bma4_get_fifo_down_accel(uint8_t *fifo_down, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_fifo_down_accel(uint8_t fifo_down, struct bma4_dev *dev);
int8_t bma4_set_fifo_down_accel(uint8_t fifo_down, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1287,7 +1287,7 @@ int8_t bma4_set_fifo_down_accel(uint8_t fifo_down, struct bma4_dev *dev);
* @retval < 0 -> Fail
*
*/
int8_t bma4_get_fifo_length(uint16_t *fifo_length, struct bma4_dev *dev);
int8_t bma4_get_fifo_length(uint16_t* fifo_length, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1327,7 +1327,7 @@ int8_t bma4_get_fifo_length(uint16_t *fifo_length, struct bma4_dev *dev);
*/
int8_t bma4_second_if_mag_compensate_xyz(struct bma4_mag_fifo_data mag_fifo_data,
uint8_t mag_second_if,
const struct bma4_mag *compensated_mag_data);
const struct bma4_mag* compensated_mag_data);
/**
* \ingroup bma4
@ -1363,7 +1363,7 @@ int8_t bma4_second_if_mag_compensate_xyz(struct bma4_mag_fifo_data mag_fifo_data
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_read_mag_xyz(const struct bma4_mag *mag, uint8_t sensor_select, const struct bma4_dev *dev);
int8_t bma4_read_mag_xyz(const struct bma4_mag* mag, uint8_t sensor_select, const struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1396,7 +1396,7 @@ int8_t bma4_read_mag_xyz(const struct bma4_mag *mag, uint8_t sensor_select, cons
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_if_mode(uint8_t *if_mode, struct bma4_dev *dev);
int8_t bma4_get_if_mode(uint8_t* if_mode, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiIFMode
@ -1422,7 +1422,7 @@ int8_t bma4_get_if_mode(uint8_t *if_mode, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_if_mode(uint8_t if_mode, struct bma4_dev *dev);
int8_t bma4_set_if_mode(uint8_t if_mode, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1446,7 +1446,7 @@ int8_t bma4_set_if_mode(uint8_t if_mode, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_accel_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev);
int8_t bma4_get_accel_data_rdy(uint8_t* data_rdy, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1470,7 +1470,7 @@ int8_t bma4_get_accel_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_mag_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev);
int8_t bma4_get_mag_data_rdy(uint8_t* data_rdy, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1507,7 +1507,7 @@ int8_t bma4_get_mag_data_rdy(uint8_t *data_rdy, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_asic_status(struct bma4_asic_status *asic_status, struct bma4_dev *dev);
int8_t bma4_get_asic_status(struct bma4_asic_status* asic_status, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1540,7 +1540,7 @@ int8_t bma4_get_asic_status(struct bma4_asic_status *asic_status, struct bma4_de
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_offset_comp(uint8_t offset_en, struct bma4_dev *dev);
int8_t bma4_set_offset_comp(uint8_t offset_en, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiOffsetComp
@ -1566,7 +1566,7 @@ int8_t bma4_set_offset_comp(uint8_t offset_en, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_get_offset_comp(uint8_t *offset_en, struct bma4_dev *dev);
int8_t bma4_get_offset_comp(uint8_t* offset_en, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1607,10 +1607,7 @@ int8_t bma4_get_offset_comp(uint8_t *offset_en, struct bma4_dev *dev);
* @retval < 0 -> Fail
*
*/
int8_t bma4_extract_accel(struct bma4_accel *accel_data,
uint16_t *accel_length,
struct bma4_fifo_frame *fifo,
const struct bma4_dev *dev);
int8_t bma4_extract_accel(struct bma4_accel* accel_data, uint16_t* accel_length, struct bma4_fifo_frame* fifo, const struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1650,10 +1647,7 @@ int8_t bma4_extract_accel(struct bma4_accel *accel_data,
* @retval < 0 -> Fail
*
*/
int8_t bma4_extract_mag(const struct bma4_mag *mag_data,
uint16_t *mag_length,
struct bma4_fifo_frame *fifo,
const struct bma4_dev *dev);
int8_t bma4_extract_mag(const struct bma4_mag* mag_data, uint16_t* mag_length, struct bma4_fifo_frame* fifo, const struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1686,7 +1680,7 @@ int8_t bma4_extract_mag(const struct bma4_mag *mag_data,
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_perform_accel_selftest(int8_t *result, struct bma4_dev *dev);
int8_t bma4_perform_accel_selftest(int8_t* result, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiAccelSelftest
@ -1704,7 +1698,7 @@ int8_t bma4_perform_accel_selftest(int8_t *result, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_selftest_config(uint8_t sign, struct bma4_dev *dev);
int8_t bma4_selftest_config(uint8_t sign, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1749,7 +1743,7 @@ int8_t bma4_selftest_config(uint8_t sign, struct bma4_dev *dev);
* @retval < 0 -> Fail
*
*/
int8_t bma4_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, struct bma4_dev *dev);
int8_t bma4_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiInterrupt
@ -1776,7 +1770,7 @@ int8_t bma4_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, st
* @retval < 0 -> Fail
*
*/
int8_t bma4_set_interrupt_mode(uint8_t mode, struct bma4_dev *dev);
int8_t bma4_set_interrupt_mode(uint8_t mode, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiInterrupt
@ -1803,7 +1797,7 @@ int8_t bma4_set_interrupt_mode(uint8_t mode, struct bma4_dev *dev);
* @retval < 0 -> Fail
*
*/
int8_t bma4_get_interrupt_mode(uint8_t *mode, struct bma4_dev *dev);
int8_t bma4_get_interrupt_mode(uint8_t* mode, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1853,7 +1847,7 @@ int8_t bma4_get_interrupt_mode(uint8_t *mode, struct bma4_dev *dev);
* @retval < 0 -> Fail
*
*/
int8_t bma4_set_aux_mag_config(const struct bma4_aux_mag_config *aux_mag, struct bma4_dev *dev);
int8_t bma4_set_aux_mag_config(const struct bma4_aux_mag_config* aux_mag, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiAuxMagConfig
@ -1898,7 +1892,7 @@ int8_t bma4_set_aux_mag_config(const struct bma4_aux_mag_config *aux_mag, struct
* @retval < 0 -> Fail
*
*/
int8_t bma4_get_aux_mag_config(struct bma4_aux_mag_config *aux_mag, struct bma4_dev *dev);
int8_t bma4_get_aux_mag_config(struct bma4_aux_mag_config* aux_mag, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -1942,7 +1936,7 @@ int8_t bma4_get_aux_mag_config(struct bma4_aux_mag_config *aux_mag, struct bma4_
* @retval < 0 -> Fail
*
*/
int8_t bma4_set_fifo_config(uint8_t config, uint8_t enable, struct bma4_dev *dev);
int8_t bma4_set_fifo_config(uint8_t config, uint8_t enable, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiFIFOConfig
@ -1979,7 +1973,7 @@ int8_t bma4_set_fifo_config(uint8_t config, uint8_t enable, struct bma4_dev *dev
* @retval < 0 -> Fail
*
*/
int8_t bma4_get_fifo_config(uint8_t *fifo_config, struct bma4_dev *dev);
int8_t bma4_get_fifo_config(uint8_t* fifo_config, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -2039,8 +2033,7 @@ int8_t bma4_get_fifo_config(uint8_t *fifo_config, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma4_set_int_pin_config(const struct bma4_int_pin_config *int_pin_config, uint8_t int_line,
struct bma4_dev *dev);
int8_t bma4_set_int_pin_config(const struct bma4_int_pin_config* int_pin_config, uint8_t int_line, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiIntConfig
@ -2092,7 +2085,7 @@ int8_t bma4_set_int_pin_config(const struct bma4_int_pin_config *int_pin_config,
* @retval < 0 -> Fail
*
*/
int8_t bma4_get_int_pin_config(struct bma4_int_pin_config *int_pin_config, uint8_t int_line, struct bma4_dev *dev);
int8_t bma4_get_int_pin_config(struct bma4_int_pin_config* int_pin_config, uint8_t int_line, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -2116,7 +2109,7 @@ int8_t bma4_get_int_pin_config(struct bma4_int_pin_config *int_pin_config, uint8
* @retval < 0 -> Fail
*
*/
int8_t bma4_read_int_status(uint16_t *int_status, struct bma4_dev *dev);
int8_t bma4_read_int_status(uint16_t* int_status, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiIntStatus
@ -2134,7 +2127,7 @@ int8_t bma4_read_int_status(uint16_t *int_status, struct bma4_dev *dev);
* @retval < 0 -> Fail
*
*/
int8_t bma4_read_int_status_0(uint8_t *int_status_0, struct bma4_dev *dev);
int8_t bma4_read_int_status_0(uint8_t* int_status_0, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiIntStatus
@ -2152,7 +2145,7 @@ int8_t bma4_read_int_status_0(uint8_t *int_status_0, struct bma4_dev *dev);
* @retval < 0 -> Fail
*
*/
int8_t bma4_read_int_status_1(uint8_t *int_status_1, struct bma4_dev *dev);
int8_t bma4_read_int_status_1(uint8_t* int_status_1, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -2176,7 +2169,7 @@ int8_t bma4_read_int_status_1(uint8_t *int_status_1, struct bma4_dev *dev);
* @retval < 0 -> Fail
*
*/
int8_t bma4_aux_interface_init(struct bma4_dev *dev);
int8_t bma4_aux_interface_init(struct bma4_dev* dev);
/*!
* \ingroup bma4ApiAux
@ -2197,7 +2190,7 @@ int8_t bma4_aux_interface_init(struct bma4_dev *dev);
* @retval < 0 -> Fail
*
*/
int8_t bma4_aux_read(uint8_t aux_reg_addr, uint8_t *aux_data, uint16_t len, struct bma4_dev *dev);
int8_t bma4_aux_read(uint8_t aux_reg_addr, uint8_t* aux_data, uint16_t len, struct bma4_dev* dev);
/*!
* \ingroup bma4ApiAux
@ -2218,7 +2211,7 @@ int8_t bma4_aux_read(uint8_t aux_reg_addr, uint8_t *aux_data, uint16_t len, stru
* @retval < 0 -> Fail
*
*/
int8_t bma4_aux_write(uint8_t aux_reg_addr, const uint8_t *aux_data, uint16_t len, struct bma4_dev *dev);
int8_t bma4_aux_write(uint8_t aux_reg_addr, const uint8_t* aux_data, uint16_t len, struct bma4_dev* dev);
/**
* \ingroup bma4
@ -2241,7 +2234,7 @@ int8_t bma4_aux_write(uint8_t aux_reg_addr, const uint8_t *aux_data, uint16_t le
* @retval < 0 -> Fail
*
*/
int8_t bma4_soft_reset(struct bma4_dev *dev);
int8_t bma4_soft_reset(struct bma4_dev* dev);
/**
* \ingroup bma4
@ -2274,7 +2267,7 @@ int8_t bma4_soft_reset(struct bma4_dev *dev);
* @retval Any non zero value -> Fail
*
*/
int8_t bma4_perform_accel_foc(const struct bma4_accel_foc_g_value *accel_g_value, struct bma4_dev *dev);
int8_t bma4_perform_accel_foc(const struct bma4_accel_foc_g_value* accel_g_value, struct bma4_dev* dev);
#endif

View file

@ -51,131 +51,131 @@ extern "C" {
#include "bma4.h"
/**\name Chip ID of BMA423 sensor */
#define BMA423_CHIP_ID UINT8_C(0x11)
#define BMA425_CHIP_ID UINT8_C(0x13)
#define BMA423_CHIP_ID UINT8_C(0x11)
#define BMA425_CHIP_ID UINT8_C(0x13)
/**\ Configuration ID start position of BMA423 sensor */
#define BMA423_CONFIG_ID_START_ADDR UINT8_C(66)
#define BMA423_CONFIG_ID_START_ADDR UINT8_C(66)
/**\name Sensor feature size */
#define BMA423_FEATURE_SIZE UINT8_C(70)
#define BMA423_ANY_MOT_LEN UINT8_C(4)
#define BMA423_FEATURE_SIZE UINT8_C(70)
#define BMA423_ANY_MOT_LEN UINT8_C(4)
/**\name Feature offset address */
#define BMA423_ANY_MOT_OFFSET UINT8_C(0x00)
#define BMA423_NO_MOT_OFFSET UINT8_C(0x04)
#define BMA423_STEP_CNTR_PARAM_OFFSET UINT8_C(0x08)
#define BMA423_STEP_CNTR_OFFSET UINT8_C(0x3A)
#define BMA423_SINGLE_TAP_OFFSET UINT8_C(0x3C)
#define BMA423_DOUBLE_TAP_OFFSET UINT8_C(0x3E)
#define BMA423_WRIST_WEAR_OFFSET UINT8_C(0x40)
#define BMA423_CONFIG_ID_OFFSET UINT8_C(0x42)
#define BMA423_AXES_REMAP_OFFSET UINT8_C(0x44)
#define BMA423_ANY_MOT_OFFSET UINT8_C(0x00)
#define BMA423_NO_MOT_OFFSET UINT8_C(0x04)
#define BMA423_STEP_CNTR_PARAM_OFFSET UINT8_C(0x08)
#define BMA423_STEP_CNTR_OFFSET UINT8_C(0x3A)
#define BMA423_SINGLE_TAP_OFFSET UINT8_C(0x3C)
#define BMA423_DOUBLE_TAP_OFFSET UINT8_C(0x3E)
#define BMA423_WRIST_WEAR_OFFSET UINT8_C(0x40)
#define BMA423_CONFIG_ID_OFFSET UINT8_C(0x42)
#define BMA423_AXES_REMAP_OFFSET UINT8_C(0x44)
/**\name Read/Write Lengths */
#define BMA423_RD_WR_MIN_LEN UINT8_C(2)
#define BMA423_NO_MOT_RD_WR_LEN (BMA423_ANY_MOT_LEN + BMA423_NO_MOT_OFFSET)
#define BMA423_RD_WR_MIN_LEN UINT8_C(2)
#define BMA423_NO_MOT_RD_WR_LEN (BMA423_ANY_MOT_LEN + BMA423_NO_MOT_OFFSET)
/*! @name Mask definitions for major and minor config */
#define BMA423_CONFIG_MAJOR_MSK UINT16_C(0X3C0)
#define BMA423_CONFIG_MINOR_MSK UINT8_C(0X1F)
#define BMA423_CONFIG_MAJOR_MSK UINT16_C(0X3C0)
#define BMA423_CONFIG_MINOR_MSK UINT8_C(0X1F)
/*! @name Bit position for major config */
#define BMA423_CONFIG_MAJOR_POS UINT8_C(0X06)
#define BMA423_CONFIG_MAJOR_POS UINT8_C(0X06)
/**************************************************************/
/**\name Re-map Axes */
/**************************************************************/
#define BMA423_X_AXIS_MASK UINT8_C(0x03)
#define BMA423_X_AXIS_SIGN_MASK UINT8_C(0x04)
#define BMA423_Y_AXIS_MASK UINT8_C(0x18)
#define BMA423_Y_AXIS_SIGN_MASK UINT8_C(0x20)
#define BMA423_Z_AXIS_MASK UINT8_C(0xC0)
#define BMA423_Z_AXIS_SIGN_MASK UINT8_C(0x01)
#define BMA423_X_AXIS_MASK UINT8_C(0x03)
#define BMA423_X_AXIS_SIGN_MASK UINT8_C(0x04)
#define BMA423_Y_AXIS_MASK UINT8_C(0x18)
#define BMA423_Y_AXIS_SIGN_MASK UINT8_C(0x20)
#define BMA423_Z_AXIS_MASK UINT8_C(0xC0)
#define BMA423_Z_AXIS_SIGN_MASK UINT8_C(0x01)
/**************************************************************/
/**\name Step Counter/Detector/Activity */
/**************************************************************/
/**\name Step counter/activity enable macros */
#define BMA423_STEP_CNTR_EN_MSK UINT8_C(0x10)
#define BMA423_STEP_ACT_EN_MSK UINT8_C(0x20)
#define BMA423_STEP_CNTR_EN_MSK UINT8_C(0x10)
#define BMA423_STEP_ACT_EN_MSK UINT8_C(0x20)
/**\name Step counter water-mark macros */
#define BMA423_STEP_CNTR_WM_MSK UINT16_C(0x03FF)
#define BMA423_STEP_CNTR_WM_MSK UINT16_C(0x03FF)
/**\name Step counter reset macros */
#define BMA423_STEP_CNTR_RST_POS UINT8_C(2)
#define BMA423_STEP_CNTR_RST_MSK UINT8_C(0x04)
#define BMA423_STEP_CNTR_RST_POS UINT8_C(2)
#define BMA423_STEP_CNTR_RST_MSK UINT8_C(0x04)
/**\name Step detector enable macros */
#define BMA423_STEP_DETECTOR_EN_POS UINT8_C(3)
#define BMA423_STEP_DETECTOR_EN_MSK UINT8_C(0x08)
#define BMA423_STEP_DETECTOR_EN_POS UINT8_C(3)
#define BMA423_STEP_DETECTOR_EN_MSK UINT8_C(0x08)
/**\name Wrist-wear enable macros */
#define BMA423_WRIST_WEAR_EN_MSK UINT8_C(0x01)
#define BMA423_WRIST_WEAR_EN_MSK UINT8_C(0x01)
/**\name Step count output length*/
#define BMA423_STEP_CNTR_DATA_SIZE UINT16_C(4)
#define BMA423_STEP_CNTR_DATA_SIZE UINT16_C(4)
/**\name single tap enable macros */
#define BMA423_SINGLE_TAP_EN_MSK UINT8_C(0x01)
#define BMA423_SINGLE_TAP_EN_MSK UINT8_C(0x01)
/**\name double tap enable macros */
#define BMA423_DOUBLE_TAP_EN_MSK UINT8_C(0x01)
#define BMA423_DOUBLE_TAP_EN_MSK UINT8_C(0x01)
/**\name tap sensitivity macros */
#define BMA423_TAP_SENS_POS UINT8_C(1)
#define BMA423_TAP_SENS_MSK UINT8_C(0x0E)
#define BMA423_TAP_SENS_POS UINT8_C(1)
#define BMA423_TAP_SENS_MSK UINT8_C(0x0E)
/**\name Tap selection macro */
#define BMA423_TAP_SEL_POS UINT8_C(4)
#define BMA423_TAP_SEL_MSK UINT8_C(0x10)
#define BMA423_TAP_SEL_POS UINT8_C(4)
#define BMA423_TAP_SEL_MSK UINT8_C(0x10)
/**************************************************************/
/**\name Any/no Motion */
/**************************************************************/
/**\name Any/No motion threshold macros */
#define BMA423_ANY_NO_MOT_THRES_MSK UINT16_C(0x07FF)
#define BMA423_ANY_NO_MOT_THRES_MSK UINT16_C(0x07FF)
/**\name Any/No motion duration macros */
#define BMA423_ANY_NO_MOT_DUR_MSK UINT16_C(0x1FFF)
#define BMA423_ANY_NO_MOT_DUR_MSK UINT16_C(0x1FFF)
/**\name Any/No motion enable macros */
#define BMA423_ANY_NO_MOT_AXIS_EN_POS UINT8_C(0x0D)
#define BMA423_ANY_NO_MOT_AXIS_EN_MSK UINT16_C(0xE000)
#define BMA423_ANY_NO_MOT_AXIS_EN_POS UINT8_C(0x0D)
#define BMA423_ANY_NO_MOT_AXIS_EN_MSK UINT16_C(0xE000)
/**************************************************************/
/**\name User macros */
/**************************************************************/
/**\name Any-motion/No-motion axis enable macros */
#define BMA423_X_AXIS_EN UINT8_C(0x01)
#define BMA423_Y_AXIS_EN UINT8_C(0x02)
#define BMA423_Z_AXIS_EN UINT8_C(0x04)
#define BMA423_EN_ALL_AXIS UINT8_C(0x07)
#define BMA423_DIS_ALL_AXIS UINT8_C(0x00)
#define BMA423_X_AXIS_EN UINT8_C(0x01)
#define BMA423_Y_AXIS_EN UINT8_C(0x02)
#define BMA423_Z_AXIS_EN UINT8_C(0x04)
#define BMA423_EN_ALL_AXIS UINT8_C(0x07)
#define BMA423_DIS_ALL_AXIS UINT8_C(0x00)
/**\name Feature enable macros for the sensor */
#define BMA423_STEP_CNTR UINT8_C(0x01)
#define BMA423_STEP_ACT UINT8_C(0x02)
#define BMA423_WRIST_WEAR UINT8_C(0x04)
#define BMA423_SINGLE_TAP UINT8_C(0x08)
#define BMA423_DOUBLE_TAP UINT8_C(0x10)
#define BMA423_STEP_CNTR UINT8_C(0x01)
#define BMA423_STEP_ACT UINT8_C(0x02)
#define BMA423_WRIST_WEAR UINT8_C(0x04)
#define BMA423_SINGLE_TAP UINT8_C(0x08)
#define BMA423_DOUBLE_TAP UINT8_C(0x10)
/**\name Interrupt status macros */
#define BMA423_SINGLE_TAP_INT UINT8_C(0x01)
#define BMA423_STEP_CNTR_INT UINT8_C(0x02)
#define BMA423_ACTIVITY_INT UINT8_C(0x04)
#define BMA423_WRIST_WEAR_INT UINT8_C(0x08)
#define BMA423_DOUBLE_TAP_INT UINT8_C(0x10)
#define BMA423_ANY_MOT_INT UINT8_C(0x20)
#define BMA423_NO_MOT_INT UINT8_C(0x40)
#define BMA423_ERROR_INT UINT8_C(0x80)
#define BMA423_SINGLE_TAP_INT UINT8_C(0x01)
#define BMA423_STEP_CNTR_INT UINT8_C(0x02)
#define BMA423_ACTIVITY_INT UINT8_C(0x04)
#define BMA423_WRIST_WEAR_INT UINT8_C(0x08)
#define BMA423_DOUBLE_TAP_INT UINT8_C(0x10)
#define BMA423_ANY_MOT_INT UINT8_C(0x20)
#define BMA423_NO_MOT_INT UINT8_C(0x40)
#define BMA423_ERROR_INT UINT8_C(0x80)
/**\name Activity recognition macros */
#define BMA423_USER_STATIONARY UINT8_C(0x00)
#define BMA423_USER_WALKING UINT8_C(0x01)
#define BMA423_USER_RUNNING UINT8_C(0x02)
#define BMA423_STATE_INVALID UINT8_C(0x03)
#define BMA423_USER_STATIONARY UINT8_C(0x00)
#define BMA423_USER_WALKING UINT8_C(0x01)
#define BMA423_USER_RUNNING UINT8_C(0x02)
#define BMA423_STATE_INVALID UINT8_C(0x03)
/******************************************************************************/
/*! @name Structure Declarations */
@ -184,123 +184,120 @@ extern "C" {
/*!
* @brief Any/No motion configuration
*/
struct bma423_any_no_mot_config
{
/*! Expressed in 50 Hz samples (20 ms) */
uint16_t duration;
struct bma423_any_no_mot_config {
/*! Expressed in 50 Hz samples (20 ms) */
uint16_t duration;
/*! Threshold value for Any-motion/No-motion detection in
* 5.11g format
*/
uint16_t threshold;
/*! Threshold value for Any-motion/No-motion detection in
* 5.11g format
*/
uint16_t threshold;
/*! To enable selected axes */
uint8_t axes_en;
/*! To enable selected axes */
uint8_t axes_en;
};
/*!
* @brief Axes re-mapping configuration
*/
struct bma423_axes_remap
{
/*! Re-mapped x-axis */
uint8_t x_axis;
struct bma423_axes_remap {
/*! Re-mapped x-axis */
uint8_t x_axis;
/*! Re-mapped y-axis */
uint8_t y_axis;
/*! Re-mapped y-axis */
uint8_t y_axis;
/*! Re-mapped z-axis */
uint8_t z_axis;
/*! Re-mapped z-axis */
uint8_t z_axis;
/*! Re-mapped x-axis sign */
uint8_t x_axis_sign;
/*! Re-mapped x-axis sign */
uint8_t x_axis_sign;
/*! Re-mapped y-axis sign */
uint8_t y_axis_sign;
/*! Re-mapped y-axis sign */
uint8_t y_axis_sign;
/*! Re-mapped z-axis sign */
uint8_t z_axis_sign;
/*! Re-mapped z-axis sign */
uint8_t z_axis_sign;
};
/*!
* @brief Step counter param settings
*/
struct bma423_stepcounter_settings
{
/*! Step Counter param 1 */
uint16_t param1;
struct bma423_stepcounter_settings {
/*! Step Counter param 1 */
uint16_t param1;
/*! Step Counter param 2 */
uint16_t param2;
/*! Step Counter param 2 */
uint16_t param2;
/*! Step Counter param 3 */
uint16_t param3;
/*! Step Counter param 3 */
uint16_t param3;
/*! Step Counter param 4 */
uint16_t param4;
/*! Step Counter param 4 */
uint16_t param4;
/*! Step Counter param 5 */
uint16_t param5;
/*! Step Counter param 5 */
uint16_t param5;
/*! Step Counter param 6 */
uint16_t param6;
/*! Step Counter param 6 */
uint16_t param6;
/*! Step Counter param 7 */
uint16_t param7;
/*! Step Counter param 7 */
uint16_t param7;
/*! Step Counter param 8 */
uint16_t param8;
/*! Step Counter param 8 */
uint16_t param8;
/*! Step Counter param 9 */
uint16_t param9;
/*! Step Counter param 9 */
uint16_t param9;
/*! Step Counter param 10 */
uint16_t param10;
/*! Step Counter param 10 */
uint16_t param10;
/*! Step Counter param 11 */
uint16_t param11;
/*! Step Counter param 11 */
uint16_t param11;
/*! Step Counter param 12 */
uint16_t param12;
/*! Step Counter param 12 */
uint16_t param12;
/*! Step Counter param 13 */
uint16_t param13;
/*! Step Counter param 13 */
uint16_t param13;
/*! Step Counter param 14 */
uint16_t param14;
/*! Step Counter param 14 */
uint16_t param14;
/*! Step Counter param 15 */
uint16_t param15;
/*! Step Counter param 15 */
uint16_t param15;
/*! Step Counter param 16 */
uint16_t param16;
/*! Step Counter param 16 */
uint16_t param16;
/*! Step Counter param 17 */
uint16_t param17;
/*! Step Counter param 17 */
uint16_t param17;
/*! Step Counter param 18 */
uint16_t param18;
/*! Step Counter param 18 */
uint16_t param18;
/*! Step Counter param 19 */
uint16_t param19;
/*! Step Counter param 19 */
uint16_t param19;
/*! Step Counter param 20 */
uint16_t param20;
/*! Step Counter param 20 */
uint16_t param20;
/*! Step Counter param 21 */
uint16_t param21;
/*! Step Counter param 21 */
uint16_t param21;
/*! Step Counter param 22 */
uint16_t param22;
/*! Step Counter param 22 */
uint16_t param22;
/*! Step Counter param 23 */
uint16_t param23;
/*! Step Counter param 23 */
uint16_t param23;
/*! Step Counter param 24 */
uint16_t param24;
/*! Step Counter param 24 */
uint16_t param24;
/*! Step Counter param 25 */
uint16_t param25;
/*! Step Counter param 25 */
uint16_t param25;
};
/***************************************************************************/
@ -330,7 +327,7 @@ struct bma423_stepcounter_settings
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_init(struct bma4_dev *dev);
int8_t bma423_init(struct bma4_dev* dev);
/**
* \ingroup bma423
@ -353,7 +350,7 @@ int8_t bma423_init(struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_write_config_file(struct bma4_dev *dev);
int8_t bma423_write_config_file(struct bma4_dev* dev);
/**
* \ingroup bma423
@ -376,7 +373,7 @@ int8_t bma423_write_config_file(struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_get_config_id(uint16_t *config_id, struct bma4_dev *dev);
int8_t bma423_get_config_id(uint16_t* config_id, struct bma4_dev* dev);
/**
* \ingroup bma423
@ -434,7 +431,7 @@ int8_t bma423_get_config_id(uint16_t *config_id, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, struct bma4_dev *dev);
int8_t bma423_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable, struct bma4_dev* dev);
/**
* \ingroup bma423
@ -474,7 +471,7 @@ int8_t bma423_map_interrupt(uint8_t int_line, uint16_t int_map, uint8_t enable,
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_read_int_status(uint16_t *int_status, struct bma4_dev *dev);
int8_t bma423_read_int_status(uint16_t* int_status, struct bma4_dev* dev);
/**
* \ingroup bma423
@ -516,7 +513,7 @@ int8_t bma423_read_int_status(uint16_t *int_status, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_feature_enable(uint8_t feature, uint8_t enable, struct bma4_dev *dev);
int8_t bma423_feature_enable(uint8_t feature, uint8_t enable, struct bma4_dev* dev);
/**
* \ingroup bma423
@ -539,7 +536,7 @@ int8_t bma423_feature_enable(uint8_t feature, uint8_t enable, struct bma4_dev *d
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_set_remap_axes(const struct bma423_axes_remap *remap_data, struct bma4_dev *dev);
int8_t bma423_set_remap_axes(const struct bma423_axes_remap* remap_data, struct bma4_dev* dev);
/*!
* \ingroup bma423ApiRemap
@ -557,7 +554,7 @@ int8_t bma423_set_remap_axes(const struct bma423_axes_remap *remap_data, struct
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_get_remap_axes(struct bma423_axes_remap *remap_data, struct bma4_dev *dev);
int8_t bma423_get_remap_axes(struct bma423_axes_remap* remap_data, struct bma4_dev* dev);
/**
* \ingroup bma423
@ -585,7 +582,7 @@ int8_t bma423_get_remap_axes(struct bma423_axes_remap *remap_data, struct bma4_d
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_step_counter_set_watermark(uint16_t step_counter_wm, struct bma4_dev *dev);
int8_t bma423_step_counter_set_watermark(uint16_t step_counter_wm, struct bma4_dev* dev);
/*!
* \ingroup bma423ApiStepC
@ -607,7 +604,7 @@ int8_t bma423_step_counter_set_watermark(uint16_t step_counter_wm, struct bma4_d
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_step_counter_get_watermark(uint16_t *step_counter_wm, struct bma4_dev *dev);
int8_t bma423_step_counter_get_watermark(uint16_t* step_counter_wm, struct bma4_dev* dev);
/*!
* \ingroup bma423ApiStepC
@ -623,7 +620,7 @@ int8_t bma423_step_counter_get_watermark(uint16_t *step_counter_wm, struct bma4_
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_reset_step_counter(struct bma4_dev *dev);
int8_t bma423_reset_step_counter(struct bma4_dev* dev);
/*!
* \ingroup bma423ApiStepC
@ -642,7 +639,7 @@ int8_t bma423_reset_step_counter(struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_step_counter_output(uint32_t *step_count, struct bma4_dev *dev);
int8_t bma423_step_counter_output(uint32_t* step_count, struct bma4_dev* dev);
/**
* \ingroup bma423
@ -676,7 +673,7 @@ int8_t bma423_step_counter_output(uint32_t *step_count, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_activity_output(uint8_t *activity, struct bma4_dev *dev);
int8_t bma423_activity_output(uint8_t* activity, struct bma4_dev* dev);
/*!
* \ingroup bma423ApiStepC
@ -695,7 +692,7 @@ int8_t bma423_activity_output(uint8_t *activity, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_stepcounter_get_parameter(struct bma423_stepcounter_settings *setting, struct bma4_dev *dev);
int8_t bma423_stepcounter_get_parameter(struct bma423_stepcounter_settings* setting, struct bma4_dev* dev);
/*!
* \ingroup bma423ApiStepC
@ -714,7 +711,7 @@ int8_t bma423_stepcounter_get_parameter(struct bma423_stepcounter_settings *sett
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_stepcounter_set_parameter(const struct bma423_stepcounter_settings *setting, struct bma4_dev *dev);
int8_t bma423_stepcounter_set_parameter(const struct bma423_stepcounter_settings* setting, struct bma4_dev* dev);
/**
* \ingroup bma421
@ -746,7 +743,7 @@ int8_t bma423_stepcounter_set_parameter(const struct bma423_stepcounter_settings
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_step_detector_enable(uint8_t enable, struct bma4_dev *dev);
int8_t bma423_step_detector_enable(uint8_t enable, struct bma4_dev* dev);
/**
* \ingroup bma423
@ -806,7 +803,7 @@ int8_t bma423_step_detector_enable(uint8_t enable, struct bma4_dev *dev);
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_set_any_mot_config(const struct bma423_any_no_mot_config *any_mot, struct bma4_dev *dev);
int8_t bma423_set_any_mot_config(const struct bma423_any_no_mot_config* any_mot, struct bma4_dev* dev);
/*!
* \ingroup bma423ApiAnyMot
@ -860,7 +857,7 @@ int8_t bma423_set_any_mot_config(const struct bma423_any_no_mot_config *any_mot,
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_get_any_mot_config(struct bma423_any_no_mot_config *any_mot, struct bma4_dev *dev);
int8_t bma423_get_any_mot_config(struct bma423_any_no_mot_config* any_mot, struct bma4_dev* dev);
/**
* \ingroup bma423
@ -920,7 +917,7 @@ int8_t bma423_get_any_mot_config(struct bma423_any_no_mot_config *any_mot, struc
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_set_no_mot_config(const struct bma423_any_no_mot_config *no_mot, struct bma4_dev *dev);
int8_t bma423_set_no_mot_config(const struct bma423_any_no_mot_config* no_mot, struct bma4_dev* dev);
/*!
* \ingroup bma423ApiNomot
@ -974,7 +971,7 @@ int8_t bma423_set_no_mot_config(const struct bma423_any_no_mot_config *no_mot, s
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_get_no_mot_config(struct bma423_any_no_mot_config *no_mot, struct bma4_dev *dev);
int8_t bma423_get_no_mot_config(struct bma423_any_no_mot_config* no_mot, struct bma4_dev* dev);
/**
* \ingroup bma423
@ -1006,7 +1003,7 @@ int8_t bma423_get_no_mot_config(struct bma423_any_no_mot_config *no_mot, struct
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_single_tap_set_sensitivity(uint8_t sensitivity, struct bma4_dev *dev);
int8_t bma423_single_tap_set_sensitivity(uint8_t sensitivity, struct bma4_dev* dev);
/*!
* \ingroup bma423ApiTap
@ -1032,7 +1029,7 @@ int8_t bma423_single_tap_set_sensitivity(uint8_t sensitivity, struct bma4_dev *d
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_double_tap_set_sensitivity(uint8_t sensitivity, struct bma4_dev *dev);
int8_t bma423_double_tap_set_sensitivity(uint8_t sensitivity, struct bma4_dev* dev);
/*!
* \ingroup bma423ApiTap
@ -1058,7 +1055,7 @@ int8_t bma423_double_tap_set_sensitivity(uint8_t sensitivity, struct bma4_dev *d
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_single_tap_get_sensitivity(uint8_t *sensitivity, struct bma4_dev *dev);
int8_t bma423_single_tap_get_sensitivity(uint8_t* sensitivity, struct bma4_dev* dev);
/*!
* \ingroup bma423ApiTap
@ -1084,7 +1081,7 @@ int8_t bma423_single_tap_get_sensitivity(uint8_t *sensitivity, struct bma4_dev *
* @retval 0 -> Success
* @retval < 0 -> Fail
*/
int8_t bma423_double_tap_get_sensitivity(uint8_t *sensitivity, struct bma4_dev *dev);
int8_t bma423_double_tap_get_sensitivity(uint8_t* sensitivity, struct bma4_dev* dev);
/**
* \ingroup bma423
@ -1107,7 +1104,7 @@ int8_t bma423_double_tap_get_sensitivity(uint8_t *sensitivity, struct bma4_dev *
* @retval BMA4_OK - Success.
* @retval BMA4_E_NULL_PTR - Error: Null pointer error
*/
int8_t bma423_get_version_config(uint16_t *config_major, uint16_t *config_minor, struct bma4_dev *dev);
int8_t bma423_get_version_config(uint16_t* config_major, uint16_t* config_minor, struct bma4_dev* dev);
#ifdef __cplusplus
}

File diff suppressed because it is too large Load diff

View file

@ -9,4 +9,4 @@ namespace Pinetime {
virtual bool GetNextBuffer(uint8_t** buffer, size_t& size) = 0;
};
}
}
}

View file

@ -103,14 +103,16 @@ Hrs3300::PackedHrsAls Hrs3300::ReadHrsAls() {
void Hrs3300::WriteRegister(uint8_t reg, uint8_t data) {
auto ret = twiMaster.Write(twiAddress, reg, &data, 1);
if (ret != TwiMaster::ErrorCodes::NoError)
if (ret != TwiMaster::ErrorCodes::NoError) {
NRF_LOG_INFO("WRITE ERROR");
}
}
uint8_t Hrs3300::ReadRegister(uint8_t reg) {
uint8_t value;
auto ret = twiMaster.Read(twiAddress, reg, &value, 1);
if (ret != TwiMaster::ErrorCodes::NoError)
if (ret != TwiMaster::ErrorCodes::NoError) {
NRF_LOG_INFO("READ ERROR");
}
return value;
}

View file

@ -13,4 +13,4 @@ namespace Pinetime {
static inline void Wait();
};
}
}
}

View file

@ -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) {
if (data == nullptr)
if (data == nullptr) {
return false;
}
auto ok = xSemaphoreTake(mutex, portMAX_DELAY);
ASSERT(ok == true);

View file

@ -92,13 +92,15 @@ void SpiNorFlash::SectorErase(uint32_t sectorAddress) {
static_cast<uint8_t>(sectorAddress)};
WriteEnable();
while (!WriteEnabled())
while (!WriteEnabled()) {
vTaskDelay(1);
}
spi.Read(reinterpret_cast<uint8_t*>(&cmd), cmdSize, nullptr, 0);
while (WriteInProgress())
while (WriteInProgress()) {
vTaskDelay(1);
}
}
uint8_t SpiNorFlash::ReadSecurityRegister() {
@ -132,13 +134,15 @@ void SpiNorFlash::Write(uint32_t address, const uint8_t* buffer, size_t size) {
static_cast<uint8_t>(addr)};
WriteEnable();
while (!WriteEnabled())
while (!WriteEnabled()) {
vTaskDelay(1);
}
spi.WriteCmdAndBuffer(cmd, cmdSize, b, toWrite);
while (WriteInProgress())
while (WriteInProgress()) {
vTaskDelay(1);
}
addr += toWrite;
b += toWrite;

@ -1 +0,0 @@
Subproject commit 56b17bf9f74096774944bcac0829adcd887d391e

View file

@ -8,4 +8,4 @@ namespace Pinetime {
virtual void Resume() = 0;
};
}
}
}

View file

@ -8,4 +8,4 @@ void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action
void DebounceTimerCallback(TimerHandle_t xTimer);
extern int mallocFailedCount;
extern int stackOverflowCount;
extern int stackOverflowCount;

View file

@ -152,8 +152,9 @@ int main(void) {
logger.Init();
nrf_drv_clock_init();
if (pdPASS != xTaskCreate(Process, "MAIN", 512, nullptr, 0, &taskHandle))
if (pdPASS != xTaskCreate(Process, "MAIN", 512, nullptr, 0, &taskHandle)) {
APP_ERROR_HANDLER(NRF_ERROR_NO_MEM);
}
vTaskStartScheduler();

View file

@ -12,10 +12,11 @@ void Pinetime::System::SystemMonitor::Process() {
auto nb = uxTaskGetSystemState(tasksStatus, 10, nullptr);
for (uint32_t i = 0; i < nb; i++) {
NRF_LOG_INFO("Task [%s] - %d", tasksStatus[i].pcTaskName, tasksStatus[i].usStackHighWaterMark);
if (tasksStatus[i].usStackHighWaterMark < 20)
if (tasksStatus[i].usStackHighWaterMark < 20) {
NRF_LOG_INFO("WARNING!!! Task %s task is nearly full, only %dB available",
tasksStatus[i].pcTaskName,
tasksStatus[i].usStackHighWaterMark * 4);
}
}
lastTick = xTaskGetTickCount();
}

View file

@ -401,7 +401,7 @@ void SystemTask::GoToRunning() {
}
state = SystemTaskState::Running;
};
}
void SystemTask::GoToSleep() {
if (IsSleeping()) {
@ -415,7 +415,7 @@ void SystemTask::GoToSleep() {
heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::GoToSleep);
state = SystemTaskState::GoingToSleep;
};
}
void SystemTask::UpdateMotion() {
if (IsSleeping() && !(settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::RaiseWrist) ||

View file

@ -85,7 +85,7 @@ namespace Pinetime {
Pinetime::Controllers::NimbleController& nimble() {
return nimbleController;
};
}
bool IsSleeping() const {
return state != SystemTaskState::Running;

View file

@ -20,7 +20,7 @@ do
*.cpp|*.h)
echo Checking "$file"
PATCH="$(basename "$file").patch"
git clang-format-14 -q --style file --diff "$GITHUB_BASE_REF" "$file" > "$PATCH"
git clang-format-16 -q --style file --diff "$GITHUB_BASE_REF" "$file" > "$PATCH"
if [ -s "$PATCH" ]
then
printf "\033[31mError:\033[0m Formatting error in %s\n" "$file"

View file

@ -17,7 +17,7 @@ do
src/libs/*|src/FreeRTOS/*) continue ;;
*.cpp|*.h)
echo "::group::$file"
clang-tidy-14 -p build "$file" || true
clang-tidy-16 -p build "$file" || true
echo "::endgroup::"
esac
done