Commit a8cd6b82 authored by carlosperate's avatar carlosperate

Add serial pin warnings.

parent 6e5f9fea
...@@ -59,7 +59,7 @@ Blockly.Arduino.Boards.profiles.uno = { ...@@ -59,7 +59,7 @@ Blockly.Arduino.Boards.profiles.uno = {
pwmPins: [['3', '3'], ['5', '5'], ['6', '6'], ['9', '9'], ['10', '10'], pwmPins: [['3', '3'], ['5', '5'], ['6', '6'], ['9', '9'], ['10', '10'],
['11', '11']], ['11', '11']],
serial: [['serial', 'Serial']], serial: [['serial', 'Serial']],
serialPins: { serial: [['RX', '0'], ['TX', '1']] }, serialPins: { Serial: [['RX', '0'], ['TX', '1']] },
serialSpeed: [['300', '300'], ['600', '600'], ['1200', '1200'], serialSpeed: [['300', '300'], ['600', '600'], ['1200', '1200'],
['2400', '2400'], ['4800', '4800'], ['9600', '9600'], ['2400', '2400'], ['4800', '4800'], ['9600', '9600'],
['14400', '14400'], ['19200', '19200'], ['28800', '28800'], ['14400', '14400'], ['19200', '19200'], ['28800', '28800'],
...@@ -121,10 +121,10 @@ Blockly.Arduino.Boards.profiles.mega = { ...@@ -121,10 +121,10 @@ Blockly.Arduino.Boards.profiles.mega = {
serial: [['serial', 'Serial'], ['serial_1', 'Serial1'], serial: [['serial', 'Serial'], ['serial_1', 'Serial1'],
['serial_2', 'Serial2'], ['serial_3', 'Serial3']], ['serial_2', 'Serial2'], ['serial_3', 'Serial3']],
serialPins: { serialPins: {
serial: [['TX', '0'], ['RX', '1']], Serial: [['TX', '0'], ['RX', '1']],
serial1: [['TX', '18'], ['TX', '19']], Serial1: [['TX', '18'], ['TX', '19']],
serial2: [['TX', '16'], ['TX', '17']], Serial2: [['TX', '16'], ['TX', '17']],
serial3: [['TX', '14'], ['TX', '15']] Serial3: [['TX', '14'], ['TX', '15']]
}, },
serialSpeed: Blockly.Arduino.Boards.profiles.uno.serialSpeed, serialSpeed: Blockly.Arduino.Boards.profiles.uno.serialSpeed,
spi: [['SPI', 'SPI']], spi: [['SPI', 'SPI']],
......
...@@ -29,6 +29,12 @@ Blockly.Arduino['serial_print'] = function(block) { ...@@ -29,6 +29,12 @@ Blockly.Arduino['serial_print'] = function(block) {
block, 'CONTENT', Blockly.Arduino.ORDER_ATOMIC) || '0'; block, 'CONTENT', Blockly.Arduino.ORDER_ATOMIC) || '0';
var checkbox_name = (block.getFieldValue('NEW_LINE') == 'TRUE'); var checkbox_name = (block.getFieldValue('NEW_LINE') == 'TRUE');
var serialPins = Blockly.Arduino.Boards.selected.serialPins[serialId];
for (var i = 0; i < serialPins.length; i++) {
Blockly.Arduino.reservePin(block, serialPins[i][1],
Blockly.Arduino.PinTypes.SERIAL, 'SERIAL ' + serialPins[i][0]);
}
if (checkbox_name) { if (checkbox_name) {
var code = serialId + '.println(' + content + ');\n'; var code = serialId + '.println(' + content + ');\n';
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment