當前位置: 首頁>>代碼示例>>Python>>正文


Python ecodes.ABS_Y屬性代碼示例

本文整理匯總了Python中evdev.ecodes.ABS_Y屬性的典型用法代碼示例。如果您正苦於以下問題:Python ecodes.ABS_Y屬性的具體用法?Python ecodes.ABS_Y怎麽用?Python ecodes.ABS_Y使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在evdev.ecodes的用法示例。


在下文中一共展示了ecodes.ABS_Y屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from evdev import ecodes [as 別名]
# 或者: from evdev.ecodes import ABS_Y [as 別名]
def __init__(self, can_id):
        self.can_id = can_id
        axis_cap = AbsInfo(-32700,32700,0,0,0,0)
        self._ev = UInput(name='vjoy',
            events={
                 ecodes.EV_ABS: [
                     (ecodes.ABS_X, axis_cap),
                     (ecodes.ABS_Y, axis_cap),
                     (ecodes.ABS_Z, axis_cap)
                 ],
                 ecodes.EV_KEY: [
                     ecodes.BTN_TRIGGER, 
                     ecodes.BTN_TOP, 
                     ecodes.BTN_TOP2
                 ]
            }
        ) 
開發者ID:fishpepper,項目名稱:pyUSBtin,代碼行數:19,代碼來源:elobau_j6_joystick.py

示例2: signal

# 需要導入模塊: from evdev import ecodes [as 別名]
# 或者: from evdev.ecodes import ABS_Y [as 別名]
def signal(self, x, y, z, b0, b1, b2):
       self._ev.write(ecodes.EV_ABS, ecodes.ABS_X, x)
       self._ev.write(ecodes.EV_ABS, ecodes.ABS_Y, y)
       self._ev.write(ecodes.EV_ABS, ecodes.ABS_Z, z)
       self._ev.write(ecodes.EV_KEY, ecodes.BTN_TRIGGER, b0)
       self._ev.write(ecodes.EV_KEY, ecodes.BTN_TOP,     b1)
       self._ev.write(ecodes.EV_KEY, ecodes.BTN_TOP2,    b2)
       self._ev.syn() 
開發者ID:fishpepper,項目名稱:pyUSBtin,代碼行數:10,代碼來源:elobau_j6_joystick.py

示例3: read_events

# 需要導入模塊: from evdev import ecodes [as 別名]
# 或者: from evdev.ecodes import ABS_Y [as 別名]
def read_events(self, device):
        for event in device.read():
            if event.type == ecodes.EV_ABS:
                if event.code == ecodes.ABS_X:
                    if self.emulation_mode != 'G29':
                        value = event.value * 4
                    else:
                        value = event.value
                    self.ui.set_steering_input(value)
                elif event.code == ecodes.ABS_Y:
                    if self.emulation_mode == 'DFGT' or self.emulation_mode == 'DFP':
                        self.ui.set_accelerator_input(event.value)
                    else:
                        self.ui.set_clutch_input(event.value)
                elif event.code == ecodes.ABS_Z:
                    if self.emulation_mode == 'DFGT' or self.emulation_mode == 'DFP':
                        self.ui.set_brakes_input(event.value)
                    else:
                        self.ui.set_accelerator_input(event.value)
                elif event.code == ecodes.ABS_RZ:
                    self.ui.set_brakes_input(event.value)
                elif event.code == ecodes.ABS_HAT0X:
                    self.ui.set_hatx_input(event.value)
                    if event.value == -1:
                        self.on_button_press(100, 1)
                    elif event.value == 1:
                        self.on_button_press(101, 1)
                elif event.code == ecodes.ABS_HAT0Y:
                    self.ui.set_haty_input(event.value)
                    if event.value == -1:
                        self.on_button_press(102, 1)
                    elif event.value == 1:
                        self.on_button_press(103, 1)
            if event.type == ecodes.EV_KEY:
                if event.value:
                    delay = 0
                else:
                    delay = 100
                if event.code >= 288 and event.code <= 303:
                    button = event.code - 288
                if event.code >= 704 and event.code <= 712:
                    button = event.code - 688
                self.ui.set_btn_input(button, event.value, delay)
                self.on_button_press(button, event.value) 
開發者ID:berarma,項目名稱:oversteer,代碼行數:46,代碼來源:gui.py


注:本文中的evdev.ecodes.ABS_Y屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。