zmk_mf68/app/src/main.c

45 lines
947 B
C
Raw Normal View History

2020-04-22 06:20:34 +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>
#include <settings/settings.h>
#include <logging/log.h>
LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL);
#include <zmk/matrix.h>
#include <zmk/kscan.h>
2020-07-25 06:39:11 +10:00
#include <zmk/display.h>
#include <drivers/ext_power.h>
2020-04-22 06:20:34 +10:00
#define ZMK_KSCAN_DEV DT_LABEL(ZMK_MATRIX_NODE_ID)
2020-05-15 23:41:06 +10:00
void main(void) {
struct device *ext_power;
LOG_INF("Welcome to ZMK!\n");
2020-04-22 06:20:34 +10:00
if (zmk_kscan_init(ZMK_KSCAN_DEV) != 0) {
return;
}
2020-07-25 06:39:11 +10: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
zmk_display_init();
2020-07-25 06:39:11 +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
}