Exemple #1
0
static void wait_for_pushbutton(void)
{
	while (ioport_get_pin_level(GPIO_PUSH_BUTTON_0));
	delay_ms(1);
	while (!ioport_get_pin_level(GPIO_PUSH_BUTTON_0));
	delay_ms(1);
}
void ui_process(uint16_t framenumber)
{
	bool b_btn_state;
	static bool btn0_last_state = false;
	static bool btn1_last_state = false;
	static uint8_t cpt_sof = 0;

	if ((framenumber % 1000) == 0) {
		LED_On(LED1);
	}
	if ((framenumber % 1000) == 500) {
		LED_Off(LED1);
	}
	/* Scan process running each 40ms */
	cpt_sof++;
	if (cpt_sof < 40) {
		return;
	}
	cpt_sof = 0;

	/* Scan push buttons 1 and 2 */
	b_btn_state = !ioport_get_pin_level(GPIO_PUSH_BUTTON_1);
	if (b_btn_state != btn0_last_state) {
		ui_hid_report[0]=b_btn_state;
		udi_hid_generic_send_report_in(ui_hid_report);
		btn0_last_state = b_btn_state;
	}
	b_btn_state = !ioport_get_pin_level(GPIO_PUSH_BUTTON_2);
	if (b_btn_state != btn1_last_state) {
		ui_hid_report[0]=b_btn_state;
		udi_hid_generic_send_report_in(ui_hid_report);
		btn1_last_state = b_btn_state;
	}
}
Exemple #3
0
void force_boot_loader(void)
{
	if ( !ioport_get_pin_level(BUTTON_1) |  !ioport_get_pin_level(BUTTON_0))
	{
		goto *(BOOT_SECTION_START + 0x1FC) ;
	}
}
Exemple #4
0
void task_addon(void *pvParameters)
{
	portTickType xLastWakeTime;
	const portTickType xTimeIncrement = taskADDON_PERIOD;
	xLastWakeTime = xTaskGetTickCount();
	bool switch_top;
	bool switch_btm;
	while(1){
		switch_top = ioport_get_pin_level(ADDON_SWITCH_TOP);
		switch_btm = ioport_get_pin_level(ADDON_SWITCH_BTM);
		if(addon_up && (!switch_top)) {
			ioport_set_pin_level(ADDON_DIR_PIN_CW, ADDON_DIR_HIGH);
			ioport_set_pin_level(ADDON_DIR_PIN_CCW, ADDON_DIR_LOW);
			ioport_set_pin_level(ADDON_DRIVE_PIN, true);
		} else if(addon_down && (!switch_btm)) {
			ioport_set_pin_level(ADDON_DIR_PIN_CW, ADDON_DIR_LOW);
			ioport_set_pin_level(ADDON_DIR_PIN_CCW, ADDON_DIR_HIGH);
			ioport_set_pin_level(ADDON_DRIVE_PIN, true);
		} else {
			ioport_set_pin_level(ADDON_DRIVE_PIN, false);
			ioport_set_pin_level(ADDON_DIR_PIN_CW, ADDON_DIR_LOW);
			ioport_set_pin_level(ADDON_DIR_PIN_CCW, ADDON_DIR_LOW);
			addon_up = false;
			addon_down = false;
		}
		vTaskDelayUntil(&xLastWakeTime, xTimeIncrement);
	}
}
Exemple #5
0
/**
 * \brief Test IOPORT pin level is getting changed.
 *
 * This function set the direction of CONF_OUT_PIN to output mode with pull-up
 * enabled and read the status of pin using CONF_IN_PIN which is configured in
 * input mode.
 *
 * The pin CONF_OUT_PIN and CONF_IN_PIN are shorted using a jumper.
 *
 * \param test Current test case.
 */
