Skip to content

Commit

Permalink
Add configurable baud rate
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Sep 10, 2024
1 parent eb90ce8 commit 8e36a32
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion uart.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ ChangeLog:
...
1.01: Add UART.ports to allow available to user to be restricted
Add configurable baud rate
1.00: Auto-adjust BLE chunk size up if we receive >20 bytes in a packet
Drop UART.debug to 1 (less info printed)
Fixed flow control on BLE
Expand Down Expand Up @@ -299,7 +300,7 @@ ChangeLog:
navigator.serial.requestPort({}).then(function(port) {
log(1, "Connecting to serial port");
serialPort = port;
return port.open({ baudRate: 115200 });
return port.open({ baudRate: baud });
}).then(function () {
function readLoop() {
var reader = serialPort.readable.getReader();
Expand Down Expand Up @@ -539,6 +540,8 @@ ChangeLog:
flowControl : true,
/// Which ports should be offer to the user? If only one is specified no modal menu is created
ports : ["Web Bluetooth","Web Serial"],
/// Baud rate for Web Serial connections (Official Espruino devices use 9600, Espruino-on-ESP32/etc use 115200)
baud : 115200,
/// Used internally to write log information - you can replace this with your own function
log : function(level, s) { if (level <= this.debug) console.log("<UART> "+s)},
/// Called with the current send progress or undefined when done - you can replace this with your own function
Expand Down

0 comments on commit 8e36a32

Please sign in to comment.