1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/stm32f746g-disco: enable LTDC peripheral

This commit is contained in:
Alexandre Abadie 2021-12-21 16:28:07 +01:00
parent deccc720e3
commit dbf2f06968
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
6 changed files with 99 additions and 1 deletions

View File

@ -16,6 +16,7 @@ config BOARD_STM32F746G_DISCO
select HAS_PERIPH_DMA
select HAS_PERIPH_ETH
select HAS_PERIPH_I2C
select HAS_PERIPH_LTDC
select HAS_PERIPH_RTC
select HAS_PERIPH_RTT
select HAS_PERIPH_SPI

View File

@ -5,6 +5,7 @@ CPU_MODEL = stm32f746ng
FEATURES_PROVIDED += periph_dma
FEATURES_PROVIDED += periph_eth
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_ltdc
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_spi

View File

@ -18,9 +18,19 @@
* @}
*/
#include "kernel_defines.h"
#include "board.h"
#include "periph/gpio.h"
void board_init(void)
{
gpio_init(BACKLIGHT_PIN, GPIO_OUT);
if (IS_USED(MODULE_PERIPH_LTDC)) {
gpio_init(LCD_DISP_PIN, GPIO_OUT);
gpio_set(LCD_DISP_PIN);
gpio_set(BACKLIGHT_PIN);
}
else {
gpio_clear(BACKLIGHT_PIN);
}
}

View File

@ -27,7 +27,7 @@ Current hardware support:
| Ethernet | X | |
| USB OTG FS | X | |
| USB OTG HS | - | |
| TFT LCD | - | |
| TFT LCD | X | |
| Capacitive touch screen | - | |
| User microphones | - | |
| External Quad-SPI Flash | - | |

View File

@ -27,6 +27,36 @@
extern "C" {
#endif
/**
* @name LCD Backlight control defines
* @{
*/
#define BACKLIGHT_PIN GPIO_PIN(PORT_K, 3) /**< Backlight pin */
#define BACKLIGHT_MASK (1 << 3) /**< Backlight pin mask */
/** Set the backlight pin */
#define BACKLIGHT_ON (GPIOK->BSRR = BACKLIGHT_MASK)
/** Clear the backlight pin */
#define BACKLIGHT_OFF (GPIOK->BSRR = (BACKLIGHT_MASK << 16))
/** Toggle the backlight pin */
#define BACKLIGHT_TOGGLE (GPIOK->ODR ^= BACKLIGHT_MASK)
/** @} */
/**
* @name LCD display enable pin
* @{
*/
#define LCD_DISP_PIN GPIO_PIN(PORT_I, 12) /**< LCD screen enable pin */
/** @} */
/**
* @name LCD screen dimensions
* @{
*/
#define LCD_SCREEN_WIDTH 480 /**< LCD screen width */
#define LCD_SCREEN_HEIGHT 272 /**< LCD screen height */
/** @} */
/**
* @name User button
* @{

View File

@ -173,6 +173,62 @@ static const eth_conf_t eth_config = {
#define ETH_DMA_ISR isr_dma2_stream0
/** @} */
/**
* @name LTDC configuration
* @{
*/
/** LTDC static configuration struct */
static const ltdc_conf_t ltdc_config = {
.bus = APB2,
.rcc_mask = RCC_APB2ENR_LTDCEN,
.clk_pin = { .pin = GPIO_PIN(PORT_I, 14), .af = GPIO_AF14, },
.de_pin = { .pin = GPIO_PIN(PORT_K, 7), .af = GPIO_AF14, },
.hsync_pin = { .pin = GPIO_PIN(PORT_I, 10), .af = GPIO_AF14, },
.vsync_pin = { .pin = GPIO_PIN(PORT_I, 9), .af = GPIO_AF14, },
.r_pin = {
{ .pin = GPIO_PIN(PORT_I, 15), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 0), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 1), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 2), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 3), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 4), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 5), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 6), .af = GPIO_AF14, },
},
.g_pin = {
{ .pin = GPIO_PIN(PORT_J, 7), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 8), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 9), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 10), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 11), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_K, 0), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_K, 1), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_K, 2), .af = GPIO_AF14, },
},
.b_pin = {
{ .pin = GPIO_PIN(PORT_E, 4), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 13), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 14), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_J, 15), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_G, 12), .af = GPIO_AF9, },
{ .pin = GPIO_PIN(PORT_K, 4), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_K, 5), .af = GPIO_AF14, },
{ .pin = GPIO_PIN(PORT_K, 6), .af = GPIO_AF14, },
},
/* values below come from STM32CubeF7 code and differ from the typical
* values mentioned in the RK043FN48H datasheet. Both sets of values work
* with the display.
* See the discussion in https://community.st.com/s/question/0D50X0000BOvdWP/how-to-set-displays-parameters-
*/
.hsync = 41,
.vsync = 10,
.hbp = 13,
.hfp = 32,
.vbp = 2,
.vfp = 2,
};
/** @} */
#ifdef __cplusplus
}
#endif