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