esp32、c2、c3、s3增加蓝牙模拟键盘、鼠标

This commit is contained in:
Irene-Maxine
2024-09-30 16:52:08 +08:00
parent b24690576c
commit b4498b4827
9 changed files with 551 additions and 4 deletions

View File

@@ -1356,4 +1356,164 @@ export const analog_keyboard_str = {
this.setNextStatement(true);
this.setInputsInline(true);
}
};
};
export const analog_ble_keyboard_init = {
init:function(){
this.setColour(ACTUATOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.LISTS_SET_INDEX_SET+ Blockly.Msg.MIXLY_BLUETOOTH +Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_KEYBOARD);
this.appendValueInput('kname')
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_SYSTEM_DEVICE_NAME);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setInputsInline(true);
}
}
export const ble_keyboard_get_mac = {
init:function(){
this.setColour(ACTUATOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_GET+Blockly.Msg.MIXLY_BLUETOOTH +Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_KEYBOARD+Blockly.Msg.MIXLY_BELONG+Blockly.Msg.MIXLY_ETHERNET_MAC_ADDRESS);
this.setOutput(true);
this.setInputsInline(true);
}
}
export const ble_keyboard_connect = {
init:function(){
this.setColour(ACTUATOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_BLUETOOTH +Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_KEYBOARD+Blockly.Msg.MIXLY_IS_CONNECT);
this.setOutput(true);
this.setInputsInline(true);
}
}
export const analog_ble_keyboard_input = {
init: function () {
this.setColour(ACTUATOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_BLUETOOTH+Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_KEYBOARD)
.appendField(Blockly.Msg.MIXLY_SEND_KEYBOARD);
this.appendValueInput('special');
this.appendValueInput('general');
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_RELEASE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.MICROPYTHON_DISPLAY_YES, "True"],
[Blockly.Msg.MICROPYTHON_DISPLAY_NO, "False"]
]),'release');
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setInputsInline(true);
this.setTooltip(Blockly.Msg.MIXLY_BLUETOOTH+Blockly.Msg.ANALOG+ Blockly.Msg.MIXLY_KEYBOARD_INPUT);
}
};
export const analog_ble_keyboard_str = {
init:function(){
this.setColour(ACTUATOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_BLUETOOTH+Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_KEYBOARD);
this.appendValueInput('str')
.appendField(Blockly.Msg.MIXLY_SEND_KEYBOARD +Blockly.Msg.MIXLY_STR_PRINT);
this.appendValueInput('time')
.appendField(Blockly.Msg.MIXLY_STR_PRINT_TIME_DELAY);
this.appendDummyInput()
.appendField('ms');
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setInputsInline(true);
}
}
export const analog_ble_keyboard_send_battery = {
init:function(){
this.setColour(ACTUATOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_BLUETOOTH+Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_KEYBOARD);
this.appendValueInput('battery')
.appendField(Blockly.Msg.MIXLY_SEND_KEYBOARD+Blockly.Msg.MIXLY_BELONG+Blockly.Msg.MIXLY_BATTERY+Blockly.Msg.LISTS_SET_INDEX_INPUT_TO);
this.appendDummyInput()
.appendField('%');
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setInputsInline(true);
}
}
export const analog_ble_mouse_init = {
init:function(){
this.setColour(ACTUATOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.LISTS_SET_INDEX_SET+ Blockly.Msg.MIXLY_BLUETOOTH +Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_MOUSE);
this.appendValueInput('name')
.appendField(Blockly.Msg.MIXLY_MICROBIT_JS_SYSTEM_DEVICE_NAME);
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setInputsInline(true);
}
}
export const ble_mouse_get_mac = {
init:function(){
this.setColour(ACTUATOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_GET+Blockly.Msg.MIXLY_BLUETOOTH +Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_MOUSE+Blockly.Msg.MIXLY_BELONG+Blockly.Msg.MIXLY_ETHERNET_MAC_ADDRESS);
this.setOutput(true);
this.setInputsInline(true);
}
}
export const ble_mouse_connect = {
init:function(){
this.setColour(ACTUATOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_BLUETOOTH +Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_MOUSE+Blockly.Msg.MIXLY_IS_CONNECT);
this.setOutput(true);
this.setInputsInline(true);
}
}
export const analog_ble_mouse_input = {
init: function () {
this.setColour(ACTUATOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_BLUETOOTH+Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_MOUSE)
.appendField(Blockly.Msg.MIXLY_SEND +Blockly.Msg.MIXLY_MOUSE_INPUT);
this.appendValueInput('key');
this.appendValueInput('x')
.appendField(Blockly.Msg.MIXLY_X_CHANGES);
this.appendValueInput('y')
.appendField(Blockly.Msg.MIXLY_Y_CHANGES);
this.appendValueInput('wheel')
.appendField(Blockly.Msg.MIXLY_WHEEL_CHANGES);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_RELEASE)
.appendField(new Blockly.FieldDropdown([
[Blockly.Msg.MICROPYTHON_DISPLAY_YES, "True"],
[Blockly.Msg.MICROPYTHON_DISPLAY_NO, "False"]
]),'release');
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setInputsInline(true);
this.setTooltip(Blockly.Msg.MIXLY_BLUETOOTH+Blockly.Msg.ANALOG + Blockly.Msg.MIXLY_KEYBOARD_INPUT);
}
};
export const analog_ble_mouse_send_battery = {
init:function(){
this.setColour(ACTUATOR_ONBOARD_HUE);
this.appendDummyInput()
.appendField(Blockly.Msg.MIXLY_BLUETOOTH+Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_MOUSE);
this.appendValueInput('battery')
.appendField(Blockly.Msg.MIXLY_SEND+Blockly.Msg.MIXLY_MOUSE+Blockly.Msg.MIXLY_BELONG+Blockly.Msg.MIXLY_BATTERY+Blockly.Msg.LISTS_SET_INDEX_INPUT_TO);
this.appendDummyInput()
.appendField('%');
this.setPreviousStatement(true);
this.setNextStatement(true);
this.setInputsInline(true);
}
}