board.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2018 Inria
3  * SPDX-FileCopyrightText: 2023 Gunar Schorcht
4  * SPDX-License-Identifier: LGPL-2.1-only
5  */
6 
7 #pragma once
8 
20 #include <stdint.h>
21 
22 #include "cpu.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
32 #define BACKLIGHT_PIN GPIO_PIN(PORT_I, 0)
33 #define BACKLIGHT_MASK (1 << 0)
36 #define BACKLIGHT_ON (GPIOI->BSRR = BACKLIGHT_MASK)
38 #define BACKLIGHT_OFF (GPIOI->BSRR = (BACKLIGHT_MASK << 16))
40 #define BACKLIGHT_TOGGLE (GPIOI->ODR ^= BACKLIGHT_MASK)
65 #define LCD_DISP_PIN GPIO_PIN(PORT_H, 0)
66 #define LCD_SCREEN_WIDTH 240
67 #define LCD_SCREEN_HEIGHT 240
69 #define LCD_D0 GPIO_PIN(PORT_D, 14)
70 #define LCD_D1 GPIO_PIN(PORT_D, 15)
71 #define LCD_D2 GPIO_PIN(PORT_D, 0)
72 #define LCD_D3 GPIO_PIN(PORT_D, 1)
73 #define LCD_D4 GPIO_PIN(PORT_E, 7)
74 #define LCD_D5 GPIO_PIN(PORT_E, 8)
75 #define LCD_D6 GPIO_PIN(PORT_E, 9)
76 #define LCD_D7 GPIO_PIN(PORT_E, 10)
77 #define LCD_D8 GPIO_PIN(PORT_E, 11)
78 #define LCD_D9 GPIO_PIN(PORT_E, 12)
79 #define LCD_D10 GPIO_PIN(PORT_E, 13)
80 #define LCD_D11 GPIO_PIN(PORT_E, 14)
81 #define LCD_D12 GPIO_PIN(PORT_E, 15)
82 #define LCD_D13 GPIO_PIN(PORT_D, 8)
83 #define LCD_D14 GPIO_PIN(PORT_D, 9)
84 #define LCD_D15 GPIO_PIN(PORT_D, 10)
85 #define LCD_TE GPIO_PIN(PORT_H, 7)
86 #define LCD_WE GPIO_PIN(PORT_D, 5)
87 #define LCD_OE GPIO_PIN(PORT_D, 4)
88 #define LCD_RS GPIO_PIN(PORT_D, 13)
89 #define LCD_NE GPIO_PIN(PORT_D, 7)
90 #define LCD_RST GPIO_UNDEF
91 #define LCD_BACKLIGHT BACKLIGHT_PIN
93 #define ST77XX_PARAM_CNTRL ST77XX_CNTRL_ST7789
94 #define ST77XX_PARAM_SPI SPI_UNDEF
95 #define ST77XX_PARAM_D0 LCD_D0
96 #define ST77XX_PARAM_D1 LCD_D1
97 #define ST77XX_PARAM_D2 LCD_D2
98 #define ST77XX_PARAM_D3 LCD_D3
99 #define ST77XX_PARAM_D4 LCD_D4
100 #define ST77XX_PARAM_D5 LCD_D5
101 #define ST77XX_PARAM_D6 LCD_D6
102 #define ST77XX_PARAM_D7 LCD_D7
103 #define ST77XX_PARAM_D8 LCD_D8
104 #define ST77XX_PARAM_D9 LCD_D9
105 #define ST77XX_PARAM_D10 LCD_D10
106 #define ST77XX_PARAM_D11 LCD_D11
107 #define ST77XX_PARAM_D12 LCD_D12
108 #define ST77XX_PARAM_D13 LCD_D13
109 #define ST77XX_PARAM_D14 LCD_D14
110 #define ST77XX_PARAM_D15 LCD_D15
111 #define ST77XX_PARAM_WRX LCD_WE
112 #define ST77XX_PARAM_RDX LCD_OE
113 #define ST77XX_PARAM_DCX LCD_RS
114 #define ST77XX_PARAM_RST LCD_RST
115 #define ST77XX_PARAM_CS LCD_NE
116 #define ST77XX_PARAM_RGB 1
117 #define ST77XX_PARAM_INVERTED 1
118 #define ST77XX_PARAM_ROTATION ST77XX_ROTATION_0
119 #define ST77XX_PARAM_NUM_LINES LCD_SCREEN_HEIGHT
120 #define ST77XX_PARAM_RGB_CHANNELS LCD_SCREEN_WIDTH
130 #define FT5X06_PARAM_I2C_DEV I2C_DEV(1)
131 #define FT5X06_PARAM_INT_PIN GPIO_PIN(PORT_G, 14)
132 #define FT5X06_PARAM_XMAX LCD_SCREEN_WIDTH
133 #define FT5X06_PARAM_YMAX LCD_SCREEN_HEIGHT
134 #define FT5X06_PARAM_TYPE FT5X06_TYPE_FT6X36
135 #define FT5X06_PARAM_XYCONV FT5X06_SWAP_XY | FT5X06_MIRROR_Y
147 #define LED0_PIN_NUM 13
148 #define LED0_PORT GPIO_PORT_B
149 #define LED0_PORT_NUM PORT_B
151 #define LED1_PIN_NUM 5
152 #define LED1_PORT GPIO_PORT_A
153 #define LED1_PORT_NUM PORT_A
154 #define LED1_IS_INVERTED 1
163 #define BTN0_PIN GPIO_PIN(PORT_C, 13)
164 #define BTN0_MODE GPIO_IN_PD
166 #define BTN1_PIN GPIO_PIN(PORT_I, 9)
167 #define BTN1_MODE GPIO_IN_PD
169 #define BTN2_PIN GPIO_PIN(PORT_I, 10)
170 #define BTN2_MODE GPIO_IN_PD
172 #define BTN3_PIN GPIO_PIN(PORT_F, 11)
173 #define BTN3_MODE GPIO_IN_PD
175 #define BTN4_PIN GPIO_PIN(PORT_I, 8)
176 #define BTN4_MODE GPIO_IN_PD
179 #ifdef __cplusplus
180 }
181 #endif
182 
183 #include "stm32_leds.h"
184 
Common LED macros.