bsp disco lib
Dependents: grove_stream_jpa_sd2 grove_stream_jpa_sd2 grove_stream_jpa_sd2-2 grove_stream_jpa_sd2-3
Diff: Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_lcd.c
- Revision:
- 14:ed51426706bd
- Parent:
- 6:e1d9da7fe856
--- a/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_lcd.c Thu Nov 10 10:05:52 2016 +0100 +++ b/Drivers/BSP/STM32746G-Discovery/stm32746g_discovery_lcd.c Mon Aug 31 17:51:44 2020 +0000 @@ -130,6 +130,9 @@ * @{ */ static void DrawChar(uint16_t Xpos, uint16_t Ypos, const uint8_t *c); + +static void DrawCharJPA(uint16_t Xpos, uint16_t Ypos, const uint8_t *c); + static void FillTriangle(uint16_t x1, uint16_t x2, uint16_t x3, uint16_t y1, uint16_t y2, uint16_t y3); static void LL_FillBuffer(uint32_t LayerIndex, void *pDst, uint32_t xSize, uint32_t ySize, uint32_t OffLine, uint32_t ColorIndex); static void LL_ConvertLineToARGB8888(void * pSrc, void *pDst, uint32_t xSize, uint32_t ColorMode); @@ -657,10 +660,22 @@ */ void BSP_LCD_DisplayChar(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii) { - DrawChar(Xpos, Ypos, &DrawProp[ActiveLayer].pFont->table[(Ascii-' ') *\ - DrawProp[ActiveLayer].pFont->Height * ((DrawProp[ActiveLayer].pFont->Width + 7) / 8)]); + if (DrawProp[ActiveLayer].pFont->Width < 18) + { + DrawChar(Xpos, Ypos, &DrawProp[ActiveLayer].pFont->table[(Ascii-' ') *\ + DrawProp[ActiveLayer].pFont->Height * ((DrawProp[ActiveLayer].pFont->Width + 7) / 8)]); + } + else + { + BSP_LCD_DisplayCharJPA(Xpos,Ypos,Ascii); + } } +void BSP_LCD_DisplayCharJPA(uint16_t Xpos, uint16_t Ypos, uint8_t Ascii) +{ + DrawCharJPA(Xpos , Ypos, &DrawProp[ActiveLayer].pFont->table[(Ascii-' ') *\ + DrawProp[ActiveLayer].pFont->Height * ((DrawProp[ActiveLayer].pFont->Width + 7) / 8)]); +} /** * @brief Displays characters on the LCD. * @param Xpos: X position (in pixel) @@ -1476,6 +1491,62 @@ } } + +static void DrawCharJPA(uint16_t Xpos, uint16_t Ypos, const uint8_t *c) +{ + uint32_t i = 0, j = 0; + uint16_t height, width; + uint8_t offset; + uint8_t *pchar; + uint64_t line; + + height = DrawProp[ActiveLayer].pFont->Height; + width = DrawProp[ActiveLayer].pFont->Width; + + offset = 8 *((width + 7)/8) - width ; + + for(i = 0; i < height; i++) + { + pchar = ((uint8_t *)c + (width + 7)/8 * i); + + switch(((width + 7)/8)) + { + + case 1: + line = pchar[0]; + break; + + case 2: + line = (pchar[0]<< 8) | pchar[1]; + break; + + case 3: + line = (pchar[0]<< 16) | (pchar[1]<< 8) | pchar[2]; + break; + + default: + //line = (pchar[0]<< 16) | (pchar[1]<< 8) | pchar[2]; + line = ((uint64_t)pchar[0]<< 40) | ((uint64_t)pchar[1]<< 32) | ((uint64_t)pchar[2]<< 24) | ((uint64_t)pchar[3]<< 16) | ((uint64_t)pchar[4]<< 8) | (uint64_t)pchar[5]; + break; + } + //line = ((uint64_t)pchar[0]<< 40) | ((uint64_t)pchar[1]<< 32) | ((uint64_t)pchar[2]<< 24) | ((uint64_t)pchar[3]<< 16) | ((uint64_t)pchar[4]<< 8) | (uint64_t)pchar[5]; + + + for (j = 0; j < (width ); j++) + { + if(line & ((uint64_t)1 << (width - j + offset - 1))) + { + BSP_LCD_DrawPixel((Xpos + j ), Ypos, DrawProp[ActiveLayer].TextColor); + } + else + { + BSP_LCD_DrawPixel((Xpos + j), Ypos, DrawProp[ActiveLayer].BackColor); + } + } + Ypos++; + } +} + /** * @brief Fills a triangle (between 3 points). * @param x1: Point 1 X position @@ -1648,3 +1719,4 @@ */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ +