File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change 44
55#include " MultiPlexer_TCA9548A.h"
66
7+ TwoWire twire = TwoWire(1 );
8+
79MultiPlexer_TCA9548A::MultiPlexer_TCA9548A (int i2c_addr) {
810 _mux = new TCA9548A (i2c_addr);
911}
1012
11- void MultiPlexer_TCA9548A::begin () {
12- _mux->begin (Wire); // TwoWire instance can be passed here as 3rd argument
13- _mux->closeAll (); // Set a base state which we know (also the default state on power on)
14- changeBus (0 ); // tell the TCA9548A we want to use I2C bus number zero (to talk to the OLED)
13+ void MultiPlexer_TCA9548A::begin (int sda_pin, int scl_pin) {
14+ _mux->begin (twire, sda_pin, scl_pin);
15+
16+ // set a base state which we know (also the default state on power on)
17+ _mux->closeAll ();
18+
19+ // tell the TCA9548A we want to use I2C bus number zero (to talk to the OLED)
20+ openChannel (0 );
1521}
1622
17- void MultiPlexer_TCA9548A::changeBus (uint8_t bus_nr) {
23+ void MultiPlexer_TCA9548A::openChannel (uint8_t bus_nr) {
1824 _mux->openChannel (bus_nr);
1925}
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ class MultiPlexer_TCA9548A
1212{
1313 public:
1414 MultiPlexer_TCA9548A (int i2c_addr = 0x70 );
15- void begin ();
16- void changeBus (uint8_t bus_nr);
15+ void begin (int sda_pin, int scl_pin );
16+ void openChannel (uint8_t bus_nr);
1717
1818 private:
1919 TCA9548A* _mux;
You can’t perform that action at this time.
0 commit comments