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
9#pragma once
10
20
21#include "board.h"
22#include "lcd.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/* Default parameters for ILI9341 display */
33#ifndef ILI9341_PARAM_SPI
34#define ILI9341_PARAM_SPI SPI_DEV(0)
35#endif
36#ifndef ILI9341_PARAM_SPI_CLK
37#define ILI9341_PARAM_SPI_CLK SPI_CLK_5MHZ
38#endif
39#ifndef ILI9341_PARAM_CS
40#define ILI9341_PARAM_CS GPIO_PIN(2, 2)
41#endif
42#ifndef ILI9341_PARAM_DCX
43#define ILI9341_PARAM_DCX GPIO_PIN(3, 13)
44#endif
45#ifndef ILI9341_PARAM_RST
46#define ILI9341_PARAM_RST GPIO_UNDEF
47#endif
48#ifndef ILI9341_PARAM_SPI_MODE
49#define ILI9341_PARAM_SPI_MODE SPI_MODE_0
50#endif
51#ifndef ILI9341_PARAM_RGB
52#define ILI9341_PARAM_RGB 0
53#endif
54#ifndef ILI9341_PARAM_INVERTED
55#define ILI9341_PARAM_INVERTED 0
56#endif
57#ifndef ILI9341_PARAM_NUM_LINES
58#define ILI9341_PARAM_NUM_LINES 320U
59#endif
60#ifndef ILI9341_PARAM_RGB_CHANNELS
61#define ILI9341_PARAM_RGB_CHANNELS 240U
62#endif
63#ifndef ILI9341_PARAM_ROTATION
64#define ILI9341_PARAM_ROTATION ILI9341_ROTATION_HORZ_FLIP
65#endif
66#ifndef ILI9341_PARAM_OFFSET_X
67#define ILI9341_PARAM_OFFSET_X 0
68#endif
69#ifndef ILI9341_PARAM_OFFSET_Y
70#define ILI9341_PARAM_OFFSET_Y 0
71#endif
72
73#if MODULE_LCD_SPI || DOXYGEN
75#define ILI9341_PARAM_IF_SPI .spi = ILI9341_PARAM_SPI, \
76 .spi_clk = ILI9341_PARAM_SPI_CLK, \
77 .spi_mode = ILI9341_PARAM_SPI_MODE,
78#else
79#define ILI9341_PARAM_IF_SPI
80#endif
81
82#if MODULE_LCD_PARALLEL || DOXYGEN
84#define ILI9341_PARAM_IF_PAR .d0_pin = ILI9341_PARAM_D0, \
85 .d1_pin = ILI9341_PARAM_D1, \
86 .d2_pin = ILI9341_PARAM_D2, \
87 .d3_pin = ILI9341_PARAM_D3, \
88 .d4_pin = ILI9341_PARAM_D4, \
89 .d5_pin = ILI9341_PARAM_D5, \
90 .d6_pin = ILI9341_PARAM_D6, \
91 .d7_pin = ILI9341_PARAM_D7, \
92 .wrx_pin = ILI9341_PARAM_WRX, \
93 .rdx_pin = ILI9341_PARAM_RDX,
94#else
95#define ILI9341_PARAM_IF_PAR
96#endif
97
98#if MODULE_LCD_PARALLEL_16BIT || DOXYGEN
100#define ILI9341_PARAM_IF_PAR_16BIT .d8_pin = ILI9341_PARAM_D8, \
101 .d9_pin = ILI9341_PARAM_D9, \
102 .d10_pin = ILI9341_PARAM_D10, \
103 .d11_pin = ILI9341_PARAM_D11, \
104 .d12_pin = ILI9341_PARAM_D12, \
105 .d13_pin = ILI9341_PARAM_D13, \
106 .d14_pin = ILI9341_PARAM_D14, \
107 .d15_pin = ILI9341_PARAM_D15,
108#else
109#define ILI9341_PARAM_IF_PAR_16BIT
110#endif
111
112#if MODULE_LCD_PARALLEL_16BIT || DOXYGEN
114#define ILI9341_PARAM_IF_MODE .mode = LCD_IF_PARALLEL_16BIT,
115#elif MODULE_LCD_PARALLEL
117#define ILI9341_PARAM_IF_MODE .mode = LCD_IF_PARALLEL_8BIT,
118#else
120#define ILI9341_PARAM_IF_MODE
121#endif
122
134#ifndef ILI9341_PARAMS
135#define ILI9341_PARAMS { ILI9341_PARAM_IF_MODE \
136 ILI9341_PARAM_IF_SPI \
137 ILI9341_PARAM_IF_PAR \
138 ILI9341_PARAM_IF_PAR_16BIT \
139 .cs_pin = ILI9341_PARAM_CS, \
140 .dcx_pin = ILI9341_PARAM_DCX, \
141 .rst_pin = ILI9341_PARAM_RST, \
142 .rgb = ILI9341_PARAM_RGB, \
143 .inverted = ILI9341_PARAM_INVERTED, \
144 .lines = ILI9341_PARAM_NUM_LINES, \
145 .rgb_channels = ILI9341_PARAM_RGB_CHANNELS, \
146 .rotation = ILI9341_PARAM_ROTATION, \
147 .offset_x = ILI9341_PARAM_OFFSET_X, \
148 .offset_y = ILI9341_PARAM_OFFSET_Y, \
149}
150#endif
152
157{
159};
160
164#ifndef ILI9341_PARAM_SCREEN_IDS
165#define ILI9341_PARAM_SCREEN_IDS 0
166#endif
167
171static const uint8_t ili9341_screen_ids[] =
172{
174};
175
179#define ILI9341_NUMOF ARRAY_SIZE(ili9341_params)
183#define ILI9341_SCREEN_NUMOF ARRAY_SIZE(ili9341_screen_ids)
184
185#ifdef __cplusplus
186}
187#endif
188
#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:112