add test for PCA9685 in testing mode

This commit is contained in:
2026-11-10 20:15:30 +02:00
parent 05f892c59f
commit 74b18ec21c
5 changed files with 64 additions and 0 deletions
+1
View File
@@ -22,6 +22,7 @@ set(KPIROVER_COMPONENTS
Logger
Motors
PCA9685
PCA9685_Test
)
foreach(arb ${KPIROVER_ARBITERS})
+2
View File
@@ -8,6 +8,7 @@
#include "ulImu.h"
#include "ulLEDMode.h"
#include "ulMotorsController.h"
#include "PCA9685_Test.h"
//#include "Storage/ulStorage.h"
//#include "ulAdc.h"
@@ -78,6 +79,7 @@ void KPIRover_Init(void) {
{
if (dip[0] == true)
{
(void) PCA9685_Test_Init();
ulLEDMode_Start();
}
}
+30
View File
@@ -0,0 +1,30 @@
set(KPI_Rover_PCA9685_Test_Inc
${CMAKE_CURRENT_SOURCE_DIR}
)
set(KPI_Rover_PCA9685_Test_Src
${CMAKE_CURRENT_SOURCE_DIR}/PCA9685_Test.c
)
add_library(KPI_Rover_PCA9685_Test STATIC)
target_include_directories(KPI_Rover_PCA9685_Test PRIVATE
${KPI_Rover_PCA9685_Test_Inc}
)
target_sources(KPI_Rover_PCA9685_Test PRIVATE
${KPI_Rover_PCA9685_Test_Src}
)
target_link_libraries(KPI_Rover_PCA9685_Test PRIVATE
HAL_H
KPI_Rover_Arbiter_I2C_H
KPI_Rover_Arbiter_I2C
KPI_Rover_PCA9685_H
KPI_Rover_PCA9685
)
add_library(KPI_Rover_PCA9685_Test_H INTERFACE)
target_include_directories(KPI_Rover_PCA9685_Test_H INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}
)
+23
View File
@@ -0,0 +1,23 @@
#include "PCA9685_Test.h"
#include "PCA9685.h"
bool PCA9685_Test_Init(void)
{
if (PCA9685_Init(PCA9685_ADDR_1))
{
for (int i = 0; i < 16; i++)
{
PCA9685_SetPWM(PCA9685_ADDR_1, 0, 0, 0x3FF * ((i % 3) + 1));
}
}
if (PCA9685_Init(PCA9685_ADDR_2))
{
for (int i = 0; i < 16; i++)
{
PCA9685_SetPWM(PCA9685_ADDR_2, 0, 0, 0x3FF * ((i % 3) + 1));
}
}
return true;
}
+8
View File
@@ -0,0 +1,8 @@
#ifndef __PCA9685_TEST
#define __PCA9685_TEST
#include <stdbool.h>
bool PCA9685_Test_Init(void);
#endif /* __PCA9685_TEST */