static void run_ioport_pin_test(const struct test_case *test)
{
	static volatile pin_mask_t pin_val;

	/* Set output direction on the given IO Pin */
	ioport_set_pin_dir(CONF_OUT_PIN, IOPORT_DIR_OUTPUT);

	/* Set direction and pull-up on the given IO Pin */
	ioport_set_pin_dir(CONF_IN_PIN, IOPORT_DIR_INPUT);
	ioport_set_pin_mode(CONF_IN_PIN, IOPORT_MODE_PULLUP);

	/* Set IO pin as high */
	ioport_set_pin_level(CONF_OUT_PIN, IOPORT_PIN_LEVEL_HIGH);
	delay_ms(10);
	pin_val = ioport_get_pin_level(CONF_IN_PIN);
	test_assert_true(test, pin_val == 1,
			"IOPORT Set pin level high test failed");

	/* Set IO pin as low */
	ioport_set_pin_level(CONF_OUT_PIN, IOPORT_PIN_LEVEL_LOW);
	delay_ms(10);
	pin_val = ioport_get_pin_level(CONF_IN_PIN);
	test_assert_true(test, pin_val == 0,
			"IOPORT Set pin level low test failed");

	/* Toggle IO pin */
	ioport_toggle_pin_level(CONF_OUT_PIN);
	delay_ms(10);
	pin_val = ioport_get_pin_level(CONF_IN_PIN);
	test_assert_true(test, pin_val == 1,
			"IOPORT Set pin level toggle test failed");
}
Exemple #6
0
/**
 * \brief Wait for push button been pressed.
 */
static void wait_for_switches(void)
{
	do { } while (ioport_get_pin_level(NEXT_BUTTON));
	delay_ms(1);
	do { } while (!ioport_get_pin_level(NEXT_BUTTON));
	delay_ms(1);
}
Exemple #7
0
void led_update(void){
	if (simcard_status() == true)							{led_0_on();	}
	else													{led_0_off();	}
	if (ioport_get_pin_level(EXT1_PIN_SIM_NETWORK) == true)	{led_1_on();	}
	else													{led_1_off();	}
	if (ioport_get_pin_level(EXT1_PIN_SIM_PWR) == true)		{led_2_on();	}
	else													{led_2_off();	}
}
/**
 *  Wait for user push the button.
 */
static void wait_for_switches(void)
{
	do {
	} while (ioport_get_pin_level(GPIO_PUSH_BUTTON_1));
	mdelay(1);
	do {
	} while (!ioport_get_pin_level(GPIO_PUSH_BUTTON_1));
	mdelay(1);
}
void FP_ENCODER_Handler(uint32_t id, uint32_t mask) {
	if (ioport_get_pin_level(FP_ENCODER_Q1_GPIO) && !ioport_get_pin_level(FP_ENCODER_Q2_GPIO)) {
		//printf("CCW\r\n");
		FP_UP_Handler(0,0);
	} else if (!ioport_get_pin_level(FP_ENCODER_Q1_GPIO) && ioport_get_pin_level(FP_ENCODER_Q2_GPIO)) {
		//printf("CW\r\n");
		FP_DOWN_Handler(0,0);
	}
}
Exemple #10
0
int switch_state(int sw)
{
	switch(sw)
	{
		case SW1:
			return ioport_get_pin_level(SW1_PIN);
		break;
		case SW2:
			return ioport_get_pin_level(SW2_PIN);
		break;
	}
}
int main(void)
{
	/* Use static volatile to make it available in debug watch */
	static volatile bool pin_val;

	sysclk_init();
	board_init();
	ioport_init();

	delay_init(sysclk_get_cpu_hz());

	/* Set output direction on the given LED IOPORTs */
	ioport_set_pin_dir(EXAMPLE_LED, IOPORT_DIR_OUTPUT);

	/* Set direction and pullup on the given button IOPORT */
	ioport_set_pin_dir(EXAMPLE_BUTTON, IOPORT_DIR_INPUT);
	ioport_set_pin_mode(EXAMPLE_BUTTON, IOPORT_MODE_PULLUP);

	/* Set LED IOPORTs high */
	ioport_set_pin_level(EXAMPLE_LED, IOPORT_PIN_LEVEL_HIGH);

	while (true) {
		/* Toggle LED IOPORTs with half a second interval */
		ioport_toggle_pin_level(EXAMPLE_LED);
		delay_ms(500);

		/* Get value from button port */
		/* Use watch with debugger to see it */
		pin_val = ioport_get_pin_level(EXAMPLE_BUTTON);
	}
}
Exemple #12
0
Fichier : ui.c Projet : 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);
		}
	}
}
Exemple #13
0
void ui_process(uint16_t framenumber)
{
	bool b_btn_state;
	static bool btn0_last_state = false;
	static uint8_t cpt_sof = 0;

	// Blink LED
	if (ui_b_led_blink) {
		if ((framenumber % 1000) == 0) {
			LED_On(LED0);
		}
		if ((framenumber % 1000) == 500) {
			LED_Off(LED0);
		}
	}

	// Scan process running each 40ms
	cpt_sof++;
	if (cpt_sof < 40) {
		return;
	}
	cpt_sof = 0;

	// Scan buttons
	b_btn_state = !ioport_get_pin_level(GPIO_PUSH_BUTTON_0);
	if (b_btn_state != btn0_last_state) {
		ui_hid_report[0] = b_btn_state;
		udi_hid_generic_send_report_in(ui_hid_report);
		btn0_last_state = b_btn_state;
	}
}
/*
 * Determine if button is pressed
 *
 * \return true if button is pressed, else false
 */
bool button_pressed(void)
{
#if SAMD || SAMR21
	if (port_pin_get_input_level(SW0_PIN)) {
		return false;
	} else {
		return true;
	}
#endif

#ifdef SENSOR_TERMINAL_BOARD
	if (stb_button_read()) {
		return true;
	} else {
		return false;
	}

#elif defined GPIO_PUSH_BUTTON_0   /*Read the current state of the button*/
	if (ioport_get_pin_level(GPIO_PUSH_BUTTON_0)) {
		return false;
	} else {
		return true;
	}
#endif

	return false;
}
void shutdown_temp_sens(void)
{
	int info;
	
	ioport_set_pin_level(TEMP_CS,0);
	delay_ms(1);
	for(int i=0;i<16;i++)
	{
		info=info|(ioport_get_pin_level(TEMP_IO)<<(15-i));
		ioport_set_pin_level(TEMP_CLK,1);
		delay_ms(1);
		ioport_set_pin_level(TEMP_CLK,0);
		delay_ms(1);
		
	}
	
	ioport_set_pin_dir(TEMP_IO,IOPORT_DIR_OUTPUT);
	ioport_set_pin_level(IO,1); // sends the command 0xFFFF so it can enter the shutdown mode
	for(int i=0;i<16;i++)
	{
		ioport_set_pin_level(TEMP_CLK,1);
		delay_ms(1);
		ioport_set_pin_level(TEMP_CLK,0);
		delay_ms(1);
		
	}
	
	
	ioport_set_pin_dir(TEMP_IO,IOPORT_DIR_INPUT);
	ioport_set_pin_level(TEMP_CS,1);
	
}
Exemple #16
0
bool ZP_Button(void)
{
	if (!ioport_get_pin_level(PIO_PA0_IDX))
	{
		if (b_read)
		{
			bTemp = (int32_t) ul_ms_ticks;
			b_read = false;
			b_ms = 0;
		}		
		else
		{
			b_ms = (int32_t) ul_ms_ticks - bTemp;
		}
	}
	else
	{
		if (b_read)
		{
			b_ms = 0;
			return false;
		}
		else
		{
			b_read = true;
			return true;
		}
	}
	return false;
}
void ui_process(uint16_t framenumber)
{
	static uint8_t cpt_sof = 0;
	bool b_btn_state;
	static bool btn0_last_state = false;

	if (!associated) {
		if ((framenumber % 1000) == 0) {
			LED_On(LED0);
		}
		if ((framenumber % 1000) == 500) {
			LED_Off(LED0);
		}
	} else {
		LED_On(LED0);
	}

	/* Scan process running each 20ms */
	cpt_sof++;
	if (20 > cpt_sof) {
		return;
	}

	cpt_sof = 0;

	/* Use buttons to send measures */
	b_btn_state = !ioport_get_pin_level(GPIO_PUSH_BUTTON_1);
	if (b_btn_state != btn0_last_state) {
		btn0_last_state = b_btn_state;
		if (b_btn_state) {
			ieee11073_skeleton_send_measure_1();
		}
	}
}
void wake_up_temp_sens(void)
{
		int info;
		
		ioport_set_pin_level(TEMP_CS,0);
		delay_ms(1);
		for(int i=0;i<16;i++)
		{
			info=info|(ioport_get_pin_level(TEMP_IO)<<(15-i));
			ioport_set_pin_level(TEMP_CLK,1);
			delay_ms(1);
			ioport_set_pin_level(TEMP_CLK,0);
			delay_ms(1);
			
		}
		
		ioport_set_pin_dir(TEMP_IO,IOPORT_DIR_OUTPUT);
		ioport_set_pin_level(IO,0); // sends the command 0x0000 so it can wake up
		for(int i=0;i<16;i++)
		{
			ioport_set_pin_level(TEMP_CLK,1);
			delay_ms(1);
			ioport_set_pin_level(TEMP_CLK,0);
			delay_ms(1);
			
		}
		
		
		ioport_set_pin_dir(TEMP_IO,IOPORT_DIR_INPUT);
		ioport_set_pin_level(TEMP_CS,1);
}
//TODO: Remove for testing
static void alarm(uint32_t time)
{
	ioport_set_pin_level(LED_0_PIN,!ioport_get_pin_level(LED_0_PIN));
	//rtc_set_alarm_relative(1024);
	rtc_set_callback(alarm2);
	rtc_set_alarm_relative(32768*2);
}
Exemple #20
0
/**
 * \brief Pin status for ISO7816 RESET PIN.
 *
 * \return 1 if the Pin RESET is high; otherwise 0.
 */
uint8_t iso7816_get_reset_statuts(void)
{
#if defined(SMART_CARD_USING_GPIO)
	return gpio_pin_is_high(gs_ul_rst_pin_idx);
#elif defined(SMART_CARD_USING_IOPORT)
	return (ioport_get_pin_level(gs_ul_rst_pin_idx) == IOPORT_PIN_LEVEL_HIGH);
#endif
}
Exemple #21
0
void HM10ReadDebugByte (volatile uint8_t * byte1, volatile uint8_t * byte2)
{
	unsigned char data = 0;
	ioport_set_pin_dir(HM_10_DD, IOPORT_DIR_INPUT);
	timer_delay (HM_10_CLOCK_DATA);
	while (ioport_get_pin_level(HM_10_DD) == true) // CC2540 is not ready to send, sample 8 bits and trash
	{
		for (unsigned char bit = 0; bit < 8; bit++)
		{
			HM_10_DC_UP();
			timer_delay (HM_10_CLOCK_DATA);
			HM_10_DC_DOWN();
			timer_delay (HM_10_CLOCK_DATA);
		}
	}
	data = 0;
	for (unsigned char bit = 0; bit < 8; bit++)
	{
		HM_10_DC_UP();
		timer_delay (HM_10_CLOCK_DATA);
		HM_10_DC_DOWN();
		data |= ioport_get_pin_level(HM_10_DD);
		if (bit < 7)
		data <<= 1;
		timer_delay (HM_10_CLOCK_DATA);
	}
	if (byte1 != NULL)
	*byte1 = data;
	if (byte2 != NULL)
	{
		data = 0;
		for (unsigned char bit = 0; bit < 8; bit++)
		{
			HM_10_DC_UP();
			timer_delay (HM_10_CLOCK_DATA);
			HM_10_DC_DOWN();
			data |= ioport_get_pin_level(HM_10_DD);
			if (bit < 7)
			data <<= 1;
			timer_delay (HM_10_CLOCK_DATA);
		}
		*byte2 = data;
	}
	ioport_set_pin_dir(HM_10_DD, IOPORT_DIR_OUTPUT);
	timer_delay (HM_10_CLOCK_DATA);
}
//TODO: Remove for testing
static void alarm2(uint32_t time) {
	int i;
	
	for (i=0; i<10; i++) {
		ioport_set_pin_level(LED_0_PIN,!ioport_get_pin_level(LED_0_PIN));
		delay_ms(50);
	}
	rtc_set_callback(alarm);
	rtc_set_alarm_relative(32768);
}
Exemple #23
0
void ui_process(uint16_t framenumber)
{
	static uint8_t cpt_sof = 0;

	if ((framenumber % 1000) == 0) {
		LED_On(LED0);
	}
	if ((framenumber % 1000) == 500) {
		LED_Off(LED0);
	}
	// Scan process running each 2ms
	cpt_sof++;
	if (cpt_sof < 2) {
		return;
	}
	cpt_sof = 0;

	// Uses buttons to move mouse
	if (!ioport_get_pin_level(GPIO_PUSH_BUTTON_0)) {
		move_count --;
		switch(move_dir) {
		case MOVE_UP:
			udi_hid_mouse_moveY(-MOUSE_MOVE_RANGE);
			if (move_count < 0) {
				move_dir = MOVE_RIGHT;
				move_count = MOUSE_MOVE_COUNT;
			}
			break;
		case MOVE_RIGHT:
			udi_hid_mouse_moveX(+MOUSE_MOVE_RANGE);
			if (move_count < 0) {
				move_dir = MOVE_DOWN;
				move_count = MOUSE_MOVE_COUNT;
			}
			break;
		case MOVE_DOWN:
			udi_hid_mouse_moveY(+MOUSE_MOVE_RANGE);
			if (move_count < 0) {
				move_dir = MOVE_LEFT;
				move_count = MOUSE_MOVE_COUNT;
			}
			break;
		case MOVE_LEFT:
			udi_hid_mouse_moveX(-MOUSE_MOVE_RANGE);
			if (move_count < 0) {
				move_dir = MOVE_UP;
				move_count = MOUSE_MOVE_COUNT;
			}
			break;
		}
	}
}
Exemple #24
0
void ui_process(uint16_t framenumber)
{
	bool b_btn_state;
	static bool btn_left = false, btn_right = false;
	static uint16_t cpt_sof = 0;

	if ((framenumber % 1000) == 0) {
		LED_On(LED1);
	}
	if ((framenumber % 1000) == 500) {
		LED_Off(LED1);
	}
	/* Scan process running each 2ms */
	cpt_sof++;
	if (cpt_sof < 2) {
		return;
	}
	cpt_sof = 0;

	/* Uses buttons to move mouse */
	if (!ioport_get_pin_level(GPIO_PUSH_BUTTON_3)) {
		udi_hid_mouse_moveY(-MOUSE_MOVE_RANGE);
	}
	if (!ioport_get_pin_level(GPIO_PUSH_BUTTON_4)) {
		udi_hid_mouse_moveY( MOUSE_MOVE_RANGE);
	}
	/* Check button click */
	b_btn_state = !ioport_get_pin_level(GPIO_PUSH_BUTTON_2);
	if (b_btn_state != btn_left) {
		btn_left = b_btn_state;
		udi_hid_mouse_btnleft(btn_left);
	}
	b_btn_state = !ioport_get_pin_level(GPIO_PUSH_BUTTON_1);
	if (b_btn_state != btn_right) {
		btn_right = b_btn_state;
		udi_hid_mouse_btnright(btn_right);
	}
}
Exemple #25
0
/*
*	Write to the SPI stacking interface
*
*/
void stack_write(uint8_t value)
{
	uint8_t uc_pcs;
	static uint16_t data;

	for (int i = 0; i < 16; i++) {
		spi_write(SPI_MASTER_BASE, value + i, 0, 0);
		/* Wait transfer done. */
		while ((spi_read_status(SPI_MASTER_BASE) & SPI_SR_RDRF) == 0);
		spi_read(SPI_MASTER_BASE, &data, &uc_pcs);
		printf("%d , %d\r", data, ioport_get_pin_level(SPI_IRQ1));
	}
	return;
}
Exemple #26
0
/**
 * Check if triggers asserted
 * \info The information loaded from memory to check
 */
enum trigger_modes trigger_poll(const struct regions_info *info)
{
#ifdef TRIGGER_USE_BUTTONS
#  ifdef TRIGGER_LOAD_BUTTON
	if (TRIGGER_LOAD_BUTTON_ACTIVE ==
		ioport_get_pin_level(TRIGGER_LOAD_BUTTON)) {
		return TRIGGER_LOAD;
	}
#  endif
#  ifdef TRIGGER_SWITCH_BUTTON
	if (TRIGGER_SWITCH_BUTTON_ACTIVE ==
		ioport_get_pin_level(TRIGGER_SWITCH_BUTTON)) {
		return TRIGGER_UPDATE;
	}
#  endif
#endif
#ifdef TRIGGER_USE_FLAG
	return (enum trigger_modes)info->trigger;
#else
	/* No trigger */
	return TRIGGER_BOOT;
#endif
}
bool platform_gpio_input_get( const platform_gpio_t* gpio )
{
  bool              result = false;
  
  platform_mcu_powersave_disable();
  
  require_quiet( gpio != NULL, exit);
  
  result = ( ioport_get_pin_level( gpio->pin ) == false ) ? false : true;
  
exit:
  platform_mcu_powersave_enable();
  return result;
}
Exemple #28
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);
		}
	}
}
Exemple #29
0
/*
 * Determine if button is pressed
 *
 * \return true if button is pressed, else false
 */
