Clean compiling warnings of zephyr samples (#202)
This commit is contained in:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user