Format header files

In my PR updating clang-format, I forgot to also format the headers.
This commit is contained in:
Finlay Davidson 2023-01-07 21:23:15 +01:00 committed by JF
parent 09db67e003
commit 96165a8541
55 changed files with 144 additions and 0 deletions

View file

@ -26,6 +26,7 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class AlarmController {
public:
@ -40,18 +41,23 @@ namespace Pinetime {
void StopAlerting();
enum class AlarmState { Not_Set, Set, Alerting };
enum class RecurType { None, Daily, Weekdays };
uint8_t Hours() const {
return hours;
}
uint8_t Minutes() const {
return minutes;
}
AlarmState State() const {
return state;
}
RecurType Recurrence() const {
return recurrence;
}
void SetRecurrence(RecurType recurType) {
recurrence = recurType;
}

View file

@ -17,6 +17,7 @@ namespace Pinetime {
uint8_t PercentRemaining() const {
return percentRemaining;
}
bool BatteryIsLow() const {
return percentRemaining <= lowBatteryThreshold;
}

View file

@ -16,6 +16,7 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class NotificationManager;

View file

@ -9,8 +9,10 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class Battery;
class BatteryInformationService {
public:
BatteryInformationService(Controllers::Battery& batteryController);

View file

@ -24,6 +24,7 @@ namespace Pinetime {
void StopFirmwareUpdate();
void FirmwareUpdateTotalBytes(uint32_t totalBytes);
void FirmwareUpdateCurrentBytes(uint32_t currentBytes);
void State(FirmwareUpdateStates state) {
firmwareUpdateState = state;
}
@ -31,12 +32,15 @@ namespace Pinetime {
bool IsFirmwareUpdating() const {
return isFirmwareUpdating;
}
uint32_t FirmwareUpdateTotalBytes() const {
return firmwareUpdateTotalBytes;
}
uint32_t FirmwareUpdateCurrentBytes() const {
return firmwareUpdateCurrentBytes;
}
FirmwareUpdateStates State() const {
return firmwareUpdateState;
}
@ -44,15 +48,19 @@ namespace Pinetime {
void Address(BleAddress&& addr) {
address = addr;
}
const BleAddress& Address() const {
return address;
}
void AddressType(AddressTypes t) {
addressType = t;
}
void SetPairingKey(uint32_t k) {
pairingKey = k;
}
uint32_t GetPairingKey() const {
return pairingKey;
}

View file

@ -19,12 +19,15 @@ namespace Pinetime {
bool OnDiscoveryEvent(uint16_t connectionHandle, const ble_gatt_error* error, const ble_gatt_svc* service);
int OnCharacteristicDiscoveryEvent(uint16_t conn_handle, const ble_gatt_error* error, const ble_gatt_chr* characteristic);
int OnCurrentTimeReadResult(uint16_t conn_handle, const ble_gatt_error* error, const ble_gatt_attr* attribute);
static constexpr const ble_uuid16_t* Uuid() {
return &CurrentTimeClient::ctsServiceUuid;
}
static constexpr const ble_uuid16_t* CurrentTimeCharacteristicUuid() {
return &CurrentTimeClient::currentTimeCharacteristicUuid;
}
void Discover(uint16_t connectionHandle, std::function<void(uint16_t)> lambda) override;
private:

View file

@ -13,9 +13,11 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Drivers {
class SpiNorFlash;
}
namespace Controllers {
class Ble;
@ -46,10 +48,12 @@ namespace Pinetime {
void OnNotificationTimer();
void Reset();
};
class DfuImage {
public:
DfuImage(Pinetime::Drivers::SpiNorFlash& spiNorFlash) : spiNorFlash {spiNorFlash} {
}
void Init(size_t chunkSize, size_t totalSize, uint16_t expectedCrc);
void Erase();
void Append(uint8_t* data, size_t size);

View file

@ -11,8 +11,10 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class Ble;
class FSService {
public:
FSService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::FS& fs);
@ -71,6 +73,7 @@ namespace Pinetime {
FSState state;
char filepath[maxpathlen]; // TODO ..ugh fixed filepath len
int fileSize;
using ReadHeader = struct __attribute__((packed)) {
commands command;
uint8_t padding;
@ -89,6 +92,7 @@ namespace Pinetime {
uint32_t chunklen;
uint8_t chunk[];
};
using ReadPacing = struct __attribute__((packed)) {
commands command;
uint8_t status;
@ -124,6 +128,7 @@ namespace Pinetime {
uint32_t dataSize;
uint8_t data[];
};
using ListDirHeader = struct __attribute__((packed)) {
commands command;
uint8_t padding;
@ -171,6 +176,7 @@ namespace Pinetime {
commands command;
uint8_t status;
};
using MoveHeader = struct __attribute__((packed)) {
commands command;
uint8_t padding;

View file

@ -10,8 +10,10 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class HeartRateController;
class HeartRateService {
public:
HeartRateService(Pinetime::System::SystemTask& system, Controllers::HeartRateController& heartRateController);

View file

@ -9,8 +9,10 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class NotificationManager;
class ImmediateAlertService {
public:
enum class Levels : uint8_t { NoAlert = 0, MildAlert = 1, HighAlert = 2 };

View file

@ -10,8 +10,10 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class MotionController;
class MotionService {
public:
MotionService(Pinetime::System::SystemTask& system, Controllers::MotionController& motionController);

View file

@ -30,6 +30,7 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class MusicService {
public:

View file

@ -30,6 +30,7 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class NavigationService {

View file

@ -58,12 +58,15 @@ namespace Pinetime {
Pinetime::Controllers::MusicService& music() {
return musicService;
};
Pinetime::Controllers::NavigationService& navigation() {
return navService;
};
Pinetime::Controllers::AlertNotificationService& alertService() {
return anService;
};
Pinetime::Controllers::WeatherService& weather() {
return weatherService;
};

View file

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

View file

@ -39,6 +39,7 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class WeatherService {

View file

@ -9,6 +9,7 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class DateTime {
public:
@ -51,24 +52,31 @@ namespace Pinetime {
void SetTimeZone(int8_t timezone, int8_t dst);
void UpdateTime(uint32_t systickCounter);
uint16_t Year() const {
return year;
}
Months Month() const {
return month;
}
uint8_t Day() const {
return day;
}
Days DayOfWeek() const {
return dayOfWeek;
}
uint8_t Hours() const {
return hour;
}
uint8_t Minutes() const {
return minute;
}
uint8_t Seconds() const {
return second;
}
@ -117,9 +125,11 @@ namespace Pinetime {
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> CurrentDateTime() const {
return currentDateTime;
}
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> UTCDateTime() const {
return currentDateTime - std::chrono::seconds((tzOffset + dstOffset) * 15 * 60);
}
std::chrono::seconds Uptime() const {
return uptime;
}

View file

@ -35,6 +35,7 @@ namespace Pinetime {
static size_t getSize() {
return size;
}
static size_t getBlockSize() {
return blockSize;
}

View file

@ -10,6 +10,7 @@ namespace Pinetime {
namespace Drivers {
class St7789;
}
namespace Components {
class Gfx : public Pinetime::Drivers::BufferProvider {
public:
@ -33,9 +34,11 @@ namespace Pinetime {
static constexpr uint8_t height = 240;
enum class Action { None, FillRectangle, DrawChar };
struct State {
State() : busy {false}, action {Action::None}, remainingIterations {0}, currentIteration {0} {
}
volatile bool busy;
volatile Action action;
volatile uint16_t remainingIterations;

View file

@ -7,9 +7,11 @@ namespace Pinetime {
namespace Applications {
class HeartRateTask;
}
namespace System {
class SystemTask;
}
namespace Controllers {
class HeartRateController {
public:
@ -21,9 +23,11 @@ namespace Pinetime {
void Update(States newState, uint8_t heartRate);
void SetHeartRateTask(Applications::HeartRateTask* task);
States State() const {
return state;
}
uint8_t HeartRate() const {
return heartRate;
}

View file

@ -19,12 +19,15 @@ namespace Pinetime {
int16_t X() const {
return x;
}
int16_t Y() const {
return y;
}
int16_t Z() const {
return z;
}
uint32_t NbSteps() const {
return nbSteps;
}
@ -32,6 +35,7 @@ namespace Pinetime {
void ResetTrip() {
currentTripSteps = 0;
}
uint32_t GetTripSteps() const {
return currentTripSteps;
}
@ -40,6 +44,7 @@ namespace Pinetime {
bool Should_RaiseWake(bool isSleeping);
int32_t currentShakeSpeed();
void IsSensorOk(bool isOk);
bool IsSensorOk() const {
return isSensorOk;
}

View file

@ -45,6 +45,7 @@ namespace Pinetime {
Colors ColorBG = Colors::Black;
PTSGaugeStyle gaugeStyle = PTSGaugeStyle::Full;
};
struct WatchFaceInfineat {
bool showSideCover = true;
int colorIndex = 0;
@ -66,6 +67,7 @@ namespace Pinetime {
}
settings.clockFace = face;
};
uint8_t GetClockFace() const {
return settings.clockFace;
};
@ -76,6 +78,7 @@ namespace Pinetime {
}
settings.chimesOption = chimeOption;
};
ChimesOption GetChimeOption() const {
return settings.chimesOption;
};
@ -85,6 +88,7 @@ namespace Pinetime {
settingsChanged = true;
settings.PTS.ColorTime = colorTime;
};
Colors GetPTSColorTime() const {
return settings.PTS.ColorTime;
};
@ -94,6 +98,7 @@ namespace Pinetime {
settingsChanged = true;
settings.PTS.ColorBar = colorBar;
};
Colors GetPTSColorBar() const {
return settings.PTS.ColorBar;
};
@ -103,6 +108,7 @@ namespace Pinetime {
settingsChanged = true;
settings.PTS.ColorBG = colorBG;
};
Colors GetPTSColorBG() const {
return settings.PTS.ColorBG;
};
@ -113,6 +119,7 @@ namespace Pinetime {
settingsChanged = true;
}
};
bool GetInfineatShowSideCover() const {
return settings.watchFaceInfineat.showSideCover;
};
@ -123,6 +130,7 @@ namespace Pinetime {
settingsChanged = true;
}
};
int GetInfineatColorIndex() const {
return settings.watchFaceInfineat.colorIndex;
};
@ -132,6 +140,7 @@ namespace Pinetime {
settingsChanged = true;
settings.PTS.gaugeStyle = gaugeStyle;
};
PTSGaugeStyle GetPTSGaugeStyle() const {
return settings.PTS.gaugeStyle;
};
@ -147,6 +156,7 @@ namespace Pinetime {
void SetSettingsMenu(uint8_t menu) {
settingsMenu = menu;
};
uint8_t GetSettingsMenu() const {
return settingsMenu;
};
@ -157,6 +167,7 @@ namespace Pinetime {
}
settings.clockType = clocktype;
};
ClockType GetClockType() const {
return settings.clockType;
};
@ -167,6 +178,7 @@ namespace Pinetime {
}
settings.notificationStatus = status;
};
Notification GetNotificationStatus() const {
return settings.notificationStatus;
};
@ -255,6 +267,7 @@ namespace Pinetime {
Pinetime::Controllers::FS& fs;
static constexpr uint32_t settingsVersion = 0x0004;
struct SettingsData {
uint32_t version = settingsVersion;
uint32_t stepsGoal = 10000;

View file

@ -7,6 +7,7 @@ namespace Pinetime {
namespace System {
class SystemTask;
}
namespace Controllers {
class TimerController {

View file

@ -29,6 +29,7 @@ namespace Pinetime {
class Cst816S;
class WatchdogView;
}
namespace Controllers {
class Settings;
class Battery;
@ -43,6 +44,7 @@ namespace Pinetime {
namespace System {
class SystemTask;
};
namespace Applications {
class DisplayApp {
public:

View file

@ -22,6 +22,7 @@ namespace Pinetime {
class Cst816S;
class WatchdogView;
}
namespace Controllers {
class Settings;
class Battery;
@ -63,9 +64,11 @@ namespace Pinetime {
Pinetime::Controllers::TouchHandler& touchHandler,
Pinetime::Controllers::FS& filesystem);
void Start();
void Start(Pinetime::System::BootErrors) {
Start();
};
void PushMessage(Pinetime::Applications::Display::Messages msg);
void Register(Pinetime::System::SystemTask* systemTask);

View file

@ -11,6 +11,7 @@ namespace Pinetime {
class LittleVgl {
public:
enum class FullRefreshDirections { None, Up, Down };
LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) {
}
@ -24,13 +25,17 @@ namespace Pinetime {
void FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
}
bool GetTouchPadInfo(lv_indev_data_t* ptr) {
return false;
}
void SetFullRefresh(FullRefreshDirections direction) {
}
void SetNewTapEvent(uint16_t x, uint16_t y) {
}
void SetNewTouchPoint(uint16_t x, uint16_t y, bool contact) {
}
};

View file

@ -52,9 +52,11 @@ namespace Pinetime {
static constexpr uint8_t nbWriteLines = 4;
static constexpr uint16_t totalNbLines = 320;
static constexpr uint16_t visibleNbLines = 240;
static constexpr uint8_t MaxScrollOffset() {
return LV_VER_RES_MAX - nbWriteLines;
}
FullRefreshDirections scrollDirection = FullRefreshDirections::None;
uint16_t writeOffset = 0;
uint16_t scrollOffset = 0;

View file

@ -1,5 +1,6 @@
#pragma once
#include <cstdint>
namespace Pinetime {
namespace Applications {
namespace Display {

View file

@ -15,6 +15,7 @@ namespace Pinetime {
class CheckboxList : public Screen {
public:
static constexpr size_t MaxItems = 4;
struct Item {
const char* name;
bool enabled;

View file

@ -8,6 +8,7 @@ namespace Pinetime {
namespace Controllers {
class Ble;
}
namespace Applications {
namespace Screens {

View file

@ -11,6 +11,7 @@ namespace Pinetime {
namespace Controllers {
class HeartRateController;
}
namespace Applications {
namespace Screens {

View file

@ -10,6 +10,7 @@ namespace Pinetime {
namespace Components {
class LittleVgl;
}
namespace Applications {
namespace Screens {

View file

@ -13,6 +13,7 @@ namespace Pinetime {
namespace Controllers {
class AlertNotificationService;
}
namespace Applications {
namespace Screens {
@ -45,9 +46,11 @@ namespace Pinetime {
Pinetime::Controllers::AlertNotificationService& alertNotificationService,
Pinetime::Controllers::MotorController& motorController);
~NotificationItem();
bool IsRunning() const {
return running;
}
void OnCallButtonEvent(lv_obj_t*, lv_event_t event);
private:

View file

@ -8,6 +8,7 @@ namespace Pinetime {
namespace Components {
class LittleVgl;
}
namespace Applications {
namespace Screens {

View file

@ -7,13 +7,16 @@
namespace Pinetime {
namespace Applications {
class DisplayApp;
namespace Screens {
template <class T> class DirtyValue {
public:
DirtyValue() = default; // Use NSDMI
explicit DirtyValue(T const& v) : value {v} {
} // Use MIL and const-lvalue-ref
bool IsUpdated() {
if (this->isUpdated) {
this->isUpdated = false;
@ -21,10 +24,12 @@ namespace Pinetime {
}
return false;
}
T const& Get() {
this->isUpdated = false;
return value;
} // never expose a non-const lvalue-ref
DirtyValue& operator=(const T& other) {
if (this->value != other) {
this->value = other;
@ -46,6 +51,7 @@ namespace Pinetime {
public:
explicit Screen(DisplayApp* app) : app {app} {
}
virtual ~Screen() = default;
static void RefreshTaskCallback(lv_task_t* task);
@ -64,6 +70,7 @@ namespace Pinetime {
virtual bool OnTouchEvent(TouchEvents event) {
return false;
}
virtual bool OnTouchEvent(uint16_t x, uint16_t y) {
return false;
}

View file

@ -11,6 +11,7 @@ namespace Pinetime {
namespace Screens {
enum class ScreenListModes { UpDown, RightLeft, LongPress };
template <size_t N> class ScreenList : public Screen {
public:
ScreenList(DisplayApp* app,

View file

@ -9,6 +9,7 @@ namespace Pinetime {
bool merged = false;
unsigned int value = 0;
};
namespace Screens {
class Twos : public Screen {
public:

View file

@ -18,6 +18,7 @@ namespace Pinetime {
class Ble;
class NotificationManager;
}
namespace Applications {
namespace Screens {

View file

@ -118,6 +118,7 @@ namespace Pinetime {
static constexpr int nLines = 9;
static constexpr int nColors = 7; // must match number of colors in InfineatColors
struct InfineatColors {
int orange[nLines] = {0xfd872b, 0xdb3316, 0x6f1000, 0xfd7a0a, 0xffffff, 0xffffff, 0xffffff, 0xe85102, 0xea1c00};
int blue[nLines] = {0xe7f8ff, 0x2232d0, 0x182a8b, 0xe7f8ff, 0xffffff, 0xffffff, 0xffffff, 0x5991ff, 0x1636ff};

View file

@ -23,6 +23,7 @@ namespace Pinetime {
Controllers::Settings::ChimesOption chimesOption;
const char* name;
};
static constexpr std::array<Option, 3> options = {{{Controllers::Settings::ChimesOption::None, "Off"},
{Controllers::Settings::ChimesOption::Hours, "Every hour"},
{Controllers::Settings::ChimesOption::HalfHours, "Every 30 mins"}}};

View file

@ -6,6 +6,7 @@
#include "displayapp/screens/Screen.h"
#include <components/motion/MotionController.h>
#include "systemtask/SystemTask.h"
namespace Pinetime {
namespace Applications {

View file

@ -24,6 +24,7 @@ namespace Pinetime {
Controllers::Settings::ClockType clockType;
const char* name;
};
static constexpr std::array<Option, 2> options = {{
{Controllers::Settings::ClockType::H12, "12-hour"},
{Controllers::Settings::ClockType::H24, "24-hour"},

View file

@ -23,6 +23,7 @@ namespace Pinetime {
Controllers::Settings::WakeUpMode wakeUpMode;
const char* name;
};
Controllers::Settings& settingsController;
static constexpr std::array<Option, 4> options = {{
{Controllers::Settings::WakeUpMode::SingleTap, "Single Tap"},

View file

@ -15,9 +15,11 @@ namespace Pinetime {
StatusIcons(Controllers::Battery& batteryController, Controllers::Ble& bleController);
void Align();
void Create();
lv_obj_t* GetObject() {
return container;
}
void Update();
private:

View file

@ -4,15 +4,18 @@
namespace Pinetime {
namespace Drivers {
class TwiMaster;
class Bma421 {
public:
enum class DeviceTypes : uint8_t { Unknown, BMA421, BMA425 };
struct Values {
uint32_t steps;
int16_t x;
int16_t y;
int16_t z;
};
Bma421(TwiMaster& twiMaster, uint8_t twiAddress);
Bma421(const Bma421&) = delete;
Bma421& operator=(const Bma421&) = delete;

View file

@ -16,6 +16,7 @@ namespace Pinetime {
DoubleTap = 0x0B,
LongPress = 0x0C
};
struct TouchInfos {
uint16_t x = 0;
uint16_t y = 0;
@ -38,9 +39,11 @@ namespace Pinetime {
uint8_t GetChipId() const {
return chipId;
}
uint8_t GetVendorId() const {
return vendorId;
}
uint8_t GetFwVersion() const {
return fwVersion;
}

View file

@ -14,6 +14,7 @@ namespace Pinetime {
enum class BitOrder : uint8_t { Msb_Lsb, Lsb_Msb };
enum class Modes : uint8_t { Mode0, Mode1, Mode2, Mode3 };
enum class Frequencies : uint8_t { Freq8Mhz };
struct Parameters {
BitOrder bitOrder;
Modes mode;

View file

@ -5,6 +5,7 @@
namespace Pinetime {
namespace Drivers {
class Spi;
class SpiNorFlash {
public:
explicit SpiNorFlash(Spi& spi);

View file

@ -5,6 +5,7 @@
namespace Pinetime {
namespace Drivers {
class Spi;
class St7789 {
public:
explicit St7789(Spi& spi, uint8_t pinDataCommand);

View file

@ -9,9 +9,11 @@ namespace Pinetime {
void Setup(uint8_t timeoutSeconds);
void Start();
void Kick();
ResetReasons ResetReason() const {
return resetReason;
}
static const char* ResetReasonToString(ResetReasons reason);
private:
@ -23,6 +25,7 @@ namespace Pinetime {
public:
WatchdogView(const Watchdog& watchdog) : watchdog {watchdog} {
}
Watchdog::ResetReasons ResetReason() const {
return watchdog.ResetReason();
}

View file

@ -8,9 +8,11 @@ namespace Pinetime {
namespace Drivers {
class Hrs3300;
}
namespace Controllers {
class HeartRateController;
}
namespace Applications {
class HeartRateTask {
public:

View file

@ -7,6 +7,7 @@ namespace Pinetime {
public:
void Init() override {
}
void Resume() override {
}
};

View file

@ -1,5 +1,6 @@
#pragma once
#include <cstdint>
namespace Pinetime {
namespace System {
enum class Messages : uint8_t {

View file

@ -36,6 +36,7 @@
#include "systemtask/Messages.h"
extern std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> NoInit_BackUpTime;
namespace Pinetime {
namespace Drivers {
class Cst816S;
@ -45,11 +46,13 @@ namespace Pinetime {
class TwiMaster;
class Hrs3300;
}
namespace Controllers {
class Battery;
class TouchHandler;
class ButtonHandler;
}
namespace System {
class SystemTask {
public:

View file

@ -6,9 +6,11 @@ namespace Pinetime {
namespace Components {
class LittleVgl;
}
namespace Drivers {
class Cst816S;
}
namespace Controllers {
class TouchHandler {
public:
@ -20,12 +22,15 @@ namespace Pinetime {
bool IsTouching() const {
return info.touching;
}
uint8_t GetX() const {
return info.x;
}
uint8_t GetY() const {
return info.y;
}
Pinetime::Applications::TouchEvents GestureGet();
private: