blob: 6640e4795f3a648122ac9fed08e8c9735fab8809 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <device.h>
#include <devicetree.h>
#include <drivers/gpio.h>
#include <drivers/kscan.h>
void zmk_kscan_callback(struct device *dev, u32_t row, u32_t column, bool pressed) {
printk("Row: %d, col: %d, pressed: %s\n", row, column, (pressed ? "true" : "false"));
}
void main(void)
{
struct device *dev;
printk("Welcome to ZMK!\n");
dev = device_get_binding(CONFIG_KSCAN_MATRIX_DEV_NAME);
if (dev == NULL) {
printk("NO DEVICE!\n");
return;
}
kscan_config(dev, zmk_kscan_callback);
kscan_enable_callback(dev);
}
|