Please help support the site by donating at the link below.https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8ZRU34U47BESW
#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] handlersceDisplayWaitVblankStart();sceCtrlSetSamplingCycle(0);sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);// load siodriverSceUID 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;}
this is great too bad no release yet and i hope its real also the idiots comenting on the source are retards.
Hmmm I still have faith and dont wana call shinangins yet but he posted yesterday hes hours away from posting code so if I see no release tonight or tomorrow I will begin to lose faith
rtouch is derived from exiting the x,y plates in another combination, it is not fed from a seperate line.The direct soldering was in relation to the post by folklord, but he has uncovered an interesting idea, ie 1 axis could still be very usefull, and EXTREAMLY easy and cheap to implement as long as resistances are matched, or easy op-amp buffer is used, if one were clever even joystick could be retained
ching! you win the jackpot, yep thats how to do it, but watch the dallas its just a slow d/a and its impedence matching properties are suspect, there are much better devices for this application, again though your going to be adding more components if you want to retain the stick, ie buffer.Then again a PSOIC would give you a single chip solution, you may even find a FPGA lib for the system bits and make it out of a Xilinx FPGA, but thats a 2 chip solution, both the PSOIC and the FPGA would give you firmware upgradeability to.None of this gives you "touch what you see", you still would be navigating with finger and selecting with button, and rtouch is still not available. In the final analisis not a DS beater, thats why PSPZ is as it is.
dude not easy in real life, if the micro is processing the double tap, you got no controll of paramiters ( tap-time, double-tap time, rtouch time etc etc etc ) they are fixed there is no 2 way comms between your micro and psp hence cant be changed for individual users, ie will work for man, wont work well for woman etc etc, thats exactly why that param is available on commercial ts/touch pad/mouse button. Finally nail in coffin, how you going to calibrate your ts? THat requires displaying 3 points on-screen and relaying info back to micro, which you cant do.
fair enough, if you used the dallas with good results, am not going to argue ( does not mean to say will work in this circuit though ) i used same device to vary backlight on a qvga display and had mixed results, ended up switching to a ic2 part, so suppose for me it still has that stigma. V2 of PSPZ has abbility to take over analog stick function on standard psp, it does it in a different way.