// To get started, press Ctrl+Space to bring up the completion menu and view the available nodes.

// You can also use the buttons in the sidebar to perform actions on nodes.
// Actions currently available include:

// * Enabling / disabling the node
// * Adding the bus to a bus
// * Removing the node
// * Connecting ADC channels

// For more help, browse the DeviceTree documentation at https://docs.zephyrproject.org/latest/guides/dts/index.html
// You can also visit the nRF DeviceTree extension documentation at https://nrfconnect.github.io/vscode-nrf-connect/devicetree/nrfdevicetree.html


/ {
	// model = "Nordic nRF52840 DK NRF52840";
	// compatible = "nordic,nrf52840-dk-nrf52840";


	motor_IO {
		compatible = "gpio-keys";
		motor0dir: motor_0_dir {
			gpios = <&gpio1 2 0>;
			label = "Dose Motor Direction";
		};

		enc0a: enc_a_0 {
			gpios = <&gpio1 3 0>;
			label = "Dose Hall Sensor A";
		};
        enc0b: enc_b_0 {
			gpios = <&gpio1 4 0>;
			label = "Dose Hall Sensor B";
		};

		compatible = "gpio-keys";
		motor1dir: motor_1_dir {
			gpios = <&gpio1 5 0>;
			label = "Valve Motor Direction";
		};

		enc1a: enc_a_1 {
			gpios = <&gpio1 6 0>;
			label = "Valve Hall Sensor A";
		};
        enc1b: enc_b_1 {
			gpios = <&gpio1 7 0>;
			label = "Valve Hall Sensor B";
		};
	};

    motor_speed {
		compatible = "pwm-leds";
		motor0speed: motor_0_speed {
			pwms = <&pwm2 0 PWM_MSEC(20) 0>;
		};

		compatible = "pwm-leds";
		motor1speed: motor_1_speed {
			pwms = <&pwm2 1 20 0>;
		};
    };

	/* These aliases are provided for compatibility with samples */
	aliases {
		m0d = &motor0dir;
        m0s = &motor0speed;
        m0halla = &enc0a;
        m0hallb = &enc0b;
		m1d = &motor1dir;
        m1s = &motor1speed;
        m1halla = &enc1a;
        m1hallb = &enc1b;
	};



};

/delete-node/ &pwm1;

&gpio0 {
	status = "okay";
};

&gpio1 {
	status = "okay";
};

&gpiote {
	status = "okay";
};

&pwm2 {
	status = "okay";
	pinctrl-0 = <&pwm2_default>;
	pinctrl-names = "default";
};

&pinctrl {
	pwm2_default: pwm2_default {
		group1 {
			psels = <NRF_PSEL(PWM_OUT0, 1, 1)>, <NRF_PSEL(PWM_OUT1, 1, 9)>;
		};
	};
};

