static void handle_set_dtr(const char *req, int *req_index)
{
    int val;
    if (ei_decode_boolean(req, req_index, &val) < 0) {
        send_error_response("einval");
        return;
    }

    if (!uart_is_open(uart)) {
        send_error_response("ebadf");
        return;
    }

    if (uart_set_dtr(uart, !!val) >= 0)
        send_ok_response();
    else
        send_error_response(uart_last_error());
}
void reset(void){
    uart_set_dtr(0);
    time_sleep(0.1);
    uart_set_dtr(1);
    time_sleep(0.5);
}