Added ability to use printf directly
Fork of LCD_DISCO_F429ZI by
Embed:
(wiki syntax)
Show/hide line numbers
LCD_DISCO_F429ZI.cpp
00001 /* Copyright (c) 2010-2011 mbed.org, MIT License 00002 * 00003 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software 00004 * and associated documentation files (the "Software"), to deal in the Software without 00005 * restriction, including without limitation the rights to use, copy, modify, merge, publish, 00006 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the 00007 * Software is furnished to do so, subject to the following conditions: 00008 * 00009 * The above copyright notice and this permission notice shall be included in all copies or 00010 * substantial portions of the Software. 00011 * 00012 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 00013 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00014 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 00015 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00016 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00017 */ 00018 00019 #include "LCD_DISCO_F429ZI.h" 00020 00021 #define LCD_FRAME_BUFFER_LAYER0 (LCD_FRAME_BUFFER+0x130000) 00022 #define LCD_FRAME_BUFFER_LAYER1 LCD_FRAME_BUFFER 00023 #define CONVERTED_FRAME_BUFFER (LCD_FRAME_BUFFER+0x260000) 00024 00025 // Constructor 00026 LCD_DISCO_F429ZI::LCD_DISCO_F429ZI() 00027 { 00028 BSP_LCD_Init(); 00029 BSP_LCD_LayerDefaultInit(1, LCD_FRAME_BUFFER_LAYER1); 00030 BSP_LCD_SelectLayer(1); 00031 BSP_LCD_Clear(LCD_COLOR_WHITE); 00032 BSP_LCD_SetColorKeying(1, LCD_COLOR_WHITE); 00033 BSP_LCD_SetLayerVisible(1, DISABLE); 00034 BSP_LCD_LayerDefaultInit(0, LCD_FRAME_BUFFER_LAYER0); 00035 BSP_LCD_SelectLayer(0); 00036 BSP_LCD_SetFont(&Font16); 00037 BSP_LCD_DisplayOn(); 00038 BSP_LCD_Clear(LCD_COLOR_WHITE); 00039 } 00040 00041 // Destructor 00042 LCD_DISCO_F429ZI::~LCD_DISCO_F429ZI() 00043 { 00044 00045 } 00046 00047 //================================================================================================================= 00048 // Public methods 00049 //================================================================================================================= 00050 00051 uint8_t LCD_DISCO_F429ZI::Init(void) 00052 { 00053 return BSP_LCD_Init(); 00054 } 00055 00056 uint32_t LCD_DISCO_F429ZI::GetXSize(void) 00057 { 00058 return BSP_LCD_GetXSize(); 00059 } 00060 00061 uint32_t LCD_DISCO_F429ZI::GetYSize(void) 00062 { 00063 return BSP_LCD_GetYSize(); 00064 } 00065 00066 void LCD_DISCO_F429ZI::LayerDefaultInit(uint16_t LayerIndex, uint32_t FB_Address) 00067 { 00068 BSP_LCD_LayerDefaultInit(LayerIndex, FB_Address); 00069 } 00070 00071 void LCD_DISCO_F429ZI::SelectLayer(uint32_t LayerIndex) 00072 { 00073 BSP_LCD_SelectLayer(LayerIndex); 00074 } 00075 00076 void LCD_DISCO_F429ZI::SetLayerVisible(uint32_t LayerIndex, FunctionalState state) 00077 { 00078 BSP_LCD_SetLayerVisible(LayerIndex, state); 00079 } 00080 00081 void LCD_DISCO_F429ZI::SetTransparency(uint32_t LayerIndex, uint8_t Transparency) 00082 { 00083 BSP_LCD_SetTransparency(LayerIndex, Transparency); 00084 } 00085 00086 void LCD_DISCO_F429ZI::SetLayerAddress(uint32_t LayerIndex, uint32_t Address) 00087 { 00088 BSP_LCD_SetLayerAddress(LayerIndex, Address); 00089 } 00090 00091 void LCD_DISCO_F429ZI::SetLayerWindow(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) 00092 { 00093 BSP_LCD_SetLayerWindow(LayerIndex, Xpos, Ypos, Width, Height); 00094 } 00095 00096 void LCD_DISCO_F429ZI::SetColorKeying(uint32_t LayerIndex, uint32_t RGBValue) 00097 { 00098 BSP_LCD_SetColorKeying(LayerIndex, RGBValue); 00099 } 00100 00101 void LCD_DISCO_F429ZI::ResetColorKeying(uint32_t LayerIndex) 00102 { 00103 BSP_LCD_ResetColorKeying(LayerIndex); 00104 } 00105 00106 uint32_t LCD_DISCO_F429ZI::GetTextColor(void) 00107 { 00108 return BSP_LCD_GetTextColor(); 00109 } 00110 00111 uint32_t LCD_DISCO_F429ZI::GetBackColor(void) 00112 { 00113 return BSP_LCD_GetBackColor(); 00114 } 00115 00116 void LCD_DISCO_F429ZI::SetTextColor(uint32_t Color) 00117 { 00118 BSP_LCD_SetTextColor(Color); 00119 } 00120 00121 void LCD_DISCO_F429ZI::SetBackColor(uint32_t Color) 00122 { 00123 BSP_LCD_SetBackColor(Color); 00124 } 00125 00126 void LCD_DISCO_F429ZI::SetFont(sFONT *pFonts) 00127 { 00128 BSP_LCD_SetFont(pFonts); 00129 } 00130 00131 sFONT *LCD_DISCO_F429ZI::GetFont(void) 00132 { 00133 return BSP_LCD_GetFont(); 00134 } 00135 00136 uint32_t LCD_DISCO_F429ZI::ReadPixel(uint16_t Xpos, uint16_t Ypos) 00137 { 00138 return BSP_LCD_ReadPixel(Xpos, Ypos); 00139 } 00140 00141 void LCD_DISCO_F429ZI::Clear(uint32_t Color) 00142 { 00143 BSP_LCD_Clear(Color); 00144 cursorX = 0; 00145 cursorY = 0; 00146 } 00147 00148 void LCD_DISCO_F429ZI::ClearStringLine(uint32_t Line) 00149 { 00150 BSP_LCD_ClearStringLine(Line); 00151 } 00152 00153 void LCD_DISCO_F429ZI::DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii) 00154 { 00155 BSP_LCD_DisplayChar(Xpos, Ypos, Ascii); 00156 } 00157 00158 void LCD_DISCO_F429ZI::Cursor(uint16_t Xpos, uint16_t Ypos) 00159 { 00160 cursorX = Xpos; 00161 cursorY = Ypos; 00162 } 00163 00164 void LCD_DISCO_F429ZI::DisplayStringAt(uint16_t X, uint16_t Y, uint8_t *pText, Text_AlignModeTypdef mode) 00165 { 00166 BSP_LCD_DisplayStringAt(X, Y, pText, mode); 00167 } 00168 00169 void LCD_DISCO_F429ZI::DisplayStringAtLine(uint16_t Line, uint8_t *ptr) 00170 { 00171 BSP_LCD_DisplayStringAtLine(Line, ptr); 00172 } 00173 00174 void LCD_DISCO_F429ZI::DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length) 00175 { 00176 BSP_LCD_DrawHLine(Xpos, Ypos, Length); 00177 } 00178 00179 void LCD_DISCO_F429ZI::DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length) 00180 { 00181 BSP_LCD_DrawVLine(Xpos, Ypos, Length); 00182 } 00183 00184 void LCD_DISCO_F429ZI::DrawLine(uint16_t X1, uint16_t Y1, uint16_t X2, uint16_t Y2) 00185 { 00186 BSP_LCD_DrawLine(X1, Y1, X2, Y2); 00187 } 00188 00189 void LCD_DISCO_F429ZI::DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) 00190 { 00191 BSP_LCD_DrawRect(Xpos, Ypos, Width, Height); 00192 } 00193 00194 void LCD_DISCO_F429ZI::DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius) 00195 { 00196 BSP_LCD_DrawCircle(Xpos, Ypos, Radius); 00197 } 00198 00199 void LCD_DISCO_F429ZI::DrawPolygon(pPoint Points, uint16_t PointCount) 00200 { 00201 BSP_LCD_DrawPolygon(Points, PointCount); 00202 } 00203 00204 void LCD_DISCO_F429ZI::DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius) 00205 { 00206 BSP_LCD_DrawEllipse(Xpos, Ypos, XRadius, YRadius); 00207 } 00208 00209 void LCD_DISCO_F429ZI::DrawBitmap(uint32_t X, uint32_t Y, uint8_t *pBmp) 00210 { 00211 BSP_LCD_DrawBitmap(X, Y, pBmp); 00212 } 00213 00214 void LCD_DISCO_F429ZI::FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height) 00215 { 00216 BSP_LCD_FillRect(Xpos, Ypos, Width, Height); 00217 } 00218 00219 void LCD_DISCO_F429ZI::FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius) 00220 { 00221 BSP_LCD_FillCircle(Xpos, Ypos, Radius); 00222 } 00223 00224 void LCD_DISCO_F429ZI::FillTriangle(uint16_t X1, uint16_t X2, uint16_t X3, uint16_t Y1, uint16_t Y2, uint16_t Y3) 00225 { 00226 BSP_LCD_FillTriangle(X1, X2, X3, Y1, Y2, Y3); 00227 } 00228 00229 void LCD_DISCO_F429ZI::FillPolygon(pPoint Points, uint16_t PointCount) 00230 { 00231 BSP_LCD_FillPolygon(Points, PointCount); 00232 } 00233 00234 void LCD_DISCO_F429ZI::FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius) 00235 { 00236 BSP_LCD_FillEllipse(Xpos, Ypos, XRadius, YRadius); 00237 } 00238 00239 void LCD_DISCO_F429ZI::DisplayOn(void) 00240 { 00241 BSP_LCD_DisplayOn(); 00242 } 00243 00244 void LCD_DISCO_F429ZI::DisplayOff(void) 00245 { 00246 BSP_LCD_DisplayOff(); 00247 } 00248 00249 void LCD_DISCO_F429ZI::DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t RGB_Code) 00250 { 00251 BSP_LCD_DrawPixel(Xpos, Ypos, RGB_Code); 00252 } 00253 00254 //================================================================================================================= 00255 // Private methods 00256 //=================================================================================================================
Generated on Fri Jul 22 2022 18:00:16 by 1.7.2