mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-18 10:31:09 +00:00
freertos: Remove legacy data types
This commit removes the usage of all legacy FreeRTOS data types that are exposed via configENABLE_BACKWARD_COMPATIBILITY. Legacy types can still be used by enabling CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*
|
||||
@@ -183,7 +183,7 @@ TEST_CASE("I2CWrite calls driver correctly")
|
||||
// will actually write the data but for the tests it is enough for now
|
||||
i2c_master_write_ExpectWithArrayAndReturn(&cmd_fix.dummy_handle, expected_write, WRITE_SIZE, EXPECTED_DATA_LEN, true, ESP_OK);
|
||||
i2c_master_stop_ExpectAndReturn(&cmd_fix.dummy_handle, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_RATE_MS, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_PERIOD_MS, ESP_OK);
|
||||
|
||||
std::vector<uint8_t> WRITE_BYTES = {0xAB, 0xBA};
|
||||
I2CWrite write(WRITE_BYTES);
|
||||
@@ -218,7 +218,7 @@ TEST_CASE("I2CRead calls driver correctly")
|
||||
// will actually read the data but for the tests it is enough for now
|
||||
i2c_master_read_ReturnArrayThruPtr_data(READ_DATA, READ_SIZE);
|
||||
i2c_master_stop_ExpectAndReturn(&cmd_fix.dummy_handle, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_RATE_MS, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_PERIOD_MS, ESP_OK);
|
||||
|
||||
I2CRead reader(READ_SIZE);
|
||||
std::vector<uint8_t> result = reader.do_transfer(I2CNumber::I2C0(), I2CAddress(0x47));
|
||||
@@ -261,7 +261,7 @@ TEST_CASE("I2CComposed calls driver correctly")
|
||||
// will actually read the data but for the tests it is enough for now
|
||||
i2c_master_read_ReturnArrayThruPtr_data(READ_DATA, READ_SIZE);
|
||||
i2c_master_stop_ExpectAndReturn(&cmd_fix.dummy_handle, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_RATE_MS, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_PERIOD_MS, ESP_OK);
|
||||
|
||||
I2CComposed composed_transfer;
|
||||
composed_transfer.add_write({0x47, 0x48, 0x49});
|
||||
@@ -289,7 +289,7 @@ TEST_CASE("I2CWrite transfer calls driver correctly")
|
||||
// will actually write the data but for the tests it is enough for now
|
||||
i2c_master_write_ExpectWithArrayAndReturn(&cmd_fix.dummy_handle, expected_write, WRITE_SIZE, EXPECTED_DATA_LEN, true, ESP_OK);
|
||||
i2c_master_stop_ExpectAndReturn(&cmd_fix.dummy_handle, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_RATE_MS, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_PERIOD_MS, ESP_OK);
|
||||
|
||||
I2CMaster master(I2CNumber::I2C0(), SCL_GPIO(1), SDA_GPIO(2), Frequency(400000));
|
||||
std::vector<uint8_t> WRITE_BYTES = {0xAB, 0xBA};
|
||||
@@ -310,7 +310,7 @@ TEST_CASE("I2CMaster synchronous write")
|
||||
// will actually write the data but for the tests it is enough for now
|
||||
i2c_master_write_ExpectWithArrayAndReturn(&cmd_fix.dummy_handle, expected_write, WRITE_SIZE, EXPECTED_DATA_LEN, true, ESP_OK);
|
||||
i2c_master_stop_ExpectAndReturn(&cmd_fix.dummy_handle, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_RATE_MS, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_PERIOD_MS, ESP_OK);
|
||||
|
||||
I2CMaster master(I2CNumber::I2C0(), SCL_GPIO(1), SDA_GPIO(2), Frequency(400000));
|
||||
std::vector<uint8_t> WRITE_BYTES = {0xAB, 0xBA};
|
||||
@@ -332,7 +332,7 @@ TEST_CASE("I2CMaster synchronous read")
|
||||
// will actually read the data but for the tests it is enough for now
|
||||
i2c_master_read_ReturnArrayThruPtr_data(READ_DATA, READ_SIZE);
|
||||
i2c_master_stop_ExpectAndReturn(&cmd_fix.dummy_handle, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_RATE_MS, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_PERIOD_MS, ESP_OK);
|
||||
|
||||
I2CMaster master(I2CNumber::I2C0(), SCL_GPIO(1), SDA_GPIO(2), Frequency(400000));
|
||||
std::vector<uint8_t> result = master.sync_read(I2CAddress(0x47), READ_SIZE);
|
||||
@@ -365,7 +365,7 @@ TEST_CASE("I2CMaster syncronous transfer (read and write)")
|
||||
// will actually read the data but for the tests it is enough for now
|
||||
i2c_master_read_ReturnArrayThruPtr_data(READ_DATA, READ_SIZE);
|
||||
i2c_master_stop_ExpectAndReturn(&cmd_fix.dummy_handle, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_RATE_MS, ESP_OK);
|
||||
i2c_master_cmd_begin_ExpectAndReturn(0, &cmd_fix.dummy_handle, 1000 / portTICK_PERIOD_MS, ESP_OK);
|
||||
|
||||
I2CMaster master(I2CNumber::I2C0(), SCL_GPIO(1), SDA_GPIO(2), Frequency(400000));
|
||||
vector<uint8_t> read_result = master.sync_transfer(I2CAddress(0x47), {0x47, 0x48, 0x49}, READ_SIZE);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -96,7 +96,7 @@ void I2CCommandLink::stop()
|
||||
|
||||
void I2CCommandLink::execute_transfer(I2CNumber i2c_num, chrono::milliseconds driver_timeout)
|
||||
{
|
||||
esp_err_t err = i2c_master_cmd_begin(i2c_num.get_num(), handle, driver_timeout.count() / portTICK_RATE_MS);
|
||||
esp_err_t err = i2c_master_cmd_begin(i2c_num.get_num(), handle, driver_timeout.count() / portTICK_PERIOD_MS);
|
||||
if (err != ESP_OK) {
|
||||
throw I2CTransferException(err);
|
||||
}
|
||||
@@ -184,12 +184,12 @@ I2CSlave::~I2CSlave()
|
||||
|
||||
int I2CSlave::write_raw(const uint8_t *data, size_t data_len, chrono::milliseconds timeout)
|
||||
{
|
||||
return i2c_slave_write_buffer(i2c_num.get_value(), data, data_len, (TickType_t) timeout.count() / portTICK_RATE_MS);
|
||||
return i2c_slave_write_buffer(i2c_num.get_value(), data, data_len, (TickType_t) timeout.count() / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
int I2CSlave::read_raw(uint8_t *buffer, size_t buffer_len, chrono::milliseconds timeout)
|
||||
{
|
||||
return i2c_slave_read_buffer(i2c_num.get_value(), buffer, buffer_len, (TickType_t) timeout.count() / portTICK_RATE_MS);
|
||||
return i2c_slave_read_buffer(i2c_num.get_value(), buffer, buffer_len, (TickType_t) timeout.count() / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
I2CWrite::I2CWrite(const vector<uint8_t> &bytes, chrono::milliseconds driver_timeout)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -225,7 +225,7 @@ bool SPITransactionDescriptor::wait_for(const chrono::milliseconds &timeout_dura
|
||||
|
||||
spi_transaction_t *acquired_trans_desc;
|
||||
esp_err_t err = device_handle->get_trans_result(&acquired_trans_desc,
|
||||
(TickType_t) timeout_duration.count() / portTICK_RATE_MS);
|
||||
(TickType_t) timeout_duration.count() / portTICK_PERIOD_MS);
|
||||
|
||||
if (err == ESP_ERR_TIMEOUT) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user