Changed access modified indentation

This commit is contained in:
Avamander 2021-04-24 12:00:45 +03:00
parent 40d45d923b
commit 6989854519
84 changed files with 175 additions and 175 deletions

View File

@ -1,6 +1,6 @@
--- ---
Language: Cpp Language: Cpp
AccessModifierOffset: 2 AccessModifierOffset: -2
AlignAfterOpenBracket: Align AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true AlignConsecutiveMacros: true
AlignConsecutiveAssignments: false AlignConsecutiveAssignments: false

View File

@ -2,7 +2,7 @@
namespace Pinetime { namespace Pinetime {
class BootloaderVersion { class BootloaderVersion {
public: public:
static uint32_t Major(); static uint32_t Major();
static uint32_t Minor(); static uint32_t Minor();
static uint32_t Patch(); static uint32_t Patch();

View File

@ -12,7 +12,7 @@ namespace Pinetime {
is given as the template parameter N. is given as the template parameter N.
*/ */
template <int N> class CircBuffer { template <int N> class CircBuffer {
public: public:
CircBuffer() : arr {}, sz {}, cap {N}, head {} { CircBuffer() : arr {}, sz {}, cap {N}, head {} {
} }
/** /**
@ -32,7 +32,7 @@ namespace Pinetime {
return (sum / sz); return (sum / sz);
} }
private: private:
std::array<int, N> arr; /**< internal array used to store the values*/ std::array<int, N> arr; /**< internal array used to store the values*/
uint8_t sz; /**< The current size of the array.*/ uint8_t sz; /**< The current size of the array.*/
uint8_t cap; /**< Total capacity of the CircBuffer.*/ uint8_t cap; /**< Total capacity of the CircBuffer.*/
@ -40,7 +40,7 @@ namespace Pinetime {
}; };
class Battery { class Battery {
public: public:
Battery(); Battery();
void Init(); void Init();
@ -61,7 +61,7 @@ namespace Pinetime {
return isPowerPresent; return isPowerPresent;
} }
private: private:
static Battery* instance; static Battery* instance;
nrf_saadc_value_t saadc_value; nrf_saadc_value_t saadc_value;

View File

@ -19,7 +19,7 @@ namespace Pinetime {
class NotificationManager; class NotificationManager;
class AlertNotificationClient : public BleClient { class AlertNotificationClient : public BleClient {
public: public:
explicit AlertNotificationClient(Pinetime::System::SystemTask& systemTask, explicit AlertNotificationClient(Pinetime::System::SystemTask& systemTask,
Pinetime::Controllers::NotificationManager& notificationManager); Pinetime::Controllers::NotificationManager& notificationManager);
@ -34,7 +34,7 @@ namespace Pinetime {
void Reset(); void Reset();
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:
static constexpr uint16_t ansServiceId {0x1811}; static constexpr uint16_t ansServiceId {0x1811};
static constexpr uint16_t supportedNewAlertCategoryId = 0x2a47; static constexpr uint16_t supportedNewAlertCategoryId = 0x2a47;
static constexpr uint16_t supportedUnreadAlertCategoryId = 0x2a48; static constexpr uint16_t supportedUnreadAlertCategoryId = 0x2a48;

View File

@ -20,7 +20,7 @@ namespace Pinetime {
class NotificationManager; class NotificationManager;
class AlertNotificationService { class AlertNotificationService {
public: public:
AlertNotificationService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager); AlertNotificationService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager);
void Init(); void Init();
@ -32,7 +32,7 @@ namespace Pinetime {
enum class IncomingCallResponses : uint8_t { Reject = 0x00, Answer = 0x01, Mute = 0x02 }; enum class IncomingCallResponses : uint8_t { Reject = 0x00, Answer = 0x01, Mute = 0x02 };
private: private:
enum class Categories : uint8_t { enum class Categories : uint8_t {
SimpleAlert = 0x00, SimpleAlert = 0x00,
Email = 0x01, Email = 0x01,

View File

@ -12,13 +12,13 @@ namespace Pinetime {
namespace Controllers { namespace Controllers {
class Battery; class Battery;
class BatteryInformationService { class BatteryInformationService {
public: public:
BatteryInformationService(Controllers::Battery& batteryController); BatteryInformationService(Controllers::Battery& batteryController);
void Init(); void Init();
int OnBatteryServiceRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context); int OnBatteryServiceRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context);
private: private:
Controllers::Battery& batteryController; Controllers::Battery& batteryController;
static constexpr uint16_t batteryInformationServiceId {0x180F}; static constexpr uint16_t batteryInformationServiceId {0x180F};
static constexpr uint16_t batteryLevelId {0x2A19}; static constexpr uint16_t batteryLevelId {0x2A19};

View File

@ -5,7 +5,7 @@
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {
class BleClient { class BleClient {
public: public:
virtual void Discover(uint16_t connectionHandle, std::function<void(uint16_t)> lambda) = 0; virtual void Discover(uint16_t connectionHandle, std::function<void(uint16_t)> lambda) = 0;
}; };
} }

View File

@ -6,7 +6,7 @@
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {
class Ble { class Ble {
public: public:
using BleAddress = std::array<uint8_t, 6>; using BleAddress = std::array<uint8_t, 6>;
enum class FirmwareUpdateStates { Idle, Running, Validated, Error }; enum class FirmwareUpdateStates { Idle, Running, Validated, Error };
enum class AddressTypes { Public, Random }; enum class AddressTypes { Public, Random };
@ -49,7 +49,7 @@ namespace Pinetime {
addressType = t; addressType = t;
} }
private: private:
bool isConnected = false; bool isConnected = false;
bool isFirmwareUpdating = false; bool isFirmwareUpdating = false;
uint32_t firmwareUpdateTotalBytes = 0; uint32_t firmwareUpdateTotalBytes = 0;

View File

@ -12,7 +12,7 @@ namespace Pinetime {
class DateTime; class DateTime;
class CurrentTimeClient : public BleClient { class CurrentTimeClient : public BleClient {
public: public:
explicit CurrentTimeClient(DateTime& dateTimeController); explicit CurrentTimeClient(DateTime& dateTimeController);
void Init(); void Init();
void Reset(); void Reset();
@ -27,7 +27,7 @@ namespace Pinetime {
} }
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:
typedef struct __attribute__((packed)) { typedef struct __attribute__((packed)) {
uint16_t year; uint16_t year;
uint8_t month; uint8_t month;

View File

@ -12,13 +12,13 @@
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {
class CurrentTimeService { class CurrentTimeService {
public: public:
CurrentTimeService(DateTime& dateTimeController); CurrentTimeService(DateTime& dateTimeController);
void Init(); void Init();
int OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt); int OnTimeAccessed(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt);
private: private:
static constexpr uint16_t ctsId {0x1805}; static constexpr uint16_t ctsId {0x1805};
static constexpr uint16_t ctsCharId {0x2a2b}; static constexpr uint16_t ctsCharId {0x2a2b};

View File

@ -9,13 +9,13 @@
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {
class DeviceInformationService { class DeviceInformationService {
public: public:
DeviceInformationService(); DeviceInformationService();
void Init(); void Init();
int OnDeviceInfoRequested(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt); int OnDeviceInfoRequested(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt* ctxt);
private: private:
static constexpr uint16_t deviceInfoId {0x180a}; static constexpr uint16_t deviceInfoId {0x180a};
static constexpr uint16_t manufacturerNameId {0x2a29}; static constexpr uint16_t manufacturerNameId {0x2a29};
static constexpr uint16_t modelNumberId {0x2a24}; static constexpr uint16_t modelNumberId {0x2a24};

View File

@ -20,7 +20,7 @@ namespace Pinetime {
class Ble; class Ble;
class DfuService { class DfuService {
public: public:
DfuService(Pinetime::System::SystemTask& systemTask, DfuService(Pinetime::System::SystemTask& systemTask,
Pinetime::Controllers::Ble& bleController, Pinetime::Controllers::Ble& bleController,
Pinetime::Drivers::SpiNorFlash& spiNorFlash); Pinetime::Drivers::SpiNorFlash& spiNorFlash);
@ -30,24 +30,24 @@ namespace Pinetime {
void Reset(); void Reset();
class NotificationManager { class NotificationManager {
public: public:
NotificationManager(); NotificationManager();
bool AsyncSend(uint16_t connection, uint16_t charactHandle, uint8_t* data, size_t size); bool AsyncSend(uint16_t connection, uint16_t charactHandle, uint8_t* data, size_t size);
void Send(uint16_t connection, uint16_t characteristicHandle, const uint8_t* data, const size_t s); void Send(uint16_t connection, uint16_t characteristicHandle, const uint8_t* data, const size_t s);
private: private:
TimerHandle_t timer; TimerHandle_t timer;
uint16_t connectionHandle = 0; uint16_t connectionHandle = 0;
uint16_t characteristicHandle = 0; uint16_t characteristicHandle = 0;
size_t size = 0; size_t size = 0;
uint8_t buffer[10]; uint8_t buffer[10];
public: public:
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);
@ -56,7 +56,7 @@ namespace Pinetime {
bool Validate(); bool Validate();
bool IsComplete(); bool IsComplete();
private: private:
Pinetime::Drivers::SpiNorFlash& spiNorFlash; Pinetime::Drivers::SpiNorFlash& spiNorFlash;
static constexpr size_t bufferSize = 200; static constexpr size_t bufferSize = 200;
bool ready = false; bool ready = false;
@ -73,7 +73,7 @@ namespace Pinetime {
uint16_t ComputeCrc(uint8_t const* p_data, uint32_t size, uint16_t const* p_crc); uint16_t ComputeCrc(uint8_t const* p_data, uint32_t size, uint16_t const* p_crc);
}; };
private: private:
Pinetime::System::SystemTask& systemTask; Pinetime::System::SystemTask& systemTask;
Pinetime::Controllers::Ble& bleController; Pinetime::Controllers::Ble& bleController;
DfuImage dfuImage; DfuImage dfuImage;

View File

@ -12,13 +12,13 @@ namespace Pinetime {
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);
void Init(); void Init();
int OnHeartRateRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context); int OnHeartRateRequested(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context);
void OnNewHeartRateValue(uint8_t hearRateValue); void OnNewHeartRateValue(uint8_t hearRateValue);
private: private:
Pinetime::System::SystemTask& system; Pinetime::System::SystemTask& system;
Controllers::HeartRateController& heartRateController; Controllers::HeartRateController& heartRateController;
static constexpr uint16_t heartRateServiceId {0x180D}; static constexpr uint16_t heartRateServiceId {0x180D};

View File

@ -12,14 +12,14 @@ namespace Pinetime {
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 };
ImmediateAlertService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager); ImmediateAlertService(Pinetime::System::SystemTask& systemTask, Pinetime::Controllers::NotificationManager& notificationManager);
void Init(); void Init();
int OnAlertLevelChanged(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context); int OnAlertLevelChanged(uint16_t connectionHandle, uint16_t attributeHandle, ble_gatt_access_ctxt* context);
private: private:
Pinetime::System::SystemTask& systemTask; Pinetime::System::SystemTask& systemTask;
NotificationManager& notificationManager; NotificationManager& notificationManager;

View File

@ -37,7 +37,7 @@ namespace Pinetime {
namespace Controllers { namespace Controllers {
class MusicService { class MusicService {
public: public:
explicit MusicService(Pinetime::System::SystemTask& system); explicit MusicService(Pinetime::System::SystemTask& system);
void Init(); void Init();
@ -70,7 +70,7 @@ namespace Pinetime {
enum MusicStatus { NotPlaying = 0x00, Playing = 0x01 }; enum MusicStatus { NotPlaying = 0x00, Playing = 0x01 };
private: private:
static constexpr uint8_t msId[2] = {0x00, 0x00}; static constexpr uint8_t msId[2] = {0x00, 0x00};
static constexpr uint8_t msEventCharId[2] = {0x01, 0x00}; static constexpr uint8_t msEventCharId[2] = {0x01, 0x00};
static constexpr uint8_t msStatusCharId[2] = {0x02, 0x00}; static constexpr uint8_t msStatusCharId[2] = {0x02, 0x00};

View File

@ -37,7 +37,7 @@ namespace Pinetime {
namespace Controllers { namespace Controllers {
class NavigationService { class NavigationService {
public: public:
explicit NavigationService(Pinetime::System::SystemTask& system); explicit NavigationService(Pinetime::System::SystemTask& system);
void Init(); void Init();
@ -52,7 +52,7 @@ namespace Pinetime {
int getProgress(); int getProgress();
private: private:
static constexpr uint8_t navId[2] = {0x01, 0x00}; static constexpr uint8_t navId[2] = {0x01, 0x00};
static constexpr uint8_t navFlagCharId[2] = {0x01, 0x00}; static constexpr uint8_t navFlagCharId[2] = {0x01, 0x00};
static constexpr uint8_t navNarrativeCharId[2] = {0x02, 0x00}; static constexpr uint8_t navNarrativeCharId[2] = {0x02, 0x00};

View File

@ -36,7 +36,7 @@ namespace Pinetime {
class NimbleController { class NimbleController {
public: public:
NimbleController(Pinetime::System::SystemTask& systemTask, NimbleController(Pinetime::System::SystemTask& systemTask,
Pinetime::Controllers::Ble& bleController, Pinetime::Controllers::Ble& bleController,
DateTime& dateTimeController, DateTime& dateTimeController,
@ -71,7 +71,7 @@ namespace Pinetime {
uint16_t connHandle(); uint16_t connHandle();
private: private:
static constexpr const char* deviceName = "InfiniTime"; static constexpr const char* deviceName = "InfiniTime";
Pinetime::System::SystemTask& systemTask; Pinetime::System::SystemTask& systemTask;
Pinetime::Controllers::Ble& bleController; Pinetime::Controllers::Ble& bleController;

View File

@ -8,7 +8,7 @@
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {
class NotificationManager { class NotificationManager {
public: public:
enum class Categories { enum class Categories {
Unknown, Unknown,
SimpleAlert, SimpleAlert,
@ -52,7 +52,7 @@ namespace Pinetime {
}; };
size_t NbNotifications() const; size_t NbNotifications() const;
private: private:
Notification::Id GetNextId(); Notification::Id GetNextId();
static constexpr uint8_t TotalNbNotifications = 5; static constexpr uint8_t TotalNbNotifications = 5;
std::array<Notification, TotalNbNotifications> notifications; std::array<Notification, TotalNbNotifications> notifications;

View File

@ -8,12 +8,12 @@ namespace Pinetime {
class BleClient; class BleClient;
class ServiceDiscovery { class ServiceDiscovery {
public: public:
ServiceDiscovery(std::array<BleClient*, 2>&& bleClients); ServiceDiscovery(std::array<BleClient*, 2>&& bleClients);
void StartDiscovery(uint16_t connectionHandle); void StartDiscovery(uint16_t connectionHandle);
private: private:
BleClient** clientIterator; BleClient** clientIterator;
std::array<BleClient*, 2> clients; std::array<BleClient*, 2> clients;
void OnServiceDiscovered(uint16_t connectionHandle); void OnServiceDiscovered(uint16_t connectionHandle);

View File

@ -5,7 +5,7 @@
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {
class BrightnessController { class BrightnessController {
public: public:
enum class Levels { Off, Low, Medium, High }; enum class Levels { Off, Low, Medium, High };
void Init(); void Init();
@ -21,7 +21,7 @@ namespace Pinetime {
const char* GetIcon(); const char* GetIcon();
const char* ToString(); const char* ToString();
private: private:
static constexpr uint8_t pinLcdBacklight1 = 14; static constexpr uint8_t pinLcdBacklight1 = 14;
static constexpr uint8_t pinLcdBacklight2 = 22; static constexpr uint8_t pinLcdBacklight2 = 22;
static constexpr uint8_t pinLcdBacklight3 = 23; static constexpr uint8_t pinLcdBacklight3 = 23;

View File

@ -9,7 +9,7 @@ namespace Pinetime {
} }
namespace Controllers { namespace Controllers {
class DateTime { class DateTime {
public: public:
enum class Days : uint8_t { Unknown, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday }; enum class Days : uint8_t { Unknown, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday };
enum class Months : uint8_t { enum class Months : uint8_t {
Unknown, Unknown,
@ -75,7 +75,7 @@ namespace Pinetime {
return uptime; return uptime;
} }
private: private:
System::SystemTask& systemTask; System::SystemTask& systemTask;
uint16_t year = 0; uint16_t year = 0;
Months month = Months::Unknown; Months month = Months::Unknown;

View File

@ -5,13 +5,13 @@
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {
class FirmwareValidator { class FirmwareValidator {
public: public:
void Validate(); void Validate();
bool IsValidated() const; bool IsValidated() const;
void Reset(); void Reset();
private: private:
static constexpr uint32_t validBitAdress {0x7BFE8}; static constexpr uint32_t validBitAdress {0x7BFE8};
static constexpr uint32_t validBitValue {1}; static constexpr uint32_t validBitValue {1};
}; };

View File

@ -12,7 +12,7 @@ namespace Pinetime {
} }
namespace Components { namespace Components {
class Gfx : public Pinetime::Drivers::BufferProvider { class Gfx : public Pinetime::Drivers::BufferProvider {
public: public:
explicit Gfx(Drivers::St7789& lcd); explicit Gfx(Drivers::St7789& lcd);
void Init(); void Init();
void ClearScreen(); void ClearScreen();
@ -28,7 +28,7 @@ namespace Pinetime {
bool GetNextBuffer(uint8_t** buffer, size_t& size) override; bool GetNextBuffer(uint8_t** buffer, size_t& size) override;
void pixel_draw(uint8_t x, uint8_t y, uint16_t color); void pixel_draw(uint8_t x, uint8_t y, uint16_t color);
private: private:
static constexpr uint8_t width = 240; static constexpr uint8_t width = 240;
static constexpr uint8_t height = 240; static constexpr uint8_t height = 240;

View File

@ -4,11 +4,11 @@ namespace Pinetime {
namespace Controllers { namespace Controllers {
/// Direct Form II Biquad Filter /// Direct Form II Biquad Filter
class Biquad { class Biquad {
public: public:
Biquad(float b0, float b1, float b2, float a1, float a2); Biquad(float b0, float b1, float b2, float a1, float a2);
float Step(float x); float Step(float x);
private: private:
float b0; float b0;
float b1; float b1;
float b2; float b2;

View File

@ -12,7 +12,7 @@ namespace Pinetime {
} }
namespace Controllers { namespace Controllers {
class HeartRateController { class HeartRateController {
public: public:
enum class States { Stopped, NotEnoughData, NoTouch, Running }; enum class States { Stopped, NotEnoughData, NoTouch, Running };
explicit HeartRateController(System::SystemTask& systemTask); explicit HeartRateController(System::SystemTask& systemTask);
@ -31,7 +31,7 @@ namespace Pinetime {
void SetService(Pinetime::Controllers::HeartRateService* service); void SetService(Pinetime::Controllers::HeartRateService* service);
private: private:
System::SystemTask& systemTask; System::SystemTask& systemTask;
Applications::HeartRateTask* task = nullptr; Applications::HeartRateTask* task = nullptr;
States state = States::Stopped; States state = States::Stopped;

View File

@ -7,7 +7,7 @@
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {
class Ppg { class Ppg {
public: public:
explicit Ppg(float spl); explicit Ppg(float spl);
int Preprocess(float spl); int Preprocess(float spl);
@ -16,7 +16,7 @@ namespace Pinetime {
void SetOffset(uint16_t i); void SetOffset(uint16_t i);
void Reset(); void Reset();
private: private:
std::array<int, 200> data; std::array<int, 200> data;
size_t dataIndex = 0; size_t dataIndex = 0;
float offset; float offset;

View File

@ -3,11 +3,11 @@
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {
class Ptagc { class Ptagc {
public: public:
Ptagc(float start, float decay, float threshold); Ptagc(float start, float decay, float threshold);
float Step(float spl); float Step(float spl);
private: private:
float peak; float peak;
float decay; float decay;
float boost; float boost;

View File

@ -5,7 +5,7 @@
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {
class MotionController { class MotionController {
public: public:
void Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps); void Update(int16_t x, int16_t y, int16_t z, uint32_t nbSteps);
uint16_t X() const { uint16_t X() const {
@ -27,7 +27,7 @@ namespace Pinetime {
return isSensorOk; return isSensorOk;
} }
private: private:
uint32_t nbSteps; uint32_t nbSteps;
int16_t x; int16_t x;
int16_t y; int16_t y;

View File

@ -9,12 +9,12 @@ namespace Pinetime {
static constexpr uint8_t pinMotor = 16; static constexpr uint8_t pinMotor = 16;
class MotorController { class MotorController {
public: public:
MotorController(Controllers::Settings& settingsController); MotorController(Controllers::Settings& settingsController);
void Init(); void Init();
void SetDuration(uint8_t motorDuration); void SetDuration(uint8_t motorDuration);
private: private:
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
static void vibrate(void* p_context); static void vibrate(void* p_context);
}; };

View File

@ -11,13 +11,13 @@ namespace Pinetime {
* Code from https://github.com/daniel-thompson/wasp-bootloader by Daniel Thompson released under the MIT license. * Code from https://github.com/daniel-thompson/wasp-bootloader by Daniel Thompson released under the MIT license.
*/ */
class RleDecoder { class RleDecoder {
public: public:
RleDecoder(const uint8_t* buffer, size_t size); RleDecoder(const uint8_t* buffer, size_t size);
RleDecoder(const uint8_t* buffer, size_t size, uint16_t foregroundColor, uint16_t backgroundColor); RleDecoder(const uint8_t* buffer, size_t size, uint16_t foregroundColor, uint16_t backgroundColor);
void DecodeNext(uint8_t* output, size_t maxBytes); void DecodeNext(uint8_t* output, size_t maxBytes);
private: private:
const uint8_t* buffer; const uint8_t* buffer;
size_t size; size_t size;

View File

@ -8,7 +8,7 @@
namespace Pinetime { namespace Pinetime {
namespace Controllers { namespace Controllers {
class Settings { class Settings {
public: public:
enum class ClockType { H24, H12 }; enum class ClockType { H24, H12 };
enum class Vibration { ON, OFF }; enum class Vibration { ON, OFF };
enum class WakeUpMode { None, SingleTap, DoubleTap, RaiseWrist }; enum class WakeUpMode { None, SingleTap, DoubleTap, RaiseWrist };
@ -86,7 +86,7 @@ namespace Pinetime {
return settings.brightLevel; return settings.brightLevel;
}; };
private: private:
Pinetime::Drivers::SpiNorFlash& spiNorFlash; Pinetime::Drivers::SpiNorFlash& spiNorFlash;
struct SettingsData { struct SettingsData {

View File

@ -35,7 +35,7 @@ namespace Pinetime {
}; };
namespace Applications { namespace Applications {
class DisplayApp { class DisplayApp {
public: public:
enum class States { Idle, Running }; enum class States { Idle, Running };
enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim }; enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim };
enum class TouchModes { Gestures, Polling }; enum class TouchModes { Gestures, Polling };
@ -60,7 +60,7 @@ namespace Pinetime {
void SetFullRefresh(FullRefreshDirections direction); void SetFullRefresh(FullRefreshDirections direction);
void SetTouchMode(TouchModes mode); void SetTouchMode(TouchModes mode);
private: private:
Pinetime::Drivers::St7789& lcd; Pinetime::Drivers::St7789& lcd;
Pinetime::Components::LittleVgl& lvgl; Pinetime::Components::LittleVgl& lvgl;
Pinetime::Drivers::Cst816S& touchPanel; Pinetime::Drivers::Cst816S& touchPanel;

View File

@ -29,7 +29,7 @@ namespace Pinetime {
}; };
namespace Applications { namespace Applications {
class DisplayApp { class DisplayApp {
public: public:
DisplayApp(Drivers::St7789& lcd, DisplayApp(Drivers::St7789& lcd,
Components::LittleVgl& lvgl, Components::LittleVgl& lvgl,
Drivers::Cst816S&, Drivers::Cst816S&,
@ -45,7 +45,7 @@ namespace Pinetime {
void Start(); void Start();
void PushMessage(Pinetime::Applications::Display::Messages msg); void PushMessage(Pinetime::Applications::Display::Messages msg);
private: private:
TaskHandle_t taskHandle; TaskHandle_t taskHandle;
static void Process(void* instance); static void Process(void* instance);
void DisplayLogo(uint16_t color); void DisplayLogo(uint16_t color);

View File

@ -9,7 +9,7 @@
namespace Pinetime { namespace Pinetime {
namespace Components { namespace Components {
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) {
} }

View File

@ -10,7 +10,7 @@ namespace Pinetime {
namespace Components { namespace Components {
class LittleVgl { class LittleVgl {
public: public:
enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim }; enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim };
LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel); LittleVgl(Pinetime::Drivers::St7789& lcd, Pinetime::Drivers::Cst816S& touchPanel);
@ -24,7 +24,7 @@ namespace Pinetime {
void SetFullRefresh(FullRefreshDirections direction); void SetFullRefresh(FullRefreshDirections direction);
void SetNewTapEvent(uint16_t x, uint16_t y); void SetNewTapEvent(uint16_t x, uint16_t y);
private: private:
void InitDisplay(); void InitDisplay();
void InitTouchpad(); void InitTouchpad();
void InitTheme(); void InitTheme();

View File

@ -12,7 +12,7 @@ namespace Pinetime {
namespace Applications { namespace Applications {
namespace Screens { namespace Screens {
class ApplicationList : public Screen { class ApplicationList : public Screen {
public: public:
explicit ApplicationList(DisplayApp* app, explicit ApplicationList(DisplayApp* app,
Pinetime::Controllers::Settings& settingsController, Pinetime::Controllers::Settings& settingsController,
Pinetime::Controllers::Battery& batteryController, Pinetime::Controllers::Battery& batteryController,
@ -21,7 +21,7 @@ namespace Pinetime {
bool Refresh() override; bool Refresh() override;
bool OnTouchEvent(TouchEvents event) override; bool OnTouchEvent(TouchEvents event) override;
private: private:
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
Pinetime::Controllers::Battery& batteryController; Pinetime::Controllers::Battery& batteryController;
Controllers::DateTime& dateTimeController; Controllers::DateTime& dateTimeController;

View File

@ -4,7 +4,7 @@ namespace Pinetime {
namespace Applications { namespace Applications {
namespace Screens { namespace Screens {
class BatteryIcon { class BatteryIcon {
public: public:
static const char* GetUnknownIcon(); static const char* GetUnknownIcon();
static const char* GetBatteryIcon(int batteryPercent); static const char* GetBatteryIcon(int batteryPercent);
static const char* GetPlugIcon(bool isCharging); static const char* GetPlugIcon(bool isCharging);

View File

@ -15,7 +15,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class BatteryInfo : public Screen { class BatteryInfo : public Screen {
public: public:
BatteryInfo(DisplayApp* app, Pinetime::Controllers::Battery& batteryController); BatteryInfo(DisplayApp* app, Pinetime::Controllers::Battery& batteryController);
~BatteryInfo() override; ~BatteryInfo() override;
@ -24,7 +24,7 @@ namespace Pinetime {
void UpdateScreen(); void UpdateScreen();
void UpdateAnim(); void UpdateAnim();
private: private:
Pinetime::Controllers::Battery& batteryController; Pinetime::Controllers::Battery& batteryController;
lv_obj_t* voltage; lv_obj_t* voltage;

View File

@ -4,7 +4,7 @@ namespace Pinetime {
namespace Applications { namespace Applications {
namespace Screens { namespace Screens {
class BleIcon { class BleIcon {
public: public:
static const char* GetIcon(bool isConnected); static const char* GetIcon(bool isConnected);
}; };
} }

View File

@ -9,7 +9,7 @@ namespace Pinetime {
namespace Applications { namespace Applications {
namespace Screens { namespace Screens {
class Brightness : public Screen { class Brightness : public Screen {
public: public:
Brightness(DisplayApp* app, Controllers::BrightnessController& brightness); Brightness(DisplayApp* app, Controllers::BrightnessController& brightness);
~Brightness() override; ~Brightness() override;
bool Refresh() override; bool Refresh() override;
@ -18,7 +18,7 @@ namespace Pinetime {
void OnValueChanged(); void OnValueChanged();
private: private:
Controllers::BrightnessController& brightness; Controllers::BrightnessController& brightness;
lv_obj_t* slider_label; lv_obj_t* slider_label;

View File

@ -23,7 +23,7 @@ namespace Pinetime {
namespace Applications { namespace Applications {
namespace Screens { namespace Screens {
class Clock : public Screen { class Clock : public Screen {
public: public:
Clock(DisplayApp* app, Clock(DisplayApp* app,
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
Controllers::Battery& batteryController, Controllers::Battery& batteryController,
@ -38,7 +38,7 @@ namespace Pinetime {
bool OnTouchEvent(TouchEvents event) override; bool OnTouchEvent(TouchEvents event) override;
private: private:
Controllers::DateTime& dateTimeController; Controllers::DateTime& dateTimeController;
Controllers::Battery& batteryController; Controllers::Battery& batteryController;
Controllers::Ble& bleController; Controllers::Ble& bleController;

View File

@ -9,7 +9,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class DropDownDemo : public Screen { class DropDownDemo : public Screen {
public: public:
DropDownDemo(DisplayApp* app); DropDownDemo(DisplayApp* app);
~DropDownDemo() override; ~DropDownDemo() override;
@ -17,7 +17,7 @@ namespace Pinetime {
bool OnTouchEvent(TouchEvents event) override; bool OnTouchEvent(TouchEvents event) override;
private: private:
lv_obj_t* ddlist; lv_obj_t* ddlist;
bool isDropDownOpened = false; bool isDropDownOpened = false;

View File

@ -8,7 +8,7 @@ using namespace Pinetime::Applications::Screens;
FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Ble& bleController) FirmwareUpdate::FirmwareUpdate(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Ble& bleController)
: Screen(app), bleController {bleController} { : Screen(app), bleController {bleController} {
lv_obj_t * backgroundLabel = lv_label_create(lv_scr_act(), nullptr); lv_obj_t* backgroundLabel = lv_label_create(lv_scr_act(), nullptr);
lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP); lv_label_set_long_mode(backgroundLabel, LV_LABEL_LONG_CROP);
lv_obj_set_size(backgroundLabel, 240, 240); lv_obj_set_size(backgroundLabel, 240, 240);
lv_obj_set_pos(backgroundLabel, 0, 0); lv_obj_set_pos(backgroundLabel, 0, 0);

View File

@ -11,13 +11,13 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class FirmwareUpdate : public Screen { class FirmwareUpdate : public Screen {
public: public:
FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController); FirmwareUpdate(DisplayApp* app, Pinetime::Controllers::Ble& bleController);
~FirmwareUpdate() override; ~FirmwareUpdate() override;
bool Refresh() override; bool Refresh() override;
private: private:
enum class States { Idle, Running, Validated, Error }; enum class States { Idle, Running, Validated, Error };
Pinetime::Controllers::Ble& bleController; Pinetime::Controllers::Ble& bleController;
lv_obj_t* bar1; lv_obj_t* bar1;

View File

@ -12,7 +12,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class FirmwareValidation : public Screen { class FirmwareValidation : public Screen {
public: public:
FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator); FirmwareValidation(DisplayApp* app, Pinetime::Controllers::FirmwareValidator& validator);
~FirmwareValidation() override; ~FirmwareValidation() override;
@ -20,7 +20,7 @@ namespace Pinetime {
void OnButtonEvent(lv_obj_t* object, lv_event_t event); void OnButtonEvent(lv_obj_t* object, lv_event_t event);
private: private:
Pinetime::Controllers::FirmwareValidator& validator; Pinetime::Controllers::FirmwareValidator& validator;
lv_obj_t* labelVersionInfo; lv_obj_t* labelVersionInfo;

View File

@ -12,7 +12,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class FlashLight : public Screen { class FlashLight : public Screen {
public: public:
FlashLight(DisplayApp* app, System::SystemTask& systemTask, Controllers::BrightnessController& brightness); FlashLight(DisplayApp* app, System::SystemTask& systemTask, Controllers::BrightnessController& brightness);
~FlashLight() override; ~FlashLight() override;
@ -21,7 +21,7 @@ namespace Pinetime {
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
void OnClickEvent(lv_obj_t* obj, lv_event_t event); void OnClickEvent(lv_obj_t* obj, lv_event_t event);
private: private:
Pinetime::System::SystemTask& systemTask; Pinetime::System::SystemTask& systemTask;
Controllers::BrightnessController& brightness; Controllers::BrightnessController& brightness;

View File

@ -16,7 +16,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class HeartRate : public Screen { class HeartRate : public Screen {
public: public:
HeartRate(DisplayApp* app, Controllers::HeartRateController& HeartRateController, System::SystemTask& systemTask); HeartRate(DisplayApp* app, Controllers::HeartRateController& HeartRateController, System::SystemTask& systemTask);
~HeartRate() override; ~HeartRate() override;
@ -24,7 +24,7 @@ namespace Pinetime {
void OnStartStopEvent(lv_event_t event); void OnStartStopEvent(lv_event_t event);
private: private:
Controllers::HeartRateController& heartRateController; Controllers::HeartRateController& heartRateController;
Pinetime::System::SystemTask& systemTask; Pinetime::System::SystemTask& systemTask;
void UpdateStartStopButton(bool isRunning); void UpdateStartStopButton(bool isRunning);

View File

@ -12,7 +12,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class InfiniPaint : public Screen { class InfiniPaint : public Screen {
public: public:
InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl); InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl);
~InfiniPaint() override; ~InfiniPaint() override;
@ -23,7 +23,7 @@ namespace Pinetime {
bool OnTouchEvent(uint16_t x, uint16_t y) override; bool OnTouchEvent(uint16_t x, uint16_t y) override;
private: private:
Pinetime::Components::LittleVgl& lvgl; Pinetime::Components::LittleVgl& lvgl;
static constexpr uint16_t width = 10; static constexpr uint16_t width = 10;
static constexpr uint16_t height = 10; static constexpr uint16_t height = 10;

View File

@ -8,13 +8,13 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class Label : public Screen { class Label : public Screen {
public: public:
Label(uint8_t screenID, uint8_t numScreens, DisplayApp* app, lv_obj_t* labelText); Label(uint8_t screenID, uint8_t numScreens, DisplayApp* app, lv_obj_t* labelText);
~Label() override; ~Label() override;
bool Refresh() override; bool Refresh() override;
private: private:
bool running = true; bool running = true;
lv_obj_t* labelText = nullptr; lv_obj_t* labelText = nullptr;

View File

@ -13,7 +13,7 @@ namespace Pinetime {
namespace Applications { namespace Applications {
namespace Screens { namespace Screens {
class List : public Screen { class List : public Screen {
public: public:
struct Applications { struct Applications {
const char* icon; const char* icon;
const char* name; const char* name;
@ -31,7 +31,7 @@ namespace Pinetime {
void OnButtonEvent(lv_obj_t* object, lv_event_t event); void OnButtonEvent(lv_obj_t* object, lv_event_t event);
private: private:
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
Pinetime::Applications::Apps apps[MAXLISTITEMS]; Pinetime::Applications::Apps apps[MAXLISTITEMS];

View File

@ -10,13 +10,13 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class Meter : public Screen { class Meter : public Screen {
public: public:
Meter(DisplayApp* app); Meter(DisplayApp* app);
~Meter() override; ~Meter() override;
bool Refresh() override; bool Refresh() override;
private: private:
lv_style_t style_lmeter; lv_style_t style_lmeter;
lv_obj_t* lmeter; lv_obj_t* lmeter;

View File

@ -13,14 +13,14 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class Motion : public Screen { class Motion : public Screen {
public: public:
Motion(DisplayApp* app, Controllers::MotionController& motionController); Motion(DisplayApp* app, Controllers::MotionController& motionController);
~Motion() override; ~Motion() override;
bool Refresh() override; bool Refresh() override;
bool OnButtonPushed() override; bool OnButtonPushed() override;
private: private:
Controllers::MotionController& motionController; Controllers::MotionController& motionController;
lv_obj_t* chart; lv_obj_t* chart;
lv_chart_series_t* ser1; lv_chart_series_t* ser1;

View File

@ -30,7 +30,7 @@ namespace Pinetime {
namespace Applications { namespace Applications {
namespace Screens { namespace Screens {
class Music : public Screen { class Music : public Screen {
public: public:
Music(DisplayApp* app, Pinetime::Controllers::MusicService& music); Music(DisplayApp* app, Pinetime::Controllers::MusicService& music);
~Music() override; ~Music() override;
@ -39,7 +39,7 @@ namespace Pinetime {
void OnObjectEvent(lv_obj_t* obj, lv_event_t event); void OnObjectEvent(lv_obj_t* obj, lv_event_t event);
private: private:
bool OnTouchEvent(TouchEvents event); bool OnTouchEvent(TouchEvents event);
void UpdateLength(); void UpdateLength();

View File

@ -31,13 +31,13 @@ namespace Pinetime {
namespace Applications { namespace Applications {
namespace Screens { namespace Screens {
class Navigation : public Screen { class Navigation : public Screen {
public: public:
Navigation(DisplayApp* app, Pinetime::Controllers::NavigationService& nav); Navigation(DisplayApp* app, Pinetime::Controllers::NavigationService& nav);
~Navigation() override; ~Navigation() override;
bool Refresh() override; bool Refresh() override;
private: private:
lv_obj_t* imgFlag; lv_obj_t* imgFlag;
lv_obj_t* txtNarrative; lv_obj_t* txtNarrative;
lv_obj_t* txtManDist; lv_obj_t* txtManDist;

View File

@ -4,7 +4,7 @@ namespace Pinetime {
namespace Applications { namespace Applications {
namespace Screens { namespace Screens {
class NotificationIcon { class NotificationIcon {
public: public:
static const char* GetIcon(bool newNotificationAvailable); static const char* GetIcon(bool newNotificationAvailable);
}; };
} }

View File

@ -14,7 +14,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class Notifications : public Screen { class Notifications : public Screen {
public: public:
enum class Modes { Normal, Preview }; enum class Modes { Normal, Preview };
explicit Notifications(DisplayApp* app, explicit Notifications(DisplayApp* app,
Pinetime::Controllers::NotificationManager& notificationManager, Pinetime::Controllers::NotificationManager& notificationManager,
@ -26,7 +26,7 @@ namespace Pinetime {
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
class NotificationItem { class NotificationItem {
public: public:
NotificationItem(const char* title, NotificationItem(const char* title,
const char* msg, const char* msg,
uint8_t notifNr, uint8_t notifNr,
@ -42,7 +42,7 @@ namespace Pinetime {
void OnMuteIncomingCall(lv_event_t event); void OnMuteIncomingCall(lv_event_t event);
void OnRejectIncomingCall(lv_event_t event); void OnRejectIncomingCall(lv_event_t event);
private: private:
uint8_t notifNr = 0; uint8_t notifNr = 0;
uint8_t notifNb = 0; uint8_t notifNb = 0;
char pageText[4]; char pageText[4];
@ -62,7 +62,7 @@ namespace Pinetime {
Pinetime::Controllers::AlertNotificationService& alertNotificationService; Pinetime::Controllers::AlertNotificationService& alertNotificationService;
}; };
private: private:
struct NotificationData { struct NotificationData {
const char* title; const char* title;
const char* text; const char* text;

View File

@ -12,7 +12,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class Paddle : public Screen { class Paddle : public Screen {
public: public:
Paddle(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl); Paddle(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl);
~Paddle() override; ~Paddle() override;
@ -21,7 +21,7 @@ namespace Pinetime {
bool OnTouchEvent(TouchEvents event) override; bool OnTouchEvent(TouchEvents event) override;
bool OnTouchEvent(uint16_t x, uint16_t y) override; bool OnTouchEvent(uint16_t x, uint16_t y) override;
private: private:
Pinetime::Components::LittleVgl& lvgl; Pinetime::Components::LittleVgl& lvgl;
int paddleBottomY = 90; // bottom extreme of the paddle int paddleBottomY = 90; // bottom extreme of the paddle

View File

@ -9,7 +9,7 @@ namespace Pinetime {
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
@ -28,13 +28,13 @@ namespace Pinetime {
return *this; return *this;
} }
private: private:
T value {}; // NSDMI - default initialise type T value {}; // NSDMI - default initialise type
bool isUpdated {true}; // NSDMI - use brace initilisation bool isUpdated {true}; // NSDMI - use brace initilisation
}; };
class Screen { class Screen {
public: public:
explicit Screen(DisplayApp* app) : app {app} { explicit Screen(DisplayApp* app) : app {app} {
} }
virtual ~Screen() = default; virtual ~Screen() = default;
@ -67,7 +67,7 @@ namespace Pinetime {
return false; return false;
} }
protected: protected:
DisplayApp* app; DisplayApp* app;
bool running = true; bool running = true;
}; };

View File

@ -12,7 +12,7 @@ namespace Pinetime {
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,
uint8_t initScreen, uint8_t initScreen,
std::array<std::function<std::unique_ptr<Screen>()>, N>&& screens, std::array<std::function<std::unique_ptr<Screen>()>, N>&& screens,
@ -95,7 +95,7 @@ namespace Pinetime {
return false; return false;
} }
private: private:
uint8_t initScreen = 0; uint8_t initScreen = 0;
std::array<std::function<std::unique_ptr<Screen>()>, N> screens; std::array<std::function<std::unique_ptr<Screen>()>, N> screens;
ScreenListModes mode = ScreenListModes::UpDown; ScreenListModes mode = ScreenListModes::UpDown;

View File

@ -54,7 +54,7 @@ namespace Pinetime::Applications::Screens {
return nullptr; return nullptr;
} }
private: private:
std::array<TimeSeparated_t, N> buffer; std::array<TimeSeparated_t, N> buffer;
uint8_t currentSize; uint8_t currentSize;
uint8_t capacity; uint8_t capacity;
@ -62,7 +62,7 @@ namespace Pinetime::Applications::Screens {
}; };
class StopWatch : public Screen { class StopWatch : public Screen {
public: public:
StopWatch(DisplayApp* app); StopWatch(DisplayApp* app);
~StopWatch() override; ~StopWatch() override;
bool Refresh() override; bool Refresh() override;
@ -70,7 +70,7 @@ namespace Pinetime::Applications::Screens {
void playPauseBtnEventHandler(lv_event_t event); void playPauseBtnEventHandler(lv_event_t event);
void stopLapBtnEventHandler(lv_event_t event); void stopLapBtnEventHandler(lv_event_t event);
private: private:
bool running; bool running;
States currentState; States currentState;
Events currentEvent; Events currentEvent;

View File

@ -21,7 +21,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class SystemInfo : public Screen { class SystemInfo : public Screen {
public: public:
explicit SystemInfo(DisplayApp* app, explicit SystemInfo(DisplayApp* app,
Pinetime::Controllers::DateTime& dateTimeController, Pinetime::Controllers::DateTime& dateTimeController,
Pinetime::Controllers::Battery& batteryController, Pinetime::Controllers::Battery& batteryController,
@ -33,7 +33,7 @@ namespace Pinetime {
bool OnButtonPushed() override; bool OnButtonPushed() override;
bool OnTouchEvent(TouchEvents event) override; bool OnTouchEvent(TouchEvents event) override;
private: private:
bool running = true; bool running = true;
Pinetime::Controllers::DateTime& dateTimeController; Pinetime::Controllers::DateTime& dateTimeController;

View File

@ -14,7 +14,7 @@ namespace Pinetime {
namespace Applications { namespace Applications {
namespace Screens { namespace Screens {
class Tile : public Screen { class Tile : public Screen {
public: public:
struct Applications { struct Applications {
const char* icon; const char* icon;
Pinetime::Applications::Apps application; Pinetime::Applications::Apps application;
@ -34,7 +34,7 @@ namespace Pinetime {
void UpdateScreen(); void UpdateScreen();
void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId); void OnObjectEvent(lv_obj_t* obj, lv_event_t event, uint32_t buttonId);
private: private:
Pinetime::Controllers::Battery& batteryController; Pinetime::Controllers::Battery& batteryController;
Controllers::DateTime& dateTimeController; Controllers::DateTime& dateTimeController;

View File

@ -11,14 +11,14 @@ namespace Pinetime {
}; };
namespace Screens { namespace Screens {
class Twos : public Screen { class Twos : public Screen {
public: public:
Twos(DisplayApp* app); Twos(DisplayApp* app);
~Twos() override; ~Twos() override;
bool Refresh() override; bool Refresh() override;
bool OnTouchEvent(TouchEvents event) override; bool OnTouchEvent(TouchEvents event) override;
private: private:
lv_style_t style_cell1; lv_style_t style_cell1;
lv_style_t style_cell2; lv_style_t style_cell2;
lv_style_t style_cell3; lv_style_t style_cell3;

View File

@ -22,7 +22,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class WatchFaceAnalog : public Screen { class WatchFaceAnalog : public Screen {
public: public:
WatchFaceAnalog(DisplayApp* app, WatchFaceAnalog(DisplayApp* app,
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
Controllers::Battery& batteryController, Controllers::Battery& batteryController,
@ -34,7 +34,7 @@ namespace Pinetime {
bool Refresh() override; bool Refresh() override;
private: private:
uint8_t sHour, sMinute, sSecond; uint8_t sHour, sMinute, sSecond;
uint8_t hour; uint8_t hour;
uint8_t minute; uint8_t minute;

View File

@ -22,7 +22,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class WatchFaceDigital : public Screen { class WatchFaceDigital : public Screen {
public: public:
WatchFaceDigital(DisplayApp* app, WatchFaceDigital(DisplayApp* app,
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
Controllers::Battery& batteryController, Controllers::Battery& batteryController,
@ -37,7 +37,7 @@ namespace Pinetime {
void OnObjectEvent(lv_obj_t* pObj, lv_event_t i); void OnObjectEvent(lv_obj_t* pObj, lv_event_t i);
private: private:
char displayedChar[5]; char displayedChar[5];
uint16_t currentYear = 1970; uint16_t currentYear = 1970;

View File

@ -16,7 +16,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class QuickSettings : public Screen { class QuickSettings : public Screen {
public: public:
QuickSettings(DisplayApp* app, QuickSettings(DisplayApp* app,
Pinetime::Controllers::Battery& batteryController, Pinetime::Controllers::Battery& batteryController,
Controllers::DateTime& dateTimeController, Controllers::DateTime& dateTimeController,
@ -32,7 +32,7 @@ namespace Pinetime {
void UpdateScreen(); void UpdateScreen();
private: private:
Pinetime::Controllers::Battery& batteryController; Pinetime::Controllers::Battery& batteryController;
Controllers::DateTime& dateTimeController; Controllers::DateTime& dateTimeController;
Controllers::BrightnessController& brightness; Controllers::BrightnessController& brightness;

View File

@ -11,14 +11,14 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class SettingDisplay : public Screen { class SettingDisplay : public Screen {
public: public:
SettingDisplay(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); SettingDisplay(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
~SettingDisplay() override; ~SettingDisplay() override;
bool Refresh() override; bool Refresh() override;
void UpdateSelected(lv_obj_t* object, lv_event_t event); void UpdateSelected(lv_obj_t* object, lv_event_t event);
private: private:
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
uint8_t optionsTotal; uint8_t optionsTotal;
lv_obj_t* cbOption[4]; lv_obj_t* cbOption[4];

View File

@ -11,14 +11,14 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class SettingTimeFormat : public Screen { class SettingTimeFormat : public Screen {
public: public:
SettingTimeFormat(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); SettingTimeFormat(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
~SettingTimeFormat() override; ~SettingTimeFormat() override;
bool Refresh() override; bool Refresh() override;
void UpdateSelected(lv_obj_t* object, lv_event_t event); void UpdateSelected(lv_obj_t* object, lv_event_t event);
private: private:
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
uint8_t optionsTotal; uint8_t optionsTotal;
lv_obj_t* cbOption[2]; lv_obj_t* cbOption[2];

View File

@ -11,14 +11,14 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class SettingWakeUp : public Screen { class SettingWakeUp : public Screen {
public: public:
SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); SettingWakeUp(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
~SettingWakeUp() override; ~SettingWakeUp() override;
bool Refresh() override; bool Refresh() override;
void UpdateSelected(lv_obj_t* object, lv_event_t event); void UpdateSelected(lv_obj_t* object, lv_event_t event);
private: private:
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
uint8_t optionsTotal; uint8_t optionsTotal;
lv_obj_t* cbOption[4]; lv_obj_t* cbOption[4];

View File

@ -11,14 +11,14 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class SettingWatchFace : public Screen { class SettingWatchFace : public Screen {
public: public:
SettingWatchFace(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); SettingWatchFace(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
~SettingWatchFace() override; ~SettingWatchFace() override;
bool Refresh() override; bool Refresh() override;
void UpdateSelected(lv_obj_t* object, lv_event_t event); void UpdateSelected(lv_obj_t* object, lv_event_t event);
private: private:
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
uint8_t optionsTotal; uint8_t optionsTotal;
lv_obj_t* cbOption[2]; lv_obj_t* cbOption[2];

View File

@ -10,7 +10,7 @@ namespace Pinetime {
namespace Screens { namespace Screens {
class Settings : public Screen { class Settings : public Screen {
public: public:
Settings(DisplayApp* app, Pinetime::Controllers::Settings& settingsController); Settings(DisplayApp* app, Pinetime::Controllers::Settings& settingsController);
~Settings() override; ~Settings() override;
@ -19,7 +19,7 @@ namespace Pinetime {
void OnButtonEvent(lv_obj_t* object, lv_event_t event); void OnButtonEvent(lv_obj_t* object, lv_event_t event);
bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override; bool OnTouchEvent(Pinetime::Applications::TouchEvents event) override;
private: private:
Controllers::Settings& settingsController; Controllers::Settings& settingsController;
ScreenList<2> screens; ScreenList<2> screens;

View File

@ -5,7 +5,7 @@ namespace Pinetime {
namespace Drivers { namespace Drivers {
class TwiMaster; class TwiMaster;
class Bma421 { class Bma421 {
public: public:
struct Values { struct Values {
uint32_t steps; uint32_t steps;
int16_t x; int16_t x;
@ -30,7 +30,7 @@ namespace Pinetime {
bool IsOk() const; bool IsOk() const;
private: private:
void Reset(); void Reset();
TwiMaster& twiMaster; TwiMaster& twiMaster;

View File

@ -5,7 +5,7 @@
namespace Pinetime { namespace Pinetime {
namespace Drivers { namespace Drivers {
class BufferProvider { class BufferProvider {
public: public:
virtual bool GetNextBuffer(uint8_t** buffer, size_t& size) = 0; virtual bool GetNextBuffer(uint8_t** buffer, size_t& size) = 0;
}; };
} }

View File

@ -5,7 +5,7 @@
namespace Pinetime { namespace Pinetime {
namespace Drivers { namespace Drivers {
class Cst816S { class Cst816S {
public: public:
enum class Gestures : uint8_t { enum class Gestures : uint8_t {
None = 0x00, None = 0x00,
SlideDown = 0x01, SlideDown = 0x01,
@ -38,7 +38,7 @@ namespace Pinetime {
void Sleep(); void Sleep();
void Wakeup(); void Wakeup();
private: private:
static constexpr uint8_t pinIrq = 28; static constexpr uint8_t pinIrq = 28;
static constexpr uint8_t pinReset = 10; static constexpr uint8_t pinReset = 10;
static constexpr uint8_t lastTouchId = 0x0f; static constexpr uint8_t lastTouchId = 0x0f;

View File

@ -5,7 +5,7 @@
namespace Pinetime { namespace Pinetime {
namespace Drivers { namespace Drivers {
class Hrs3300 { class Hrs3300 {
public: public:
enum class Registers : uint8_t { enum class Registers : uint8_t {
Id = 0x00, Id = 0x00,
Enable = 0x01, Enable = 0x01,
@ -35,7 +35,7 @@ namespace Pinetime {
void SetGain(uint8_t gain); void SetGain(uint8_t gain);
void SetDrive(uint8_t drive); void SetDrive(uint8_t drive);
private: private:
TwiMaster& twiMaster; TwiMaster& twiMaster;
uint8_t twiAddress; uint8_t twiAddress;

View File

@ -5,11 +5,11 @@
namespace Pinetime { namespace Pinetime {
namespace Drivers { namespace Drivers {
class InternalFlash { class InternalFlash {
public: public:
static void ErasePage(uint32_t address); static void ErasePage(uint32_t address);
static void WriteWord(uint32_t address, uint32_t value); static void WriteWord(uint32_t address, uint32_t value);
private: private:
static inline void Wait(); static inline void Wait();
}; };
} }

View File

@ -6,7 +6,7 @@
namespace Pinetime { namespace Pinetime {
namespace Drivers { namespace Drivers {
class Spi { class Spi {
public: public:
Spi(SpiMaster& spiMaster, uint8_t pinCsn); Spi(SpiMaster& spiMaster, uint8_t pinCsn);
Spi(const Spi&) = delete; Spi(const Spi&) = delete;
Spi& operator=(const Spi&) = delete; Spi& operator=(const Spi&) = delete;
@ -20,7 +20,7 @@ namespace Pinetime {
void Sleep(); void Sleep();
void Wakeup(); void Wakeup();
private: private:
SpiMaster& spiMaster; SpiMaster& spiMaster;
uint8_t pinCsn; uint8_t pinCsn;
}; };

View File

@ -9,7 +9,7 @@
namespace Pinetime { namespace Pinetime {
namespace Drivers { namespace Drivers {
class SpiMaster { class SpiMaster {
public: public:
; ;
enum class SpiModule : uint8_t { SPI0, SPI1 }; enum class SpiModule : uint8_t { SPI0, SPI1 };
enum class BitOrder : uint8_t { Msb_Lsb, Lsb_Msb }; enum class BitOrder : uint8_t { Msb_Lsb, Lsb_Msb };
@ -42,7 +42,7 @@ namespace Pinetime {
void Sleep(); void Sleep();
void Wakeup(); void Wakeup();
private: private:
void SetupWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel); void SetupWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel);
void DisableWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel); void DisableWorkaroundForFtpan58(NRF_SPIM_Type* spim, uint32_t ppi_channel, uint32_t gpiote_channel);
void PrepareTx(const volatile uint32_t bufferAddress, const volatile size_t size); void PrepareTx(const volatile uint32_t bufferAddress, const volatile size_t size);

View File

@ -6,7 +6,7 @@ namespace Pinetime {
namespace Drivers { namespace Drivers {
class Spi; class Spi;
class SpiNorFlash { class SpiNorFlash {
public: public:
explicit SpiNorFlash(Spi& spi); explicit SpiNorFlash(Spi& spi);
SpiNorFlash(const SpiNorFlash&) = delete; SpiNorFlash(const SpiNorFlash&) = delete;
SpiNorFlash& operator=(const SpiNorFlash&) = delete; SpiNorFlash& operator=(const SpiNorFlash&) = delete;
@ -38,7 +38,7 @@ namespace Pinetime {
void Sleep(); void Sleep();
void Wakeup(); void Wakeup();
private: private:
enum class Commands : uint8_t { enum class Commands : uint8_t {
PageProgram = 0x02, PageProgram = 0x02,
Read = 0x03, Read = 0x03,

View File

@ -6,7 +6,7 @@ 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);
St7789(const St7789&) = delete; St7789(const St7789&) = delete;
St7789& operator=(const St7789&) = delete; St7789& operator=(const St7789&) = delete;
@ -28,7 +28,7 @@ namespace Pinetime {
void Sleep(); void Sleep();
void Wakeup(); void Wakeup();
private: private:
Spi& spi; Spi& spi;
uint8_t pinDataCommand; uint8_t pinDataCommand;
uint8_t verticalScrollingStartAddress = 0; uint8_t verticalScrollingStartAddress = 0;

View File

@ -7,7 +7,7 @@
namespace Pinetime { namespace Pinetime {
namespace Drivers { namespace Drivers {
class TwiMaster { class TwiMaster {
public: public:
enum class Modules { TWIM1 }; enum class Modules { TWIM1 };
enum class Frequencies { Khz100, Khz250, Khz400 }; enum class Frequencies { Khz100, Khz250, Khz400 };
enum class ErrorCodes { NoError, TransactionFailed }; enum class ErrorCodes { NoError, TransactionFailed };
@ -26,7 +26,7 @@ namespace Pinetime {
void Sleep(); void Sleep();
void Wakeup(); void Wakeup();
private: private:
ErrorCodes Read(uint8_t deviceAddress, uint8_t* buffer, size_t size, bool stop); ErrorCodes Read(uint8_t deviceAddress, uint8_t* buffer, size_t size, bool stop);
ErrorCodes Write(uint8_t deviceAddress, const uint8_t* data, size_t size, bool stop); ErrorCodes Write(uint8_t deviceAddress, const uint8_t* data, size_t size, bool stop);
void FixHwFreezed(); void FixHwFreezed();

View File

@ -4,7 +4,7 @@
namespace Pinetime { namespace Pinetime {
namespace Drivers { namespace Drivers {
class Watchdog { class Watchdog {
public: public:
enum class ResetReasons { ResetPin, Watchdog, SoftReset, CpuLockup, SystemOff, LpComp, DebugInterface, NFC, HardReset }; enum class ResetReasons { ResetPin, Watchdog, SoftReset, CpuLockup, SystemOff, LpComp, DebugInterface, NFC, HardReset };
void Setup(uint8_t timeoutSeconds); void Setup(uint8_t timeoutSeconds);
void Start(); void Start();
@ -14,20 +14,20 @@ namespace Pinetime {
} }
static const char* ResetReasonToString(ResetReasons reason); static const char* ResetReasonToString(ResetReasons reason);
private: private:
ResetReasons resetReason; ResetReasons resetReason;
ResetReasons ActualResetReason() const; ResetReasons ActualResetReason() const;
}; };
class WatchdogView { class WatchdogView {
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();
} }
private: private:
const Watchdog& watchdog; const Watchdog& watchdog;
}; };
} }

View File

@ -9,18 +9,18 @@ namespace Pinetime {
struct FreeRtosMonitor {}; struct FreeRtosMonitor {};
template <class T> class SystemMonitor { template <class T> class SystemMonitor {
public: public:
SystemMonitor() = delete; SystemMonitor() = delete;
}; };
template <> class SystemMonitor<DummyMonitor> { template <> class SystemMonitor<DummyMonitor> {
public: public:
void Process() const { void Process() const {
} }
}; };
template <> class SystemMonitor<FreeRtosMonitor> { template <> class SystemMonitor<FreeRtosMonitor> {
public: public:
void Process() const { void Process() const {
if (xTaskGetTickCount() - lastTick > 10000) { if (xTaskGetTickCount() - lastTick > 10000) {
NRF_LOG_INFO("---------------------------------------\nFree heap : %d", xPortGetFreeHeapSize()); NRF_LOG_INFO("---------------------------------------\nFree heap : %d", xPortGetFreeHeapSize());
@ -36,7 +36,7 @@ namespace Pinetime {
} }
} }
private: private:
mutable TickType_t lastTick = 0; mutable TickType_t lastTick = 0;
mutable TaskStatus_t tasksStatus[10]; mutable TaskStatus_t tasksStatus[10];
}; };

View File

@ -38,7 +38,7 @@ namespace Pinetime {
} }
namespace System { namespace System {
class SystemTask { class SystemTask {
public: public:
enum class Messages { enum class Messages {
GoToSleep, GoToSleep,
GoToRunning, GoToRunning,
@ -83,7 +83,7 @@ namespace Pinetime {
return nimbleController; return nimbleController;
}; };
private: private:
TaskHandle_t taskHandle; TaskHandle_t taskHandle;
Pinetime::Drivers::SpiMaster& spi; Pinetime::Drivers::SpiMaster& spi;