Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config doesn't compile when sensors are added #2853

Open
aDogCalledSpot opened this issue Mar 3, 2025 · 0 comments
Open

Config doesn't compile when sensors are added #2853

aDogCalledSpot opened this issue Mar 3, 2025 · 0 comments

Comments

@aDogCalledSpot
Copy link

I'm currently working on my configuration for my Swoop which features optional EC11 rotary encoders on both halves of the split keyboard. I've added the encoder on the left, but not on the right.

You can see my full configuration here.

The most relevant part (I think) is in the swoop.dtsi:

    kscan0: kscan {
        compatible = "zmk,kscan-gpio-matrix";

        diode-direction = "col2row";
        row-gpios
            = <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
            , <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
            , <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
            , <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
            ;
    };

	left_encoder: encoder_left {
		compatible = "alps,ec11";
        a-gpios = <&pro_micro 8 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
        b-gpios = <&pro_micro 9 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
        resolution = <4>;
        status = "disabled";
	};

	right_encoder: encoder_right {
		compatible = "alps,ec11";
        a-gpios = <&pro_micro 9 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
        b-gpios = <&pro_micro 8 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
        resolution = <4>;
        status = "disabled";
	};

/*
    sensors: sensors {
        compatible = "zmk,keymap_sensors";
        sensors = <&left_encoder &right_encoder>;
        triggers-per-rotation = <20>;
    };
*/

With the sensors commented out (as above) everything compiles fine but when I try to uncomment the lines I receive the following failure:

FAILED: CMakeFiles/app.dir/src/sensors.c.obj 
ccache /opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DKERNEL -DNRF52840_XXAA -DPICOLIBC_INTEGER_PRINTF_SCANF -D_FORTIFY_SOURCE=1 -D_POSIX_C_SOURCE=200809 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -I/home/ari/repos/zmk/app/include -I/home/ari/repos/zmk/zephyr/include -I/home/ari/repos/zmk/app/build/left/zephyr/include/generated -I/home/ari/repos/zmk/zephyr/soc/arm/nordic_nrf/nrf52 -I/home/ari/repos/zmk/zephyr/soc/arm/nordic_nrf/common/. -I/home/ari/repos/zmk/zephyr/subsys/usb/device -I/home/ari/repos/zmk/zephyr/subsys/bluetooth/controller/ll_sw/nordic/hal/nrf5/nrfx_glue -I/home/ari/repos/zmk/zephyr/subsys/bluetooth -I/home/ari/repos/zmk/zephyr/subsys/settings/include -I/home/ari/repos/zmk/modules/hal/cmsis/CMSIS/Core/Include -I/home/ari/repos/zmk/zephyr/modules/cmsis/. -I/home/ari/repos/zmk/modules/hal/nordic/nrfx -I/home/ari/repos/zmk/modules/hal/nordic/nrfx/drivers/include -I/home/ari/repos/zmk/modules/hal/nordic/nrfx/mdk -I/home/ari/repos/zmk/zephyr/modules/hal_nordic/nrfx/. -I/home/ari/repos/zmk/modules/crypto/tinycrypt/lib/include -I/home/ari/repos/zmk/app/module/include -I/home/ari/repos/zmk/app/module/drivers/sensor/battery/. -fno-strict-aliasing -Os -imacros /home/ari/repos/zmk/app/build/left/zephyr/include/generated/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mfp16-format=ieee --sysroot=/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros /home/ari/repos/zmk/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/ari/repos/zmk/app=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/ari/repos/zmk/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/ari/repos/zmk=WEST_TOPDIR -ffunction-sections -fdata-sections --specs=picolibc.specs -std=c99 -Wfatal-errors -MD -MT CMakeFiles/app.dir/src/sensors.c.obj -MF CMakeFiles/app.dir/src/sensors.c.obj.d -o CMakeFiles/app.dir/src/sensors.c.obj -c /home/ari/repos/zmk/app/src/sensors.c
In file included from /home/ari/repos/zmk/zephyr/include/zephyr/sys/util_macro.h:34,
                 from /home/ari/repos/zmk/zephyr/include/zephyr/sys/util.h:17,
                 from /home/ari/repos/zmk/zephyr/include/zephyr/devicetree.h:25,
                 from /home/ari/repos/zmk/zephyr/include/zephyr/device.h:12,
                 from /home/ari/repos/zmk/zephyr/include/zephyr/drivers/sensor.h:25,
                 from /home/ari/repos/zmk/app/src/sensors.c:7:
/home/ari/repos/zmk/zephyr/include/zephyr/sys/util_macro.h:418:44: warning: implicit declaration of function 'Z_UTIL_LISTIFY_DT_N_S_sensors_P_sensors_LEN' [-Wimplicit-function-declaration]
  418 | #define LISTIFY(LEN, F, sep, ...) UTIL_CAT(Z_UTIL_LISTIFY_, LEN)(F, sep, __VA_ARGS__)
      |                                            ^~~~~~~~~~~~~~~
/home/ari/repos/zmk/zephyr/include/zephyr/sys/util_internal.h:105:36: note: in definition of macro 'UTIL_PRIMITIVE_CAT'
  105 | #define UTIL_PRIMITIVE_CAT(a, ...) a##__VA_ARGS__
      |                                    ^
/home/ari/repos/zmk/zephyr/include/zephyr/sys/util_macro.h:418:35: note: in expansion of macro 'UTIL_CAT'
  418 | #define LISTIFY(LEN, F, sep, ...) UTIL_CAT(Z_UTIL_LISTIFY_, LEN)(F, sep, __VA_ARGS__)
      |                                   ^~~~~~~~
/home/ari/repos/zmk/app/src/sensors.c:50:5: note: in expansion of macro 'LISTIFY'
   50 |     LISTIFY(ZMK_KEYMAP_SENSORS_LEN, SENSOR_CHILD_DEFAULTS, (, ), 0)
      |     ^~~~~~~
/home/ari/repos/zmk/app/src/sensors.c:50:37: error: 'SENSOR_CHILD_DEFAULTS' undeclared here (not in a function)
   50 |     LISTIFY(ZMK_KEYMAP_SENSORS_LEN, SENSOR_CHILD_DEFAULTS, (, ), 0)
      |                                     ^~~~~~~~~~~~~~~~~~~~~
/home/ari/repos/zmk/zephyr/include/zephyr/sys/util_macro.h:418:66: note: in definition of macro 'LISTIFY'
  418 | #define LISTIFY(LEN, F, sep, ...) UTIL_CAT(Z_UTIL_LISTIFY_, LEN)(F, sep, __VA_ARGS__)
      |                                                                  ^
compilation terminated due to -Wfatal-errors.

In my swoop.conf I added the following lines:

CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y

To me it looks as if I'm missing a config setting but I wasn't able to find the right one in the docs.

Any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant