Compare commits
4 Commits
a01d3157aa
...
59bf4c98bc
Author | SHA1 | Date | |
---|---|---|---|
|
59bf4c98bc | ||
|
526845e4f2 | ||
|
2c854e2535 | ||
|
a5407e8de9 |
@ -69,8 +69,8 @@ Possible choices :
|
|||||||
||PA_7|I/O|**PWM4**/LSPI_MOSI/I²S_MCK/I²S_DI/Touch0|U/D|**LCD backlight N-MOSFET driver**||
|
||PA_7|I/O|**PWM4**/LSPI_MOSI/I²S_MCK/I²S_DI/Touch0|U/D|**LCD backlight N-MOSFET driver**||
|
||||||
||VDD3V3IO|P|IO power supply, 3.3V||||
|
||VDD3V3IO|P|IO power supply, 3.3V||||
|
||||||
||PB_0|**I/O**|PWM0/LSPI_MISO/UART3_TX/PSRAM_CK/Touch3|U/D|**Battery resistor voltage divider enable**||
|
||PB_0|**I/O**|PWM0/LSPI_MISO/UART3_TX/PSRAM_CK/Touch3|U/D|**Battery resistor voltage divider enable**||
|
||||||
||PB_1|I/O|PWM1/LSPI_CK/UART3_RX/PSRAM_CS/Touch4|U/D|||
|
||PB_1|**I/O**|PWM1/LSPI_CK/UART3_RX/PSRAM_CS/Touch4|U/D|**Touch Panel IRQ line**||
|
||||||
||PB_2|I/O|PWM2/LSPI_CK/**UART2_TX**/PSRAM_D0/Touch5|U/D|**Serial output for debug**||
|
||PB_2|I/O|PWM2/LSPI_CK/**UART2_TX**/PSRAM_D0/Touch5|U/D|**Debug UART serial output**||
|
||||||
||PB_3|I/O|PWM3/LSPI_MISO/UART2_RX/PSRAM_D1/Touch6|U/D|||
|
||PB_3|I/O|PWM3/LSPI_MISO/UART2_RX/PSRAM_D1/Touch6|U/D|||
|
||||||
||PB_4|I/O|LSPI_CS/UART2_RTS/UART4_TX/PSRAM_D2/Touch7|U/D|||
|
||PB_4|I/O|LSPI_CS/UART2_RTS/UART4_TX/PSRAM_D2/Touch7|U/D|||
|
||||||
||PB_5|I/O|LSPI_MOSI/UART2_CTS/UART4_RX/PSRAM_D3/Touch8|U/D|||
|
||PB_5|I/O|LSPI_MOSI/UART2_CTS/UART4_RX/PSRAM_D3/Touch8|U/D|||
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
#ifndef APPCONFIG_H
|
#ifndef APPCONFIG_H
|
||||||
#define APPCONFIG_H
|
#define APPCONFIG_H
|
||||||
|
|
||||||
/*
|
#include "wm_gpio.h"
|
||||||
* This file contains all the configuration parameters linked to the main application.
|
|
||||||
|
/**
|
||||||
|
* @brief This file contains all the configuration parameters linked to the main application.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Define which logs to display :
|
* @brief Define which kind of logs to display :
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LOG_ENABLE_ERROR (1)
|
#define LOG_ENABLE_ERROR (1)
|
||||||
@ -15,4 +19,44 @@
|
|||||||
#define LOG_ENABLE_TRACE (1)
|
#define LOG_ENABLE_TRACE (1)
|
||||||
#define LOG_ENABLE_DEBUG (1)
|
#define LOG_ENABLE_DEBUG (1)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Define the hardware pin mapping for all the components :
|
||||||
|
* i2c
|
||||||
|
* lcd display
|
||||||
|
* touch panel
|
||||||
|
* debug uart
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief i2c
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define I2C_SCL WM_IO_PA_01
|
||||||
|
#define I2C_SDA WM_IO_PA_04
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief lcd display
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define LCD_ROTATION 0
|
||||||
|
#define LCD_CLOCK_CLOCK WM_IO_PB_06
|
||||||
|
#define LCD_DATA_LINE WM_IO_PB_07
|
||||||
|
#define LCD_CHIP_SELECT WM_IO_PB_10
|
||||||
|
#define LCD_DATA_COMMAND WM_IO_PB_08
|
||||||
|
#define LCD_RESET WM_IO_PB_09
|
||||||
|
#define LCD_PWM_BACKLIGHT WM_IO_PA_07
|
||||||
|
#define LCD_PWM_CHANNEL 4
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief lcd touch panel
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define LCD_TOUCH_PANEL_IRQ WM_IO_PB_00
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief debug uart
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#define DEBUG_UART_TX WM_IO_PB_02
|
||||||
|
|
||||||
#endif //APPCONFIG_H
|
#endif //APPCONFIG_H
|
@ -142,7 +142,7 @@ bool compass_screen_is_in_use(CompassScreen_t *const compassScreen)
|
|||||||
if(!compassScreen)
|
if(!compassScreen)
|
||||||
{
|
{
|
||||||
LV_LOG_ERROR("NULL pointer given !");
|
LV_LOG_ERROR("NULL pointer given !");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return compassScreen->display != NULL;
|
return compassScreen->display != NULL;
|
||||||
|
123
src/W800 SDK v1.00.08/lvgl/lvgl_port/lv_port_indev.c
Normal file
123
src/W800 SDK v1.00.08/lvgl/lvgl_port/lv_port_indev.c
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
/**
|
||||||
|
* @file lv_port_indev_templ.c
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*Copy this file as "lv_port_indev.c" and set this value to "1" to enable content*/
|
||||||
|
#if 1
|
||||||
|
|
||||||
|
/*********************
|
||||||
|
* INCLUDES
|
||||||
|
*********************/
|
||||||
|
#include "lv_port_indev.h"
|
||||||
|
#include "wm_gpio.h"
|
||||||
|
#include "app_config.h"
|
||||||
|
#include "CST816D.h"
|
||||||
|
|
||||||
|
/*********************
|
||||||
|
* DEFINES
|
||||||
|
*********************/
|
||||||
|
|
||||||
|
/**********************
|
||||||
|
* TYPEDEFS
|
||||||
|
**********************/
|
||||||
|
|
||||||
|
/**********************
|
||||||
|
* STATIC PROTOTYPES
|
||||||
|
**********************/
|
||||||
|
static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
|
||||||
|
|
||||||
|
/**********************
|
||||||
|
* STATIC VARIABLES
|
||||||
|
**********************/
|
||||||
|
static lv_indev_t * indev_touchpad;
|
||||||
|
|
||||||
|
/**********************
|
||||||
|
* MACROS
|
||||||
|
**********************/
|
||||||
|
|
||||||
|
/**********************
|
||||||
|
* LOCAL FUNCTIONS
|
||||||
|
**********************/
|
||||||
|
static void touch_panel_isr(void *arg)
|
||||||
|
{
|
||||||
|
CST816D_Touch_Data_t *p = arg;
|
||||||
|
tls_clr_gpio_irq_status(LCD_TOUCH_PANEL_IRQ);
|
||||||
|
CST816D_read_touch_event(p);
|
||||||
|
}
|
||||||
|
/**********************
|
||||||
|
* GLOBAL FUNCTIONS
|
||||||
|
**********************/
|
||||||
|
|
||||||
|
void lv_port_indev_init(void)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Here you will find example implementation of input devices supported by LittelvGL:
|
||||||
|
* - Touchpad
|
||||||
|
* - Mouse (with cursor support)
|
||||||
|
* - Keypad (supports GUI usage only with key)
|
||||||
|
* - Encoder (supports GUI usage only with: left, right, push)
|
||||||
|
* - Button (external buttons to press points on the screen)
|
||||||
|
*
|
||||||
|
* The `..._read()` function are only examples.
|
||||||
|
* You should shape them according to your hardware
|
||||||
|
*/
|
||||||
|
|
||||||
|
static lv_indev_drv_t indev_drv;
|
||||||
|
static CST816D_Touch_Data_t CST816D_Touch_Data;
|
||||||
|
|
||||||
|
/*------------------
|
||||||
|
* Touchpad
|
||||||
|
* -----------------*/
|
||||||
|
|
||||||
|
/*Initialize your touchpad if you have*/
|
||||||
|
// Let's configure the needed interrupt pin to detect and read touch screen events
|
||||||
|
tls_gpio_cfg(LCD_TOUCH_PANEL_IRQ, WM_GPIO_DIR_INPUT, WM_GPIO_ATTR_PULLHIGH);
|
||||||
|
tls_gpio_isr_register(LCD_TOUCH_PANEL_IRQ, &(touch_panel_isr), &CST816D_Touch_Data);
|
||||||
|
tls_gpio_irq_enable(LCD_TOUCH_PANEL_IRQ, WM_GPIO_IRQ_TRIG_FALLING_EDGE);
|
||||||
|
|
||||||
|
memset(&CST816D_Touch_Data, 0, sizeof CST816D_Touch_Data);
|
||||||
|
|
||||||
|
/*Register a touchpad input device*/
|
||||||
|
lv_indev_drv_init(&indev_drv);
|
||||||
|
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||||
|
indev_drv.read_cb = touchpad_read;
|
||||||
|
indev_drv.user_data = &CST816D_Touch_Data;
|
||||||
|
indev_touchpad = lv_indev_drv_register(&indev_drv);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************
|
||||||
|
* STATIC FUNCTIONS
|
||||||
|
**********************/
|
||||||
|
|
||||||
|
/*------------------
|
||||||
|
* Touchpad
|
||||||
|
* -----------------*/
|
||||||
|
|
||||||
|
static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||||
|
{
|
||||||
|
static lv_coord_t last_x = 0;
|
||||||
|
static lv_coord_t last_y = 0;
|
||||||
|
|
||||||
|
CST816D_Touch_Data_t *p = indev_drv->user_data;
|
||||||
|
|
||||||
|
// Save the pressed coordinates and the state
|
||||||
|
if(p->isValid && p->event == CST816D_Event_Pressed) {
|
||||||
|
last_x = p->touch_x;
|
||||||
|
last_y = p->touch_y;
|
||||||
|
data->state = LV_INDEV_STATE_PR;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
data->state = LV_INDEV_STATE_REL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the last pressed coordinates
|
||||||
|
data->point.x = 239-last_x;
|
||||||
|
data->point.y = 239-last_y;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /*Enable this file at the top*/
|
||||||
|
|
||||||
|
/*This dummy typedef exists purely to silence -Wpedantic.*/
|
||||||
|
typedef int keep_pedantic_happy;
|
||||||
|
#endif
|
Loading…
Reference in New Issue
Block a user