Exemplo n.º 1
0
USART_HOST_ISR_VECT()
#endif
{
	uint8_t temp;
#if SAMD || SAMR21 || SAML21
	usart_serial_read_packet(&host_uart_module, &temp, 1);
#else
	usart_serial_read_packet(USART_HOST, &temp, 1);
#endif

	/* Introducing critical section to avoid buffer corruption. */
	cpu_irq_disable();

	/* The number of data in the receive buffer is incremented and the
	 * buffer is updated. */

	serial_rx_buf[serial_rx_buf_tail] = temp;

	if ((SERIAL_RX_BUF_SIZE_HOST - 1) == serial_rx_buf_tail) {
		/* Reached the end of buffer, revert back to beginning of
		 * buffer. */
		serial_rx_buf_tail = 0x00;
	} else {
		serial_rx_buf_tail++;
	}

	cpu_irq_enable();
}
Exemplo n.º 2
0
USART_NCP_ISR_VECT()
{
	uint8_t temp;
	
	usart_serial_read_packet(USART_NCP, &temp, 1);
	/* Introducing critical section to avoid buffer corruption. */
	cpu_irq_disable();
	
	/* The number of data in the receive buffer is incremented and the buffer is updated. */
	serial_rx_count++;
	
	
	serial_rx_buf[serial_rx_buf_tail] = temp;
	
	if ((SERIAL_RX_BUF_SIZE_NCP - 1) == serial_rx_buf_tail)
	{
		/* Reached the end of buffer, revert back to beginning of buffer. */
		serial_rx_buf_tail = 0x00;
	}
	else
	{
		serial_rx_buf_tail++;
	}

	cpu_irq_enable();
}