board.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 Inria
3  * 2023 Gunar Schorcht
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
21 #ifndef BOARD_H
22 #define BOARD_H
23 
24 #include <stdint.h>
25 
26 #include "cpu.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
36 #define BACKLIGHT_PIN GPIO_PIN(PORT_I, 0)
37 #define BACKLIGHT_MASK (1 << 0)
40 #define BACKLIGHT_ON (GPIOI->BSRR = BACKLIGHT_MASK)
42 #define BACKLIGHT_OFF (GPIOI->BSRR = (BACKLIGHT_MASK << 16))
44 #define BACKLIGHT_TOGGLE (GPIOI->ODR ^= BACKLIGHT_MASK)
69 #define LCD_DISP_PIN GPIO_PIN(PORT_H, 0)
70 #define LCD_SCREEN_WIDTH 240
71 #define LCD_SCREEN_HEIGHT 240
73 #define LCD_D0 GPIO_PIN(PORT_D, 14)
74 #define LCD_D1 GPIO_PIN(PORT_D, 15)
75 #define LCD_D2 GPIO_PIN(PORT_D, 0)
76 #define LCD_D3 GPIO_PIN(PORT_D, 1)
77 #define LCD_D4 GPIO_PIN(PORT_E, 7)
78 #define LCD_D5 GPIO_PIN(PORT_E, 8)
79 #define LCD_D6 GPIO_PIN(PORT_E, 9)
80 #define LCD_D7 GPIO_PIN(PORT_E, 10)
81 #define LCD_D8 GPIO_PIN(PORT_E, 11)
82 #define LCD_D9 GPIO_PIN(PORT_E, 12)
83 #define LCD_D10 GPIO_PIN(PORT_E, 13)
84 #define LCD_D11 GPIO_PIN(PORT_E, 14)
85 #define LCD_D12 GPIO_PIN(PORT_E, 15)
86 #define LCD_D13 GPIO_PIN(PORT_D, 8)
87 #define LCD_D14 GPIO_PIN(PORT_D, 9)
88 #define LCD_D15 GPIO_PIN(PORT_D, 10)
89 #define LCD_TE GPIO_PIN(PORT_H, 7)
90 #define LCD_WE GPIO_PIN(PORT_D, 5)
91 #define LCD_OE GPIO_PIN(PORT_D, 4)
92 #define LCD_RS GPIO_PIN(PORT_D, 13)
93 #define LCD_NE GPIO_PIN(PORT_D, 7)
94 #define LCD_RST GPIO_UNDEF
95 #define LCD_BACKLIGHT BACKLIGHT_PIN
97 #define ST77XX_PARAM_CNTRL ST77XX_CNTRL_ST7789
98 #define ST77XX_PARAM_SPI SPI_UNDEF
99 #define ST77XX_PARAM_D0 LCD_D0
100 #define ST77XX_PARAM_D1 LCD_D1
101 #define ST77XX_PARAM_D2 LCD_D2
102 #define ST77XX_PARAM_D3 LCD_D3
103 #define ST77XX_PARAM_D4 LCD_D4
104 #define ST77XX_PARAM_D5 LCD_D5
105 #define ST77XX_PARAM_D6 LCD_D6
106 #define ST77XX_PARAM_D7 LCD_D7
107 #define ST77XX_PARAM_D8 LCD_D8
108 #define ST77XX_PARAM_D9 LCD_D9
109 #define ST77XX_PARAM_D10 LCD_D10
110 #define ST77XX_PARAM_D11 LCD_D11
111 #define ST77XX_PARAM_D12 LCD_D12
112 #define ST77XX_PARAM_D13 LCD_D13
113 #define ST77XX_PARAM_D14 LCD_D14
114 #define ST77XX_PARAM_D15 LCD_D15
115 #define ST77XX_PARAM_WRX LCD_WE
116 #define ST77XX_PARAM_RDX LCD_OE
117 #define ST77XX_PARAM_DCX LCD_RS
118 #define ST77XX_PARAM_RST LCD_RST
119 #define ST77XX_PARAM_CS LCD_NE
120 #define ST77XX_PARAM_RGB 1
121 #define ST77XX_PARAM_INVERTED 1
122 #define ST77XX_PARAM_ROTATION ST77XX_ROTATION_0
123 #define ST77XX_PARAM_NUM_LINES LCD_SCREEN_HEIGHT
124 #define ST77XX_PARAM_RGB_CHANNELS LCD_SCREEN_WIDTH
134 #define FT5X06_PARAM_I2C_DEV I2C_DEV(1)
135 #define FT5X06_PARAM_INT_PIN GPIO_PIN(PORT_G, 14)
136 #define FT5X06_PARAM_XMAX LCD_SCREEN_WIDTH
137 #define FT5X06_PARAM_YMAX LCD_SCREEN_HEIGHT
138 #define FT5X06_PARAM_TYPE FT5X06_TYPE_FT6X36
139 #define FT5X06_PARAM_XYCONV FT5X06_SWAP_XY | FT5X06_MIRROR_Y
151 #define LED0_PIN_NUM 13
152 #define LED0_PORT GPIO_PORT_B
153 #define LED0_PORT_NUM PORT_B
155 #define LED1_PIN_NUM 5
156 #define LED1_PORT GPIO_PORT_A
157 #define LED1_PORT_NUM PORT_A
158 #define LED1_IS_INVERTED 1
167 #define BTN0_PIN GPIO_PIN(PORT_C, 13)
168 #define BTN0_MODE GPIO_IN_PD
170 #define BTN1_PIN GPIO_PIN(PORT_I, 9)
171 #define BTN1_MODE GPIO_IN_PD
173 #define BTN2_PIN GPIO_PIN(PORT_I, 10)
174 #define BTN2_MODE GPIO_IN_PD
176 #define BTN3_PIN GPIO_PIN(PORT_F, 11)
177 #define BTN3_MODE GPIO_IN_PD
179 #define BTN4_PIN GPIO_PIN(PORT_I, 8)
180 #define BTN4_MODE GPIO_IN_PD
183 #ifdef __cplusplus
184 }
185 #endif
186 
187 #include "stm32_leds.h"
188 
189 #endif /* BOARD_H */
Common LED macros.