Diy Xbox Wireless Adapter - Raspberry Pi Forums


i have raspberry pi 2 , im running retropie.and have xboxdrv working diy adapter old rrod xbox.
has info here: https://dilisilib.wordpress.com/hacking ... e-arduino/

unfortunately doesnt have sync function figured use gpio enable it. first outing wiringpi.
know c best thats why went wiringpi. wired 3 wires. 5 power button, 6 data, , 7 clock.

understand, pull data line down, send 10 bit command , pull data line again. didnt research find commands works on arduino im sure right.

started porting arduino code , cant working reason. c program can tell button or isnt pressed, (tho seems backwards me) digitalread(sync_pin) read 1 when not pressed 0 when pressed.

actual sending of command hangs on clock while loop. ive tried writing several different ways have found , can't it.

ill paste code below, , on github https://github.com/pressy4pie/xboxadapt ... ter/sync.c
sorry still kind of dirty , stuff

code: select all

/* adapted yaywoop , alexander martinex , dilandou connor rigby 5/7/15  on original xbox 360 rf board: pins 1-4 usb. step pin 1 down 3.3 volts power. pin 2 , 3 white , green d- & d+ , pin 4 ground.  pins 5-7 plugged gpio header. pin 5 power button , repurposed sync. pin 6 data pin 7 clock  don't forget common ground also. program requires wiringpi installed. */  #include <wiringpi.h> #include <stdio.h>  /* pin  declerations in broadcom pin numbers.  commented numbers in wiring pi also. think these right have no freaking idea. */ #define sync_pin  13  //pin 5 on module (red) #define data_pin  15 //pin 6 on module (white) #define clock_pin 16 //14 //pin 7 on module. (blue) #define test_pin 7 /* defined commands.  */ int led_cmd[10] = {0,0,1,0,0,0,0,1,0,0}; //init , center light int anim_cmd[10] = {0,0,1,0,0,0,0,1,0,1}; //startup animation int sync_cmd[10] = {0,0,0,0,0,0,0,1,0,0}; //sync process  /* part gives hard time. data isn't being sent seems. */ void senddata(int cmd_do[]){ 	pinmode(data_pin, output); 	digitalwrite(test_pin, low); 	digitalwrite(data_pin, low); //pull data pin low start sending command... 	int prev = 1; 	int i;  	printf(" sending cmd \n"); 	for(i = 0; < 10; i++){ 		//printf("  waiting clock\n");  		//while (prev == digitalread(clock_pin)){} //pause until there change in clock 		//prev = digitalread(clock_pin); 		digitalwrite(data_pin, cmd_do[i]);  		//while (prev == digitalread(clock_pin)){} 		//prev = digitalread(clock_pin);  		} 	digitalwrite(data_pin, high); 	pinmode(data_pin, input);   }  /* these 2 commands wrappers senddata command */ void initleds(){ 	senddata(led_cmd); 	delay(50); 	senddata(anim_cmd); 	delay(50); 	}  void sync(){ 	printf("=====starting sync process=====\n"); 	printf(" doesn't work yet...\n");	 }   /* main program , loop */ int main()  {        printf("=====initializing gpio=====\n"); wiringpisetup();    //this setup portion of arduino code   pinmode(sync_pin, input);   printf("  sync_pin set input\n");       digitalwrite(sync_pin,high);   printf("  setting sync_pin high\n");       pinmode(data_pin, input);   printf("  data_pin set input\n");      pinmode(clock_pin, input);   printf("  clock_pin set input\n");    pinmode(test_pin, output);   printf("  test_pin set output\n");   delay(2000); printf("  testing led on\n"); digitalwrite(test_pin, high);  printf("=====starting leds=====\n");   initleds(); //sendcmd(led_cmd);  //while(){ 	printf("waiting sync button pressed...\n"); 	while(digitalread(sync_pin) != 1){ 		//wait button pushed start sync. 		//i might put cute little animation here userspace execution of program. 	} 	sync(); //} return 0;  }



raspberrypi



Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support