#No analog input from joystick [SOLVED]

1 messages · Page 1 of 1 (latest)

regal comet
#

I'm trying to make a device with just an analog stick and two buttons to use as a mouse, using zmk-analog-input-driver to no avail (other than getting the two mouse buttons working).

Link to the zmk config : https://github.com/heinn-dev/zmk-joy.

I'm using a nicenano clone. I wired up the joystick to P0.31 and P0.29 which I'm not sure if that translates to &adc 5 and 7 (according to the repo?) or 8 and 10 (A8 and A10 on the schematic). I've tried them all anyway.

I've tried setting up usb logging, and while I do receive messages for the button presses, I didn't get the analog values spam I was expecting from the joystick polling (seems to log nothing at all from it). I've also tried jumping ground to every other input pin just to check, and nothing showed up.

Do I have to use a different version / fork of zmk?
(tried using forks of similar zmk joystick projects with no luck)

I'm somewhat new to this so I think I'm just missing something obvious.

#

\zmk-joy\boards\shields\two_percent_milk\two_percent_milk.overlay

#include <dt-bindings/zmk/matrix_transform.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include <input/processors.dtsi>
#include <dt-bindings/zmk/input_transform.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>

&adc {
    status = "okay";
};

/ {

    kscan0: kscan {
        compatible = "zmk,kscan-gpio-direct";
        input-gpios
            = <&gpio0 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
            , <&gpio0 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
    };

    anin0: analog_input_0 {
        compatible = "zmk,analog-input";
        sampling-hz = <100>;
        x-ch {
            io-channels = <&adc 5>; // <--- see ain-map.png for nRF52840 5 or 10
            mv-mid = <1300>;
            mv-min-max = <1600>;
            mv-deadzone = <88>;
            scale-multiplier = <1>;
            scale-divisor = <100>;
            invert;
            evt-type = <INPUT_EV_REL>;
            input-code = <INPUT_REL_X>;
        };
        y-ch {
            io-channels = <&adc 7>; // <--- see ain-map.png for nRF52840 7 or 8
            mv-mid = <1300>;
            mv-min-max = <1600>;
            mv-deadzone = <88>;
            scale-multiplier = <1>;
            scale-divisor = <100>;
            invert;
            evt-type = <INPUT_EV_REL>;
            input-code = <INPUT_REL_Y>;

        };
    };
    
        analog_input_listener {
        status = "okay";
        compatible = "zmk,input-listener";
        device = <&anin0>;
        input-processors = <&zip_xy_scaler 1 1>;
    };
    
};
#

\zmk-joy\config\two_percent_milk.conf

CONFIG_ZMK_BLE=y
CONFIG_INPUT=y

CONFIG_ZMK_USB_LOGGING=y
CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS=8000
CONFIG_LOG_DEFAULT_LEVEL=3

CONFIG_ADC=y
CONFIG_ADC_ASYNC=y
CONFIG_ANALOG_INPUT=y

CONFIG_ANALOG_INPUT_LOG_LEVEL_DBG=y
CONFIG_ANALOG_INPUT_REPORT_INTERVAL_MIN=22
CONFIG_ANALOG_INPUT_LOG_DBG_RAW=y
CONFIG_ANALOG_INPUT_LOG_DBG_REPORT=y
CONFIG_ZMK_POINTING=y```
regal comet
#

@cursive helm sorry for the ping but I've no clue what's wrong here, I think I'm doing the same things other projects on github are doing. Would be grateful if you took a look, the project is pretty small and barebones 🥲

hazy fjord
#

You should name your shield something different, your overlay file is not being used.

https://github.com/heinn-dev/zmk-joy/actions/runs/17174309671/job/48728163754#step:11:37

-- Found devicetree overlay: /tmp/zmk-config/zmk/app/boards/shields/two_percent_milk/two_percent_milk.overlay
-- Found devicetree overlay: /tmp/zmk-config/zmk/app/boards/shields/two_percent_milk/boards/nice_nano_v2.overlay

That's https://github.com/zmkfirmware/zmk/blob/main/app/boards/shields/two_percent_milk/two_percent_milk.overlay

You can also verify this by expanding the "devicetree" section then search zmk,input-listener:

regal comet
#

oof, can I just give it a different name on the build.yaml file and rename everything to that?

regal comet
hazy fjord
#

Your config is missing Kconfig.shield and Kconfig.defconfig

regal comet
#

success! turns out I just didn't quite understand the structure of zmk

thank you for your help 🙇‍♂️