Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
cp build/coverage/compile_commands.json compile_commands.json
- name: Run Analysis
# skip the analysis step for dependabot PRs since dependabot does not have access to secrets
if: ${{ github.actor != 'dependabot[bot]' }}
if: ${{ false && github.actor != 'dependabot[bot]' }}
env:
# to get access to secrets.SONAR_TOKEN, provide GITHUB_TOKEN
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (PREVIEW_STANDALONE)
FetchContent_Declare(
emil
GIT_REPOSITORY https://github.com/philips-software/amp-embedded-infra-lib
GIT_TAG 4239adfcec976c47fbdc2b8ada6c6577d7a3c2b9 # v7.1.0
GIT_TAG aa01db06f02d8e2958dfb65702d5034537508bf2 # unreleased
)

FetchContent_MakeAvailable(emil)
Expand All @@ -30,7 +30,7 @@ if (PREVIEW_STANDALONE)
FetchContent_Declare(
halst
GIT_REPOSITORY https://github.com/philips-software/amp-hal-st
GIT_TAG 1e684ac1c00b7466928b390f07d2d69c6ae4e1fc # v4.0.0
GIT_TAG d78537b56b33b7811eb54e371312d0ec32fef60b # unreleased
)

FetchContent_MakeAvailable(halst)
Expand Down
2 changes: 1 addition & 1 deletion preview/interfaces/BufferedDisplaySsd1306.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace services
hal::I2cAddress address;
bool initializing = true;

infra::Optional<infra::Bitmap> bitmap;
std::optional<infra::Bitmap> bitmap;
infra::Point position;
infra::AutoResetFunction<void()> onDone;

Expand Down
4 changes: 2 additions & 2 deletions preview/interfaces/test/TestViewPainterBufferedDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class ViewPainterBufferedDisplayTest
{
EXPECT_CALL(display, PixelFormat()).WillRepeatedly(testing::Return(infra::PixelFormat::rgb565));

viewPainter.Emplace(buffer, display, bitmapPainter);
viewPainter.emplace(buffer, display, bitmapPainter);
}

std::array<uint8_t, 8 * 16 * 2> buffer;
testing::StrictMock<hal::BufferedDisplayMock> display;
testing::StrictMock<hal::BitmapPainterMock> bitmapPainter;
testing::StrictMock<services::ViewMock> view;
infra::Optional<services::ViewPainterBufferedDisplay> viewPainter;
std::optional<services::ViewPainterBufferedDisplay> viewPainter;
};

TEST_F(ViewPainterBufferedDisplayTest, Paint)
Expand Down
6 changes: 3 additions & 3 deletions preview/touch/TouchScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace services
, touchDelta(touchDelta)
{}

