Tested on a avr128da48 and avr128db64. TWI1 is mostly working fine. Had some issues with pin configuration, should be fixed now in the PR. Have tested in non-dual mode with usePullups, pins and swap in all the configurations. I've tested against a range of other devices with I2C interfaces and in a loopback on the da48, where Wire1 was acting as the master and Wire as the slave.
I've not touched on anything with dual mode yet, I imagine you would have to add an extra if statement for every pin configuration?
Changes
More use of group masks.
Corrected some masks in TWI1_Pins.
Removed badArgs call in TWI0_Pins and TWI1_Pins. This is due to how Wire::pins is setup. If we use Wire1, the pins one configures with Wire::pins will always be checked against both TWI0 and TWI1 during compile time and thus fail. I don't know if there is a good way to do this. No
Changed to temp == 8 in TWI1_usePullups since we want to check for if we are in configuration 0x2 << 2 for TWI1
Tested on a avr128da48 and avr128db64. TWI1 is mostly working fine. Had some issues with pin configuration, should be fixed now in the PR. Have tested in non-dual mode with usePullups, pins and swap in all the configurations. I've tested against a range of other devices with I2C interfaces and in a loopback on the da48, where Wire1 was acting as the master and Wire as the slave.
I've not touched on anything with dual mode yet, I imagine you would have to add an extra if statement for every pin configuration?