alexander | 3c79893 | 2021-03-26 21:42:19 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021 Arm Limited. All rights reserved. |
| 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 DATA_PSN_H |
| 18 | #define DATA_PSN_H |
| 19 | |
| 20 | /** |
| 21 | * This file is the top level abstraction for the data presentation module |
| 22 | **/ |
| 23 | #include <stdint.h> |
| 24 | #include <stddef.h> |
| 25 | #include <stdbool.h> |
| 26 | |
| 27 | /* Structure to encompass the data presentation module and it's methods */ |
| 28 | typedef struct data_presentation_module { |
| 29 | int inited; /**< initialised or not */ |
| 30 | char system_name[8]; /**< name of the system in use */ |
| 31 | int (* system_init)(void); /**< pointer to init function */ |
| 32 | |
| 33 | /** Pointer to the image presentation function */ |
| 34 | int (* present_data_image)(uint8_t *data, const uint32_t width, |
| 35 | const uint32_t height, const uint32_t channels, |
| 36 | const uint32_t pos_x, const uint32_t pos_y, |
| 37 | const uint32_t downsample_factor); |
| 38 | |
| 39 | /* Pointer to text presentation function */ |
| 40 | int (* present_data_text)(const char *str, const size_t str_sz, |
| 41 | const uint32_t pos_x, const uint32_t pos_y, |
| 42 | const bool allow_multiple_lines); |
| 43 | |
| 44 | /* Pointer to box presentation function */ |
| 45 | int (* present_box)(const uint32_t pos_x, const uint32_t pos_y, |
| 46 | const uint32_t width, const uint32_t height, const uint16_t color); |
| 47 | |
| 48 | /* Pointer to clear presentation function */ |
| 49 | int (* clear)(const uint16_t color); |
| 50 | |
| 51 | /* Pointer to set text color presentation function */ |
| 52 | int (* set_text_color)(const uint16_t color); |
| 53 | } data_psn_module; |
| 54 | |
| 55 | |
| 56 | /** |
| 57 | * @brief Initialises the data presentation system. |
| 58 | * @param[in,out] module Pointer to a pre-allocated data |
| 59 | * presentation structure object. |
| 60 | * @return 0 if successful, error code otherwise. |
| 61 | **/ |
| 62 | int data_psn_system_init(data_psn_module *module); |
| 63 | |
| 64 | /** |
| 65 | * @brief Releases the data presentation system. |
| 66 | * @param[in,out] module Pointer to a pre-allocated data |
| 67 | * presentation structure object. |
| 68 | * @return 0 if successful, error code otherwise. |
| 69 | **/ |
| 70 | int data_psn_system_release(data_psn_module *module); |
| 71 | |
| 72 | #endif /* DATA_PSN_H */ |