examples/serial_test.c: Explicit set the line parameters
authorUwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Mon, 5 Sep 2011 09:45:31 +0000 (11:45 +0200)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Mon, 5 Sep 2011 09:57:49 +0000 (11:57 +0200)
examples/serial_test.c

index 7c89e78..4ed0b7e 100644 (file)
@@ -130,6 +130,21 @@ int main(int argc, char **argv)
         exit(-1);
     }
     
+    /* Set line parameters
+     *
+     * TODO: Make these parameters settable from the command line
+     *
+     * Parameters are choosen that sending a continous stream of 0x55 
+     * should give a square wave
+     *
+     */
+    f = ftdi_set_line_property(ftdi, 8, STOP_BIT_1, NONE);
+    if (f < 0)
+    {
+        fprintf(stderr, "unable to set line parameters: %d (%s)\n", f, ftdi_get_error_string(ftdi));
+        exit(-1);
+    }
+    
     if (do_write)
         for(i=0; i<1024; i++)
             buf[i] = pattern;