Browse Source

Remove sensor test code.

xmkb
Pete Johanson 4 years ago
parent
commit
b48011ace6
  1. 42
      app/src/main.c

42
app/src/main.c

@ -8,7 +8,6 @@
#include <device.h> #include <device.h>
#include <devicetree.h> #include <devicetree.h>
#include <settings/settings.h> #include <settings/settings.h>
#include <drivers/sensor.h>
#include <logging/log.h> #include <logging/log.h>
LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL); LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL);
@ -19,44 +18,6 @@ LOG_MODULE_REGISTER(zmk, CONFIG_ZMK_LOG_LEVEL);
#define ZMK_KSCAN_DEV DT_LABEL(ZMK_MATRIX_NODE_ID) #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)
{
int err;
struct sensor_value value;
LOG_DBG("");
err = sensor_sample_fetch(dev);
if (err) {
LOG_ERR("Failed to fetch new EC11 sample");
return;
}
err = sensor_channel_get(dev, SENSOR_CHAN_ROTATION, &value);
if (err) {
LOG_DBG("Failed to get the sample for EC11 %d", err);
return;
}
LOG_DBG("val1 %d val2 %d", value.val1, value.val2);
}
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) void main(void)
{ {
printk("Welcome to ZMK!\n"); printk("Welcome to ZMK!\n");
@ -66,10 +27,7 @@ void main(void)
return; return;
} }
#ifdef CONFIG_SETTINGS #ifdef CONFIG_SETTINGS
settings_load(); settings_load();
#endif #endif
init_sensor();
} }

Loading…
Cancel
Save