You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At first please excuse my bad english cause I'm an old native speaken german who learnd english 50 years ago. So, I think, sentences in grammar and in vocabulary is wrong and I hope you understand nonetheless.
If you initialisize a GPIO-Pin for Input/Output we must use registers PADIER and PBDIER. Stupidly these registers are writ-we-only so we can't do a read-modify-write -back operation.
Your code
PADIER |= (1 << BTN_BIT); // Enable Button as digital input
has function, cause this is the first and only time where you are modifying the PADIER register.
If I modify GPIO-pins (for example driving an I2C data-line, switching between input and output), I only modify an external variable called "PADIER_tmp" and doing every modifying to this variable by afterwards writing to the register
volatile uint8_t PADIER_tmp = 0xf9; // Bits 2 -1 could be keep 00 for future compatibilty
PADIER_tmp |= (1 << BTN_BIT); // set as input
PADIER= PADIER_tmp;
.
.
PADIER_tmp &= ~(1 << BTN_BIT);
PADIER= PADIER_tmp;
Nice greetings
JJ
The text was updated successfully, but these errors were encountered:
Hi JJ, can you submit a pull request, if you already found the solution?
Hi cpldcpu, as you know, I'm not the "hero" in english language and I'm surely not the "hero" by doing things in github (and shame on me: I don't know how to do a pull request in github). The solution to the bug is given in the posting (writing the value tu a global variable, do a read-modify-writeback operation to the variable and write the variable value to PADIER / PBDIER).
At first please excuse my bad english cause I'm an old native speaken german who learnd english 50 years ago. So, I think, sentences in grammar and in vocabulary is wrong and I hope you understand nonetheless.
If you initialisize a GPIO-Pin for Input/Output we must use registers PADIER and PBDIER. Stupidly these registers are writ-we-only so we can't do a read-modify-write -back operation.
Your code
PADIER |= (1 << BTN_BIT); // Enable Button as digital input
has function, cause this is the first and only time where you are modifying the PADIER register.
If I modify GPIO-pins (for example driving an I2C data-line, switching between input and output), I only modify an external variable called "PADIER_tmp" and doing every modifying to this variable by afterwards writing to the register
volatile uint8_t PADIER_tmp = 0xf9; // Bits 2 -1 could be keep 00 for future compatibilty
PADIER_tmp |= (1 << BTN_BIT); // set as input
PADIER= PADIER_tmp;
.
.
PADIER_tmp &= ~(1 << BTN_BIT);
PADIER= PADIER_tmp;
Nice greetings
JJ
The text was updated successfully, but these errors were encountered: