src/platform/arm-teensy3/usb_serial.c
int usb_serial_getchar(void)
{
	unsigned int i;
	int c;

	if (!rx_packet) {
		if (!usb_configuration) return -1;
		rx_packet = usb_rx(CDC_RX_ENDPOINT);
		if (!rx_packet) return -1;
	}
	i = rx_packet->index;
	c = rx_packet->buf[i++];
	if (i >= rx_packet->len) {
		usb_free(rx_packet);
		rx_packet = NULL;
	} else {
		rx_packet->index = i;
	}
	return c;
}
// get the next character, or -1 if nothing received
get the next character, or -1 if nothing received
get the next character or - 1 if nothing received
int usb_serial_getchar(void)
{
	unsigned int i;
	int c;
	if (!rx_packet) {
		if (!usb_configuration) return -1;
		rx_packet = usb_rx(CDC_RX_ENDPOINT);
		if (!rx_packet) return -1;
	}
	i = rx_packet->index;
	c = rx_packet->buf[i++];
	if (i >= rx_packet->len) {
		usb_free(rx_packet);
		rx_packet = NULL;
	} else {
		rx_packet->index = i;
	}
	return c;
}
int usb_serial_getchar ( void ) { unsigned int i ; int c ; if ( ! rx_packet ) { if ( ! usb_configuration ) return -1 ; rx_packet = usb_rx ( CDC_RX_ENDPOINT ) ; if ( ! rx_packet ) return -1 ; } i = rx_packet -> index ; c = rx_packet -> buf [ i ++ ] ; if ( i >= rx_packet -> len ) { usb_free ( rx_packet ) ; rx_packet = NULL ; } else { rx_packet -> index = i ; } return c ; }
get the next character, or -1 if nothing received
get the next character or - 1 if nothing received