[riot-notifications] [RIOT-OS/RIOT] usbus: Add CDC-ACM (Serial console) function (#11085)

Koen Zandberg notifications at github.com
Thu Sep 19 11:01:35 CEST 2019


bergzand commented on this pull request.



> +    /* Use tsrb and flush */
+    return len;
+}
+
+static void _cdc_acm_rx_pipe(usbus_cdcacm_device_t *cdcacm,
+                             uint8_t *data, size_t len)
+{
+    (void)cdcacm;
+    for (size_t i = 0; i < len; i++) {
+        isrpipe_write_one(&cdc_stdio_isrpipe, data[i]);
+    }
+}
+
+void usb_cdc_acm_stdio_init(usbus_t *usbus)
+{
+    usbus_cdc_acm_init(usbus, &cdcacm, _cdc_acm_rx_pipe, NULL,

> How could the coding_cb function could be updated (it's NULL by default) after the CDC ACM stdio is initialized ?

There is no update function provided at the moment, I can add it if it is required.

The aim of this callback is to allow the host computer to configure the serial device, setting the baud rate and the parity mode. For STDIO this normally doesn't make much sense as there is no baud rate or parity associated with normal STDIO operations. With #12268 this is used to configure and update the baud rate and mode of the `periph_uart` device used.

> I'm thinking of the Arduino MKR (and any board flashed via bossa) where we could provide a way to automatically reset the board to bootloader mode when the host open the TTY with a given baudrate: This is what is done on Arduino: when the stdio serial is opened at 1200 baud, the board reboot in bootloader mode and bossa can flash the board after that.

So the idea here is to reset (`pm_reboot()`) the board when the ttyACMn connected to the RIOT USB serial console is configured to a specific baud rate? I guess I can add an update hook function if you want to have this structure as a way to reset the board.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11085#discussion_r326064562
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190919/fabc9f9f/attachment.htm>


More information about the notifications mailing list