text stringlengths 0 828 |
|---|
if isinstance(left, dict) and isinstance(right, dict): |
return attrs |
else: |
joined_class = type(left.__class__.__name__ + right.__class__.__name__, (Union,), |
{}) |
return joined_class(attrs)" |
3899,"def setKeyButton( self, btnId, keyCallback, bounceTime = DEF_BOUNCE_TIME_NORMAL, pullUpDown = GPIO.PUD_UP, event = GPIO.BOTH ): |
""""""! |
\~english |
Set key button event |
@param btnId: Key button pin number in BCM |
@param keyCallback: A interrupt <b>callback_function</b> or <b>None</b>. <br> |
If set to <b>None</b> means keybutton work in query mode<br> |
then uses RPiKeyButtons#readKeyButton for get keybutton status |
@param bounceTime: Default set to DEF_BOUNCE_TIME_NORMAL |
@param pullUpDown: Default set to GPIO.PUD_UP |
@param event: Default set to GPIO.BOTH. it can be: { GPIO.RISING | GPIO.FALLING | GPIO.BOTH } |
\~chinese |
设置按键事件 |
@param btnId: 按键IO号(in BCM mode) |
@param keyCallback: 按键中断回调函数 <b>callback_function</b> 或 <b>None</b><br> |
如果设置为<b>None</b>,则表示按键工作在查询模式<br> |
然后使用 RPiKeyButtons#readKeyButton 获取 keybutton 状态 |
@param bounceTime: 默认 DEF_BOUNCE_TIME_NORMAL |
@param pullUpDown: 默认 GPIO.PUD_UP |
@param event: 默认 GPIO.BOTH 它可以是: { GPIO.RISING | GPIO.FALLING | GPIO.BOTH } |
\~ \n |
@see DEF_BOUNCE_TIME_SHORT_MON (10ms) |
@see DEF_BOUNCE_TIME_SHORT (50ms) |
@see DEF_BOUNCE_TIME_NORMAL (100ms) |
@see DEF_BOUNCE_TIME_LONG (200ms) |
@note |
* setKeyButton(btnId = 12, keyCallback = None ) |
* setKeyButton(btnId = 14, keyCallback = aKeyCallbackFun ) <br> |
<pre> |
\# a simple callback function |
def aKeyCallbackFun(channel): |
print(channel) |
pass |
</pre> |
"""""" |
GPIO.setup( btnId, GPIO.IN, pull_up_down=pullUpDown) |
# The keyCallback is None means setting keybutton in query mode, |
# then uses readKeyButton for get keybutton status |
# event can be { RISING, FALLING, BOTH } |
if keyCallback != None: |
try: |
GPIO.add_event_detect( btnId, event, callback=keyCallback, bouncetime=bounceTime ) |
except: |
pass |
pass" |
3900,"def removeKeyButtonEvent(self, buttons= [] ): |
""""""! |
\~english |
Remove key button event callbacks |
@param buttons: an array of button Ids. eg. [ 12,13,15, ...] |
\~chinese |
移除按键事件回调 |
@param buttons: 按钮ID数组。 例如: [12,13,15,...] |
"""""" |
for i in range( 0, len(buttons)-1 ): |
GPIO.remove_event_detect( buttons[i] )" |
3901,"def configKeyButtons( self, enableButtons = [], bounceTime = DEF_BOUNCE_TIME_NORMAL, pullUpDown = GPIO.PUD_UP, event = GPIO.BOTH ): |
""""""! |
\~english |
Config multi key buttons IO and event on same time |
@param enableButtons: an array of key button configs. eg. <br> |
[{ ""id"":BUTTON_ACT_A, ""callback"": aCallbackFun }, ... ] |
@param bounceTime: Default set to DEF_BOUNCE_TIME_NORMAL |
@param pullUpDown: Default set to GPIO.PUD_UP |
@param event: Default set to GPIO.BOTH. it can be: { GPIO.RISING | GPIO.FALLING | GPIO.BOTH } |
\~chinese |
同时配置多个按键IO和事件 |
@param enableButtons: 组按键配置 例如: <br> |
[{ ""id"":BUTTON_ACT_A, ""callback"": aCallbackFun }, ... ] |
@param bounceTime: 默认 DEF_BOUNCE_TIME_NORMAL |
@param pullUpDown: 默认 GPIO.PUD_UP |
@param event: 默认 GPIO.BOTH 它可以是: { GPIO.RISING | GPIO.FALLING | GPIO.BOTH } |
\~ \n |
@see DEF_BOUNCE_TIME_SHORT_MON (10ms) |
@see DEF_BOUNCE_TIME_SHORT (50ms) |
@see DEF_BOUNCE_TIME_NORMAL (100ms) |
@see DEF_BOUNCE_TIME_LONG (200ms) |
"""""" |
for key in enableButtons: |
self.setKeyButton( key[""id""], key[""callback""], bounceTime, pullUpDown, event ) |
pass" |
3902,"def matches_from_list(item,options,fuzzy=90,fname_match=True,fuzzy_fragment=None,guess=False): |
'''Returns the members of ``options`` that best matches ``item``. Will prioritize |
exact matches, then filename-style matching, then fuzzy matching. Returns a tuple of item, |
index, match type, and fuzziness (if applicable) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.