mirror of
https://github.com/zmkfirmware/zmk.git
synced 2026-03-30 18:05:32 -05:00
Initial en11 exploration.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <device.h>
|
||||
#include <devicetree.h>
|
||||
#include <settings/settings.h>
|
||||
#include <drivers/sensor.h>
|
||||
|
||||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
@@ -18,6 +19,27 @@ LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL);
|
||||
|
||||
#define ZMK_KSCAN_DEV DT_LABEL(ZMK_MATRIX_NODE_ID)
|
||||
|
||||
static struct sensor_trigger trigger;
|
||||
|
||||
void encoder_change(struct device *dev, struct sensor_trigger *trigger)
|
||||
{
|
||||
LOG_DBG("");
|
||||
}
|
||||
|
||||
void init_sensor()
|
||||
{
|
||||
struct device *dev = device_get_binding("Rotary Encoder");
|
||||
if (!dev) {
|
||||
LOG_DBG("NO ENCODER!");
|
||||
return;
|
||||
}
|
||||
|
||||
trigger.type = SENSOR_TRIG_DATA_READY;
|
||||
trigger.chan = SENSOR_CHAN_ROTATION;
|
||||
|
||||
sensor_trigger_set(dev, &trigger, encoder_change);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
printk("Welcome to ZMK!\n");
|
||||
@@ -31,4 +53,6 @@ void main(void)
|
||||
#ifdef CONFIG_SETTINGS
|
||||
settings_load();
|
||||
#endif
|
||||
|
||||
init_sensor();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user