GCC Code Coverage Report


Directory: ./
File: channeloutput/PCF8574.h
Date: 2026-10-29 08:11:58
Exec Total Coverage
Lines: 3 3 100.0%
Functions: 1 1 100.0%
Branches: 0 0 -%

Line Branch Exec Source
1 #pragma once
2 /*
3 * This file is part of the Falcon Player (FPP) and is Copyright (C)
4 * 2013-2022 by the Falcon Player Developers.
5 *
6 * The Falcon Player (FPP) is free software, and is covered under
7 * multiple Open Source licenses. Please see the included 'LICENSES'
8 * file for descriptions of what files are covered by each license.
9 *
10 * This source file is covered under the GPL v2 as described in the
11 * included LICENSE.GPL file.
12 */
13
14 #include "ChannelOutput.h"
15 #include "fpp-json-fwd.h"
16 #include "util/I2CUtils.h"
17
18 class PCF8574Output : public ChannelOutput {
19 public:
20 PCF8574Output(unsigned int startChannel, unsigned int channelCount);
21 virtual ~PCF8574Output();
22
23 virtual int Init(Json::Value config) override;
24 virtual int Close(void) override;
25
26 virtual int SendData(unsigned char* channelData) override;
27
28 virtual void DumpConfig(void) override;
29
30 2 virtual void GetRequiredChannelRanges(const std::function<void(int, int)>& addRange) override {
31 2 addRange(m_startChannel, m_startChannel + m_channelCount - 1);
32 2 }
33
34 private:
35 I2CUtils* i2c;
36
37 class PCF8574Port {
38 public:
39 unsigned char m_invert = 0;
40 unsigned char m_pinmode = 0;
41 unsigned char m_threshold = 128;
42 unsigned char m_hysteresisUpper = 192;
43 unsigned char m_hysteresisLower = 64;
44 unsigned char m_lastState = 0;
45 };
46
47 int m_deviceID;
48 PCF8574Port m_ports[8];
49 unsigned char m_pinOrderingInvert;
50 unsigned char m_lastVal = 0xFF;
51 };
52