/* get the input character string and check if it is valid  */
uint8_t usart_input_threshold(uint32_t value)
/* get the input character string and check if it is valid  */
uint8_t usart_input_threshold(uint32_t value)
{
    uint32_t index = 0;
    uint32_t tmp[2] = {0, 0};
    while (index < 2){
        while (RESET == usart_flag_get(EVAL_COM1, USART_STAT_RBNE));
        tmp[index++] = usart_data_receive(EVAL_COM1);
        if ((tmp[index - 1] < 0x30) || (tmp[index - 1] > 0x39)){
            printf("\n\r please input a valid number between 0 and 9 \n\r");
            index--;
        }
    }
    index = (tmp[1] - 0x30) + ((tmp[0] - 0x30) * 10);
    if (index > value){
        printf("\n\r please input a valid number between 0 and %d \n\r", value);
        return 0xFF;
    }
    index = (tmp[1] - 0x30) + ((tmp[0] - 0x30) <<4);
    return index;
}