Hello, I am modifying Ride 7 ''Toggle" example program which works without circle OS. I want that this program should work like this:
When no buttons pressed: LEDs just blinking.
When button pressed (main or one of joystick): Stop blinking. LEDs are ON.
Now I have a situation then LEDs stops blinking only then main buttton is pressed. When I press joystick button (left for example) - LED's still blinking.
Any suggestions?
Main part of code:
while ( 1 )
{
do
{
bpinput = (( GPIO_ReadInputData( BP_GPIO ) ) & ( BP_PIN ) );
if ( bpinput )
GPIO_Write( LEDS_GPIO, ( 1 & LEDS_BOTH_PINS ) );
}
while ( bpinput );
jstkinput = ( (GPIO_ReadInputData(JSTK_GPIO)) & ( JSTK_ALL_PINS ) );
jstkinput = (( u16 )JSTK_GPIO->IDR ) & ( JSTK_ALL_PINS );
switch ( jstkinput & ( JSTK_ALL_PINS ) )
{
case GPIO_Pin_3:
GPIO_Write( LEDS_GPIO, ( 1 & LEDS_BOTH_PINS ) );
break;
case GPIO_Pin_4:
GPIO_Write( LEDS_GPIO, ( 1 & LEDS_BOTH_PINS ) );
break;
case GPIO_Pin_5:
GPIO_Write( LEDS_GPIO, ( 1 & LEDS_BOTH_PINS ) );
break;
case GPIO_Pin_6:
GPIO_Write( LEDS_GPIO, ( 1 & LEDS_BOTH_PINS ) );
break;
default :
//no buttons are pressed
//just go on toggling
break;
}
// Toggle LEDs
GPIO_Write( LEDS_GPIO, ( toggle & LEDS_BOTH_PINS ) );
// increment Toggle variable
toggle++;
// Insert delay
Delay( delayvar );
}
}