Skip to content
This repository has been archived by the owner on Dec 4, 2020. It is now read-only.

Commit

Permalink
Merge pull request #53 from HamidSaffari/patch-2
Browse files Browse the repository at this point in the history
Removed Hardware-Timer interrupt LV-Tick because of using (millis()) …
  • Loading branch information
Pablo2048 authored Jun 18, 2020
2 parents d8d1fe0 + f8d9359 commit 8620db9
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions examples/STM32_TFT_eSPI_Slider/STM32_TFT_eSPI_Slider.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
*/

#define LED_PIN PB6
#define LVGL_TICK_PERIOD 60

//Ticker tick; /* timer for interrupt handler */
TFT_eSPI tft = TFT_eSPI(); /* TFT instance */
static lv_disp_buf_t disp_buf;
static lv_color_t buf[LV_HOR_RES_MAX * 10];
Expand Down Expand Up @@ -89,11 +87,6 @@ bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
return false; /*Return `false` because we are not buffering and no more data to read*/
}

/* Interrupt driven periodic handler */
static void lv_tick_handler(void)
{
lv_tick_inc(LVGL_TICK_PERIOD);
}

void slider_event_cb(lv_obj_t * slider, lv_event_t event)
{
Expand Down Expand Up @@ -189,21 +182,9 @@ void setup() {
indev_drv.read_cb = my_touchpad_read; /*Set your driver function*/
lv_indev_drv_register(&indev_drv); /*Finally register the driver*/


/*Initialize the graphics library's tick*/
////tick.attach_ms(LVGL_TICK_PERIOD, lv_tick_handler);

TIM_TypeDef *Instance = TIM2;
// Instantiate HardwareTimer object. Thanks to 'new' instanciation, HardwareTimer is not destructed when setup() function is finished.
HardwareTimer *MyTim = new HardwareTimer(Instance);
//MyTim->setMode(2, TIMER_OUTPUT_COMPARE);
MyTim->setOverflow(LVGL_TICK_PERIOD*1000, MICROSEC_FORMAT);
MyTim->attachInterrupt(lv_tick_handler);
MyTim->resume();

//Set the theme..
lv_theme_t * th = lv_theme_night_init(210, NULL); //Set a HUE value and a Font for the Night Theme
lv_theme_set_current(th);
//lv_theme_t * th = lv_theme_night_init(210, NULL); //Set a HUE value and a Font for the Night Theme
//lv_theme_set_current(th);

lv_obj_t * scr = lv_cont_create(NULL, NULL);
lv_disp_load_scr(scr);
Expand Down

0 comments on commit 8620db9

Please sign in to comment.