bool button_pressed(void)
{
#if defined GPIO_PUSH_BUTTON_0
	/*Read the current state of the button*/
	if (ioport_get_pin_level(GPIO_PUSH_BUTTON_0)) {
		return false;
	} else {
		return true;
	}

#else
	return false;

#endif
}
Exemple #30
0
int main (void)
{
	sysclk_init();
	ioport_init();
	
	ioport_set_pin_dir(LED_BLUE, IOPORT_DIR_OUTPUT);
	ioport_set_pin_dir(LED_GREEN, IOPORT_DIR_OUTPUT);
	ioport_set_pin_dir(LED_WHITE, IOPORT_DIR_OUTPUT);
	
	ioport_configure_pin(BUTTON_0, IOPORT_PULL_UP);
	ioport_configure_pin(BUTTON_1, IOPORT_PULL_UP);

	force_boot_loader();
	
	irq_initialize_vectors();
	cpu_irq_enable();
	udc_start();
	//board_init();

	while(1)
	{
		ioport_toggle_pin_level(LED_GREEN);
		delay_ms(100);
		ioport_set_pin_level(LED_BLUE, ioport_get_pin_level(BUTTON_0));
		ioport_set_pin_level(LED_WHITE, ioport_get_pin_level(BUTTON_1));
		
		char usb_in = udi_cdc_getc();
		char usb_out [17]=  "WHAT YOU TYPED: \r";//udi_cdc_getc();
		for (int i=0;i<16;i++)
		{
			udi_cdc_putc(usb_out[i]);
		}
		udi_cdc_putc(usb_in);
		udi_cdc_putc('\r');
	}
}