This commit is contained in:
Peli de Halleux 2016-12-20 12:38:00 -08:00
parent 50f0e85884
commit 4ebe9f595a

View File

@ -92,7 +92,10 @@ namespace serial {
//% blockId=serial_redirect block="serial|redirect to|TX %tx|RX %rx|at baud rate %rate" //% blockId=serial_redirect block="serial|redirect to|TX %tx|RX %rx|at baud rate %rate"
//% blockExternalInputs=1 //% blockExternalInputs=1
void redirect(SerialPin tx, SerialPin rx, BaudRate rate) { 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); uBit.serial.baud((int)rate);
} }
} }