|
| 1 | +//http://www.seeedstudio.com/wiki/GROVE_System |
| 2 | +//http://www.seeedstudio.com/depot/index.php?main_page=advanced_search_result&search_in_description=1&keyword=grovefamily |
| 3 | +//support starter bundle example http://www.seeedstudio.com/wiki/GROVE_-_Starter_Kit_V1.1b |
| 4 | + |
| 5 | +/** |
| 6 | + * @license |
| 7 | + * Visual Blocks Editor |
| 8 | + * |
| 9 | + * Copyright 2012 Fred Lin. |
| 10 | + * https://github.com/gasolin/BlocklyDuino |
| 11 | + * |
| 12 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 13 | + * you may not use this file except in compliance with the License. |
| 14 | + * You may obtain a copy of the License at |
| 15 | + * |
| 16 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 17 | + * |
| 18 | + * Unless required by applicable law or agreed to in writing, software |
| 19 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 20 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 21 | + * See the License for the specific language governing permissions and |
| 22 | + * limitations under the License. |
| 23 | + */ |
| 24 | + |
| 25 | +/** |
| 26 | + * @fileoverview Helper functions for generating seeeduino grove blocks. |
| 27 | + * @author [email protected] (Fred Lin) |
| 28 | + */ |
| 29 | + |
| 30 | +goog.provide('Blockly.Blocks.interrupts'); |
| 31 | + |
| 32 | +goog.require('Blockly.Blocks'); |
| 33 | +goog.require('Blockly.Types'); |
| 34 | + |
| 35 | +Blockly.Blocks.interrupts.HUE = 190; |
| 36 | + |
| 37 | +Blockly.Blocks['interrupts_attach'] = { |
| 38 | + init: function() { |
| 39 | + this.setHelpUrl(Blockly.Msg.INTERRUPTS_ATTACH_HELPURL); |
| 40 | + this.setColour(190); |
| 41 | + this.appendDummyInput() |
| 42 | + .appendField(Blockly.Msg.INTERRUPTS_ATTACH_TITLE); |
| 43 | + this.appendDummyInput() |
| 44 | + .appendField(Blockly.Msg.PIN) |
| 45 | + .appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.interrupt), "PIN"); |
| 46 | + this.appendDummyInput() |
| 47 | + .appendField(Blockly.Msg.MODE) |
| 48 | + .appendField(new Blockly.FieldDropdown([[Blockly.Msg.ARD_LOW, "LOW"],[Blockly.Msg.ARD_CHANGE, "CHANGE"],[Blockly.Msg.ARD_RISING, "RISING"],[Blockly.Msg.ARD_FALLING, "FALLING"]]), "MODE"); |
| 49 | + this.appendStatementInput("CONTENT"); |
| 50 | + this.setInputsInline(true); |
| 51 | + this.setTooltip(Blockly.Msg.INTERRUPTS_ATTACH_TOOLTIP); |
| 52 | + } |
| 53 | +}; |
| 54 | + |
| 55 | +Blockly.Blocks['interrupts_detach'] = { |
| 56 | + init: function() { |
| 57 | + this.setHelpUrl(Blockly.Msg.INTERRUPTS_DETACH_HELPURL); |
| 58 | + this.setColour(190); |
| 59 | + this.appendDummyInput() |
| 60 | + .appendField(Blockly.Msg.INTERRUPTS_DETACH_TITLE); |
| 61 | + this.appendDummyInput() |
| 62 | + .appendField(new Blockly.FieldDropdown(Blockly.Arduino.Boards.selected.interrupt), "PIN"); |
| 63 | + this.setPreviousStatement(true, null); |
| 64 | + this.setNextStatement(true, null); |
| 65 | + this.setTooltip(Blockly.Msg.INTERRUPTS_DETACH_TOOLTIP); |
| 66 | + } |
| 67 | +}; |
| 68 | + |
| 69 | +Blockly.Blocks['interrupts'] = { |
| 70 | + init: function() { |
| 71 | + this.setHelpUrl(Blockly.Msg.INTERRUPTS_HELPURL); |
| 72 | + this.setColour(190); |
| 73 | + this.appendDummyInput() |
| 74 | + .appendField(Blockly.Msg.INTERRUPTS_TITLE); |
| 75 | + this.setPreviousStatement(true, null); |
| 76 | + this.setNextStatement(true, null); |
| 77 | + this.setTooltip(Blockly.Msg.INTERRUPTS_TOOLTIP); |
| 78 | + } |
| 79 | +}; |
| 80 | + |
| 81 | +Blockly.Blocks['interrupts_no'] = { |
| 82 | + init: function() { |
| 83 | + this.setHelpUrl(Blockly.Msg.INTERRUPTS_NO_HELPURL); |
| 84 | + this.setColour(190); |
| 85 | + this.appendDummyInput() |
| 86 | + .appendField(Blockly.Msg.INTERRUPTS_NO_TITLE); |
| 87 | + this.setPreviousStatement(true, null); |
| 88 | + this.setNextStatement(true, null); |
| 89 | + this.setTooltip(Blockly.Msg.INTERRUPTS_NO_TOOLTIP); |
| 90 | + } |
| 91 | +}; |
| 92 | + |
0 commit comments