]> git.gag.com Git - fw/altos/commitdiff
working as USB to serial converter on sn 1
authorBdale Garbee <bdale@gag.com>
Sat, 6 Jul 2024 23:56:33 +0000 (17:56 -0600)
committerBdale Garbee <bdale@gag.com>
Sat, 6 Jul 2024 23:56:33 +0000 (17:56 -0600)
src/quantimotor-v1/ao_pins.h
src/quantimotor-v1/ao_quantimotor.c

index cb65a6ab0ac91cfd8c0c89a7dcb2d1c50619ff03..22a731fe90c44ca8021bfda6253a5822a3daa4bf 100644 (file)
@@ -29,9 +29,7 @@
 #define HAS_USB_VBUS           0
 #define HAS_USB_PULLUP         1
 #define AO_USB_PULLUP_PORT     0
-/* #define AO_USB_PULLUP_PIN   20 */
-/* following is for use of fctester proto as development device */
-#define AO_USB_PULLUP_PIN      6
+#define AO_USB_PULLUP_PIN      20 
 
 /* USART */
 
index 18362c2a29d2796d3599a76183d2ddbd000a2770..d15f248f2defffbac773dd0779a3e3bd6613c02b 100644 (file)
@@ -7,11 +7,12 @@
 #include <ao_serial.h>
 
 static struct ao_task ao_console_read_task;
+static struct ao_task ao_console_write_task;
 
 static void
 ao_console_read(void)
 {
-        int     c;
+        int    c;
         for (;;) {
                 ao_arch_block_interrupts();
                 c = _ao_serial0_pollchar();
@@ -24,6 +25,16 @@ ao_console_read(void)
         }
 }
 
+static void
+ao_console_write(void)
+{
+        char   c;
+        for (;;) {
+                c = ao_usb_getchar();
+               ao_serial0_putchar(c);
+        }
+}
+
 int
 main(void)
 {
@@ -38,9 +49,11 @@ main(void)
        ao_serial_init();
         ao_serial0_set_speed(AO_SERIAL_SPEED_115200);
 
-       ao_cmd_init();
+       /* the command interpreter could interfere with usb -> serial */
+       /* ao_cmd_init(); */
 
        ao_add_task(&ao_console_read_task, ao_console_read, "console_read");
+       ao_add_task(&ao_console_write_task, ao_console_write, "console_write");
 
        ao_start_scheduler();
        return 0;