Loading...
Searching...
No Matches
ili9341_params.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 Koen Zandberg <koen@bergzand.net>
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
19#ifndef ILI9341_PARAMS_H
20#define ILI9341_PARAMS_H
21
22#include "board.h"
23#include "lcd.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29/* Default parameters for ILI9341 display */
34#ifndef ILI9341_PARAM_SPI
35#define ILI9341_PARAM_SPI SPI_DEV(0)
36#endif
37#ifndef ILI9341_PARAM_SPI_CLK
38#define ILI9341_PARAM_SPI_CLK SPI_CLK_5MHZ
39#endif
40#ifndef ILI9341_PARAM_CS
41#define ILI9341_PARAM_CS GPIO_PIN(2, 2)
42#endif
43#ifndef ILI9341_PARAM_DCX
44#define ILI9341_PARAM_DCX GPIO_PIN(3, 13)
45#endif
46#ifndef ILI9341_PARAM_RST
47#define ILI9341_PARAM_RST GPIO_UNDEF
48#endif
49#ifndef ILI9341_PARAM_SPI_MODE
50#define ILI9341_PARAM_SPI_MODE SPI_MODE_0
51#endif
52#ifndef ILI9341_PARAM_RGB
53#define ILI9341_PARAM_RGB 0
54#endif
55#ifndef ILI9341_PARAM_INVERTED
56#define ILI9341_PARAM_INVERTED 0
57#endif
58#ifndef ILI9341_PARAM_NUM_LINES
59#define ILI9341_PARAM_NUM_LINES 320U
60#endif
61#ifndef ILI9341_PARAM_RGB_CHANNELS
62#define ILI9341_PARAM_RGB_CHANNELS 240U
63#endif
64#ifndef ILI9341_PARAM_ROTATION
65#define ILI9341_PARAM_ROTATION ILI9341_ROTATION_HORZ_FLIP
66#endif
67#ifndef ILI9341_PARAM_OFFSET_X
68#define ILI9341_PARAM_OFFSET_X 0
69#endif
70#ifndef ILI9341_PARAM_OFFSET_Y
71#define ILI9341_PARAM_OFFSET_Y 0
72#endif
73
74#if MODULE_LCD_SPI || DOXYGEN
76#define ILI9341_PARAM_IF_SPI .spi = ILI9341_PARAM_SPI, \
77 .spi_clk = ILI9341_PARAM_SPI_CLK, \
78 .spi_mode = ILI9341_PARAM_SPI_MODE,
79#else
80#define ILI9341_PARAM_IF_SPI
81#endif
82
83#if MODULE_LCD_PARALLEL || DOXYGEN
85#define ILI9341_PARAM_IF_PAR .d0_pin = ILI9341_PARAM_D0, \
86 .d1_pin = ILI9341_PARAM_D1, \
87 .d2_pin = ILI9341_PARAM_D2, \
88 .d3_pin = ILI9341_PARAM_D3, \
89 .d4_pin = ILI9341_PARAM_D4, \
90 .d5_pin = ILI9341_PARAM_D5, \
91 .d6_pin = ILI9341_PARAM_D6, \
92 .d7_pin = ILI9341_PARAM_D7, \
93 .wrx_pin = ILI9341_PARAM_WRX, \
94 .rdx_pin = ILI9341_PARAM_RDX,
95#else
96#define ILI9341_PARAM_IF_PAR
97#endif
98
99#if MODULE_LCD_PARALLEL_16BIT || DOXYGEN
101#define ILI9341_PARAM_IF_PAR_16BIT .d8_pin = ILI9341_PARAM_D8, \
102 .d9_pin = ILI9341_PARAM_D9, \
103 .d10_pin = ILI9341_PARAM_D10, \
104 .d11_pin = ILI9341_PARAM_D11, \
105 .d12_pin = ILI9341_PARAM_D12, \
106 .d13_pin = ILI9341_PARAM_D13, \
107 .d14_pin = ILI9341_PARAM_D14, \
108 .d15_pin = ILI9341_PARAM_D15,
109#else
110#define ILI9341_PARAM_IF_PAR_16BIT
111#endif
112
113#if MODULE_LCD_PARALLEL_16BIT || DOXYGEN
115#define ILI9341_PARAM_IF_MODE .mode = LCD_IF_PARALLEL_16BIT,
116#elif MODULE_LCD_PARALLEL
118#define ILI9341_PARAM_IF_MODE .mode = LCD_IF_PARALLEL_8BIT,
119#else
121#define ILI9341_PARAM_IF_MODE
122#endif
123
135#ifndef ILI9341_PARAMS
136#define ILI9341_PARAMS { ILI9341_PARAM_IF_MODE \
137 ILI9341_PARAM_IF_SPI \
138 ILI9341_PARAM_IF_PAR \
139 ILI9341_PARAM_IF_PAR_16BIT \
140 .cs_pin = ILI9341_PARAM_CS, \
141 .dcx_pin = ILI9341_PARAM_DCX, \
142 .rst_pin = ILI9341_PARAM_RST, \
143 .rgb = ILI9341_PARAM_RGB, \
144 .inverted = ILI9341_PARAM_INVERTED, \
145 .lines = ILI9341_PARAM_NUM_LINES, \
146 .rgb_channels = ILI9341_PARAM_RGB_CHANNELS, \
147 .rotation = ILI9341_PARAM_ROTATION, \
148 .offset_x = ILI9341_PARAM_OFFSET_X, \
149 .offset_y = ILI9341_PARAM_OFFSET_Y, \
150}
151#endif
158{
160};
161
165#ifndef ILI9341_PARAM_SCREEN_IDS
166#define ILI9341_PARAM_SCREEN_IDS 0
167#endif
168
172static const uint8_t ili9341_screen_ids[] =
173{
175};
176
180#define ILI9341_NUMOF ARRAY_SIZE(ili9341_params)
184#define ILI9341_SCREEN_NUMOF ARRAY_SIZE(ili9341_screen_ids)
185
186#ifdef __cplusplus
187}
188#endif
189
190#endif /* ILI9341_PARAMS_H */
#define ILI9341_PARAM_SCREEN_IDS
Default screen identifiers.
static const lcd_params_t ili9341_params[]
Configure ILI9341.
#define ILI9341_PARAMS
Default params.
static const uint8_t ili9341_screen_ids[]
Configure screen identifiers.
Device initialization parameters.
Definition lcd.h:113