Skip to content
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
18 changes: 11 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,7 @@ target_sources(${CMAKE_PROJECT_NAME} PRIVATE
app/drivers/motor_driver.c
app/drivers/ir_remote.c
app/drivers/line_sensor.c
app/drivers/vl53l0x/vl53l0x_platform.c
app/drivers/vl53l0x/vl53l0x_api.c
app/drivers/vl53l0x/vl53l0x_api_calibration.c
app/drivers/vl53l0x/vl53l0x_api_core.c
app/drivers/vl53l0x/vl53l0x_api_ranging.c
app/drivers/vl53l0x/vl53l0x_api_strings.c
app/drivers/vl53l4cd_platform.c
app/state.c
app/state_standby.c
app/state_retreat.c
Expand All @@ -85,12 +80,20 @@ add_library(segger_rtt STATIC
external/rtt/RTT/SEGGER_RTT.c
external/rtt/RTT/SEGGER_RTT_printf.c
)

target_include_directories(segger_rtt PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/app/config
${CMAKE_CURRENT_SOURCE_DIR}/external/rtt/RTT
)

add_library(vl53l4cd_uld STATIC
external/VL53L4CD_ULD_V2.2.3/VL53L4CD_ULD_Driver/VL53L4CD_api.c
external/VL53L4CD_ULD_V2.2.3/VL53L4CD_ULD_Driver/VL53L4CD_calibration.c
)
target_include_directories(vl53l4cd_uld PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/external/VL53L4CD_ULD_V2.2.3/VL53L4CD_ULD_Driver
${CMAKE_CURRENT_SOURCE_DIR}/external/VL53L4CD_ULD_V2.2.3/Platform
)

# Add project symbols (macros)
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
# Add user defined symbols
Expand All @@ -105,5 +108,6 @@ target_link_libraries(${CMAKE_PROJECT_NAME}

# Add user defined libraries
segger_rtt
vl53l4cd_uld
)

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ regardless of battery voltage, which fluctuates with charge.
- The [STM32CubeMX generated](#hardware-initialization) source and header files live in `Src` and
`Inc`.
- External libraries live in `external`, at the time of writing it holds a Segger RTT library
git submodule, used for logging in debug builds, and the Unity unit testing framework.
git submodule, used for logging in debug builds, ST's VL53L4CD driver and the Unity unit testing
framework.
- Integration and unit tests live in `tests`.

### State machine
Expand Down
12 changes: 8 additions & 4 deletions Src/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ void MX_I2C1_Init(void)
/* USER CODE END I2C1_Init 0 */

/* USER CODE BEGIN I2C1_Init 1 */
// The I2C bus is used to communicate with our three VL53L* ranging sensors, configured in fast
// mode, 400 KHz, to speed up the I2C transmissions required to read the ranging data and reset
// the DRDY pin.
// The I2C bus is used to communicate with our three VL53L4CD ranging sensors, configured for I2C
// fast mode plus, 1MHz, to speed up the I2C transmissions required to read the ranging data and
// reset the DRDY pin.
/* USER CODE END I2C1_Init 1 */
hi2c1.Instance = I2C1;
hi2c1.Init.Timing = 0x0010020A;
hi2c1.Init.Timing = 0x00100001;
hi2c1.Init.OwnAddress1 = 0;
hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
Expand All @@ -66,6 +66,10 @@ void MX_I2C1_Init(void)
{
Error_Handler();
}

/** I2C Fast mode Plus enable
*/
__HAL_SYSCFG_FASTMODEPLUS_ENABLE(I2C_FASTMODEPLUS_I2C1);
/* USER CODE BEGIN I2C1_Init 2 */

/* USER CODE END I2C1_Init 2 */
Expand Down
4 changes: 2 additions & 2 deletions app/app.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "VL53L4CD_api.h"
#include "debug.h"
#include "drivers/ir_remote.h"
#include "drivers/line_sensor.h"
#include "drivers/motor_driver.h"
#include "drivers/vl53l0x/vl53l0x_api.h"
#include "main.h"
#include "ranging.h"
#include "state.h"
Expand All @@ -20,7 +20,7 @@ void app_init(void)
ir_remote_init();
line_sensor_init();
int ret = ranging_init();
if (ret != VL53L0X_ERROR_NONE)
if (ret != VL53L4CD_ERROR_NONE)
{
DEBUG_PRINTF("Encountered an error during ranging init, error: %d\n", ret);
Error_Handler();
Expand Down
Loading
Loading