Changeset - ef80f76e5ec7
[Not reviewed]
default
2 2 0
Ethan Zonca - 17 months ago 2024-01-11 20:19:47
ez@ethanzonca.com
Remove unused helpers
4 files changed with 2 insertions and 344 deletions:
0 comments (0 inline, 0 general)
main/CMakeLists.txt
Show inline comments
 
idf_component_register(SRCS "main.c" "wifi.c" "usb_cdc.c" "can.c" "display.c" "ui_helpers.c"
 
idf_component_register(SRCS "main.c" "wifi.c" "usb_cdc.c" "can.c" "display.c"
 
                       INCLUDE_DIRS .)
main/display.c
Show inline comments
 
//
 
// display
 
//
 

	
 
#include "display.h"
 
#include "esp_err.h"
 
#include "esp_log.h"
 
#include "esp_check.h"
 
#include "driver/i2c.h"
 
#include "driver/gpio.h"
 
#include "driver/spi_master.h"
 
#include "esp_lcd_panel_io.h"
 
#include "esp_lcd_panel_vendor.h"
 
#include "esp_lcd_panel_ops.h"
 
#include "esp_lvgl_port.h"
 

	
 

	
 
#include <stdio.h>
 
#include "esp_timer.h"
 
#include "esp_heap_caps.h"
 
#include "freertos/FreeRTOS.h"
 
#include "freertos/task.h"
 
#include "ui_helpers.h"
 
// #include "ui_helpers.h"
 

	
 
static const char *TAG = "LVGL_SETUP";
 
static void lvgl_timer_task(void *arg);
 

	
 
static lv_obj_t *ui_Screen1;
 
static lv_obj_t *ui_redsquare;
 

	
 
static lv_obj_t *meter;
 
static lv_obj_t *ue_img_logo;
 
static lv_obj_t *esp_img_logo;
 

	
 
static lv_obj_t *ui_Dropdown2;
 

	
 
LV_IMG_DECLARE(ue_logo)
 
LV_IMG_DECLARE(esp_logo)
 
LV_IMG_DECLARE(red_square)
 

	
 
#define BSP_NULL_CHECK(x, ret) assert(x)
 

	
 
static SemaphoreHandle_t lvgl_mux;  // LVGL mutex
 
static SemaphoreHandle_t touch_mux; // Touch mutex
 

	
 
static void bsp_touchpad_read(lv_indev_drv_t *drv, lv_indev_data_t *data)
 
{
 
    uint16_t touchpad_x[1] = {0};
 
    uint16_t touchpad_y[1] = {0};
 
    uint8_t touchpad_cnt = 0;
 

	
 
    /* Read data from touch controller into memory */
 
    if (xSemaphoreTake(touch_mux, 0) == pdTRUE)
 
    {
 
        esp_lcd_touch_read_data(drv->user_data);
 
    }
 
    /* Get coordinates */
 
    bool touchpad_pressed = esp_lcd_touch_get_coordinates(drv->user_data, touchpad_x, touchpad_y, NULL, &touchpad_cnt, 1);
 

	
 
    if (touchpad_pressed && touchpad_cnt > 0)
 
    {
 
        data->point.x = touchpad_x[0];
 
        data->point.y = touchpad_y[0];
 
        data->state = LV_INDEV_STATE_PRESSED;
 
        printf("data->point.x = %u \n", data->point.x);
 
        printf("data->point.y = %u \n", data->point.y);
 
    }
 
    else
 
    {
 
        data->state = LV_INDEV_STATE_RELEASED;
 
    }
 
}
 

	
 
static void touch_callback(esp_lcd_touch_handle_t tp)
 
{
 
    BaseType_t xHigherPriorityTaskWoken = pdFALSE;
 
    xSemaphoreGiveFromISR(touch_mux, &xHigherPriorityTaskWoken);
 

	
 
    if (xHigherPriorityTaskWoken)
 
    {
 
        portYIELD_FROM_ISR();
 
    }
 
}
 

	
 
static void set_value(void *indic, int32_t v)
 
{
 
    lv_meter_set_indicator_end_value(meter, indic, v);
 
}
 

	
 
static bool example_notify_lvgl_flush_ready(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_io_event_data_t *edata, void *user_ctx)
 
{
 
    lv_disp_drv_t *disp_driver = (lv_disp_drv_t *)user_ctx;
 
    lv_disp_flush_ready(disp_driver);
 
    return false;
 
}
 

	
 
static void example_lvgl_flush_cb(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_map)
 
{
 
    esp_lcd_panel_handle_t panel_handle = (esp_lcd_panel_handle_t)drv->user_data;
 
    int offsetx1 = area->x1;
 
    int offsetx2 = area->x2;
 
    int offsety1 = area->y1;
 
    int offsety2 = area->y2;
 
    // copy a buffer's content to a specific area of the display
 
    esp_lcd_panel_draw_bitmap(panel_handle, offsetx1, offsety1, offsetx2 + 1, offsety2 + 1, color_map);
 
}
 

	
 
static void example_increase_lvgl_tick(void *arg)
 
{
 
    /* Tell LVGL how many milliseconds has elapsed */
 
    lv_tick_inc(EXAMPLE_LVGL_TICK_PERIOD_MS);
 
}
 

	
 
void display_init()
 
{
 

	
 
    static lv_disp_draw_buf_t disp_buf; // contains internal graphic buffer(s) called draw buffer(s)
 
    static lv_disp_drv_t disp_drv;      // contains callback functions
 

	
main/ui_helpers.c
Show inline comments
 
deleted file
main/ui_helpers.h
Show inline comments
 
deleted file
0 comments (0 inline, 0 general)