WICED_BT_TRACE( "sample_gpio_app_management_cback %d\n\r", event );
switch( event )
{
/* Bluetooth
case BTM_ENABLED_EVT:
/* Initializes the GPIO driver */
wiced_hal_mia_init( );
wiced_hal_gpio_init( );
wiced_hal_mia_enable_mia_interrupt( TRUE );
wiced_hal_mia_enable_lhl_interrupt( TRUE );
/* Sample function configures LED pin as output
gpio_test_led( );
/* Sample function configures GPIO as input. Enable interrupt.
gpio_set_input_interrupt( );
break;
default:
break;
}
return result;
}
void gpio_interrrupt_handler(void *data, uint8_t port_pin)
{
static uint32_t prev_blink_interval = APP_TIMEOUT_IN_SECONDS_A;
uint32_t curr_blink_interval = 0;
/* Get the status of interrupt on P# */
if ( wiced_hal_gpio_get_pin_interrupt_status( WICED_GPIO_BUTTON ) )
{
/* Clear the gpio interrupt */
wiced_hal_gpio_clear_pin_interrupt_status( WICED_GPIO_BUTTON );
}
/* stop the led blink timer */
wiced_stop_timer( &seconds_timer );
/* toggle the blink time interval */
curr_blink_interval = (APP_TIMEOUT_IN_SECONDS_A == prev_blink_interval)
wiced_start_timer( &seconds_timer, curr_blink_interval );
WICED_BT_TRACE("gpio_interrupt_handler : %d\n\r", curr_blink_interval);
/* update the previous blink interval */
prev_blink_interval = curr_blink_interval;
}
void gpio_set_input_interrupt( )
{
uint16_t pin_config;
/* Configure GPIO PIN# as input, pull up and interrupt on rising edge and output
* value as high (pin should be configured before registering interrupt handler )*/
wiced_hal_gpio_configure_pin( WICED_GPIO_BUTTON, WICED_GPIO_BUTTON_SETTINGS(
CYW920706WCDEVAL Hardware User Guide
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Arrow.com.
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
Downloaded from
stack enabled */
* sends a square wave on it
* if testing pin 31 then disable puart*/
* Register a call back function to handle on interrupt*/
?APP_TIMEOUT_IN_SECONDS_B:APP_TIMEOUT_IN_SECONDS_A;
GPIO_EN_INT_RISING_EDGE ), WICED_GPIO_BUTTON_DEFAULT_STATE );
Interface Programming Information and Examples
Doc. No.: 002-16535 Rev. **
37
Need help?
Do you have a question about the WICED CYW920706WCDEVAL and is the answer not in the manual?