How to enable and disable keypad scanning in runtime?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
dheeraj20231
Level 1
Level 1
10 replies posted 10 sign-ins 5 replies posted

I am using custom hardware and I perfectly run HID LE Remote example from CYBLE 303472 EVAL M2B BSP.

I also get input from keypad and send to the HID over BLE.

Now I want to disable keypad scanning in runtime for low power consumption and when I get GPIO interrupt  that I want to enable keypad scanning.

 I Try call below function in runtime (one by one and together)

wiced_hal_keyscan_turnOff();
kscan_shutdown();

But keypad scanning is still running.

 

 

 

0 Likes
1 Solution

Hi dheeraj

 

Sorry for replying so late.

kscan_shutdown()  was used for low battery and should disable the interrupt to complete the process. I saw you enabled the interrupt again. The key scan should not cost much current, could you please share your occupied current and excepted current?

 

BR

Sven

View solution in original post

0 Likes
5 Replies
Sven_Wang
Moderator
Moderator
Moderator
250 sign-ins 50 solutions authored 25 solutions authored

Hi @dheeraj20231 

 

Could you reproduce it in the CYBLE 303472 EVAL M2B rather than custom hardware?

 

Thanks

Sven

0 Likes
dheeraj20231
Level 1
Level 1
10 replies posted 10 sign-ins 5 replies posted

Hi, I also test same thing by CYBLE 303472 EVAL M2B evalution kit and this is not working.

I Tried with GPIO pull up disable and enable in runtime.

After Disable pull by following line, my keypad is not send data om terminal, that means it was disable. and than enable it was working again.

Disable :wiced_hal_gpio_configure_pin(WICED_P00, GPIO_PULL_UP_DOWN_NONE, GPIO_PIN_OUTPUT_LOW);

Enable: wiced_hal_gpio_configure_pin(WICED_P00, GPIO_PULL_UP, GPIO_PIN_OUTPUT_HIGH);

But I don't  know why below pre defined function is not working

wiced_hal_keyscan_turnOff();
kscan_shutdown();

0 Likes
Sven_Wang
Moderator
Moderator
Moderator
250 sign-ins 50 solutions authored 25 solutions authored

Hi @dheeraj20231 

 

You need to disable interrupts at the same time. 

 

    kscan_shutdown();
        // Disable Interrupts
    wiced_hal_mia_enable_mia_interrupt(FALSE);
    wiced_hal_mia_enable_lhl_interrupt(FALSE);
 
Like the APP_shutdown.
Even so, I was confused why you want to save energy at the runtime. The electric current cost should be lower than MCU and RF parts.
 
Thanks
Sven

 

0 Likes

Hi Sven,

Thanks for the reply. I tried above solution.

--------------For disable keypad  -------------------------

    kscan_shutdown();
        // Disable Interrupts
    wiced_hal_mia_enable_mia_interrupt(FALSE);
    wiced_hal_mia_enable_lhl_interrupt(FALSE);
 
--------------For Enable keypad  -------------------------
    wiced_hal_mia_enable_mia_interrupt(TRUE);
    wiced_hal_mia_enable_lhl_interrupt(TRUE);
 
But my keypad is not disable , it was send data to HID.
0 Likes

Hi dheeraj

 

Sorry for replying so late.

kscan_shutdown()  was used for low battery and should disable the interrupt to complete the process. I saw you enabled the interrupt again. The key scan should not cost much current, could you please share your occupied current and excepted current?

 

BR

Sven

0 Likes