/* Incoming UART messages will trigger an interrupt. The ISR keeps track of
* the incoming color code and updates the color structure as it receives
* characters.
*/
void USART3_IRQHandler(void)
{
	uint8_t hex = 0;
	static uint32_t ISRCount = 0; // counts interrupt service routines
    if (USART_GetITStatus(USART3, USART_IT_RXNE) != RESET){
        hex = ascii_to_hex((char)USART_ReceiveData(USART3));
    }

    if (ISRCount % 6 == 0) color = 0;

    color +=  hex << 4*(5 - (ISRCount % 6));
    ISRCount++;
    AssignColor(&ColorStructure, color);
}