MCPcopy Create free account
hub / github.com/FastLED/FastLED / FL_TEST_FILE

Function FL_TEST_FILE

tests/fl/channels/adapters/spi_channel_adapter.cpp:17–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15#include "platforms/shared/spi_hw_base.h"
16
17FL_TEST_FILE(FL_FILEPATH) {
18
19using namespace fl;
20
21namespace {
22
23/// @brief Simple mock SPI hardware controller for testing
24/// Simulates SpiHwBase without actual hardware transmission
25class MockSpiHw : public SpiHwBase {
26public:
27 explicit MockSpiHw(uint8_t laneCount = 1, const char* name = "MOCK_SPI", int priority = 5)
28 : mLaneCount(laneCount), mName(name) {
29 (void)priority; // Unused, just for API compatibility
30 }
31
32 // SpiHwBase interface
33 bool begin(const void* config) override {
34 mBeginCalled = true;
35 mInitialized = true;
36 return mBeginReturnValue;
37 }
38
39 void end() override {
40 mEndCalled = true;
41 mInitialized = false;
42 }
43
44 DMABuffer acquireDMABuffer(size_t size) override {
45 mAcquireBufferCalled = true;
46 if (size > mDmaBuffer.size()) {
47 mDmaBuffer.resize(size);
48 }
49 // Return a DMABuffer constructed with size
50 return DMABuffer(size);
51 }
52
53 bool transmit(TransmitMode mode = TransmitMode::ASYNC) override {
54 mTransmitCalled = true;
55 mTransmitCount++;
56 mTransmitMode = mode;
57 if (mode == TransmitMode::ASYNC) {
58 mBusy = true;
59 }
60 return mTransmitReturnValue;
61 }
62
63 bool waitComplete(uint32_t timeout_ms = fl::numeric_limits<uint32_t>::max()) override {
64 (void)timeout_ms;
65 mWaitCompleteCalled = true;
66 mBusy = false;
67 return mWaitCompleteReturnValue;
68 }
69
70 bool isBusy() const override {
71 return mBusy;
72 }
73
74 bool isInitialized() const override {

Callers

nothing calls this directly

Calls 15

createFunction · 0.85
getPriorityMethod · 0.80
setBusIdMethod · 0.80
wasTransmitCalledMethod · 0.80
wasWaitCompleteCalledMethod · 0.80
completeTransmissionMethod · 0.80
isInUseMethod · 0.80
createSpiChannelDataFunction · 0.70
stringClass · 0.50
getNameMethod · 0.45
canHandleMethod · 0.45

Tested by

no test coverage detected