1 /**
2  * @file    clcd.h
3  * @brief   Color LCD function prototypes and data types.
4  */
5 
6 /******************************************************************************
7  *
8  * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
9  * Analog Devices, Inc.),
10  * Copyright (C) 2023-2024 Analog Devices, Inc.
11  *
12  * Licensed under the Apache License, Version 2.0 (the "License");
13  * you may not use this file except in compliance with the License.
14  * You may obtain a copy of the License at
15  *
16  *     http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  *
24  ******************************************************************************/
25 
26 /* Define to prevent redundant inclusion */
27 #ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32650_CLCD_H_
28 #define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32650_CLCD_H_
29 
30 /* **** Includes **** */
31 #include "clcd_regs.h"
32 #include "mxc_sys.h"
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 /**
39  * @defgroup clcd Color LCD (CLCD)
40  * @ingroup periphlibs
41  * @{
42  */
43 
44 /* **** Definitions **** */
45 
46 /**
47  * Enumeration type for setting the number Bits per Pixel for the LCD screen
48  */
49 typedef enum {
50     MXC_BPP1 = MXC_S_CLCD_CTRL_BPP_BPP1, /**< 1 Bits per Pixel.                       */
51     MXC_BPP2 = MXC_S_CLCD_CTRL_BPP_BPP2, /**< 2 Bits per Pixel.                       */
52     MXC_BPP4 = MXC_S_CLCD_CTRL_BPP_BPP4, /**< 4 Bits per Pixel.                       */
53     MXC_BPP8 = MXC_S_CLCD_CTRL_BPP_BPP8, /**< 8 Bits per Pixel.                       */
54     MXC_BPP16 = MXC_S_CLCD_CTRL_BPP_BPP16, /**< 16 Bits per Pixel.                      */
55     MXC_BPP24 = MXC_S_CLCD_CTRL_BPP_BPP24, /**< 24 Bits per Pixel.                      */
56 } mxc_clcd_bpp_t;
57 
58 /**
59  * Structure type for configuring the CLCD peripheral.
60  */
61 typedef struct mxc_clcd_cfg {
62     uint32_t width;
63     uint32_t height;
64     uint32_t frequency;
65     uint32_t vfrontporch;
66     uint32_t vbackporch;
67     uint32_t vsyncwidth;
68     uint32_t hfrontporch;
69     uint32_t hbackporch;
70     uint32_t hsyncwidth;
71     uint32_t *palette;
72     uint32_t paletteSize;
73     mxc_clcd_bpp_t bpp;
74 } mxc_clcd_cfg_t;
75 
76 /* **** Function Prototypes **** */
77 
78 /**
79  * @brief Initialize the clcd.
80  * @param      cfg The clcd configuration
81  * @return #E_NO_ERROR if successful, appropriate error otherwise
82  */
83 int MXC_CLCD_Init(mxc_clcd_cfg_t *cfg);
84 
85 /**
86  * @brief      Shutdown CLCD module.
87  * @return     #E_NO_ERROR if successful, appropriate error otherwise
88  */
89 int MXC_CLCD_Shutdown(void);
90 
91 /**
92  * @brief Configure CLCD frame module.
93  * @param      cfg The clcd configuration
94  * @return #E_NO_ERROR if successful, appropriate error otherwise
95  */
96 int MXC_CLCD_ConfigPanel(mxc_clcd_cfg_t *cfg);
97 
98 /**
99  * @brief      Enable CLCD  module.
100  * @return     #E_NO_ERROR if successful, appropriate error otherwise
101  */
102 int MXC_CLCD_Enable(void);
103 
104 /**
105  * @brief      Disable CLCD  module.
106  * @return     #E_NO_ERROR if successful, appropriate error otherwise
107  */
108 int MXC_CLCD_Disable(void);
109 
110 /**
111  * @brief Set CLCD frame module.
112  * @param      addr The frame address
113  * @return #E_NO_ERROR if successful, appropriate error otherwise
114  */
115 int MXC_CLCD_SetFrameAddr(void *addr);
116 
117 /**@} end of group clcd */
118 
119 #ifdef __cplusplus
120 }
121 #endif
122 
123 #endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32650_CLCD_H_
124