Initial en11 exploration.
This commit is contained in:
parent
f6110a632d
commit
893b99d907
10 changed files with 542 additions and 0 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue