How to use Rpi4B to control multiple ADS1115 I2C ADCs, using PCA9546/TCA9548A I2C Multiplexer?
(1) PCA9645 Datasheet Section 6.1 explains the device slave address is 0x70 to 0x77. In other words, 7 PCA9645s can be placed on the same I2C bus. You use A2, A2, A0 address decode pins/bits to select which PCA9685 device (not channel) to use. The 8 PCA9685s are A2, A1, A0 hardwired with each unique combination, Gnd, Gnd, Gnd to Vcc, Vcc, Vcc as addresses 0x70 to 0x77. The link I suggested you in my very first comment for reference is for PCF8574 which also has A2, A1, A0 and use the same device address decoding trick. So you should find it helpful, well, hopefully.
(2) PCA9645 Datasheet Section 6.2 and 6.2.1 explains how to select one of the 4 mux channels of any particular device. In your case of 4 ADS1115s, each connected to 1 of the 4 PCA9645 channels, you use the control register's 4 bits B3, B2, B1, B0 to select which channel, therefore which ADC1115 to use.
(3) You code sets I2C speed to 1,000,000 Hz = 1MHz which is a bit too high. My experiment for Rpi4B is that I2C 800kHz is about the upper limit, beyond than that the transmission is not longer stable. You will get I/O error messages.
(4) For Rpi3B, actually there is a known/confirmed hardware/firmware bug and you CANNOT set the I2C speed, even "official" doc says otherwise. In other words, Rpi3B I2C speed is a flat 100kHz, no matter what you try to do. For Rpi4B buster, you can set I2C speed from as low as 10kHz to perhaps 800kHz, at which speed, system gets unstable.
(5) AdaFruit's ADS1115 library might be outdated. They said they no longer support Rpi and only entertains CircuitPython which is compatible to a long hardware/SBC/MCU list which sadly does NOT include Rpi. You need to search other GitHub blogs which modifies AdaFruit's library to make it Rpi compatible. But those blogs are usually maintained by one guys, or a small group of guys which might not provide enough doc.
(6) Since AdaFruit and SparkFun used to support Arduino and now only biased to CircuitPython, their Rpi tutorials and libraries are often only applicable to the old Rpi1/2. Rpi3 is often not supported, not to mention Rpi4.
(7) Another shop that supports Rpi is Pimoroni. You might search their Rpi friendly tutorials in case you find AdaFruit library not up to date for your Rpi3/4.
(8) I hope I have answered your two questions. Please let me know if there is still things not clear.
(9) You code on ADS1115 is AdaFruit only, so might not work with Rpi. You might try again without PCA9654, and ask another question specific to ADS1115 but not PCA9654, I will try to see if I can help. Happy python programming and cheers! :)
(1) ADS1115 Datasheet - TI
(2) AdaFruit ADS1115 Module Overview - AdaFruit
(3) AdaFruit ADS1115 Module Features - AdaFruit
(4) Adafruit 4-Channel ADC Breakouts Tutorial - Bill Earl, AdaFruit (Page 7 of 24 on I2C Adressing
(5) How to interface more than 10x ADS1115 a raspberry pi? - Rpi StackExchange Q&A
(6) PCA9546A 4-channel I2C-bus switch with reset - NXP
(7) TCA9548A Low Voltage 4-Channel I2C and SMBus Switch with Reset Function - TI
Appendix A - ADS1115 Clever I2C Device Addressing
Actually ADS111s has a very clever way of device addressing, which I have not seen in other devices. Usually you need 3 address pins to decode 8 devices, and 2 address pins to decode 4 devices. But this ADS1115 can do the following:
USE ONLY ONE PIN (CALLED ADR) TO DECODE/SELECT 4 ADS1115 DEVICES,
as explain below:
Adafruit 4-Channel ADC Breakouts Created by Bill Earl Page 7 of 24
I2C Addressing The ADS11x5 chips have a base 7-bit I2C address of 0x48 (1001000) and a clever addressing scheme that allows four different addresses using just one address pin (named ADR for ADdRess). To program the address, connect the
address pin as follows:
0x48 (1001000) ADR -> GND,
0x49 (1001001) ADR -> VDD,
0x4A (1001010) ADR -> SDA,
0x4B (1001011) ADR -> SCL
Appendix B - TCA9548A Summary
TCA9546A Low Voltage 4-Channel I2C and SMBus Switch with Reset Function - TI