Several questions about pspctrl.h

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
darkn3ss
Posts: 6
Joined: Mon Aug 25, 2008 6:31 pm

Several questions about pspctrl.h

Post by darkn3ss »

1. what's a psp ctrl mode? what are the differences between PSP_CTRL_MODE_DIGITAL & PSP_CTRL_MODE_ANALOG?
2. what does the sample cycle do? is it in seconds or milisec?
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

While digital input can trigger an interrupt (and so its handling is small-profile) an analog nub requires a thread to continuously poll its state...by setting ctrl mode you basically turn on or off that polling thread. Sample cycle should be the period of a polling loop (but atm i cannot say what measure it is....sorry, i never write program from scratch, i always use templates, and this kind of things i figured out years ago, and never touched again!!).

jean
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Re: Several questions about pspctrl.h

Post by hlide »

darkn3ss wrote:1. what's a psp ctrl mode? what are the differences between PSP_CTRL_MODE_DIGITAL & PSP_CTRL_MODE_ANALOG?
2. what does the sample cycle do? is it in seconds or milisec?
1. PSP_CTRL_MODE_DIGITAL : no A-PAD (the nub under your left thumb)

2. PSP_CTRL_MODE_ANALOG on : if you set 0, the A-PAD reading is done at V-SYNC frequency (60 updates per second). You can set your own period which is normally given in ms as I doubt it is ns and surely not in s !
darkn3ss
Posts: 6
Joined: Mon Aug 25, 2008 6:31 pm

Post by darkn3ss »

i m a little bit confused by your answers, folks
i'll put it my way.
1. for Jean, i guess what you are saying is: DIGITAL mode is a discrete mode which input is triggered by button press; and ANALOG mode is a consecutive which generates another thread to collect key presses.
and i m a little bit agree with you on that point, i have to confirm with it after several tests.

2. for hlide, thanks for your answer, but i m sorry to say that i dont follow most of what you are saying, could you please explain in more detail about it? thank you very much ;-)
User avatar
Raphael
Posts: 646
Joined: Tue Jan 17, 2006 4:54 pm
Location: Germany
Contact:

Post by Raphael »

As the others already said: CTRL_MODE_ANALOG enables the analog nub polling (analog, because it returns an analog signal in form of values 0-255 for each axis), while CTRL_MODE_DIGITAL disables that and only reads the digital input from D-Pad (digital because the signal is digital in each direction: either on [pressed] or off [not pressed]).
The digital pad is always on though, so a better descriptive name for CTRL_MODE_DIGITAL would be CTRL_MODE_NO_ANALOG actually.

And as hlide intended to say: The sampling cycle method is only applicable if CTRL_MODE_ANALOG is set, in which case it tells how often to poll the analog nub data. I don't know what the exact parameter is, ms might be a good guess, but normally you should just set it to 0.
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

darkn3ss wrote:2. for hlide, thanks for your answer, but i m sorry to say that i dont follow most of what you are saying, could you please explain in more detail about it? thank you very much ;-)
lol, ok. Normally you set 0 (as stated by Raphael) to have a 60 Hz refresh of analog nub data in the internal control pad buffer. Internally, when VSYNC callback is executed, the callback also updates the internal control pad buffer. This is why when you use a sceCtrlReadXXX function, it is always synched with the VSYNC signal, which means you shouldn't call repeatly this function without redrawing a display frame, or you would miss frames because the second would wait for the next VSYNC until it could return the next control pad data.

You can also set your own timing (you'll be no longer synched with VSYNC) to update the internal control pad buffer by choosing a non-zero period in ms : kernel will set an internal timer to update the buffer for your given period and would run independently from VSYNC.
darkn3ss
Posts: 6
Joined: Mon Aug 25, 2008 6:31 pm

Post by darkn3ss »

thanks folks, that would help a lot ;-)
Post Reply