void TouchScreen::Measure(const infra::Function<void(infra::Optional<infra::Point> position)>& onTouched)
void TouchScreen::Measure(const infra::Function<void(std::optional<infra::Point> position)>& onTouched)
{
assert(this->onTouched == nullptr);
this->onTouched = onTouched;
Expand Down Expand Up @@ -50,12 +50,12 @@ namespace services
{
if (xTouchResult >= yTouchResult + touchScreen.touchDelta)
{
touchScreen.onTouched(infra::none);
touchScreen.onTouched(std::nullopt);
touchScreen.state.Emplace<StateIdle>();
}
else if (finalMeasurement)
{
touchScreen.onTouched(infra::MakeOptional(infra::Point(touchScreen.xResult, touchScreen.yResult)));
touchScreen.onTouched(std::make_optional(infra::Point(touchScreen.xResult, touchScreen.yResult)));
touchScreen.state.Emplace<StateIdle>();
}
else
Expand Down
4 changes: 2 additions & 2 deletions preview/touch/TouchScreen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace services

TouchScreen(hal::GpioPin& xPlus, hal::GpioPin& xMinus, hal::GpioPin& yPlus, hal::GpioPin& yMinus, infra::CreatorBase<AnalogToDigitalPin, void()>& xPlusAnalogPin, infra::CreatorBase<AnalogToDigitalPin, void()>& yPlusAnalogPin, uint32_t touchDelta);

void Measure(const infra::Function<void(infra::Optional<infra::Point> position)>& onTouched);
void Measure(const infra::Function<void(std::optional<infra::Point> position)>& onTouched);

private:
class State
Expand Down Expand Up @@ -103,7 +103,7 @@ namespace services
infra::CreatorBase<AnalogToDigitalPin, void()>& yPlusAnalogPin;
uint32_t touchDelta;

infra::AutoResetFunction<void(infra::Optional<infra::Point> position)> onTouched;
infra::AutoResetFunction<void(std::optional<infra::Point> position)> onTouched;
infra::PolymorphicVariant<State, StateIdle, StateTouchMeasurement, StateXMeasurement, StateYMeasurement> state;

uint32_t xResult;
Expand Down
2 changes: 1 addition & 1 deletion preview/touch/TouchScreenToTouchRecipientInteractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace services
if (!measurementBusy)
{
measurementBusy = true;
touchScreen.Measure([this](infra::Optional<infra::Point> position)
touchScreen.Measure([this](std::optional<infra::Point> position)
{
if (position)
{
Expand Down
6 changes: 3 additions & 3 deletions preview/touch/TouchSpinInteger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace services
, to(to)
, circular(circular)
, distancePerIncrement(distancePerIncrement)
, width(infra::MakeOptional(width))
, width(std::make_optional(width))
{}

void TouchSpinInteger::StartTouch(infra::Point point)
Expand Down Expand Up @@ -49,7 +49,7 @@ namespace services

void TouchSpinInteger::StopTouch()
{
startTouch = infra::none;
startTouch.reset();
}

void TouchSpinInteger::Swipe(Direction direction)
Expand Down Expand Up @@ -104,7 +104,7 @@ namespace services
{
valueString.clear();
infra::StringOutputStream stream(valueString);
if (width != infra::none)
if (width != std::nullopt)
stream << infra::Width(*width, '0') << value;
else
stream << value;
Expand Down
4 changes: 2 additions & 2 deletions preview/touch/TouchSpinInteger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ namespace services
int32_t to;
bool circular;
uint16_t distancePerIncrement;
infra::Optional<uint8_t> width;
std::optional<uint8_t> width;

infra::Optional<infra::Point> startTouch;
std::optional<infra::Point> startTouch;
int32_t stepsReported = 0;

infra::BoundedString::WithStorage<12> valueString;
Expand Down
8 changes: 4 additions & 4 deletions preview/touch/test/TestTouchScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class TouchScreenTest
services::TouchScreen::PixelPosition yTouchResult{ 0 };

infra::Function<void()> onMeasurementDone;
infra::Function<void(infra::Optional<infra::Point> position)> onResult = [](infra::Optional<infra::Point> position) {};
infra::Function<void(std::optional<infra::Point> position)> onResult = [](std::optional<infra::Point> position) {};
};

TEST_F(TouchScreenTest, Measure_results_in_touch_measurement)
Expand All @@ -137,7 +137,7 @@ TEST_F(TouchScreenTest, Measure_results_in_touch_measurement)

TEST_F(TouchScreenTest, on_no_touch_none_is_reported)
{
infra::VerifyingFunction<void(infra::Optional<infra::Point>)> expectOnResult(infra::none);
infra::VerifyingFunction<void(std::optional<infra::Point>)> expectOnResult(std::nullopt);
onResult = expectOnResult;

xTouchResult = services::TouchScreen::PixelPosition{ 400 };
Expand Down Expand Up @@ -177,7 +177,7 @@ TEST_F(TouchScreenTest, after_measurement_is_done_y_measurement_starts)

TEST_F(TouchScreenTest, after_last_measurement_result_is_reported)
{
infra::VerifyingFunction<void(infra::Optional<infra::Point>)> expectOnResult(infra::MakeOptional(infra::Point()));
infra::VerifyingFunction<void(std::optional<infra::Point>)> expectOnResult(std::make_optional(infra::Point()));
onResult = expectOnResult;

DoTouchMeasurement();
Expand All @@ -190,7 +190,7 @@ TEST_F(TouchScreenTest, after_last_measurement_result_is_reported)

TEST_F(TouchScreenTest, on_touch_position_is_reported)
{
infra::VerifyingFunction<void(infra::Optional<infra::Point>)> expectOnResult(infra::MakeOptional(infra::Point(42, 134)));
infra::VerifyingFunction<void(std::optional<infra::Point>)> expectOnResult(std::make_optional(infra::Point(42, 134)));
onResult = expectOnResult;

xResult = services::TouchScreen::PixelPosition{ 42 };
Expand Down
6 changes: 3 additions & 3 deletions preview/views/HorizontalLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,20 @@ namespace services

void HorizontalLayout::Add(View& view, uint16_t proportion, VerticalAlignment alignment)
{
views.push_back(detail::LayoutViewInfo{ &view, infra::MakeOptional(alignment), proportion, static_cast<uint8_t>(views.size()) });
views.push_back(detail::LayoutViewInfo{ &view, std::make_optional(alignment), proportion, static_cast<uint8_t>(views.size()) });
view.SetParent(*this);
}

void HorizontalLayout::AddFill(View& view, uint16_t proportion)
{
views.push_back(detail::LayoutViewInfo{ &view, infra::none, proportion, static_cast<uint8_t>(views.size()) });
views.push_back(detail::LayoutViewInfo{ &view, std::nullopt, proportion, static_cast<uint8_t>(views.size()) });
view.SetParent(*this);
}

void HorizontalLayout::AddDummy(uint16_t proportion)
{
assert(proportion != 0);
views.push_back(detail::LayoutViewInfo{ nullptr, infra::none, proportion, static_cast<uint8_t>(views.size()) });
views.push_back(detail::LayoutViewInfo{ nullptr, std::nullopt, proportion, static_cast<uint8_t>(views.size()) });
}

void HorizontalLayout::BringToFront(View& view)
Expand Down
2 changes: 1 addition & 1 deletion preview/views/HorizontalLayout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace services
struct LayoutViewInfo
{
View* view;
infra::Optional<VerticalAlignment> alignment; // No alignment means fill up the available space in the vertical direction
std::optional<VerticalAlignment> alignment; // No alignment means fill up the available space in the vertical direction
uint16_t proportion;
uint8_t paintOrder;
infra::Region drawRegion;
Expand Down
6 changes: 3 additions & 3 deletions preview/views/VerticalLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,20 @@ namespace services

void VerticalLayout::Add(View& view, uint16_t proportion, HorizontalAlignment alignment)
{
views.push_back(detail::LayoutViewInfo{ &view, infra::MakeOptional(Flip(alignment)), proportion, static_cast<uint8_t>(views.size()) });
views.push_back(detail::LayoutViewInfo{ &view, std::make_optional(Flip(alignment)), proportion, static_cast<uint8_t>(views.size()) });
view.SetParent(*this);
}

void VerticalLayout::AddFill(View& view, uint16_t proportion)
{
views.push_back(detail::LayoutViewInfo{ &view, infra::none, proportion, static_cast<uint8_t>(views.size()) });
views.push_back(detail::LayoutViewInfo{ &view, std::nullopt, proportion, static_cast<uint8_t>(views.size()) });
view.SetParent(*this);
}

void VerticalLayout::AddDummy(uint16_t proportion)
{
assert(proportion != 0);
views.push_back(detail::LayoutViewInfo{ nullptr, infra::none, proportion, static_cast<uint8_t>(views.size()) });
views.push_back(detail::LayoutViewInfo{ nullptr, std::nullopt, proportion, static_cast<uint8_t>(views.size()) });
}

void VerticalLayout::BringToFront(View& view)
Expand Down
4 changes: 2 additions & 2 deletions preview/views/ViewDisableableText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ namespace services
DrawLine(TextRegion(), canvas, boundingRegion);

auto fadingRegion = FadingRegion();
if (fadingRegion != infra::none)
if (fadingRegion != std::nullopt)
DrawLine(*fadingRegion, canvas, boundingRegion);
}
}

void ViewDisableableFadingText::Enable(bool newEnabled)
{
Dirty(TextRegion() | FadingRegion().ValueOr(infra::Region()));
Dirty(TextRegion() | FadingRegion().value_or(infra::Region()));
enabled = newEnabled;
}

Expand Down
6 changes: 3 additions & 3 deletions preview/views/ViewFadingText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ namespace services
return ViewText::TextRegion();
}

infra::Optional<infra::Region> ViewFadingText::FadingRegion() const
std::optional<infra::Region> ViewFadingText::FadingRegion() const
{
if (fadeTimer.Armed())
{
Expand All @@ -107,10 +107,10 @@ namespace services
if (fadeDirection == Direction::down || fadeDirection == Direction::right)
deltaBuffer = -deltaBuffer;

return infra::MakeOptional(ViewText::TextRegion() >> deltaBuffer);
return std::make_optional(ViewText::TextRegion() >> deltaBuffer);
}
}

return infra::none;
return std::nullopt;
}
}
2 changes: 1 addition & 1 deletion preview/views/ViewFadingText.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace services
void FadeIn(infra::BoundedConstString newText, Direction from);

infra::Region TextRegion() const;
infra::Optional<infra::Region> FadingRegion() const;
std::optional<infra::Region> FadingRegion() const;

private:
infra::BoundedString& buffer1;
Expand Down
6 changes: 3 additions & 3 deletions preview/views/ViewFramedTextButtonWithPopOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace services
ViewFramedTextButton::Activate();

FramedTextButtonAttributes attributes = Attributes();
popOut.Emplace(regionOffset, FramedTextAttributes{ attributes.frameColour, attributes.activatedBackgroundColour, attributes.textColour, attributes.font }, Text());
popOut.emplace(regionOffset, FramedTextAttributes{ attributes.frameColour, attributes.activatedBackgroundColour, attributes.textColour, attributes.font }, Text());
popOut->SetParent(*this);
popOut->SetViewRegion(ViewRegion());
Dirty(popOut->ViewRegion());
Expand All @@ -21,7 +21,7 @@ namespace services
void ViewFramedTextButtonWithPopOut::Deactivate()
{
Dirty(popOut->DrawRegion());
popOut = infra::none;
popOut.reset();

ViewFramedTextButton::Deactivate();
}
Expand All @@ -46,7 +46,7 @@ namespace services
{
ViewFramedTextButton::ViewRegionChanged();

if (popOut != infra::none)
if (popOut != std::nullopt)
popOut->SetViewRegion(ViewRegion());
}
}
2 changes: 1 addition & 1 deletion preview/views/ViewFramedTextButtonWithPopOut.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace services

private:
infra::RegionOffset regionOffset;
infra::Optional<ViewOffsetRegion::WithView<ViewFramedText>> popOut;
std::optional<ViewOffsetRegion::WithView<ViewFramedText>> popOut;
};
}

Expand Down
Loading