mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
Fix unit test - ws2811 removed as platform specific
This commit is contained in:
parent
81a1deddfc
commit
0b6428beac
2 changed files with 3 additions and 101 deletions
|
@ -311,12 +311,13 @@ batteryState_e getBatteryState(void)
|
||||||
return BATTERY_OK;
|
return BATTERY_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ws2811LedStripInit(ioTag_t ioTag)
|
void ws2811LedStripInit(ioTag_t ioTag, ledStripFormatRGB_e ledFormat)
|
||||||
{
|
{
|
||||||
UNUSED(ioTag);
|
UNUSED(ioTag);
|
||||||
|
UNUSED(ledFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ws2811UpdateStrip(ledStripFormatRGB_e, uint8_t) {return true;}
|
bool ws2811UpdateStrip(uint8_t) {return true;}
|
||||||
|
|
||||||
void setLedValue(uint16_t index, const uint8_t value)
|
void setLedValue(uint16_t index, const uint8_t value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,99 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of Cleanflight.
|
|
||||||
*
|
|
||||||
* Cleanflight is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* Cleanflight is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include <limits.h>
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include "build/build_config.h"
|
|
||||||
|
|
||||||
#include "common/color.h"
|
|
||||||
|
|
||||||
#include "drivers/light_ws2811strip.h"
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "unittest_macros.h"
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
uint32_t simulatedTime = 0;
|
|
||||||
uint32_t micros(void) { return simulatedTime; }
|
|
||||||
void updateLEDDMABuffer(ledStripFormatRGB_e ledFormat, rgbColor24bpp_t *color, unsigned ledIndex);
|
|
||||||
void schedulerIgnoreTaskExecTime(void) {}
|
|
||||||
void schedulerIgnoreTaskStateTime(void) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(WS2812, updateDMABuffer)
|
|
||||||
{
|
|
||||||
// given
|
|
||||||
rgbColor24bpp_t color1 = { .raw = {0xFF,0xAA,0x55} };
|
|
||||||
|
|
||||||
// when
|
|
||||||
updateLEDDMABuffer(LED_GRB, &color1, 0);
|
|
||||||
|
|
||||||
// and
|
|
||||||
uint8_t byteIndex = 0;
|
|
||||||
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 0]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_0, ledStripDMABuffer[(byteIndex * 8) + 1]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 2]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_0, ledStripDMABuffer[(byteIndex * 8) + 3]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 4]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_0, ledStripDMABuffer[(byteIndex * 8) + 5]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 6]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_0, ledStripDMABuffer[(byteIndex * 8) + 7]);
|
|
||||||
byteIndex++;
|
|
||||||
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 0]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 1]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 2]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 3]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 4]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 5]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 6]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 7]);
|
|
||||||
byteIndex++;
|
|
||||||
|
|
||||||
EXPECT_EQ(BIT_COMPARE_0, ledStripDMABuffer[(byteIndex * 8) + 0]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 1]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_0, ledStripDMABuffer[(byteIndex * 8) + 2]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 3]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_0, ledStripDMABuffer[(byteIndex * 8) + 4]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 5]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_0, ledStripDMABuffer[(byteIndex * 8) + 6]);
|
|
||||||
EXPECT_EQ(BIT_COMPARE_1, ledStripDMABuffer[(byteIndex * 8) + 7]);
|
|
||||||
byteIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
rgbColor24bpp_t* hsvToRgb24(const hsvColor_t *c)
|
|
||||||
{
|
|
||||||
UNUSED(c);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ws2811LedStripHardwareInit(ioTag_t ioTag)
|
|
||||||
{
|
|
||||||
UNUSED(ioTag);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ws2811LedStripDMAEnable(void) {}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue