Hi all,
Playing with the Teensy 4.0 which is my first adventure in something non-AVR. Looks like the whole concept of PORTA, PORTB, etc doesn't apply anymore, and I'm curious how I can go about reading pins in one call (therefore, no digitalRead). Also I already know what pins are for what, so I don't want to burn bunch of CPU time in the digitalRead method with the whole -if-then-else nature of the function.
Right now I have:
etc....
However this obviously still burns a lot of CPU cycles. Is there way to get the whole register of values for all 39 pins and mask out what I need in one swoop? I know in AVR world I could read the whole PORT at once.
Thanks!
Playing with the Teensy 4.0 which is my first adventure in something non-AVR. Looks like the whole concept of PORTA, PORTB, etc doesn't apply anymore, and I'm curious how I can go about reading pins in one call (therefore, no digitalRead). Also I already know what pins are for what, so I don't want to burn bunch of CPU time in the digitalRead method with the whole -if-then-else nature of the function.
Right now I have:
Code:
d_r[0][col] = (CORE_PIN0_PINREG & CORE_PIN0_BITMASK) ? 1 : 0;
d_r[1][col] = (CORE_PIN1_PINREG & CORE_PIN1_BITMASK) ? 1 : 0;
d_r[2][col] = (CORE_PIN2_PINREG & CORE_PIN2_BITMASK) ? 1 : 0;
d_r[3][col] = (CORE_PIN3_PINREG & CORE_PIN3_BITMASK) ? 1 : 0;
d_r[4][col] = (CORE_PIN4_PINREG & CORE_PIN4_BITMASK) ? 1 : 0;
However this obviously still burns a lot of CPU cycles. Is there way to get the whole register of values for all 39 pins and mask out what I need in one swoop? I know in AVR world I could read the whole PORT at once.
Thanks!