Hello,
i'm using the Witty Pi4 l3v7 with a different board and was wondering if it is possible to eliminate the need to the GPIO connections except the I2C.
Is it possible to read the charger state (GPIO-5, GPIO-6) via an i2c register of the ATtiny?
I could also Implement this myself however i'm missing the schematic to see how the pins of the Attiny are connected to the other wittypi internals. Is it possible to get a simplified schematic of the board?
Cheers
I would suggest to make use of the I2C_CONF_RFU_3 register (with index 49). It has 8 bits and you actually only need 2 of them to keep the state. This register is currently not used by anyone else, so it is pretty suitable for such use case.
You will need to modify the current software or implement your own software to read the state of GPIO-5 and GPIO-6, and save the result to I2C register #49.
Thanks for pointing me to the I2C_CONF_RFU_3 register. I had a similar idea of using one of the RFU registers, however is there documentation available how to read the GPIO-5 or GPIO-6 state from within the ATtiny?
@mastalee That is not a correct direction. The MCU (ATtiny841) doesn't have physical access to other GPIOs on Raspberry Pi. There is no way it can read the GPIO-5 or GPIO-6 state directly.
If you want to tell the MCU to remember the state of GPIO-5 and GPIO-6, this job needs to be done by a software running on Raspberry Pi, who can read all GPIOs in the PI and can write the I2C registers in Witty Pi's MCU.
thanks for clarification.
Are all the gpio pins on the attiny used or are there some free ones?
@mastalee Yes, they are all used.
See here: https://github.com/uugear/Witty-Pi-4/blob/main/Firmware/WittyPi4_L3V7/WittyPi4_L3V7.ino#L18-L34
ATtiny841 has 11 usable GPIO pins and they are all assigned already.