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

From Organic Design wiki
Revision as of 04:00, 21 January 2009 by Rob (talk | contribs) (add gpl)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 */

#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");
	
	
}