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