summaryrefslogtreecommitdiff
path: root/skey.c
diff options
context:
space:
mode:
Diffstat (limited to 'skey.c')
-rw-r--r--skey.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/skey.c b/skey.c
index d9bdef9..2d5b4aa 100644
--- a/skey.c
+++ b/skey.c
@@ -28,7 +28,7 @@ static void skey_update (unsigned long unused) {
int column_index = 0;
while (column_index < 10) {
//sets the column pin high for reading
- gpio_set_value(column_pins[column_index],1);
+ gpio_set_value(column_pins[column_index], 1);
//reads with all the rows
row_index = 0;
while (row_index < 3) {
@@ -38,7 +38,7 @@ static void skey_update (unsigned long unused) {
row_index++;
}
//sets the row pin low
- gpio_set_value(column_pins[column_index],0);
+ gpio_set_value(column_pins[column_index], 0);
column_index++;
}
//updates the timer
@@ -63,6 +63,9 @@ static int __init skey_init (void) {
printk(KERN_ALERT "skey: column_pins[%d], BCM %d request failed\n", i, column_pins[i]);
return -EINVAL;
}
+ if (gpio_direction_output(column_pins[i], 0)) {
+ printk(KERN_ALERT "skey: column_pins[%d], BCM %d, set output failed\n",i, column_pins[i]);
+ }
i++;
}
//ditto for row pins
@@ -78,6 +81,9 @@ static int __init skey_init (void) {
printk(KERN_ALERT "skey: row_pins[%d], BCM %d request failed\n", j, row_pins[j]);
return -EINVAL;
}
+ if (gpio_direction_input(row_pins[j])) {
+ printk(KERN_ALERT "skey: row_pins[%d], BCM %d, set output failed\n",j, row_pins[j]);
+ }
j++;
}
//sets up timer for keyboard read function