|
| 1 | +/**************************************************************************** |
| 2 | + * boards/arm/stm32h7/linum-stm32h753bi/src/stm32_lcd.c |
| 3 | + * |
| 4 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 5 | + * contributor license agreements. See the NOTICE file distributed with |
| 6 | + * this work for additional information regarding copyright ownership. The |
| 7 | + * ASF licenses this file to you under the Apache License, Version 2.0 (the |
| 8 | + * "License"); you may not use this file except in compliance with the |
| 9 | + * License. You may obtain a copy of the License at |
| 10 | + * |
| 11 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | + * |
| 13 | + * Unless required by applicable law or agreed to in writing, software |
| 14 | + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 15 | + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 16 | + * License for the specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + * |
| 19 | + ****************************************************************************/ |
| 20 | + |
| 21 | +/**************************************************************************** |
| 22 | + * Included Files |
| 23 | + ****************************************************************************/ |
| 24 | + |
| 25 | +#include <nuttx/config.h> |
| 26 | + |
| 27 | +#include <errno.h> |
| 28 | +#include <debug.h> |
| 29 | + |
| 30 | +#include <nuttx/arch.h> |
| 31 | +#include <nuttx/board.h> |
| 32 | +#include <nuttx/video/fb.h> |
| 33 | +#include <arch/board/board.h> |
| 34 | + |
| 35 | +#include "stm32_gpio.h" |
| 36 | +#include "stm32_ltdc.h" |
| 37 | + |
| 38 | +#include "linum-stm32h753bi.h" |
| 39 | + |
| 40 | +#ifdef CONFIG_STM32H7_LTDC |
| 41 | +/**************************************************************************** |
| 42 | + * Public Functions |
| 43 | + ****************************************************************************/ |
| 44 | + |
| 45 | +/**************************************************************************** |
| 46 | + * Name: up_fbinitialize |
| 47 | + * |
| 48 | + * Description: |
| 49 | + * Initialize the framebuffer video hardware associated with the display. |
| 50 | + * |
| 51 | + * Input Parameters: |
| 52 | + * display - In the case of hardware with multiple displays, this |
| 53 | + * specifies the display. Normally this is zero. |
| 54 | + * |
| 55 | + * Returned Value: |
| 56 | + * Zero is returned on success; a negated errno value is returned on any |
| 57 | + * failure. |
| 58 | + * |
| 59 | + ****************************************************************************/ |
| 60 | + |
| 61 | +int up_fbinitialize(int display) |
| 62 | +{ |
| 63 | + /* Custom LCD display with RGB interface */ |
| 64 | + |
| 65 | + stm32_configgpio(GPIO_LCD_DISP); |
| 66 | + stm32_configgpio(GPIO_LCD_BL); |
| 67 | + |
| 68 | + stm32_gpiowrite(GPIO_LCD_DISP, true); |
| 69 | + stm32_gpiowrite(GPIO_LCD_BL, true); |
| 70 | + |
| 71 | + return stm32_ltdcinitialize(); |
| 72 | +} |
| 73 | + |
| 74 | +/**************************************************************************** |
| 75 | + * Name: up_fbgetvplane |
| 76 | + * |
| 77 | + * Description: |
| 78 | + * Return a a reference to the framebuffer object for the specified video |
| 79 | + * plane of the specified plane. |
| 80 | + * Many OSDs support multiple planes of video. |
| 81 | + * |
| 82 | + * Input Parameters: |
| 83 | + * display - In the case of hardware with multiple displays, this |
| 84 | + * specifies the display. Normally this is zero. |
| 85 | + * vplane - Identifies the plane being queried. |
| 86 | + * |
| 87 | + * Returned Value: |
| 88 | + * A non-NULL pointer to the frame buffer access structure is returned on |
| 89 | + * success; NULL is returned on any failure. |
| 90 | + * |
| 91 | + ****************************************************************************/ |
| 92 | + |
| 93 | +struct fb_vtable_s *up_fbgetvplane(int display, int vplane) |
| 94 | +{ |
| 95 | + return stm32_ltdcgetvplane(vplane); |
| 96 | +} |
| 97 | + |
| 98 | +/**************************************************************************** |
| 99 | + * Name: up_fbuninitialize |
| 100 | + * |
| 101 | + * Description: |
| 102 | + * Uninitialize the framebuffer support for the specified display. |
| 103 | + * |
| 104 | + * Input Parameters: |
| 105 | + * display - In the case of hardware with multiple displays, this |
| 106 | + * specifies the display. Normally this is zero. |
| 107 | + * |
| 108 | + * Returned Value: |
| 109 | + * None |
| 110 | + * |
| 111 | + ****************************************************************************/ |
| 112 | + |
| 113 | +void up_fbuninitialize(int display) |
| 114 | +{ |
| 115 | + stm32_gpiowrite(GPIO_LCD_DISP, false); |
| 116 | + stm32_gpiowrite(GPIO_LCD_BL, false); |
| 117 | + |
| 118 | + stm32_ltdcuninitialize(); |
| 119 | +} |
| 120 | +#endif /* CONFIG_STM32_LTDC */ |
0 commit comments