1/* 2 * Copyright (c) 2021 Tokita, Hiroshi <tokita.hiroshi@gmail.com> 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7#include <zephyr/dt-bindings/input/input-event-codes.h> 8 9/ { 10 chosen { 11 zephyr,console = &usart0; 12 zephyr,shell-uart = &usart0; 13 zephyr,sram = &sram0; 14 zephyr,flash = &flash0; 15 zephyr,display = &lcd0; 16 sdhc0 = &sdhc0; 17 }; 18 19 leds { 20 compatible = "gpio-leds"; 21 led_red: led_red { 22 gpios = <&gpioc 13 GPIO_ACTIVE_LOW>; 23 label = "LED_R"; 24 }; 25 led_green: led_green { 26 gpios = <&gpioa 1 GPIO_ACTIVE_LOW>; 27 label = "LED_G"; 28 }; 29 led_blue: led_blue { 30 gpios = <&gpioa 2 GPIO_ACTIVE_LOW>; 31 label = "LED_B"; 32 }; 33 }; 34 35 gpio_keys { 36 compatible = "gpio-keys"; 37 button_boot0: button_boot0 { 38 label = "BUTTON_BOOT0"; 39 gpios = <&gpioa 8 GPIO_ACTIVE_HIGH>; 40 zephyr,code = <INPUT_KEY_0>; 41 }; 42 }; 43 44 pwmleds { 45 compatible = "pwm-leds"; 46 47 /* NOTE: bridge TIMER1_CH1 and LED_GREEN (PA1) */ 48 pwm_led_green: pwm_led_green { 49 pwms = <&pwm1 1 PWM_MSEC(20) PWM_POLARITY_NORMAL>; 50 label = "PWM_LED_G"; 51 }; 52 /* NOTE: bridge TIMER1_CH2 and LED_BLUE (PA2) */ 53 pwm_led_blue: pwm_led_blue { 54 pwms = <&pwm1 2 PWM_MSEC(20) PWM_POLARITY_NORMAL>; 55 label = "PWM_LED_B"; 56 }; 57 }; 58 59 aliases { 60 led0 = &led_red; 61 led1 = &led_green; 62 led2 = &led_blue; 63 pwm-led0 = &pwm_led_green; 64 pwm-led1 = &pwm_led_blue; 65 sw0 = &button_boot0; 66 watchdog0 = &fwdgt; 67 }; 68}; 69 70&gpioa { 71 status = "okay"; 72}; 73 74&gpiob { 75 status = "okay"; 76}; 77 78&gpioc { 79 status = "okay"; 80}; 81 82&usart0 { 83 status = "okay"; 84 current-speed = <115200>; 85 pinctrl-0 = <&usart0_default>; 86 pinctrl-names = "default"; 87}; 88 89&timer1 { 90 status = "okay"; 91 prescaler = <4096>; 92 93 pwm1: pwm { 94 status = "okay"; 95 pinctrl-0 = <&pwm1_default>; 96 pinctrl-names = "default"; 97 }; 98}; 99 100&dac { 101 status = "okay"; 102 pinctrl-0 = <&dac_default>; 103 pinctrl-names = "default"; 104}; 105 106&spi0 { 107 status = "okay"; 108 pinctrl-0 = <&spi0_default>; 109 pinctrl-names = "default"; 110 111 cs-gpios = <&gpiob 2 GPIO_ACTIVE_LOW>; 112 113 /* longan nano has LCD with st7735s controller. 114 * It can use with st7735r driver. 115 */ 116 lcd0: lcd@0 { 117 compatible = "sitronix,st7735r"; 118 reg = <0>; 119 status = "okay"; 120 reset-gpios = <&gpiob 1 GPIO_ACTIVE_LOW>; 121 cmd-data-gpios = <&gpiob 0 GPIO_ACTIVE_LOW>; 122 width = <160>; 123 height = <80>; 124 inversion-on; 125 rgb-is-inverted; 126 x-offset = <1>; 127 y-offset = <26>; 128 pwctr1 = [62 02 04]; 129 pwctr2 = [C0]; 130 pwctr3 = [0D 00]; 131 pwctr4 = [8D 6A]; 132 pwctr5 = [8D EE]; 133 invctr = <3>; 134 frmctr1 = [05 3A 3A]; 135 frmctr2 = [05 3A 3A]; 136 frmctr3 = [05 3A 3A 05 3A 3A]; 137 vmctr1 = <14>; 138 gamctrp1 = [10 0E 02 03 0E 07 02 07 0A 12 27 37 00 0D 0E 10]; 139 gamctrn1 = [10 0E 03 03 0F 06 02 08 0A 13 26 36 00 0D 0E 10]; 140 colmod = <5>; 141 madctl = <120>; 142 caset = [00 01 00 a0]; 143 raset = [00 1a 00 69]; 144 145 spi-max-frequency = <4000000>; 146 }; 147}; 148 149&spi1 { 150 status = "okay"; 151 pinctrl-0 = <&spi1_default>; 152 pinctrl-names = "default"; 153 154 cs-gpios = <&gpiob 12 GPIO_ACTIVE_LOW>; 155 156 sdhc0: sdhc@0 { 157 compatible = "zephyr,sdhc-spi-slot"; 158 reg = <0>; 159 status = "okay"; 160 spi-max-frequency = <24000000>; 161 mmc { 162 compatible = "zephyr,sdmmc-disk"; 163 status = "okay"; 164 }; 165 }; 166}; 167 168&fwdgt { 169 status = "okay"; 170}; 171