GamePad Bluetooth Universale

Salve,
sto realizzando un gamepad che sfrutti arduino per la gestione degli input e la loro trasmissione via protocollo Bluetooth a PC.

Innanzitutto gli input comprendono:
16xTasti Croce Direzionale,A,B,X,Y,+,-,Home,Power,R,L,2xPulsanti delle levette analogiche;
2xLevette Analogiche;
2xGrilletti Analogici;
5xLED (1xCaricaBatteria; 4xN°GamePad);

Il modulo bluetooth per lo sviluppo è il classico BT Shield v2.1.
Ecco un'immagine mock-up del gamepad.

Ora posto il codice ancora in pre-alpha, ho solamente disposto alcune funzioni. Spero di poterlo modificare a breve ed aggiornarlo. Come sempre se avete proposte o suggerimenti ben vengano.

// KEYPAD CODE-------START
#include <Keypad.h>
const byte ROWS = 4; //four rows
const byte COLS = 4; //four columns
//define the cymbols on the buttons of the keypads
char hexaKeys[ROWS][COLS] = {
  {'a','b','x','y'},  // Button
  {'R','D','U','L'}, // D-Pad
  {'Start','9','A','B'},
  {'C','D','E','F'}
};
byte rowPins[ROWS] = {3, 2, 1, 0}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {7, 6, 5, 4}; //connect to the column pinouts of the keypad

//initialize an instance of class NewKeypad
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS); 
// KEYPAD CODE-------END

// BLUETOOTH CODE-------START
unsigned int timeout=0;
unsigned char state=0;
ISR(TIMER2_OVF_vect)          //Timer2  Service 
{ 
    TCNT2 = 0;
     timeout++;
if (timeout>61)
  {
        state=1;
        timeout=0;
  }
}
// BLUETOOTH CODE-------END

//PINOUT Settings
char button_a=3, button_b=4, button_x=5, button_y=6;             // a,b,x,y button
char dpad_right=7, dpad_down=8, dpad_up=9, dpad_left=10; // D-Pad button
char sel=11, start=12;
char led_batt=14;

void setup(void)
{
  // BLUETOOTH CODE-------START
  pinMode(2,INPUT);                            
  pinMode(13,OUTPUT);
  attachInterrupt(0,cleantime,FALLING);
  init_timer2();
  // BLUETOOTH CODE-------END
  
  pinMode(sel, INPUT);      //Set the Joystick 'Select' button as an input
  digitalWrite(sel, HIGH);  //Enable the pull-up resistor on the select button
  
  pinMode(start, INPUT);      //Set the Joystick 'Start' button as an input
  digitalWrite(start, HIGH);  //Enable the pull-up resistor on the start button
  
  pinMode(button_a, INPUT);      //Set the Joystick button 0 as an input
  digitalWrite(button_a, HIGH);  //Enable the pull-up resistor on button 0

  pinMode(button_b, INPUT);      //Set the Joystick button 1 as an input
  digitalWrite(button_b, HIGH);  //Enable the pull-up resistor on button 1
  
  pinMode(button_x, INPUT);      //Set the Joystick button 2 as an input
  digitalWrite(button_x, HIGH);  //Enable the pull-up resistor on button 2

  pinMode(button_y, INPUT);      //Set the Joystick button 3 as an input
  digitalWrite(button_y, HIGH);  //Enable the pull-up resistor on button 3
  
  pinMode(dpad_right, INPUT);      //Set the D-Pad button 7 as an input
  digitalWrite(dpad_right, HIGH);  //Enable the pull-up resistor on button 7

  pinMode(dpad_down, INPUT);      //Set the D-Pad button 8 as an input
  digitalWrite(dpad_down, HIGH);  //Enable the pull-up resistor on button 8
  
  pinMode(dpad_up, INPUT);      //Set the D-Pad button 9 as an input
  digitalWrite(dpad_up, HIGH);  //Enable the pull-up resistor on button 9

  pinMode(dpad_left, INPUT);      //Set the D-Pad button 10 as an input
  digitalWrite(dpad_left, HIGH);  //Enable the pull-up resistor on button 10
  
  Serial.begin(9600);           //Turn on the Serial Port at 9600 bps
}

void loop(void)
{
  // KEYPAD CODE-------START
  char customKey = customKeypad.getKey();
  if (customKey != NO_KEY)
    Serial.println(customKey);
  // KEYPAD CODE-------END    
  
  Serial.print(analogRead(0));          //Read the position of the SX joysticks X axis and print it on the serial port.
  Serial.print(",");
  Serial.print(analogRead(1));          //Read the position of the SX joysticks Y axis and print it on the serial port.
  Serial.print(",");
  Serial.print(analogRead(2));          //Read the position of the DX joysticks X axis and print it on the serial port.
  Serial.print(",");
  Serial.print(analogRead(3));          //Read the position of the DX joysticks Y axis and print it on the serial port.
  Serial.print(",");
  Serial.print(analogRead(4));          //Read the position of the ZL Trigger and print it on the serial port.
  Serial.print(",");
  Serial.print(analogRead(5));          //Read the position of the ZR Trigger and print it on the serial port.
  Serial.print(",");
  
  Serial.print(digitalRead(sel));           //Read the value of the select button and print it on the serial port.
  Serial.print(digitalRead(start));         //Read the value of the select button and print it on the serial port.
  
  Serial.print(digitalRead(button_a));   //Read the value of the button a, b, x, y and print it on the serial port.
  Serial.print(digitalRead(button_b));   
  Serial.print(digitalRead(button_x)); 
  Serial.print(digitalRead(button_y));   
  
  Serial.print(digitalRead(dpad_right));   //Read the value of the D-Pad button RIGHT, DOWN, UP, LEFT and print it on the serial port.
  Serial.print(digitalRead(dpad_down));   
  Serial.print(digitalRead(dpad_up));   
  Serial.print(digitalRead(dpad_left)); 
  
  //Wait for 100 ms, then go back to the beginning of 'loop' and repeat.
  delay(100);
  
  // BLUETOOTH CODE-------START
  switch(state)
     {
        case 0:
        digitalWrite(13,LOW);
        break;
        case 1:
        digitalWrite(13,HIGH);
        Serial.print("Hellow BT");
        break;
    }
  // BLUETOOTH CODE-------END    
}

// BLUETOOTH CODE-------START

void init_timer2(void)               
{
    TCCR2A |= (1 << WGM21) | (1 << WGM20);   
    TCCR2B |= 0x07;      // by clk/1024
    ASSR |= (0<<AS2);    // Use internal clock - external clock not used in Arduino
    TIMSK2 |= 0x01;       // Timer2 Overflow Interrupt Enable
    TCNT2 = 0;
    sei();   
}

void cleantime()
{
    timeout=0;
    state=0;
}
// BLUETOOTH CODE-------END

Davvero bello intendi farlo comunicare solo col pc?ovvero è un gamepad unicamente per pc?
come intendi realizzare la bellissima cover in foto?
immagino tu voglia leggere i comandi via seriale giusto?

Madwriter:
Davvero bello intendi farlo comunicare solo col pc?ovvero è un gamepad unicamente per pc?

Inizialmente per il debug e la prototipazione sì. In seguito agendo sul fw sarà possibile configurarlo con altre periferiche tipo ps3 e wiiu, dato che è nato per essere un controller aftermarket per il prossimo wiiu.

Madwriter:
come intendi realizzare la bellissima cover in foto?

una volta ultimato lo sviluppo sw e hw del pcb mi affiderò ad una ditta per la produzione di massa del prodotto.

Madwriter:
immagino tu voglia leggere i comandi via seriale giusto?

attualmente nelle prime fasi di sviluppo il codice sarà seriale ed in chiaro poi entreranno in gioco le varie criptazioni del caso.