Merge pull request #238 from nscooling/make_unique
Resolved C++14 Cmake build issues so correctly building to C99/C++14
This commit is contained in:
commit
58a2d000c4
|
@ -1,6 +1,16 @@
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
project(pinetime VERSION 0.15.0 LANGUAGES C CXX ASM)
|
project(pinetime VERSION 0.15.0 LANGUAGES C CXX ASM)
|
||||||
|
|
||||||
|
set(CMAKE_C_STANDARD 99)
|
||||||
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
|
||||||
|
# set(CMAKE_GENERATOR "Unix Makefiles")
|
||||||
|
set(CMAKE_C_EXTENSIONS OFF)
|
||||||
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
set(NRF_TARGET "nrf52")
|
set(NRF_TARGET "nrf52")
|
||||||
|
|
||||||
if (NOT ARM_NONE_EABI_TOOLCHAIN_PATH)
|
if (NOT ARM_NONE_EABI_TOOLCHAIN_PATH)
|
||||||
|
|
|
@ -36,9 +36,6 @@ macro(nRF5x_setup)
|
||||||
set(CMAKE_OSX_SYSROOT "/")
|
set(CMAKE_OSX_SYSROOT "/")
|
||||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
|
||||||
|
|
||||||
# language standard/version settings
|
|
||||||
set(CMAKE_C_STANDARD 99)
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
|
||||||
|
|
||||||
# CPU specyfic settings
|
# CPU specyfic settings
|
||||||
if (NRF_TARGET MATCHES "nrf51")
|
if (NRF_TARGET MATCHES "nrf51")
|
||||||
|
@ -86,8 +83,8 @@ macro(nRF5x_setup)
|
||||||
set(CMAKE_CXX_FLAGS "${COMMON_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${COMMON_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
|
||||||
set(CMAKE_ASM_FLAGS "-MP -MD -std=c99 -x assembler-with-cpp")
|
set(CMAKE_ASM_FLAGS "-MP -MD -x assembler-with-cpp")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "-mthumb -mabi=aapcs -std=gnu++98 -std=c99 -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} ${CPU_FLAGS} -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm")
|
set(CMAKE_EXE_LINKER_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} ${CPU_FLAGS} -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm")
|
||||||
# note: we must override the default cmake linker flags so that CMAKE_C_FLAGS are not added implicitly
|
# note: we must override the default cmake linker flags so that CMAKE_C_FLAGS are not added implicitly
|
||||||
set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_COMPILER} <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_COMPILER} <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||||
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_C_COMPILER} <LINK_FLAGS> <OBJECTS> -lstdc++ -o <TARGET> <LINK_LIBRARIES>")
|
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_C_COMPILER} <LINK_FLAGS> <OBJECTS> -lstdc++ -o <TARGET> <LINK_LIBRARIES>")
|
||||||
|
|
|
@ -3,16 +3,6 @@ cmake_minimum_required(VERSION 3.10)
|
||||||
project(pinetime-app C CXX ASM)
|
project(pinetime-app C CXX ASM)
|
||||||
|
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 99)
|
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
|
||||||
|
|
||||||
# set(CMAKE_GENERATOR "Unix Makefiles")
|
|
||||||
set(CMAKE_C_EXTENSIONS OFF)
|
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
||||||
|
|
||||||
# define some variables just for this example to determine file locations
|
# define some variables just for this example to determine file locations
|
||||||
set(NRF_PROJECT_NAME pinetime-app)
|
set(NRF_PROJECT_NAME pinetime-app)
|
||||||
set(NRF_BOARD pca10040)
|
set(NRF_BOARD pca10040)
|
||||||
|
@ -875,8 +865,6 @@ target_compile_options(${EXECUTABLE_NAME} PUBLIC
|
||||||
set_target_properties(${EXECUTABLE_NAME} PROPERTIES
|
set_target_properties(${EXECUTABLE_NAME} PROPERTIES
|
||||||
SUFFIX ".out"
|
SUFFIX ".out"
|
||||||
LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_FILE_NAME}.map"
|
LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_FILE_NAME}.map"
|
||||||
CXX_STANDARD 11
|
|
||||||
C_STANDARD 99
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(TARGET ${EXECUTABLE_NAME}
|
add_custom_command(TARGET ${EXECUTABLE_NAME}
|
||||||
|
@ -907,8 +895,6 @@ target_compile_options(${EXECUTABLE_MCUBOOT_NAME} PUBLIC
|
||||||
set_target_properties(${EXECUTABLE_MCUBOOT_NAME} PROPERTIES
|
set_target_properties(${EXECUTABLE_MCUBOOT_NAME} PROPERTIES
|
||||||
SUFFIX ".out"
|
SUFFIX ".out"
|
||||||
LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT_MCUBOOT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_MCUBOOT_FILE_NAME}.map"
|
LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT_MCUBOOT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_MCUBOOT_FILE_NAME}.map"
|
||||||
CXX_STANDARD 11
|
|
||||||
C_STANDARD 99
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_NAME}
|
add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_NAME}
|
||||||
|
@ -946,8 +932,6 @@ target_compile_options(${EXECUTABLE_RECOVERY_NAME} PUBLIC
|
||||||
set_target_properties(${EXECUTABLE_RECOVERY_NAME} PROPERTIES
|
set_target_properties(${EXECUTABLE_RECOVERY_NAME} PROPERTIES
|
||||||
SUFFIX ".out"
|
SUFFIX ".out"
|
||||||
LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_RECOVERY_FILE_NAME}.map"
|
LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_RECOVERY_FILE_NAME}.map"
|
||||||
CXX_STANDARD 11
|
|
||||||
C_STANDARD 99
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(TARGET ${EXECUTABLE_RECOVERY_NAME}
|
add_custom_command(TARGET ${EXECUTABLE_RECOVERY_NAME}
|
||||||
|
@ -977,9 +961,7 @@ target_compile_options(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PUBLIC
|
||||||
|
|
||||||
set_target_properties(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PROPERTIES
|
set_target_properties(${EXECUTABLE_RECOVERY_MCUBOOT_NAME} PROPERTIES
|
||||||
SUFFIX ".out"
|
SUFFIX ".out"
|
||||||
LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT_MCUBOOT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_RECOVERY_MCUBOOT_FILE_NAME}.map"
|
LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_GRAPHICS_FILE_NAME}.map"
|
||||||
CXX_STANDARD 11
|
|
||||||
C_STANDARD 99
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(TARGET ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}
|
add_custom_command(TARGET ${EXECUTABLE_RECOVERY_MCUBOOT_NAME}
|
||||||
|
@ -1021,8 +1003,6 @@ add_dependencies(${EXECUTABLE_RECOVERYLOADER_NAME} ${EXECUTABLE_RECOVERY_MCUBOOT
|
||||||
set_target_properties(${EXECUTABLE_RECOVERYLOADER_NAME} PROPERTIES
|
set_target_properties(${EXECUTABLE_RECOVERYLOADER_NAME} PROPERTIES
|
||||||
SUFFIX ".out"
|
SUFFIX ".out"
|
||||||
LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_RECOVERYLOADER_FILE_NAME}.map"
|
LINK_FLAGS "-mthumb -mabi=aapcs -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_RECOVERYLOADER_FILE_NAME}.map"
|
||||||
CXX_STANDARD 11
|
|
||||||
C_STANDARD 99
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(TARGET ${EXECUTABLE_RECOVERYLOADER_NAME}
|
add_custom_command(TARGET ${EXECUTABLE_RECOVERYLOADER_NAME}
|
||||||
|
@ -1056,8 +1036,6 @@ add_dependencies(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} ${EXECUTABLE_RECOVERY
|
||||||
set_target_properties(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PROPERTIES
|
set_target_properties(${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME} PROPERTIES
|
||||||
SUFFIX ".out"
|
SUFFIX ".out"
|
||||||
LINK_FLAGS "-mthumb -mabi=aapcs -std=gnu++98 -std=c99 -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT_MCUBOOT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.map"
|
LINK_FLAGS "-mthumb -mabi=aapcs -std=gnu++98 -std=c99 -L ${NRF5_SDK_PATH}/modules/nrfx/mdk -T${NRF5_LINKER_SCRIPT_MCUBOOT} -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Wl,--gc-sections --specs=nano.specs -lc -lnosys -lm -Wl,-Map=${EXECUTABLE_MCUBOOT_RECOVERYLOADER_FILE_NAME}.map"
|
||||||
CXX_STANDARD 11
|
|
||||||
C_STANDARD 99
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}
|
add_custom_command(TARGET ${EXECUTABLE_MCUBOOT_RECOVERYLOADER_NAME}
|
||||||
|
|
|
@ -123,7 +123,7 @@ void DisplayApp::Refresh() {
|
||||||
currentScreen.reset(nullptr);
|
currentScreen.reset(nullptr);
|
||||||
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up);
|
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Up);
|
||||||
onClockApp = false;
|
onClockApp = false;
|
||||||
currentScreen.reset(new Screens::Notifications(this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview));
|
currentScreen = std::make_unique<Screens::Notifications>(this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Preview);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -161,10 +161,10 @@ void DisplayApp::Refresh() {
|
||||||
// lvgl.SetFullRefresh(components::LittleVgl::FullRefreshDirections::Down);
|
// lvgl.SetFullRefresh(components::LittleVgl::FullRefreshDirections::Down);
|
||||||
// currentScreen.reset(nullptr);
|
// currentScreen.reset(nullptr);
|
||||||
// if(toggle) {
|
// if(toggle) {
|
||||||
// currentScreen.reset(new Screens::Tile(this));
|
// currentScreen = std::make_unique<Screens::Tile>(this);
|
||||||
// toggle = false;
|
// toggle = false;
|
||||||
// } else {
|
// } else {
|
||||||
// currentScreen.reset(new Screens::Clock(this, dateTimeController, batteryController, bleController));
|
// currentScreen = std::make_unique<Screens::Clock>(this, dateTimeController, batteryController, bleController);
|
||||||
// toggle = true;
|
// toggle = true;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@ -172,9 +172,13 @@ void DisplayApp::Refresh() {
|
||||||
case Messages::BleFirmwareUpdateStarted:
|
case Messages::BleFirmwareUpdateStarted:
|
||||||
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down);
|
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::Down);
|
||||||
currentScreen.reset(nullptr);
|
currentScreen.reset(nullptr);
|
||||||
currentScreen.reset(new Screens::FirmwareUpdate(this, bleController));
|
currentScreen = std::make_unique<Screens::FirmwareUpdate>(this, bleController);
|
||||||
onClockApp = false;
|
onClockApp = false;
|
||||||
|
|
||||||
|
break;
|
||||||
|
case Messages::UpdateDateTime:
|
||||||
|
// Added to remove warning
|
||||||
|
// What should happen here?
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,23 +202,23 @@ void DisplayApp::RunningState() {
|
||||||
onClockApp = false;
|
onClockApp = false;
|
||||||
switch(nextApp) {
|
switch(nextApp) {
|
||||||
case Apps::None:
|
case Apps::None:
|
||||||
case Apps::Launcher: currentScreen.reset(new Screens::ApplicationList(this, settingsController)); break;
|
case Apps::Launcher: currentScreen = std::make_unique<Screens::ApplicationList>(this, settingsController); break;
|
||||||
case Apps::Clock:
|
case Apps::Clock:
|
||||||
currentScreen.reset(new Screens::Clock(this, dateTimeController, batteryController, bleController, notificationManager, settingsController, heartRateController));
|
currentScreen = std::make_unique<Screens::Clock>(this, dateTimeController, batteryController, bleController, notificationManager, settingsController, heartRateController);
|
||||||
onClockApp = true;
|
onClockApp = true;
|
||||||
break;
|
break;
|
||||||
case Apps::SysInfo: currentScreen.reset(new Screens::SystemInfo(this, dateTimeController, batteryController, brightnessController, bleController, watchdog)); break;
|
case Apps::SysInfo: currentScreen = std::make_unique<Screens::SystemInfo>(this, dateTimeController, batteryController, brightnessController, bleController, watchdog); break;
|
||||||
case Apps::Meter: currentScreen.reset(new Screens::Meter(this)); break;
|
case Apps::Meter: currentScreen = std::make_unique<Screens::Meter>(this);break;
|
||||||
case Apps::StopWatch: currentScreen.reset(new Screens::StopWatch(this)); break;
|
case Apps::StopWatch: currentScreen = std::make_unique<Screens::StopWatch>(this); break;
|
||||||
case Apps::Twos: currentScreen.reset(new Screens::Twos(this)); break;
|
case Apps::Twos: currentScreen = std::make_unique<Screens::Twos>(this); break;
|
||||||
case Apps::Paint: currentScreen.reset(new Screens::InfiniPaint(this, lvgl)); break;
|
case Apps::Paint: currentScreen = std::make_unique<Screens::InfiniPaint>(this, lvgl); break;
|
||||||
case Apps::Paddle: currentScreen.reset(new Screens::Paddle(this, lvgl)); break;
|
case Apps::Paddle: currentScreen = std::make_unique<Screens::Paddle>(this, lvgl); break;
|
||||||
case Apps::Brightness : currentScreen.reset(new Screens::Brightness(this, brightnessController)); break;
|
case Apps::Brightness : currentScreen = std::make_unique<Screens::Brightness>(this, brightnessController); break;
|
||||||
case Apps::Music : currentScreen.reset(new Screens::Music(this, systemTask.nimble().music())); break;
|
case Apps::Music : currentScreen = std::make_unique<Screens::Music>(this, systemTask.nimble().music()); break;
|
||||||
case Apps::Navigation : currentScreen.reset(new Screens::Navigation(this, systemTask.nimble().navigation())); break;
|
case Apps::Navigation : currentScreen = std::make_unique<Screens::Navigation>(this, systemTask.nimble().navigation()); break;
|
||||||
case Apps::FirmwareValidation: currentScreen.reset(new Screens::FirmwareValidation(this, validator)); break;
|
case Apps::FirmwareValidation: currentScreen = std::make_unique<Screens::FirmwareValidation>(this, validator); break;
|
||||||
case Apps::Notifications: currentScreen.reset(new Screens::Notifications(this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal)); break;
|
case Apps::Notifications: currentScreen = std::make_unique<Screens::Notifications>(this, notificationManager, systemTask.nimble().alertService(), Screens::Notifications::Modes::Normal); break;
|
||||||
case Apps::HeartRate: currentScreen.reset(new Screens::HeartRate(this, heartRateController)); break;
|
case Apps::HeartRate: currentScreen = std::make_unique<Screens::HeartRate>(this, heartRateController); break;
|
||||||
}
|
}
|
||||||
nextApp = Apps::None;
|
nextApp = Apps::None;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen1() {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return std::unique_ptr<Screen>(new Screens::Tile(0, app, settingsController, applications));
|
return std::make_unique<Screens::Tile>(0, app, settingsController, applications);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
|
std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
|
||||||
|
@ -70,7 +70,7 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen2() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return std::unique_ptr<Screen>(new Screens::Tile(1, app, settingsController, applications));
|
return std::make_unique<Screens::Tile>(1, app, settingsController, applications);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Screen> ApplicationList::CreateScreen3() {
|
std::unique_ptr<Screen> ApplicationList::CreateScreen3() {
|
||||||
|
@ -84,6 +84,6 @@ std::unique_ptr<Screen> ApplicationList::CreateScreen3() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return std::unique_ptr<Screen>(new Screens::Tile(2, app, settingsController, applications));
|
return std::make_unique<Screens::Tile>(2, app, settingsController, applications);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,20 +64,20 @@ bool Clock::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() {
|
std::unique_ptr<Screen> Clock::WatchFaceDigitalScreen() {
|
||||||
return std::unique_ptr<Screen>(new Screens::WatchFaceDigital(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, heartRateController));
|
return std::make_unique<Screens::WatchFaceDigital>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController, heartRateController);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
|
std::unique_ptr<Screen> Clock::WatchFaceAnalogScreen() {
|
||||||
return std::unique_ptr<Screen>(new Screens::WatchFaceAnalog(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController));
|
return std::make_unique<Screens::WatchFaceAnalog>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// Examples for more watch faces
|
// Examples for more watch faces
|
||||||
std::unique_ptr<Screen> Clock::WatchFaceMinimalScreen() {
|
std::unique_ptr<Screen> Clock::WatchFaceMinimalScreen() {
|
||||||
return std::unique_ptr<Screen>(new Screens::WatchFaceMinimal(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController));
|
return std::make_unique<Screens::WatchFaceMinimal>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Screen> Clock::WatchFaceCustomScreen() {
|
std::unique_ptr<Screen> Clock::WatchFaceCustomScreen() {
|
||||||
return std::unique_ptr<Screen>(new Screens::WatchFaceCustom(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController));
|
return std::make_unique<Screens::WatchFaceCustom>(app, dateTimeController, batteryController, bleController, notificatioManager, settingsController);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
|
@ -17,22 +17,22 @@ Notifications::Notifications(DisplayApp *app,
|
||||||
auto notification = notificationManager.GetLastNotification();
|
auto notification = notificationManager.GetLastNotification();
|
||||||
if(notification.valid) {
|
if(notification.valid) {
|
||||||
currentId = notification.id;
|
currentId = notification.id;
|
||||||
currentItem.reset(new NotificationItem("\nNotification",
|
currentItem = std::make_unique<NotificationItem>("\nNotification",
|
||||||
notification.message.data(),
|
notification.message.data(),
|
||||||
notification.index,
|
notification.index,
|
||||||
notification.category,
|
notification.category,
|
||||||
notificationManager.NbNotifications(),
|
notificationManager.NbNotifications(),
|
||||||
mode,
|
mode,
|
||||||
alertNotificationService));
|
alertNotificationService);
|
||||||
validDisplay = true;
|
validDisplay = true;
|
||||||
} else {
|
} else {
|
||||||
currentItem.reset(new NotificationItem("\nNotification",
|
currentItem = std::make_unique<NotificationItem>("\nNotification",
|
||||||
"No notification to display",
|
"No notification to display",
|
||||||
0,
|
0,
|
||||||
notification.category,
|
notification.category,
|
||||||
notificationManager.NbNotifications(),
|
notificationManager.NbNotifications(),
|
||||||
Modes::Preview,
|
Modes::Preview,
|
||||||
alertNotificationService));
|
alertNotificationService);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mode == Modes::Preview) {
|
if(mode == Modes::Preview) {
|
||||||
|
@ -87,13 +87,13 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
currentId = previousNotification.id;
|
currentId = previousNotification.id;
|
||||||
currentItem.reset(nullptr);
|
currentItem.reset(nullptr);
|
||||||
app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up);
|
app->SetFullRefresh(DisplayApp::FullRefreshDirections::Up);
|
||||||
currentItem.reset(new NotificationItem("\nNotification",
|
currentItem = std::make_unique<NotificationItem>("\nNotification",
|
||||||
previousNotification.message.data(),
|
previousNotification.message.data(),
|
||||||
previousNotification.index,
|
previousNotification.index,
|
||||||
previousNotification.category,
|
previousNotification.category,
|
||||||
notificationManager.NbNotifications(),
|
notificationManager.NbNotifications(),
|
||||||
mode,
|
mode,
|
||||||
alertNotificationService));
|
alertNotificationService);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case Pinetime::Applications::TouchEvents::SwipeDown: {
|
case Pinetime::Applications::TouchEvents::SwipeDown: {
|
||||||
|
@ -109,13 +109,13 @@ bool Notifications::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
|
||||||
currentId = nextNotification.id;
|
currentId = nextNotification.id;
|
||||||
currentItem.reset(nullptr);
|
currentItem.reset(nullptr);
|
||||||
app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down);
|
app->SetFullRefresh(DisplayApp::FullRefreshDirections::Down);
|
||||||
currentItem.reset(new NotificationItem("\nNotification",
|
currentItem = std::make_unique<NotificationItem>("\nNotification",
|
||||||
nextNotification.message.data(),
|
nextNotification.message.data(),
|
||||||
nextNotification.index,
|
nextNotification.index,
|
||||||
nextNotification.category,
|
nextNotification.category,
|
||||||
notificationManager.NbNotifications(),
|
notificationManager.NbNotifications(),
|
||||||
mode,
|
mode,
|
||||||
alertNotificationService));
|
alertNotificationService);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
case Pinetime::Applications::TouchEvents::LongTap: {
|
case Pinetime::Applications::TouchEvents::LongTap: {
|
||||||
|
|
|
@ -104,14 +104,14 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen1() {
|
||||||
uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds,
|
uptimeDays, uptimeHours, uptimeMinutes, uptimeSeconds,
|
||||||
batteryPercent, brightness, resetReason);
|
batteryPercent, brightness, resetReason);
|
||||||
|
|
||||||
return std::unique_ptr<Screen>(new Screens::Label(app, t1));
|
return std::make_unique<Screens::Label>(app, t1);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
|
std::unique_ptr<Screen> SystemInfo::CreateScreen2() {
|
||||||
auto& bleAddr = bleController.Address();
|
auto& bleAddr = bleController.Address();
|
||||||
sprintf(t2, "BLE MAC: \n %02x:%02x:%02x:%02x:%02x:%02x",
|
sprintf(t2, "BLE MAC: \n %02x:%02x:%02x:%02x:%02x:%02x",
|
||||||
bleAddr[5], bleAddr[4], bleAddr[3], bleAddr[2], bleAddr[1], bleAddr[0]);
|
bleAddr[5], bleAddr[4], bleAddr[3], bleAddr[2], bleAddr[1], bleAddr[0]);
|
||||||
return std::unique_ptr<Screen>(new Screens::Label(app, t2));
|
return std::make_unique<Screens::Label>(app, t2);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
|
std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
|
||||||
|
@ -123,5 +123,5 @@ std::unique_ptr<Screen> SystemInfo::CreateScreen3() {
|
||||||
"Source code:\n"
|
"Source code:\n"
|
||||||
"https://github.com/\n"
|
"https://github.com/\n"
|
||||||
" JF002/InfiniTime");
|
" JF002/InfiniTime");
|
||||||
return std::unique_ptr<Screen>(new Screens::Label(app, t3));
|
return std::make_unique<Screens::Label>(app, t3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#include "Symbols.h"
|
#include "Symbols.h"
|
||||||
#include "NotificationIcon.h"
|
#include "NotificationIcon.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
LV_IMG_DECLARE(bg_clock);
|
LV_IMG_DECLARE(bg_clock);
|
||||||
|
|
||||||
using namespace Pinetime::Applications::Screens;
|
using namespace Pinetime::Applications::Screens;
|
||||||
|
|
|
@ -49,6 +49,8 @@ Pinetime::Logging::NrfLogger logger;
|
||||||
Pinetime::Logging::DummyLogger logger;
|
Pinetime::Logging::DummyLogger logger;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
static constexpr uint8_t pinSpiSck = 2;
|
static constexpr uint8_t pinSpiSck = 2;
|
||||||
static constexpr uint8_t pinSpiMosi = 3;
|
static constexpr uint8_t pinSpiMosi = 3;
|
||||||
static constexpr uint8_t pinSpiMiso = 4;
|
static constexpr uint8_t pinSpiMiso = 4;
|
||||||
|
@ -254,8 +256,8 @@ int main(void) {
|
||||||
|
|
||||||
debounceTimer = xTimerCreate ("debounceTimer", 200, pdFALSE, (void *) 0, DebounceTimerCallback);
|
debounceTimer = xTimerCreate ("debounceTimer", 200, pdFALSE, (void *) 0, DebounceTimerCallback);
|
||||||
|
|
||||||
systemTask.reset(new Pinetime::System::SystemTask(spi, lcd, spiNorFlash, twiMaster, touchPanel, lvgl, batteryController, bleController,
|
systemTask = std::make_unique<Pinetime::System::SystemTask>(spi, lcd, spiNorFlash, twiMaster, touchPanel, lvgl, batteryController, bleController,
|
||||||
dateTimeController, motorController, heartRateSensor, settingsController));
|
dateTimeController, motorController, heartRateSensor, settingsController);
|
||||||
systemTask->Start();
|
systemTask->Start();
|
||||||
nimble_port_init();
|
nimble_port_init();
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
#include "drivers/Hrs3300.h"
|
#include "drivers/Hrs3300.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
using namespace Pinetime::System;
|
using namespace Pinetime::System;
|
||||||
|
|
||||||
void IdleTimerCallback(TimerHandle_t xTimer) {
|
void IdleTimerCallback(TimerHandle_t xTimer) {
|
||||||
|
@ -86,9 +88,9 @@ void SystemTask::Work() {
|
||||||
settingsController.Init();
|
settingsController.Init();
|
||||||
|
|
||||||
|
|
||||||
displayApp.reset(new Pinetime::Applications::DisplayApp(lcd, lvgl, touchPanel, batteryController, bleController,
|
displayApp = std::make_unique<Pinetime::Applications::DisplayApp>(lcd, lvgl, touchPanel, batteryController, bleController,
|
||||||
dateTimeController, watchdogView, *this, notificationManager,
|
dateTimeController, watchdogView, *this, notificationManager,
|
||||||
heartRateController, settingsController));
|
heartRateController, settingsController);
|
||||||
displayApp->Start();
|
displayApp->Start();
|
||||||
|
|
||||||
batteryController.Update();
|
batteryController.Update();
|
||||||
|
@ -96,7 +98,7 @@ void SystemTask::Work() {
|
||||||
|
|
||||||
heartRateSensor.Init();
|
heartRateSensor.Init();
|
||||||
heartRateSensor.Disable();
|
heartRateSensor.Disable();
|
||||||
heartRateApp.reset(new Pinetime::Applications::HeartRateTask(heartRateSensor, heartRateController));
|
heartRateApp = std::make_unique<Pinetime::Applications::HeartRateTask>(heartRateSensor, heartRateController);
|
||||||
heartRateApp->Start();
|
heartRateApp->Start();
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user