goog.provide('Blockly.Blocks.EPD_152X296');
goog.require('Blockly.Blocks');

Blockly.Blocks.EPD_Pin_Init= {
  init: function() { 
  this.appendValueInput("SCK")
      .setCheck(Number)
      .appendField("墨水屏(152x296) 引脚重定向  SCK");
  this.appendValueInput("MOSI")
      .setCheck(Number)
      .appendField("MOSI");
  this.appendValueInput("CS")
      .setCheck(Number)
      .appendField("CS");
  this.appendValueInput("RST")
      .setCheck(Number)
      .appendField("RST");
  this.appendValueInput("DC")
      .setCheck(Number)
      .appendField("DC");
  this.appendValueInput("BUSY")
      .setCheck(Number)
      .appendField("BUSY");
  this.setInputsInline(true);
  this.setPreviousStatement(true, null);
  this.setNextStatement(true, null);
  this.setColour(90);
  this.setTooltip("");
  this.setHelpUrl("");
  }
};

Blockly.Blocks.EPD_Init= {
  init: function() { 
  this.appendDummyInput()
      .appendField("初始化墨水屏(152X196)  屏幕 ");
  this.appendDummyInput()
      .appendField(new Blockly.FieldDropdown([["旋转 0°","0"],["旋转 90°","90"],["旋转 180","180"],["旋转 270°","270"]]), "Rotate_value");
  this.appendDummyInput()
      .appendField("背景颜色");
  this.appendDummyInput()
      .appendField(new Blockly.FieldDropdown([["白","WHITE"],["黑","BLACK"]]), "Color_value");
  this.setInputsInline(true);
  this.setPreviousStatement(true, null);
  this.setNextStatement(true, null);
  this.setColour(90);
  this.setTooltip("");
  this.setHelpUrl("");
  }
};


Blockly.Blocks.EPD_Display= {
  init: function() { 
  this.appendDummyInput()
      .appendField("墨水屏(152x296)  刷新页面");
  this.appendStatementInput("function")
      .setCheck(null);
  this.setPreviousStatement(true, null);
  this.setNextStatement(true, null);
  this.setColour(90);
  this.setTooltip("");
  this.setHelpUrl("");
  }
};


Blockly.Blocks.Paint_DrawNum= {
  init: function() { 
  this.appendValueInput("Num_x")
      .setCheck(Number)
      .appendField("墨水屏显示数字   起点x  ");
  this.appendValueInput("Num_y")
      .setCheck(Number)
      .appendField(" 起点y ");
  this.appendValueInput("Num_Value")
      .setCheck(Number)
      .appendField(" 内容 ");
  this.appendDummyInput()
      .appendField("字号");
  this.appendDummyInput()
      .appendField(new Blockly.FieldDropdown([["08","&Font8"],["12","&Font12"],["16","&Font16"],["20","&Font20"],["24","&Font24"]]), "Num_word_size");
  this.appendDummyInput()
      .appendField(" 字体颜色 ");
  this.appendDummyInput()
      .appendField(new Blockly.FieldDropdown([["黑","BLACK"],["白","WHITE"]]), "Num_color1");
  this.appendDummyInput()
      .appendField("背景颜色");
  this.appendDummyInput()
      .appendField(new Blockly.FieldDropdown([["白","WHITE"],["黑","BLACK"]]), "Num_color2");
  this.setInputsInline(true);
  this.setPreviousStatement(true, null);
  this.setNextStatement(true, null);
  this.setColour(90);
  this.setTooltip("");
  this.setHelpUrl("");
  }
};

Blockly.Blocks.Paint_DrawString_EN= {
  init: function() { 
  this.appendValueInput("String_x")
      .setCheck(Number)
      .appendField("墨水屏显示文本   起点x  ");
  this.appendValueInput("String_y")
      .setCheck(Number)
      .appendField(" 起点y ");
  this.appendValueInput("String_Value")
      .setCheck(String)
      .appendField(" 内容 ");
  this.appendDummyInput()
      .appendField("字号");
  this.appendDummyInput()
      .appendField(new Blockly.FieldDropdown([["08","&Font8"],["12","&Font12"],["16","&Font16"],["20","&Font20"],["24","&Font24"]]), "String_word_size");
  this.appendDummyInput()
      .appendField(" 字体颜色 ");
  this.appendDummyInput()
      .appendField(new Blockly.FieldDropdown([["黑","BLACK"],["白","WHITE"]]), "String_color1");
  this.appendDummyInput()
      .appendField("背景颜色");
  this.appendDummyInput()
      .appendField(new Blockly.FieldDropdown([["白","WHITE"],["黑","BLACK"]]), "String_color2");
  this.setInputsInline(true);
  this.setPreviousStatement(true, null);
  this.setNextStatement(true, null);
  this.setColour(90);
  this.setTooltip("");
  this.setHelpUrl("");
  }
};



Blockly.Blocks.Paint_DrawImage= {
  init: function() { 
  this.appendValueInput("Image_x")
      .setCheck(Number)
      .appendField("墨水屏显示图像   起点x  ");
  this.appendValueInput("Image_y")
      .setCheck(Number)
      .appendField(" 起点y ");
  this.appendValueInput("Image_Width")
      .setCheck(Number)
      .appendField("宽度");
  this.appendValueInput("Image_height")
      .setCheck(Number)
      .appendField("高度");
  this.appendValueInput("Image_value")
      .setCheck(String)
      .appendField("图像名称");
  this.setInputsInline(true);
  this.setPreviousStatement(true, null);
  this.setNextStatement(true, null);
  this.setColour(90);
  this.setTooltip("");
  this.setHelpUrl("");
  }
};



Blockly.Blocks.Paint_Clear= {
  init: function() { 
  this.appendDummyInput()
      .appendField("墨水屏(152X296)  清屏颜色");
  this.appendDummyInput()
      .appendField(new Blockly.FieldDropdown([["白","WHITE"],["黑","BLACK"]]), "Clear_Color");
  this.setInputsInline(true);
  this.setPreviousStatement(true, null);
  this.setNextStatement(true, null);
  this.setColour(90);
  this.setTooltip("");
  this.setHelpUrl("");
  }
};


Blockly.Blocks.EPD_2IN66_Partial_Display= {
  init: function() { 
  this.appendDummyInput()
      .appendField("墨水屏(152X296) 局部刷新页面");
  this.appendStatementInput("Partial_Display")
      .setCheck(null);
  this.setPreviousStatement(true, null);
  this.setNextStatement(true, null);
  this.setColour(90);
  this.setTooltip("");
  this.setHelpUrl("");
  }
};

