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: RadarDemo 3DDemo RadarDemoT
Diff: RK043FN48H.h
- Revision:
- 2:02b7b78e8510
- Parent:
- 0:566855d63a2f
--- a/RK043FN48H.h Sun Nov 06 02:13:11 2016 +0000
+++ b/RK043FN48H.h Thu Nov 10 15:34:43 2016 +0000
@@ -7,6 +7,7 @@
#include "Commons.h"
#include "Display.h"
#include "stm32746g_discovery_lcd.h"
+#include "GrFont.h"
#define ALPHA_MASK 0x00FFFFFF
@@ -31,7 +32,7 @@
* @brief Clear the active layer using background color.
* @retval None
*/
- void Clear();
+ void virtual Clear();
/**
* @brief Clear the active layer using given color.
@@ -44,7 +45,7 @@
* @retval None
*/
void ClearLayer(Layer layer, uint32_t color);
-
+
/**
* @brief Set background color for active layer.
* @retval None
@@ -56,7 +57,7 @@
* @retval None
*/
void SetForegroundColor(uint32_t color);
-
+
/// <summary>
/// Sets the color of the draw.
/// </summary>
@@ -65,12 +66,28 @@
/// <param name="blue">The blue.</param>
/// <param name="alpha">The alpha.</param>
void virtual SetDrawColor(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha);
-
+
+ /// <summary>
+ /// Gets the color of the draw.
+ /// </summary>
+ /// <returns>Draw color value</returns>
+ uint32_t virtual GetDrawColor();
+
/// <summary>
- /// Returns the color to draw on selected layer.
+ /// Sets the clear color.
/// </summary>
- uint32_t virtual GetDrawColor();
-
+ /// <param name="red">The red.</param>
+ /// <param name="green">The green.</param>
+ /// <param name="blue">The blue.</param>
+ /// <param name="alpha">The alpha.</param>
+ void virtual SetClearColor(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha);
+
+ /// <summary>
+ /// Gets the clear color.
+ /// </summary>
+ /// <returns>Clear color value</returns>
+ uint32_t virtual GetClearColor();
+
/// <summary>
/// Draws the point.
/// </summary>
@@ -78,7 +95,7 @@
/// <param name="posY">The position y.</param>
/// <param name="colorMask">The color mask.</param>
void virtual DrawPoint(int posX, int posY, uint32_t colorMask);
-
+
//void virtual DrawLine(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
//void virtual FillRectangle(uint16_t posX, uint16_t posY, uint16_t x2, uint16_t y2);
@@ -96,18 +113,57 @@
/// </summary>
/// <returns></returns>
uint16_t virtual DisplayHeight();
-
+
void SetActiveLayer(Layer layer);
-
+
Layer GetActiveLayer();
-
+
void SetLayersTransparency( uint8_t background, uint8_t foreground);
-
+
void SetLayersVisibility( bool background, bool foreground);
-
+
+//==============================================================================
+//
+// Text output
+//
+//==============================================================================
+
+ /**
+ * @brief Change current text cursor location for the given position on the screen.
+ * Remark - cursor is unvisible.
+ * @param x : X position
+ * @param y : Y position
+ * @retval None
+ */
+ void GotoXY(int x, int y);
+
+ /**
+ * @brief Put character on the screen using current font and cursor location.
+ * See also: gotoXY(x,y), SetFont(type), SetForegroundColor(c), SetBackgroundColor(c)
+ * @param ch: Character to print
+ * @retval None
+ */
+ void putch(char ch);
+
+ /**
+ * @brief Put string on the screen using current font and cursor location.
+ * See also: gotoXY(x,y), SetFont(type), SetForegroundColor(c), SetBackgroundColor(c)
+ * @param str: C string (char *) to print.
+ * @retval None
+ */
+ void puts(const char * str);
+
+ /**
+ * @brief Draw string on the screen at given position using current font.
+ * See also: SetFont(type), SetForegroundColor(c), SetBackgroundColor(c)
+ * @param str: C string (char *) to print.
+ * @retval None
+ */
+ void virtual DrawText(int posX, int posY, char * str);
+
private:
- // Frame buffer adresses for layers
+ // Frame buffer addresses for layers
uint32_t FbForegroundStartAdress;
uint32_t FbBackgroundStartAdress;
@@ -116,6 +172,24 @@
* Contains selected font, background and foreground color
*/
LCD_DrawPropTypeDef actualDrawProp[MAX_LAYER_NUMBER];
-
+
+ /**
+ * @brief Actual cursor text position for text output
+ */
+ Point _cursorPos[MAX_LAYER_NUMBER];
+
+ /**
+ * @brief Current fonts for layers
+ */
+ GrFont _selectedFont[MAX_LAYER_NUMBER];
+
+ /**
+ * @brief Internal method to move text coursor to the next line
+ * depending on font height. Font width is not used.
+ * @param w : Font width
+ * @param h : Font height
+ */
+ void gotoNewLine(int w, int h);
+
};