[riot-notifications] [RIOT-OS/RIOT] drivers/at: make at_dev_init() return uart initialize status (#10826)

ranbe1 notifications at github.com
Wed Jan 23 17:21:21 CET 2019


ranbe1 commented on this pull request.



> @@ -47,7 +47,17 @@ static int init(int argc, char **argv)
     uint8_t uart = atoi(argv[1]);
     uint32_t baudrate = atoi(argv[2]);
 
-    at_dev_init(&at_dev, UART_DEV(uart), baudrate, buf, sizeof(buf));
+    int res = at_dev_init(&at_dev, UART_DEV(uart), baudrate, buf, sizeof(buf));
+
+    /* check the UART initialization return value and respond as needed */
+    if (res == UART_NODEV) {
+        puts("Invalid UART device given!");
+        return 1;
+    }
+    else if (res == UART_NOBAUD) {
+        puts("Baudrate is not applicable!");
+        return 1;
+    }
 
     return 0;

done

-- 
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/10826#discussion_r250267087
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190123/48b2b6dd/attachment-0001.html>


More information about the notifications mailing list