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 
10 #pragma once
11 
23 #include <stdint.h>
24 
25 #include "cpu.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
35 #define BACKLIGHT_PIN GPIO_PIN(PORT_I, 0)
36 #define BACKLIGHT_MASK (1 << 0)
39 #define BACKLIGHT_ON (GPIOI->BSRR = BACKLIGHT_MASK)
41 #define BACKLIGHT_OFF (GPIOI->BSRR = (BACKLIGHT_MASK << 16))
43 #define BACKLIGHT_TOGGLE (GPIOI->ODR ^= BACKLIGHT_MASK)
68 #define LCD_DISP_PIN GPIO_PIN(PORT_H, 0)
69 #define LCD_SCREEN_WIDTH 240
70 #define LCD_SCREEN_HEIGHT 240
72 #define LCD_D0 GPIO_PIN(PORT_D, 14)
73 #define LCD_D1 GPIO_PIN(PORT_D, 15)
74 #define LCD_D2 GPIO_PIN(PORT_D, 0)
75 #define LCD_D3 GPIO_PIN(PORT_D, 1)
76 #define LCD_D4 GPIO_PIN(PORT_E, 7)
77 #define LCD_D5 GPIO_PIN(PORT_E, 8)
78 #define LCD_D6 GPIO_PIN(PORT_E, 9)
79 #define LCD_D7 GPIO_PIN(PORT_E, 10)
80 #define LCD_D8 GPIO_PIN(PORT_E, 11)
81 #define LCD_D9 GPIO_PIN(PORT_E, 12)
82 #define LCD_D10 GPIO_PIN(PORT_E, 13)
83 #define LCD_D11 GPIO_PIN(PORT_E, 14)
84 #define LCD_D12 GPIO_PIN(PORT_E, 15)
85 #define LCD_D13 GPIO_PIN(PORT_D, 8)
86 #define LCD_D14 GPIO_PIN(PORT_D, 9)
87 #define LCD_D15 GPIO_PIN(PORT_D, 10)
88 #define LCD_TE GPIO_PIN(PORT_H, 7)
89 #define LCD_WE GPIO_PIN(PORT_D, 5)
90 #define LCD_OE GPIO_PIN(PORT_D, 4)
91 #define LCD_RS GPIO_PIN(PORT_D, 13)
92 #define LCD_NE GPIO_PIN(PORT_D, 7)
93 #define LCD_RST GPIO_UNDEF
94 #define LCD_BACKLIGHT BACKLIGHT_PIN
96 #define ST77XX_PARAM_CNTRL ST77XX_CNTRL_ST7789
97 #define ST77XX_PARAM_SPI SPI_UNDEF
98 #define ST77XX_PARAM_D0 LCD_D0
99 #define ST77XX_PARAM_D1 LCD_D1
100 #define ST77XX_PARAM_D2 LCD_D2
101 #define ST77XX_PARAM_D3 LCD_D3
102 #define ST77XX_PARAM_D4 LCD_D4
103 #define ST77XX_PARAM_D5 LCD_D5
104 #define ST77XX_PARAM_D6 LCD_D6
105 #define ST77XX_PARAM_D7 LCD_D7
106 #define ST77XX_PARAM_D8 LCD_D8
107 #define ST77XX_PARAM_D9 LCD_D9
108 #define ST77XX_PARAM_D10 LCD_D10
109 #define ST77XX_PARAM_D11 LCD_D11
110 #define ST77XX_PARAM_D12 LCD_D12
111 #define ST77XX_PARAM_D13 LCD_D13
112 #define ST77XX_PARAM_D14 LCD_D14
113 #define ST77XX_PARAM_D15 LCD_D15
114 #define ST77XX_PARAM_WRX LCD_WE
115 #define ST77XX_PARAM_RDX LCD_OE
116 #define ST77XX_PARAM_DCX LCD_RS
117 #define ST77XX_PARAM_RST LCD_RST
118 #define ST77XX_PARAM_CS LCD_NE
119 #define ST77XX_PARAM_RGB 1
120 #define ST77XX_PARAM_INVERTED 1
121 #define ST77XX_PARAM_ROTATION ST77XX_ROTATION_0
122 #define ST77XX_PARAM_NUM_LINES LCD_SCREEN_HEIGHT
123 #define ST77XX_PARAM_RGB_CHANNELS LCD_SCREEN_WIDTH
133 #define FT5X06_PARAM_I2C_DEV I2C_DEV(1)
134 #define FT5X06_PARAM_INT_PIN GPIO_PIN(PORT_G, 14)
135 #define FT5X06_PARAM_XMAX LCD_SCREEN_WIDTH
136 #define FT5X06_PARAM_YMAX LCD_SCREEN_HEIGHT
137 #define FT5X06_PARAM_TYPE FT5X06_TYPE_FT6X36
138 #define FT5X06_PARAM_XYCONV FT5X06_SWAP_XY | FT5X06_MIRROR_Y
150 #define LED0_PIN_NUM 13
151 #define LED0_PORT GPIO_PORT_B
152 #define LED0_PORT_NUM PORT_B
154 #define LED1_PIN_NUM 5
155 #define LED1_PORT GPIO_PORT_A
156 #define LED1_PORT_NUM PORT_A
157 #define LED1_IS_INVERTED 1
166 #define BTN0_PIN GPIO_PIN(PORT_C, 13)
167 #define BTN0_MODE GPIO_IN_PD
169 #define BTN1_PIN GPIO_PIN(PORT_I, 9)
170 #define BTN1_MODE GPIO_IN_PD
172 #define BTN2_PIN GPIO_PIN(PORT_I, 10)
173 #define BTN2_MODE GPIO_IN_PD
175 #define BTN3_PIN GPIO_PIN(PORT_F, 11)
176 #define BTN3_MODE GPIO_IN_PD
178 #define BTN4_PIN GPIO_PIN(PORT_I, 8)
179 #define BTN4_MODE GPIO_IN_PD
182 #ifdef __cplusplus
183 }
184 #endif
185 
186 #include "stm32_leds.h"
187 
Common LED macros.