MustafaMulla29/wireless-mouse-pcb

A tscircuit package created by MustafaMulla29.

Version
1.0.16
License
unset
Stars
0

firmware/boards/nrf52dk_nrf52810.overlay

/* SPDX-License-Identifier: Apache-2.0 */

#include <zephyr/dt-bindings/adc/adc.h>
#include <zephyr/dt-bindings/adc/nrf-saadc.h>
#include <zephyr/dt-bindings/led/led.h>
#include <zephyr/dt-bindings/pinctrl/nrf-pinctrl.h>
#include <zephyr/dt-bindings/regulator/nrf5x.h>

/* The DK board definition reserves flash for MCUboot and enables its external
 * DC/DC inductor. This PCB boots directly from address zero and leaves DCC
 * unconnected, so replace those DK-only defaults.
 */
/delete-node/ &boot_partition;
/delete-node/ &slot0_partition;
/delete-node/ &slot1_partition;
/delete-node/ &storage_partition;

/ {
	chosen {
		zephyr,code-partition = &app_partition;
	};

	aliases {
		led-strip = &status_led;
	};

	zephyr,user {
		io-channels = <&adc 0>;
	};
};

&flash0 {
	partitions {
		app_partition: partition@0 {
			compatible = "zephyr,mapped-partition";
			label = "image-0";
			reg = <0x00000000 0x0002e000>;
		};

		storage_partition: partition@2e000 {
			compatible = "zephyr,mapped-partition";
			label = "storage";
			reg = <0x0002e000 0x00002000>;
		};
	};
};

&reg {
	regulator-initial-mode = <NRF5X_REG_MODE_LDO>;
};

/* P0.21 is wired to the reset button and RESET test point. */
&uicr {
	gpio-as-nreset;
	/* P0.10 is SENSOR_RESET and would otherwise be an NFC pin. */
	nfct-pins-as-gpios;
};

&uart0 {
	status = "disabled";
};

&i2c0 {
	status = "disabled";
};

&pinctrl {
	spi0_mouse_default: spi0_mouse_default {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 15)>,
				<NRF_PSEL(SPIM_MOSI, 0, 25)>;
		};
	};

	spi0_mouse_sleep: spi0_mouse_sleep {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 15)>,
				<NRF_PSEL(SPIM_MOSI, 0, 25)>;
			low-power-enable;
		};
	};
};

/* P0.25 is the WLED data line. P0.15 is unused and only supplies the
 * peripheral's otherwise-unrouted clock output. The sensor itself uses
 * GPIO bit-banging because PMW3610 SDIO is bidirectional on one wire.
 */
&spi0 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	#address-cells = <1>;
	#size-cells = <0>;
	pinctrl-0 = <&spi0_mouse_default>;
	pinctrl-1 = <&spi0_mouse_sleep>;
	pinctrl-names = "default", "sleep";

	status_led: ws2812@0 {
		compatible = "worldsemi,ws2812-spi";
		reg = <0>;
		spi-max-frequency = <4000000>;
		chain-length = <1>;
		spi-one-frame = <0x70>;
		spi-zero-frame = <0x40>;
		color-mapping = <LED_COLOR_ID_GREEN
				 LED_COLOR_ID_RED
				 LED_COLOR_ID_BLUE>;
	};
};

&adc {
	status = "okay";
	#address-cells = <1>;
	#size-cells = <0>;

	channel@0 {
		reg = <0>;
		zephyr,gain = "ADC_GAIN_1_6";
		zephyr,reference = "ADC_REF_INTERNAL";
		zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40)>;
		zephyr,input-positive = <NRF_SAADC_AIN0>;
		zephyr,resolution = <12>;
		zephyr,oversampling = <4>;
	};
};