Esempio n. 1
0
File: ui.c Progetto: marekr/asf
void ui_host_sof_event(void)
{
	bool b_btn_state;
	static bool btn_suspend_and_remotewakeup = false;
	static uint16_t counter_sof = 0;

	if (ui_enum_status == UHC_ENUM_SUCCESS) {
		/* Display device enumerated and in active mode */
		if (++counter_sof > ui_device_speed_blink) {
			counter_sof = 0;
			LED_Toggle(LED0);
		}

		/* Scan button to enter in suspend mode and remote wakeup */
		b_btn_state = !ioport_get_pin_level(GPIO_PUSH_BUTTON_0);
		if (b_btn_state != btn_suspend_and_remotewakeup) {
			/* Button have changed */
			btn_suspend_and_remotewakeup = b_btn_state;
			if (b_btn_state) {
				/* Button has been pressed */
				ui_enable_asynchronous_interrupt();
				LED_Off(LED0);
				uhc_suspend(true);
				return;
			}
		}

		/* Power on a LED when the mouse button down */
		if (ui_nb_down) {
			LED_On(LED0);
		}
	}
}
Esempio n. 2
0
void ui_usb_sof_event(void)
{
	bool b_btn_state;
	static bool btn_suspend = false;
	static uint16_t counter_sof = 0;

	if (ui_enum_status == UHC_ENUM_SUCCESS) {
		/* Display device enumerated and in active mode */
		if (++counter_sof > ui_device_speed_blink) {
			counter_sof = 0;
			LED_Toggle(LED1_GPIO);
			if (ui_test_done && !ui_test_result) {
				/* Test fail then blink led */
				LED_Toggle(LED0_GPIO);
			}
		}
		/* Scan button to enter in suspend mode and remote wakeup */
		b_btn_state = (!gpio_pin_is_high(GPIO_PUSH_BUTTON_1)) ?
				true : false;
		if (b_btn_state != btn_suspend) {
			/* Button have changed */
			btn_suspend = b_btn_state;
			if (b_btn_state) {
				/* Button has been pressed */
				LED_Off(LED0_GPIO);
				LED_Off(LED1_GPIO);
				LED_Off(LED2_GPIO);
				ui_enable_asynchronous_interrupt();
				uhc_suspend(true);
				return;
			}
		}
	}
}
Esempio n. 3
0
static void run_test_upstream_hs(const struct test_case *test)
{
	CHECK_EVENT_CONNECTION();
	CHECK_EVENT_ENUM_SUCCESS_HIGH_SPEEP();
	uhc_suspend(true);
	CHECK_EVENT_WAKEUP();
}
Esempio n. 4
0
static void run_test_downstream_disconnection(const struct test_case *test)
{
	uhc_suspend(false);
	delay_ms(30);
	uhc_resume();
	CHECK_EVENT_DISCONNECTION();
}
Esempio n. 5
0
static void run_test_downstream(const struct test_case *test)
{
	uhc_suspend(false);
	delay_ms(30);
	uhc_resume();
	CHECK_EVENT_WAKEUP();
}
Esempio n. 6
0
File: ui.c Progetto: Dewb/mod
void ui_usb_sof_event(void)
{
    bool b_btn_state;
    static bool btn_suspend = false;
    static uint16_t counter_sof = 0;

    if (ui_enum_status == UHC_ENUM_SUCCESS) {

        /* Display device enumerated and in active mode */
        if (++counter_sof > ui_device_speed_blink) {
            counter_sof = 0;
            if (ui_hid_mouse_plug) {
                LED_Toggle(LED0_GPIO);
            } else {
                LED_Off(LED0_GPIO);
            }
            if (ui_msc_plug) {
                LED_Toggle(LED1_GPIO);
            }
            if (ui_test_done && !ui_test_result) {
                /* Test fail then blink led */
                LED_Toggle(LED2_GPIO);
            }
        }
        /* Power on a LED when mouse move */
        if (ui_x || ui_y || ui_scroll) {
            ui_x = ui_y = ui_scroll = 0;
            LED_On(LED0_GPIO);
        }
        /* Power on a LED when mouse button down */
        if (ui_nb_down) {
            LED_On(LED0_GPIO);
        }
        /* Scan button to enter in suspend mode */
        b_btn_state = (!gpio_pin_is_high(GPIO_PUSH_BUTTON_1)) ?
                      true : false;
        if (b_btn_state != btn_suspend) {
            /* Button have changed */
            btn_suspend = b_btn_state;
            if (b_btn_state) {
                /* Button has been pressed */
                LED_Off(LED0_GPIO);
                LED_Off(LED1_GPIO);
                LED_Off(LED2_GPIO);
                LED_Off(LED3_GPIO);
                ui_enable_asynchronous_interrupt();
                uhc_suspend(true);
                return;
            }
        }
    }
}
Esempio n. 7
0
void ui_usb_sof_event(void)
{
	bool b_btn_state;
	static bool btn_suspend = false;
	static uint16_t counter_sof = 0;
	static uint16_t counter_sof_move_refresh = 0;

	if (ui_enum_status == UHC_ENUM_SUCCESS) {
		/* Display device enumerated and in active mode */
		if (++counter_sof > ui_device_speed_blink) {
			counter_sof = 0;
			if (ui_hid_mouse_plug || ui_msc_plug) {
				LED_Toggle(LED0);
			} else {
				LED_On(LED0);
			}
			if (ui_test_done && !ui_test_result) {
				/* Test fail then blink BL */
				backlight_toggle();
			}
		}
		/* Scan button to enter in suspend mode and remote wakeup */
		b_btn_state = (!ioport_get_pin_level(GPIO_PUSH_BUTTON_0)) ?
				true : false;
		if (b_btn_state != btn_suspend) {
			/* Button have changed */
			btn_suspend = b_btn_state;
			if (b_btn_state) {
				/* Button has been pressed */
				LED_Off(LED0);
				backlight_off();
				ui_enable_asynchronous_interrupt();
				uhc_suspend(true);
				return;
			}
		}

		/* Move the remote mouse pointer on the Board Monitor screen */
		if (++counter_sof_move_refresh > 100) {
			counter_sof_move_refresh = 0;
			bm_mouse_pointer_move(bm_x / 8, bm_y / 8);
		}

		/* Power on a LED when the mouse button down */
		if (ui_nb_down) {
			LED_On(LED0);
		}
	}
}
Esempio n. 8
0
File: ui.c Progetto: InSoonPark/asf
void ui_usb_sof_event(void)
{
	bool b_btn_state;
	static bool btn_suspend = false;
	static uint16_t counter_sof = 0;

	if (ui_enum_status == UHC_ENUM_SUCCESS) {
		/* Display device enumerated and in active mode */
		if (++counter_sof > ui_device_speed_blink) {
			counter_sof = 0;
			if (ui_hid_mouse_plug || ui_msc_plug) {
				LED_Toggle(LED0);
			} else {
				LED_On(LED0);
			}
			if (ui_test_done) {
				if (ui_test_result) {
					/* Test successful */
					LED_On(LED0);
				} else {
					/* Test fail */
					LED_Off(LED0);
				}
			}
		}
		/* Scan button to enter in suspend mode and remote wakeup */
		b_btn_state = (!ioport_get_pin_level(GPIO_PUSH_BUTTON_0)) ?
				true : false;
		if (b_btn_state != btn_suspend) {
			/* Button have changed */
			btn_suspend = b_btn_state;
			if (b_btn_state) {
				/* Button has been pressed */
				LED_Off(LED0);
				ui_enable_asynchronous_interrupt();
				uhc_suspend(true);
				return;
			}
		}

		/* Power on a LED when the mouse button down */
		if (ui_nb_down) {
			LED_On(LED0);
		}
	}
}
Esempio n. 9
0
File: ui.c Progetto: Mazetti/asf
void ui_host_sof_event(void)
{
	bool b_btn_state;
	static bool btn_suspend_and_remotewakeup = false;
	static uint16_t counter_sof = 0;

	if (ui_host_enum_status == UHC_ENUM_SUCCESS) {
		/* Display device enumerated and in active mode */
		if (++counter_sof == 500) {
			counter_sof = 0;
			LED_Toggle(LED0);
		}

		/* Scan button to enter in suspend mode and remote wakeup */
		b_btn_state = (!gpio_pin_is_high(GPIO_PUSH_BUTTON_1)) ?
				true : false;
		if (b_btn_state != btn_suspend_and_remotewakeup) {
			/* Button have changed */
			btn_suspend_and_remotewakeup = b_btn_state;
			if (b_btn_state) {
				/* Button has been pressed */
				LED_Off(LED0);
				LED_Off(LED1);
				ui_enable_asynchronous_interrupt();
				uhc_suspend(true);
				return;
			}
		}

		/* Power on a LED when the mouse move */
		if (!ui_host_x && !ui_host_y && !ui_host_scroll) {
			LED_Off(LED1);
		} else {
			ui_host_x = ui_host_y = ui_host_scroll = 0;
			LED_On(LED1);
		}
	}
}
Esempio n. 10
0
void ui_usb_sof_event(void)
{
	bool b_btn_state;
	static bool btn_suspend = false;
	static uint16_t counter_sof = 0;

	if (ui_enum_status == UHC_ENUM_SUCCESS) {
		/* Display device enumerated and in active mode */
		if (++counter_sof > ui_device_speed_blink) {
			counter_sof = 0;
			LED_Toggle(LED_0_PIN);
			if (ui_test_done) {
				if (ui_test_result) {
					/* Test successful */
					LED_On(LED_0_PIN);
				} else {
					/* Test fail */
					LED_Off(LED_0_PIN);
				}
			}
		}
		/* Scan button to enter in suspend mode and remote wakeup */
		b_btn_state = !port_pin_get_input_level(BUTTON_0_PIN);
		if (b_btn_state != btn_suspend) {
			/* Button have changed */
			btn_suspend = b_btn_state;
			if (b_btn_state) {
				/* Button has been pressed */
				LED_Off(LED_0_PIN);
				ui_enable_asynchronous_interrupt();
				uhc_suspend(true);
				return;
			}
		}
	}
}
Esempio n. 11
0
static void run_test_disconnection_in_suspend(const struct test_case *test)
{
	uhc_suspend(false);
	CHECK_EVENT_DISCONNECTION();
}