Esempio n. 1
0
static void check_state_timer_handler( void* arg )
{
    gpio_keypad_internal_t* keypad = (gpio_keypad_internal_t*)arg;

    if ( keypad != NULL )
    {
        gpio_key_internal_t* key = keypad->current_key_pressed;

        if ( key != NULL )
        {
            if ( key->key->polarity == KEY_POLARITY_HIGH )
            {
                if ( wiced_gpio_input_get( key->key->gpio ) == 0 )
                {
                    wiced_rtos_send_asynchronous_event( keypad->thread, key_held_event_handler, (void*)key );
                }
                else
                {
                    wiced_rtos_send_asynchronous_event( keypad->thread, key_released_event_handler, (void*)key );
                }
            }
            else
            {
                if ( wiced_gpio_input_get( key->key->gpio ) == 1 )
                {
                    wiced_rtos_send_asynchronous_event( keypad->thread, key_held_event_handler, (void*)key );
                }
                else
                {
                    wiced_rtos_send_asynchronous_event( keypad->thread, key_released_event_handler, (void*)key );
                }
            }
        }
    }
}
Esempio n. 2
0
// executed on main run loop
static wiced_result_t h4_main_deliver_packet(void *arg){
    // deliver packet
    packet_handler(hci_packet[0], &hci_packet[1], rx_worker_read_pos-1);
    // trigger receive of next packet
    wiced_rtos_send_asynchronous_event(&rx_worker_thread, &h4_rx_worker_receive_packet, NULL);    
    return WICED_SUCCESS;
}
Esempio n. 3
0
static void spi_slave_ready_pin_irq_handler( void* arg )
{
    spi_master_t* master = (spi_master_t*)arg;

    if ( master->in_transaction == WICED_TRUE )
    {
        wiced_rtos_set_semaphore( &master->data_ready_semaphore );
    }
    else
    {
        wiced_rtos_send_asynchronous_event( WICED_NETWORKING_WORKER_THREAD, spi_slave_data_ready_worker_callback, arg );
    }
}
Esempio n. 4
0
static void gpio_interrupt_key_handler( void* arg )
{
    gpio_key_internal_t* key = (gpio_key_internal_t*)arg;

    if ( key != NULL )
    {
        gpio_keypad_internal_t* keypad = key->owner;
        uint32_t current_time;

        wiced_watchdog_kick( );
        wiced_time_get_time( &current_time );

        if ( ( current_time - key->last_irq_timestamp > DEBOUNCE_TIME_MS ) && ( keypad->current_key_pressed == 0 ) )
        {
            wiced_time_get_time( &key->last_irq_timestamp );
            wiced_rtos_send_asynchronous_event( keypad->thread, key_pressed_event_handler, (void*)key );
        }
    }
}