Addhere to some missed style guidlines
This commit is contained in:
@@ -14,7 +14,7 @@ void lcd_init(bool bl_on) {
|
|||||||
|
|
||||||
BSP_LCD_Init();
|
BSP_LCD_Init();
|
||||||
BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS);
|
BSP_LCD_LayerDefaultInit(1, LCD_FB_START_ADDRESS);
|
||||||
BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS + (BSP_LCD_GetXSize()*BSP_LCD_GetYSize()*4));
|
BSP_LCD_LayerDefaultInit(0, LCD_FB_START_ADDRESS + (BSP_LCD_GetXSize() * BSP_LCD_GetYSize() * 4));
|
||||||
BSP_LCD_SelectLayer(0);
|
BSP_LCD_SelectLayer(0);
|
||||||
BSP_LCD_Clear(LCD_COLOR_BLACK);
|
BSP_LCD_Clear(LCD_COLOR_BLACK);
|
||||||
BSP_LCD_SelectLayer(1);
|
BSP_LCD_SelectLayer(1);
|
||||||
@@ -22,10 +22,10 @@ void lcd_init(bool bl_on) {
|
|||||||
if (bl_on) {
|
if (bl_on) {
|
||||||
HAL_GPIO_WritePin(GPIOK, GPIO_PIN_3, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(GPIOK, GPIO_PIN_3, GPIO_PIN_SET);
|
||||||
HAL_GPIO_WritePin(GPIOI, GPIO_PIN_12, GPIO_PIN_SET);
|
HAL_GPIO_WritePin(GPIOI, GPIO_PIN_12, GPIO_PIN_SET);
|
||||||
} else {
|
return;
|
||||||
HAL_GPIO_WritePin(GPIOK, GPIO_PIN_3, GPIO_PIN_RESET);
|
|
||||||
HAL_GPIO_WritePin(GPIOI, GPIO_PIN_12, GPIO_PIN_RESET);
|
|
||||||
}
|
}
|
||||||
|
HAL_GPIO_WritePin(GPIOK, GPIO_PIN_3, GPIO_PIN_RESET);
|
||||||
|
HAL_GPIO_WritePin(GPIOI, GPIO_PIN_12, GPIO_PIN_RESET);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_display_text(uint8_t* text, uint16_t x_pos, uint16_t y_pos, uint32_t color, uint32_t bg_color, sFONT *font) {
|
void lcd_display_text(uint8_t* text, uint16_t x_pos, uint16_t y_pos, uint32_t color, uint32_t bg_color, sFONT *font) {
|
||||||
@@ -42,34 +42,33 @@ void lcd_display_text(uint8_t* text, uint16_t x_pos, uint16_t y_pos, uint32_t co
|
|||||||
|
|
||||||
if (tot_length > BSP_LCD_GetXSize()) {
|
if (tot_length > BSP_LCD_GetXSize()) {
|
||||||
for (int i = 0; i < strlen(text); i++) {
|
for (int i = 0; i < strlen(text); i++) {
|
||||||
if ((x_pos) > BSP_LCD_GetXSize() - (font->Width)*2) {
|
if ((x_pos) > BSP_LCD_GetXSize() - (font->Width) * 2) {
|
||||||
if (isalpha(text[i-1]) && isalpha(text[i])) {
|
if (isalpha(text[i - 1]) && isalpha(text[i])) {
|
||||||
BSP_LCD_DisplayChar(x_pos, y_pos, '-');
|
BSP_LCD_DisplayChar(x_pos, y_pos, '-');
|
||||||
} else {
|
} else {
|
||||||
BSP_LCD_DisplayChar(x_pos, y_pos, text[i]);
|
BSP_LCD_DisplayChar(x_pos, y_pos, text[i]);
|
||||||
}
|
}
|
||||||
x_pos = 0;
|
x_pos = 0;
|
||||||
y_pos += font->Height;
|
y_pos += font->Height;
|
||||||
} else {
|
continue;
|
||||||
BSP_LCD_DisplayChar(x_pos, y_pos, text[i]);
|
|
||||||
x_pos += font->Width;
|
|
||||||
}
|
}
|
||||||
|
BSP_LCD_DisplayChar(x_pos, y_pos, text[i]);
|
||||||
|
x_pos += font->Width;
|
||||||
}
|
}
|
||||||
} else {
|
return;
|
||||||
BSP_LCD_DisplayStringAt(x_pos, y_pos, text, LEFT_MODE);
|
|
||||||
}
|
}
|
||||||
|
BSP_LCD_DisplayStringAt(x_pos, y_pos, text, LEFT_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_draw_raw_img(const void* p_src, uint32_t x_pos, uint32_t y_pos, uint32_t x_size, uint32_t y_size, uint32_t color_mode) {
|
void lcd_draw_raw_img(const void* p_src, uint32_t x_pos, uint32_t y_pos, uint32_t x_size, uint32_t y_size, uint32_t color_mode) {
|
||||||
|
|
||||||
uint32_t address = hLtdcHandler.LayerCfg[1].FBStartAdress + (((BSP_LCD_GetXSize()*y_pos) + x_pos)*(4));
|
uint32_t address = hLtdcHandler.LayerCfg[1].FBStartAdress + (((BSP_LCD_GetXSize() * y_pos) + x_pos) * (4));
|
||||||
void *p_dst = (void *)address;
|
void *p_dst = (void *)address;
|
||||||
|
|
||||||
|
|
||||||
hDma2dHandler2.Init.Mode = DMA2D_M2M_PFC;
|
hDma2dHandler2.Init.Mode = DMA2D_M2M_PFC;
|
||||||
hDma2dHandler2.Init.ColorMode = DMA2D_ARGB8888;
|
hDma2dHandler2.Init.ColorMode = DMA2D_ARGB8888;
|
||||||
hDma2dHandler2.Init.OutputOffset = BSP_LCD_GetXSize()-x_size;
|
hDma2dHandler2.Init.OutputOffset = BSP_LCD_GetXSize() - x_size;
|
||||||
|
|
||||||
hDma2dHandler2.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
|
hDma2dHandler2.LayerCfg[1].AlphaMode = DMA2D_NO_MODIF_ALPHA;
|
||||||
hDma2dHandler2.LayerCfg[1].InputAlpha = 0xFF;
|
hDma2dHandler2.LayerCfg[1].InputAlpha = 0xFF;
|
||||||
|
|||||||
Reference in New Issue
Block a user