Skip to content

Commit

Permalink
deprecation: FreeRTOS syntax changed in 2014
Browse files Browse the repository at this point in the history
In 2014 FreeRTOS v8.0.0 was released which introduced a number of
deprecation notices... some of which it looks like still hadn't been
resolved.

This was discovered via the error message:

> HINT: You maybe using pre FreeRTOS V8.0.0 data types. The backward
compatibility of such data types is no longer enabled by default. Please
turn on CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY explicitly to use
such data types.

I was about to just flip that switch in the config and move on... until
I saw espressif/esp-idf#51.

Yes... Issue number 51.  In a repository which currently is working
through issue number 11833, number 51 debated what I was just talking
about doing... but in 2016.

Obviously this is a band-aid which needed to be ripped off (and next up
will need to be `driver_mch22`.  The fix is simple enough.
`portTICK_RATE_MS` needs to be replaced with `portTICK_PERIOD_MS`.  This
can be a simple `sed` replacement:

    sed  -i 's/portTICK_RATE_MS/portTICK_PERIOD_MS/g' components/buses/buses.c
  • Loading branch information
brianredbeard committed Jul 8, 2023
1 parent 2abb285 commit fe2af20
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions components/buses/buses.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ esp_err_t driver_i2c_read_bytes(int bus, uint8_t addr, uint8_t *value, size_t va

xSemaphoreHandle mux = (bus == I2C_NUM_1) ? i2c1_mux : i2c0_mux;
if (xSemaphoreTake(mux, portMAX_DELAY) != pdTRUE) return ESP_ERR_TIMEOUT; // Wait for I2C bus to become available
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_RATE_MS);
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
xSemaphoreGive(mux);
return res;
Expand Down Expand Up @@ -160,7 +160,7 @@ esp_err_t driver_i2c_read_reg(int bus, uint8_t addr, uint8_t reg, uint8_t *value

xSemaphoreHandle mux = (bus == I2C_NUM_1) ? i2c1_mux : i2c0_mux;
if (xSemaphoreTake(mux, portMAX_DELAY) != pdTRUE) return ESP_ERR_TIMEOUT; // Wait for I2C bus to become available
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_RATE_MS);
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
xSemaphoreGive(mux);
return res;
Expand All @@ -181,7 +181,7 @@ esp_err_t driver_i2c_read_event(int bus, uint8_t addr, uint8_t *buf) {

xSemaphoreHandle mux = (bus == I2C_NUM_1) ? i2c1_mux : i2c0_mux;
if (xSemaphoreTake(mux, portMAX_DELAY) != pdTRUE) return ESP_ERR_TIMEOUT; // Wait for I2C bus to become available
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_RATE_MS);
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
xSemaphoreGive(mux);
return res;
Expand All @@ -200,7 +200,7 @@ esp_err_t driver_i2c_write_byte(int bus, uint8_t addr, uint8_t value) {

xSemaphoreHandle mux = (bus == I2C_NUM_1) ? i2c1_mux : i2c0_mux;
if (xSemaphoreTake(mux, portMAX_DELAY) != pdTRUE) return ESP_ERR_TIMEOUT; // Wait for I2C bus to become available
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_RATE_MS);
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
xSemaphoreGive(mux);
return res;
Expand All @@ -221,7 +221,7 @@ esp_err_t driver_i2c_write_reg(int bus, uint8_t addr, uint8_t reg, uint8_t value

xSemaphoreHandle mux = (bus == I2C_NUM_1) ? i2c1_mux : i2c0_mux;
if (xSemaphoreTake(mux, portMAX_DELAY) != pdTRUE) return ESP_ERR_TIMEOUT; // Wait for I2C bus to become available
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_RATE_MS);
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
xSemaphoreGive(mux);
return res;
Expand All @@ -244,7 +244,7 @@ esp_err_t driver_i2c_write_reg_n(int bus, uint8_t addr, uint8_t reg, uint8_t *va

xSemaphoreHandle mux = (bus == I2C_NUM_1) ? i2c1_mux : i2c0_mux;
if (xSemaphoreTake(mux, portMAX_DELAY) != pdTRUE) return ESP_ERR_TIMEOUT; // Wait for I2C bus to become available
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_RATE_MS);
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
xSemaphoreGive(mux);
return res;
Expand All @@ -265,7 +265,7 @@ esp_err_t driver_i2c_write_buffer(int bus, uint8_t addr, const uint8_t* buffer,

xSemaphoreHandle mux = (bus == I2C_NUM_1) ? i2c1_mux : i2c0_mux;
if (xSemaphoreTake(mux, portMAX_DELAY) != pdTRUE) return ESP_ERR_TIMEOUT; // Wait for I2C bus to become available
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_RATE_MS);
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
xSemaphoreGive(mux);
return res;
Expand All @@ -288,7 +288,7 @@ esp_err_t driver_i2c_write_buffer_reg(int bus, uint8_t addr, uint8_t reg, const

xSemaphoreHandle mux = (bus == I2C_NUM_1) ? i2c1_mux : i2c0_mux;
if (xSemaphoreTake(mux, portMAX_DELAY) != pdTRUE) return ESP_ERR_TIMEOUT; // Wait for I2C bus to become available
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_RATE_MS);
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
xSemaphoreGive(mux);
return res;
Expand All @@ -315,7 +315,7 @@ esp_err_t driver_i2c_write_reg32(int bus, uint8_t addr, uint8_t reg, uint32_t va

xSemaphoreHandle mux = (bus == I2C_NUM_1) ? i2c1_mux : i2c0_mux;
if (xSemaphoreTake(mux, portMAX_DELAY) != pdTRUE) return ESP_ERR_TIMEOUT; // Wait for I2C bus to become available
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_RATE_MS);
res = i2c_master_cmd_begin(bus, cmd, 1000 / portTICK_PERIOD_MS);
i2c_cmd_link_delete(cmd);
xSemaphoreGive(mux);
return res;
Expand Down

0 comments on commit fe2af20

Please sign in to comment.