shithub: heymac-node

ref: ad1df2d2a01bd064e643287ff305673dfede3ce3
dir: /boards/xtensa/ttgo_lora32/ttgo_lora32.dts/

View raw version
/*
 * Copyright (c) 2021 Instituto de Pesquisas Eldorado (eldorado.org.br)
 *
 * SPDX-License-Identifier: Apache-2.0
 */
/dts-v1/;

#include <espressif/esp32/esp32_pico_d4.dtsi>
#include "ttgo_lora32-pinctrl.dtsi"
#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
	model = "ttgo_lora32";
	compatible = "espressif,esp32";

	aliases {
		uart-0 = &uart0;
		i2c-0 = &i2c0;
		led0 = &led0;
		//sw0 = &button0;
		watchdog0 = &wdt0;
		lora0 = &lora0;
	};

	leds {
		compatible = "gpio-leds";
		led0: led {
			gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
			label = "White LED";
		};

		vext: vext {
			gpios = <&gpio0 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
			label = "External VCC";
		};

		/*
		oledrst: oledrst {
			gpios = <&gpio0 16 (GPIO_PULL_UP | GPIO_ACTIVE_HIGH)>;
			label = "OLED Reset";
		};
		*/
	};

	/*
	buttons {
		compatible = "gpio-keys";
		button0: button_0 {
			gpios = <&gpio0 0 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
			label = "PRG Button";
			zephyr,code = <INPUT_KEY_0>;
		};
	};
	*/

	chosen {
		zephyr,sram = &sram0;
		zephyr,console = &uart0;
		zephyr,shell-uart = &uart0;
		zephyr,flash = &flash0;
		zephyr,display = &oled_screen;
	};
};

&cpu0 {
	clock-frequency = <ESP32_CLK_CPU_240M>;
};

&cpu1 {
	clock-frequency = <ESP32_CLK_CPU_240M>;
};

&uart0 {
	status = "okay";
	current-speed = <115200>;
	pinctrl-0 = <&uart0_default>;
	pinctrl-names = "default";
};

&gpio0 {
	status = "okay";
};

&gpio1 {
	status = "okay";
};

&trng0 {
	status = "okay";
};

&i2c0 {
	status = "okay";
	clock-frequency = <I2C_BITRATE_FAST>;
	sda-gpios = <&gpio0 4 GPIO_OPEN_DRAIN>;
	scl-gpios = <&gpio0 15 GPIO_OPEN_DRAIN>;
	pinctrl-0 = <&i2c0_default>;
	pinctrl-names = "default";

	oled_screen: ssd1306@3c {
		compatible = "solomon,ssd1306fb";
		reg = <0x3c>;
		width = <128>;
		height = <64>;
		segment-offset = <0>;
		page-offset = <0>;
		display-offset = <0>;
		multiplex-ratio = <63>;
		segment-remap;
		com-invdir;
		prechargep = <0x22>;
	};
};

&spi3 {
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";
	pinctrl-0 = <&spim3_default>;
	pinctrl-names = "default";
	cs-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
	lora0: sx1276@0 {
		compatible = "semtech,sx1276";
		reg = <0>;
		reset-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
		dio-gpios =
			/* SX1276 D0 -> GPIO26 */
			<&gpio0 26 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
			/* SX1276 D1 -> GPIO35 */
			<&gpio1 1 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>,
			/* SX1276 D1 -> GPIO34 */
			<&gpio0 32 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
		spi-max-frequency = <1000000>;
		power-amplifier-output = "pa-boost";
	};
};

&flash0 {
	/* the board is using plain d0wd SoC part without the flash
	 * so any additional flash size should be defined at the board level
	 */
	reg = <0x0 DT_SIZE_M(8)>;

	status = "okay";
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		/* Reserve 60kB for the bootloader */
		boot_partition: partition@1000 {
			label = "mcuboot";
			reg = <0x00001000 0x0000F000>;
			read-only;
		};

		/* Reserve 1024kB for the application in slot 0 */
		slot0_partition: partition@10000 {
			label = "image-0";
			reg = <0x00010000 0x00100000>;
		};

		/* Reserve 1024kB for the application in slot 1 */
		slot1_partition: partition@110000 {
			label = "image-1";
			reg = <0x00110000 0x00100000>;
		};

		/* Reserve 256kB for the scratch partition */
		scratch_partition: partition@210000 {
			   label = "image-scratch";
			   reg = <0x00210000 0x00040000>;
		};

		storage_partition: partition@250000 {
			label = "storage";
			reg = <0x00250000 0x00006000>;
		};
	};
};

/* Required by the ssd1306_128x64 shield which enables the OLED display */
arduino_i2c: &i2c0 {};