OK, I found the fix. I looked in FreeRTOS-Kernel/CMakelLists.txt and saw:
# `freertos_config` target defines the path to FreeRTOSConfig.h and optionally other freertos based config files
if(NOT TARGET freertos_config )
if (NOT DEFINED FREERTOS_CONFIG_FILE_DIRECTORY )
So, in the top-level CMakeLists.txt I defined FREERTOS_CONFIG_FILE_DIRECTORY :
set(FREERTOS_CONFIG_FILE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
Then moved the FreeRTOSConfig.h file out of /src to the top-level directory. Then in the file i2c_sht4x.cpp I added the following include lines:
#include "FreeRTOS.h"
#include "task.h"
Seems you have to include FreeRTOS.h prior to including tash.h.
I make sure the code is using vTaskDelay:
retval = i2c_write_blocking(i2c_bus_, SSHT4x_I2C_ADDRESS, &command, SHT4x_COMMAND_LENGTH, true);
//sleep_ms(10); // Datasheet says to put in a delay.
vTaskDelay(1000)
retval = i2c_read_blocking(i2c_bus_, SSHT4x_I2C_ADDRESS, (uint8_t *)buffer, SHT4x_SERIAL_LENGTH, false);
It compiles just fine:
[build] [9/9 100% :: 0.409] Linking CXX executable src/WeatherStation.elf
[driver] Build completed: 00:00:00.436
[build] Build finished with exit code 0
So, it seems that you just need to define a variable in Cake that indicates where the directory is that contains the FreeRTOSConfig.h file.
# `freertos_config` target defines the path to FreeRTOSConfig.h and optionally other freertos based config files
if(NOT TARGET freertos_config )
if (NOT DEFINED FREERTOS_CONFIG_FILE_DIRECTORY )
So, in the top-level CMakeLists.txt I defined FREERTOS_CONFIG_FILE_DIRECTORY :
set(FREERTOS_CONFIG_FILE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
Then moved the FreeRTOSConfig.h file out of /src to the top-level directory. Then in the file i2c_sht4x.cpp I added the following include lines:
#include "FreeRTOS.h"
#include "task.h"
Seems you have to include FreeRTOS.h prior to including tash.h.
I make sure the code is using vTaskDelay:
retval = i2c_write_blocking(i2c_bus_, SSHT4x_I2C_ADDRESS, &command, SHT4x_COMMAND_LENGTH, true);
//sleep_ms(10); // Datasheet says to put in a delay.
vTaskDelay(1000)
retval = i2c_read_blocking(i2c_bus_, SSHT4x_I2C_ADDRESS, (uint8_t *)buffer, SHT4x_SERIAL_LENGTH, false);
It compiles just fine:
[build] [9/9 100% :: 0.409] Linking CXX executable src/WeatherStation.elf
[driver] Build completed: 00:00:00.436
[build] Build finished with exit code 0
So, it seems that you just need to define a variable in Cake that indicates where the directory is that contains the FreeRTOSConfig.h file.
Statistics: Posted by chriskot870 — Wed Feb 07, 2024 8:24 pm