Description
Hi guys, I am driving a st7735 1.8 "tft lcd with nucleo f401re board. The screen loads once when the software runs. But it is not refreshing again. I want to show the value read from ADC on the bar component.
What MCU/Processor/Board and compiler are you using?
Nucleo-F401RE
1.8" SPI LCD TFT 128x160 ST7735
System Workbench for STM32
What do you want to achieve?
I want to know why me screen is not refreshed
What have you tried so far?
I can drive the screen. Components fit the screen perfectly.
Code to reproduce
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
{
d1 += adc_buffer[0];
d2 += adc_buffer[1];
t++;
if(t==5000)
{
d1 /= 5000;
d2 /= 5000;
pot_value_1 = map(d1, 0, 4096, 0, 100);
pot_value_2 = map(d2, 0, 4096, 0, 100);
UART_Printf("%d %d %d\r\n", d1, d2);
// I can see the pot values from terminal. They are changing properly.
lv_bar_set_value(bar_1, pot_value_1, LV_ANIM_OFF); //Bar values are not changing.
lv_bar_set_value(bar_2, pot_value_2, LV_ANIM_OFF);
t = 0;
}
}
void tft_init(void)
{
ST7735_Init();
ST7735_FillScreen(ST7735_BLACK);
static lv_disp_buf_t disp_buf_1;
static lv_color_t buf1_1[LV_HOR_RES_MAX * 1]; /*A buffer for 10 rows*/
lv_disp_buf_init(&disp_buf_1, buf1_1, NULL, LV_HOR_RES_MAX * 1); /*Initialize the display buffer*/
/*-----------------------------------
* Register the display in LittlevGL
*----------------------------------*/
lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
/*Set up the functions to access to your display*/
/*Set the resolution of the display*/
disp_drv.hor_res = 160;
disp_drv.ver_res = 128;
/*Used to copy the buffer's content to the display*/
disp_drv.flush_cb = tft_flush;
/*Set a display buffer*/
disp_drv.buffer = &disp_buf_1;
/*Finally register the driver*/
disp = lv_disp_drv_register(&disp_drv);
}