Update behavior_sensor_rotate_key_press.c

This commit is contained in:
Chatblanc77 2022-09-09 10:09:30 +07:00 committed by GitHub
parent 99423e0ce5
commit dc0e54158a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,19 +21,12 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
static int behavior_sensor_rotate_key_press_init(const struct device *dev) { return 0; };
static int on_sensor_binding_triggered(struct zmk_behavior_binding *binding,
const struct device *sensor, int64_t timestamp) {
struct sensor_value value;
int err;
const struct sensor_value value, int64_t timestamp) {
uint32_t keycode;
LOG_DBG("inc keycode 0x%02X dec keycode 0x%02X", binding->param1, binding->param2);
err = sensor_channel_get(sensor, SENSOR_CHAN_ROTATION, &value);
if (err) {
LOG_WRN("Failed to ge sensor rotation value: %d", err);
return err;
}
switch (value.val1) {
case 1:
keycode = binding->param1;