Skip to content

Commit 95c84b1

Browse files
author
Louis Pearson
committed
Run clang-format on files changed in branch
1 parent d4e9abb commit 95c84b1

5 files changed

Lines changed: 19 additions & 29 deletions

File tree

src/components/stopwatch/StopWatchController.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ int wrap(int index) {
7070
return ((index % LAP_CAPACITY) + LAP_CAPACITY) % LAP_CAPACITY;
7171
}
7272

73-
LapInfo_t *StopWatch::lastLap(int lap) {
73+
LapInfo_t* StopWatch::lastLap(int lap) {
7474
if (lap >= LAP_CAPACITY || lap > lapCount || lapCount == 0) {
7575
// Return "empty" LapInfo_t
7676
return &emptyLapInfo;

src/components/stopwatch/StopWatchController.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Pinetime {
1414
enum class StopWatchStates { Cleared, Running, Paused };
1515

1616
struct LapInfo_t {
17-
int count = 0; // Used to label the lap
17+
int count = 0; // Used to label the lap
1818
TickType_t time = 0; // delta time from beginning of stopwatch
1919
};
2020

@@ -44,7 +44,7 @@ namespace Pinetime {
4444
/// Indexes into lap history, with 0 being the latest lap.
4545
/// If the lap is unavailable, count and time will be 0. If there is a
4646
/// real value, count should be above 0
47-
LapInfo_t *lastLap(int lap=0);
47+
LapInfo_t* lastLap(int lap = 0);
4848

4949
bool isRunning();
5050
bool isCleared();
@@ -59,7 +59,7 @@ namespace Pinetime {
5959
TickType_t timeElapsedPreviously = 0;
6060
// Stores lap times
6161
LapInfo_t laps[LAP_CAPACITY];
62-
LapInfo_t emptyLapInfo = { .count = 0, .time = 0 };
62+
LapInfo_t emptyLapInfo = {.count = 0, .time = 0};
6363
int lapCount = 0;
6464
int lapHead = 0;
6565
};

src/displayapp/screens/StopWatch.cpp

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,10 @@ static void stop_lap_event_handler(lv_obj_t* obj, lv_event_t event) {
4545
stopWatch->stopLapBtnEventHandler(event);
4646
}
4747

48-
StopWatch::StopWatch(DisplayApp* app, System::SystemTask& systemTask, Controllers::DateTime& dateTimeController, Controllers::StopWatch& stopWatchController)
48+
StopWatch::StopWatch(DisplayApp* app,
49+
System::SystemTask& systemTask,
50+
Controllers::DateTime& dateTimeController,
51+
Controllers::StopWatch& stopWatchController)
4952
: Screen(app),
5053
systemTask {systemTask},
5154
dateTimeController {dateTimeController},
@@ -172,28 +175,16 @@ void StopWatch::displayPaused() {
172175
}
173176

174177
void StopWatch::updateLaps() {
175-
Pinetime::Controllers::LapInfo_t *lap1 = stopWatchController.lastLap();
176-
Pinetime::Controllers::LapInfo_t *lap2 = stopWatchController.lastLap(1);
178+
Pinetime::Controllers::LapInfo_t* lap1 = stopWatchController.lastLap();
179+
Pinetime::Controllers::LapInfo_t* lap2 = stopWatchController.lastLap(1);
177180

178181
if (lap1->count != 0) {
179182
TimeSeparated_t laptime = convertTicksToTimeSegments(lap1->time);
180-
lv_label_set_text_fmt(
181-
lapOneText,
182-
"#%2d %2d:%02d.%02d",
183-
lap1->count,
184-
laptime.mins,
185-
laptime.secs,
186-
laptime.hundredths);
183+
lv_label_set_text_fmt(lapOneText, "#%2d %2d:%02d.%02d", lap1->count, laptime.mins, laptime.secs, laptime.hundredths);
187184
}
188185
if (lap2->count != 0) {
189186
TimeSeparated_t laptime = convertTicksToTimeSegments(lap2->time);
190-
lv_label_set_text_fmt(
191-
lapTwoText,
192-
"#%2d %2d:%02d.%02d",
193-
lap2->count,
194-
laptime.mins,
195-
laptime.secs,
196-
laptime.hundredths);
187+
lv_label_set_text_fmt(lapTwoText, "#%2d %2d:%02d.%02d", lap2->count, laptime.mins, laptime.secs, laptime.hundredths);
197188
}
198189
}
199190

@@ -227,7 +218,8 @@ void StopWatch::stopLapBtnEventHandler(lv_event_t event) {
227218
}
228219
// If running, then this button is used to save laps
229220
if (stopWatchController.isRunning()) {
230-
TickType_t currentTime = stopWatchController.getElapsedPreviously() + calculateDelta(stopWatchController.getStart(), xTaskGetTickCount());
221+
TickType_t currentTime =
222+
stopWatchController.getElapsedPreviously() + calculateDelta(stopWatchController.getStart(), xTaskGetTickCount());
231223
stopWatchController.pushLap(currentTime);
232224

233225
updateLaps();

src/main.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Pinetime::System::SystemTask systemTask(spi,
159159
fs,
160160
touchHandler);
161161

162-
/* Variable Declarations for variables in noinit SRAM
162+
/* Variable Declarations for variables in noinit SRAM
163163
Increment NoInit_MagicValue upon adding variables to this area
164164
*/
165165
extern uint32_t __start_noinit_data;
@@ -168,7 +168,6 @@ static constexpr uint32_t NoInit_MagicValue = 0xDEAD0000;
168168
uint32_t NoInit_MagicWord __attribute__((section(".noinit")));
169169
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> NoInit_BackUpTime __attribute__((section(".noinit")));
170170

171-
172171
void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) {
173172
if (pin == Pinetime::PinMap::Cst816sIrq) {
174173
systemTask.OnTouchEvent();
@@ -329,12 +328,11 @@ int main(void) {
329328
// retrieve version stored by bootloader
330329
Pinetime::BootloaderVersion::SetVersion(NRF_TIMER2->CC[0]);
331330

332-
333331
if (NoInit_MagicWord == NoInit_MagicValue) {
334332
dateTimeController.SetCurrentTime(NoInit_BackUpTime);
335333
} else {
336-
//Clear Memory to known state
337-
memset(&__start_noinit_data,0,(uintptr_t)&__stop_noinit_data-(uintptr_t)&__start_noinit_data);
334+
// Clear Memory to known state
335+
memset(&__start_noinit_data, 0, (uintptr_t) &__stop_noinit_data - (uintptr_t) &__start_noinit_data);
338336
NoInit_MagicWord = NoInit_MagicValue;
339337
}
340338

src/systemtask/SystemTask.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "main.h"
2626
#include "BootErrors.h"
2727

28-
2928
#include <memory>
3029

3130
using namespace Pinetime::System;
@@ -179,7 +178,8 @@ void SystemTask::Work() {
179178
nrfx_gpiote_in_event_enable(PinMap::Button, true);
180179

181180
// Touchscreen
182-
nrf_gpio_cfg_sense_input(PinMap::Cst816sIrq, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pullup, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_Low);
181+
nrf_gpio_cfg_sense_input(
182+
PinMap::Cst816sIrq, (nrf_gpio_pin_pull_t) GPIO_PIN_CNF_PULL_Pullup, (nrf_gpio_pin_sense_t) GPIO_PIN_CNF_SENSE_Low);
183183

184184
pinConfig.skip_gpio_setup = true;
185185
pinConfig.hi_accuracy = false;

0 commit comments

Comments
 (0)