LED_LCD

Committer:
bcostm
Date:
Thu Dec 17 10:26:56 2015 +0000
Revision:
0:dc55a068bc1a
Initial release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 0:dc55a068bc1a 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
bcostm 0:dc55a068bc1a 2 *
bcostm 0:dc55a068bc1a 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
bcostm 0:dc55a068bc1a 4 * and associated documentation files (the "Software"), to deal in the Software without
bcostm 0:dc55a068bc1a 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
bcostm 0:dc55a068bc1a 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
bcostm 0:dc55a068bc1a 7 * Software is furnished to do so, subject to the following conditions:
bcostm 0:dc55a068bc1a 8 *
bcostm 0:dc55a068bc1a 9 * The above copyright notice and this permission notice shall be included in all copies or
bcostm 0:dc55a068bc1a 10 * substantial portions of the Software.
bcostm 0:dc55a068bc1a 11 *
bcostm 0:dc55a068bc1a 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
bcostm 0:dc55a068bc1a 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
bcostm 0:dc55a068bc1a 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
bcostm 0:dc55a068bc1a 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
bcostm 0:dc55a068bc1a 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
bcostm 0:dc55a068bc1a 17 */
bcostm 0:dc55a068bc1a 18
bcostm 0:dc55a068bc1a 19 #include "LCD_DISCO_F429ZI.h"
bcostm 0:dc55a068bc1a 20
bcostm 0:dc55a068bc1a 21 #define LCD_FRAME_BUFFER_LAYER0 (LCD_FRAME_BUFFER+0x130000)
bcostm 0:dc55a068bc1a 22 #define LCD_FRAME_BUFFER_LAYER1 LCD_FRAME_BUFFER
bcostm 0:dc55a068bc1a 23 #define CONVERTED_FRAME_BUFFER (LCD_FRAME_BUFFER+0x260000)
bcostm 0:dc55a068bc1a 24
bcostm 0:dc55a068bc1a 25 // Constructor
bcostm 0:dc55a068bc1a 26 LCD_DISCO_F429ZI::LCD_DISCO_F429ZI()
bcostm 0:dc55a068bc1a 27 {
bcostm 0:dc55a068bc1a 28 BSP_LCD_Init();
bcostm 0:dc55a068bc1a 29 BSP_LCD_LayerDefaultInit(1, LCD_FRAME_BUFFER_LAYER1);
bcostm 0:dc55a068bc1a 30 BSP_LCD_SelectLayer(1);
bcostm 0:dc55a068bc1a 31 BSP_LCD_Clear(LCD_COLOR_WHITE);
bcostm 0:dc55a068bc1a 32 BSP_LCD_SetColorKeying(1, LCD_COLOR_WHITE);
bcostm 0:dc55a068bc1a 33 BSP_LCD_SetLayerVisible(1, DISABLE);
bcostm 0:dc55a068bc1a 34 BSP_LCD_LayerDefaultInit(0, LCD_FRAME_BUFFER_LAYER0);
bcostm 0:dc55a068bc1a 35 BSP_LCD_SelectLayer(0);
bcostm 0:dc55a068bc1a 36 BSP_LCD_SetFont(&Font16);
bcostm 0:dc55a068bc1a 37 BSP_LCD_DisplayOn();
bcostm 0:dc55a068bc1a 38 BSP_LCD_Clear(LCD_COLOR_WHITE);
bcostm 0:dc55a068bc1a 39 }
bcostm 0:dc55a068bc1a 40
bcostm 0:dc55a068bc1a 41 // Destructor
bcostm 0:dc55a068bc1a 42 LCD_DISCO_F429ZI::~LCD_DISCO_F429ZI()
bcostm 0:dc55a068bc1a 43 {
bcostm 0:dc55a068bc1a 44
bcostm 0:dc55a068bc1a 45 }
bcostm 0:dc55a068bc1a 46
bcostm 0:dc55a068bc1a 47 //=================================================================================================================
bcostm 0:dc55a068bc1a 48 // Public methods
bcostm 0:dc55a068bc1a 49 //=================================================================================================================
bcostm 0:dc55a068bc1a 50
bcostm 0:dc55a068bc1a 51 uint8_t LCD_DISCO_F429ZI::Init(void)
bcostm 0:dc55a068bc1a 52 {
bcostm 0:dc55a068bc1a 53 return BSP_LCD_Init();
bcostm 0:dc55a068bc1a 54 }
bcostm 0:dc55a068bc1a 55
bcostm 0:dc55a068bc1a 56 uint32_t LCD_DISCO_F429ZI::GetXSize(void)
bcostm 0:dc55a068bc1a 57 {
bcostm 0:dc55a068bc1a 58 return BSP_LCD_GetXSize();
bcostm 0:dc55a068bc1a 59 }
bcostm 0:dc55a068bc1a 60
bcostm 0:dc55a068bc1a 61 uint32_t LCD_DISCO_F429ZI::GetYSize(void)
bcostm 0:dc55a068bc1a 62 {
bcostm 0:dc55a068bc1a 63 return BSP_LCD_GetYSize();
bcostm 0:dc55a068bc1a 64 }
bcostm 0:dc55a068bc1a 65
bcostm 0:dc55a068bc1a 66 void LCD_DISCO_F429ZI::LayerDefaultInit(uint16_t LayerIndex, uint32_t FB_Address)
bcostm 0:dc55a068bc1a 67 {
bcostm 0:dc55a068bc1a 68 BSP_LCD_LayerDefaultInit(LayerIndex, FB_Address);
bcostm 0:dc55a068bc1a 69 }
bcostm 0:dc55a068bc1a 70
bcostm 0:dc55a068bc1a 71 void LCD_DISCO_F429ZI::SelectLayer(uint32_t LayerIndex)
bcostm 0:dc55a068bc1a 72 {
bcostm 0:dc55a068bc1a 73 BSP_LCD_SelectLayer(LayerIndex);
bcostm 0:dc55a068bc1a 74 }
bcostm 0:dc55a068bc1a 75
bcostm 0:dc55a068bc1a 76 void LCD_DISCO_F429ZI::SetLayerVisible(uint32_t LayerIndex, FunctionalState state)
bcostm 0:dc55a068bc1a 77 {
bcostm 0:dc55a068bc1a 78 BSP_LCD_SetLayerVisible(LayerIndex, state);
bcostm 0:dc55a068bc1a 79 }
bcostm 0:dc55a068bc1a 80
bcostm 0:dc55a068bc1a 81 void LCD_DISCO_F429ZI::SetTransparency(uint32_t LayerIndex, uint8_t Transparency)
bcostm 0:dc55a068bc1a 82 {
bcostm 0:dc55a068bc1a 83 BSP_LCD_SetTransparency(LayerIndex, Transparency);
bcostm 0:dc55a068bc1a 84 }
bcostm 0:dc55a068bc1a 85
bcostm 0:dc55a068bc1a 86 void LCD_DISCO_F429ZI::SetLayerAddress(uint32_t LayerIndex, uint32_t Address)
bcostm 0:dc55a068bc1a 87 {
bcostm 0:dc55a068bc1a 88 BSP_LCD_SetLayerAddress(LayerIndex, Address);
bcostm 0:dc55a068bc1a 89 }
bcostm 0:dc55a068bc1a 90
bcostm 0:dc55a068bc1a 91 void LCD_DISCO_F429ZI::SetLayerWindow(uint16_t LayerIndex, uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
bcostm 0:dc55a068bc1a 92 {
bcostm 0:dc55a068bc1a 93 BSP_LCD_SetLayerWindow(LayerIndex, Xpos, Ypos, Width, Height);
bcostm 0:dc55a068bc1a 94 }
bcostm 0:dc55a068bc1a 95
bcostm 0:dc55a068bc1a 96 void LCD_DISCO_F429ZI::SetColorKeying(uint32_t LayerIndex, uint32_t RGBValue)
bcostm 0:dc55a068bc1a 97 {
bcostm 0:dc55a068bc1a 98 BSP_LCD_SetColorKeying(LayerIndex, RGBValue);
bcostm 0:dc55a068bc1a 99 }
bcostm 0:dc55a068bc1a 100
bcostm 0:dc55a068bc1a 101 void LCD_DISCO_F429ZI::ResetColorKeying(uint32_t LayerIndex)
bcostm 0:dc55a068bc1a 102 {
bcostm 0:dc55a068bc1a 103 BSP_LCD_ResetColorKeying(LayerIndex);
bcostm 0:dc55a068bc1a 104 }
bcostm 0:dc55a068bc1a 105
bcostm 0:dc55a068bc1a 106 uint32_t LCD_DISCO_F429ZI::GetTextColor(void)
bcostm 0:dc55a068bc1a 107 {
bcostm 0:dc55a068bc1a 108 return BSP_LCD_GetTextColor();
bcostm 0:dc55a068bc1a 109 }
bcostm 0:dc55a068bc1a 110
bcostm 0:dc55a068bc1a 111 uint32_t LCD_DISCO_F429ZI::GetBackColor(void)
bcostm 0:dc55a068bc1a 112 {
bcostm 0:dc55a068bc1a 113 return BSP_LCD_GetBackColor();
bcostm 0:dc55a068bc1a 114 }
bcostm 0:dc55a068bc1a 115
bcostm 0:dc55a068bc1a 116 void LCD_DISCO_F429ZI::SetTextColor(uint32_t Color)
bcostm 0:dc55a068bc1a 117 {
bcostm 0:dc55a068bc1a 118 BSP_LCD_SetTextColor(Color);
bcostm 0:dc55a068bc1a 119 }
bcostm 0:dc55a068bc1a 120
bcostm 0:dc55a068bc1a 121 void LCD_DISCO_F429ZI::SetBackColor(uint32_t Color)
bcostm 0:dc55a068bc1a 122 {
bcostm 0:dc55a068bc1a 123 BSP_LCD_SetBackColor(Color);
bcostm 0:dc55a068bc1a 124 }
bcostm 0:dc55a068bc1a 125
bcostm 0:dc55a068bc1a 126 void LCD_DISCO_F429ZI::SetFont(sFONT *pFonts)
bcostm 0:dc55a068bc1a 127 {
bcostm 0:dc55a068bc1a 128 BSP_LCD_SetFont(pFonts);
bcostm 0:dc55a068bc1a 129 }
bcostm 0:dc55a068bc1a 130
bcostm 0:dc55a068bc1a 131 sFONT *LCD_DISCO_F429ZI::GetFont(void)
bcostm 0:dc55a068bc1a 132 {
bcostm 0:dc55a068bc1a 133 return BSP_LCD_GetFont();
bcostm 0:dc55a068bc1a 134 }
bcostm 0:dc55a068bc1a 135
bcostm 0:dc55a068bc1a 136 uint32_t LCD_DISCO_F429ZI::ReadPixel(uint16_t Xpos, uint16_t Ypos)
bcostm 0:dc55a068bc1a 137 {
bcostm 0:dc55a068bc1a 138 return BSP_LCD_ReadPixel(Xpos, Ypos);
bcostm 0:dc55a068bc1a 139 }
bcostm 0:dc55a068bc1a 140
bcostm 0:dc55a068bc1a 141 void LCD_DISCO_F429ZI::Clear(uint32_t Color)
bcostm 0:dc55a068bc1a 142 {
bcostm 0:dc55a068bc1a 143 BSP_LCD_Clear(Color);
bcostm 0:dc55a068bc1a 144 }
bcostm 0:dc55a068bc1a 145
bcostm 0:dc55a068bc1a 146 void LCD_DISCO_F429ZI::ClearStringLine(uint32_t Line)
bcostm 0:dc55a068bc1a 147 {
bcostm 0:dc55a068bc1a 148 BSP_LCD_ClearStringLine(Line);
bcostm 0:dc55a068bc1a 149 }
bcostm 0:dc55a068bc1a 150
bcostm 0:dc55a068bc1a 151 void LCD_DISCO_F429ZI::DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii)
bcostm 0:dc55a068bc1a 152 {
bcostm 0:dc55a068bc1a 153 BSP_LCD_DisplayChar(Xpos, Ypos, Ascii);
bcostm 0:dc55a068bc1a 154 }
bcostm 0:dc55a068bc1a 155
bcostm 0:dc55a068bc1a 156 void LCD_DISCO_F429ZI::DisplayStringAt(uint16_t X, uint16_t Y, uint8_t *pText, Text_AlignModeTypdef mode)
bcostm 0:dc55a068bc1a 157 {
bcostm 0:dc55a068bc1a 158 BSP_LCD_DisplayStringAt(X, Y, pText, mode);
bcostm 0:dc55a068bc1a 159 }
bcostm 0:dc55a068bc1a 160
bcostm 0:dc55a068bc1a 161 void LCD_DISCO_F429ZI::DisplayStringAtLine(uint16_t Line, uint8_t *ptr)
bcostm 0:dc55a068bc1a 162 {
bcostm 0:dc55a068bc1a 163 BSP_LCD_DisplayStringAtLine(Line, ptr);
bcostm 0:dc55a068bc1a 164 }
bcostm 0:dc55a068bc1a 165
bcostm 0:dc55a068bc1a 166 void LCD_DISCO_F429ZI::DrawHLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length)
bcostm 0:dc55a068bc1a 167 {
bcostm 0:dc55a068bc1a 168 BSP_LCD_DrawHLine(Xpos, Ypos, Length);
bcostm 0:dc55a068bc1a 169 }
bcostm 0:dc55a068bc1a 170
bcostm 0:dc55a068bc1a 171 void LCD_DISCO_F429ZI::DrawVLine(uint16_t Xpos, uint16_t Ypos, uint16_t Length)
bcostm 0:dc55a068bc1a 172 {
bcostm 0:dc55a068bc1a 173 BSP_LCD_DrawVLine(Xpos, Ypos, Length);
bcostm 0:dc55a068bc1a 174 }
bcostm 0:dc55a068bc1a 175
bcostm 0:dc55a068bc1a 176 void LCD_DISCO_F429ZI::DrawLine(uint16_t X1, uint16_t Y1, uint16_t X2, uint16_t Y2)
bcostm 0:dc55a068bc1a 177 {
bcostm 0:dc55a068bc1a 178 BSP_LCD_DrawLine(X1, Y1, X2, Y2);
bcostm 0:dc55a068bc1a 179 }
bcostm 0:dc55a068bc1a 180
bcostm 0:dc55a068bc1a 181 void LCD_DISCO_F429ZI::DrawRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
bcostm 0:dc55a068bc1a 182 {
bcostm 0:dc55a068bc1a 183 BSP_LCD_DrawRect(Xpos, Ypos, Width, Height);
bcostm 0:dc55a068bc1a 184 }
bcostm 0:dc55a068bc1a 185
bcostm 0:dc55a068bc1a 186 void LCD_DISCO_F429ZI::DrawCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius)
bcostm 0:dc55a068bc1a 187 {
bcostm 0:dc55a068bc1a 188 BSP_LCD_DrawCircle(Xpos, Ypos, Radius);
bcostm 0:dc55a068bc1a 189 }
bcostm 0:dc55a068bc1a 190
bcostm 0:dc55a068bc1a 191 void LCD_DISCO_F429ZI::DrawPolygon(pPoint Points, uint16_t PointCount)
bcostm 0:dc55a068bc1a 192 {
bcostm 0:dc55a068bc1a 193 BSP_LCD_DrawPolygon(Points, PointCount);
bcostm 0:dc55a068bc1a 194 }
bcostm 0:dc55a068bc1a 195
bcostm 0:dc55a068bc1a 196 void LCD_DISCO_F429ZI::DrawEllipse(int Xpos, int Ypos, int XRadius, int YRadius)
bcostm 0:dc55a068bc1a 197 {
bcostm 0:dc55a068bc1a 198 BSP_LCD_DrawEllipse(Xpos, Ypos, XRadius, YRadius);
bcostm 0:dc55a068bc1a 199 }
bcostm 0:dc55a068bc1a 200
bcostm 0:dc55a068bc1a 201 void LCD_DISCO_F429ZI::DrawBitmap(uint32_t X, uint32_t Y, uint8_t *pBmp)
bcostm 0:dc55a068bc1a 202 {
bcostm 0:dc55a068bc1a 203 BSP_LCD_DrawBitmap(X, Y, pBmp);
bcostm 0:dc55a068bc1a 204 }
bcostm 0:dc55a068bc1a 205
bcostm 0:dc55a068bc1a 206 void LCD_DISCO_F429ZI::FillRect(uint16_t Xpos, uint16_t Ypos, uint16_t Width, uint16_t Height)
bcostm 0:dc55a068bc1a 207 {
bcostm 0:dc55a068bc1a 208 BSP_LCD_FillRect(Xpos, Ypos, Width, Height);
bcostm 0:dc55a068bc1a 209 }
bcostm 0:dc55a068bc1a 210
bcostm 0:dc55a068bc1a 211 void LCD_DISCO_F429ZI::FillCircle(uint16_t Xpos, uint16_t Ypos, uint16_t Radius)
bcostm 0:dc55a068bc1a 212 {
bcostm 0:dc55a068bc1a 213 BSP_LCD_FillCircle(Xpos, Ypos, Radius);
bcostm 0:dc55a068bc1a 214 }
bcostm 0:dc55a068bc1a 215
bcostm 0:dc55a068bc1a 216 void LCD_DISCO_F429ZI::FillTriangle(uint16_t X1, uint16_t X2, uint16_t X3, uint16_t Y1, uint16_t Y2, uint16_t Y3)
bcostm 0:dc55a068bc1a 217 {
bcostm 0:dc55a068bc1a 218 BSP_LCD_FillTriangle(X1, X2, X3, Y1, Y2, Y3);
bcostm 0:dc55a068bc1a 219 }
bcostm 0:dc55a068bc1a 220
bcostm 0:dc55a068bc1a 221 void LCD_DISCO_F429ZI::FillPolygon(pPoint Points, uint16_t PointCount)
bcostm 0:dc55a068bc1a 222 {
bcostm 0:dc55a068bc1a 223 BSP_LCD_FillPolygon(Points, PointCount);
bcostm 0:dc55a068bc1a 224 }
bcostm 0:dc55a068bc1a 225
bcostm 0:dc55a068bc1a 226 void LCD_DISCO_F429ZI::FillEllipse(int Xpos, int Ypos, int XRadius, int YRadius)
bcostm 0:dc55a068bc1a 227 {
bcostm 0:dc55a068bc1a 228 BSP_LCD_FillEllipse(Xpos, Ypos, XRadius, YRadius);
bcostm 0:dc55a068bc1a 229 }
bcostm 0:dc55a068bc1a 230
bcostm 0:dc55a068bc1a 231 void LCD_DISCO_F429ZI::DisplayOn(void)
bcostm 0:dc55a068bc1a 232 {
bcostm 0:dc55a068bc1a 233 BSP_LCD_DisplayOn();
bcostm 0:dc55a068bc1a 234 }
bcostm 0:dc55a068bc1a 235
bcostm 0:dc55a068bc1a 236 void LCD_DISCO_F429ZI::DisplayOff(void)
bcostm 0:dc55a068bc1a 237 {
bcostm 0:dc55a068bc1a 238 BSP_LCD_DisplayOff();
bcostm 0:dc55a068bc1a 239 }
bcostm 0:dc55a068bc1a 240
bcostm 0:dc55a068bc1a 241 void LCD_DISCO_F429ZI::DrawPixel(uint16_t Xpos, uint16_t Ypos, uint32_t RGB_Code)
bcostm 0:dc55a068bc1a 242 {
bcostm 0:dc55a068bc1a 243 BSP_LCD_DrawPixel(Xpos, Ypos, RGB_Code);
bcostm 0:dc55a068bc1a 244 }
bcostm 0:dc55a068bc1a 245
bcostm 0:dc55a068bc1a 246 //=================================================================================================================
bcostm 0:dc55a068bc1a 247 // Private methods
bcostm 0:dc55a068bc1a 248 //=================================================================================================================