Linux Audio

Check our new training course

Embedded Linux Audio

Check our new training course
with Creative Commons CC-BY-SA
lecture materials

Bootlin logo

Elixir Cross Referencer

Loading...
/*
 * Copyright (c) 2023 Benjamin Cabé <benjamin@zephyrproject.org>
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/dts-v1/;
#include <st/f4/stm32f412Xg.dtsi>
#include <st/f4/stm32f412r(e-g)tx-pinctrl.dtsi>
#include <zephyr/dt-bindings/input/input-event-codes.h>

/ {
	model = "MXChip AZ3166 IoT Developer Kit";
	compatible = "mxchip,az3166_iotdevkit";

	aliases {
		led0 = &user_led;
		pwm-led0 = &blue_pwm_led;
		sw0 = &button_a;

		red-led = &red_led;
		green-led = &green_led;
		blue-led = &blue_led;

		red-pwm-led = &red_pwm_led;
		green-pwm-led = &green_pwm_led;
		blue-pwm-led = &blue_pwm_led;
	};

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

	leds {
		compatible = "gpio-leds";
		green_led: green_led {
			gpios = <&gpiob 3 GPIO_ACTIVE_HIGH>;
			label = "Green";
		};
		red_led: red_led {
			gpios = <&gpiob 4 GPIO_ACTIVE_HIGH>;
			label = "Red";
		};
		blue_led: blue_led {
			gpios = <&gpioc 7 GPIO_ACTIVE_HIGH>;
			label = "Blue";
		};
		wifi_led: wifi_led {
			gpios = <&gpiob 2 GPIO_ACTIVE_HIGH>;
			label = "Wi-Fi";
		};
		azure_led: azure_led {
			gpios = <&gpioa 15 GPIO_ACTIVE_HIGH>;
			label = "Azure";
		};
		user_led: user_led {
			gpios = <&gpioc 13 GPIO_ACTIVE_HIGH>;
			label = "User";
		};
	};

	pwmleds {
		compatible = "pwm-leds";
		red_pwm_led: red_pwm_led {
			pwms = <&pwm3 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
		};
		green_pwm_led: green_pwm_led {
			pwms = <&pwm2 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
		};
		blue_pwm_led: blue_pwm_led {
			pwms = <&pwm3 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
		};
	};

	buttons {
		compatible = "gpio-keys";
		button_a: button_a {
			gpios = <&gpioa 4 (GPIO_ACTIVE_LOW | GPIO_PULL_DOWN)>;
			label = "Button A";
			zephyr,code = <INPUT_KEY_A>;
		};

		button_b: button_b {
			gpios = <&gpioa 10 (GPIO_ACTIVE_LOW | GPIO_PULL_DOWN)>;
			label = "Button B";
			zephyr,code = <INPUT_KEY_B>;
		};
	};

};

&clk_lsi {
	status = "okay";
};

&clk_hse {
	clock-frequency = <DT_FREQ_M(26)>;
	status = "okay";
};

&pll {
	div-m = <13>;
	mul-n = <96>;
	div-p = <2>;
	div-q = <4>;
	clocks = <&clk_hse>;
	status = "okay";
};

&rcc {
	clocks = <&pll>;
	clock-frequency = <DT_FREQ_M(96)>;
	ahb-prescaler = <1>;
	apb1-prescaler = <2>;
	apb2-prescaler = <1>;
};

&usart1 {
	pinctrl-0 = <&usart1_tx_pb6 &usart1_rx_pb7>;
	pinctrl-names = "default";
	current-speed = <115200>;
	status = "okay";
};


&usart6 {
	pinctrl-0 = <&usart6_tx_pa11 &usart6_rx_pa12>;
	pinctrl-names = "default";
	current-speed = <115200>;
	status = "okay";
};

&i2c1 {
	pinctrl-0 = <&i2c1_scl_pb8 &i2c1_sda_pb9>;
	pinctrl-names = "default";
	clock-frequency = <I2C_BITRATE_FAST>;
	status = "okay";

	lsm6dsl@6a {
		compatible = "st,lsm6dsl";
		reg = <0x6a>;
	};

	hts221@5f {
		compatible = "st,hts221";
		reg = <0x5f>;
	};

	lis2mdl@1e {
		compatible = "st,lis2mdl";
		reg = <0x1e>;
	};

	lps22hb-press@5c {
		compatible = "st,lps22hb-press";
		reg = <0x5c>;
	};

	ssd1306: 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>;
		inversion-on;

		reset-gpios = <&gpioa 8 GPIO_ACTIVE_HIGH>;
	};
};

&spi1 {
	pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>;
	pinctrl-names = "default";
	status = "okay";
};

&timers2 {
	st,prescaler = <10000>;
	status = "okay";

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

&timers3 {
	st,prescaler = <10000>;
	status = "okay";

	pwm3: pwm {
		status = "okay";
		pinctrl-0 = <&tim3_ch1_pb4 &tim3_ch2_pc7>;
		pinctrl-names = "default";
	};
};

&rtc {
	clocks = <&rcc STM32_CLOCK_BUS_APB1 0x10000000>,
		 <&rcc STM32_SRC_LSI RTC_SEL(2)>;
	status = "okay";
};