Forward from cvs-log. Gustavo?
--- Begin Message --- Attached is a patch to lcd.py and rc.py that enables the CrystalFontz 633 keypad to be used with Freevo. Similar changes should work with other keypads that use lcdproc.
lcdproc 0.5 nightly build was used. Unsure if the code works with lcdproc 0.4x (633 keypad unsupported)diff -Naur freevo/src/plugins/lcd.py freevo-new/src/plugins/lcd.py --- freevo/src/plugins/lcd.py 2004-02-23 16:30:28.000000000 +1100 +++ freevo-new/src/plugins/lcd.py 2004-05-06 21:37:20.000000000 +1000 @@ -104,6 +104,7 @@ from event import * import config import util +import rc try: import pylcd except: @@ -752,7 +753,13 @@ plugin.register( self, "lcd" ) - + # 633 CrystalFontz Keypad. Register Keys for Freevo + self.lcd.send("client_add_key Up") + self.lcd.send("client_add_key Down") + self.lcd.send("client_add_key Left") + self.lcd.send("client_add_key Right") + self.lcd.send("client_add_key Enter") + self.lcd.send("client_add_key Escape") # Show welcome screen: for w in self.screens[ "welcome" ]: @@ -896,6 +903,22 @@ def poll( self ): if self.disable: return + # 633 CrystalFontz. Read a key press from the keypad and post the event + lcd_keyPress = self.lcd.read().strip() + + if lcd_keyPress == "key Up": + rc.post_event(Event(rc.key_event_mapper("UP"))) + elif lcd_keyPress == "key Down": + rc.post_event(Event(rc.key_event_mapper("DOWN"))) + elif lcd_keyPress == "key Left": + rc.post_event(Event(rc.key_event_mapper("LEFT"))) + elif lcd_keyPress == "key Right": + rc.post_event(Event(rc.key_event_mapper("RIGHT"))) + elif lcd_keyPress == "key Enter": + rc.post_event(Event(rc.key_event_mapper("SELECT"))) + elif lcd_keyPress == "key Escape": + rc.post_event(Event(rc.key_event_mapper("EXIT"))) + if self.playitem: self.draw( ( 'player', self.playitem ), None ) diff -Naur freevo/src/rc.py freevo-new/src/rc.py --- freevo/src/rc.py 2004-02-29 04:30:59.000000000 +1100 +++ freevo-new/src/rc.py 2004-05-06 21:52:19.000000000 +1000 @@ -99,8 +99,11 @@ """ get_singleton().set_context(context) - - +def key_event_mapper(key): + """ + 633 CrystalFontz keypad reuses the key_event_mapper method + """ + return get_singleton().key_event_mapper(key) # -------------------------------------------------------------------------------- # internal classes of this module
--- End Message ---
-- And on the seventh day, He exited from append mode.
