mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-02-06 15:05:19 +00:00
Clean compiling warnings of zephyr samples (#202)
This commit is contained in:
parent
63cbe4a967
commit
2a74e2dd29
|
@ -31,7 +31,9 @@
|
|||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void xpt2046_corr(int16_t * x, int16_t * y);
|
||||
#if 0
|
||||
static void xpt2046_avg(int16_t * x, int16_t * y);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
|
@ -73,7 +75,6 @@ int last_pen_interrupt_time = 0;
|
|||
void xpt2046_pen_gpio_callback(struct device *port, struct gpio_callback *cb,
|
||||
u32_t pins)
|
||||
{
|
||||
int i;
|
||||
cnt++;
|
||||
if ((k_uptime_get_32() - last_pen_interrupt_time) > 500) {
|
||||
k_sem_give(&sem_touch_read);
|
||||
|
@ -86,15 +87,15 @@ void xpt2046_pen_gpio_callback(struct device *port, struct gpio_callback *cb,
|
|||
void disable_pen_interrupt()
|
||||
{
|
||||
int ret = 0;
|
||||
ret = gpio_pin_disable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
|
||||
ret = gpio_disable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
|
||||
if (ret != 0) {
|
||||
printf("gpio_pin_configure GPIO_DIR_IN failed\n");
|
||||
printf("gpio_pin_configure GPIO_INPUT failed\n");
|
||||
}
|
||||
}
|
||||
void enable_pen_interrupt()
|
||||
{
|
||||
int ret = 0;
|
||||
ret = gpio_pin_enable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
|
||||
ret = gpio_enable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
|
||||
if (ret != 0) {
|
||||
printf("gpio_pin_configure failed\n");
|
||||
}
|
||||
|
@ -152,8 +153,8 @@ void xpt2046_init(void)
|
|||
return;
|
||||
}
|
||||
gpio_pin_configure(xpt2046_cs_ctrl.gpio_dev, XPT2046_CS_GPIO_PIN,
|
||||
GPIO_DIR_OUT);
|
||||
gpio_pin_write(xpt2046_cs_ctrl.gpio_dev, XPT2046_CS_GPIO_PIN, 1);
|
||||
GPIO_OUTPUT);
|
||||
gpio_pin_set(xpt2046_cs_ctrl.gpio_dev, XPT2046_CS_GPIO_PIN, 1);
|
||||
xpt2046_cs_ctrl.gpio_pin = XPT2046_CS_GPIO_PIN;
|
||||
xpt2046_cs_ctrl.delay = 0;
|
||||
spi_conf_xpt2046.cs = &xpt2046_cs_ctrl;
|
||||
|
@ -169,8 +170,8 @@ void xpt2046_init(void)
|
|||
}
|
||||
/* Setup GPIO input */
|
||||
ret = gpio_pin_configure(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN,
|
||||
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE
|
||||
| GPIO_INT_ACTIVE_LOW | GPIO_INT_DEBOUNCE)
|
||||
(GPIO_INPUT | GPIO_INT_ENABLE | GPIO_INT_EDGE
|
||||
| GPIO_INT_LOW_0 | GPIO_INT_DEBOUNCE)
|
||||
);
|
||||
if (ret) {
|
||||
printk("Error configuring pin %d!\n", XPT2046_PEN_GPIO_PIN);
|
||||
|
@ -183,9 +184,9 @@ void xpt2046_init(void)
|
|||
if (ret) {
|
||||
printk("gpio_add_callback error\n");
|
||||
}
|
||||
ret = gpio_pin_enable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
|
||||
ret = gpio_enable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
|
||||
if (ret) {
|
||||
printk("gpio_pin_enable_callback error\n");
|
||||
printk("gpio_enable_callback error\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -209,7 +210,6 @@ bool xpt2046_read(lv_indev_data_t * data)
|
|||
static int16_t last_y = 0;
|
||||
bool valid = true;
|
||||
int s32_ret = 0;
|
||||
uint8_t buf;
|
||||
|
||||
int16_t x = 0;
|
||||
int16_t y = 0;
|
||||
|
@ -293,6 +293,7 @@ static void xpt2046_corr(int16_t * x, int16_t * y)
|
|||
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void xpt2046_avg(int16_t * x, int16_t * y)
|
||||
{
|
||||
/*Shift out the oldest data*/
|
||||
|
@ -320,6 +321,7 @@ static void xpt2046_avg(int16_t * x, int16_t * y)
|
|||
(*x) = (int32_t) x_sum / avg_last;
|
||||
(*y) = (int32_t) y_sum / avg_last;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool touchscreen_read(lv_indev_data_t * data)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <sys/byteorder.h>
|
||||
#include <drivers/spi.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct ili9340_data {
|
||||
struct device *reset_gpio;
|
||||
|
@ -62,29 +63,29 @@ int ili9340_init()
|
|||
data->spi_config.cs = NULL;
|
||||
#endif
|
||||
data->reset_gpio = device_get_binding(
|
||||
DT_ILITEK_ILI9340_0_RESET_GPIOS_CONTROLLER);
|
||||
DT_ILITEK_ILI9340_0_RESET_GPIOS_CONTROLLER);
|
||||
if (data->reset_gpio == NULL) {
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
gpio_pin_configure(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN,
|
||||
GPIO_DIR_OUT);
|
||||
GPIO_OUTPUT);
|
||||
|
||||
data->command_data_gpio = device_get_binding(
|
||||
DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_CONTROLLER);
|
||||
DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_CONTROLLER);
|
||||
if (data->command_data_gpio == NULL) {
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
gpio_pin_configure(data->command_data_gpio,
|
||||
DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN, GPIO_DIR_OUT);
|
||||
DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN, GPIO_OUTPUT);
|
||||
|
||||
LOG_DBG("Resetting display driver\n");
|
||||
gpio_pin_write(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
|
||||
gpio_pin_set(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
|
||||
k_sleep(1);
|
||||
gpio_pin_write(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 0);
|
||||
gpio_pin_set(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 0);
|
||||
k_sleep(1);
|
||||
gpio_pin_write(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
|
||||
gpio_pin_set(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
|
||||
k_sleep(5);
|
||||
|
||||
LOG_DBG("Initializing LCD\n");
|
||||
|
@ -228,19 +229,17 @@ static void ili9340_get_capabilities(const struct device *dev,
|
|||
void ili9340_transmit(struct ili9340_data *data, u8_t cmd, void *tx_data,
|
||||
size_t tx_len)
|
||||
{
|
||||
int i;
|
||||
char * buf1 = tx_data;
|
||||
data = (struct ili9340_data *) &ili9340_data1;
|
||||
struct spi_buf tx_buf = { .buf = &cmd, .len = 1 };
|
||||
struct spi_buf_set tx_bufs = { .buffers = &tx_buf, .count = 1 };
|
||||
|
||||
gpio_pin_write(data->command_data_gpio, DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
|
||||
gpio_pin_set(data->command_data_gpio, DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
|
||||
ILI9340_CMD_DATA_PIN_COMMAND);
|
||||
spi_transceive(data->spi_dev, &data->spi_config, &tx_bufs, NULL);
|
||||
if (tx_data != NULL) {
|
||||
tx_buf.buf = tx_data;
|
||||
tx_buf.len = tx_len;
|
||||
gpio_pin_write(data->command_data_gpio,
|
||||
gpio_pin_set(data->command_data_gpio,
|
||||
DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
|
||||
ILI9340_CMD_DATA_PIN_DATA);
|
||||
spi_transceive(data->spi_dev, &data->spi_config, &tx_bufs, NULL);
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void xpt2046_corr(int16_t * x, int16_t * y);
|
||||
#if 0
|
||||
static void xpt2046_avg(int16_t * x, int16_t * y);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
|
@ -73,7 +75,6 @@ int last_pen_interrupt_time = 0;
|
|||
void xpt2046_pen_gpio_callback(struct device *port, struct gpio_callback *cb,
|
||||
u32_t pins)
|
||||
{
|
||||
int i;
|
||||
cnt++;
|
||||
if ((k_uptime_get_32() - last_pen_interrupt_time) > 500) {
|
||||
k_sem_give(&sem_touch_read);
|
||||
|
@ -86,15 +87,15 @@ void xpt2046_pen_gpio_callback(struct device *port, struct gpio_callback *cb,
|
|||
void disable_pen_interrupt()
|
||||
{
|
||||
int ret = 0;
|
||||
ret = gpio_pin_disable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
|
||||
ret = gpio_disable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
|
||||
if (ret != 0) {
|
||||
printf("gpio_pin_configure GPIO_DIR_IN failed\n");
|
||||
printf("gpio_pin_configure GPIO_INPUT failed\n");
|
||||
}
|
||||
}
|
||||
void enable_pen_interrupt()
|
||||
{
|
||||
int ret = 0;
|
||||
ret = gpio_pin_enable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
|
||||
ret = gpio_enable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
|
||||
if (ret != 0) {
|
||||
printf("gpio_pin_configure failed\n");
|
||||
}
|
||||
|
@ -152,8 +153,8 @@ void xpt2046_init(void)
|
|||
return;
|
||||
}
|
||||
gpio_pin_configure(xpt2046_cs_ctrl.gpio_dev, XPT2046_CS_GPIO_PIN,
|
||||
GPIO_DIR_OUT);
|
||||
gpio_pin_write(xpt2046_cs_ctrl.gpio_dev, XPT2046_CS_GPIO_PIN, 1);
|
||||
GPIO_OUTPUT);
|
||||
gpio_pin_set(xpt2046_cs_ctrl.gpio_dev, XPT2046_CS_GPIO_PIN, 1);
|
||||
xpt2046_cs_ctrl.gpio_pin = XPT2046_CS_GPIO_PIN;
|
||||
xpt2046_cs_ctrl.delay = 0;
|
||||
spi_conf_xpt2046.cs = &xpt2046_cs_ctrl;
|
||||
|
@ -169,8 +170,8 @@ void xpt2046_init(void)
|
|||
}
|
||||
/* Setup GPIO input */
|
||||
ret = gpio_pin_configure(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN,
|
||||
(GPIO_DIR_IN | GPIO_INT | GPIO_INT_EDGE
|
||||
| GPIO_INT_ACTIVE_LOW | GPIO_INT_DEBOUNCE)
|
||||
(GPIO_INPUT | GPIO_INT_ENABLE | GPIO_INT_EDGE
|
||||
| GPIO_INT_LOW_0 | GPIO_INT_DEBOUNCE)
|
||||
);
|
||||
if (ret) {
|
||||
printk("Error configuring pin %d!\n", XPT2046_PEN_GPIO_PIN);
|
||||
|
@ -183,9 +184,9 @@ void xpt2046_init(void)
|
|||
if (ret) {
|
||||
printk("gpio_add_callback error\n");
|
||||
}
|
||||
ret = gpio_pin_enable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
|
||||
ret = gpio_enable_callback(xpt2046_pen_gpio_dev, XPT2046_PEN_GPIO_PIN);
|
||||
if (ret) {
|
||||
printk("gpio_pin_enable_callback error\n");
|
||||
printk("gpio_enable_callback error\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -209,7 +210,6 @@ bool xpt2046_read(lv_indev_data_t * data)
|
|||
static int16_t last_y = 0;
|
||||
bool valid = true;
|
||||
int s32_ret = 0;
|
||||
uint8_t buf;
|
||||
|
||||
int16_t x = 0;
|
||||
int16_t y = 0;
|
||||
|
@ -293,6 +293,7 @@ static void xpt2046_corr(int16_t * x, int16_t * y)
|
|||
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void xpt2046_avg(int16_t * x, int16_t * y)
|
||||
{
|
||||
/*Shift out the oldest data*/
|
||||
|
@ -320,6 +321,7 @@ static void xpt2046_avg(int16_t * x, int16_t * y)
|
|||
(*x) = (int32_t) x_sum / avg_last;
|
||||
(*y) = (int32_t) y_sum / avg_last;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool touchscreen_read(lv_indev_data_t * data)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <sys/byteorder.h>
|
||||
#include <drivers/spi.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
struct ili9340_data {
|
||||
struct device *reset_gpio;
|
||||
|
@ -68,7 +69,7 @@ int ili9340_init()
|
|||
}
|
||||
|
||||
gpio_pin_configure(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN,
|
||||
GPIO_DIR_OUT);
|
||||
GPIO_OUTPUT);
|
||||
|
||||
data->command_data_gpio = device_get_binding(
|
||||
DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_CONTROLLER);
|
||||
|
@ -77,14 +78,14 @@ int ili9340_init()
|
|||
}
|
||||
|
||||
gpio_pin_configure(data->command_data_gpio,
|
||||
DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN, GPIO_DIR_OUT);
|
||||
DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN, GPIO_OUTPUT);
|
||||
|
||||
LOG_DBG("Resetting display driver\n");
|
||||
gpio_pin_write(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
|
||||
gpio_pin_set(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
|
||||
k_sleep(1);
|
||||
gpio_pin_write(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 0);
|
||||
gpio_pin_set(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 0);
|
||||
k_sleep(1);
|
||||
gpio_pin_write(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
|
||||
gpio_pin_set(data->reset_gpio, DT_ILITEK_ILI9340_0_RESET_GPIOS_PIN, 1);
|
||||
k_sleep(5);
|
||||
|
||||
LOG_DBG("Initializing LCD\n");
|
||||
|
@ -228,30 +229,28 @@ static void ili9340_get_capabilities(const struct device *dev,
|
|||
void ili9340_transmit(struct ili9340_data *data, u8_t cmd, void *tx_data,
|
||||
size_t tx_len)
|
||||
{
|
||||
int i;
|
||||
char * buf1 = tx_data;
|
||||
data = (struct ili9340_data *) &ili9340_data1;
|
||||
struct spi_buf tx_buf = { .buf = &cmd, .len = 1 };
|
||||
struct spi_buf_set tx_bufs = { .buffers = &tx_buf, .count = 1 };
|
||||
|
||||
gpio_pin_write(data->command_data_gpio, DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
|
||||
gpio_pin_set(data->command_data_gpio, DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
|
||||
ILI9340_CMD_DATA_PIN_COMMAND);
|
||||
spi_transceive(data->spi_dev, &data->spi_config, &tx_bufs, NULL);
|
||||
if (tx_data != NULL) {
|
||||
tx_buf.buf = tx_data;
|
||||
tx_buf.len = tx_len;
|
||||
gpio_pin_write(data->command_data_gpio,
|
||||
gpio_pin_set(data->command_data_gpio,
|
||||
DT_ILITEK_ILI9340_0_CMD_DATA_GPIOS_PIN,
|
||||
ILI9340_CMD_DATA_PIN_DATA);
|
||||
spi_transceive(data->spi_dev, &data->spi_config, &tx_bufs, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
struct display_driver_api ili9340_api1 ={
|
||||
struct display_driver_api ili9340_api1 = {
|
||||
.blanking_on = ili9340_display_blanking_on,
|
||||
.blanking_off = ili9340_display_blanking_off,
|
||||
.write = ili9340_write,
|
||||
.read = ili9340_read,
|
||||
.read = ili9340_read,
|
||||
.get_framebuffer = ili9340_get_framebuffer,
|
||||
.set_brightness = ili9340_set_brightness,
|
||||
.set_contrast = ili9340_set_contrast,
|
||||
|
|
Loading…
Reference in New Issue
Block a user