This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can I disable a button __interrupt dynamicly, and swich it back again?

I know the default button 1 __interrupt is on p0_1

AND it works because of blow function.

HAL_ISR_FUNCTION( halKeyPort0Isr, P0INT_VECTOR )
{
  if (HAL_KEY_SW_6_PXIFG & HAL_KEY_SW_6_BIT)
  {
    halProcessKeyInterrupt();
  }

  /*
    Clear the CPU interrupt flag for Port_0
    PxIFG has to be cleared before PxIF
  */
  HAL_KEY_SW_6_PXIFG = 0;
  HAL_KEY_CPU_PORT_0_IF = 0;
}

Now I  wonder Can I  suddenly disable the p0_1's button function and change it to other stuff in my program,

Then Get it back to work as a button again?

Such as I send a string command over air to my zigbee router ,which is from the coordinator,   it will disable p0_1 to other functions

Then I can send a string command again to my zigbee to get  p0_1 back to work as  the button 1 as  before?

Thanks

btw:

Can I also change the ADC default pin ? which is on p0.

  • kidd dexter said:

    Now I  wonder Can I  suddenly disable the p0_1's button function and change it to other stuff in my program,

    Then Get it back to work as a button again?

    It can be done... you can dynamically disable interrupt on P0_1 (and any other GPIO if you like)

    then if() else() condition is the ultimate solution for your question.
     

    kidd dexter said:
    Can I also change the ADC default pin ? which is on p0.

    If you mean whether ADC sampling port can be changed from P0 to other port/s, the answer is

    no, it can not be done. However, if you asking whether ADC input on P0 can be changed to

    other pin please refer to cc253x/4x guide, section 7.

  • Thanks man!

    So is there a hit ,to show me ,How to disable button  interrupt on P0_1 ?

  • Well, basically if P0_1 is configured to catch interrupts, then disabling interrupts on this

    pin would be to change P0IEN in the following way:

    P0IEN &= ~0x02;