ECU/GSM/dist/src/USART_program.c
u16 USART_u16Receive(u8 Channel) {
	volatile UART_REG * selectedChannel = USART1;

	switch(Channel) {
		case 1:
			;
			break;
		case 2:
			selectedChannel = USART2;
			break;
		case 3:
			selectedChannel = USART3;
			break;
		case 4:
			selectedChannel = USART4;
			break;
		case 5:
			selectedChannel = USART5;
			break;
		default:
			return 0;
	}

	while (!GET_BIT(selectedChannel->SR, 5));	// Data has been received and can be read
	return selectedChannel->DR;
}
/**
 * @brief  (POLLING) Waits for character receive and returns it
 * @param  Channel:	Number of the UART Channel to use.
  * 					Can be USART_CHANNEL_x where x is from 1 to 5
 * @retval u8: the 8/9 bits received in the data register
 */
@brief  (POLLING) Waits for character receive and returns it
@param  Channel:     Number of the UART Channel to use.
Can be USART_CHANNEL_x where x is from 1 to 5
@retval u8: the 8/9 bits received in the data register
@brief ( POLLING ) Waits for character receive and returns it @param Channel : Number of the UART Channel to use . Can be USART_CHANNEL_x where x is from 1 to 5 @retval u8 : the 8 / 9 bits received in the data register
u16 USART_u16Receive(u8 Channel) {
	volatile UART_REG * selectedChannel = USART1;
	switch(Channel) {
		case 1:
			;
			break;
		case 2:
			selectedChannel = USART2;
			break;
		case 3:
			selectedChannel = USART3;
			break;
		case 4:
			selectedChannel = USART4;
			break;
		case 5:
			selectedChannel = USART5;
			break;
		default:
			return 0;
	}
	while (!GET_BIT(selectedChannel->SR, 5));	
	return selectedChannel->DR;
}
u16 USART_u16Receive ( u8 Channel ) { volatile UART_REG * selectedChannel = USART1 ; switch ( Channel ) { case 1 : ; break ; case 2 : selectedChannel = USART2 ; break ; case 3 : selectedChannel = USART3 ; break ; case 4 : selectedChannel = USART4 ; break ; case 5 : selectedChannel = USART5 ; break ; default : return 0 ; } while ( ! GET_BIT ( selectedChannel -> SR , 5 ) ) ; return selectedChannel -> DR ; }
@brief  (POLLING) Waits for character receive and returns it
 @param  Channel:     Number of the UART Channel to use.
@brief ( POLLING ) Waits for character receive and returns it @param Channel : Number of the UART Channel to use .
// Data has been received and can be read