diff options
| author | JF002 <JF002@users.noreply.github.com> | 2020-12-01 20:44:44 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-01 20:44:44 (GMT) |
| commit | c6556bcdea7671f1c1daaa9e20c4c3d7cd5f29a4 (patch) | |
| tree | 38c920cd13ed3768af2363de317ef3adf4483bd6 /src | |
| parent | c87de415b28710ec0f5a504fe4720402b9be5ebc (diff) | |
| parent | 6e22509b5ffe6d7c29d09b07f38e64fb1bdc0b21 (diff) | |
Merge pull request #136 from okaestne/include-cleanup
Includes cleanup
Diffstat (limited to 'src')
91 files changed, 378 insertions, 421 deletions
diff --git a/src/components/battery/BatteryController.cpp b/src/components/battery/BatteryController.cpp index 571efae..3e3d65b 100644 --- a/src/components/battery/BatteryController.cpp +++ b/src/components/battery/BatteryController.cpp @@ -1,8 +1,7 @@ -#include <drivers/include/nrfx_saadc.h> +#include "BatteryController.h" #include <hal/nrf_gpio.h> #include <libraries/log/nrf_log.h> #include <algorithm> -#include "BatteryController.h" using namespace Pinetime::Controllers; diff --git a/src/components/battery/BatteryController.h b/src/components/battery/BatteryController.h index f07648a..7cc964e 100644 --- a/src/components/battery/BatteryController.h +++ b/src/components/battery/BatteryController.h @@ -1,7 +1,7 @@ #pragma once +#include <cstdint> #include <drivers/include/nrfx_saadc.h> - namespace Pinetime { namespace Controllers { class Battery { diff --git a/src/components/ble/AlertNotificationClient.cpp b/src/components/ble/AlertNotificationClient.cpp index abe4109..e7a1862 100644 --- a/src/components/ble/AlertNotificationClient.cpp +++ b/src/components/ble/AlertNotificationClient.cpp @@ -1,7 +1,7 @@ -#include <systemtask/SystemTask.h> -#include "NotificationManager.h" - #include "AlertNotificationClient.h" +#include <algorithm> +#include "NotificationManager.h" +#include "systemtask/SystemTask.h" using namespace Pinetime::Controllers; constexpr ble_uuid16_t AlertNotificationClient::ansServiceUuid; @@ -159,8 +159,8 @@ void AlertNotificationClient::OnNotification(ble_gap_event *event) { const auto maxBufferSize{maxMessageSize + headerSize}; const auto dbgPacketLen = OS_MBUF_PKTLEN(event->notify_rx.om); - size_t bufferSize = min(dbgPacketLen + stringTerminatorSize, maxBufferSize); - auto messageSize = min(maxMessageSize, (bufferSize - headerSize)); + size_t bufferSize = std::min(dbgPacketLen + stringTerminatorSize, maxBufferSize); + auto messageSize = std::min(maxMessageSize, (bufferSize - headerSize)); NotificationManager::Notification notif; os_mbuf_copydata(event->notify_rx.om, headerSize, messageSize - 1, notif.message.data()); diff --git a/src/components/ble/AlertNotificationClient.h b/src/components/ble/AlertNotificationClient.h index bc0df51..fa10456 100644 --- a/src/components/ble/AlertNotificationClient.h +++ b/src/components/ble/AlertNotificationClient.h @@ -1,13 +1,23 @@ #pragma once #include <cstdint> -#include <array> +#include <functional> +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max #include <host/ble_gap.h> +#undef max +#undef min #include "BleClient.h" - namespace Pinetime { + + namespace System { + class SystemTask; + } + namespace Controllers { + class NotificationManager; + class AlertNotificationClient : public BleClient { public: explicit AlertNotificationClient(Pinetime::System::SystemTask &systemTask, diff --git a/src/components/ble/AlertNotificationService.cpp b/src/components/ble/AlertNotificationService.cpp index 32711b9..3156470 100644 --- a/src/components/ble/AlertNotificationService.cpp +++ b/src/components/ble/AlertNotificationService.cpp @@ -1,10 +1,9 @@ - -#include <hal/nrf_rtc.h> -#include "NotificationManager.h" -#include <systemtask/SystemTask.h> - #include "AlertNotificationService.h" +#include <hal/nrf_rtc.h> #include <cstring> +#include <algorithm> +#include "NotificationManager.h" +#include "systemtask/SystemTask.h" using namespace Pinetime::Controllers; @@ -60,8 +59,8 @@ int AlertNotificationService::OnAlert(uint16_t conn_handle, uint16_t attr_handle const auto maxBufferSize{maxMessageSize + headerSize}; const auto dbgPacketLen = OS_MBUF_PKTLEN(ctxt->om); - size_t bufferSize = min(dbgPacketLen + stringTerminatorSize, maxBufferSize); - auto messageSize = min(maxMessageSize, (bufferSize-headerSize)); + size_t bufferSize = std::min(dbgPacketLen + stringTerminatorSize, maxBufferSize); + auto messageSize = std::min(maxMessageSize, (bufferSize-headerSize)); NotificationManager::Notification notif; os_mbuf_copydata(ctxt->om, headerSize, messageSize-1, notif.message.data()); diff --git a/src/components/ble/AlertNotificationService.h b/src/components/ble/AlertNotificationService.h index 1b8c498..120312d 100644 --- a/src/components/ble/AlertNotificationService.h +++ b/src/components/ble/AlertNotificationService.h @@ -1,10 +1,20 @@ #pragma once #include <cstdint> #include <array> +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max #include <host/ble_gap.h> +#undef max +#undef min namespace Pinetime { + + namespace System { + class SystemTask; + } namespace Controllers { + class NotificationManager; + class AlertNotificationService { public: AlertNotificationService(Pinetime::System::SystemTask &systemTask, diff --git a/src/components/ble/BatteryInformationService.h b/src/components/ble/BatteryInformationService.h index 74b2222..b00000a 100644 --- a/src/components/ble/BatteryInformationService.h +++ b/src/components/ble/BatteryInformationService.h @@ -1,5 +1,9 @@ #pragma once +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max #include <host/ble_gap.h> +#undef max +#undef min namespace Pinetime { namespace System { diff --git a/src/components/ble/BleController.cpp b/src/components/ble/BleController.cpp index 2b396e1..650ec79 100644 --- a/src/components/ble/BleController.cpp +++ b/src/components/ble/BleController.cpp @@ -1,5 +1,3 @@ -#include <cstring> -#include <cstdlib> #include "BleController.h" using namespace Pinetime::Controllers; diff --git a/src/components/ble/BleController.h b/src/components/ble/BleController.h index 3f52ea2..0570c8d 100644 --- a/src/components/ble/BleController.h +++ b/src/components/ble/BleController.h @@ -1,8 +1,7 @@ #pragma once -#include <FreeRTOS.h> -#include <queue.h> #include <array> +#include <cstdint> namespace Pinetime { namespace Controllers { diff --git a/src/components/ble/CurrentTimeClient.cpp b/src/components/ble/CurrentTimeClient.cpp index 92f9374..be50fed 100644 --- a/src/components/ble/CurrentTimeClient.cpp +++ b/src/components/ble/CurrentTimeClient.cpp @@ -1,5 +1,6 @@ -#include <hal/nrf_rtc.h> #include "CurrentTimeClient.h" +#include <hal/nrf_rtc.h> +#include "components/datetime/DateTimeController.h" using namespace Pinetime::Controllers; diff --git a/src/components/ble/CurrentTimeClient.h b/src/components/ble/CurrentTimeClient.h index 9313939..1b2e018 100644 --- a/src/components/ble/CurrentTimeClient.h +++ b/src/components/ble/CurrentTimeClient.h @@ -1,13 +1,15 @@ #pragma once +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max +#include <host/ble_gap.h> +#undef max +#undef min #include <cstdint> -#include <array> - -#include "components/datetime/DateTimeController.h" #include "BleClient.h" -#include <host/ble_gap.h> namespace Pinetime { namespace Controllers { + class DateTime; class CurrentTimeClient : public BleClient { public: diff --git a/src/components/ble/CurrentTimeService.h b/src/components/ble/CurrentTimeService.h index a6be964..2395628 100644 --- a/src/components/ble/CurrentTimeService.h +++ b/src/components/ble/CurrentTimeService.h @@ -3,7 +3,11 @@ #include <array> #include "components/datetime/DateTimeController.h" +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max #include <host/ble_gap.h> +#undef max +#undef min namespace Pinetime { namespace Controllers { diff --git a/src/components/ble/DeviceInformationService.h b/src/components/ble/DeviceInformationService.h index 25ab840..94ca7bb 100644 --- a/src/components/ble/DeviceInformationService.h +++ b/src/components/ble/DeviceInformationService.h @@ -1,9 +1,10 @@ #pragma once -#include <cstdint> -#include <array> - +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max #include <host/ble_gap.h> -#include <Version.h> +#undef max +#undef min +#include "Version.h" namespace Pinetime { namespace Controllers { diff --git a/src/components/ble/DfuService.cpp b/src/components/ble/DfuService.cpp index 4dec514..90795b4 100644 --- a/src/components/ble/DfuService.cpp +++ b/src/components/ble/DfuService.cpp @@ -1,8 +1,8 @@ +#include "DfuService.h" #include <cstring> - #include "components/ble/BleController.h" +#include "drivers/SpiNorFlash.h" #include "systemtask/SystemTask.h" -#include "DfuService.h" using namespace Pinetime::Controllers; diff --git a/src/components/ble/DfuService.h b/src/components/ble/DfuService.h index d7ba460..096bd99 100644 --- a/src/components/ble/DfuService.h +++ b/src/components/ble/DfuService.h @@ -3,7 +3,11 @@ #include <cstdint> #include <array> +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max #include <host/ble_gap.h> +#undef max +#undef min namespace Pinetime { namespace System { diff --git a/src/components/ble/ImmediateAlertService.cpp b/src/components/ble/ImmediateAlertService.cpp index e2cee30..0f6bf6c 100644 --- a/src/components/ble/ImmediateAlertService.cpp +++ b/src/components/ble/ImmediateAlertService.cpp @@ -1,7 +1,7 @@ -#include <systemtask/SystemTask.h> -#include <cstring> #include "ImmediateAlertService.h" -#include "AlertNotificationService.h" +#include <cstring> +#include "NotificationManager.h" +#include "systemtask/SystemTask.h" using namespace Pinetime::Controllers; diff --git a/src/components/ble/ImmediateAlertService.h b/src/components/ble/ImmediateAlertService.h index c42846c..2bc9cba 100644 --- a/src/components/ble/ImmediateAlertService.h +++ b/src/components/ble/ImmediateAlertService.h @@ -1,5 +1,9 @@ #pragma once +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max #include <host/ble_gap.h> +#undef max +#undef min namespace Pinetime { namespace System { diff --git a/src/components/ble/MusicService.cpp b/src/components/ble/MusicService.cpp index 84f2972..fdecb6b 100644 --- a/src/components/ble/MusicService.cpp +++ b/src/components/ble/MusicService.cpp @@ -15,8 +15,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#include <systemtask/SystemTask.h> #include "MusicService.h" +#include "systemtask/SystemTask.h" int MSCallback(uint16_t conn_handle, uint16_t attr_handle, struct ble_gatt_access_ctxt *ctxt, void *arg) { auto musicService = static_cast<Pinetime::Controllers::MusicService *>(arg); diff --git a/src/components/ble/MusicService.h b/src/components/ble/MusicService.h index b365909..ee3628b 100644 --- a/src/components/ble/MusicService.h +++ b/src/components/ble/MusicService.h @@ -18,10 +18,13 @@ #pragma once #include <cstdint> -#include <array> +#include <string> +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max #include <host/ble_gap.h> #include <host/ble_uuid.h> -#include <string> +#undef max +#undef min //c7e50000-78fc-48fe-8e23-43b37a1942d0 #define MUSIC_SERVICE_UUID_BASE {0xd0, 0x42, 0x19, 0x3a, 0x3b, 0x43, 0x23, 0x8e, 0xfe, 0x48, 0xfc, 0x78, 0x00, 0x00, 0xe5, 0xc7} diff --git a/src/components/ble/NimbleController.cpp b/src/components/ble/NimbleController.cpp index af7f402..a6f3cc3 100644 --- a/src/components/ble/NimbleController.cpp +++ b/src/components/ble/NimbleController.cpp @@ -1,15 +1,19 @@ -#include "components/datetime/DateTimeController.h" -#include <systemtask/SystemTask.h> -#include "components/ble/NotificationManager.h" -#include <hal/nrf_rtc.h> #include "NimbleController.h" -#include "MusicService.h" -#include <services/gatt/ble_svc_gatt.h> -#include <services/gap/ble_svc_gap.h> -#include <host/util/util.h> -#include <host/ble_hs_id.h> -#include <host/ble_hs.h> +#include <hal/nrf_rtc.h> +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max #include <host/ble_gap.h> +#include <host/ble_hs.h> +#include <host/ble_hs_id.h> +#include <host/util/util.h> +#undef max +#undef min +#include <services/gap/ble_svc_gap.h> +#include <services/gatt/ble_svc_gatt.h> +#include "components/ble/BleController.h" +#include "components/ble/NotificationManager.h" +#include "components/datetime/DateTimeController.h" +#include "systemtask/SystemTask.h" using namespace Pinetime::Controllers; diff --git a/src/components/ble/NimbleController.h b/src/components/ble/NimbleController.h index 8ddec1f..914f11e 100644 --- a/src/components/ble/NimbleController.h +++ b/src/components/ble/NimbleController.h @@ -2,24 +2,35 @@ #include <cstdint> -#include "AlertNotificationService.h" +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max +#include <host/ble_gap.h> +#undef max +#undef min #include "AlertNotificationClient.h" -#include "DeviceInformationService.h" +#include "AlertNotificationService.h" +#include "BatteryInformationService.h" #include "CurrentTimeClient.h" -#include "DfuService.h" #include "CurrentTimeService.h" -#include "MusicService.h" -#include "BatteryInformationService.h" +#include "DeviceInformationService.h" +#include "DfuService.h" #include "ImmediateAlertService.h" +#include "MusicService.h" #include "ServiceDiscovery.h" -#include <host/ble_gap.h> namespace Pinetime { namespace Drivers { class SpiNorFlash; } + + namespace System { + class SystemTask; + } + namespace Controllers { + class Ble; class DateTime; + class NotificationManager; class NimbleController { diff --git a/src/components/ble/NotificationManager.cpp b/src/components/ble/NotificationManager.cpp index 6771172..dabcb4b 100644 --- a/src/components/ble/NotificationManager.cpp +++ b/src/components/ble/NotificationManager.cpp @@ -1,6 +1,6 @@ +#include "NotificationManager.h" #include <cstring> #include <algorithm> -#include "NotificationManager.h" using namespace Pinetime::Controllers; diff --git a/src/components/ble/NotificationManager.h b/src/components/ble/NotificationManager.h index 49fe830..036d2ed 100644 --- a/src/components/ble/NotificationManager.h +++ b/src/components/ble/NotificationManager.h @@ -2,6 +2,8 @@ #include <array> #include <atomic> +#include <cstddef> +#include <cstdint> namespace Pinetime { namespace Controllers { @@ -27,7 +29,7 @@ namespace Pinetime { bool ClearNewNotificationFlag(); bool AreNewNotificationsAvailable(); - static constexpr uint8_t MaximumMessageSize() { return MessageSize; }; + static constexpr size_t MaximumMessageSize() { return MessageSize; }; size_t NbNotifications() const; private: diff --git a/src/components/ble/ServiceDiscovery.cpp b/src/components/ble/ServiceDiscovery.cpp index 4b29d89..4d37b8b 100644 --- a/src/components/ble/ServiceDiscovery.cpp +++ b/src/components/ble/ServiceDiscovery.cpp @@ -1,5 +1,7 @@ -#include <libraries/log/nrf_log.h> #include "ServiceDiscovery.h" +#include <libraries/log/nrf_log.h> +#include "BleClient.h" + using namespace Pinetime::Controllers; ServiceDiscovery::ServiceDiscovery(std::array<BleClient*, 2>&& clients) : clients{clients} { diff --git a/src/components/ble/ServiceDiscovery.h b/src/components/ble/ServiceDiscovery.h index c86fc4e..0b26bd1 100644 --- a/src/components/ble/ServiceDiscovery.h +++ b/src/components/ble/ServiceDiscovery.h @@ -1,12 +1,12 @@ #pragma once #include <array> -#include <functional> -#include <memory> -#include "BleClient.h" +#include <cstdint> namespace Pinetime { namespace Controllers { + class BleClient; + class ServiceDiscovery { public: ServiceDiscovery(std::array<BleClient*, 2>&& bleClients); diff --git a/src/components/brightness/BrightnessController.cpp b/src/components/brightness/BrightnessController.cpp index c8825d6..78c461d 100644 --- a/src/components/brightness/BrightnessController.cpp +++ b/src/components/brightness/BrightnessController.cpp @@ -1,5 +1,5 @@ -#include <hal/nrf_gpio.h> #include "BrightnessController.h" +#include <hal/nrf_gpio.h> using namespace Pinetime::Controllers; diff --git a/src/components/firmwarevalidator/FirmwareValidator.cpp b/src/components/firmwarevalidator/FirmwareValidator.cpp index 244d5c0..48f9855 100644 --- a/src/components/firmwarevalidator/FirmwareValidator.cpp +++ b/src/components/firmwarevalidator/FirmwareValidator.cpp @@ -1,8 +1,8 @@ -#include <drivers/InternalFlash.h> -#include <hal/nrf_rtc.h> - #include "FirmwareValidator.h" +#include <hal/nrf_rtc.h> +#include "drivers/InternalFlash.h" + using namespace Pinetime::Controllers; bool FirmwareValidator::IsValidated() const { diff --git a/src/components/gfx/Gfx.cpp b/src/components/gfx/Gfx.cpp index bab7c8d..59c1da9 100644 --- a/src/components/gfx/Gfx.cpp +++ b/src/components/gfx/Gfx.cpp @@ -1,8 +1,5 @@ -#include <libraries/svc/nrf_svci.h> -#include <FreeRTOS.h> -#include <task.h> #include "Gfx.h" -#include "../../drivers/St7789.h" +#include "drivers/St7789.h" using namespace Pinetime::Components; Gfx::Gfx(Pinetime::Drivers::St7789 &lcd) : lcd{lcd} { diff --git a/src/components/gfx/Gfx.h b/src/components/gfx/Gfx.h index eba6319..4c0fc8e 100644 --- a/src/components/gfx/Gfx.h +++ b/src/components/gfx/Gfx.h @@ -1,10 +1,10 @@ #pragma once -#include <cstdint> -#include <nrf_font.h> -#include <drivers/BufferProvider.h> #include <FreeRTOS.h> +#include <nrf_font.h> #include <task.h> - +#include <cstddef> +#include <cstdint> +#include "drivers/BufferProvider.h" namespace Pinetime { namespace Drivers { diff --git a/src/displayapp/DisplayApp.cpp b/src/displayapp/DisplayApp.cpp index d4d4133..efc042b 100644 --- a/src/displayapp/DisplayApp.cpp +++ b/src/displayapp/DisplayApp.cpp @@ -1,25 +1,24 @@ -#include <string> - #include "DisplayApp.h" -#include <FreeRTOS.h> -#include <task.h> #include <libraries/log/nrf_log.h> -#include <nrf_font.h> -#include <queue.h> +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" #include "components/datetime/DateTimeController.h" -#include <drivers/Cst816s.h> -#include "displayapp/screens/Notifications.h" -#include "displayapp/screens/Tile.h" -#include "displayapp/screens/Meter.h" -#include "displayapp/screens/Gauge.h" -#include "displayapp/screens/Brightness.h" -#include "displayapp/screens/SystemInfo.h" -#include "displayapp/screens/Music.h" #include "components/ble/NotificationManager.h" -#include "displayapp/screens/FirmwareUpdate.h" #include "displayapp/screens/ApplicationList.h" +#include "displayapp/screens/Brightness.h" +#include "displayapp/screens/Clock.h" +#include "displayapp/screens/FirmwareUpdate.h" #include "displayapp/screens/FirmwareValidation.h" +#include "displayapp/screens/Gauge.h" #include "displayapp/screens/InfiniPaint.h" +#include "displayapp/screens/Meter.h" +#include "displayapp/screens/Music.h" +#include "displayapp/screens/Notifications.h" +#include "displayapp/screens/SystemInfo.h" +#include "displayapp/screens/Tile.h" +#include "drivers/Cst816s.h" +#include "drivers/St7789.h" +#include "drivers/Watchdog.h" #include "systemtask/SystemTask.h" using namespace Pinetime::Applications; diff --git a/src/displayapp/DisplayApp.h b/src/displayapp/DisplayApp.h index 2a0efde..25cd281 100644 --- a/src/displayapp/DisplayApp.h +++ b/src/displayapp/DisplayApp.h @@ -1,28 +1,30 @@ #pragma once #include <FreeRTOS.h> -#include <task.h> -#include <drivers/St7789.h> -#include <drivers/SpiMaster.h> -#include <bits/unique_ptr.h> +#include <date/date.h> #include <queue.h> -#include "components/gfx/Gfx.h" -#include "components/battery/BatteryController.h" +#include <task.h> +#include <memory> +#include "Apps.h" +#include "LittleVgl.h" +#include "TouchEvents.h" #include "components/brightness/BrightnessController.h" -#include "components/ble/BleController.h" -#include "components/datetime/DateTimeController.h" -#include "components/ble/NotificationManager.h" #include "components/firmwarevalidator/FirmwareValidator.h" -#include "drivers/Cst816s.h" -#include "LittleVgl.h" -#include <date/date.h> -#include "displayapp/screens/Clock.h" #include "displayapp/screens/Modal.h" -#include <drivers/Watchdog.h> -#include "TouchEvents.h" -#include "Apps.h" - namespace Pinetime { + + namespace Drivers { + class St7789; + class Cst816S; + class WatchdogView; + } + namespace Controllers { + class Battery; + class Ble; + class DateTime; + class NotificationManager; + } + namespace System { class SystemTask; }; diff --git a/src/displayapp/LittleVgl.cpp b/src/displayapp/LittleVgl.cpp index 7b6275e..b4e5cac 100644 --- a/src/displayapp/LittleVgl.cpp +++ b/src/displayapp/LittleVgl.cpp @@ -1,14 +1,10 @@ +#include "LittleVgl.h" + #include <FreeRTOS.h> -#include <projdefs.h> #include <task.h> -#include <libs/lvgl/src/lv_core/lv_obj.h> -#include <hal/nrf_rtc.h> -#include <libraries/log/nrf_log.h> - -#include <libs/lvgl/src/lv_themes/lv_theme.h> -#include <libs/lvgl/src/lv_themes/lv_theme_night.h> - -#include "LittleVgl.h" +//#include <projdefs.h> +#include "drivers/Cst816s.h" +#include "drivers/St7789.h" using namespace Pinetime::Components; diff --git a/src/displayapp/LittleVgl.h b/src/displayapp/LittleVgl.h index 5c1c443..ea50985 100644 --- a/src/displayapp/LittleVgl.h +++ b/src/displayapp/LittleVgl.h @@ -1,12 +1,13 @@ #pragma once -#include <libs/lvgl/src/lv_core/lv_style.h> -#include <libs/lvgl/src/lv_themes/lv_theme.h> -#include <libs/lvgl/src/lv_hal/lv_hal.h> -#include <drivers/St7789.h> -#include <drivers/Cst816s.h> +#include <lvgl/lvgl.h> namespace Pinetime { + namespace Drivers { + class Cst816S; + class St7789; + } + namespace Components { class LittleVgl { public: diff --git a/src/displayapp/screens/ApplicationList.cpp b/src/displayapp/screens/ApplicationList.cpp index 7eb9718..1702697 100644 --- a/src/displayapp/screens/ApplicationList.cpp +++ b/src/displayapp/screens/ApplicationList.cpp @@ -1,9 +1,10 @@ -#include <libs/lvgl/lvgl.h> -#include <displayapp/DisplayApp.h> -#include <functional> #include "ApplicationList.h" -#include "Tile.h" +#include <lvgl/lvgl.h> +#include <array> #include "Symbols.h" +#include "Tile.h" +#include "displayapp/Apps.h" +#include "../DisplayApp.h" using namespace Pinetime::Applications::Screens; diff --git a/src/displayapp/screens/ApplicationList.h b/src/displayapp/screens/ApplicationList.h index 9c95acb..aefb238 100644 --- a/src/displayapp/screens/ApplicationList.h +++ b/src/displayapp/screens/ApplicationList.h @@ -1,14 +1,9 @@ #pragma once -#include <functional> -#include <vector> +#include <memory> -#include "components/ble/NimbleController.h" #include "Screen.h" -#include "Label.h" #include "ScreenList.h" -#include "Gauge.h" -#include "Meter.h" namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/BatteryIcon.cpp b/src/displayapp/screens/BatteryIcon.cpp index 26939d1..4c10247 100644 --- a/src/displayapp/screens/BatteryIcon.cpp +++ b/src/displayapp/screens/BatteryIcon.cpp @@ -1,5 +1,6 @@ #include "BatteryIcon.h" #include "Symbols.h" + using namespace Pinetime::Applications::Screens; const char* BatteryIcon::GetBatteryIcon(float batteryPercent) { diff --git a/src/displayapp/screens/BatteryIcon.h b/src/displayapp/screens/BatteryIcon.h index 58f04a8..f100192 100644 --- a/src/displayapp/screens/BatteryIcon.h +++ b/src/displayapp/screens/BatteryIcon.h @@ -1,7 +1,5 @@ #pragma once -#include <libs/lvgl/src/lv_draw/lv_img_decoder.h> - namespace Pinetime { namespace Applications { namespace Screens { diff --git a/src/displayapp/screens/Brightness.cpp b/src/displayapp/screens/Brightness.cpp index 8ea9a77..c8085be 100644 --- a/src/displayapp/screens/Brightness.cpp +++ b/src/displayapp/screens/Brightness.cpp @@ -1,5 +1,5 @@ -#include <libs/lvgl/lvgl.h> #include "Brightness.h" +#include <lvgl/lvgl.h> using namespace Pinetime::Applications::Screens; diff --git a/src/displayapp/screens/Brightness.h b/src/displayapp/screens/Brightness.h index 7d599ac..7aee968 100644 --- a/src/displayapp/screens/Brightness.h +++ b/src/displayapp/screens/Brightness.h @@ -1,8 +1,9 @@ #pragma once -#include <libs/lvgl/src/lv_core/lv_obj.h> -#include "components/brightness/BrightnessController.h" +#include <lvgl/src/lv_core/lv_obj.h> +#include <cstdint> #include "Screen.h" +#include "components/brightness/BrightnessController.h" namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/Clock.cpp b/src/displayapp/screens/Clock.cpp index 977321c1..5765914 100644 --- a/src/displayapp/screens/Clock.cpp +++ b/src/displayapp/screens/Clock.cpp @@ -1,15 +1,16 @@ -#include <cstdio> - -#include <libs/date/includes/date/date.h> -#include "components/datetime/DateTimeController.h" -#include <libs/lvgl/lvgl.h> #include "Clock.h" -#include "../DisplayApp.h" + +#include <date/date.h> +#include <lvgl/lvgl.h> +#include <cstdio> #include "BatteryIcon.h" #include "BleIcon.h" +#include "NotificationIcon.h" #include "Symbols.h" +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" #include "components/ble/NotificationManager.h" -#include "NotificationIcon.h" +#include "../DisplayApp.h" using namespace Pinetime::Applications::Screens; extern lv_font_t jetbrains_mono_extrabold_compressed; diff --git a/src/displayapp/screens/Clock.h b/src/displayapp/screens/Clock.h index 58149a7..4c5f60a 100644 --- a/src/displayapp/screens/Clock.h +++ b/src/displayapp/screens/Clock.h @@ -1,17 +1,19 @@ #pragma once -#include <cstdint> +#include <lvgl/src/lv_core/lv_obj.h> #include <chrono> - +#include <cstdint> +#include <memory> #include "Screen.h" -#include <bits/unique_ptr.h> -#include <libs/lvgl/src/lv_core/lv_style.h> -#include <libs/lvgl/src/lv_core/lv_obj.h> -#include "components/ble/NotificationManager.h" -#include "components/battery/BatteryController.h" -#include "components/ble/BleController.h" +#include "components/datetime/DateTimeController.h" namespace Pinetime { + namespace Controllers { + class Battery; + class Ble; + class NotificationManager; + } + namespace Applications { namespace Screens { @@ -34,7 +36,7 @@ namespace Pinetime { T value; bool isUpdated = true; }; - class Clock : public Screen{ + class Clock : public Screen { public: Clock(DisplayApp* app, Controllers::DateTime& dateTimeController, diff --git a/src/displayapp/screens/DropDownDemo.cpp b/src/displayapp/screens/DropDownDemo.cpp index ce3acd5..37728e1 100644 --- a/src/displayapp/screens/DropDownDemo.cpp +++ b/src/displayapp/screens/DropDownDemo.cpp @@ -1,6 +1,6 @@ -#include <libs/lvgl/lvgl.h> -#include <libraries/log/nrf_log.h> #include "DropDownDemo.h" +#include <lvgl/lvgl.h> +#include <libraries/log/nrf_log.h> #include "../DisplayApp.h" using namespace Pinetime::Applications::Screens; diff --git a/src/displayapp/screens/DropDownDemo.h b/src/displayapp/screens/DropDownDemo.h index 7c75efc..d66aeed 100644 --- a/src/displayapp/screens/DropDownDemo.h +++ b/src/displayapp/screens/DropDownDemo.h @@ -2,15 +2,13 @@ #include <cstdint> #include "Screen.h" -#include <bits/unique_ptr.h> -#include <libs/lvgl/src/lv_core/lv_style.h> -#include <libs/lvgl/src/lv_core/lv_obj.h> +#include <lvgl/src/lv_core/lv_obj.h> namespace Pinetime { namespace Applications { namespace Screens { - class DropDownDemo : public Screen{ + class DropDownDemo : public Screen { public: DropDownDemo(DisplayApp* app); ~DropDownDemo() override; diff --git a/src/displayapp/screens/FirmwareUpdate.cpp b/src/displayapp/screens/FirmwareUpdate.cpp index 778409e..b9f891d 100644 --- a/src/displayapp/screens/FirmwareUpdate.cpp +++ b/src/displayapp/screens/FirmwareUpdate.cpp @@ -1,5 +1,6 @@ -#include <libs/lvgl/lvgl.h> #include "FirmwareUpdate.h" +#include <lvgl/lvgl.h> +#include "components/ble/BleController.h" #include "../DisplayApp.h" using namespace Pinetime::Applications::Screens; diff --git a/src/displayapp/screens/FirmwareUpdate.h b/src/displayapp/screens/FirmwareUpdate.h index 893fe68..262e7af 100644 --- a/src/displayapp/screens/FirmwareUpdate.h +++ b/src/displayapp/screens/FirmwareUpdate.h @@ -1,15 +1,12 @@ #pragma once -#include <cstdint> -#include <chrono> - #include "Screen.h" -#include <bits/unique_ptr.h> -#include <libs/lvgl/src/lv_core/lv_style.h> -#include <libs/lvgl/src/lv_core/lv_obj.h> -#include "components/ble/BleController.h" +#include <lvgl/src/lv_core/lv_obj.h> namespace Pinetime { + namespace Controllers { + class Ble; + } namespace Applications { namespace Screens { diff --git a/src/displayapp/screens/FirmwareValidation.cpp b/src/displayapp/screens/FirmwareValidation.cpp index 4ac399f..d4165dc 100644 --- a/src/displayapp/screens/FirmwareValidation.cpp +++ b/src/displayapp/screens/FirmwareValidation.cpp @@ -1,8 +1,8 @@ -#include <libs/lvgl/lvgl.h> #include "FirmwareValidation.h" -#include "../DisplayApp.h" -#include "../../Version.h" +#include <lvgl/lvgl.h> +#include "Version.h" #include "components/firmwarevalidator/FirmwareValidator.h" +#include "../DisplayApp.h" using namespace Pinetime::Applications::Screens; extern lv_font_t jetbrains_mono_extrabold_compressed; @@ -87,5 +87,3 @@ void FirmwareValidation::OnButtonEvent(lv_obj_t *object, lv_event_t event) { } } - - diff --git a/src/displayapp/screens/FirmwareValidation.h b/src/displayapp/screens/FirmwareValidation.h index 947f557..9eea86b 100644 --- a/src/displayapp/screens/FirmwareValidation.h +++ b/src/displayapp/screens/FirmwareValidation.h @@ -1,10 +1,7 @@ #pragma once -#include <cstdint> #include "Screen.h" -#include <bits/unique_ptr.h> -#include <libs/lvgl/src/lv_core/lv_style.h> -#include <libs/lvgl/src/lv_core/lv_obj.h> +#include <lvgl/src/lv_core/lv_obj.h> namespace Pinetime { namespace Controllers { diff --git a/src/displayapp/screens/Gauge.cpp b/src/displayapp/screens/Gauge.cpp index 81c283c..1b9f2c6 100644 --- a/src/displayapp/screens/Gauge.cpp +++ b/src/displayapp/screens/Gauge.cpp @@ -1,4 +1,3 @@ -#include <libs/lvgl/lvgl.h> #include "Gauge.h" #include "../DisplayApp.h" diff --git a/src/displayapp/screens/Gauge.h b/src/displayapp/screens/Gauge.h index 03c06be..2a6b8f8 100644 --- a/src/displayapp/screens/Gauge.h +++ b/src/displayapp/screens/Gauge.h @@ -2,9 +2,7 @@ #include <cstdint> #include "Screen.h" -#include <bits/unique_ptr.h> -#include <libs/lvgl/src/lv_core/lv_style.h> -#include <libs/lvgl/src/lv_core/lv_obj.h> +#include <lvgl/lvgl.h> namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/InfiniPaint.cpp b/src/displayapp/screens/InfiniPaint.cpp index 3ea75e9..65be662 100644 --- a/src/displayapp/screens/InfiniPaint.cpp +++ b/src/displayapp/screens/InfiniPaint.cpp @@ -1,7 +1,6 @@ -#include <libs/lvgl/lvgl.h> -#include <libraries/log/nrf_log.h> #include "InfiniPaint.h" #include "../DisplayApp.h" +#include "../LittleVgl.h" using namespace Pinetime::Applications::Screens; extern lv_font_t jetbrains_mono_extrabold_compressed; diff --git a/src/displayapp/screens/InfiniPaint.h b/src/displayapp/screens/InfiniPaint.h index f29135d..9a7ac07 100644 --- a/src/displayapp/screens/InfiniPaint.h +++ b/src/displayapp/screens/InfiniPaint.h @@ -1,31 +1,30 @@ #pragma once +#include <lvgl/lvgl.h> #include <cstdint> #include "Screen.h" -#include <bits/unique_ptr.h> -#include <libs/lvgl/src/lv_core/lv_style.h> -#include <libs/lvgl/src/lv_core/lv_obj.h> -#include <drivers/St7789.h> -#include "displayapp/LittleVgl.h" namespace Pinetime { + namespace Components { + class LittleVgl; + } namespace Applications { namespace Screens { - + class InfiniPaint : public Screen { public: InfiniPaint(DisplayApp* app, Pinetime::Components::LittleVgl& lvgl); - + ~InfiniPaint() override; - + bool Refresh() override; - + bool OnButtonPushed() override; - + bool OnTouchEvent(TouchEvents event) override; - + bool OnTouchEvent(uint16_t x, uint16_t y) override; - + private: Pinetime::Components::LittleVgl& lvgl; static constexpr uint16_t width = 10; diff --git a/src/displayapp/screens/Label.cpp b/src/displayapp/screens/Label.cpp index 540776c..4be7742 100644 --- a/src/displayapp/screens/Label.cpp +++ b/src/displayapp/screens/Label.cpp @@ -1,4 +1,3 @@ -#include <libs/lvgl/lvgl.h> #include "Label.h" using namespace Pinetime::Applications::Screens; diff --git a/src/displayapp/screens/Label.h b/src/displayapp/screens/Label.h index 3e7b379..dba89bb 100644 --- a/src/displayapp/screens/Label.h +++ b/src/displayapp/screens/Label.h @@ -1,6 +1,5 @@ #pragma once -#include <vector> #include "Screen.h" #include <lvgl/lvgl.h> diff --git a/src/displayapp/screens/Meter.cpp b/src/displayapp/screens/Meter.cpp index 273e111..3c8e703 100644 --- a/src/displayapp/screens/Meter.cpp +++ b/src/displayapp/screens/Meter.cpp @@ -1,5 +1,5 @@ -#include <libs/lvgl/lvgl.h> #include "Meter.h" +#include <lvgl/lvgl.h> #include "../DisplayApp.h" using namespace Pinetime::Applications::Screens; diff --git a/src/displayapp/screens/Meter.h b/src/displayapp/screens/Meter.h index ddf8be8..86888dd 100644 --- a/src/displayapp/screens/Meter.h +++ b/src/displayapp/screens/Meter.h @@ -1,11 +1,9 @@ #pragma once #include <cstdint> -#include <chrono> #include "Screen.h" -#include <bits/unique_ptr.h> -#include <libs/lvgl/src/lv_core/lv_style.h> -#include <libs/lvgl/src/lv_core/lv_obj.h> +#include <lvgl/src/lv_core/lv_style.h> +#include <lvgl/src/lv_core/lv_obj.h> namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/Modal.cpp b/src/displayapp/screens/Modal.cpp index 29f7bfa..d1a110e 100644 --- a/src/displayapp/screens/Modal.cpp +++ b/src/displayapp/screens/Modal.cpp @@ -1,5 +1,5 @@ -#include <libs/lvgl/lvgl.h> #include "Modal.h" +#include <lvgl/lvgl.h> #include "../DisplayApp.h" using namespace Pinetime::Applications::Screens; diff --git a/src/displayapp/screens/Modal.h b/src/displayapp/screens/Modal.h index c616c29..9cc177f 100644 --- a/src/displayapp/screens/Modal.h +++ b/src/displayapp/screens/Modal.h @@ -1,11 +1,8 @@ #pragma once -#include <cstdint> -#include <chrono> #include "Screen.h" -#include <bits/unique_ptr.h> -#include <libs/lvgl/src/lv_core/lv_style.h> -#include <libs/lvgl/src/lv_core/lv_obj.h> +#include <lvgl/src/lv_core/lv_style.h> +#include <lvgl/src/lv_core/lv_obj.h> namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/Music.cpp b/src/displayapp/screens/Music.cpp index 225a15a..c4ae3ac 100644 --- a/src/displayapp/screens/Music.cpp +++ b/src/displayapp/screens/Music.cpp @@ -15,9 +15,13 @@ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ -#include <libs/lvgl/lvgl.h> - #include "Music.h" +#include <cstdint> +#include "../DisplayApp.h" +#include "components/ble/MusicService.h" +#include "displayapp/icons/music/disc.cpp" +#include "displayapp/icons/music/disc_f_1.cpp" +#include "displayapp/icons/music/disc_f_2.cpp" using namespace Pinetime::Applications::Screens; diff --git a/src/displayapp/screens/Music.h b/src/displayapp/screens/Music.h index 81ba793..66bde21 100644 --- a/src/displayapp/screens/Music.h +++ b/src/displayapp/screens/Music.h @@ -17,24 +17,16 @@ */ #pragma once -#include <cstdint> -#include <chrono> +#include <FreeRTOS.h> +#include <lvgl/src/lv_core/lv_obj.h> #include <string> - -#include "components/gfx/Gfx.h" -#include "components/battery/BatteryController.h" -#include "components/ble/BleController.h" -#include "components/ble/MusicService.h" #include "Screen.h" -#include <bits/unique_ptr.h> -#include <libs/lvgl/src/lv_core/lv_style.h> -#include <libs/lvgl/src/lv_core/lv_obj.h> -#include "../../Version.h" -#include "displayapp/icons/music/disc.cpp" -#include "displayapp/icons/music/disc_f_1.cpp" -#include "displayapp/icons/music/disc_f_2.cpp" namespace Pinetime { + namespace Controllers { + class MusicService; + } + namespace Applications { namespace Screens { class Music : public Screen { diff --git a/src/displayapp/screens/Notifications.cpp b/src/displayapp/screens/Notifications.cpp index 85848b2..51a601c 100644 --- a/src/displayapp/screens/Notifications.cpp +++ b/src/displayapp/screens/Notifications.cpp @@ -1,7 +1,5 @@ -#include <libs/lvgl/lvgl.h> -#include <displayapp/DisplayApp.h> -#include <functional> #include "Notifications.h" +#include <displayapp/DisplayApp.h> using namespace Pinetime::Applications::Screens; diff --git a/src/displayapp/screens/Notifications.h b/src/displayapp/screens/Notifications.h index fb4e1ef..f5c6a86 100644 --- a/src/displayapp/screens/Notifications.h +++ b/src/displayapp/screens/Notifications.h @@ -1,11 +1,10 @@ #pragma once -#include <functional> -#include <vector> - +#include <lvgl/lvgl.h> +#include <cstdint> +#include <memory> #include "Screen.h" -#include "ScreenList.h" - +#include "components/ble/NotificationManager.h" namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/ScreenList.h b/src/displayapp/screens/ScreenList.h index b198634..736e363 100644 --- a/src/displayapp/screens/ScreenList.h +++ b/src/displayapp/screens/ScreenList.h @@ -1,10 +1,10 @@ #pragma once -#include <vector> +#include <array> #include <functional> -#include "components/ble/NimbleController.h" +#include <memory> #include "Screen.h" -#include "Label.h" +#include "../DisplayApp.h" namespace Pinetime { namespace Applications { diff --git a/src/displayapp/screens/SystemInfo.cpp b/src/displayapp/screens/SystemInfo.cpp index 83384fb..d821ac7 100644 --- a/src/displayapp/screens/SystemInfo.cpp +++ b/src/displayapp/screens/SystemInfo.cpp @@ -1,9 +1,13 @@ -#include <libs/lvgl/lvgl.h> -#include <displayapp/DisplayApp.h> -#include <functional> #include "SystemInfo.h" -#include "../../Version.h" -#include "Tile.h" +#include <lvgl/lvgl.h> +#include "../DisplayApp.h" +#include "Label.h" +#include "Version.h" +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" +#include "components/brightness/BrightnessController.h" +#include "components/datetime/DateTimeController.h" +#include "drivers/Watchdog.h" using namespace Pinetime::Applications::Screens; diff --git a/src/displayapp/screens/SystemInfo.h b/src/displayapp/screens/SystemInfo.h index 987a584..a71bacc 100644 --- a/src/displayapp/screens/SystemInfo.h +++ b/src/displayapp/screens/SystemInfo.h @@ -1,17 +1,24 @@ #pragma once -#include <functional> -#include <vector> - -#include "components/ble/NimbleController.h" +#include <memory> #include "Screen.h" -#include "Label.h" #include "ScreenList.h" -#include "Gauge.h" -#include "Meter.h" namespace Pinetime { + namespace Controllers { + class DateTime; + class Battery; + class BrightnessController; + class Ble; + } + + namespace Drivers { + class WatchdogView; + } + namespace Applications { + class DisplayApp; + namespace Screens { class SystemInfo : public Screen { public: diff --git a/src/displayapp/screens/Tab.cpp b/src/displayapp/screens/Tab.cpp deleted file mode 100644 index 44b806c..0000000 --- a/src/displayapp/screens/Tab.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include <cstdio> -#include <libs/date/includes/date/date.h> -#include "components/datetime/DateTimeController.h" -#include <Version.h> -#include <libs/lvgl/src/lv_core/lv_obj.h> -#include <libs/lvgl/src/lv_font/lv_font.h> -#include <libs/lvgl/lvgl.h> -#include <libraries/log/nrf_log.h> -#include "Tab.h" -#include "displayapp/DisplayApp.h" - - -using namespace Pinetime::Applications::Screens; - -extern lv_font_t jetbrains_mono_bold_20; - -//static void event_handler(lv_obj_t * obj, lv_event_t event) { -// Tile* screen = static_cast<Tile *>(obj->user_data); -// screen->OnObjectEvent(obj, event); -//} - -Tab::Tab(DisplayApp* app, Pinetime::Components::Gfx &gfx) : Screen(app, gfx) { -/*Create a Tab view object*/ - lv_obj_t *tabview; - tabview = lv_tabview_create(lv_scr_act(), NULL); - - /*Add 3 tabs (the tabs are page (lv_page) and can be scrolled*/ - lv_obj_t *tab1 = lv_tabview_add_tab(tabview, "Tab 1"); - lv_obj_t *tab2 = lv_tabview_add_tab(tabview, "Tab 2"); - lv_obj_t *tab3 = lv_tabview_add_tab(tabview, "Tab 3"); - - - /*Add content to the tabs*/ - lv_obj_t * label = lv_label_create(tab1, NULL); - lv_label_set_text(label, "This the first tab\n\n" - "If the content\n" - "of a tab\n" - "become too long\n" - "the it \n" - "automatically\n" - "become\n" - "scrollable."); - - label = lv_label_create(tab2, NULL); - lv_label_set_text(label, "Second tab"); - - label = lv_label_create(tab3, NULL); - lv_label_set_text(label, "Third tab"); - -} - -Tab::~Tab() { - lv_obj_clean(lv_scr_act()); -} - -void Tab::Refresh(bool fullRefresh) { - -} - -void Tab::OnObjectEvent(lv_obj_t *obj, lv_event_t event) { - if(event == LV_EVENT_CLICKED) { - NRF_LOG_INFO("Clicked"); - } - else if(event == LV_EVENT_VALUE_CHANGED) { - NRF_LOG_INFO("Toggled"); - } -} diff --git a/src/displayapp/screens/Tab.h b/src/displayapp/screens/Tab.h deleted file mode 100644 index e16dbb9..0000000 --- a/src/displayapp/screens/Tab.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include <cstdint> -#include "Screen.h" -#include <bits/unique_ptr.h> -#include <lvgl/src/lv_core/lv_style.h> - -namespace Pinetime { - namespace Applications { - namespace Screens { - class Tab : public Screen { - public: - explicit Tab(DisplayApp* app, Components::Gfx& gfx); - ~Tab() override; - void Refresh(bool fullRefresh) override; - void OnObjectEvent(lv_obj_t* obj, lv_event_t event); - - private: - - }; - } - } -} diff --git a/src/displayapp/screens/Tile.cpp b/src/displayapp/screens/Tile.cpp index 75fa6ef..c1a5e94 100644 --- a/src/displayapp/screens/Tile.cpp +++ b/src/displayapp/screens/Tile.cpp @@ -1,11 +1,5 @@ -#include <libs/lvgl/src/lv_core/lv_obj.h> -#include <libs/lvgl/src/lv_font/lv_font.h> -#include <libs/lvgl/lvgl.h> - #include "Tile.h" -#include "displayapp/DisplayApp.h" -#include "Symbols.h" -#include "../../Version.h" +#include "../DisplayApp.h" using namespace Pinetime::Applications::Screens; diff --git a/src/displayapp/screens/Tile.h b/src/displayapp/screens/Tile.h index cf5fcf1..7edf67b 100644 --- a/src/displayapp/screens/Tile.h +++ b/src/displayapp/screens/Tile.h @@ -1,11 +1,11 @@ #pragma once +#include <lvgl/lvgl.h> #include <cstdint> -#include "Screen.h" -#include <bits/unique_ptr.h> +#include <memory> #include "Modal.h" -#include <lvgl/src/lv_core/lv_style.h> -#include <displayapp/Apps.h> +#include "Screen.h" +#include "../Apps.h" namespace Pinetime { namespace Applications { diff --git a/src/drivers/BufferProvider.h b/src/drivers/BufferProvider.h index 50fa253..1be4317 100644 --- a/src/drivers/BufferProvider.h +++ b/src/drivers/BufferProvider.h @@ -1,5 +1,6 @@ #pragma once #include <cstddef> +#include <cstdint> namespace Pinetime { namespace Drivers { diff --git a/src/drivers/Cst816s.cpp b/src/drivers/Cst816s.cpp index 94db3b3..e703b73 100644 --- a/src/drivers/Cst816s.cpp +++ b/src/drivers/Cst816s.cpp @@ -1,8 +1,9 @@ +#include "Cst816s.h" #include <FreeRTOS.h> -#include <task.h> -#include <nrfx_log.h> #include <legacy/nrf_drv_gpiote.h> -#include "Cst816s.h" +#include <nrfx_log.h> +#include <task.h> + using namespace Pinetime::Drivers; /* References : diff --git a/src/drivers/Cst816s.h b/src/drivers/Cst816s.h index 4569e82..b7876b8 100644 --- a/src/drivers/Cst816s.h +++ b/src/drivers/Cst816s.h @@ -1,6 +1,5 @@ #pragma once -#include <nrfx_twi.h> #include "TwiMaster.h" namespace Pinetime { diff --git a/src/drivers/DebugPins.cpp b/src/drivers/DebugPins.cpp index 5a12fd8..8457ba5 100644 --- a/src/drivers/DebugPins.cpp +++ b/src/drivers/DebugPins.cpp @@ -1,5 +1,5 @@ -#include <hal/nrf_gpio.h> #include "DebugPins.h" +#include <hal/nrf_gpio.h> #ifdef USE_DEBUG_PINS void debugpins_init() { diff --git a/src/drivers/InternalFlash.cpp b/src/drivers/InternalFlash.cpp index db705d7..33c1447 100644 --- a/src/drivers/InternalFlash.cpp +++ b/src/drivers/InternalFlash.cpp @@ -1,5 +1,5 @@ -#include <mdk/nrf.h> #include "InternalFlash.h" +#include <mdk/nrf.h> using namespace Pinetime::Drivers; void InternalFlash::ErasePage(uint32_t address) { diff --git a/src/drivers/Spi.cpp b/src/drivers/Spi.cpp index 2d8aa3b..0e7de4d 100644 --- a/src/drivers/Spi.cpp +++ b/src/drivers/Spi.cpp @@ -1,6 +1,6 @@ +#include "Spi.h" #include <hal/nrf_gpio.h> #include <nrfx_log.h> -#include "Spi.h" using namespace Pinetime::Drivers; diff --git a/src/drivers/Spi.h b/src/drivers/Spi.h index 82ba8a6..e3cab45 100644 --- a/src/drivers/Spi.h +++ b/src/drivers/Spi.h @@ -1,12 +1,6 @@ #pragma once -#include <FreeRTOS.h> #include <cstdint> #include <cstddef> -#include <array> -#include <atomic> -#include <task.h> - -#include "BufferProvider.h" #include "SpiMaster.h" namespace Pinetime { diff --git a/src/drivers/SpiMaster.cpp b/src/drivers/SpiMaster.cpp index 2e5852a..5f7c064 100644 --- a/src/drivers/SpiMaster.cpp +++ b/src/drivers/SpiMaster.cpp @@ -1,10 +1,8 @@ -#include <FreeRTOS.h> +#include "SpiMaster.h" #include <hal/nrf_gpio.h> #include <hal/nrf_spim.h> -#include "SpiMaster.h" -#include <algorithm> -#include <task.h> #include <nrfx_log.h> +#include <algorithm> using namespace Pinetime::Drivers; diff --git a/src/drivers/SpiMaster.h b/src/drivers/SpiMaster.h index cd3193e..cb79d90 100644 --- a/src/drivers/SpiMaster.h +++ b/src/drivers/SpiMaster.h @@ -1,14 +1,10 @@ #pragma once -#include <FreeRTOS.h> -#include <cstdint> #include <cstddef> -#include <array> -#include <atomic> -#include <task.h> -#include <semphr.h> +#include <cstdint> -#include "BufferProvider.h" +#include <FreeRTOS.h> #include <semphr.h> +#include <task.h> namespace Pinetime { namespace Drivers { diff --git a/src/drivers/SpiNorFlash.cpp b/src/drivers/SpiNorFlash.cpp index bd24834..3ea5afe 100644 --- a/src/drivers/SpiNorFlash.cpp +++ b/src/drivers/SpiNorFlash.cpp @@ -1,7 +1,7 @@ +#include "SpiNorFlash.h" #include <hal/nrf_gpio.h> #include <libraries/delay/nrf_delay.h> #include <libraries/log/nrf_log.h> -#include "SpiNorFlash.h" #include "Spi.h" using namespace Pinetime::Drivers; diff --git a/src/drivers/SpiNorFlash.h b/src/drivers/SpiNorFlash.h index 10c25a0..7702d43 100644 --- a/src/drivers/SpiNorFlash.h +++ b/src/drivers/SpiNorFlash.h @@ -1,5 +1,6 @@ #pragma once #include <cstddef> +#include <cstdint> namespace Pinetime { namespace Drivers { diff --git a/src/drivers/St7789.cpp b/src/drivers/St7789.cpp index ed28c82..2df2c53 100644 --- a/src/drivers/St7789.cpp +++ b/src/drivers/St7789.cpp @@ -1,7 +1,7 @@ +#include "St7789.h" #include <hal/nrf_gpio.h> #include <libraries/delay/nrf_delay.h> #include <nrfx_log.h> -#include "St7789.h" #include "Spi.h" using namespace Pinetime::Drivers; diff --git a/src/drivers/St7789.h b/src/drivers/St7789.h index 0b94cf2..053cacc 100644 --- a/src/drivers/St7789.h +++ b/src/drivers/St7789.h @@ -1,5 +1,6 @@ #pragma once #include <cstddef> +#include <cstdint> namespace Pinetime { namespace Drivers { diff --git a/src/drivers/TwiMaster.cpp b/src/drivers/TwiMaster.cpp index 3ff8a95..6a063ec 100644 --- a/src/drivers/TwiMaster.cpp +++ b/src/drivers/TwiMaster.cpp @@ -1,7 +1,7 @@ -#include <nrfx_log.h> -#include <hal/nrf_gpio.h> -#include <cstring> #include "TwiMaster.h" +#include <cstring> +#include <hal/nrf_gpio.h> +#include <nrfx_log.h> using namespace Pinetime::Drivers; diff --git a/src/drivers/TwiMaster.h b/src/drivers/TwiMaster.h index 52e3909..399e3d0 100644 --- a/src/drivers/TwiMaster.h +++ b/src/drivers/TwiMaster.h @@ -1,8 +1,8 @@ #pragma once #include <FreeRTOS.h> #include <semphr.h> -#include <drivers/include/nrfx_twi.h> - +#include <drivers/include/nrfx_twi.h> // NRF_TWIM_Type +#include <cstdint> namespace Pinetime { namespace Drivers { diff --git a/src/drivers/Watchdog.cpp b/src/drivers/Watchdog.cpp index 11da121..d09fbcd 100644 --- a/src/drivers/Watchdog.cpp +++ b/src/drivers/Watchdog.cpp @@ -1,7 +1,5 @@ -#include <mdk/nrf52.h> -#include <mdk/nrf52_bitfields.h> -#include <nrf_soc.h> #include "Watchdog.h" +#include <mdk/nrf.h> using namespace Pinetime::Drivers; diff --git a/src/drivers/Watchdog.h b/src/drivers/Watchdog.h index 73f99ea..0c816a4 100644 --- a/src/drivers/Watchdog.h +++ b/src/drivers/Watchdog.h @@ -1,4 +1,5 @@ #pragma once +#include <cstdint> namespace Pinetime { namespace Drivers { diff --git a/src/logging/NrfLogger.cpp b/src/logging/NrfLogger.cpp index 0d95c06..9f7624b 100644 --- a/src/logging/NrfLogger.cpp +++ b/src/logging/NrfLogger.cpp @@ -1,9 +1,8 @@ +#include "NrfLogger.h" + +#include <libraries/log/nrf_log.h> #include <libraries/log/nrf_log_ctrl.h> #include <libraries/log/nrf_log_default_backends.h> -#include <FreeRTOS.h> -#include <task.h> -#include <libraries/log/nrf_log.h> -#include "NrfLogger.h" using namespace Pinetime::Logging; diff --git a/src/logging/NrfLogger.h b/src/logging/NrfLogger.h index cb7089f..fb68b91 100644 --- a/src/logging/NrfLogger.h +++ b/src/logging/NrfLogger.h @@ -1,6 +1,9 @@ #pragma once #include "Logger.h" +#include <FreeRTOS.h> +#include <task.h> + namespace Pinetime { namespace Logging{ class NrfLogger : public Logger { diff --git a/src/main.cpp b/src/main.cpp index 45aac6d..3505704 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,32 +1,44 @@ -#include <FreeRTOS.h> -#include <task.h> -#include <timers.h> -#include <legacy/nrf_drv_clock.h> +// nrf #include <hal/nrf_rtc.h> #include <hal/nrf_wdt.h> -#include <os/os_cputime.h> -#include <libraries/timer/app_timer.h> +#include <legacy/nrf_drv_clock.h> #include <libraries/gpiote/app_gpiote.h> -#include "displayapp/DisplayApp.h" +#include <libraries/timer/app_timer.h> #include <softdevice/common/nrf_sdh.h> -#include "components/datetime/DateTimeController.h" -#include "components/battery/BatteryController.h" -#include "components/ble/BleController.h" -#include "components/ble/NotificationManager.h" -#include <drivers/St7789.h> -#include <drivers/SpiMaster.h> -#include <drivers/Spi.h> -#include "displayapp/LittleVgl.h" -#include <systemtask/SystemTask.h> -#include <nimble/nimble_port_freertos.h> -#include <nimble/npl_freertos.h> -#include <nimble/nimble_port.h> -#include <host/ble_hs.h> + +// nimble +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max #include <controller/ble_ll.h> -#include <transport/ram/ble_hci_ram.h> +#include <host/ble_hs.h> #include <host/util/util.h> +#include <nimble/nimble_port.h> +#include <nimble/nimble_port_freertos.h> +#include <nimble/npl_freertos.h> +#include <os/os_cputime.h> #include <services/gap/ble_svc_gap.h> +#include <transport/ram/ble_hci_ram.h> +#undef max +#undef min + +// FreeRTOS +#include <FreeRTOS.h> +#include <task.h> +#include <timers.h> +#include "components/battery/BatteryController.h" +#include "components/ble/BleController.h" +#include "components/ble/NotificationManager.h" +#include "components/datetime/DateTimeController.h" +#include "displayapp/DisplayApp.h" +#include "displayapp/LittleVgl.h" +#include "drivers/Spi.h" +#include "drivers/SpiMaster.h" +#include "drivers/SpiNorFlash.h" +#include "drivers/St7789.h" +#include "drivers/TwiMaster.h" +#include "drivers/Cst816s.h" +#include "systemtask/SystemTask.h" #if NRF_LOG_ENABLED #include "logging/NrfLogger.h" @@ -2,6 +2,7 @@ #include <FreeRTOS.h> #include <timers.h> +#include <nrfx_gpiote.h> void nrfx_gpiote_evt_handler(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action); void DebounceTimerCallback(TimerHandle_t xTimer);
\ No newline at end of file diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp index 3177bce..9cd2f5e 100644 --- a/src/systemtask/SystemTask.cpp +++ b/src/systemtask/SystemTask.cpp @@ -1,19 +1,27 @@ -#include <libraries/log/nrf_log.h> -#include <libraries/gpiote/app_gpiote.h> -#include <drivers/Cst816s.h> -#include "displayapp/LittleVgl.h" -#include <hal/nrf_rtc.h> -#include "components/ble/NotificationManager.h" -#include <host/ble_gatt.h> -#include <host/ble_hs_adv.h> #include "SystemTask.h" -#include <nimble/hci_common.h> +#define min // workaround: nimble's min/max macros conflict with libstdc++ +#define max #include <host/ble_gap.h> +#include <host/ble_gatt.h> +#include <host/ble_hs_adv.h> #include <host/util/util.h> -#include <drivers/InternalFlash.h> +#include <nimble/hci_common.h> +#undef max +#undef min +#include <hal/nrf_rtc.h> +#include <libraries/gpiote/app_gpiote.h> +#include <libraries/log/nrf_log.h> + +#include "BootloaderVersion.h" +#include "components/ble/BleController.h" +#include "displayapp/LittleVgl.h" +#include "drivers/Cst816s.h" +#include "drivers/St7789.h" +#include "drivers/InternalFlash.h" +#include "drivers/SpiMaster.h" +#include "drivers/SpiNorFlash.h" +#include "drivers/TwiMaster.h" #include "main.h" -#include "components/ble/NimbleController.h" -#include "../BootloaderVersion.h" using namespace Pinetime::System; diff --git a/src/systemtask/SystemTask.h b/src/systemtask/SystemTask.h index 6ef0cfb..fe6e7cb 100644 --- a/src/systemtask/SystemTask.h +++ b/src/systemtask/SystemTask.h @@ -4,17 +4,23 @@ #include <FreeRTOS.h> #include <task.h> -#include <drivers/SpiMaster.h> -#include <drivers/St7789.h> -#include "components/battery/BatteryController.h" -#include "displayapp/DisplayApp.h" -#include <drivers/Watchdog.h> -#include <drivers/SpiNorFlash.h> +#include <timers.h> + #include "SystemMonitor.h" +#include "components/battery/BatteryController.h" #include "components/ble/NimbleController.h" -#include "timers.h" +#include "components/ble/NotificationManager.h" +#include "displayapp/DisplayApp.h" +#include "drivers/Watchdog.h" namespace Pinetime { + namespace Drivers { + class Cst816S; + class SpiMaster; + class SpiNorFlash; + class St7789; + class TwiMaster; + } namespace System { class SystemTask { public: |
