I am using a Qt Py ESP32-S2 and trying to read the state of lots of pins connected to a ATtiny817 Breakout with seesaw.
I have no problems when using individual seesaw digitalRead() functions for each pin, but I seems quite slow, and means lots of lines of code.
In the documentation there is a digitalReadBulk() function, but I am having some trouble understanding how to use it. It gives an example of passing 0b0110 to return the values of pins 2 and 3. If pin 2 is high and pin 3 is low, 0b0010 will be returned.
It works as described, and I understand that the leading 0b means that the number is being represented as a binary, and when I adjust pins 2 and 3 the returned value switches between 0b0110, 0b0100, 0b0010, 0b000 depending on the switch state as expected.
What I am not sure about is where the initial 0b0110 comes from and what I should change it to if I wanted to read the values of different pins. What would I need to pass to read from pin 6? or from pins 0, 1, and 2?
How to use ATtiny817 Seesaw digitalReadBulk
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- jordancormack
- Posts: 2
- Joined: Fri Oct 07, 2022 9:05 pm
- adafruit_support_carter
- Posts: 29483
- Joined: Tue Nov 29, 2016 2:45 pm
Re: How to use ATtiny817 Seesaw digitalReadBulk
The parameter is a bitbask. The binary literal is used to make creating the mask easier to read. Put a 1 in the bit location for any pin of interest.
Please be positive and constructive with your questions and comments.