From b07dabd489ea4cb2ecd1bb37158da89d256b30db Mon Sep 17 00:00:00 2001 From: Yann Locatelli Date: Mon, 14 Mar 2022 16:00:08 +0100 Subject: [PATCH] :children_crossing: (video): Set screen in correct orientation --- drivers/CoreVideo/source/CoreLCDDriverOTM8009A.cpp | 6 +++--- drivers/CoreVideo/tests/CoreLCDDriverOTM8009A_test.cpp | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/CoreVideo/source/CoreLCDDriverOTM8009A.cpp b/drivers/CoreVideo/source/CoreLCDDriverOTM8009A.cpp index 34763e1708..7b0f510e5a 100644 --- a/drivers/CoreVideo/source/CoreLCDDriverOTM8009A.cpp +++ b/drivers/CoreVideo/source/CoreLCDDriverOTM8009A.cpp @@ -273,11 +273,11 @@ void CoreLCDDriverOTM8009A::setLandscapeOrientation() std::byte _settings {0x00}; - auto set_vertical_symmetry = [&]() constexpr { _settings |= std::byte {1 << 7}; }; - auto set_landscape_mode = [&]() constexpr { _settings |= std::byte {1 << 5}; }; + auto set_landscape_mode = [&]() constexpr { _settings |= std::byte {1 << 5}; }; + auto set_horizontal_symmetry = [&]() constexpr { _settings |= std::byte {1 << 6}; }; - set_vertical_symmetry(); set_landscape_mode(); + set_horizontal_symmetry(); return std::to_integer(_settings); }; diff --git a/drivers/CoreVideo/tests/CoreLCDDriverOTM8009A_test.cpp b/drivers/CoreVideo/tests/CoreLCDDriverOTM8009A_test.cpp index 84f35b83ed..3fbe816f7e 100644 --- a/drivers/CoreVideo/tests/CoreLCDDriverOTM8009A_test.cpp +++ b/drivers/CoreVideo/tests/CoreLCDDriverOTM8009A_test.cpp @@ -45,7 +45,13 @@ TEST_F(CoreOTM8009ATest, initialize) TEST_F(CoreOTM8009ATest, setLandscapeOrientation) { - auto expected_instruction_array = ElementsAre(lcd::otm8009a::madctr::command, 0xA0); + auto _settings = uint8_t {0x00}; + auto set_landscape_mode = [&] { _settings |= (1 << 5); }; + auto set_horizontal_symmetry = [&] { _settings |= (1 << 6); }; + set_landscape_mode(); + set_horizontal_symmetry(); + + auto expected_instruction_array = ElementsAre(lcd::otm8009a::madctr::command, _settings); auto expected_set_address_for_column_array = ElementsAre(0x00, 0x00, 0x03, 0x1F, lcd::otm8009a::set_address::for_column::command); auto expected_set_address_for_page_array =