Jump to content

Can't get stylus to work at all


Zapf Bandit

Recommended Posts

I am using the newest "libnds" and "devkitARM" but I can't seem to get the stylus to work at all in Dualis. I use my own arm7 code which does the following with regards to pen control. This all works fine on the hardware but doesn't seem to have any effect in Dualis. Am I missing something obvious?

 

#define TOUCH_CAL_X1 (*(vs16*)0x027FFCD8)

#define TOUCH_CAL_Y1 (*(vs16*)0x027FFCDA)

#define TOUCH_CAL_X2 (*(vs16*)0x027FFCDE)

#define TOUCH_CAL_Y2 (*(vs16*)0x027FFCE0)

#define SCREEN_WIDTH 256

#define SCREEN_HEIGHT 192

s32 TOUCH_WIDTH = TOUCH_CAL_X2 - TOUCH_CAL_X1;

s32 TOUCH_HEIGHT = TOUCH_CAL_Y2 - TOUCH_CAL_Y1;

s32 TOUCH_OFFSET_X = ( ((SCREEN_WIDTH -60) * TOUCH_CAL_X1) / TOUCH_WIDTH ) - 28;

s32 TOUCH_OFFSET_Y = ( ((SCREEN_HEIGHT-60) * TOUCH_CAL_Y1) / TOUCH_HEIGHT ) - 28;

 

.......

 

// Read the X/Y buttons and the /PENIRQ line

but = XKEYS;

if (!(but & 0x40)) {

// Read the touch screen

x = touchRead(TSC_MEASURE_X);

y = touchRead(TSC_MEASURE_Y);

xpx = ( ((SCREEN_WIDTH -60) * x) / TOUCH_WIDTH ) - TOUCH_OFFSET_X;

ypx = ( ((SCREEN_HEIGHT-60) * y) / TOUCH_HEIGHT ) - TOUCH_OFFSET_Y;

z1 = touchRead(TSC_MEASURE_Z1);

z2 = touchRead(TSC_MEASURE_Z2);

}

 

 

IPC->buttons = but;

IPC->touchX = x;

IPC->touchY = y;

IPC->touchXpx = xpx;

IPC->touchYpx = ypx;

IPC->touchZ1 = z1;

IPC->touchZ2 = z2;

 

Thanks,

Zapf Bandit

www.zapfbandit.com

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...