File tree Expand file tree Collapse file tree 2 files changed +14
-11
lines changed
Expand file tree Collapse file tree 2 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 1- /* Copyright (c) 2020-2021 , Collab
1+ /* Copyright (c) 2020-2023 , Collab
22 * All rights reserved
33*/
44
55#include < MultiPlexer_PCF8574.h>
66
7- MultiPlexer_PCF8574::MultiPlexer_PCF8574 (uint8_t address, uint8_t sda, uint8_t scl) {
8- _sdaPin = sda;
9- _sclPin = scl;
10- _expander = new PCF8574 (address);
7+ MultiPlexer_PCF8574::MultiPlexer_PCF8574 (uint8_t address, TwoWire* wire) {
8+ _expander = new PCF8574 (address, wire);
119}
1210
1311bool MultiPlexer_PCF8574::begin () {
14- return _expander->begin (_sdaPin, _sclPin);
12+ bool expanderReady = _expander->begin ();
13+ if (!expanderReady) {
14+ Log.warning (F (" PCF8574 could not initialize!" CR));
15+ }
16+ if (!isConnected ()) {
17+ Log.warning (F (" PCF8574 not connected!" CR));
18+ }
19+ return expanderReady;
1520}
1621
1722bool MultiPlexer_PCF8574::isConnected () {
Original file line number Diff line number Diff line change 1- /* Copyright (c) 2020-2021 , Collab
1+ /* Copyright (c) 2020-2023 , Collab
22 * All rights reserved
33*/
44/*
88#define MultiPlexer_PCF8574_h
99
1010#include < Arduino.h>
11- #include < Method.h>
1211#include < PCF8574.h>
12+ #include < ArduinoLog.h>
1313
1414class MultiPlexer_PCF8574
1515{
1616 public:
17- MultiPlexer_PCF8574 (uint8_t address, uint8_t sda, uint8_t scl );
17+ MultiPlexer_PCF8574 (uint8_t address, TwoWire* wire = &Wire );
1818 bool begin ();
1919 bool isConnected ();
2020 void digitalWrite (uint8_t pin, uint8_t value);
2121 uint8_t digitalRead (uint8_t pin);
2222
2323 private:
2424 PCF8574* _expander;
25- uint8_t _sdaPin;
26- uint8_t _sclPin;
2725};
2826
2927#endif
You can’t perform that action at this time.
0 commit comments