goog.require('Blockly.JavaScript');


Blockly.JavaScript['adc_done'] = function(block) {
	var code = 'adc_done()';
	return [code, Blockly.JavaScript.ORDER_NONE];
};
Blockly.JavaScript['adc_read'] = function(block) {
	// var option = block.getFieldValue('ADCoptions');
	// var code = 'read_adc(' + option +');\n';
	// if(option == 'ADC_START_AND_READ') {
	// 	code = 'read_adc();\n';
	// }
	// if(block.outputConnection) {
	// 	return [code, Blockly.JavaScript.ORDER_NONE];
	// } else {
	// 	return code;
	// }
	if(block.outputConnection) {
		return "I have an output";
	} else {
		return "I don't have an output";
	}
};
Blockly.JavaScript['adc_channel'] = function(block) {
	var channel = block.getFieldValue('channel');
	var code = 'set_adc_channel(' + channel +');\n';
	return code;
};
Blockly.JavaScript['adc_setup'] = function(block) {
	var option = block.getFieldValue('CLOCKoptions');
	var code = 'setup_adc(' + option +');\n';
	return code;
};
@@ -30,17 +30,16 @@
 ipt');%0A%0A
-%0A
 Blockly.
@@ -151,18 +151,24 @@
 DER_NONE
+ + '%5Cn'
 %5D
-;
 %0A%7D;%0ABloc
@@ -215,19 +215,16 @@
 ock) %7B%0A%09
-// 
 var opti
@@ -264,19 +264,16 @@
 ons');%0A%09
-// 
 var code
@@ -303,21 +303,49 @@
  +')
-;%5Cn
 ';%0A%09
-// if(
+if (block.outputConnection) %7B%0A%09%09if ( 
 opti
@@ -349,16 +349,17 @@
 ption ==
+=
  'ADC_ST
@@ -376,83 +376,75 @@
 AD')
- %7B%0A%09// %09code = 'read_adc();%5Cn';%0A%09// %7D%0A%09// if(block.outputConnection) %7B%0A%09// 
+%0A%09%09%09return %5B'read_adc()'%09, Blockly.JavaScript.ORDER_NONE + '%5Cn'%5D;%0A%09
 %09ret
@@ -487,15 +487,19 @@
 NONE
+ + '%5Cn'
 %5D;%0A%09
-// 
 %7D el
@@ -504,19 +504,16 @@
 else %7B%0A%09
-// 
 %09return 
@@ -520,118 +520,16 @@
 code
-;%0A%09// %7D%0A%09if(block.outputConnection) %7B%0A%09%09return %22I have an output%22;%0A%09%7D else %7B%0A%09%09return %22I don't have an output%22
+ + ';%5Cn'
 ;%0A%09%7D

Fix en generador de código de módulo ADC