Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wan to develop my own keypad driver to my own keypad. I have to used GPIO to identify Key Events and used I2c to get scan code. I am going to develop keypad driver like this.

#include <linux/gpio.h> 
#include <linux/interrupt.h>

#define GPIO 1 //gpio PIN
...
if(gpio_request(GPIO, "Description")){
    Exception
}

gpio_direction_input(GPIO);
...
int irq = 0;
if((irq = gpio_to_irq(GPIO)) < 0 ){
    Exception
}
…

int init_module(){
    int result = request_irq(GPIO, handler_func, IRQF_TRIGGER_LOW,"Description", "Device id");
    if(result){
        Exception
    }
}

void handler_func(...){
    //get scan code via i2c
}

I need to develop an interface and have to handle following operations

  In my keypad, print as "1abc" on the [KEY1] .
  1. When press key, display 1st Characters as it is -> "1"
  2. Special key combinations are used to input other 3 characters
     Eg:
          key input operations as follows;

          KEY1 (direct press) should display "1"
          F1 + KEY1 (simultaneous press) should display "a"
          F2 + KEY1 (simultaneous press) should display "b"
          F3 + KEY1 (simultaneous press) should display "c"

My problem is how should I develop this interface?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.