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