mini板hid修改
删除不亮
This commit is contained in:
@@ -104,7 +104,6 @@ export const actuator_mixgo_zero_led_color = {
|
|||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
.appendField(Blockly.Msg.MIXLY_LCD_SETCOLOR)
|
.appendField(Blockly.Msg.MIXLY_LCD_SETCOLOR)
|
||||||
.appendField(new Blockly.FieldDropdown([
|
.appendField(new Blockly.FieldDropdown([
|
||||||
[Blockly.Msg.MIXLY_LIGHT_OFF, "0"],
|
|
||||||
[Blockly.Msg.MIXLY_LIGHT_RED, "1"],
|
[Blockly.Msg.MIXLY_LIGHT_RED, "1"],
|
||||||
[Blockly.Msg.MIXLY_LIGHT_GREEN, "2"],
|
[Blockly.Msg.MIXLY_LIGHT_GREEN, "2"],
|
||||||
[Blockly.Msg.MIXLY_LIGHT_BLUE, "3"],
|
[Blockly.Msg.MIXLY_LIGHT_BLUE, "3"],
|
||||||
@@ -1005,10 +1004,8 @@ export const analog_keyboard_input = {
|
|||||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_KEYBOARD_INPUT);
|
.appendField(Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_KEYBOARD_INPUT);
|
||||||
this.appendValueInput('special')
|
this.appendValueInput('special');
|
||||||
.appendField(Blockly.Msg.MIXLY_SPECIAL_KEY);
|
this.appendValueInput('general');
|
||||||
this.appendValueInput('general')
|
|
||||||
.appendField(Blockly.Msg.MIXLY_GENERAL_KEY);
|
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.MIXLY_RELEASE)
|
.appendField(Blockly.Msg.MIXLY_RELEASE)
|
||||||
.appendField(new Blockly.FieldDropdown([
|
.appendField(new Blockly.FieldDropdown([
|
||||||
@@ -1026,6 +1023,7 @@ export const special_key = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
|
.appendField(Blockly.Msg.MIXLY_SPECIAL_KEY)
|
||||||
.appendField(new Blockly.FieldDropdown([
|
.appendField(new Blockly.FieldDropdown([
|
||||||
[Blockly.Msg.MIXLY_SPECIAL_KEY0,"0"],
|
[Blockly.Msg.MIXLY_SPECIAL_KEY0,"0"],
|
||||||
[Blockly.Msg.MIXLY_SPECIAL_KEY1, "1"],
|
[Blockly.Msg.MIXLY_SPECIAL_KEY1, "1"],
|
||||||
@@ -1045,6 +1043,7 @@ export const general_key = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
|
.appendField(Blockly.Msg.MIXLY_GENERAL_KEY)
|
||||||
.appendField(new Blockly.FieldDropdown([
|
.appendField(new Blockly.FieldDropdown([
|
||||||
[Blockly.Msg.MIXLY_SPECIAL_KEY0,"0"],
|
[Blockly.Msg.MIXLY_SPECIAL_KEY0,"0"],
|
||||||
['A', "0x04"],
|
['A', "0x04"],
|
||||||
@@ -1073,32 +1072,32 @@ export const general_key = {
|
|||||||
['X', "0x1B"],
|
['X', "0x1B"],
|
||||||
['Y', "0x1C"],
|
['Y', "0x1C"],
|
||||||
['Z', "0x1D"],
|
['Z', "0x1D"],
|
||||||
['ONE', "0x1E"],
|
['1', "0x1E"],
|
||||||
['TWO', "0x1F"],
|
['2', "0x1F"],
|
||||||
['THREE', "0x20"],
|
['3', "0x20"],
|
||||||
['FOUR', "0x21"],
|
['4', "0x21"],
|
||||||
['FIVE', "0x22"],
|
['5', "0x22"],
|
||||||
['SIX', "0x23"],
|
['6', "0x23"],
|
||||||
['SEVEN', "0x24"],
|
['7', "0x24"],
|
||||||
['EIGHT', "0x25"],
|
['8', "0x25"],
|
||||||
['NINE', "0x26"],
|
['9', "0x26"],
|
||||||
['ZERO', "0x27"],
|
['0', "0x27"],
|
||||||
['ENTER', "0x28"],
|
['ENTER', "0x28"],
|
||||||
['ESC', "0x29"],
|
['ESC', "0x29"],
|
||||||
['BACKSPACE', "0x2A"],
|
['BACKSPACE', "0x2A"],
|
||||||
['TAB', "0x2B"],
|
['TAB', "0x2B"],
|
||||||
['SPACE', "0x2C"],
|
['SPACE', "0x2C"],
|
||||||
['MINUS', "0x2D"],
|
['-', "0x2D"],
|
||||||
['EQUAL', "0x2E"],
|
['=', "0x2E"],
|
||||||
['LEFT_BRACE', "0x2F"],
|
['{', "0x2F"],
|
||||||
['RIGHT_BRACE', "0x30"],
|
['}', "0x30"],
|
||||||
['BACKSLASH', "0x31"],
|
['\\', "0x31"],
|
||||||
['SEMICOLON', "0x33"],
|
[';', "0x33"],
|
||||||
['QUOTE', "0x34"],
|
['"', "0x34"],
|
||||||
['TILDE', "0x35"],
|
['`', "0x35"],
|
||||||
['COMMA', "0x36"],
|
[',', "0x36"],
|
||||||
['PERIOD', "0x37"],
|
['.', "0x37"],
|
||||||
['SLASH', "0x38"],
|
['/', "0x38"],
|
||||||
['CAPS_LOCK', "0x39"],
|
['CAPS_LOCK', "0x39"],
|
||||||
['F1', "0x3A"],
|
['F1', "0x3A"],
|
||||||
['F2', "0x3B"],
|
['F2', "0x3B"],
|
||||||
@@ -1126,39 +1125,192 @@ export const general_key = {
|
|||||||
['DOWN', "0x51"],
|
['DOWN', "0x51"],
|
||||||
['UP', "0x52"],
|
['UP', "0x52"],
|
||||||
['NUM_LOCK', "0x53"],
|
['NUM_LOCK', "0x53"],
|
||||||
['NUMPAD_SLASH', "0x54"],
|
['/', "0x54"],
|
||||||
['NUMPAD_ASTERISK', "0x55"],
|
['*', "0x55"],
|
||||||
['NUMPAD_MINUS', "0x56"],
|
['-', "0x56"],
|
||||||
['NUMPAD_PLUS', "0x57"],
|
['+', "0x57"],
|
||||||
['NUMPAD_ENTER', "0x58"],
|
['ENTER', "0x58"],
|
||||||
['NUMPAD_1', "0x59"],
|
['1', "0x59"],
|
||||||
['NUMPAD_2', "0x5A"],
|
['2', "0x5A"],
|
||||||
['NUMPAD_3', "0x5B"],
|
['3', "0x5B"],
|
||||||
['NUMPAD_4', "0x5C"],
|
['4', "0x5C"],
|
||||||
['NUMPAD_5', "0x5D"],
|
['5', "0x5D"],
|
||||||
['NUMPAD_6', "0x5E"],
|
['6', "0x5E"],
|
||||||
['NUMPAD_7', "0x5F"],
|
['7', "0x5F"],
|
||||||
['NUMPAD_8', "0x60"],
|
['8', "0x60"],
|
||||||
['NUMPAD_9', "0x61"],
|
['9', "0x61"],
|
||||||
['NUMPAD_0', "0x62"],
|
['0', "0x62"],
|
||||||
['NUMPAD_PERIOD', "0x63"]
|
['.', "0x63"]
|
||||||
]), 'op')
|
]), 'op')
|
||||||
this.setOutput(true);
|
this.setOutput(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export const general_key_tuple = {
|
||||||
|
init: function () {
|
||||||
|
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||||
|
this.itemCount_ = 2;
|
||||||
|
this.updateShape_();
|
||||||
|
this.setOutput(true);
|
||||||
|
this.setMutator(new Blockly.icons.MutatorIcon(['generalkey_create_with_item'], this));
|
||||||
|
this.setTooltip(Blockly.Msg.GENERALKEY_TUPLE_CREATE_TOOLTIP);
|
||||||
|
},
|
||||||
|
|
||||||
|
mutationToDom: function() {
|
||||||
|
var container = document.createElement('mutation');
|
||||||
|
container.setAttribute('items', this.itemCount_);
|
||||||
|
return container;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Parse XML to restore the list inputs.
|
||||||
|
* @param {!Element} xmlElement XML storage element.
|
||||||
|
* @this Blockly.Block
|
||||||
|
*/
|
||||||
|
domToMutation: function(xmlElement) {
|
||||||
|
this.itemCount_ = parseInt(xmlElement.getAttribute('items'), 10);
|
||||||
|
this.updateShape_();
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Populate the mutator's dialog with this block's components.
|
||||||
|
* @param {!Blockly.Workspace} workspace Mutator's workspace.
|
||||||
|
* @return {!Blockly.Block} Root block in mutator.
|
||||||
|
* @this Blockly.Block
|
||||||
|
*/
|
||||||
|
decompose: function(workspace) {
|
||||||
|
var containerBlock =
|
||||||
|
workspace.newBlock('generalkey_container');
|
||||||
|
containerBlock.initSvg();
|
||||||
|
var connection = containerBlock.getInput('STACK').connection;
|
||||||
|
for (var i = 0; i < this.itemCount_; i++) {
|
||||||
|
var itemBlock = workspace.newBlock('generalkey_create_with_item');
|
||||||
|
itemBlock.initSvg();
|
||||||
|
connection.connect(itemBlock.previousConnection);
|
||||||
|
connection = itemBlock.nextConnection;
|
||||||
|
}
|
||||||
|
return containerBlock;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Reconfigure this block based on the mutator dialog's components.
|
||||||
|
* @param {!Blockly.Block} containerBlock Root block in mutator.
|
||||||
|
* @this Blockly.Block
|
||||||
|
*/
|
||||||
|
compose: function(containerBlock) {
|
||||||
|
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||||
|
// Count number of inputs.
|
||||||
|
var connections = [];
|
||||||
|
var i = 0;
|
||||||
|
while (itemBlock) {
|
||||||
|
connections[i] = itemBlock.valueConnection_;
|
||||||
|
itemBlock = itemBlock.nextConnection &&
|
||||||
|
itemBlock.nextConnection.targetBlock();
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
this.itemCount_ = i;
|
||||||
|
this.updateShape_();
|
||||||
|
// Reconnect any child blocks.
|
||||||
|
for (var i = 0; i < this.itemCount_; i++) {
|
||||||
|
if (connections[i]) {
|
||||||
|
this.getInput('ADD' + i).connection.connect(connections[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Store pointers to any connected child blocks.
|
||||||
|
* @param {!Blockly.Block} containerBlock Root block in mutator.
|
||||||
|
* @this Blockly.Block
|
||||||
|
*/
|
||||||
|
saveConnections: function(containerBlock) {
|
||||||
|
var itemBlock = containerBlock.getInputTargetBlock('STACK');
|
||||||
|
var i = 0;
|
||||||
|
while (itemBlock) {
|
||||||
|
var input = this.getInput('ADD' + i);
|
||||||
|
itemBlock.valueConnection_ = input && input.connection.targetConnection;
|
||||||
|
i++;
|
||||||
|
itemBlock = itemBlock.nextConnection &&
|
||||||
|
itemBlock.nextConnection.targetBlock();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Modify this block to have the correct number of inputs.
|
||||||
|
* @private
|
||||||
|
* @this Blockly.Block
|
||||||
|
*/
|
||||||
|
updateShape_: function() {
|
||||||
|
// Delete everything.
|
||||||
|
if (this.getInput('EMPTY')) {
|
||||||
|
this.removeInput('EMPTY');
|
||||||
|
} else {
|
||||||
|
var i = 0;
|
||||||
|
while (this.getInput('ADD' + i)) {
|
||||||
|
this.removeInput('ADD' + i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Rebuild block.
|
||||||
|
if (this.itemCount_ == 0) {
|
||||||
|
this.appendDummyInput('EMPTY')
|
||||||
|
.appendField(Blockly.Msg.GENERALKEY_CREATE_EMPTY_TITLE);
|
||||||
|
} else {
|
||||||
|
for (var i = 0; i < this.itemCount_; i++) {
|
||||||
|
var input = this.appendValueInput('ADD' + i);
|
||||||
|
if (i == 0) {
|
||||||
|
input.appendField(Blockly.Msg.GENERALKEY_CREATE_WITH_INPUT_WITH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getVars: function() {
|
||||||
|
return [this.getFieldValue('VAR')];
|
||||||
|
},
|
||||||
|
renameVar: function(oldName, newName) {
|
||||||
|
if (Blockly.Names.equals(oldName, this.getFieldValue('VAR'))) {
|
||||||
|
this.setTitleValue(newName, 'VAR');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const generalkey_container = {
|
||||||
|
/**
|
||||||
|
* Mutator block for list container.
|
||||||
|
* @this Blockly.Block
|
||||||
|
*/
|
||||||
|
init: function() {
|
||||||
|
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.MIXLY_GENERAL_KEY);
|
||||||
|
this.appendStatementInput('STACK');
|
||||||
|
this.setTooltip(Blockly.Msg.GENERALKEY_CONTAINER_TOOLTIP);
|
||||||
|
this.contextMenu = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const generalkey_create_with_item = {
|
||||||
|
/**
|
||||||
|
* Mutator bolck for adding items.
|
||||||
|
* @this Blockly.Block
|
||||||
|
*/
|
||||||
|
init: function() {
|
||||||
|
this.setColour(ACTUATOR_EXTERN_HUE);
|
||||||
|
this.appendDummyInput()
|
||||||
|
.appendField(Blockly.Msg.blockpy_SET_VARIABLES_NAME);
|
||||||
|
this.setPreviousStatement(true);
|
||||||
|
this.setNextStatement(true);
|
||||||
|
this.setTooltip(Blockly.Msg.TUPLE_CREATE_WITH_ITEM_TOOLTIP);
|
||||||
|
this.contextMenu = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export const analog_mouse_input = {
|
export const analog_mouse_input = {
|
||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
.appendField(Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_MOUSE_INPUT);
|
.appendField(Blockly.Msg.ANALOG+Blockly.Msg.MIXLY_MOUSE_INPUT);
|
||||||
this.appendValueInput('key')
|
this.appendValueInput('key');
|
||||||
.appendField(Blockly.Msg.MIXLY_MOUSE_KEYS);
|
|
||||||
this.appendValueInput('x')
|
this.appendValueInput('x')
|
||||||
.appendField(Blockly.Msg.MIXLY_X_Y_CHANGES+'x:');
|
.appendField(Blockly.Msg.MIXLY_X_CHANGES);
|
||||||
this.appendValueInput('y')
|
this.appendValueInput('y')
|
||||||
.appendField('y:');
|
.appendField(Blockly.Msg.MIXLY_Y_CHANGES);
|
||||||
this.appendValueInput('wheel')
|
this.appendValueInput('wheel')
|
||||||
.appendField(Blockly.Msg.MIXLY_WHEEL_CHANGES);
|
.appendField(Blockly.Msg.MIXLY_WHEEL_CHANGES);
|
||||||
this.appendDummyInput()
|
this.appendDummyInput()
|
||||||
@@ -1178,6 +1330,7 @@ export const mouse_key = {
|
|||||||
init: function () {
|
init: function () {
|
||||||
this.setColour(ACTUATOR_ONBOARD_HUE);
|
this.setColour(ACTUATOR_ONBOARD_HUE);
|
||||||
this.appendDummyInput("")
|
this.appendDummyInput("")
|
||||||
|
.appendField(Blockly.Msg.MIXLY_MOUSE_KEYS)
|
||||||
.appendField(new Blockly.FieldDropdown([
|
.appendField(new Blockly.FieldDropdown([
|
||||||
[Blockly.Msg.MIXLY_SPECIAL_KEY0,"0"],
|
[Blockly.Msg.MIXLY_SPECIAL_KEY0,"0"],
|
||||||
[Blockly.Msg.MIXLY_MOUSE_LEFT_KEY, "1"],
|
[Blockly.Msg.MIXLY_MOUSE_LEFT_KEY, "1"],
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ export const analog_keyboard_input = function (_, generator) {
|
|||||||
var ge = generator.valueToCode(this, 'general', generator.ORDER_ATOMIC);
|
var ge = generator.valueToCode(this, 'general', generator.ORDER_ATOMIC);
|
||||||
var re = this.getFieldValue('release');
|
var re = this.getFieldValue('release');
|
||||||
generator.definitions_['import_' + version + '_onboard_bot'] = 'from ' + version + ' import onboard_bot';
|
generator.definitions_['import_' + version + '_onboard_bot'] = 'from ' + version + ' import onboard_bot';
|
||||||
var code = "hid_keyboard(special="+sp+",general="+ge+",release="+re+")\n";
|
var code = "hid_keyboard("+sp+","+ge+","+re+")\n";
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,3 +489,21 @@ export const analog_keyboard_str = function (_, generator) {
|
|||||||
var code = "onboard_bot.hid_keyboard_str("+str+",delay="+t+")\n";
|
var code = "onboard_bot.hid_keyboard_str("+str+",delay="+t+")\n";
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const general_key_tuple = function(_, generator) {
|
||||||
|
// Create a list with any number of elements of any type.
|
||||||
|
var dropdown_type = this.getFieldValue('TYPE');
|
||||||
|
var code = new Array(this.itemCount_);
|
||||||
|
var default_value = '0';
|
||||||
|
for (var n = 0; n < this.itemCount_; n++) {
|
||||||
|
|
||||||
|
code[n] = generator.valueToCode(this, 'ADD' + n,
|
||||||
|
generator.ORDER_NONE) || default_value;
|
||||||
|
}
|
||||||
|
if (this.itemCount_!=1){
|
||||||
|
var code = '(' + code.join(', ') + ')';}
|
||||||
|
else {
|
||||||
|
var code = '(' + code.join(', ') + ',)';}
|
||||||
|
|
||||||
|
return [code, generator.ORDER_ATOMIC];
|
||||||
|
};
|
||||||
@@ -43,6 +43,8 @@ class BOT035(FrameBuffer):
|
|||||||
if 0x20 <= ord(ch) <= 0x7f:
|
if 0x20 <= ord(ch) <= 0x7f:
|
||||||
char_index = 2 + (ord(ch)-32) * _FONT_W
|
char_index = 2 + (ord(ch)-32) * _FONT_W
|
||||||
return _FONT5x8_CODE[char_index : char_index + _FONT_W]
|
return _FONT5x8_CODE[char_index : char_index + _FONT_W]
|
||||||
|
else:
|
||||||
|
raise ValueError("Cannot display characters other than ASCLL code")
|
||||||
|
|
||||||
def _uincode(self, ch):
|
def _uincode(self, ch):
|
||||||
'''uincode code font reading data'''
|
'''uincode code font reading data'''
|
||||||
@@ -54,7 +56,7 @@ class BOT035(FrameBuffer):
|
|||||||
elif 0xff01 <= uni <= 0xffe5 :
|
elif 0xff01 <= uni <= 0xffe5 :
|
||||||
_address = 0x25734 + (uni - 0xff01) * 4
|
_address = 0x25734 + (uni - 0xff01) * 4
|
||||||
else:
|
else:
|
||||||
return None, 0
|
raise ValueError("Cannot display characters other than GB2312 code")
|
||||||
buffer = bytearray(4)
|
buffer = bytearray(4)
|
||||||
flash_read(_Uincode_ADDR + _address, buffer)
|
flash_read(_Uincode_ADDR + _address, buffer)
|
||||||
font_info = buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0]
|
font_info = buffer[3] << 24 | buffer[2] << 16 | buffer[1] << 8 | buffer[0]
|
||||||
@@ -138,7 +140,7 @@ class BOT035(FrameBuffer):
|
|||||||
self._buffer[i] = self._buffer[i] | buffer[i]
|
self._buffer[i] = self._buffer[i] | buffer[i]
|
||||||
|
|
||||||
def _ascall_bitmap(self, buffer, x=0):
|
def _ascall_bitmap(self, buffer, x=0):
|
||||||
if -_FONT_W <= x <= _LEDS_W and buffer is not None:
|
if -_FONT_W <= x <= _LEDS_W:
|
||||||
for _x in range(_FONT_W):
|
for _x in range(_FONT_W):
|
||||||
for _y in range(_FONT_H):
|
for _y in range(_FONT_H):
|
||||||
if (buffer[_x] >> _y) & 0x1:
|
if (buffer[_x] >> _y) & 0x1:
|
||||||
@@ -146,7 +148,7 @@ class BOT035(FrameBuffer):
|
|||||||
|
|
||||||
def _uincode_bitmap(self, buffer, x=0):
|
def _uincode_bitmap(self, buffer, x=0):
|
||||||
_buffer, width = buffer
|
_buffer, width = buffer
|
||||||
if -width < x < _LEDS_H and _buffer is not None:
|
if -width < x < _LEDS_H:
|
||||||
for _y in range(12):
|
for _y in range(12):
|
||||||
for _x in range(width):
|
for _x in range(width):
|
||||||
if _buffer[_y * ((width + 7) // 8) + _x // 8] & (0x80 >> (_x & 7)):
|
if _buffer[_y * ((width + 7) // 8) + _x // 8] & (0x80 >> (_x & 7)):
|
||||||
@@ -222,9 +224,9 @@ class BOT035(FrameBuffer):
|
|||||||
return self._i2c.readfrom(_BOT035_ADDRESS, nbytes)[0]
|
return self._i2c.readfrom(_BOT035_ADDRESS, nbytes)[0]
|
||||||
|
|
||||||
def reset(self):
|
def reset(self):
|
||||||
"""Reset SPK, PWM registers to default state"""
|
"""Reset SPK, PWM, HID registers to default state"""
|
||||||
self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_SPK, b'\x0A\x00\x00\x00\x20\x4E\x64\x64')
|
self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_SPK, b'\x0A\x00\x00\x00\x20\x4E\x64\x64')
|
||||||
self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_KB, bytes(9))
|
#self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_KB, bytes(9))
|
||||||
|
|
||||||
def get_brightness(self):
|
def get_brightness(self):
|
||||||
return self._brightness
|
return self._brightness
|
||||||
@@ -285,11 +287,12 @@ class BOT035(FrameBuffer):
|
|||||||
def hid_keyboard(self, special=0, general=0, release=True):
|
def hid_keyboard(self, special=0, general=0, release=True):
|
||||||
self._buf = bytearray(4)
|
self._buf = bytearray(4)
|
||||||
self._buf[0] = special
|
self._buf[0] = special
|
||||||
if type(general) is int:
|
if type(general) in (tuple, list):
|
||||||
self._buf[1] = general
|
|
||||||
elif type(general) is tuple:
|
|
||||||
for i in range(len(general)):
|
for i in range(len(general)):
|
||||||
|
if i > 2: break
|
||||||
self._buf[i + 1] = general[i]
|
self._buf[i + 1] = general[i]
|
||||||
|
else:
|
||||||
|
self._buf[1] = general
|
||||||
self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_KB, self._buf)
|
self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_KB, self._buf)
|
||||||
if release:
|
if release:
|
||||||
time.sleep_ms(10)
|
time.sleep_ms(10)
|
||||||
@@ -297,21 +300,15 @@ class BOT035(FrameBuffer):
|
|||||||
|
|
||||||
def hid_keyboard_str(self, string, delay=0):
|
def hid_keyboard_str(self, string, delay=0):
|
||||||
for char in str(string):
|
for char in str(string):
|
||||||
self._wreg(_BOT035_STR, ord(char))
|
self._wreg(_BOT035_STR, ord(char) & 0xFF)
|
||||||
time.sleep_ms(20 + delay)
|
time.sleep_ms(20 + delay)
|
||||||
|
|
||||||
def hid_mouse(self, keys=0, move=(0, 0), wheel=0, release=True):
|
def hid_mouse(self, keys=0, move=(0, 0), wheel=0, release=True):
|
||||||
self._buf = bytearray(4)
|
self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_MS, bytes([keys & 0x0F, move[0] & 0xFF, move[1] & 0xFF, wheel & 0xFF]))
|
||||||
self._buf[0] = keys
|
|
||||||
self._buf[1] = move[0]
|
|
||||||
self._buf[2] = move[1]
|
|
||||||
self._buf[3] = wheel
|
|
||||||
self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_MS, self._buf)
|
|
||||||
if release:
|
if release:
|
||||||
time.sleep_ms(10)
|
time.sleep_ms(10)
|
||||||
self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_MS, bytes(4))
|
self._i2c.writeto_mem(_BOT035_ADDRESS, _BOT035_MS, bytes(4))
|
||||||
|
|
||||||
|
|
||||||
"""Graph module"""
|
"""Graph module"""
|
||||||
HEART=b'\x00\x0c\x1e?~\xfc~?\x1e\x0c\x00\x00'
|
HEART=b'\x00\x0c\x1e?~\xfc~?\x1e\x0c\x00\x00'
|
||||||
HEART_SMALL=b'\x00\x00\x0c\x1e<x<\x1e\x0c\x00\x00\x00'
|
HEART_SMALL=b'\x00\x00\x0c\x1e<x<\x1e\x0c\x00\x00\x00'
|
||||||
|
|||||||
@@ -1703,18 +1703,25 @@
|
|||||||
</block>
|
</block>
|
||||||
<block type="analog_keyboard_input" m-show="micropython:esp32c2:mixgo_mini">
|
<block type="analog_keyboard_input" m-show="micropython:esp32c2:mixgo_mini">
|
||||||
<value name="special">
|
<value name="special">
|
||||||
<shadow type="special_key">
|
<block type="special_key">
|
||||||
</shadow>
|
</block>
|
||||||
</value>
|
</value>
|
||||||
<value name="general">
|
<value name="general">
|
||||||
<shadow type="general_key">
|
<block type="general_key">
|
||||||
</shadow>
|
</block>
|
||||||
</value>
|
</value>
|
||||||
</block>
|
</block>
|
||||||
|
<block type="general_key_tuple" m-show="micropython:esp32c2:mixgo_mini">
|
||||||
|
<value name="general">
|
||||||
|
<block type="general_key">
|
||||||
|
</block>
|
||||||
|
</value>
|
||||||
|
</block>
|
||||||
|
|
||||||
<block type="analog_mouse_input" m-show="micropython:esp32c2:mixgo_mini">
|
<block type="analog_mouse_input" m-show="micropython:esp32c2:mixgo_mini">
|
||||||
<value name="key">
|
<value name="key">
|
||||||
<shadow type="mouse_key">
|
<block type="mouse_key">
|
||||||
</shadow>
|
</block>
|
||||||
</value>
|
</value>
|
||||||
<value name="x">
|
<value name="x">
|
||||||
<shadow type="math_number">
|
<shadow type="math_number">
|
||||||
@@ -1737,6 +1744,7 @@
|
|||||||
</value>
|
</value>
|
||||||
<value name="time">
|
<value name="time">
|
||||||
<shadow type="math_number">
|
<shadow type="math_number">
|
||||||
|
<field name="NUM">10</field>
|
||||||
</shadow>
|
</shadow>
|
||||||
</value>
|
</value>
|
||||||
</block>
|
</block>
|
||||||
|
|||||||
@@ -3641,7 +3641,7 @@ En.MIXLY_KEYBOARD_INPUT = "keyboard input";
|
|||||||
En.MIXLY_SPECIAL_KEY = "special key";
|
En.MIXLY_SPECIAL_KEY = "special key";
|
||||||
En.MIXLY_GENERAL_KEY = "general key";
|
En.MIXLY_GENERAL_KEY = "general key";
|
||||||
En.MIXLY_RELEASE = "automatic release";
|
En.MIXLY_RELEASE = "automatic release";
|
||||||
En.MIXLY_SPECIAL_KEY0 = "no operation (release)";
|
En.MIXLY_SPECIAL_KEY0 = "no operation";
|
||||||
En.MIXLY_SPECIAL_KEY1 = "Left Control key";
|
En.MIXLY_SPECIAL_KEY1 = "Left Control key";
|
||||||
En.MIXLY_SPECIAL_KEY2 = "Left Shift key";
|
En.MIXLY_SPECIAL_KEY2 = "Left Shift key";
|
||||||
En.MIXLY_SPECIAL_KEY4 = "Left Alt key";
|
En.MIXLY_SPECIAL_KEY4 = "Left Alt key";
|
||||||
@@ -3652,11 +3652,16 @@ En.MIXLY_SPECIAL_KEY64 = "Right Alt key";
|
|||||||
En.MIXLY_SPECIAL_KEY128 = "Right Windows key";
|
En.MIXLY_SPECIAL_KEY128 = "Right Windows key";
|
||||||
En.MIXLY_MOUSE_INPUT = "mouse input";
|
En.MIXLY_MOUSE_INPUT = "mouse input";
|
||||||
En.MIXLY_MOUSE_KEYS = "mouse button";
|
En.MIXLY_MOUSE_KEYS = "mouse button";
|
||||||
En.MIXLY_X_Y_CHANGES = "change in the x and y axes ";
|
En.MIXLY_X_CHANGES = "change in the x axe ";
|
||||||
|
En.MIXLY_Y_CHANGES = "change in the y axe ";
|
||||||
En.MIXLY_MOUSE_LEFT_KEY = "left key";
|
En.MIXLY_MOUSE_LEFT_KEY = "left key";
|
||||||
En.MIXLY_MOUSE_RIGHT_KEY = "right key";
|
En.MIXLY_MOUSE_RIGHT_KEY = "right key";
|
||||||
En.MIXLY_MOUSE_MID_KEY = "middle key";
|
En.MIXLY_MOUSE_MID_KEY = "middle key";
|
||||||
En.MIXLY_WHEEL_CHANGES = "roller change amount";
|
En.MIXLY_WHEEL_CHANGES = "roller change amount";
|
||||||
En.MIXLY_STR_PRINT = "character input";
|
En.MIXLY_STR_PRINT = "character input";
|
||||||
En.MIXLY_STR_PRINT_TIME_DELAY = "per character interval";
|
En.MIXLY_STR_PRINT_TIME_DELAY = "per character interval";
|
||||||
|
En.GENERALKEY_CONTAINER_TOOLTIP = "Add, remove, or rearrange sections to reconfigure the key combination.";
|
||||||
|
En.GENERALKEY_CREATE_EMPTY_TITLE = "Empty key combinations";
|
||||||
|
En.GENERALKEY_CREATE_WITH_INPUT_WITH = "combinate the normal keys";
|
||||||
|
En.GENERALKEY_TUPLE_CREATE_TOOLTIP = "combinate the keys as a tuple, and up to 3 keys can be combined";
|
||||||
})();
|
})();
|
||||||
@@ -3789,7 +3789,7 @@ ZhHans.MIXLY_KEYBOARD_INPUT = "键盘输入";
|
|||||||
ZhHans.MIXLY_SPECIAL_KEY = "特殊按键";
|
ZhHans.MIXLY_SPECIAL_KEY = "特殊按键";
|
||||||
ZhHans.MIXLY_GENERAL_KEY = "普通按键";
|
ZhHans.MIXLY_GENERAL_KEY = "普通按键";
|
||||||
ZhHans.MIXLY_RELEASE = "自动释放";
|
ZhHans.MIXLY_RELEASE = "自动释放";
|
||||||
ZhHans.MIXLY_SPECIAL_KEY0 = "无操作(释放)";
|
ZhHans.MIXLY_SPECIAL_KEY0 = "无操作";
|
||||||
ZhHans.MIXLY_SPECIAL_KEY1 = "左Control键";
|
ZhHans.MIXLY_SPECIAL_KEY1 = "左Control键";
|
||||||
ZhHans.MIXLY_SPECIAL_KEY2 = "左Shift键";
|
ZhHans.MIXLY_SPECIAL_KEY2 = "左Shift键";
|
||||||
ZhHans.MIXLY_SPECIAL_KEY4 = "左Alt键";
|
ZhHans.MIXLY_SPECIAL_KEY4 = "左Alt键";
|
||||||
@@ -3800,11 +3800,16 @@ ZhHans.MIXLY_SPECIAL_KEY64 = "右Alt键";
|
|||||||
ZhHans.MIXLY_SPECIAL_KEY128 = "右Windows键";
|
ZhHans.MIXLY_SPECIAL_KEY128 = "右Windows键";
|
||||||
ZhHans.MIXLY_MOUSE_INPUT = "鼠标输入";
|
ZhHans.MIXLY_MOUSE_INPUT = "鼠标输入";
|
||||||
ZhHans.MIXLY_MOUSE_KEYS = "鼠标按键";
|
ZhHans.MIXLY_MOUSE_KEYS = "鼠标按键";
|
||||||
ZhHans.MIXLY_X_Y_CHANGES = "x、y轴改变量 ";
|
ZhHans.MIXLY_X_CHANGES = "x轴移动 ";
|
||||||
|
ZhHans.MIXLY_Y_CHANGES = "y轴移动 ";
|
||||||
ZhHans.MIXLY_MOUSE_LEFT_KEY = "左键";
|
ZhHans.MIXLY_MOUSE_LEFT_KEY = "左键";
|
||||||
ZhHans.MIXLY_MOUSE_RIGHT_KEY = "右键";
|
ZhHans.MIXLY_MOUSE_RIGHT_KEY = "右键";
|
||||||
ZhHans.MIXLY_MOUSE_MID_KEY = "中键";
|
ZhHans.MIXLY_MOUSE_MID_KEY = "中键";
|
||||||
ZhHans.MIXLY_WHEEL_CHANGES = "滚轮改变量";
|
ZhHans.MIXLY_WHEEL_CHANGES = "滚轮滚动";
|
||||||
ZhHans.MIXLY_STR_PRINT = "字符输入";
|
ZhHans.MIXLY_STR_PRINT = "字符输入";
|
||||||
ZhHans.MIXLY_STR_PRINT_TIME_DELAY = "每个字符间隔";
|
ZhHans.MIXLY_STR_PRINT_TIME_DELAY = "每个字符间隔";
|
||||||
|
ZhHans.GENERALKEY_CONTAINER_TOOLTIP = "增加、删除或重新排列各部分以此重新配置这个按键组合。";
|
||||||
|
ZhHans.GENERALKEY_CREATE_EMPTY_TITLE = "空按键组合";
|
||||||
|
ZhHans.GENERALKEY_CREATE_WITH_INPUT_WITH = "组合普通按键为";
|
||||||
|
ZhHans.GENERALKEY_TUPLE_CREATE_TOOLTIP = "组合按键为元组,最多可组合3个按键";
|
||||||
})();
|
})();
|
||||||
@@ -3644,7 +3644,7 @@ ZhHant.MIXLY_KEYBOARD_INPUT = "鍵盤輸入";
|
|||||||
ZhHant.MIXLY_SPECIAL_KEY = "特殊按鍵";
|
ZhHant.MIXLY_SPECIAL_KEY = "特殊按鍵";
|
||||||
ZhHant.MIXLY_GENERAL_KEY = "普通按鍵";
|
ZhHant.MIXLY_GENERAL_KEY = "普通按鍵";
|
||||||
ZhHant.MIXLY_RELEASE = "自動釋放";
|
ZhHant.MIXLY_RELEASE = "自動釋放";
|
||||||
ZhHant.MIXLY_SPECIAL_KEY0 = "無操作(釋放)";
|
ZhHant.MIXLY_SPECIAL_KEY0 = "無操作";
|
||||||
ZhHant.MIXLY_SPECIAL_KEY1 = "左Control鍵";
|
ZhHant.MIXLY_SPECIAL_KEY1 = "左Control鍵";
|
||||||
ZhHant.MIXLY_SPECIAL_KEY2 = "左Shift鍵";
|
ZhHant.MIXLY_SPECIAL_KEY2 = "左Shift鍵";
|
||||||
ZhHant.MIXLY_SPECIAL_KEY4 = "左Alt鍵";
|
ZhHant.MIXLY_SPECIAL_KEY4 = "左Alt鍵";
|
||||||
@@ -3655,11 +3655,16 @@ ZhHant.MIXLY_SPECIAL_KEY64 = "右Alt鍵";
|
|||||||
ZhHant.MIXLY_SPECIAL_KEY128 = "右Windows鍵";
|
ZhHant.MIXLY_SPECIAL_KEY128 = "右Windows鍵";
|
||||||
ZhHant.MIXLY_MOUSE_INPUT = "鼠標輸入";
|
ZhHant.MIXLY_MOUSE_INPUT = "鼠標輸入";
|
||||||
ZhHant.MIXLY_MOUSE_KEYS = "鼠標按鍵";
|
ZhHant.MIXLY_MOUSE_KEYS = "鼠標按鍵";
|
||||||
ZhHant.MIXLY_X_Y_CHANGES = "x、y軸改變量 ";
|
ZhHant.MIXLY_X_CHANGES = "x軸移動 ";
|
||||||
|
ZhHant.MIXLY_Y_CHANGES = "y軸移動 ";
|
||||||
ZhHant.MIXLY_MOUSE_LEFT_KEY = "左鍵";
|
ZhHant.MIXLY_MOUSE_LEFT_KEY = "左鍵";
|
||||||
ZhHant.MIXLY_MOUSE_RIGHT_KEY = "右鍵";
|
ZhHant.MIXLY_MOUSE_RIGHT_KEY = "右鍵";
|
||||||
ZhHant.MIXLY_MOUSE_MID_KEY = "中鍵";
|
ZhHant.MIXLY_MOUSE_MID_KEY = "中鍵";
|
||||||
ZhHant.MIXLY_WHEEL_CHANGES = "滾輪改變量";
|
ZhHant.MIXLY_WHEEL_CHANGES = "滾輪滑動";
|
||||||
ZhHant.MIXLY_STR_PRINT = "字符輸入";
|
ZhHant.MIXLY_STR_PRINT = "字符輸入";
|
||||||
ZhHant.MIXLY_STR_PRINT_TIME_DELAY = "每個字符間隔";
|
ZhHant.MIXLY_STR_PRINT_TIME_DELAY = "每個字符間隔";
|
||||||
|
ZhHant.GENERALKEY_CONTAINER_TOOLTIP = "增加、刪除或重新排列各部分以此重新配置這個按鍵組合。";
|
||||||
|
ZhHant.GENERALKEY_CREATE_EMPTY_TITLE = "空按鍵組合";
|
||||||
|
ZhHant.GENERALKEY_CREATE_WITH_INPUT_WITH = "組合普通按鍵為";
|
||||||
|
ZhHant.GENERALKEY_TUPLE_CREATE_TOOLTIP = "組合按鍵為元組,最多可組合3個按鍵";
|
||||||
})();
|
})();
|
||||||
Reference in New Issue
Block a user