From 4ebe9f595a0eb8b0afa8663ca6a808095016370d Mon Sep 17 00:00:00 2001 From: Peli de Halleux Date: Tue, 20 Dec 2016 12:38:00 -0800 Subject: [PATCH] fix for Microsoft/pxt#961 --- libs/core/serial.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/core/serial.cpp b/libs/core/serial.cpp index 6c387f4f..f2fd2442 100644 --- a/libs/core/serial.cpp +++ b/libs/core/serial.cpp @@ -92,7 +92,10 @@ namespace serial { //% blockId=serial_redirect block="serial|redirect to|TX %tx|RX %rx|at baud rate %rate" //% blockExternalInputs=1 void redirect(SerialPin tx, SerialPin rx, BaudRate rate) { - uBit.serial.redirect((PinName)tx, (PinName)rx); + MicroBitPin* txp = getPin(tx); if (!tx) return; + MicroBitPin* rxp = getPin(rx); if (!rx) return; + + uBit.serial.redirect(txp->name, rxp->name); uBit.serial.baud((int)rate); } }