2020-04-22 06:20:34 +10:00
|
|
|
/*
|
2020-05-02 09:14:18 +10:00
|
|
|
* Copyright (c) 2020 Peter Johanson
|
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>
|
|
|
|
#include <zmk/endpoints.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-04-22 06:20:34 +10:00
|
|
|
void main(void)
|
|
|
|
{
|
2020-05-02 04:58:00 +10:00
|
|
|
printk("Welcome to ZMK!\n");
|
2020-04-22 06:20:34 +10:00
|
|
|
|
2020-05-15 23:41:06 +10:00
|
|
|
if (zmk_kscan_init(ZMK_KSCAN_DEV) != 0)
|
|
|
|
{
|
2020-05-04 05:49:33 +10:00
|
|
|
return;
|
|
|
|
}
|
2020-05-06 06:09:05 +10:00
|
|
|
|
2020-05-15 23:41:06 +10:00
|
|
|
if (zmk_endpoints_init())
|
|
|
|
{
|
2020-05-21 13:36:27 +10:00
|
|
|
printk("ENDPOINT INIT FAILED\n");
|
2020-05-06 06:09:05 +10:00
|
|
|
return;
|
|
|
|
}
|
2020-05-21 13:36:27 +10:00
|
|
|
|
|
|
|
#ifdef CONFIG_SETTINGS
|
|
|
|
settings_load();
|
|
|
|
#endif
|
2020-04-22 06:20:34 +10:00
|
|
|
}
|