CONTROLLER / WII

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 CMM2

Syntax:
CONTROLLER CLASSIC OPEN [n] [,interrupt [,bitmask] ]
CONTROLLER CLASSIC CLOSE [n]
CONTROLLER MOUSE OPEN [n] [,LEFTBUTTONint] [,RIGHTBUTTONint] [,sensitivity]
CONTROLLER MOUSE CLOSE [n]
CONTROLLER NUNCHUK OPEN [n] [,Zinterrupt [,Cinterrupt] ]
CONTROLLER NUNCHUK CLOSE [n]

Description:

CONTROLLER can be replaced with WII

 
WII CLASSIC OPEN [n] [,interrupt [,bitmask] ]
Opens a Classic port for communications. 
'n' is the I2C channel that the Classic is connected to. If not specified channel 3 is opened (the front panel Wii connector). 
'interrupt' is an optional MMbasic interrupt routine that will be triggered when buttons are pressed. 
The interrupts trigger once on the button press and will not re-interrupt until it is released. 
The bitmask specifies which of the 15 buttons on the Wii Classic will trigger an interrupt. The default is that they all will. 
See the CLASSIC function for details of which bits in the bitmask control which buttons. 
The firmware checks for the existence of a controller on open and will throw error if not found. 
Once open the Classic is polled continuously in the background once every 16mSec. 
The I2C transfers are under interrupt control and non-blocking for the rest of the firmware. 
The I2C channel is opened at 100KHz - other I2C devices can share the I2C port with the Classic if required in which case I2C(n) OPEN should not be called. 


WII CLASSIC CLOSE [n]
WII CLASSIC CLOSE will close the Wii port n. If the parameter is omitted channel 3 is closed. 

Also see the CLASSIC() function for accessing the state of the device.

CONTROLLER MOUSE OPEN [n] [,LEFTBUTTONint] [,RIGHTBUTTONint] [,sensitivity]
Opens a Hobbytronic Mouse port for communications. 'n' is the I2C channel that the Nunchuk is connected to. 
If not specified channel 2 is opened (pins 27 and 28 on the I/O port). 
Channel 0 refers to a PS/2 mouse connected to pin33 (clock) and pin 32(data). 4.7k pullup to 5V resistors are required
'LEFTBUTTONint' and 'RIGHTBUTTONint' are optional MMbasic interrupt routines that will be triggered when one or other of the mouse buttons is pressed. 
The interrupts trigger once on the button press and will not re-interrupt until it is released. 
The firmware checks for the existence of a controller on open and will throw error if not found. This error can be trapped with the ON ERROR command. 
Once open the mouse I/F is polled continuously in the background once every 16mSec. 
The I2C transfers are under interrupt control and non-blocking for the rest of the firmware. 
The I2C channel is opened at 100KHz - other I2C devices can share the I2C port with the mouse if required in which case I2C(n) OPEN should not be called.
'Sensitivity' allows you to tune the sensitivity of the Hobbytronic mice I/F by specifying a number between 0 and 10. 
0 indicates that the default automaitic sensitivity should be used. Other values will explicitly set the sensitivity as per the Hobbytronic documentation. 
For the PS2 mouse the sensitivity can be set between 0 and 8. 
Values of 1-4 set the resolution of the mouse to 1,2, 4 or 8 counts/mm. 
Values 5-8 do the same but in addition enable mouse scaling which gives a non-linear relationship between speed and count.
NB: not all PS2 mice seem to implement these commands.


CONTROLLER MOUSE CLOSE [n]
'n' is the i2c channel or zero for a PS/2 mouse and defaults to 2
Closes the controller

Also see the MOUSE() function for accessing the state of the device.

WII NUNCHUK OPEN [n] [,Zinterrupt [,Cinterrupt] ]
Opens a Nunchuk port for communications. 
'n' is the I2C channel that the Nunchuk is connected to. If not specified channel 3 is opened (the front panel Wii connector). 
'Cinterrupt' and 'Zinterrupt' are optional MMbasic interrupt routines that will be triggered when one or other of the buttons is pressed. 
The interrupts trigger once on the button press and will not re-interrupt until it is released. The firmware checks for the existence of a controller on open and will throw error if not found. 
This error can be trapped with the ON ERROR command. 
If a classic controller is plugged in instead, an error will not be thrown, instead you can check the ID code with NUNCHUK(T, channel). 
Once open the Nunchuk is polled continuously in the background once every 16mSec. 
The I2C transfers are under interrupt control and non-blocking for the rest of the firmware.
The I2C channel is opened at 100KHz - other I2C devices can share the I2C port with the Nunchuk if required in which case I2C(n) OPEN should not be called. 

WII NUNCHUK CLOSE [n]
WII NUNCHUK CLOSE will close the Nunchuk port n. If the parameter is omitted channel 3 is closed. 

Also see the NUNCHUK() function for accessing the state of the device.

 

Last edited: 03 January, 2021