Just think of the return value of get_key_press() as if you were making a direct read on PINC or whichever input register you have selected. The only differences are two-fold: one is that rather than ANDing after the read to pick selected bits (as you might with a direct read of PINx) you can pass a mask INTO the function to mask bits beforehand. Also the output is "special" in that unlike a direct read of PINx where you might see bits "flickering" between 0 and 1 the function "smoothes" the output so you only see "solid" 0s and 1s.
Ok, I have already integrated the code in my project. I think it's working just fine!
© 2021 Microchip Technology Inc.