Skip to content

Commit

Permalink
ports/mega: Run Arduino Mega 2560 serial at 38400
Browse files Browse the repository at this point in the history
This triggers our custom serial driver to enable XON/XOFF flow
control so that communication with the board is reliable.

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Nov 13, 2019
1 parent 06a895e commit bc1c900
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions chips/atmega/snek-atmega-serial.c
Expand Up @@ -15,7 +15,9 @@
#include "snek.h"

/* UART baud rate */
#ifndef UART_BAUD
#define UART_BAUD 115200
#endif
#define UART_BAUD_U2X(div) ((F_CPU / (div) / UART_BAUD - 1) / 2)
#define UART_U2X (UART_BAUD_U2X(4) <= 4095)
#define UART_BAUD_SCALE (UART_U2X ? UART_BAUD_U2X(4) : UART_BAUD_U2X(8))
Expand Down
1 change: 1 addition & 0 deletions ports/mega/snek-mega.builtin
Expand Up @@ -85,3 +85,4 @@ A15, -2, 69
#include <snek-atmega-math.h>
#define SNEK_POOL 6144
#define SNEK_MAX_TOKEN 63
#define UART_BAUD 38400

0 comments on commit bc1c900

Please sign in to comment.