zmk_mf68/src/main.c

34 lines
644 B
C
Raw Normal View History

2020-04-22 06:20:34 +10:00
/*
* 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>
2020-04-22 06:20:34 +10:00
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"));
}
2020-04-22 06:20:34 +10:00
void main(void)
{
struct device *dev;
printk("Welcome to ZMK!\n");
2020-04-22 06:20:34 +10:00
dev = device_get_binding(CONFIG_KSCAN_MATRIX_DEV_NAME);
2020-04-22 06:20:34 +10:00
if (dev == NULL) {
printk("NO DEVICE!\n");
2020-04-22 06:20:34 +10:00
return;
}
kscan_config(dev, zmk_kscan_callback);
2020-04-22 06:20:34 +10:00
kscan_enable_callback(dev);
2020-04-22 06:20:34 +10:00
}