mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Update unit tests to correctly use C/C++ where appropriate. Cleanup
makefile by using additional whitespace.
This commit is contained in:
parent
b893e457f1
commit
bf88696847
5 changed files with 173 additions and 60 deletions
|
@ -87,118 +87,209 @@ $(OBJECT_DIR)/gtest_main.a : $(OBJECT_DIR)/gtest-all.o $(OBJECT_DIR)/gtest_main.
|
||||||
# includes in test dir must override includes in user dir
|
# includes in test dir must override includes in user dir
|
||||||
TEST_INCLUDE_DIRS := $(TEST_DIR) \
|
TEST_INCLUDE_DIRS := $(TEST_DIR) \
|
||||||
$(USER_INCLUDE_DIR)
|
$(USER_INCLUDE_DIR)
|
||||||
|
|
||||||
|
|
||||||
TEST_CFLAGS = $(addprefix -I,$(TEST_INCLUDE_DIRS))
|
TEST_CFLAGS = $(addprefix -I,$(TEST_INCLUDE_DIRS))
|
||||||
|
|
||||||
|
$(OBJECT_DIR)/common/maths.o : \
|
||||||
|
$(USER_DIR)/common/maths.c \
|
||||||
|
$(USER_DIR)/common/maths.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
|
@mkdir -p $(dir $@)
|
||||||
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/common/maths.c -o $@
|
||||||
|
|
||||||
|
|
||||||
$(OBJECT_DIR)/sensors/battery.o : $(USER_DIR)/sensors/battery.c $(USER_DIR)/sensors/battery.h $(GTEST_HEADERS)
|
$(OBJECT_DIR)/sensors/battery.o : $(USER_DIR)/sensors/battery.c $(USER_DIR)/sensors/battery.h $(GTEST_HEADERS)
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/sensors/battery.c -o $@
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/sensors/battery.c -o $@
|
||||||
|
|
||||||
$(OBJECT_DIR)/battery_unittest.o : $(TEST_DIR)/battery_unittest.cc \
|
$(OBJECT_DIR)/battery_unittest.o : \
|
||||||
$(USER_DIR)/sensors/battery.h $(GTEST_HEADERS)
|
$(TEST_DIR)/battery_unittest.cc \
|
||||||
|
$(USER_DIR)/sensors/battery.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/battery_unittest.cc -o $@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/battery_unittest.cc -o $@
|
||||||
|
|
||||||
battery_unittest : $(OBJECT_DIR)/sensors/battery.o $(OBJECT_DIR)/battery_unittest.o $(OBJECT_DIR)/gtest_main.a
|
battery_unittest : \
|
||||||
|
$(OBJECT_DIR)/sensors/battery.o \
|
||||||
|
$(OBJECT_DIR)/common/maths.o \
|
||||||
|
$(OBJECT_DIR)/battery_unittest.o \
|
||||||
|
$(OBJECT_DIR)/gtest_main.a
|
||||||
|
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
||||||
|
|
||||||
|
$(OBJECT_DIR)/flight/imu.o : \
|
||||||
|
$(USER_DIR)/flight/imu.c \
|
||||||
|
$(USER_DIR)/flight/imu.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
|
|
||||||
$(OBJECT_DIR)/flight/imu.o : $(USER_DIR)/flight/imu.c $(USER_DIR)/flight/imu.h $(GTEST_HEADERS)
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/flight/imu.c -o $@
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/flight/imu.c -o $@
|
||||||
|
|
||||||
$(OBJECT_DIR)/flight_imu_unittest.o : $(TEST_DIR)/flight_imu_unittest.cc \
|
$(OBJECT_DIR)/flight_imu_unittest.o : \
|
||||||
$(USER_DIR)/flight/imu.h $(GTEST_HEADERS)
|
$(TEST_DIR)/flight_imu_unittest.cc \
|
||||||
|
$(USER_DIR)/flight/imu.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/flight_imu_unittest.cc -o $@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/flight_imu_unittest.cc -o $@
|
||||||
|
|
||||||
flight_imu_unittest : $(OBJECT_DIR)/flight/imu.o $(OBJECT_DIR)/flight/altitudehold.o $(OBJECT_DIR)/flight_imu_unittest.o $(OBJECT_DIR)/gtest_main.a
|
flight_imu_unittest : \
|
||||||
|
$(OBJECT_DIR)/flight/imu.o \
|
||||||
|
$(OBJECT_DIR)/flight/altitudehold.o \
|
||||||
|
$(OBJECT_DIR)/flight_imu_unittest.o \
|
||||||
|
$(OBJECT_DIR)/gtest_main.a
|
||||||
|
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(OBJECT_DIR)/flight/altitudehold.o : $(USER_DIR)/flight/altitudehold.c $(USER_DIR)/flight/altitudehold.h $(GTEST_HEADERS)
|
$(OBJECT_DIR)/flight/altitudehold.o : \
|
||||||
|
$(USER_DIR)/flight/altitudehold.c \
|
||||||
|
$(USER_DIR)/flight/altitudehold.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/flight/altitudehold.c -o $@
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/flight/altitudehold.c -o $@
|
||||||
|
|
||||||
$(OBJECT_DIR)/altitude_hold_unittest.o : $(TEST_DIR)/altitude_hold_unittest.cc \
|
$(OBJECT_DIR)/altitude_hold_unittest.o : \
|
||||||
$(USER_DIR)/flight/altitudehold.h $(GTEST_HEADERS)
|
$(TEST_DIR)/altitude_hold_unittest.cc \
|
||||||
|
$(USER_DIR)/flight/altitudehold.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/altitude_hold_unittest.cc -o $@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/altitude_hold_unittest.cc -o $@
|
||||||
|
|
||||||
altitude_hold_unittest : $(OBJECT_DIR)/flight/altitudehold.o $(OBJECT_DIR)/altitude_hold_unittest.o $(OBJECT_DIR)/gtest_main.a
|
altitude_hold_unittest : \
|
||||||
|
$(OBJECT_DIR)/flight/altitudehold.o \
|
||||||
|
$(OBJECT_DIR)/altitude_hold_unittest.o \
|
||||||
|
$(OBJECT_DIR)/gtest_main.a
|
||||||
|
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
||||||
|
|
||||||
|
|
||||||
|
$(OBJECT_DIR)/flight/gps_conversion.o : \
|
||||||
|
$(USER_DIR)/flight/gps_conversion.c \
|
||||||
|
$(USER_DIR)/flight/gps_conversion.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
$(OBJECT_DIR)/flight/gps_conversion.o : $(USER_DIR)/flight/gps_conversion.c $(USER_DIR)/flight/gps_conversion.h $(GTEST_HEADERS)
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/flight/gps_conversion.c -o $@
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/flight/gps_conversion.c -o $@
|
||||||
|
|
||||||
$(OBJECT_DIR)/gps_conversion_unittest.o : $(TEST_DIR)/gps_conversion_unittest.cc \
|
$(OBJECT_DIR)/gps_conversion_unittest.o : \
|
||||||
$(USER_DIR)/flight/gps_conversion.h $(GTEST_HEADERS)
|
$(TEST_DIR)/gps_conversion_unittest.cc \
|
||||||
|
$(USER_DIR)/flight/gps_conversion.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/gps_conversion_unittest.cc -o $@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/gps_conversion_unittest.cc -o $@
|
||||||
|
|
||||||
gps_conversion_unittest : $(OBJECT_DIR)/flight/gps_conversion.o $(OBJECT_DIR)/gps_conversion_unittest.o $(OBJECT_DIR)/gtest_main.a
|
gps_conversion_unittest : \
|
||||||
|
$(OBJECT_DIR)/flight/gps_conversion.o \
|
||||||
|
$(OBJECT_DIR)/gps_conversion_unittest.o \
|
||||||
|
$(OBJECT_DIR)/gtest_main.a
|
||||||
|
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(OBJECT_DIR)/telemetry/hott.o : $(USER_DIR)/telemetry/hott.c $(USER_DIR)/telemetry/hott.h $(GTEST_HEADERS)
|
$(OBJECT_DIR)/telemetry/hott.o : \
|
||||||
|
$(USER_DIR)/telemetry/hott.c \
|
||||||
|
$(USER_DIR)/telemetry/hott.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/telemetry/hott.c -o $@
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/telemetry/hott.c -o $@
|
||||||
|
|
||||||
$(OBJECT_DIR)/telemetry_hott_unittest.o : $(TEST_DIR)/telemetry_hott_unittest.cc \
|
$(OBJECT_DIR)/telemetry_hott_unittest.o : \
|
||||||
$(USER_DIR)/telemetry/hott.h $(GTEST_HEADERS)
|
$(TEST_DIR)/telemetry_hott_unittest.cc \
|
||||||
|
$(USER_DIR)/telemetry/hott.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/telemetry_hott_unittest.cc -o $@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/telemetry_hott_unittest.cc -o $@
|
||||||
|
|
||||||
telemetry_hott_unittest :$(OBJECT_DIR)/telemetry/hott.o $(OBJECT_DIR)/telemetry_hott_unittest.o $(OBJECT_DIR)/flight/gps_conversion.o $(OBJECT_DIR)/gtest_main.a
|
telemetry_hott_unittest : \
|
||||||
|
$(OBJECT_DIR)/telemetry/hott.o \
|
||||||
|
$(OBJECT_DIR)/telemetry_hott_unittest.o \
|
||||||
|
$(OBJECT_DIR)/flight/gps_conversion.o \
|
||||||
|
$(OBJECT_DIR)/gtest_main.a
|
||||||
|
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(OBJECT_DIR)/io/rc_controls.o : $(USER_DIR)/io/rc_controls.c $(USER_DIR)/io/rc_controls.h $(GTEST_HEADERS)
|
$(OBJECT_DIR)/io/rc_controls.o : \
|
||||||
|
$(USER_DIR)/io/rc_controls.c \
|
||||||
|
$(USER_DIR)/io/rc_controls.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/io/rc_controls.c -o $@
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/io/rc_controls.c -o $@
|
||||||
|
|
||||||
$(OBJECT_DIR)/rc_controls_unittest.o : $(TEST_DIR)/rc_controls_unittest.cc \
|
$(OBJECT_DIR)/rc_controls_unittest.o : \
|
||||||
$(USER_DIR)/io/rc_controls.h $(GTEST_HEADERS)
|
$(TEST_DIR)/rc_controls_unittest.cc \
|
||||||
|
$(USER_DIR)/io/rc_controls.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/rc_controls_unittest.cc -o $@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/rc_controls_unittest.cc -o $@
|
||||||
|
|
||||||
rc_controls_unittest :$(OBJECT_DIR)/io/rc_controls.o $(OBJECT_DIR)/rc_controls_unittest.o $(OBJECT_DIR)/gtest_main.a
|
rc_controls_unittest : \
|
||||||
|
$(OBJECT_DIR)/io/rc_controls.o \
|
||||||
|
$(OBJECT_DIR)/rc_controls_unittest.o \
|
||||||
|
$(OBJECT_DIR)/gtest_main.a
|
||||||
|
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
||||||
|
|
||||||
|
|
||||||
$(OBJECT_DIR)/io/ledstrip.o : $(USER_DIR)/io/ledstrip.c $(USER_DIR)/io/ledstrip.h $(GTEST_HEADERS)
|
$(OBJECT_DIR)/io/ledstrip.o : \
|
||||||
|
$(USER_DIR)/io/ledstrip.c \
|
||||||
|
$(USER_DIR)/io/ledstrip.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/io/ledstrip.c -o $@
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/io/ledstrip.c -o $@
|
||||||
|
|
||||||
|
$(OBJECT_DIR)/ledstrip_unittest.o : \
|
||||||
|
$(TEST_DIR)/ledstrip_unittest.cc \
|
||||||
|
$(USER_DIR)/io/ledstrip.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
$(OBJECT_DIR)/ledstrip_unittest.o : $(TEST_DIR)/ledstrip_unittest.cc \
|
|
||||||
$(USER_DIR)/io/ledstrip.h $(GTEST_HEADERS)
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/ledstrip_unittest.cc -o $@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/ledstrip_unittest.cc -o $@
|
||||||
|
|
||||||
|
ledstrip_unittest : \
|
||||||
|
$(OBJECT_DIR)/io/ledstrip.o \
|
||||||
|
$(OBJECT_DIR)/ledstrip_unittest.o \
|
||||||
|
$(OBJECT_DIR)/gtest_main.a
|
||||||
|
|
||||||
ledstrip_unittest :$(OBJECT_DIR)/io/ledstrip.o $(OBJECT_DIR)/ledstrip_unittest.o $(OBJECT_DIR)/gtest_main.a
|
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(OBJECT_DIR)/drivers/light_ws2811strip.o : $(USER_DIR)/drivers/light_ws2811strip.c $(USER_DIR)/drivers/light_ws2811strip.h $(GTEST_HEADERS)
|
$(OBJECT_DIR)/drivers/light_ws2811strip.o : \
|
||||||
|
$(USER_DIR)/drivers/light_ws2811strip.c \
|
||||||
|
$(USER_DIR)/drivers/light_ws2811strip.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/drivers/light_ws2811strip.c -o $@
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(USER_DIR)/drivers/light_ws2811strip.c -o $@
|
||||||
|
|
||||||
$(OBJECT_DIR)/ws2811_unittest.o : $(TEST_DIR)/ws2811_unittest.cc \
|
$(OBJECT_DIR)/ws2811_unittest.o : \
|
||||||
$(USER_DIR)/drivers/light_ws2811strip.h $(GTEST_HEADERS)
|
$(TEST_DIR)/ws2811_unittest.cc \
|
||||||
|
$(USER_DIR)/drivers/light_ws2811strip.h \
|
||||||
|
$(GTEST_HEADERS)
|
||||||
|
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/ws2811_unittest.cc -o $@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(TEST_CFLAGS) -c $(TEST_DIR)/ws2811_unittest.cc -o $@
|
||||||
|
|
||||||
ws2811_unittest :$(OBJECT_DIR)/drivers/light_ws2811strip.o $(OBJECT_DIR)/ws2811_unittest.o $(OBJECT_DIR)/gtest_main.a
|
ws2811_unittest : \
|
||||||
|
$(OBJECT_DIR)/drivers/light_ws2811strip.o \
|
||||||
|
$(OBJECT_DIR)/ws2811_unittest.o \
|
||||||
|
$(OBJECT_DIR)/gtest_main.a
|
||||||
|
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -lpthread $^ -o $(OBJECT_DIR)/$@
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,9 @@ extern "C" {
|
||||||
#include "flight/flight.h"
|
#include "flight/flight.h"
|
||||||
|
|
||||||
#include "sensors/sensors.h"
|
#include "sensors/sensors.h"
|
||||||
|
#include "drivers/sensor.h"
|
||||||
#include "drivers/accgyro.h"
|
#include "drivers/accgyro.h"
|
||||||
|
#include "drivers/compass.h"
|
||||||
#include "sensors/gyro.h"
|
#include "sensors/gyro.h"
|
||||||
#include "sensors/compass.h"
|
#include "sensors/compass.h"
|
||||||
#include "sensors/acceleration.h"
|
#include "sensors/acceleration.h"
|
||||||
|
|
|
@ -18,7 +18,10 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "flight/gps_conversion.h"
|
|
||||||
|
extern "C" {
|
||||||
|
#include "flight/gps_conversion.h"
|
||||||
|
}
|
||||||
|
|
||||||
#include "unittest_macros.h"
|
#include "unittest_macros.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
|
@ -19,37 +19,40 @@
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "build_config.h"
|
extern "C" {
|
||||||
|
#include "build_config.h"
|
||||||
|
|
||||||
#include "common/color.h"
|
#include "common/color.h"
|
||||||
#include "common/axis.h"
|
#include "common/axis.h"
|
||||||
#include "flight/flight.h"
|
#include "flight/flight.h"
|
||||||
|
|
||||||
#include "sensors/battery.h"
|
#include "sensors/battery.h"
|
||||||
#include "config/runtime_config.h"
|
#include "config/runtime_config.h"
|
||||||
#include "config/config.h"
|
#include "config/config.h"
|
||||||
|
|
||||||
#include "rx/rx.h"
|
#include "rx/rx.h"
|
||||||
|
|
||||||
#include "drivers/light_ws2811strip.h"
|
|
||||||
#include "io/ledstrip.h"
|
|
||||||
|
|
||||||
|
#include "drivers/light_ws2811strip.h"
|
||||||
|
#include "io/ledstrip.h"
|
||||||
|
}
|
||||||
|
|
||||||
#include "unittest_macros.h"
|
#include "unittest_macros.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
extern ledConfig_t *ledConfigs;
|
extern "C" {
|
||||||
extern uint8_t highestYValueForNorth;
|
extern ledConfig_t *ledConfigs;
|
||||||
extern uint8_t lowestYValueForSouth;
|
extern uint8_t highestYValueForNorth;
|
||||||
extern uint8_t highestXValueForWest;
|
extern uint8_t lowestYValueForSouth;
|
||||||
extern uint8_t lowestXValueForEast;
|
extern uint8_t highestXValueForWest;
|
||||||
extern uint8_t ledGridWidth;
|
extern uint8_t lowestXValueForEast;
|
||||||
extern uint8_t ledGridHeight;
|
extern uint8_t ledGridWidth;
|
||||||
|
extern uint8_t ledGridHeight;
|
||||||
|
|
||||||
void determineLedStripDimensions(void);
|
void determineLedStripDimensions(void);
|
||||||
void determineOrientationLimits(void);
|
void determineOrientationLimits(void);
|
||||||
|
|
||||||
ledConfig_t systemLedConfigs[MAX_LED_STRIP_LENGTH];
|
ledConfig_t systemLedConfigs[MAX_LED_STRIP_LENGTH];
|
||||||
|
}
|
||||||
|
|
||||||
TEST(LedStripTest, parseLedStripConfig)
|
TEST(LedStripTest, parseLedStripConfig)
|
||||||
{
|
{
|
||||||
|
@ -336,12 +339,18 @@ TEST(ColorTest, parseColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
uint8_t armingFlags = 0;
|
uint8_t armingFlags = 0;
|
||||||
uint16_t flightModeFlags = 0;
|
uint16_t flightModeFlags = 0;
|
||||||
int16_t rcCommand[4];
|
int16_t rcCommand[4];
|
||||||
int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT];
|
int16_t rcData[MAX_SUPPORTED_RC_CHANNEL_COUNT];
|
||||||
|
|
||||||
|
batteryState_e calculateBatteryState(void) {
|
||||||
|
return BATTERY_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ws2811LedStripInit(void) {}
|
||||||
void ws2811UpdateStrip(void) {}
|
void ws2811UpdateStrip(void) {}
|
||||||
|
|
||||||
void setLedValue(uint16_t index, const uint8_t value) {
|
void setLedValue(uint16_t index, const uint8_t value) {
|
||||||
|
@ -399,3 +408,5 @@ int scaleRange(int x, int srcMin, int srcMax, int destMin, int destMax) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -19,19 +19,23 @@
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#include "build_config.h"
|
extern "C" {
|
||||||
|
#include "build_config.h"
|
||||||
|
|
||||||
#include "common/color.h"
|
#include "common/color.h"
|
||||||
|
|
||||||
#include "drivers/light_ws2811strip.h"
|
#include "drivers/light_ws2811strip.h"
|
||||||
|
}
|
||||||
|
|
||||||
#include "unittest_macros.h"
|
#include "unittest_macros.h"
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
STATIC_UNIT_TESTED extern uint16_t dmaBufferOffset;
|
STATIC_UNIT_TESTED extern uint16_t dmaBufferOffset;
|
||||||
|
|
||||||
STATIC_UNIT_TESTED void fastUpdateLEDDMABuffer(rgbColor24bpp_t *color);
|
STATIC_UNIT_TESTED void fastUpdateLEDDMABuffer(rgbColor24bpp_t *color);
|
||||||
STATIC_UNIT_TESTED void updateLEDDMABuffer(uint8_t componentValue);
|
STATIC_UNIT_TESTED void updateLEDDMABuffer(uint8_t componentValue);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(WS2812, updateDMABuffer) {
|
TEST(WS2812, updateDMABuffer) {
|
||||||
// given
|
// given
|
||||||
|
@ -86,6 +90,7 @@ TEST(WS2812, updateDMABuffer) {
|
||||||
byteIndex++;
|
byteIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
rgbColor24bpp_t* hsvToRgb24(const hsvColor_t *c) {
|
rgbColor24bpp_t* hsvToRgb24(const hsvColor_t *c) {
|
||||||
UNUSED(c);
|
UNUSED(c);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -93,3 +98,4 @@ rgbColor24bpp_t* hsvToRgb24(const hsvColor_t *c) {
|
||||||
|
|
||||||
void ws2811LedStripHardwareInit(void) {}
|
void ws2811LedStripHardwareInit(void) {}
|
||||||
void ws2811LedStripDMAEnable(void) {}
|
void ws2811LedStripDMAEnable(void) {}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue