Before we continue experimenting with psp2d let's take a look at other psp modules.
This module provides information about the psp, and some other functions like changing cpu/bus speed:
pspos.setclocks(333,166) # To set both CPU and Bus clock pspos.setclock(333) # To set the CPU clock only pspos.setbus(166) # To set the bus speed only pspos.getclocks() # To get the current clock
This functions are usually useless since the python interpreter will automatically set the clock for you. Apart from messing around with clock speed, the pspos module provides information about various aspects of the psp system:
pspos.freemem() # Return amount of free memory pspos.battery() # Returns a list containing different values about the battery pspos.battery() # Returns battery charge percentage pspos.getnickname() # Returns the current users nickname
And last but not least, the function:
As you can see you have to pass a parameter, there are a total of 9 parameters, depending on what information you require:
PSP_SYSTEMPARAM_ID_STRING_NICKNAME = 1 PSP_SYSTEMPARAM_ID_INT_ADHOC_CHANNEL = 2 PSP_SYSTEMPARAM_ID_INT_WLAN_POWERSAVE = 3 PSP_SYSTEMPARAM_ID_INT_DATE_FORMAT = 4 PSP_SYSTEMPARAM_ID_INT_TIME_FORMAT = 5 PSP_SYSTEMPARAM_ID_INT_TIMEZONE = 6 PSP_SYSTEMPARAM_ID_INT_DAYLIGHTSAVINGS = 7 PSP_SYSTEMPARAM_ID_INT_LANGUAGE = 8 PSP_SYSTEMPARAM_ID_INT_UNKNOWN = 9
So if you want to retrieve the system language (PSP_SYSTEMPARAM_ID_INT_LANGUAGE), you use:
because 8 is the ID for PSP_SYSTEMPARAM_ID_INT_LANGUAGE. Now be careful because PSP_SYSTEMPARAM_ID_INT_LANGUAGE returns another number, instead of the real language. Using that returned number you have to identify the laguage by yourself:
PSP_SYSTEMPARAM_LANGUAGE_JAPANESE = 0 PSP_SYSTEMPARAM_LANGUAGE_ENGLISH = 1 PSP_SYSTEMPARAM_LANGUAGE_FRENCH = 2 PSP_SYSTEMPARAM_LANGUAGE_SPANISH = 3 PSP_SYSTEMPARAM_LANGUAGE_GERMAN = 4 PSP_SYSTEMPARAM_LANGUAGE_ITALIAN = 5 PSP_SYSTEMPARAM_LANGUAGE_DUTCH = 6 PSP_SYSTEMPARAM_LANGUAGE_PORTUGUESE = 7 PSP_SYSTEMPARAM_LANGUAGE_RUSSIAN = 8 PSP_SYSTEMPARAM_LANGUAGE_KOREAN = 9 PSP_SYSTEMPARAM_LANGUAGE_CHINESE_TRADITIONAL = 10 PSP_SYSTEMPARAM_LANGUAGE_CHINESE_SIMPLIFIED = 11
so if pspos.getsystemparam(8) returns 1 you know the language is english, but if it returns 3 you know the number is spanish. Also PSP_SYSTEMPARAM_ID_STRING_NICKNAME is the same as pspos.getnickname(), as a matter of fact if you call pspos.getsystemparam(1) it will itself call pspos.getnickname(). That's basically it for this module, take a look at it since it's very easy to understand.
This module provides functions about sound such as music playback and volume control. Setting the volume:
vol has to be a number between 0 and 255.
again, vol has to be a number between 0 and 255. Play a file:
music = pspsnd.Music("path_to_file") music.start() music.stop()
as you can see, it's pretty straightforward.
To be honest, I haven't used this module myself, but looking at the source code and other examples it isn't that big a deal:
pspnet.connectToAPCTL(n) # Connect to AP, n has to be a number depending on the AP (see bellow) pspnet.disconnectAPCTL() # Disconnect from AP pspnet.wlanSwitchState() # Return the wlan switch state pspnet.wlanEtherAddr() # Return Ethernet Address pspnet.getAPCTLState() # Return state of connection pspnet.getIP() # Return IP address pspnet.enumConfigs() # Enumerate the different AP configurations
Well that's basically it. On the next lesson we'll start seeing some real examples.