enum SER {
    //% block="串口1"
    Serial1,
    //% block="串口2"
    Serial2
}




//% color="#AA278D" iconWidth=50 iconHeight=40
namespace hbr740 {
    //% block="语音识别初始化端口 tx [TX] rx [RX] 灵敏度[LM] 音量值[YL]" blockType="command"
    //% TX.shadow="dropdownRound" TX.options="PIN_DigitalWrite" TX.defl=PIN_DigitalWrite.P1
    //% RX.shadow="dropdownRound" RX.options="PIN_DigitalWrite" RX.defl=PIN_DigitalWrite.P0
    //% LM.shadow="range" LM.params.min=0 LM.params.max=100 LM.defl=90
    //% YL.shadow="range" YL.params.min=0 YL.params.max=100 YL.defl=90
    export function hbr740init(parameter: any, block: any) {
        let tx = parameter.TX.code;
        let rx = parameter.RX.code;
        let lm = parameter.LM.code;
        let yl = parameter.YL.code;
        Generator.addInclude('ArduBits_HBR740', '#include <ArduBits_ASR740.h>');
        Generator.addObject(`ASR_740`, `ASR_740`, `ASR740;`);
        Generator.addSetup(`ASR_740.ASR_init()`, `ASR740.ASR_do_init(${tx}, ${rx}, ${lm}, ${yl});`);
    }

    //% block="语音识别块识别  组号[ZH]" blockType="command"
    //% ZH.shadow="number" ZH.defl=2
    export function hbr740group(parameter: any, block: any) {
        let zh = parameter.ZH.code;
        Generator.addInclude('ArduBits_HBR740', '#include <ArduBits_ASR740.h>');
        Generator.addCode(`ASR740.ASR_group(${zh});\n  ASR740.ASR_start_one_discern(10);`);        
    }

    //% block="语音识别块获取识别的序号" blockType="reporter"
    export function hbr740rec(parameter: any, block: any) {
        Generator.addInclude('ArduBits_HBR740', '#include <ArduBits_ASR740.h>');
        Generator.addCode(`ASR740.ASR_one_receive()`);
    }

    //% block="语音识别块被唤醒" blockType="boolean"
    export function hbr740startrec(parameter: any, block: any) {
        Generator.addInclude('ArduBits_HBR740', '#include <ArduBits_ASR740.h>');
        Generator.addCode(`ASR740.ASR_start_receive()`);
    }   

    
    //% block="语音识别块睡眠" blockType="command"
    export function hbr740start(parameter: any, block: any) {
        Generator.addInclude('ArduBits_HBR740', '#include <ArduBits_ASR740.h>');
        Generator.addCode(`ASR740.ASR_group(1);\n  ASR740.ASR_start_continuous_discern();`);
    }

}
