Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Testing for bits in EasyC (http://www.chiefdelphi.com/forums/showthread.php?t=61994)

rhoads2234 18-01-2008 20:15

Testing for bits in EasyC
 
my team wants to use the USB chicklet with the x-box360 controller

in the FIRSTwiki it explains how to test an individual bit in MPLab
I would like to make sure that code like the following is supported in EasyC

#define BUTTON_5 ((~p1_wheel &0x80)!=0)
I think it should work but there might be some obscure reason why it might not

Confirmations with reasons or denials would be great! Thank you in advance!

Kingofl337 18-01-2008 22:07

Re: Testing for bits in EasyC
 
Paul recommend we use

dpad_top = (GetOIAInput ( 1 , 3 )&1<<7)?0:1 ;
dpad_bottom = (GetOIAInput ( 1 , 3 )&1<<6)?0:1 ;
dpad_left = (GetOIAInput ( 1 , 3 )&1<<5)?0:1 ;
dpad_right = (GetOIAInput ( 1 , 3 )&1<<4)?0:1 ;

left_top = (GetOIAInput ( 1 , 4 )&1<<7)?0:1 ;
right_top = (GetOIAInput ( 1 , 4 )&1<<6)?0:1 ;
left_trigger = (GetOIAInput ( 1 , 4 )&1<<5)?0:1 ;
right_trigger = (GetOIAInput ( 1 , 4 )&1<<4)?0:1 ;


I'm not sure how to properly define this so the compiler does barf but if you can do it in C you can do it in easyC

edit: I got it to work I think...

Click on the projects tab and paste:

#define BUTTON_5 ((~GetOIAInput ( 1 , 3 ) &0x80)!=0) // same as p1_wheel

Into UserInclude.h

Also the Xbox controller itself isn't the best unit the thumbsticks stick and don't recenter well. The Logictech "PS2" like controller works better.


All times are GMT -5. The time now is 23:13.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi