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;
			}
		}
	}
}
Beispiel #2
0
Datei: ui.c Projekt: 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);
		}
	}
}
Beispiel #3
0
Datei: ui.c Projekt: 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;
            }
        }
    }
}
Beispiel #4
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);
		}
	}
}
Beispiel #5
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;
			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);
		}
	}
}
Beispiel #6
0
Datei: ui.c Projekt: gstroe/Arm
void ui_usb_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(LED_YELLOW0);
		}

		/* Scan button to enter in suspend mode and remote wakeup */
		/*b_btn_state = (!gpio_pin_is_high(GPIO_PUSH_BUTTON_1)) ?
		        true : false;*/
		b_btn_state = true;

		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();
				USBH_suspend(true);
				return;
			}
		}

		/* Power on a LED when the mouse move */
		if (!ui_x && !ui_y && !ui_scroll) {
#if 2 == LED_NUM
			LED_Clear(LED_YELLOW1);
#endif
		} else {
			ui_x = ui_y = ui_scroll = 0;
#if 2 == LED_NUM
			LED_Set(LED_YELLOW1);
#endif
		}
	}
}
Beispiel #7
0
Datei: ui.c Projekt: 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);
		}
	}
}
Beispiel #8
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;
			}
		}
	}
}
Beispiel #9
0
void ui_usb_enum_event(uhc_device_t *dev, uhc_enum_status_t status)
{
	ui_enum_status = status;
	if (ui_enum_status == UHC_ENUM_SUCCESS) {
		switch (dev->speed) {
		case UHD_SPEED_HIGH:
			ui_device_speed_blink = 250;
			break;

		case UHD_SPEED_FULL:
			ui_device_speed_blink = 500;
			break;

		case UHD_SPEED_LOW:
		default:
			ui_device_speed_blink = 1000;
			break;
		}
		/* USB Device CDC connected
		   Open and configure UART and USB CDC ports */
		usb_cdc_line_coding_t cfg = {
			.dwDTERate   = CPU_TO_LE32(19200),
			.bCharFormat = CDC_STOP_BITS_1,
			.bParityType = CDC_PAR_NONE,
			.bDataBits   = 8,
		};
		uart_open();
		uart_config(&cfg);
		uhi_cdc_open(0, &cfg);
	}
}

void ui_usb_wakeup_event(void)
{
#ifdef USB_HOST_LPM_SUPPORT
	ui_disable_asynchronous_interrupt();
#endif
}

void ui_usb_sof_event(void)
{
#ifdef USB_HOST_LPM_SUPPORT
	bool b_btn_state;
	static bool btn_suspend_and_remotewakeup = false;
#endif

	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_data_transfer) {
				LED_Toggle(LED_0_PIN);
			}
		}
#ifdef USB_HOST_LPM_SUPPORT
		/* 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_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(LED_0_PIN);
                uhc_suspend_lpm(true, HIRD_800_US);
				return;
			}
		}
#endif // #ifdef USB_HOST_LPM_SUPPORT
	}
}
Beispiel #10
0
void ui_device_remotewakeup_enable(void)
{
	ui_enable_asynchronous_interrupt();
}
Beispiel #11
0
void ui_wakeup_enable(void)
{
	ui_enable_asynchronous_interrupt();
}