USB Roll-up drum kit user-space driver for linux

From Organic Design
Revision as of 03:52, 21 January 2009 by Rob (talk | contribs) (add new version)
#include <stdio.h>

struct pad { 
	char data[8]; 
	};

// drumkit: pad status data (0 = not pressed, 1 = pressed)
unsigned int pad_data[6] = {0, 0, 0, 0, 0, 0};

// drumkit: pad note data (0 = do nothing, 1 = play note)
unsigned int pad_notes[6] = {0, 0, 0, 0, 0, 0};

int main() {

	FILE *f;    
  int i,j;    
  struct pad r;

  f = fopen("/dev/random","r");    

	while( fread(&r,sizeof(struct pad),1,f) != 0 )
		printf("%d %d %d %d %d %d %d %d\n",
			r.data[0], r.data[1], r.data[2], r.data[3], r.data[4], r.data[5], r.data[6], r.data[7]);    


  fclose(f);    

  printf("\n");
	
	
}