Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: SignalProcessLab DigitalSignalAlgorithm_Lab DigitalSignal_Lab
RK043FN48H.h
00001 // 00002 // RK043FN48H.h - Graphics commands for DISCO_F746NG display build on top of stm32746g driver. 00003 // 00004 00005 #pragma once 00006 00007 #include "Commons.h" 00008 #include "Display.h" 00009 #include "../BSP_DISCO_F746NG/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_lcd.h" 00010 00011 #define ALPHA_MASK 0x00FFFFFF 00012 00013 #define TITLE "Signal Process" 00014 #define XPOS_TITLE 10 00015 #define YPOS_TITLE 10 00016 /** 00017 * @brief Display layers available for RK043FN48H 00018 */ 00019 typedef enum ELayer { 00020 Background = 0, // Bottom 00021 Foreground = 1 // Upper 00022 } Layer; 00023 00024 /** 00025 * @brief DISCO_F746NG display 00026 */ 00027 class RK043FN48H : public Display 00028 { 00029 public: 00030 RK043FN48H(); 00031 ~RK043FN48H(); 00032 00033 /** 00034 * @brief Clear the active layer using background color. 00035 * @retval None 00036 */ 00037 void Clear(); 00038 00039 /** 00040 * @brief Clear the active layer using given color. 00041 * @retval None 00042 */ 00043 void Clear(uint32_t color); 00044 00045 /** 00046 * @brief Clear selected layer using given color. 00047 * @retval None 00048 */ 00049 void ClearLayer(Layer layer, uint32_t color); 00050 00051 /** 00052 * @brief Set background color for active layer. 00053 * @retval None 00054 */ 00055 void SetBackgroundColor(uint32_t color); 00056 00057 /** 00058 * @brief Set foreground color for active layer. 00059 * @retval None 00060 */ 00061 void SetForegroundColor(uint32_t color); 00062 00063 /// <summary> 00064 /// Sets the color of the draw. 00065 /// </summary> 00066 /// <param name="red">The red.</param> 00067 /// <param name="green">The green.</param> 00068 /// <param name="blue">The blue.</param> 00069 /// <param name="alpha">The alpha.</param> 00070 void virtual SetDrawColor(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha); 00071 00072 /// <summary> 00073 /// Returns the color to draw on selected layer. 00074 /// </summary> 00075 uint32_t virtual GetDrawColor(); 00076 00077 /// <summary> 00078 /// Draws the point. 00079 /// </summary> 00080 /// <param name="posX">The position x.</param> 00081 /// <param name="posY">The position y.</param> 00082 /// <param name="colorMask">The color mask.</param> 00083 void virtual DrawPoint(int posX, int posY, uint32_t colorMask); 00084 00085 //void virtual DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); 00086 00087 //void virtual FillRectangle(uint16_t posX, uint16_t posY, uint16_t x2, uint16_t y2); 00088 00089 void CopyBitmap(Layer layer, uint8_t *bitmap, uint32_t width, uint32_t height, uint32_t rgbGolorCode); 00090 00091 /// <summary> 00092 /// Returns screen width. 00093 /// </summary> 00094 /// <returns></returns> 00095 uint16_t virtual DisplayWidth(); 00096 00097 /// <summary> 00098 /// Returns screen height. 00099 /// </summary> 00100 /// <returns></returns> 00101 uint16_t virtual DisplayHeight(); 00102 00103 void SetActiveLayer(Layer layer); 00104 00105 Layer GetActiveLayer(); 00106 00107 void SetLayersTransparency( uint8_t background, uint8_t foreground); 00108 00109 void SetLayersVisibility( bool background, bool foreground); 00110 00111 00112 //New Function 00113 //Add date: 25/08/2019 00114 00115 00116 /** 00117 * @brief Draws an horizontal line. 00118 * @param Xpos: X position 00119 * @param Ypos: Y position 00120 * @param Length: Line length 00121 * @retval None 00122 */ 00123 void DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length); 00124 00125 /** 00126 * @brief Draws a vertical line. 00127 * @param Xpos: X position 00128 * @param Ypos: Y position 00129 * @param Length: Line length 00130 * @retval None 00131 */ 00132 void DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length); 00133 00134 /** 00135 * @brief Draws an uni-line (between two points);. 00136 * @param x1: Point 1 X position 00137 * @param y1: Point 1 Y position 00138 * @param x2: Point 2 X position 00139 * @param y2: Point 2 Y position 00140 * @retval None 00141 */ 00142 void DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); 00143 00144 /** 00145 * @brief Draws a rectangle. 00146 * @param Xpos: X position 00147 * @param Ypos: Y position 00148 * @param Width: Rectangle width 00149 * @param Height: Rectangle height 00150 * @retval None 00151 */ 00152 void DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height); 00153 00154 /** 00155 * @brief Draws a circle. 00156 * @param Xpos: X position 00157 * @param Ypos: Y position 00158 * @param Radius: Circle radius 00159 * @retval None 00160 */ 00161 void DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius); 00162 00163 /** 00164 * @brief Draws an poly-line (between many points);. 00165 * @param Points: Pointer to the points array 00166 * @param PointCount: Number of points 00167 * @retval None 00168 */ 00169 void DrawPolygon(pPoint Points, uint16_t PointCount); 00170 00171 /** 00172 * @brief Draws an ellipse on LCD. 00173 * @param Xpos: X position 00174 * @param Ypos: Y position 00175 * @param XRadius: Ellipse X radius 00176 * @param YRadius: Ellipse Y radius 00177 * @retval None 00178 */ 00179 void DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius); 00180 00181 /** 00182 * @brief Draws a pixel on LCD. 00183 * @param Xpos: X position 00184 * @param Ypos: Y position 00185 * @param RGB_Code: Pixel color in ARGB mode (8-8-8-8); 00186 * @retval None 00187 */ 00188 void DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t RGB_Code); 00189 00190 /** 00191 * @brief Draws a bitmap picture loaded in the internal Flash in ARGB888 format (32 bits per pixel);. 00192 * @param Xpos: Bmp X position in the LCD 00193 * @param Ypos: Bmp Y position in the LCD 00194 * @param pbmp: Pointer to Bmp picture address in the internal Flash 00195 * @retval None 00196 */ 00197 void DrawBitmap(uint32_t Xpos, uint32_t Ypos, uint8_t *pbmp); 00198 00199 00200 /** 00201 * @brief Draws a full rectangle. 00202 * @param Xpos: X position 00203 * @param Ypos: Y position 00204 * @param Width: Rectangle width 00205 * @param Height: Rectangle height 00206 * @retval None 00207 */ 00208 void FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height); 00209 /** 00210 * @brief Draws a full circle. 00211 * @param Xpos: X position 00212 * @param Ypos: Y position 00213 * @param Radius: Circle radius 00214 * @retval None 00215 */ 00216 void FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius); 00217 00218 /** 00219 * @brief Draws a full poly-line (between many points);. 00220 * @param Points: Pointer to the points array 00221 * @param PointCount: Number of points 00222 * @retval None 00223 */ 00224 void FillPolygon(pPoint Points, uint16_t PointCount); 00225 00226 /** 00227 * @brief Draws a full ellipse. 00228 * @param Xpos: X position 00229 * @param Ypos: Y position 00230 * @param XRadius: Ellipse X radius 00231 * @param YRadius: Ellipse Y radius 00232 * @retval None 00233 */ 00234 void FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius); 00235 00236 00237 //Add LCD String Display 00238 /** 00239 * @brief Sets the LCD text color. 00240 * @param Color: Text color code ARGB(8-8-8-8); 00241 * @retval None 00242 */ 00243 void SetTextColor(uint32_t Color); 00244 00245 /** 00246 * @brief Gets the LCD text color. 00247 * @retval Used text color. 00248 */ 00249 uint32_t GetTextColor(void); 00250 00251 /** 00252 * @brief Sets the LCD background color. 00253 * @param Color: Layer background color code ARGB(8-8-8-8); 00254 * @retval None 00255 */ 00256 void SetBackColor(uint32_t Color); 00257 00258 /** 00259 * @brief Gets the LCD background color. 00260 * @retval Used background colour 00261 */ 00262 uint32_t GetBackColor(void); 00263 00264 /** 00265 * @brief Sets the LCD text font. 00266 * @param fonts: Layer font to be used 00267 * @retval None 00268 */ 00269 void SetFont(sFONT *fonts); 00270 00271 /** 00272 * @brief Gets the LCD text font. 00273 * @retval Used layer font 00274 */ 00275 sFONT *GetFont(void); 00276 00277 /** 00278 * @brief Reads an LCD pixel. 00279 * @param Xpos: X position 00280 * @param Ypos: Y position 00281 * @retval RGB pixel color 00282 */ 00283 uint32_t ReadPixel(uint16_t Xpos, uint16_t Ypos); 00284 00285 /** 00286 * @brief Clears the selected line. 00287 * @param Line: Line to be cleared 00288 * @retval None 00289 */ 00290 void ClearStringLine(uint32_t Line); 00291 00292 /** 00293 * @brief Displays one character. 00294 * @param Xpos: Start column address 00295 * @param Ypos: Line where to display the character shape. 00296 * @param Ascii: Character ascii code 00297 * This parameter must be a number between Min_Data = 0x20 and Max_Data = 0x7E 00298 * @retval None 00299 */ 00300 void DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii); 00301 00302 /** 00303 * @brief Displays characters on the LCD. 00304 * @param Xpos: X position (in pixel); 00305 * @param Ypos: Y position (in pixel); 00306 * @param Text: Pointer to string to display on LCD 00307 * @param Mode: Display mode 00308 * This parameter can be one of the following values: 00309 * @arg CENTER_MODE 00310 * @arg RIGHT_MODE 00311 * @arg LEFT_MODE 00312 * @retval None 00313 */ 00314 void DisplayStringAt(uint16_t Xpos, uint16_t Ypos, uint8_t *Text, Text_AlignModeTypdef Mode); 00315 00316 /** 00317 * @brief Displays a maximum of 60 characters on the LCD. 00318 * @param Line: Line where to display the character shape 00319 * @param ptr: Pointer to string to display on LCD 00320 * @retval None 00321 */ 00322 void DisplayStringAtLine(uint16_t Line, uint8_t *ptr); 00323 private: 00324 00325 // Frame buffer adresses for layers 00326 uint32_t FbForegroundStartAdress; 00327 uint32_t FbBackgroundStartAdress; 00328 00329 /** 00330 * @brief Mirror structure for drivers DropProp, 00331 * Contains selected font, background and foreground color 00332 */ 00333 LCD_DrawPropTypeDef actualDrawProp[MAX_LAYER_NUMBER]; 00334 00335 }; 00336
Generated on Sat Jul 23 2022 05:49:00 by
1.7.2