Skip to main content
Associate II
Oct 16, 2023 5:23 AM UTC
Question

unable to read port memory

  KeyInputMemory[column_count] = (uint16_t)(GPIOB->IDR);

       uint16_t mask = 0x0FFF;

       KeyInputMemory[column_count] &= mask;

 

    if (KeyInputMemory[column_count] == StoredKeyInput[column_count]) {  //

 

        KeyInputCounter[column_count]++;

        if (KeyInputCounter[column_count] > 5) {

        

            StoredKeyInput[column_count] = KeyInputMemory[column_count];

 

            // Reset the counter

          //KeyInputCounter[column_count] = 0;

        }

 

    } else {

        // Store the current key input into the column stored key input

        StoredKeyInput[column_count] = KeyInputMemory[column_count];

 

        // Clear the key input count

        KeyInputCounter[column_count] = 0;

 

        //EXIT

        return;

    } I have physical keyboard i have to read b port but not detecting is my logic is true or false....... whenever key is pressed not reading the values

This topic has been closed for replies.

2 replies

ST Technical Moderator
Oct 16, 2023 10:41 AM UTC

Hello @Girish1 

 

Would you provide more details about the issue? If possible, add more context about your Hardware setup, attach your IOC file/configuration.

 

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
TDK
Oct 16, 2023 2:23 PM UTC

The code doesn't make a whole lot of sense here. You're comparing 12 different bits in the code. I suspect you want to look at a single bit instead.

Suggest using HAL_GPIO_ReadPin instead if you're not comfortable with bitwise manipulation.

"If you feel a post has answered your question, please click ""Accept as Solution""."