Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ladislas/feature/deprecate lstd #402

Merged
merged 5 commits into from
Jan 9, 2022
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
3 changes: 3 additions & 0 deletions .github/workflows/ci-code_analysis-sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ jobs:
make ccache_prebuild

- name: Config, build & run unit tests
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
run: |
make config_unit_tests
make unit_tests
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-unit_tests-gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
runs-on: ubuntu-latest

env:
CC: /usr/bin/gcc
CXX: /usr/bin/g++
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10

steps:
- uses: actions/checkout@v2
Expand Down
6 changes: 0 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@ if (${TARGET_BOARD} IN_LIST AVAILABLE_CUSTOM_TARGETS)
add_subdirectory(${TARGETS_DIR}/TARGET_${TARGET_BOARD})
endif()

# Add c++ support, include directories
include_directories(BEFORE SYSTEM
${INCLUDE_DIR}/cxxsupport
${MBED_OS_DIR}/platform/cxxsupport
)

include_directories(BEFORE
${INCLUDE_DIR}
)
Expand Down
7 changes: 4 additions & 3 deletions drivers/CoreFlashMemory/include/CoreFlashIS25LP016D.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#ifndef _LEKA_OS_DRIVER_CORE_FLASH_MEMORY_IS25LP016D_H_
#define _LEKA_OS_DRIVER_CORE_FLASH_MEMORY_IS25LP016D_H_

#include <cinttypes>
#include <cstdint>
#include <span>

#include "interface/drivers/FlashManager.h"
#include "interface/drivers/FlashMemory.h"
Expand All @@ -23,8 +24,8 @@ class CoreFlashIS25LP016D : public interface::FlashMemory

void reset();

auto read(uint32_t address, lstd::span<uint8_t> rx_buffer, size_t rx_buffer_size) -> size_t final;
auto write(uint32_t address, lstd::span<uint8_t> tx_buffer, size_t tx_buffer_size) -> size_t final;
auto read(uint32_t address, std::span<uint8_t> rx_buffer, size_t rx_buffer_size) -> size_t final;
auto write(uint32_t address, std::span<uint8_t> tx_buffer, size_t tx_buffer_size) -> size_t final;

void erase() final;

Expand Down
4 changes: 2 additions & 2 deletions drivers/CoreFlashMemory/source/CoreFlashIS25LP016D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void CoreFlashIS25LP016D::reset()
_flash_manager.reset();
}

auto CoreFlashIS25LP016D::read(uint32_t address, lstd::span<uint8_t> rx_buffer, size_t rx_buffer_size) -> size_t
auto CoreFlashIS25LP016D::read(uint32_t address, std::span<uint8_t> rx_buffer, size_t rx_buffer_size) -> size_t
{
if (address + rx_buffer.size() > flash::is25lp016d::size) {
return 0;
Expand All @@ -36,7 +36,7 @@ auto CoreFlashIS25LP016D::read(uint32_t address, lstd::span<uint8_t> rx_buffer,
return bytes_read;
}

auto CoreFlashIS25LP016D::write(uint32_t address, const lstd::span<uint8_t> tx_buffer, size_t tx_buffer_size) -> size_t
auto CoreFlashIS25LP016D::write(uint32_t address, const std::span<uint8_t> tx_buffer, size_t tx_buffer_size) -> size_t
{
if (address + tx_buffer.size() > getSize()) {
return 0;
Expand Down
10 changes: 5 additions & 5 deletions drivers/CoreFlashMemory/tests/CoreFlashIS25LP016D_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

#include "CoreFlashIS25LP016D.h"
#include <lstd_array>
#include <array>

#include "gtest/gtest.h"
#include "mocks/leka/FlashManager.h"
Expand Down Expand Up @@ -121,7 +121,7 @@ TEST_F(CoreFlashIS25LP016DTest, readFailChipIsNotAvailable)
TEST_F(CoreFlashIS25LP016DTest, write)
{
uint32_t address = 0x2A;
auto buffer = lstd::to_array<uint8_t>({0x61, 0x62, 0x63, 0x64, 0x65, 0x66}); // "abcdef"
auto buffer = std::to_array<uint8_t>({0x61, 0x62, 0x63, 0x64, 0x65, 0x66}); // "abcdef"
const auto bytes_to_write = 5;

size_t expected_bytes_written = bytes_to_write;
Expand All @@ -145,7 +145,7 @@ TEST_F(CoreFlashIS25LP016DTest, write)
TEST_F(CoreFlashIS25LP016DTest, writeOverSize)
{
uint32_t address = flash::is25lp016d::size;
auto buffer = lstd::to_array<uint8_t>({0x61, 0x62, 0x63, 0x64, 0x65, 0x66}); // "abcdef"
auto buffer = std::to_array<uint8_t>({0x61, 0x62, 0x63, 0x64, 0x65, 0x66}); // "abcdef"
const auto bytes_to_write = 5;

size_t expected_bytes_written = 0;
Expand All @@ -159,7 +159,7 @@ TEST_F(CoreFlashIS25LP016DTest, writeOverSize)
TEST_F(CoreFlashIS25LP016DTest, writeFailNotEnableToWrite)
{
uint32_t address = 0x2A;
auto buffer = lstd::to_array<uint8_t>({0x61, 0x62, 0x63, 0x64, 0x65, 0x66}); // "abcdef"
auto buffer = std::to_array<uint8_t>({0x61, 0x62, 0x63, 0x64, 0x65, 0x66}); // "abcdef"
const auto bytes_to_write = 5;

size_t expected_bytes_written = 0;
Expand All @@ -179,7 +179,7 @@ TEST_F(CoreFlashIS25LP016DTest, writeFailNotEnableToWrite)
TEST_F(CoreFlashIS25LP016DTest, writeFailChipIsNotAvailable)
{
uint32_t address = 0x2A;
auto buffer = lstd::to_array<uint8_t>({0x61, 0x62, 0x63, 0x64, 0x65, 0x66}); // "abcdef"
auto buffer = std::to_array<uint8_t>({0x61, 0x62, 0x63, 0x64, 0x65, 0x66}); // "abcdef"
const auto bytes_to_write = 5;

size_t expected_bytes_written = 0;
Expand Down
22 changes: 11 additions & 11 deletions drivers/CoreFlashMemory/tests/CoreFlashManagerIS25LP016D_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: Apache-2.0

#include "CoreFlashManagerIS25LP016D.h"
#include <lstd_array>
#include <array>

#include "gtest/gtest.h"
#include "mocks/leka/QSPI.h"
Expand Down Expand Up @@ -37,12 +37,12 @@ class CoreFlashManagerIS25LP016DTest : public ::testing::Test
void MOCK_FUNCTION_chip_available(int times = 1)
{
auto work_not_in_progress = ~status::work_in_progress;
auto returned_value = lstd::to_array({work_not_in_progress});
auto returned_value = std::to_array({work_not_in_progress});
EXPECT_CALL(qspimock, sendCommand(command::read_status, _, _, _, setArray(returned_value), _)).Times(times);
}
void MOCK_FUNCTION_chip_not_available()
{
auto returned_value = lstd::to_array({status::work_in_progress});
auto returned_value = std::to_array({status::work_in_progress});
EXPECT_CALL(qspimock, sendCommand(command::read_status, _, _, _, setArray(returned_value), _)).Times(1);
}

Expand All @@ -57,7 +57,7 @@ class CoreFlashManagerIS25LP016DTest : public ::testing::Test
}
void MOCK_FUNCTION_enable_write_and_write_is_enabled()
{
auto returned_value = lstd::to_array({status::write_enable_latch});
auto returned_value = std::to_array({status::write_enable_latch});
{
InSequence seq;

Expand All @@ -73,7 +73,7 @@ class CoreFlashManagerIS25LP016DTest : public ::testing::Test
void MOCK_FUNCTION_enable_write_and_write_is_not_enabled()
{
auto write_not_enabled = ~status::write_enable_latch;
auto returned_value = lstd::to_array({write_not_enabled});
auto returned_value = std::to_array({write_not_enabled});
{
InSequence seq;

Expand All @@ -98,7 +98,7 @@ TEST_F(CoreFlashManagerIS25LP016DTest, instantiation)

TEST_F(CoreFlashManagerIS25LP016DTest, getStatusRegister)
{
auto returned_value = lstd::to_array({0x2A});
auto returned_value = std::to_array({0x2A});
auto expected_value = returned_value[0];

EXPECT_CALL(qspimock, sendCommand(command::read_status, _, _, _, setArray(returned_value), status::register_size))
Expand All @@ -113,7 +113,7 @@ TEST_F(CoreFlashManagerIS25LP016DTest, chipIsAvailable)
auto expected_not_available = false;

auto work_not_in_progress = ~status::work_in_progress;
auto returned_value = lstd::to_array({work_not_in_progress});
auto returned_value = std::to_array({work_not_in_progress});

EXPECT_CALL(qspimock, sendCommand(command::read_status, _, _, _, setArray(returned_value), status::register_size))
.Times(1);
Expand All @@ -126,7 +126,7 @@ TEST_F(CoreFlashManagerIS25LP016DTest, chipIsNotAvailable)
{
auto expected_not_available = true;

auto returned_value = lstd::to_array({status::work_in_progress});
auto returned_value = std::to_array({status::work_in_progress});

EXPECT_CALL(qspimock, sendCommand(command::read_status, _, _, _, setArray(returned_value), status::register_size))
.Times(1);
Expand Down Expand Up @@ -223,7 +223,7 @@ TEST_F(CoreFlashManagerIS25LP016DTest, writeIsEnabled)
{
auto expected_not_enabled = false;

auto returned_value = lstd::to_array({status::write_enable_latch});
auto returned_value = std::to_array({status::write_enable_latch});

{
InSequence seq;
Expand All @@ -243,7 +243,7 @@ TEST_F(CoreFlashManagerIS25LP016DTest, writeIsNotEnabled)
auto expected_not_enabled = true;

auto write_not_enabled = ~status::write_enable_latch;
auto returned_value = lstd::to_array({write_not_enabled});
auto returned_value = std::to_array({write_not_enabled});

{
InSequence seq;
Expand All @@ -262,7 +262,7 @@ TEST_F(CoreFlashManagerIS25LP016DTest, writeIsNotEnabledDueToChipNotAvailable)
{
auto expected_not_enabled = true;

auto returned_value = lstd::to_array({status::write_enable_latch});
auto returned_value = std::to_array({status::write_enable_latch});

{
InSequence seq;
Expand Down
10 changes: 6 additions & 4 deletions drivers/CoreQSPI/include/CoreQSPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef _LEKA_OS_DRIVER_CORE_QSPI_H_
#define _LEKA_OS_DRIVER_CORE_QSPI_H_

#include <span>

#include "drivers/QSPI.h"

#include "interface/drivers/QSPI.h"
Expand All @@ -21,11 +23,11 @@ class CoreQSPI : public interface::QSPI
void setDataTransmissionFormat() final;
void setFrequency(int hz = ONE_MHZ) final;

auto read(uint8_t command, uint32_t address, lstd::span<uint8_t> rx_buffer, size_t rx_buffer_size) -> size_t final;
auto write(uint8_t command, uint32_t address, lstd::span<uint8_t> tx_buffer, size_t tx_buffer_size) -> size_t final;
auto read(uint8_t command, uint32_t address, std::span<uint8_t> rx_buffer, size_t rx_buffer_size) -> size_t final;
auto write(uint8_t command, uint32_t address, std::span<uint8_t> tx_buffer, size_t tx_buffer_size) -> size_t final;

auto sendCommand(uint8_t command, uint32_t address, lstd::span<uint8_t> tx_buffer, size_t tx_buffer_size,
lstd::span<uint8_t> rx_buffer, size_t rx_buffer_size) -> std::tuple<size_t, size_t> final;
auto sendCommand(uint8_t command, uint32_t address, std::span<uint8_t> tx_buffer, size_t tx_buffer_size,
std::span<uint8_t> rx_buffer, size_t rx_buffer_size) -> std::tuple<size_t, size_t> final;

private:
mbed::QSPI _qspi;
Expand Down
9 changes: 4 additions & 5 deletions drivers/CoreQSPI/source/CoreQSPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void CoreQSPI::setFrequency(int hz)
_qspi.set_frequency(hz);
}

auto CoreQSPI::read(uint8_t command, uint32_t address, lstd::span<uint8_t> rx_buffer, size_t rx_buffer_size) -> size_t
auto CoreQSPI::read(uint8_t command, uint32_t address, std::span<uint8_t> rx_buffer, size_t rx_buffer_size) -> size_t
{
// ? Use local variable as Mbed's QSPI driver returns the number of bytes read as an in/out parameter
auto size = rx_buffer_size;
Expand All @@ -35,7 +35,7 @@ auto CoreQSPI::read(uint8_t command, uint32_t address, lstd::span<uint8_t> rx_bu
return size;
}

auto CoreQSPI::write(uint8_t command, uint32_t address, const lstd::span<uint8_t> tx_buffer, size_t tx_buffer_size)
auto CoreQSPI::write(uint8_t command, uint32_t address, const std::span<uint8_t> tx_buffer, size_t tx_buffer_size)
-> size_t
{
// ? Use local variable as Mbed's QSPI driver returns the number of bytes written as an in/out parameter
Expand All @@ -46,9 +46,8 @@ auto CoreQSPI::write(uint8_t command, uint32_t address, const lstd::span<uint8_t
return size;
}

auto CoreQSPI::sendCommand(uint8_t command, uint32_t address, const lstd::span<uint8_t> tx_buffer,
size_t tx_buffer_size, lstd::span<uint8_t> rx_buffer, size_t rx_buffer_size)
-> std::tuple<size_t, size_t>
auto CoreQSPI::sendCommand(uint8_t command, uint32_t address, const std::span<uint8_t> tx_buffer, size_t tx_buffer_size,
std::span<uint8_t> rx_buffer, size_t rx_buffer_size) -> std::tuple<size_t, size_t>
{
// ? Use local variable as Mbed's QSPI drivers returns the number of bytes read/written as an in/out parameter
auto tx_size = tx_buffer_size;
Expand Down
4 changes: 2 additions & 2 deletions drivers/CoreVideo/include/CGFont.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
#ifndef _LEKA_OS_DRIVER_CORE_VIDEO_FONT_TABLE_H_
#define _LEKA_OS_DRIVER_CORE_VIDEO_FONT_TABLE_H_

#include <array>
#include <cstdint>
#include <lstd_array>

namespace leka {

Expand All @@ -18,7 +18,7 @@ namespace leka {
// Reading has to be done row of pixel by row of pixel. Hence, the row of 17 pixels is encoded on 3 bytes.
// As consequence of the 2 previous sentences, the last 7 bits are not used in the third byte.

constexpr auto CGFontTable = lstd::to_array<uint8_t>({
constexpr auto CGFontTable = std::to_array<uint8_t>({

// @0 ' ' (17 pixels wide)
0x00, 0x00, 0x00, //
Expand Down
3 changes: 1 addition & 2 deletions drivers/CoreVideo/source/CoreLCDDriverOTM8009A.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: Apache-2.0

#include <array>
#include <lstd_array>

#include "rtos/ThisThread.h"

Expand Down Expand Up @@ -284,7 +283,7 @@ void CoreLCDDriverOTM8009A::setLandscapeOrientation()
return std::to_integer<uint8_t>(_settings);
};

constexpr auto command = lstd::to_array<uint8_t>({madctr::command, settings()});
constexpr auto command = std::to_array<uint8_t>({madctr::command, settings()});

_dsi.write(command.data(), std::size(command));

Expand Down
80 changes: 0 additions & 80 deletions include/cxxsupport/lstd_array

This file was deleted.

Loading