Hi, I'm wondering if I can use BME to know the state of a pin of a port but without to modify the value.
ex:
if((GPIOC_PDIR & 0x40)){...
..
}
Thank you.
Hello Stefano:
What do you mean about reading without modifying?
When you read the GPIOx_PDIR register, the values remain, they are not mofidied. Or could you explain a little more please?.
Regards!
Jorge Gonzalez
Hi Jorge, to know the level of ptc6 I need to do (GPIOC_PDIR & 0x40) that is an AND-bit operation. I wonder if I can avoid to do this operation by BME getting the value of ptc6 immediatelly.
Thank you.
Hello Stefano:
I had this answer pending for you. I searched and found that it is possible to read one or more bits of a determined peripheral with BME. In fact, there are some example source codes in the KL25_SC package. I guess you have it, but in any case here is the link:
FRDM-KL25Z: Freescale Freedom Development Platform for Kinetis KL14/15/24/25 MCUs
There is a header file called "bme,h" which contains macros with the bit manipulation functions. For the case you mentioned, the reading of the bit would be something like this:
rdata = BME_UBFX_W(&GPIOC_PDIR, 0x6, 0x1); // rdata is the variable in which you store the PTC6 value
I am also attaching a presentation with more info regarding BME.
Regards!
Jorge Gonzalez