PSPZ Project WIP
hlide..........
will be posting the example driver code i used and general data format in next couple of days, will then assemble some "dev" units and distribute them to interested software developers, will take another week, then still on target to offer consumer units in about 2.7 months. At the moment sourcing EXACTLY the right size touchscreens is proving a problem, but will sort it ! So suppose its going well with all the usual unexpected delays !!
will be posting the example driver code i used and general data format in next couple of days, will then assemble some "dev" units and distribute them to interested software developers, will take another week, then still on target to offer consumer units in about 2.7 months. At the moment sourcing EXACTLY the right size touchscreens is proving a problem, but will sort it ! So suppose its going well with all the usual unexpected delays !!
ta88v2 are fine, it is v3 the real problem :pjean wrote:yeah...i was thinking to pass to a slim before ta88v2 hell arrives here in europe, but 60 euros of difference for 32Mb of ram and a tv-out are an exageration (i mean...selling my phat and re-buying a slim will cost me approx 60 euros)
What do you exactly mean by "dev-units"?
jean............ im making and distributing ( free to interested commited developers ) about 10 dev units, these will be functionally identical to the final production units except very "rough" in terms of the hardware ( stick on screen, trailling wires etc ). Its going to cost me, but im hoping that by the time of the launch there will be a number of hombrew apps and games supporting the screen. Im going to be taking PM,s from interested developers today or tomorrow sometime and hopefully shipping the dev units to people by end of week, thats why asked if you were running slim, cos phat dev units not ready !
No blog im affraid, have zero idea how to go about one !!, who hosts that kind of thing ?
No blog im affraid, have zero idea how to go about one !!, who hosts that kind of thing ?
-
- Posts: 328
- Joined: Sun Jun 03, 2007 10:05 pm
Good progress :) Phat units not yet ready?
Last edited by KickinAezz on Wed Aug 06, 2008 10:27 pm, edited 1 time in total.
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Use it more for Development than for Gaming.
no not worried about the legality as hlide pointed out its damn sight less contraversial than something like pandora. Yes V1 works only through the sio hence is only a cfw product that is going to limit the customer base big time but since the main motivation is not to make money, but to get the screen out there supported by devs, as long as i break even not to worrid :)
hi guys, her is another 2 vids showing app have done, will post the code in a bit, BUT DONT FLAME ME !!!!!, am just starting on psp code and the code is shit!!!!! not exactly text-book c!!! ( coming from a microcontroller background where even function calls are a no-no when they eat up your stack!! )
http://ru.youtube.com/watch?v=eXNpe7NWaZw
http://ru.youtube.com/watch?v=vzesLXiYHN0
http://ru.youtube.com/watch?v=eXNpe7NWaZw
http://ru.youtube.com/watch?v=vzesLXiYHN0
-
- Posts: 328
- Joined: Sun Jun 03, 2007 10:05 pm
Great progress!jube wrote:hi guys, her is another 2 vids showing app have done, will post the code in a bit, BUT DONT FLAME ME !!!!!, am just starting on psp code and the code is shit!!!!! not exactly text-book c!!! ( coming from a microcontroller background where even function calls are a no-no when they eat up your stack!! )
http://ru.youtube.com/watch?v=eXNpe7NWaZw
http://ru.youtube.com/watch?v=vzesLXiYHN0
Be sure to post 2 versions of the code
1: The code you consider shit. (i.e. the as-is version)
2: Cleaned up.
Just curious of programming style of a programmer for microcontrollers. :)
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Use it more for Development than for Gaming.
thats the source to the osk that video'ed, posting it to let developers know how the serial data stream looks like, its all very simple, and a little derivative but hey just starting!
this bit uses jeans sio prx but its just as good using the sdk call ( at 14400 obviously ! )
this bit uses jeans sio prx but its just as good using the sdk call ( at 14400 obviously ! )
Code: Select all
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspsdk.h>
#include <pspctrl.h>
#include <stdio.h>
#include <string.h>
#include <oslib/oslib.h>
#include "../../commons/callbacks.h"
#include "../../commons/calibrate.h"
PSP_MODULE_INFO("TS_SAMPLE", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_KB(12*1024);
char tschar = 0 ;
int sioReadChar();
int xread = 0;
int yread = 0;
int rread = 0;
int backspace = 0;
char screentext[1];
char redraw = 0;
char newchar = 0;
POINT touched,touchedscaled,touchedfinal;
POINT cal[3];
POINT tcal[3];
MATRIX calmatrix;
void sioInit(int,int);
void sioPutString(const char *, int);
int initOSLib(){
oslInit(0);
oslInitGfx(OSL_PF_8888, 1);
oslInitAudio();
oslSetQuitOnLoadFailure(1);
oslSetKeyAutorepeatInit(40);
oslSetKeyAutorepeatInterval(10);
return 0;
}
int byte2word ( int bytehigh, int bytelow )
{
int tally = 0;
tally = bytehigh ;
tally = tally << 8 ;
tally = tally | bytelow ;
return tally ;
}
char getTSChar (int yaxis,int xaxis)
{
char retchar = 0;
if ((yaxis > 60) && (yaxis < 100))
{
if ((xaxis > 0) && (xaxis < 43))
retchar = 0x31;
if ((xaxis > 43) && (xaxis < 86))
retchar = 0x32;
if ((xaxis > 86) && (xaxis < 131))
retchar = 0x33;
if ((xaxis > 131) && (xaxis < 175))
retchar = 0x34;
if ((xaxis > 175) && (xaxis < 218))
retchar = 0x35;
if ((xaxis > 218) && (xaxis < 262))
retchar = 0x36;
if ((xaxis > 262) && (xaxis < 306))
retchar = 0x37;
if ((xaxis > 306) && (xaxis < 350))
retchar = 0x38;
if ((xaxis > 350) && (xaxis < 393))
retchar = 0x39;
if ((xaxis > 393) && (xaxis < 435))
retchar = 0x30;
if ((xaxis > 435) && (xaxis <480))
retchar = 0x3F;
return(retchar);
}
if ((yaxis > 100) && (yaxis < 141))
{
if ((xaxis > 0) && (xaxis < 43))
retchar = 51;
if ((xaxis > 43) && (xaxis < 86))
retchar = 0x57;
if ((xaxis > 86) && (xaxis < 131))
retchar = 0x45;
if ((xaxis > 131) && (xaxis < 175))
retchar = 0x52;
if ((xaxis > 175) && (xaxis < 218))
retchar = 0x54;
if ((xaxis > 218) && (xaxis < 262))
retchar = 0x59;
if ((xaxis > 262) && (xaxis < 306))
retchar = 0x55;
if ((xaxis > 306) && (xaxis < 350))
retchar = 0x49;
if ((xaxis > 350) && (xaxis < 393))
retchar = 0x4f;
if ((xaxis > 393) && (xaxis < 435))
retchar = 0x50;
if ((xaxis > 435) && (xaxis <480))
retchar = 0x3f;
return(retchar);
}
if ((yaxis > 141) && (yaxis < 180))
{
if ((xaxis > 0) && (xaxis < 43))
retchar = 0x41;
if ((xaxis > 43) && (xaxis < 86))
retchar = 53;
if ((xaxis > 86) && (xaxis < 131))
retchar = 0x44;
if ((xaxis > 131) && (xaxis < 175))
retchar = 0x46;
if ((xaxis > 175) && (xaxis < 218))
retchar = 0x47;
if ((xaxis > 218) && (xaxis < 262))
retchar = 0x48;
if ((xaxis > 262) && (xaxis < 306))
retchar = 0x4A;
if ((xaxis > 306) && (xaxis < 350))
retchar = 0x4B;
if ((xaxis > 350) && (xaxis < 393))
retchar = 0x4c;
if ((xaxis > 393) && (xaxis < 435))
retchar = 0x3A;
if ((xaxis > 435) && (xaxis <480))
retchar = 0x3b;
return(retchar);
}
if ((yaxis > 180) && (yaxis < 220))
{
if ((xaxis > 0) && (xaxis < 43))
retchar = 0x5A;
if ((xaxis > 43) && (xaxis < 86))
retchar = 0x58;
if ((xaxis > 86) && (xaxis < 131))
retchar = 0x43;
if ((xaxis > 131) && (xaxis < 175))
retchar = 0x56;
if ((xaxis > 175) && (xaxis < 218))
retchar = 0x42;
if ((xaxis > 218) && (xaxis < 262))
retchar = 0x4e;
if ((xaxis > 262) && (xaxis < 306))
retchar = 0x4d;
if ((xaxis > 306) && (xaxis < 350))
retchar = 0x2c;
if ((xaxis > 350) && (xaxis < 393))
retchar = 0x2e;
if ((xaxis > 393) && (xaxis < 435))
retchar = 0x40;
if ((xaxis > 435) && (xaxis <480))
retchar = 0x3f;
return(retchar);
}
if ((yaxis > 100) && (yaxis < 141))
{
if ((xaxis > 0) && (xaxis < 43))
backspace = 1;
if ((xaxis > 43) && (xaxis < 86))
retchar = 0x20;
if ((xaxis > 86) && (xaxis < 131))
retchar = 0x0d;
return(retchar);
}
return(0);
}
int pollThread (SceSize args ,void * argp)
{
int ch = -1;
int readhigh = 0;
int readlow = 0;
float xf,yf ;
char oldchar = 0;
int keyrepeat = 0;
while(running())
{
ch = sioReadChar();
if(ch == 255)
{
ch = sioReadChar();
if(ch == 255)
{
readhigh = sioReadChar();
readlow = sioReadChar();
xf = ((byte2word ( readhigh,readlow )) - 45 ) / 1.77708 ;
xread = (int)xf;
if (xread > 480)
xread = 480;
if (xread < 0)
xread = 0;
xread = 480 - xread;
readhigh = sioReadChar();
readlow = sioReadChar();
yf = ((byte2word ( readhigh,readlow )) - 107 ) / 2.59191 ;
yread = (int)yf;
if (yread > 272)
yread = 272;
if (yread < 0)
yread = 0;
yread = 272 - yread;
readhigh = sioReadChar();
readlow = sioReadChar();
rread = byte2word ( readhigh,readlow ) ;
oldchar = newchar;
newchar = getTSChar(yread,xread);
if ((!(oldchar == newchar)) || (keyrepeat > 12) )
{
screentext[0] = newchar;
keyrepeat = 0;
redraw = 1;
}
else
{
keyrepeat++;
}
}
}
}
}
void createPollThread(){
SceUID thid;
thid = sceKernelCreateThread("sio polling thread", pollThread, 20, 16384, 0, NULL);
sceKernelStartThread(thid, 0, NULL);
}
int main(void)
{
int baud=9600;
initOSLib();
oslIntraFontInit(INTRAFONT_CACHE_MED);
pspDebugScreenInit();
//Load image:
OSL_IMAGE *bkg = oslLoadImageFilePNG("tskbd.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888);
pspDebugScreenPrintf("immage loaded\n");
//Load font:
OSL_FONT *pgfFont = oslLoadFontFile("flash0:/font/ltn0.pgf");
oslIntraFontSetStyle(pgfFont, 1.0, RGBA(255,255,255,255), RGBA(0,0,0,0), INTRAFONT_ALIGN_CENTER);
oslSetFont(pgfFont);
pspDebugScreenPrintf("font set\n");
oslStartDrawing();
oslDrawImageXY(bkg, 0, 0);
oslEndDrawing();
setupCallbacks(); // [home] handler
sceDisplayWaitVblankStart();
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
// load siodriver
SceUID mod = pspSdkLoadStartModule("sioDriver.prx", PSP_MEMORY_PARTITION_KERNEL);
if (mod < 0)
{
sceKernelDelayThread(3000000);
sceKernelExitGame();
}
sceKernelDelayThread(1000000);
sioInit(baud,0);
sceKernelDelayThread(1000000);
createPollThread();
while(running())
{
if (redraw)
{
oslStartDrawing();
oslDrawImageXY(bkg, 0, 0);
oslDrawString(100, 25, screentext);
oslEndDrawing();
redraw = 0;
pspDebugScreenPrintf(screentext);
}
}
sceKernelExitGame();
return 0;
}
Last edited by jube on Sun Aug 10, 2008 3:42 pm, edited 1 time in total.
Please, Jube, always use tag code "" to put a code source.
example :
Code: Select all
[code/]
example :
Code: Select all
int main(char **argv, int argc)
{
if (argc < 2)
{
...
}
return 0;
}
why OSLib??? no big deal having a whole graph library if you only have to do a pair of blits per cycle...moreover, the last time i checked OSLib, it was closed-source.
Some (very)small guidelines/advices:
in byte2word, no need for an in-memoy temp variable, let the compiler hold midvalues as registers that's way faster if you use it frequently.
so:
but you could even put an "inline" before declaration or (better) do it as a macro (through "define" directive)
in "char getTSChar (int yaxis,int xaxis) ", you don't need to perform all the checks once you find the pressed key, so in the big "if" list, you can write a lot of "else", or (better) you can simply return instead of setting a temp:
turn all divide for constant into multiply for constant...
will become
...don't know if compiler holds such an optimization all alone, but usually a multiply is 4x faster than division.
Oh, and put a sleep somewhere in that poll thread main-loop.
You are one of the few among new "devs" that really deserve help in my opinion. And i want to see your project working well, so when you need help, feel free to ask.
Some (very)small guidelines/advices:
in byte2word, no need for an in-memoy temp variable, let the compiler hold midvalues as registers that's way faster if you use it frequently.
so:
Code: Select all
int byte2word ( char h, char l)
{
return (h<<8)|l;
}
in "char getTSChar (int yaxis,int xaxis) ", you don't need to perform all the checks once you find the pressed key, so in the big "if" list, you can write a lot of "else", or (better) you can simply return instead of setting a temp:
Code: Select all
if ((yaxis > 60) && (yaxis < 100))
{
if ((xaxis > 0) && (xaxis < 43))
return 0x31;
if ((xaxis > 43) && (xaxis < 86))
return 0x32;
if ((xaxis > 86) && (xaxis < 131))
return 0x33;
.
.
.
}
Code: Select all
xf = ((byte2word ( readhigh,readlow )) - 45 ) / 1.77708 ;
Code: Select all
xf = ((byte2word ( readhigh,readlow )) - 45 ) * 0,563 ;
Oh, and put a sleep somewhere in that poll thread main-loop.
You are one of the few among new "devs" that really deserve help in my opinion. And i want to see your project working well, so when you need help, feel free to ask.
i'm not totally sure but -ffast-math option should allow compiler to do such such optimization.jean wrote:turn all divide for constant into multiply for constant...will becomeCode: Select all
xf = ((byte2word ( readhigh,readlow )) - 45 ) / 1.77708 ;
...don't know if compiler holds such an optimization all alone, but usually a multiply is 4x faster than division.Code: Select all
xf = ((byte2word ( readhigh,readlow )) - 45 ) * 0,563 ;
jube, great job! This looks very promising. You have added 1 of the most important features that Sony missed out. I think many of us will like to know how will the final product fit into the PSP Slim. Does the mod fit insides our PSP, or stick out like the one you've in the youtube video? If it fits inside the PSP, does your product come with a replacement faceplate?
jean........ hlide...thank you VERY much for your kind words and advice, its good stuff!!! will maker those changes when i get out of the hardware world!
phantom...unit will come in 2 flavours, a clip-on add-on, and an internal modification, the internal mod will include a custom molded top casing which accomidates the extra 1.7 to 0.9 mm touch screen. The clip-on should come in at a reasonable $60-80 ( break-even price ), but the internal mod will be horrably expensive!!
You cant see much cos of the camera, but the second videos are of the internal mod ( dev unit ) BTW. video is with my dev screen which by now is knackered! so response not that good!!
phantom...unit will come in 2 flavours, a clip-on add-on, and an internal modification, the internal mod will include a custom molded top casing which accomidates the extra 1.7 to 0.9 mm touch screen. The clip-on should come in at a reasonable $60-80 ( break-even price ), but the internal mod will be horrably expensive!!
You cant see much cos of the camera, but the second videos are of the internal mod ( dev unit ) BTW. video is with my dev screen which by now is knackered! so response not that good!!
jube, it's good to hear there will be 2 versions. I'm more interested in the internal mod, but this of course will depend on the final pricing. I understand making custom mold would be extremely expensive. You may even lose money if you don't sell a lot of units. To me, determine the pricing would be difficult. If the price is too high, you may not be able to sell many. If it's too low, you will need to sell a lot to even break even. Have you considered to sell you design or partner with other companies, such as neoflash or divineo? This could lower your risk.
To set up a Sparkfun 4wire resistive touchscreen controller transmitting via SIO RS232 to PSP:
3 chip circuit
<<3—3 chips are all you need for this circuit. The ADS7845 handles the analog functions and the
PIC performs the sequencing, scaling, and messaging formatting. The MAX232 handles the RS-232 level
shifting.>>
http://www.circuitcellar.com/library/pr ... 114/f3.htm
Pic circuit
<<6—Four of the PIC’s
digital lines are used to provide x
and y voltage gradients. A single
analog input is used to determine
the contact point by measuring
the pick-off voltage in both the x
and the y planes.>>
http://www.circuitcellar.com/library/pr ... 114/f4.htm
or
3 Volt one chip controller
<<The processor as interface is the Tritec
TR88L811, a dedicated 4-wire touchscreen interface device. It handles
all of the touchscreen scanning, touch detection, and message
formatting chores. The 3-VOLT device was originally developed for
the PDA industry.>>
as explained in
http://www.circuitcellar.com/library/pr ... lin114.pdf
or something ready to work with 5 Volt like
<<4-Wire Resistive TouchScreen RS232 Controller (SLT-TP05-RS232).>>
with software for all OS and PCs, included Linux and DOS.
http://shop-on-line.tvielectronics.com/ ... ontrollers
Any comment about setting up a Touchscreen controller for special applications for PSP?
3 chip circuit
<<3—3 chips are all you need for this circuit. The ADS7845 handles the analog functions and the
PIC performs the sequencing, scaling, and messaging formatting. The MAX232 handles the RS-232 level
shifting.>>
http://www.circuitcellar.com/library/pr ... 114/f3.htm
Pic circuit
<<6—Four of the PIC’s
digital lines are used to provide x
and y voltage gradients. A single
analog input is used to determine
the contact point by measuring
the pick-off voltage in both the x
and the y planes.>>
http://www.circuitcellar.com/library/pr ... 114/f4.htm
or
3 Volt one chip controller
<<The processor as interface is the Tritec
TR88L811, a dedicated 4-wire touchscreen interface device. It handles
all of the touchscreen scanning, touch detection, and message
formatting chores. The 3-VOLT device was originally developed for
the PDA industry.>>
as explained in
http://www.circuitcellar.com/library/pr ... lin114.pdf
or something ready to work with 5 Volt like
<<4-Wire Resistive TouchScreen RS232 Controller (SLT-TP05-RS232).>>
with software for all OS and PCs, included Linux and DOS.
http://shop-on-line.tvielectronics.com/ ... ontrollers
Any comment about setting up a Touchscreen controller for special applications for PSP?
PSP sio cannot provide million amperes, so i racomend using the fewest (already power-saving) components possible. The only way to go for phat and slim in my perspective (as the pic16f883 teached us in openKeyboard's story) is to use a single pic of the new family going 2v, capable of internal timing (no external quartz), chosen between those providing at least a 2 ways ADC. Single component, small (SMD version is VERY smal), no additional compoments but a capacitor, ease of mount and use, single firmware that can customize anything, ICSP. Wonderful. There is definitely no sense in using a max**** to adapt voltage level between two low-voltage devices. If i correctly understand, the meaning of jube's project is to spread the software support, too; remember this when you do your customized version of this project, if you do.To set up a Sparkfun 4wire resistive touchscreen controller transmitting via SIO RS232 to PSP:
....
If someone is in need of hints about a firmware, feel free to ask, i'm a low-level man atm ;)