(() => {

    'use strict';
    goog.provide('Blockly.Blocks.PWM_Servo');
    goog.require('Blockly.Blocks');

    Blockly.Blocks.inmp441= {
    init: function() { 
        this.appendValueInput("SCK")
            .setCheck(null)
            .appendField("INMP441麦克风初始化")
            .appendField("SCK#");
        this.appendValueInput("SD")
            .setCheck(null)
            .appendField("SD#");
        this.appendValueInput("WS")
            .setCheck(null)
            .appendField("WS#");
        this.appendValueInput("Gain")
            .setCheck(null)
            .appendField("增益");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(240);
        this.setTooltip("增益越大声音越大，但容易引发啸叫");
        this.setHelpUrl("www.baidu.com");
        }
    };

    Blockly.Blocks.int16_p= {
        init: function() { 
        this.appendDummyInput()
            .appendField("类型")
            .appendField(new Blockly.FieldDropdown([["char","char "],["unsigned char","unsigned char "],["short","short "],["unsigned short","unsigned short "],["int","int "],["unsigned int","unsigned int "],["float","float "],["double","double "],["char *","char *"],["unsigned char *","unsigned char *"],["short *","short *"],["unsigned short *","unsigned short *"],["int *","int *"],["unsigned int *","unsigned int *"],["float *","float *"],["double *","double *"]]), "type");
        this.appendDummyInput()
            .appendField("变量名")
            .appendField(new Blockly.FieldTextInput("data"), "name");
        this.appendValueInput("value")
            .setCheck(null)
            .appendField("赋值为");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(240);
        this.setTooltip("定义变量");
        this.setHelpUrl("www.baidu.com");
        }
    };

    Blockly.Blocks.mic_api= {
        init: function() { 
        this.appendDummyInput()
            .appendField("INMP441读取的声音数据");
        this.setOutput(true, null);
        this.setColour(240);
        this.setTooltip("返回int16_t*，大小为1024");
        this.setHelpUrl("www.baidu.com");
        }
    };

    Blockly.Blocks.MAX98357= {
        init: function() { 
        this.appendValueInput("Din")
            .setCheck(null)
            .appendField("MAX98357音频放大器初始化")
            .appendField("DIN#");
        this.appendValueInput("Bclk")
            .setCheck(null)
            .appendField("BCLK#");
        this.appendValueInput("Lrclk")
            .setCheck(null)
            .appendField("LRCLK#");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(90);
        this.setTooltip("音频放大器");
        this.setHelpUrl("www.baidu.com");
        }
    };

    Blockly.Blocks.spk_api= {
        init: function() { 
        this.appendValueInput("spk_value")
            .setCheck(null)
            .appendField("MAX98357音频放大器播放");
        this.setInputsInline(true);
        this.setPreviousStatement(true, null);
        this.setNextStatement(true, null);
        this.setColour(90);
        this.setTooltip("参数为int16_t的指针，大小为1024");
        this.setHelpUrl("www.baidu.com");
        }
    };
    
})();