i2c Register Auto-increment support #10
-
Can EasyMCP2221 use the i2c register auto increment feature? For example the PCA9685 supports this feature by setting MODE1 register bit 5 to "True". |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
Yes, with EasyMCP2221 you can set the PCA9685's MODE1 register bit 5 to "True". |
Beta Was this translation helpful? Give feedback.
-
In auto increment you can write to successive registers by specifying only the first register index. You do not have to specify subsequent reqister indecies. For example of the PCA9685 if you write an i2c packet with the device address followed by register 0x16 followed by 4 Bytes followed by the stop flag you will have programmed LED 4 with the "ON" low and high bytes and the "OFF" bytes low and high bytes, in other words registers 0x16, 0x17, 0x18 & 0x19 from the same i2c packet (as long as "auto-increment" flag (register 1 bit 5) is set. This has saved 3 seperate i2c transactions. It is a feature of i2c. I can't see how to do it in EASYMCP2221. |
Beta Was this translation helpful? Give feedback.
-
Hello. I'm sorry, I still don't get your question. But you can review this example: examples/ledbar. It also uses the PCA9685 chip. The final result is shown in a GIF at the end of this post: El integrado MCP2221/A. |
Beta Was this translation helpful? Give feedback.
-
Yes, EasyMCP2221 does support automatic increment Line 115: v is a 4 bytes (effectively). It gives me enough to go on thank you. P. |
Beta Was this translation helpful? Give feedback.
-
Perfect! Thank you. |
Beta Was this translation helpful? Give feedback.
Yes, EasyMCP2221 does support automatic increment
from examples/ledbar/PCA9685.py
Line 27: AI = 1<<5 (AI = "AutoIncrement")
Line 115:
if update:
timer_on, timer_off = self.calculate_timers(duty, delay)
v = [
timer_on % 256,
int(timer_on / 256),
timer_off % 256,
int(timer_off / 256)
]
self.pca.write_register(self.LED0_ON_L + 4*led, v)
v is a 4 bytes (effectively).
It gives me enough to go on thank you.
P.