LittleVgl: Instantiate in DisplayApp

LVGL is only a part of the main DisplayApp. Other "DisplayApps" can be
implemented without LVGL.

DummyLittleVgl isn't needed anymore and has been removed
This commit is contained in:
Riku Isokoski 2023-02-25 13:29:07 +02:00
parent ff34cf196e
commit 6f942e20ed
8 changed files with 5 additions and 64 deletions

View File

@ -60,7 +60,6 @@ namespace {
}
DisplayApp::DisplayApp(Drivers::St7789& lcd,
Components::LittleVgl& lvgl,
const Drivers::Cst816S& touchPanel,
const Controllers::Battery& batteryController,
const Controllers::Ble& bleController,
@ -77,7 +76,6 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
Pinetime::Controllers::TouchHandler& touchHandler,
Pinetime::Controllers::FS& filesystem)
: lcd {lcd},
lvgl {lvgl},
touchPanel {touchPanel},
batteryController {batteryController},
bleController {bleController},
@ -92,7 +90,8 @@ DisplayApp::DisplayApp(Drivers::St7789& lcd,
alarmController {alarmController},
brightnessController {brightnessController},
touchHandler {touchHandler},
filesystem {filesystem} {
filesystem {filesystem},
lvgl {lcd} {
}
void DisplayApp::Start(System::BootErrors error) {
@ -100,6 +99,8 @@ void DisplayApp::Start(System::BootErrors error) {
bootError = error;
lvgl.Init();
if (error == System::BootErrors::TouchController) {
LoadNewScreen(Apps::Error, DisplayApp::FullRefreshDirections::None);
} else {

View File

@ -52,7 +52,6 @@ namespace Pinetime {
enum class FullRefreshDirections { None, Up, Down, Left, Right, LeftAnim, RightAnim };
DisplayApp(Drivers::St7789& lcd,
Components::LittleVgl& lvgl,
const Drivers::Cst816S&,
const Controllers::Battery& batteryController,
const Controllers::Ble& bleController,
@ -79,7 +78,6 @@ namespace Pinetime {
private:
Pinetime::Drivers::St7789& lcd;
Pinetime::Components::LittleVgl& lvgl;
const Pinetime::Drivers::Cst816S& touchPanel;
const Pinetime::Controllers::Battery& batteryController;
const Pinetime::Controllers::Ble& bleController;
@ -98,6 +96,7 @@ namespace Pinetime {
Pinetime::Controllers::FS& filesystem;
Pinetime::Controllers::FirmwareValidator validator;
Pinetime::Components::LittleVgl lvgl;
TaskHandle_t taskHandle;

View File

@ -11,7 +11,6 @@
using namespace Pinetime::Applications;
DisplayApp::DisplayApp(Drivers::St7789& lcd,
Components::LittleVgl& /*lvgl*/,
const Drivers::Cst816S& /*touchPanel*/,
const Controllers::Battery& /*batteryController*/,
const Controllers::Ble& bleController,

View File

@ -14,7 +14,6 @@
#include "displayapp/TouchEvents.h"
#include "displayapp/Apps.h"
#include "displayapp/Messages.h"
#include "displayapp/DummyLittleVgl.h"
namespace Pinetime {
namespace Drivers {
@ -47,7 +46,6 @@ namespace Pinetime {
class DisplayApp {
public:
DisplayApp(Drivers::St7789& lcd,
Components::LittleVgl& lvgl,
const Drivers::Cst816S&,
const Controllers::Battery& batteryController,
const Controllers::Ble& bleController,

View File

@ -1,42 +0,0 @@
#pragma once
#include <lvgl/src/lv_core/lv_style.h>
#include <lvgl/src/lv_themes/lv_theme.h>
#include <lvgl/src/lv_hal/lv_hal.h>
#include <drivers/St7789.h>
namespace Pinetime {
namespace Components {
class LittleVgl {
public:
enum class FullRefreshDirections { None, Up, Down };
LittleVgl(Pinetime::Drivers::St7789& lcd) {
}
LittleVgl(const LittleVgl&) = delete;
LittleVgl& operator=(const LittleVgl&) = delete;
LittleVgl(LittleVgl&&) = delete;
LittleVgl& operator=(LittleVgl&&) = delete;
void Init() {
}
void FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
}
bool GetTouchPadInfo(lv_indev_data_t* ptr) {
return false;
}
void SetFullRefresh(FullRefreshDirections direction) {
}
void SetNewTapEvent(uint16_t x, uint16_t y) {
}
void SetNewTouchPoint(uint16_t x, uint16_t y, bool contact) {
}
};
}
}

View File

@ -81,14 +81,10 @@ static constexpr uint32_t MaxTwiFrequencyWithoutHardwareBug {0x06200000};
Pinetime::Drivers::TwiMaster twiMaster {NRF_TWIM1, MaxTwiFrequencyWithoutHardwareBug, Pinetime::PinMap::TwiSda, Pinetime::PinMap::TwiScl};
Pinetime::Drivers::Cst816S touchPanel {twiMaster, touchPanelTwiAddress};
#ifdef PINETIME_IS_RECOVERY
#include "displayapp/DummyLittleVgl.h"
#include "displayapp/DisplayAppRecovery.h"
#else
#include "displayapp/LittleVgl.h"
#include "displayapp/DisplayApp.h"
#endif
Pinetime::Components::LittleVgl lvgl {lcd};
Pinetime::Drivers::Bma421 motionSensor {twiMaster, motionSensorTwiAddress};
Pinetime::Drivers::Hrs3300 heartRateSensor {twiMaster, heartRateSensorTwiAddress};
@ -115,7 +111,6 @@ Pinetime::Controllers::ButtonHandler buttonHandler;
Pinetime::Controllers::BrightnessController brightnessController {};
Pinetime::Applications::DisplayApp displayApp(lcd,
lvgl,
touchPanel,
batteryController,
bleController,
@ -137,7 +132,6 @@ Pinetime::System::SystemTask systemTask(spi,
spiNorFlash,
twiMaster,
touchPanel,
lvgl,
batteryController,
bleController,
dateTimeController,
@ -350,8 +344,6 @@ int main() {
NoInit_MagicWord = NoInit_MagicValue;
}
lvgl.Init();
systemTask.Start();
nimble_port_init();

View File

@ -53,7 +53,6 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
Pinetime::Drivers::SpiNorFlash& spiNorFlash,
Drivers::TwiMaster& twiMaster,
Drivers::Cst816S& touchPanel,
Components::LittleVgl& lvgl,
Controllers::Battery& batteryController,
Controllers::Ble& bleController,
Controllers::DateTime& dateTimeController,
@ -76,7 +75,6 @@ SystemTask::SystemTask(Drivers::SpiMaster& spi,
spiNorFlash {spiNorFlash},
twiMaster {twiMaster},
touchPanel {touchPanel},
lvgl {lvgl},
batteryController {batteryController},
bleController {bleController},
dateTimeController {dateTimeController},

View File

@ -24,11 +24,9 @@
#ifdef PINETIME_IS_RECOVERY
#include "displayapp/DisplayAppRecovery.h"
#include "displayapp/DummyLittleVgl.h"
#else
#include "components/settings/Settings.h"
#include "displayapp/DisplayApp.h"
#include "displayapp/LittleVgl.h"
#endif
#include "drivers/Watchdog.h"
@ -61,7 +59,6 @@ namespace Pinetime {
Pinetime::Drivers::SpiNorFlash& spiNorFlash,
Drivers::TwiMaster& twiMaster,
Drivers::Cst816S& touchPanel,
Components::LittleVgl& lvgl,
Controllers::Battery& batteryController,
Controllers::Ble& bleController,
Controllers::DateTime& dateTimeController,
@ -104,7 +101,6 @@ namespace Pinetime {
Pinetime::Drivers::SpiNorFlash& spiNorFlash;
Pinetime::Drivers::TwiMaster& twiMaster;
Pinetime::Drivers::Cst816S& touchPanel;
Pinetime::Components::LittleVgl& lvgl;
Pinetime::Controllers::Battery& batteryController;
Pinetime::Controllers::Ble& bleController;