def __init__(self, wiimote): """ Initialisation sequence is described at http://wiibrew.org/wiki/Wiimote#Initialization_Sequence """ Module.__init__(self, wiimote) self.flags = 0 # start 7-step initialisation sequence # 1. Enable speaker # 2. Mute speaker # 3. Write 0x01 to register 0xa20009 # 4. Write 0x08 to register 0xa20001 # 5. Write 7-byte configuration to registers 0xa20001-0xa20008 # 6. Write 0x01 to register 0xa20008 # 7. Unmute speaker (so we can hear, dah) self.enableSpeaker() # 1 self.muteSpeaker() # 2 self.wiimote.write_registers([0xa2, 0x00, 0x09], [0x01]) # 3 if wiimote.logger.isEnabledFor(logging.DEBUG): wiimote.logger.debug("Write registers 1 : ok ") self.wiimote.write_registers([0xa2, 0x00, 0x01], [0x08]) # 4 if wiimote.logger.isEnabledFor(logging.DEBUG): wiimote.logger.debug("Write registers 2 : ok ") self.setSpeakerConfiguration() # 5 if wiimote.logger.isEnabledFor(logging.DEBUG): wiimote.logger.debug("Configuration : ok ") self.wiimote.write_registers([0xa2, 0x00, 0x08], [0x01]) # 6 if wiimote.logger.isEnabledFor(logging.DEBUG): wiimote.logger.debug("Write registers 3 : ok ") self.unmuteSpeaker() # 7 if wiimote.logger.isEnabledFor(logging.INFO): wiimote.logger.info ("Speaker initialisation done") # init is done, let's play :) # self.play([0x00, 0x00]) # <- get input somewhere with open("/home/chris/code/pywii/misc/prepare.wav", "r") as wav : data = wav.read(self.MAX_SIZE) while data != '': self.play(data) data = wav.read(self.MAX_SIZE)
def __init__(self, wiimote): """ Starts the module """ Module.__init__(self, wiimote)
def __init__(self, wiimote): Module.__init__(self, wiimote)
def __init__(self, wiimote): """ Buttons mapping initialization """ Module.__init__(self,wiimote)
def __init__(self,wiimote): Module.__init__(self,wiimote)