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

View File

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

View File

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

View File

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

View File

@ -24,6 +24,7 @@ namespace Pinetime {
void StopFirmwareUpdate(); void StopFirmwareUpdate();
void FirmwareUpdateTotalBytes(uint32_t totalBytes); void FirmwareUpdateTotalBytes(uint32_t totalBytes);
void FirmwareUpdateCurrentBytes(uint32_t currentBytes); void FirmwareUpdateCurrentBytes(uint32_t currentBytes);
void State(FirmwareUpdateStates state) { void State(FirmwareUpdateStates state) {
firmwareUpdateState = state; firmwareUpdateState = state;
} }
@ -31,12 +32,15 @@ namespace Pinetime {
bool IsFirmwareUpdating() const { bool IsFirmwareUpdating() const {
return isFirmwareUpdating; return isFirmwareUpdating;
} }
uint32_t FirmwareUpdateTotalBytes() const { uint32_t FirmwareUpdateTotalBytes() const {
return firmwareUpdateTotalBytes; return firmwareUpdateTotalBytes;
} }
uint32_t FirmwareUpdateCurrentBytes() const { uint32_t FirmwareUpdateCurrentBytes() const {
return firmwareUpdateCurrentBytes; return firmwareUpdateCurrentBytes;
} }
FirmwareUpdateStates State() const { FirmwareUpdateStates State() const {
return firmwareUpdateState; return firmwareUpdateState;
} }
@ -44,15 +48,19 @@ namespace Pinetime {
void Address(BleAddress&& addr) { void Address(BleAddress&& addr) {
address = addr; address = addr;
} }
const BleAddress& Address() const { const BleAddress& Address() const {
return address; return address;
} }
void AddressType(AddressTypes t) { void AddressType(AddressTypes t) {
addressType = t; addressType = t;
} }
void SetPairingKey(uint32_t k) { void SetPairingKey(uint32_t k) {
pairingKey = k; pairingKey = k;
} }
uint32_t GetPairingKey() const { uint32_t GetPairingKey() const {
return pairingKey; 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); 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 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); int OnCurrentTimeReadResult(uint16_t conn_handle, const ble_gatt_error* error, const ble_gatt_attr* attribute);
static constexpr const ble_uuid16_t* Uuid() { static constexpr const ble_uuid16_t* Uuid() {
return &CurrentTimeClient::ctsServiceUuid; return &CurrentTimeClient::ctsServiceUuid;
} }
static constexpr const ble_uuid16_t* CurrentTimeCharacteristicUuid() { static constexpr const ble_uuid16_t* CurrentTimeCharacteristicUuid() {
return &CurrentTimeClient::currentTimeCharacteristicUuid; return &CurrentTimeClient::currentTimeCharacteristicUuid;
} }
void Discover(uint16_t connectionHandle, std::function<void(uint16_t)> lambda) override; void Discover(uint16_t connectionHandle, std::function<void(uint16_t)> lambda) override;
private: private:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,6 +11,7 @@ namespace Pinetime {
class LittleVgl { class LittleVgl {
public: public:
enum class FullRefreshDirections { None, Up, Down }; enum class FullRefreshDirections { None, Up, Down };
LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel) { 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) { void FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
} }
bool GetTouchPadInfo(lv_indev_data_t* ptr) { bool GetTouchPadInfo(lv_indev_data_t* ptr) {
return false; return false;
} }
void SetFullRefresh(FullRefreshDirections direction) { void SetFullRefresh(FullRefreshDirections direction) {
} }
void SetNewTapEvent(uint16_t x, uint16_t y) { void SetNewTapEvent(uint16_t x, uint16_t y) {
} }
void SetNewTouchPoint(uint16_t x, uint16_t y, bool contact) { 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 uint8_t nbWriteLines = 4;
static constexpr uint16_t totalNbLines = 320; static constexpr uint16_t totalNbLines = 320;
static constexpr uint16_t visibleNbLines = 240; static constexpr uint16_t visibleNbLines = 240;
static constexpr uint8_t MaxScrollOffset() { static constexpr uint8_t MaxScrollOffset() {
return LV_VER_RES_MAX - nbWriteLines; return LV_VER_RES_MAX - nbWriteLines;
} }
FullRefreshDirections scrollDirection = FullRefreshDirections::None; FullRefreshDirections scrollDirection = FullRefreshDirections::None;
uint16_t writeOffset = 0; uint16_t writeOffset = 0;
uint16_t scrollOffset = 0; uint16_t scrollOffset = 0;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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