2020-04-22 06:20:34 +10:00
|
|
|
/*
|
2020-09-10 13:57:44 +10:00
|
|
|
* Copyright (c) 2020 The ZMK Contributors
|
2020-04-22 06:20:34 +10:00
|
|
|
*
|
2020-05-02 09:14:18 +10:00
|
|
|
* SPDX-License-Identifier: MIT
|
2020-04-22 06:20:34 +10:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <zephyr.h>
|
|
|
|
#include <device.h>
|
|
|
|
#include <devicetree.h>
|
2020-05-21 13:36:27 +10:00
|
|
|
#include <settings/settings.h>
|
2020-04-26 12:41:20 +10:00
|
|
|
|
2020-05-25 08:22:16 +10:00
|
|
|
#include <logging/log.h>
|
|
|
|
LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL);
|
|
|
|
|
2020-05-18 23:11:46 +10:00
|
|
|
#include <zmk/matrix.h>
|
|
|
|
#include <zmk/kscan.h>
|
2020-07-25 06:39:11 +10:00
|
|
|
#include <zmk/display.h>
|
2020-10-06 18:52:21 +11:00
|
|
|
#include <drivers/ext_power.h>
|
2020-04-22 06:20:34 +10:00
|
|
|
|
2020-05-07 00:04:19 +10:00
|
|
|
#define ZMK_KSCAN_DEV DT_LABEL(ZMK_MATRIX_NODE_ID)
|
2020-05-15 23:41:06 +10:00
|
|
|
|
2020-09-14 12:53:24 +10:00
|
|
|
void main(void) {
|
2020-10-06 18:52:21 +11:00
|
|
|
struct device *ext_power;
|
2020-09-14 12:53:24 +10:00
|
|
|
LOG_INF("Welcome to ZMK!\n");
|
2020-04-22 06:20:34 +10:00
|
|
|
|
2020-09-14 12:53:24 +10:00
|
|
|
if (zmk_kscan_init(ZMK_KSCAN_DEV) != 0) {
|
|
|
|
return;
|
|
|
|
}
|
2020-07-25 06:39:11 +10:00
|
|
|
|
2020-10-06 18:52:21 +11:00
|
|
|
// Enable the external VCC output
|
|
|
|
ext_power = device_get_binding("EXT_POWER");
|
|
|
|
if (ext_power != NULL) {
|
|
|
|
const struct ext_power_api *ext_power_api = ext_power->driver_api;
|
|
|
|
ext_power_api->enable(ext_power);
|
|
|
|
}
|
|
|
|
|
2020-07-25 06:39:11 +10:00
|
|
|
#ifdef CONFIG_ZMK_DISPLAY
|
2020-09-14 12:53:24 +10:00
|
|
|
zmk_display_init();
|
2020-07-25 06:39:11 +10:00
|
|
|
|
2020-09-14 12:53:24 +10:00
|
|
|
while (1) {
|
|
|
|
zmk_display_task_handler();
|
|
|
|
}
|
2020-07-25 06:39:11 +10:00
|
|
|
#endif /* CONFIG_ZMK_DISPLAY */
|
2020-04-22 06:20:34 +10:00
|
|
|
}
|