Browse Source

TFT cleanup

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
parent
commit
b5ef699523
  1. 20
      Marlin/src/HAL/STM32/tft/tft_fsmc.h
  2. 8
      Marlin/src/HAL/STM32F1/tft/tft_fsmc.h
  3. 14
      Marlin/src/lcd/tft/ui_480x320.cpp
  4. 2
      Marlin/src/lcd/tft_io/ssd1963.h

20
Marlin/src/HAL/STM32/tft/tft_fsmc.h

@ -21,30 +21,28 @@
*/ */
#pragma once #pragma once
#include "../../../inc/MarlinConfig.h"
#ifdef STM32F1xx #ifdef STM32F1xx
#include "stm32f1xx_hal.h" #include "stm32f1xx_hal.h"
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN)
#elif defined(STM32F4xx) #elif defined(STM32F4xx)
#include "stm32f4xx_hal.h" #include "stm32f4xx_hal.h"
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR & DMA_SxCR_EN)
#else #else
#error FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware. #error "FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware."
#endif #endif
#ifndef LCD_READ_ID #ifndef LCD_READ_ID
#define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341) #define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341)
#endif #endif
#ifndef LCD_READ_ID4 #ifndef LCD_READ_ID4
#define LCD_READ_ID4 0xD3 // Read display identification information (0xD3 on ILI9341) #define LCD_READ_ID4 0xD3 // Read display identification information (0xD3 on ILI9341)
#endif #endif
#define DATASIZE_8BIT SPI_DATASIZE_8BIT #define DATASIZE_8BIT SPI_DATASIZE_8BIT
#define DATASIZE_16BIT SPI_DATASIZE_16BIT #define DATASIZE_16BIT SPI_DATASIZE_16BIT
#define TFT_IO_DRIVER TFT_FSMC #define TFT_IO_DRIVER TFT_FSMC
#ifdef STM32F1xx
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN)
#elif defined(STM32F4xx)
#define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR & DMA_SxCR_EN)
#endif
typedef struct { typedef struct {
__IO uint16_t REG; __IO uint16_t REG;

8
Marlin/src/HAL/STM32F1/tft/tft_fsmc.h

@ -22,7 +22,7 @@
#pragma once #pragma once
#ifndef LCD_READ_ID #ifndef LCD_READ_ID
#define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341) #define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341)
#endif #endif
#ifndef LCD_READ_ID4 #ifndef LCD_READ_ID4
#define LCD_READ_ID4 0xD3 // Read display identification information (0xD3 on ILI9341) #define LCD_READ_ID4 0xD3 // Read display identification information (0xD3 on ILI9341)
@ -30,9 +30,9 @@
#include <libmaple/dma.h> #include <libmaple/dma.h>
#define DATASIZE_8BIT DMA_SIZE_8BITS #define DATASIZE_8BIT DMA_SIZE_8BITS
#define DATASIZE_16BIT DMA_SIZE_16BITS #define DATASIZE_16BIT DMA_SIZE_16BITS
#define TFT_IO_DRIVER TFT_FSMC #define TFT_IO_DRIVER TFT_FSMC
typedef struct { typedef struct {
__IO uint16_t REG; __IO uint16_t REG;

14
Marlin/src/lcd/tft/ui_480x320.cpp

@ -428,21 +428,21 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const valu
extern screenFunc_t _manual_move_func_ptr; extern screenFunc_t _manual_move_func_ptr;
if (ui.currentScreen != _manual_move_func_ptr && !ui.external_control) { if (ui.currentScreen != _manual_move_func_ptr && !ui.external_control) {
#define SLIDER_LENGHT 336 #define SLIDER_LENGTH 336
#define SLIDER_Y_POSITION 186 #define SLIDER_Y_POSITION 186
tft.canvas((TFT_WIDTH - SLIDER_LENGHT) / 2, SLIDER_Y_POSITION, SLIDER_LENGHT, 16); tft.canvas((TFT_WIDTH - SLIDER_LENGTH) / 2, SLIDER_Y_POSITION, SLIDER_LENGTH, 16);
tft.set_background(COLOR_BACKGROUND); tft.set_background(COLOR_BACKGROUND);
int16_t position = (SLIDER_LENGHT - 2) * ui.encoderPosition / maxEditValue; int16_t position = (SLIDER_LENGTH - 2) * ui.encoderPosition / maxEditValue;
tft.add_bar(0, 7, 1, 2, ui.encoderPosition == 0 ? COLOR_SLIDER_INACTIVE : COLOR_SLIDER); tft.add_bar(0, 7, 1, 2, ui.encoderPosition == 0 ? COLOR_SLIDER_INACTIVE : COLOR_SLIDER);
tft.add_bar(1, 6, position, 4, COLOR_SLIDER); tft.add_bar(1, 6, position, 4, COLOR_SLIDER);
tft.add_bar(position + 1, 6, SLIDER_LENGHT - 2 - position, 4, COLOR_SLIDER_INACTIVE); tft.add_bar(position + 1, 6, SLIDER_LENGTH - 2 - position, 4, COLOR_SLIDER_INACTIVE);
tft.add_bar(SLIDER_LENGHT - 1, 7, 1, 2, int32_t(ui.encoderPosition) == maxEditValue ? COLOR_SLIDER : COLOR_SLIDER_INACTIVE); tft.add_bar(SLIDER_LENGTH - 1, 7, 1, 2, int32_t(ui.encoderPosition) == maxEditValue ? COLOR_SLIDER : COLOR_SLIDER_INACTIVE);
#if ENABLED(TOUCH_SCREEN) #if ENABLED(TOUCH_SCREEN)
tft.add_image((SLIDER_LENGHT - 8) * ui.encoderPosition / maxEditValue, 0, imgSlider, COLOR_SLIDER); tft.add_image((SLIDER_LENGTH - 8) * ui.encoderPosition / maxEditValue, 0, imgSlider, COLOR_SLIDER);
touch.add_control(SLIDER, (TFT_WIDTH - SLIDER_LENGHT) / 2, SLIDER_Y_POSITION - 8, SLIDER_LENGHT, 32, maxEditValue); touch.add_control(SLIDER, (TFT_WIDTH - SLIDER_LENGTH) / 2, SLIDER_Y_POSITION - 8, SLIDER_LENGTH, 32, maxEditValue);
#endif #endif
} }

2
Marlin/src/lcd/tft_io/ssd1963.h

@ -125,7 +125,7 @@ static const uint16_t ssd1963_init[] = {
ESC_REG(SSD1963_NORON), ESC_REG(SSD1963_NORON),
ESC_REG(SSD1963_DISPON), ESC_REG(SSD1963_DISPON),
ESC_REG(SSD1963_SPWMCFG), 0x0006, 0x00f0, 0x0001, 0x00f0, 0x0000, 0x0000, ESC_REG(SSD1963_SPWMCFG), 0x0006, 0x00F0, 0x0001, 0x00F0, 0x0000, 0x0000,
ESC_REG(SSD1963_SDBCCFG), 0x000D, ESC_REG(SSD1963_SDBCCFG), 0x000D,
ESC_END ESC_END
}; };

Loading…
Cancel
Save