alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 1 | /* |
Richard Burton | f32a86a | 2022-11-15 11:46:11 +0000 | [diff] [blame^] | 2 | * SPDX-FileCopyrightText: Copyright 2021-2022 Arm Limited and/or its affiliates <open-source-office@arm.com> |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 3 | * SPDX-License-Identifier: Apache-2.0 |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | #ifndef LCD_IMG_H |
| 18 | #define LCD_IMG_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | #include <stddef.h> |
| 22 | #include <stdbool.h> |
| 23 | |
| 24 | /** |
| 25 | * @brief Initialise the LCD |
| 26 | * @return 0 if successful, error code otherwise. |
| 27 | **/ |
| 28 | int lcd_init(void); |
| 29 | |
| 30 | /** |
| 31 | * @brief Display a given image on the LCD. This allows displaying 8 bit |
| 32 | * single or multi-channel images on the LCD. |
| 33 | * @param[in] data Pointer to start of the image. |
| 34 | * @param[in] width Width of this image. |
| 35 | * @param[in] height Image height. |
| 36 | * @param[in] channels Number of channels. |
| 37 | * @param[in] pos_x Screen position x co-ordinate. |
| 38 | * @param[in] pos_y Screen position y co-ordinate. |
| 39 | * @param[in] downsample_factor Factor by which the image needs to be |
| 40 | * downsampled. |
| 41 | * @return 0 if successful, non-zero otherwise. |
| 42 | **/ |
Richard Burton | 9c54990 | 2022-02-15 16:39:18 +0000 | [diff] [blame] | 43 | int lcd_display_image(const uint8_t* data, const uint32_t width, |
alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 44 | const uint32_t height, const uint32_t channels, |
| 45 | const uint32_t pos_x, const uint32_t pos_y, |
| 46 | const uint32_t downsample_factor); |
| 47 | |
| 48 | /** |
| 49 | * @brief Display a given image on the LCD. This allows displaying 8 bit |
| 50 | * single or multi-channel images on the LCD. |
| 51 | * @param[in] str Pointer to a null terminated string. |
| 52 | * @param[in] str_sz Length of the string. |
| 53 | * @param[in] pos_x Screen position x co-ordinate. |
| 54 | * @param[in] pos_y Screen position y co-ordinate. |
| 55 | * @param[in] allow_multiple_lines The function will try and spread |
| 56 | * the string into multiple lines if |
| 57 | * they don't fit in one. |
| 58 | * @return 0 if successful, non-zero otherwise. |
| 59 | **/ |
| 60 | int lcd_display_text(const char* str, const size_t str_sz, |
| 61 | const uint32_t pos_x, const uint32_t pos_y, |
| 62 | const bool allow_multiple_lines); |
| 63 | |
| 64 | /** |
| 65 | * @brief Display a box with given color on LCD. |
| 66 | * @param[in] pos_x Screen position x co-ordinate. |
| 67 | * @param[in] pos_y Screen position y co-ordinate. |
| 68 | * @param[in] width Width. |
| 69 | * @param[in] height Height. |
| 70 | * @param[in] color Fill color. |
| 71 | * @return 0 if successful, non-zero otherwise. |
| 72 | **/ |
| 73 | int lcd_display_box(const uint32_t pos_x, const uint32_t pos_y, |
| 74 | const uint32_t width, const uint32_t height, const uint16_t color); |
| 75 | |
| 76 | /** |
| 77 | * @brief Clear LCD. |
| 78 | * @param[in] color Fill color. |
| 79 | * @return 0 if successful, non-zero otherwise. |
| 80 | **/ |
| 81 | int lcd_clear(const uint16_t color); |
| 82 | |
| 83 | /** |
| 84 | * @brief Set text color. |
| 85 | * @param[in] color Fill color. |
| 86 | * @return 0 if successful, non-zero otherwise. |
| 87 | **/ |
| 88 | int lcd_set_text_color(const uint16_t color); |
| 89 | |
| 90 | #endif /* LCD_IMG_H */ |