zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \ xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g" git grep -l 's\(8\|16\|32\|64\)_t' | \ xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g" Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
ee6fa31af6
commit
a1b77fd589
2364 changed files with 32505 additions and 32505 deletions
|
@ -24,16 +24,16 @@ static int dummy_display_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dummy_display_write(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int dummy_display_write(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
const void *buf)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dummy_display_read(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int dummy_display_read(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
void *buf)
|
||||
{
|
||||
|
@ -56,13 +56,13 @@ static int dummy_display_blanking_on(const struct device *dev)
|
|||
}
|
||||
|
||||
static int dummy_display_set_brightness(const struct device *dev,
|
||||
const u8_t brightness)
|
||||
const uint8_t brightness)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dummy_display_set_contrast(const struct device *dev,
|
||||
const u8_t contrast)
|
||||
const uint8_t contrast)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -30,13 +30,13 @@ static void *framebuf_get_framebuffer(const struct device *dev)
|
|||
}
|
||||
|
||||
static int framebuf_set_brightness(const struct device *dev,
|
||||
const u8_t brightness)
|
||||
const uint8_t brightness)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int framebuf_set_contrast(const struct device *dev,
|
||||
const u8_t contrast)
|
||||
const uint8_t contrast)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
@ -76,21 +76,21 @@ static void framebuf_get_capabilities(const struct device *dev,
|
|||
caps->current_orientation = DISPLAY_ORIENTATION_NORMAL;
|
||||
}
|
||||
|
||||
static int framebuf_write(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int framebuf_write(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
const void *buf)
|
||||
{
|
||||
struct framebuf_dev_data *data = FRAMEBUF_DATA(dev);
|
||||
u32_t *dst = data->buffer;
|
||||
const u32_t *src = buf;
|
||||
u32_t row;
|
||||
uint32_t *dst = data->buffer;
|
||||
const uint32_t *src = buf;
|
||||
uint32_t row;
|
||||
|
||||
dst += x;
|
||||
dst += (y * data->pitch);
|
||||
|
||||
for (row = 0; row < desc->height; ++row) {
|
||||
(void) memcpy(dst, src, desc->width * sizeof(u32_t));
|
||||
(void) memcpy(dst, src, desc->width * sizeof(uint32_t));
|
||||
dst += data->pitch;
|
||||
src += desc->pitch;
|
||||
}
|
||||
|
@ -98,21 +98,21 @@ static int framebuf_write(const struct device *dev, const u16_t x,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int framebuf_read(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int framebuf_read(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
void *buf)
|
||||
{
|
||||
struct framebuf_dev_data *data = FRAMEBUF_DATA(dev);
|
||||
u32_t *src = data->buffer;
|
||||
u32_t *dst = buf;
|
||||
u32_t row;
|
||||
uint32_t *src = data->buffer;
|
||||
uint32_t *dst = buf;
|
||||
uint32_t row;
|
||||
|
||||
src += x;
|
||||
src += (y * data->pitch);
|
||||
|
||||
for (row = 0; row < desc->height; ++row) {
|
||||
(void) memcpy(dst, src, desc->width * sizeof(u32_t));
|
||||
(void) memcpy(dst, src, desc->width * sizeof(uint32_t));
|
||||
src += data->pitch;
|
||||
dst += desc->pitch;
|
||||
}
|
||||
|
|
|
@ -117,10 +117,10 @@ static int ili9340_init(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void ili9340_set_mem_area(struct ili9340_data *data, const u16_t x,
|
||||
const u16_t y, const u16_t w, const u16_t h)
|
||||
static void ili9340_set_mem_area(struct ili9340_data *data, const uint16_t x,
|
||||
const uint16_t y, const uint16_t w, const uint16_t h)
|
||||
{
|
||||
u16_t spi_data[2];
|
||||
uint16_t spi_data[2];
|
||||
|
||||
spi_data[0] = sys_cpu_to_be16(x);
|
||||
spi_data[1] = sys_cpu_to_be16(x + w - 1);
|
||||
|
@ -131,18 +131,18 @@ static void ili9340_set_mem_area(struct ili9340_data *data, const u16_t x,
|
|||
ili9340_transmit(data, ILI9340_CMD_PAGE_ADDR, &spi_data[0], 4);
|
||||
}
|
||||
|
||||
static int ili9340_write(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int ili9340_write(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
const void *buf)
|
||||
{
|
||||
struct ili9340_data *data = (struct ili9340_data *)dev->driver_data;
|
||||
const u8_t *write_data_start = (u8_t *) buf;
|
||||
const uint8_t *write_data_start = (uint8_t *) buf;
|
||||
struct spi_buf tx_buf;
|
||||
struct spi_buf_set tx_bufs;
|
||||
u16_t write_cnt;
|
||||
u16_t nbr_of_writes;
|
||||
u16_t write_h;
|
||||
uint16_t write_cnt;
|
||||
uint16_t nbr_of_writes;
|
||||
uint16_t write_h;
|
||||
|
||||
__ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width");
|
||||
__ASSERT((desc->pitch * ILI9340_RGB_SIZE * desc->height) <= desc->bu_size,
|
||||
|
@ -178,8 +178,8 @@ static int ili9340_write(const struct device *dev, const u16_t x,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ili9340_read(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int ili9340_read(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
void *buf)
|
||||
{
|
||||
|
@ -212,13 +212,13 @@ static int ili9340_display_blanking_on(const struct device *dev)
|
|||
}
|
||||
|
||||
static int ili9340_set_brightness(const struct device *dev,
|
||||
const u8_t brightness)
|
||||
const uint8_t brightness)
|
||||
{
|
||||
LOG_WRN("Set brightness not implemented");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int ili9340_set_contrast(const struct device *dev, const u8_t contrast)
|
||||
static int ili9340_set_contrast(const struct device *dev, const uint8_t contrast)
|
||||
{
|
||||
LOG_ERR("Set contrast not supported");
|
||||
return -ENOTSUP;
|
||||
|
@ -265,7 +265,7 @@ static void ili9340_get_capabilities(const struct device *dev,
|
|||
capabilities->current_orientation = DISPLAY_ORIENTATION_NORMAL;
|
||||
}
|
||||
|
||||
void ili9340_transmit(struct ili9340_data *data, u8_t cmd, void *tx_data,
|
||||
void ili9340_transmit(struct ili9340_data *data, uint8_t cmd, void *tx_data,
|
||||
size_t tx_len)
|
||||
{
|
||||
struct spi_buf tx_buf = { .buf = &cmd, .len = 1 };
|
||||
|
|
|
@ -62,7 +62,7 @@ struct ili9340_data;
|
|||
* @param tx_len Number of bytes in tx_data buffer
|
||||
*
|
||||
*/
|
||||
void ili9340_transmit(struct ili9340_data *data, u8_t cmd, void *tx_data,
|
||||
void ili9340_transmit(struct ili9340_data *data, uint8_t cmd, void *tx_data,
|
||||
size_t tx_len);
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
void ili9340_lcd_init(struct ili9340_data *data)
|
||||
{
|
||||
u8_t tx_data[15];
|
||||
uint8_t tx_data[15];
|
||||
|
||||
tx_data[0] = 0x23;
|
||||
ili9340_transmit(data, ILI9340_CMD_POWER_CTRL_1, tx_data, 1);
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
|
||||
void ili9340_lcd_init(struct ili9340_data *p_ili9340)
|
||||
{
|
||||
u8_t cmd;
|
||||
u8_t data[15];
|
||||
uint8_t cmd;
|
||||
uint8_t data[15];
|
||||
|
||||
/* Software reset */
|
||||
cmd = ILI9340_CMD_SOFTWARE_RESET;
|
||||
|
|
|
@ -28,7 +28,7 @@ struct mcux_elcdif_config {
|
|||
void (*irq_config_func)(struct device *dev);
|
||||
elcdif_rgb_mode_config_t rgb_mode;
|
||||
enum display_pixel_format pixel_format;
|
||||
u8_t bits_per_pixel;
|
||||
uint8_t bits_per_pixel;
|
||||
};
|
||||
|
||||
struct mcux_elcdif_data {
|
||||
|
@ -36,23 +36,23 @@ struct mcux_elcdif_data {
|
|||
struct k_sem sem;
|
||||
size_t pixel_bytes;
|
||||
size_t fb_bytes;
|
||||
u8_t write_idx;
|
||||
uint8_t write_idx;
|
||||
};
|
||||
|
||||
static int mcux_elcdif_write(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int mcux_elcdif_write(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
const void *buf)
|
||||
{
|
||||
const struct mcux_elcdif_config *config = dev->config_info;
|
||||
struct mcux_elcdif_data *data = dev->driver_data;
|
||||
|
||||
u8_t write_idx = data->write_idx;
|
||||
u8_t read_idx = !write_idx;
|
||||
uint8_t write_idx = data->write_idx;
|
||||
uint8_t read_idx = !write_idx;
|
||||
|
||||
int h_idx;
|
||||
const u8_t *src;
|
||||
u8_t *dst;
|
||||
const uint8_t *src;
|
||||
uint8_t *dst;
|
||||
|
||||
__ASSERT((data->pixel_bytes * desc->pitch * desc->height) <=
|
||||
desc->buf_size, "Input buffer too small");
|
||||
|
@ -87,8 +87,8 @@ static int mcux_elcdif_write(const struct device *dev, const u16_t x,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int mcux_elcdif_read(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int mcux_elcdif_read(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
void *buf)
|
||||
{
|
||||
|
@ -115,14 +115,14 @@ static int mcux_elcdif_display_blanking_on(const struct device *dev)
|
|||
}
|
||||
|
||||
static int mcux_elcdif_set_brightness(const struct device *dev,
|
||||
const u8_t brightness)
|
||||
const uint8_t brightness)
|
||||
{
|
||||
LOG_WRN("Set brightness not implemented");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int mcux_elcdif_set_contrast(const struct device *dev,
|
||||
const u8_t contrast)
|
||||
const uint8_t contrast)
|
||||
{
|
||||
LOG_ERR("Set contrast not implemented");
|
||||
return -ENOTSUP;
|
||||
|
@ -169,7 +169,7 @@ static void mcux_elcdif_isr(void *arg)
|
|||
struct device *dev = (struct device *)arg;
|
||||
const struct mcux_elcdif_config *config = dev->config_info;
|
||||
struct mcux_elcdif_data *data = dev->driver_data;
|
||||
u32_t status;
|
||||
uint32_t status;
|
||||
|
||||
status = ELCDIF_GetInterruptStatus(config->base);
|
||||
ELCDIF_ClearInterruptStatus(config->base, status);
|
||||
|
|
|
@ -21,7 +21,7 @@ struct sdl_display_data {
|
|||
SDL_Texture *texture;
|
||||
bool display_on;
|
||||
enum display_pixel_format current_pixel_format;
|
||||
u8_t buf[4 * CONFIG_SDL_DISPLAY_X_RES * CONFIG_SDL_DISPLAY_Y_RES];
|
||||
uint8_t buf[4 * CONFIG_SDL_DISPLAY_X_RES * CONFIG_SDL_DISPLAY_Y_RES];
|
||||
};
|
||||
|
||||
static struct sdl_display_data sdl_display_data;
|
||||
|
@ -93,91 +93,91 @@ static void sdl_display_write_argb8888(void *disp_buf,
|
|||
memcpy(disp_buf, buf, desc->pitch * 4U * desc->height);
|
||||
}
|
||||
|
||||
static void sdl_display_write_rgb888(u8_t *disp_buf,
|
||||
static void sdl_display_write_rgb888(uint8_t *disp_buf,
|
||||
const struct display_buffer_descriptor *desc, const void *buf)
|
||||
{
|
||||
u32_t w_idx;
|
||||
u32_t h_idx;
|
||||
u32_t pixel;
|
||||
const u8_t *byte_ptr;
|
||||
uint32_t w_idx;
|
||||
uint32_t h_idx;
|
||||
uint32_t pixel;
|
||||
const uint8_t *byte_ptr;
|
||||
|
||||
__ASSERT((desc->pitch * 3U * desc->height) <= desc->buf_size,
|
||||
"Input buffer to small");
|
||||
|
||||
for (h_idx = 0U; h_idx < desc->height; ++h_idx) {
|
||||
for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
|
||||
byte_ptr = (const u8_t *)buf +
|
||||
byte_ptr = (const uint8_t *)buf +
|
||||
((h_idx * desc->pitch) + w_idx) * 3U;
|
||||
pixel = *byte_ptr << 16;
|
||||
pixel |= *(byte_ptr + 1) << 8;
|
||||
pixel |= *(byte_ptr + 2);
|
||||
*((u32_t *)disp_buf) = pixel;
|
||||
*((uint32_t *)disp_buf) = pixel;
|
||||
disp_buf += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sdl_display_write_rgb565(u8_t *disp_buf,
|
||||
static void sdl_display_write_rgb565(uint8_t *disp_buf,
|
||||
const struct display_buffer_descriptor *desc, const void *buf)
|
||||
{
|
||||
u32_t w_idx;
|
||||
u32_t h_idx;
|
||||
u32_t pixel;
|
||||
const u16_t *pix_ptr;
|
||||
u16_t rgb565;
|
||||
uint32_t w_idx;
|
||||
uint32_t h_idx;
|
||||
uint32_t pixel;
|
||||
const uint16_t *pix_ptr;
|
||||
uint16_t rgb565;
|
||||
|
||||
__ASSERT((desc->pitch * 2U * desc->height) <= desc->buf_size,
|
||||
"Input buffer to small");
|
||||
|
||||
for (h_idx = 0U; h_idx < desc->height; ++h_idx) {
|
||||
for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
|
||||
pix_ptr = (const u16_t *)buf +
|
||||
pix_ptr = (const uint16_t *)buf +
|
||||
((h_idx * desc->pitch) + w_idx);
|
||||
rgb565 = sys_be16_to_cpu(*pix_ptr);
|
||||
pixel = (((rgb565 >> 11) & 0x1F) * 255 / 31) << 16;
|
||||
pixel |= (((rgb565 >> 5) & 0x3F) * 255 / 63) << 8;
|
||||
pixel |= (rgb565 & 0x1F) * 255 / 31;
|
||||
*((u32_t *)disp_buf) = pixel;
|
||||
*((uint32_t *)disp_buf) = pixel;
|
||||
disp_buf += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sdl_display_write_bgr565(u8_t *disp_buf,
|
||||
static void sdl_display_write_bgr565(uint8_t *disp_buf,
|
||||
const struct display_buffer_descriptor *desc, const void *buf)
|
||||
{
|
||||
u32_t w_idx;
|
||||
u32_t h_idx;
|
||||
u32_t pixel;
|
||||
const u16_t *pix_ptr;
|
||||
uint32_t w_idx;
|
||||
uint32_t h_idx;
|
||||
uint32_t pixel;
|
||||
const uint16_t *pix_ptr;
|
||||
|
||||
__ASSERT((desc->pitch * 2U * desc->height) <= desc->buf_size,
|
||||
"Input buffer to small");
|
||||
|
||||
for (h_idx = 0U; h_idx < desc->height; ++h_idx) {
|
||||
for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
|
||||
pix_ptr = (const u16_t *)buf +
|
||||
pix_ptr = (const uint16_t *)buf +
|
||||
((h_idx * desc->pitch) + w_idx);
|
||||
pixel = (((*pix_ptr >> 11) & 0x1F) * 255 / 31) << 16;
|
||||
pixel |= (((*pix_ptr >> 5) & 0x3F) * 255 / 63) << 8;
|
||||
pixel |= (*pix_ptr & 0x1F) * 255 / 31;
|
||||
*((u32_t *)disp_buf) = pixel;
|
||||
*((uint32_t *)disp_buf) = pixel;
|
||||
disp_buf += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sdl_display_write_mono(u8_t *disp_buf,
|
||||
static void sdl_display_write_mono(uint8_t *disp_buf,
|
||||
const struct display_buffer_descriptor *desc, const void *buf,
|
||||
const bool one_is_black)
|
||||
{
|
||||
u32_t w_idx;
|
||||
u32_t h_idx;
|
||||
u32_t tile_idx;
|
||||
u32_t pixel;
|
||||
const u8_t *byte_ptr;
|
||||
u32_t one_color;
|
||||
u8_t *disp_buf_start;
|
||||
uint32_t w_idx;
|
||||
uint32_t h_idx;
|
||||
uint32_t tile_idx;
|
||||
uint32_t pixel;
|
||||
const uint8_t *byte_ptr;
|
||||
uint32_t one_color;
|
||||
uint8_t *disp_buf_start;
|
||||
|
||||
__ASSERT((desc->pitch * desc->height) <= (desc->buf_size * 8U),
|
||||
"Input buffer to small");
|
||||
|
@ -192,7 +192,7 @@ static void sdl_display_write_mono(u8_t *disp_buf,
|
|||
|
||||
for (tile_idx = 0U; tile_idx < desc->height/8U; ++tile_idx) {
|
||||
for (w_idx = 0U; w_idx < desc->width; ++w_idx) {
|
||||
byte_ptr = (const u8_t *)buf +
|
||||
byte_ptr = (const uint8_t *)buf +
|
||||
((tile_idx * desc->pitch) + w_idx);
|
||||
disp_buf_start = disp_buf;
|
||||
for (h_idx = 0U; h_idx < 8; ++h_idx) {
|
||||
|
@ -201,7 +201,7 @@ static void sdl_display_write_mono(u8_t *disp_buf,
|
|||
} else {
|
||||
pixel = (~one_color) & 0x00FFFFFF;
|
||||
}
|
||||
*((u32_t *)disp_buf) = pixel;
|
||||
*((uint32_t *)disp_buf) = pixel;
|
||||
disp_buf += (desc->width * 4U);
|
||||
}
|
||||
disp_buf = disp_buf_start;
|
||||
|
@ -211,8 +211,8 @@ static void sdl_display_write_mono(u8_t *disp_buf,
|
|||
}
|
||||
}
|
||||
|
||||
static int sdl_display_write(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int sdl_display_write(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
const void *buf)
|
||||
{
|
||||
|
@ -258,8 +258,8 @@ static int sdl_display_write(const struct device *dev, const u16_t x,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sdl_display_read(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int sdl_display_read(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
void *buf)
|
||||
{
|
||||
|
@ -319,13 +319,13 @@ static int sdl_display_blanking_on(const struct device *dev)
|
|||
}
|
||||
|
||||
static int sdl_display_set_brightness(const struct device *dev,
|
||||
const u8_t brightness)
|
||||
const uint8_t brightness)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int sdl_display_set_contrast(const struct device *dev,
|
||||
const u8_t contrast)
|
||||
const uint8_t contrast)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
|
|
@ -28,13 +28,13 @@ LOG_MODULE_REGISTER(display_st7789v);
|
|||
#define ST7789V_RESET_PIN DT_INST_GPIO_PIN(0, reset_gpios)
|
||||
#define ST7789V_RESET_FLAGS DT_INST_GPIO_FLAGS(0, reset_gpios)
|
||||
|
||||
static u8_t st7789v_porch_param[] = DT_INST_PROP(0, porch_param);
|
||||
static u8_t st7789v_cmd2en_param[] = DT_INST_PROP(0, cmd2en_param);
|
||||
static u8_t st7789v_pwctrl1_param[] = DT_INST_PROP(0, pwctrl1_param);
|
||||
static u8_t st7789v_pvgam_param[] = DT_INST_PROP(0, pvgam_param);
|
||||
static u8_t st7789v_nvgam_param[] = DT_INST_PROP(0, nvgam_param);
|
||||
static u8_t st7789v_ram_param[] = DT_INST_PROP(0, ram_param);
|
||||
static u8_t st7789v_rgb_param[] = DT_INST_PROP(0, rgb_param);
|
||||
static uint8_t st7789v_porch_param[] = DT_INST_PROP(0, porch_param);
|
||||
static uint8_t st7789v_cmd2en_param[] = DT_INST_PROP(0, cmd2en_param);
|
||||
static uint8_t st7789v_pwctrl1_param[] = DT_INST_PROP(0, pwctrl1_param);
|
||||
static uint8_t st7789v_pvgam_param[] = DT_INST_PROP(0, pvgam_param);
|
||||
static uint8_t st7789v_nvgam_param[] = DT_INST_PROP(0, nvgam_param);
|
||||
static uint8_t st7789v_ram_param[] = DT_INST_PROP(0, ram_param);
|
||||
static uint8_t st7789v_rgb_param[] = DT_INST_PROP(0, rgb_param);
|
||||
|
||||
struct st7789v_data {
|
||||
struct device *spi_dev;
|
||||
|
@ -48,12 +48,12 @@ struct st7789v_data {
|
|||
#endif
|
||||
struct device *cmd_data_gpio;
|
||||
|
||||
u16_t height;
|
||||
u16_t width;
|
||||
u16_t x_offset;
|
||||
u16_t y_offset;
|
||||
uint16_t height;
|
||||
uint16_t width;
|
||||
uint16_t x_offset;
|
||||
uint16_t y_offset;
|
||||
#ifdef CONFIG_DEVICE_POWER_MANAGEMENT
|
||||
u32_t pm_state;
|
||||
uint32_t pm_state;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -64,7 +64,7 @@ struct st7789v_data {
|
|||
#endif
|
||||
|
||||
static void st7789v_set_lcd_margins(struct st7789v_data *data,
|
||||
u16_t x_offset, u16_t y_offset)
|
||||
uint16_t x_offset, uint16_t y_offset)
|
||||
{
|
||||
data->x_offset = x_offset;
|
||||
data->y_offset = y_offset;
|
||||
|
@ -75,8 +75,8 @@ static void st7789v_set_cmd(struct st7789v_data *data, int is_cmd)
|
|||
gpio_pin_set(data->cmd_data_gpio, ST7789V_CMD_DATA_PIN, is_cmd);
|
||||
}
|
||||
|
||||
static void st7789v_transmit(struct st7789v_data *data, u8_t cmd,
|
||||
u8_t *tx_data, size_t tx_count)
|
||||
static void st7789v_transmit(struct st7789v_data *data, uint8_t cmd,
|
||||
uint8_t *tx_data, size_t tx_count)
|
||||
{
|
||||
struct spi_buf tx_buf = { .buf = &cmd, .len = 1 };
|
||||
struct spi_buf_set tx_bufs = { .buffers = &tx_buf, .count = 1 };
|
||||
|
@ -130,44 +130,44 @@ static int st7789v_blanking_off(const struct device *dev)
|
|||
}
|
||||
|
||||
static int st7789v_read(const struct device *dev,
|
||||
const u16_t x,
|
||||
const u16_t y,
|
||||
const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
void *buf)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static void st7789v_set_mem_area(struct st7789v_data *data, const u16_t x,
|
||||
const u16_t y, const u16_t w, const u16_t h)
|
||||
static void st7789v_set_mem_area(struct st7789v_data *data, const uint16_t x,
|
||||
const uint16_t y, const uint16_t w, const uint16_t h)
|
||||
{
|
||||
u16_t spi_data[2];
|
||||
uint16_t spi_data[2];
|
||||
|
||||
u16_t ram_x = x + data->x_offset;
|
||||
u16_t ram_y = y + data->y_offset;
|
||||
uint16_t ram_x = x + data->x_offset;
|
||||
uint16_t ram_y = y + data->y_offset;
|
||||
|
||||
spi_data[0] = sys_cpu_to_be16(ram_x);
|
||||
spi_data[1] = sys_cpu_to_be16(ram_x + w - 1);
|
||||
st7789v_transmit(data, ST7789V_CMD_CASET, (u8_t *)&spi_data[0], 4);
|
||||
st7789v_transmit(data, ST7789V_CMD_CASET, (uint8_t *)&spi_data[0], 4);
|
||||
|
||||
spi_data[0] = sys_cpu_to_be16(ram_y);
|
||||
spi_data[1] = sys_cpu_to_be16(ram_y + h - 1);
|
||||
st7789v_transmit(data, ST7789V_CMD_RASET, (u8_t *)&spi_data[0], 4);
|
||||
st7789v_transmit(data, ST7789V_CMD_RASET, (uint8_t *)&spi_data[0], 4);
|
||||
}
|
||||
|
||||
static int st7789v_write(const struct device *dev,
|
||||
const u16_t x,
|
||||
const u16_t y,
|
||||
const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
const void *buf)
|
||||
{
|
||||
struct st7789v_data *data = (struct st7789v_data *)dev->driver_data;
|
||||
const u8_t *write_data_start = (u8_t *) buf;
|
||||
const uint8_t *write_data_start = (uint8_t *) buf;
|
||||
struct spi_buf tx_buf;
|
||||
struct spi_buf_set tx_bufs;
|
||||
u16_t write_cnt;
|
||||
u16_t nbr_of_writes;
|
||||
u16_t write_h;
|
||||
uint16_t write_cnt;
|
||||
uint16_t nbr_of_writes;
|
||||
uint16_t write_h;
|
||||
|
||||
__ASSERT(desc->width <= desc->pitch, "Pitch is smaller then width");
|
||||
__ASSERT((desc->pitch * ST7789V_PIXEL_SIZE * desc->height) <= desc->buf_size,
|
||||
|
@ -209,13 +209,13 @@ static void *st7789v_get_framebuffer(const struct device *dev)
|
|||
}
|
||||
|
||||
static int st7789v_set_brightness(const struct device *dev,
|
||||
const u8_t brightness)
|
||||
const uint8_t brightness)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int st7789v_set_contrast(const struct device *dev,
|
||||
const u8_t contrast)
|
||||
const uint8_t contrast)
|
||||
{
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ static int st7789v_set_orientation(const struct device *dev,
|
|||
|
||||
static void st7789v_lcd_init(struct st7789v_data *p_st7789v)
|
||||
{
|
||||
u8_t tmp;
|
||||
uint8_t tmp;
|
||||
|
||||
st7789v_set_lcd_margins(p_st7789v, p_st7789v->x_offset,
|
||||
p_st7789v->y_offset);
|
||||
|
@ -407,7 +407,7 @@ static void st7789v_enter_sleep(struct st7789v_data *data)
|
|||
st7789v_transmit(data, ST7789V_CMD_SLEEP_IN, NULL, 0);
|
||||
}
|
||||
|
||||
static int st7789v_pm_control(struct device *dev, u32_t ctrl_command,
|
||||
static int st7789v_pm_control(struct device *dev, uint32_t ctrl_command,
|
||||
void *context, device_pm_cb cb, void *arg)
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -415,7 +415,7 @@ static int st7789v_pm_control(struct device *dev, u32_t ctrl_command,
|
|||
|
||||
switch (ctrl_command) {
|
||||
case DEVICE_PM_SET_POWER_STATE:
|
||||
if (*((u32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
|
||||
if (*((uint32_t *)context) == DEVICE_PM_ACTIVE_STATE) {
|
||||
st7789v_exit_sleep(data);
|
||||
data->pm_state = DEVICE_PM_ACTIVE_STATE;
|
||||
ret = 0;
|
||||
|
@ -426,7 +426,7 @@ static int st7789v_pm_control(struct device *dev, u32_t ctrl_command,
|
|||
}
|
||||
break;
|
||||
case DEVICE_PM_GET_POWER_STATE:
|
||||
*((u32_t *)context) = data->pm_state;
|
||||
*((uint32_t *)context) = data->pm_state;
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
|
|
|
@ -66,16 +66,16 @@ struct gd7965_data {
|
|||
#endif
|
||||
};
|
||||
|
||||
static u8_t gd7965_softstart[] = DT_INST_PROP(0, softstart);
|
||||
static u8_t gd7965_pwr[] = DT_INST_PROP(0, pwr);
|
||||
static uint8_t gd7965_softstart[] = DT_INST_PROP(0, softstart);
|
||||
static uint8_t gd7965_pwr[] = DT_INST_PROP(0, pwr);
|
||||
|
||||
/* Border and data polarity settings */
|
||||
static u8_t bdd_polarity;
|
||||
static uint8_t bdd_polarity;
|
||||
|
||||
static bool blanking_on = true;
|
||||
|
||||
static inline int gd7965_write_cmd(struct gd7965_data *driver,
|
||||
u8_t cmd, u8_t *data, size_t len)
|
||||
uint8_t cmd, uint8_t *data, size_t len)
|
||||
{
|
||||
struct spi_buf buf = {.buf = &cmd, .len = sizeof(cmd)};
|
||||
struct spi_buf_set buf_set = {.buffers = &buf, .count = 1};
|
||||
|
@ -147,14 +147,14 @@ static int gd7965_blanking_on(const struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int gd7965_write(const struct device *dev, const u16_t x, const u16_t y,
|
||||
static int gd7965_write(const struct device *dev, const uint16_t x, const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
const void *buf)
|
||||
{
|
||||
struct gd7965_data *driver = dev->driver_data;
|
||||
u16_t x_end_idx = x + desc->width - 1;
|
||||
u16_t y_end_idx = y + desc->height - 1;
|
||||
u8_t ptl[GD7965_PTL_REG_LENGTH] = {0};
|
||||
uint16_t x_end_idx = x + desc->width - 1;
|
||||
uint16_t y_end_idx = y + desc->height - 1;
|
||||
uint8_t ptl[GD7965_PTL_REG_LENGTH] = {0};
|
||||
size_t buf_len;
|
||||
|
||||
LOG_DBG("x %u, y %u, height %u, width %u, pitch %u",
|
||||
|
@ -198,7 +198,7 @@ static int gd7965_write(const struct device *dev, const u16_t x, const u16_t y,
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
if (gd7965_write_cmd(driver, GD7965_CMD_DTM2, (u8_t *)buf, buf_len)) {
|
||||
if (gd7965_write_cmd(driver, GD7965_CMD_DTM2, (uint8_t *)buf, buf_len)) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ static int gd7965_write(const struct device *dev, const u16_t x, const u16_t y,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int gd7965_read(const struct device *dev, const u16_t x, const u16_t y,
|
||||
static int gd7965_read(const struct device *dev, const uint16_t x, const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc, void *buf)
|
||||
{
|
||||
LOG_ERR("not supported");
|
||||
|
@ -237,13 +237,13 @@ static void *gd7965_get_framebuffer(const struct device *dev)
|
|||
}
|
||||
|
||||
static int gd7965_set_brightness(const struct device *dev,
|
||||
const u8_t brightness)
|
||||
const uint8_t brightness)
|
||||
{
|
||||
LOG_WRN("not supported");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int gd7965_set_contrast(const struct device *dev, u8_t contrast)
|
||||
static int gd7965_set_contrast(const struct device *dev, uint8_t contrast)
|
||||
{
|
||||
LOG_WRN("not supported");
|
||||
return -ENOTSUP;
|
||||
|
@ -280,7 +280,7 @@ static int gd7965_set_pixel_format(const struct device *dev,
|
|||
}
|
||||
|
||||
static int gd7965_clear_and_write_buffer(struct device *dev,
|
||||
u8_t pattern, bool update)
|
||||
uint8_t pattern, bool update)
|
||||
{
|
||||
struct display_buffer_descriptor desc = {
|
||||
.buf_size = GD7965_NUMOF_PAGES,
|
||||
|
@ -288,7 +288,7 @@ static int gd7965_clear_and_write_buffer(struct device *dev,
|
|||
.height = 1,
|
||||
.pitch = EPD_PANEL_WIDTH,
|
||||
};
|
||||
u8_t *line;
|
||||
uint8_t *line;
|
||||
|
||||
line = k_malloc(GD7965_NUMOF_PAGES);
|
||||
if (line == NULL) {
|
||||
|
@ -314,7 +314,7 @@ static int gd7965_clear_and_write_buffer(struct device *dev,
|
|||
static int gd7965_controller_init(struct device *dev)
|
||||
{
|
||||
struct gd7965_data *driver = dev->driver_data;
|
||||
u8_t tmp[GD7965_TRES_REG_LENGTH];
|
||||
uint8_t tmp[GD7965_TRES_REG_LENGTH];
|
||||
|
||||
gpio_pin_set(driver->reset, GD7965_RESET_PIN, 1);
|
||||
k_sleep(GD7965_RESET_DELAY);
|
||||
|
|
|
@ -23,20 +23,20 @@ LOG_MODULE_REGISTER(grove_lcd);
|
|||
#define GROVE_RGB_BACKLIGHT_ADDR (0x62)
|
||||
|
||||
struct command {
|
||||
u8_t control;
|
||||
u8_t data;
|
||||
uint8_t control;
|
||||
uint8_t data;
|
||||
};
|
||||
|
||||
struct glcd_data {
|
||||
struct device *i2c;
|
||||
u8_t input_set;
|
||||
u8_t display_switch;
|
||||
u8_t function;
|
||||
uint8_t input_set;
|
||||
uint8_t display_switch;
|
||||
uint8_t function;
|
||||
};
|
||||
|
||||
struct glcd_driver {
|
||||
u16_t lcd_addr;
|
||||
u16_t rgb_addr;
|
||||
uint16_t lcd_addr;
|
||||
uint16_t rgb_addr;
|
||||
};
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ struct glcd_driver {
|
|||
#define REGISTER_G 0x03
|
||||
#define REGISTER_B 0x02
|
||||
|
||||
static u8_t color_define[][3] = {
|
||||
static uint8_t color_define[][3] = {
|
||||
{ 255, 255, 255 }, /* white */
|
||||
{ 255, 0, 0 }, /* red */
|
||||
{ 0, 255, 0 }, /* green */
|
||||
|
@ -85,15 +85,15 @@ static u8_t color_define[][3] = {
|
|||
/********************************************
|
||||
* PRIVATE FUNCTIONS
|
||||
*******************************************/
|
||||
static void rgb_reg_set(struct device * const i2c, u8_t addr, u8_t dta)
|
||||
static void rgb_reg_set(struct device * const i2c, uint8_t addr, uint8_t dta)
|
||||
{
|
||||
u8_t data[2] = { addr, dta };
|
||||
uint8_t data[2] = { addr, dta };
|
||||
|
||||
i2c_write(i2c, data, sizeof(data), GROVE_RGB_BACKLIGHT_ADDR);
|
||||
}
|
||||
|
||||
|
||||
static inline void sleep(u32_t sleep_in_ms)
|
||||
static inline void sleep(uint32_t sleep_in_ms)
|
||||
{
|
||||
k_busy_wait(SLEEP_IN_US(sleep_in_ms));
|
||||
}
|
||||
|
@ -102,12 +102,12 @@ static inline void sleep(u32_t sleep_in_ms)
|
|||
/********************************************
|
||||
* PUBLIC FUNCTIONS
|
||||
*******************************************/
|
||||
void glcd_print(struct device *port, char *data, u32_t size)
|
||||
void glcd_print(struct device *port, char *data, uint32_t size)
|
||||
{
|
||||
const struct glcd_driver * const rom = (const struct glcd_driver *)
|
||||
port->config_info;
|
||||
struct glcd_data *dev = port->driver_data;
|
||||
u8_t buf[] = { GLCD_CMD_SET_CGRAM_ADDR, 0 };
|
||||
uint8_t buf[] = { GLCD_CMD_SET_CGRAM_ADDR, 0 };
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
|
@ -117,7 +117,7 @@ void glcd_print(struct device *port, char *data, u32_t size)
|
|||
}
|
||||
|
||||
|
||||
void glcd_cursor_pos_set(struct device *port, u8_t col, u8_t row)
|
||||
void glcd_cursor_pos_set(struct device *port, uint8_t col, uint8_t row)
|
||||
{
|
||||
const struct glcd_driver * const rom = (const struct glcd_driver *)
|
||||
port->config_info;
|
||||
|
@ -143,7 +143,7 @@ void glcd_clear(struct device *port)
|
|||
const struct glcd_driver * const rom = (const struct glcd_driver *)
|
||||
port->config_info;
|
||||
struct glcd_data *dev = port->driver_data;
|
||||
u8_t clear[] = { 0, GLCD_CMD_SCREEN_CLEAR };
|
||||
uint8_t clear[] = { 0, GLCD_CMD_SCREEN_CLEAR };
|
||||
|
||||
i2c_write(dev->i2c, clear, sizeof(clear), rom->lcd_addr);
|
||||
LOG_DBG("clear, delay 20 ms");
|
||||
|
@ -151,12 +151,12 @@ void glcd_clear(struct device *port)
|
|||
}
|
||||
|
||||
|
||||
void glcd_display_state_set(struct device *port, u8_t opt)
|
||||
void glcd_display_state_set(struct device *port, uint8_t opt)
|
||||
{
|
||||
const struct glcd_driver * const rom = (const struct glcd_driver *)
|
||||
port->config_info;
|
||||
struct glcd_data *dev = port->driver_data;
|
||||
u8_t data[] = { 0, 0 };
|
||||
uint8_t data[] = { 0, 0 };
|
||||
|
||||
dev->display_switch = opt;
|
||||
data[1] = (opt | GLCD_CMD_DISPLAY_SWITCH);
|
||||
|
@ -168,7 +168,7 @@ void glcd_display_state_set(struct device *port, u8_t opt)
|
|||
}
|
||||
|
||||
|
||||
u8_t glcd_display_state_get(struct device *port)
|
||||
uint8_t glcd_display_state_get(struct device *port)
|
||||
{
|
||||
struct glcd_data *dev = port->driver_data;
|
||||
|
||||
|
@ -176,11 +176,11 @@ u8_t glcd_display_state_get(struct device *port)
|
|||
}
|
||||
|
||||
|
||||
void glcd_input_state_set(struct device *port, u8_t opt)
|
||||
void glcd_input_state_set(struct device *port, uint8_t opt)
|
||||
{
|
||||
const struct glcd_driver * const rom = port->config_info;
|
||||
struct glcd_data *dev = port->driver_data;
|
||||
u8_t data[] = { 0, 0 };
|
||||
uint8_t data[] = { 0, 0 };
|
||||
|
||||
dev->input_set = opt;
|
||||
data[1] = (opt | GLCD_CMD_INPUT_SET);
|
||||
|
@ -191,7 +191,7 @@ void glcd_input_state_set(struct device *port, u8_t opt)
|
|||
}
|
||||
|
||||
|
||||
u8_t glcd_input_state_get(struct device *port)
|
||||
uint8_t glcd_input_state_get(struct device *port)
|
||||
{
|
||||
struct glcd_data *dev = port->driver_data;
|
||||
|
||||
|
@ -199,7 +199,7 @@ u8_t glcd_input_state_get(struct device *port)
|
|||
}
|
||||
|
||||
|
||||
void glcd_color_select(struct device *port, u8_t color)
|
||||
void glcd_color_select(struct device *port, uint8_t color)
|
||||
{
|
||||
if (color > 3) {
|
||||
LOG_WRN("selected color is too high a value");
|
||||
|
@ -211,7 +211,7 @@ void glcd_color_select(struct device *port, u8_t color)
|
|||
}
|
||||
|
||||
|
||||
void glcd_color_set(struct device *port, u8_t r, u8_t g, u8_t b)
|
||||
void glcd_color_set(struct device *port, uint8_t r, uint8_t g, uint8_t b)
|
||||
{
|
||||
struct glcd_data * const dev = port->driver_data;
|
||||
|
||||
|
@ -221,11 +221,11 @@ void glcd_color_set(struct device *port, u8_t r, u8_t g, u8_t b)
|
|||
}
|
||||
|
||||
|
||||
void glcd_function_set(struct device *port, u8_t opt)
|
||||
void glcd_function_set(struct device *port, uint8_t opt)
|
||||
{
|
||||
const struct glcd_driver * const rom = port->config_info;
|
||||
struct glcd_data *dev = port->driver_data;
|
||||
u8_t data[] = { 0, 0 };
|
||||
uint8_t data[] = { 0, 0 };
|
||||
|
||||
dev->function = opt;
|
||||
data[1] = (opt | GLCD_CMD_FUNCTION_SET);
|
||||
|
@ -237,7 +237,7 @@ void glcd_function_set(struct device *port, u8_t opt)
|
|||
}
|
||||
|
||||
|
||||
u8_t glcd_function_get(struct device *port)
|
||||
uint8_t glcd_function_get(struct device *port)
|
||||
{
|
||||
struct glcd_data *dev = port->driver_data;
|
||||
|
||||
|
@ -248,7 +248,7 @@ u8_t glcd_function_get(struct device *port)
|
|||
int glcd_initialize(struct device *port)
|
||||
{
|
||||
struct glcd_data *dev = port->driver_data;
|
||||
u8_t cmd;
|
||||
uint8_t cmd;
|
||||
|
||||
LOG_DBG("initialize called");
|
||||
|
||||
|
|
|
@ -86,21 +86,21 @@ struct mb_display {
|
|||
|
||||
struct k_timer timer; /* Rendering timer */
|
||||
|
||||
u8_t img_count; /* Image count */
|
||||
uint8_t img_count; /* Image count */
|
||||
|
||||
u8_t cur_img; /* Current image or character to show */
|
||||
uint8_t cur_img; /* Current image or character to show */
|
||||
|
||||
u8_t scroll:3, /* Scroll shift */
|
||||
uint8_t scroll:3, /* Scroll shift */
|
||||
first:1, /* First frame of a scroll sequence */
|
||||
loop:1, /* Loop to beginning */
|
||||
text:1, /* We're showing a string (not image) */
|
||||
img_sep:1; /* One column image separation */
|
||||
|
||||
/* The following variables track the currently shown image */
|
||||
u8_t cur; /* Currently rendered row */
|
||||
u32_t row[3]; /* Content (columns) for each row */
|
||||
s64_t expiry; /* When to stop showing current image */
|
||||
s32_t duration; /* Duration for each shown image */
|
||||
uint8_t cur; /* Currently rendered row */
|
||||
uint32_t row[3]; /* Content (columns) for each row */
|
||||
int64_t expiry; /* When to stop showing current image */
|
||||
int32_t duration; /* Duration for each shown image */
|
||||
|
||||
union {
|
||||
const struct mb_image *img; /* Array of images to show */
|
||||
|
@ -112,7 +112,7 @@ struct mb_display {
|
|||
};
|
||||
|
||||
struct x_y {
|
||||
u8_t x:4,
|
||||
uint8_t x:4,
|
||||
y:4;
|
||||
};
|
||||
|
||||
|
@ -126,7 +126,7 @@ static const struct x_y map[DISPLAY_ROWS][DISPLAY_COLS] = {
|
|||
};
|
||||
|
||||
/* Mask of all the column bits */
|
||||
static const u32_t col_mask = (((~0UL) << LED_COL1_GPIO_PIN) &
|
||||
static const uint32_t col_mask = (((~0UL) << LED_COL1_GPIO_PIN) &
|
||||
((~0UL) >> (31 - LED_COL9_GPIO_PIN)));
|
||||
|
||||
static inline const struct mb_image *get_font(char ch)
|
||||
|
@ -171,9 +171,9 @@ static void start_image(struct mb_display *disp, const struct mb_image *img)
|
|||
|
||||
#define ROW_PIN(n) (LED_ROW1_GPIO_PIN + (n))
|
||||
|
||||
static inline void update_pins(struct mb_display *disp, u32_t val)
|
||||
static inline void update_pins(struct mb_display *disp, uint32_t val)
|
||||
{
|
||||
u32_t pin, prev = (disp->cur + 2) % 3;
|
||||
uint32_t pin, prev = (disp->cur + 2) % 3;
|
||||
|
||||
/* Disable the previous row */
|
||||
gpio_pin_set_raw(disp->dev, ROW_PIN(prev), 0);
|
||||
|
@ -241,7 +241,7 @@ static inline bool last_frame(struct mb_display *disp)
|
|||
}
|
||||
}
|
||||
|
||||
static inline u8_t scroll_steps(struct mb_display *disp)
|
||||
static inline uint8_t scroll_steps(struct mb_display *disp)
|
||||
{
|
||||
return 5 + disp->img_sep;
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ static struct mb_display display = {
|
|||
.timer = Z_TIMER_INITIALIZER(display.timer, show_row, clear_display),
|
||||
};
|
||||
|
||||
static void start_scroll(struct mb_display *disp, s32_t duration)
|
||||
static void start_scroll(struct mb_display *disp, int32_t duration)
|
||||
{
|
||||
/* Divide total duration by number of scrolling steps */
|
||||
if (duration) {
|
||||
|
@ -344,7 +344,7 @@ static void start_scroll(struct mb_display *disp, s32_t duration)
|
|||
start_image(disp, get_font(' '));
|
||||
}
|
||||
|
||||
static void start_single(struct mb_display *disp, s32_t duration)
|
||||
static void start_single(struct mb_display *disp, int32_t duration)
|
||||
{
|
||||
disp->duration = duration;
|
||||
|
||||
|
@ -355,8 +355,8 @@ static void start_single(struct mb_display *disp, s32_t duration)
|
|||
}
|
||||
}
|
||||
|
||||
void mb_display_image(struct mb_display *disp, u32_t mode, s32_t duration,
|
||||
const struct mb_image *img, u8_t img_count)
|
||||
void mb_display_image(struct mb_display *disp, uint32_t mode, int32_t duration,
|
||||
const struct mb_image *img, uint8_t img_count)
|
||||
{
|
||||
reset_display(disp);
|
||||
|
||||
|
@ -387,8 +387,8 @@ void mb_display_stop(struct mb_display *disp)
|
|||
reset_display(disp);
|
||||
}
|
||||
|
||||
void mb_display_print(struct mb_display *disp, u32_t mode,
|
||||
s32_t duration, const char *fmt, ...)
|
||||
void mb_display_print(struct mb_display *disp, uint32_t mode,
|
||||
int32_t duration, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
|
|
|
@ -49,12 +49,12 @@ LOG_MODULE_REGISTER(ssd1306, CONFIG_DISPLAY_LOG_LEVEL);
|
|||
struct ssd1306_data {
|
||||
struct device *reset;
|
||||
struct device *i2c;
|
||||
u8_t contrast;
|
||||
u8_t scan_mode;
|
||||
uint8_t contrast;
|
||||
uint8_t scan_mode;
|
||||
};
|
||||
|
||||
static inline int ssd1306_reg_read(struct ssd1306_data *driver,
|
||||
u8_t reg, u8_t * const val)
|
||||
uint8_t reg, uint8_t * const val)
|
||||
{
|
||||
return i2c_reg_read_byte(driver->i2c,
|
||||
DT_INST_REG_ADDR(0),
|
||||
|
@ -62,15 +62,15 @@ static inline int ssd1306_reg_read(struct ssd1306_data *driver,
|
|||
}
|
||||
|
||||
static inline int ssd1306_reg_write(struct ssd1306_data *driver,
|
||||
u8_t reg, u8_t val)
|
||||
uint8_t reg, uint8_t val)
|
||||
{
|
||||
return i2c_reg_write_byte(driver->i2c,
|
||||
DT_INST_REG_ADDR(0),
|
||||
reg, val);
|
||||
}
|
||||
|
||||
static inline int ssd1306_reg_update(struct ssd1306_data *driver, u8_t reg,
|
||||
u8_t mask, u8_t val)
|
||||
static inline int ssd1306_reg_update(struct ssd1306_data *driver, uint8_t reg,
|
||||
uint8_t mask, uint8_t val)
|
||||
{
|
||||
return i2c_reg_update_byte(driver->i2c,
|
||||
DT_INST_REG_ADDR(0),
|
||||
|
@ -80,7 +80,7 @@ static inline int ssd1306_reg_update(struct ssd1306_data *driver, u8_t reg,
|
|||
static inline int ssd1306_set_panel_orientation(struct device *dev)
|
||||
{
|
||||
struct ssd1306_data *driver = dev->driver_data;
|
||||
u8_t cmd_buf[] = {
|
||||
uint8_t cmd_buf[] = {
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
(SSD1306_PANEL_SEGMENT_REMAP ?
|
||||
SSD1306_SET_SEGMENT_MAP_REMAPED :
|
||||
|
@ -98,7 +98,7 @@ static inline int ssd1306_set_panel_orientation(struct device *dev)
|
|||
static inline int ssd1306_set_timing_setting(struct device *dev)
|
||||
{
|
||||
struct ssd1306_data *driver = dev->driver_data;
|
||||
u8_t cmd_buf[] = {
|
||||
uint8_t cmd_buf[] = {
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_CLOCK_DIV_RATIO,
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
|
@ -120,7 +120,7 @@ static inline int ssd1306_set_timing_setting(struct device *dev)
|
|||
static inline int ssd1306_set_hardware_config(struct device *dev)
|
||||
{
|
||||
struct ssd1306_data *driver = dev->driver_data;
|
||||
u8_t cmd_buf[] = {
|
||||
uint8_t cmd_buf[] = {
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_START_LINE,
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
|
@ -144,7 +144,7 @@ static inline int ssd1306_set_hardware_config(struct device *dev)
|
|||
static inline int ssd1306_set_charge_pump(const struct device *dev)
|
||||
{
|
||||
struct ssd1306_data *driver = dev->driver_data;
|
||||
u8_t cmd_buf[] = {
|
||||
uint8_t cmd_buf[] = {
|
||||
#if defined(CONFIG_SSD1306_DEFAULT)
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_CHARGE_PUMP_ON,
|
||||
|
@ -181,7 +181,7 @@ static int ssd1306_suspend(const struct device *dev)
|
|||
SSD1306_DISPLAY_OFF);
|
||||
}
|
||||
|
||||
static int ssd1306_write(const struct device *dev, const u16_t x, const u16_t y,
|
||||
static int ssd1306_write(const struct device *dev, const uint16_t x, const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
const void *buf)
|
||||
{
|
||||
|
@ -213,7 +213,7 @@ static int ssd1306_write(const struct device *dev, const u16_t x, const u16_t y,
|
|||
x, y, desc->pitch, desc->width, desc->height, buf_len);
|
||||
|
||||
#if defined(CONFIG_SSD1306_DEFAULT)
|
||||
u8_t cmd_buf[] = {
|
||||
uint8_t cmd_buf[] = {
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_MEM_ADDRESSING_MODE,
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
|
@ -241,11 +241,11 @@ static int ssd1306_write(const struct device *dev, const u16_t x, const u16_t y,
|
|||
return i2c_burst_write(driver->i2c,
|
||||
DT_INST_REG_ADDR(0),
|
||||
SSD1306_CONTROL_LAST_BYTE_DATA,
|
||||
(u8_t *)buf, buf_len);
|
||||
(uint8_t *)buf, buf_len);
|
||||
|
||||
#elif defined(CONFIG_SSD1306_SH1106_COMPATIBLE)
|
||||
u8_t x_offset = x + DT_INST_PROP(0, segment_offset);
|
||||
u8_t cmd_buf[] = {
|
||||
uint8_t x_offset = x + DT_INST_PROP(0, segment_offset);
|
||||
uint8_t cmd_buf[] = {
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_LOWER_COL_ADDRESS |
|
||||
(x_offset & SSD1306_SET_LOWER_COL_ADDRESS_MASK),
|
||||
|
@ -255,9 +255,9 @@ static int ssd1306_write(const struct device *dev, const u16_t x, const u16_t y,
|
|||
SSD1306_CONTROL_LAST_BYTE_CMD,
|
||||
SSD1306_SET_PAGE_START_ADDRESS | (y / 8)
|
||||
};
|
||||
u8_t *buf_ptr = (u8_t *)buf;
|
||||
uint8_t *buf_ptr = (uint8_t *)buf;
|
||||
|
||||
for (u8_t n = 0; n < desc->height / 8; n++) {
|
||||
for (uint8_t n = 0; n < desc->height / 8; n++) {
|
||||
cmd_buf[sizeof(cmd_buf) - 1] =
|
||||
SSD1306_SET_PAGE_START_ADDRESS | (n + (y / 8));
|
||||
LOG_HEXDUMP_DBG(cmd_buf, sizeof(cmd_buf), "cmd_buf");
|
||||
|
@ -275,7 +275,7 @@ static int ssd1306_write(const struct device *dev, const u16_t x, const u16_t y,
|
|||
}
|
||||
|
||||
buf_ptr = buf_ptr + desc->width;
|
||||
if (buf_ptr > ((u8_t *)buf + buf_len)) {
|
||||
if (buf_ptr > ((uint8_t *)buf + buf_len)) {
|
||||
LOG_ERR("Exceeded buffer length");
|
||||
return -1;
|
||||
}
|
||||
|
@ -285,8 +285,8 @@ static int ssd1306_write(const struct device *dev, const u16_t x, const u16_t y,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ssd1306_read(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int ssd1306_read(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
void *buf)
|
||||
{
|
||||
|
@ -301,16 +301,16 @@ static void *ssd1306_get_framebuffer(const struct device *dev)
|
|||
}
|
||||
|
||||
static int ssd1306_set_brightness(const struct device *dev,
|
||||
const u8_t brightness)
|
||||
const uint8_t brightness)
|
||||
{
|
||||
LOG_WRN("Unsupported");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int ssd1306_set_contrast(const struct device *dev, const u8_t contrast)
|
||||
static int ssd1306_set_contrast(const struct device *dev, const uint8_t contrast)
|
||||
{
|
||||
struct ssd1306_data *driver = dev->driver_data;
|
||||
u8_t cmd_buf[] = {
|
||||
uint8_t cmd_buf[] = {
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_CONTRAST_CTRL,
|
||||
SSD1306_CONTROL_LAST_BYTE_CMD,
|
||||
|
@ -354,7 +354,7 @@ static int ssd1306_init_device(struct device *dev)
|
|||
{
|
||||
struct ssd1306_data *driver = dev->driver_data;
|
||||
|
||||
u8_t cmd_buf[] = {
|
||||
uint8_t cmd_buf[] = {
|
||||
SSD1306_CONTROL_BYTE_CMD,
|
||||
SSD1306_SET_ENTIRE_DISPLAY_OFF,
|
||||
SSD1306_CONTROL_LAST_BYTE_CMD,
|
||||
|
|
|
@ -64,16 +64,16 @@ struct ssd16xx_data {
|
|||
#if defined(SSD16XX_CS_CNTRL)
|
||||
struct spi_cs_control cs_ctrl;
|
||||
#endif
|
||||
u8_t scan_mode;
|
||||
uint8_t scan_mode;
|
||||
};
|
||||
|
||||
static u8_t ssd16xx_lut_initial[] = DT_INST_PROP(0, lut_initial);
|
||||
static u8_t ssd16xx_lut_default[] = DT_INST_PROP(0, lut_default);
|
||||
static uint8_t ssd16xx_lut_initial[] = DT_INST_PROP(0, lut_initial);
|
||||
static uint8_t ssd16xx_lut_default[] = DT_INST_PROP(0, lut_default);
|
||||
#if DT_INST_NODE_HAS_PROP(0, softstart)
|
||||
static u8_t ssd16xx_softstart[] = DT_INST_PROP(0, softstart);
|
||||
static uint8_t ssd16xx_softstart[] = DT_INST_PROP(0, softstart);
|
||||
#endif
|
||||
static u8_t ssd16xx_gdv[] = DT_INST_PROP(0, gdv);
|
||||
static u8_t ssd16xx_sdv[] = DT_INST_PROP(0, sdv);
|
||||
static uint8_t ssd16xx_gdv[] = DT_INST_PROP(0, gdv);
|
||||
static uint8_t ssd16xx_sdv[] = DT_INST_PROP(0, sdv);
|
||||
|
||||
#if !DT_INST_NODE_HAS_PROP(0, lut_initial)
|
||||
#error "No initial waveform look up table (LUT) selected!"
|
||||
|
@ -84,7 +84,7 @@ static u8_t ssd16xx_sdv[] = DT_INST_PROP(0, sdv);
|
|||
#endif
|
||||
|
||||
static inline int ssd16xx_write_cmd(struct ssd16xx_data *driver,
|
||||
u8_t cmd, u8_t *data, size_t len)
|
||||
uint8_t cmd, uint8_t *data, size_t len)
|
||||
{
|
||||
int err;
|
||||
struct spi_buf buf = {.buf = &cmd, .len = sizeof(cmd)};
|
||||
|
@ -120,10 +120,10 @@ static inline void ssd16xx_busy_wait(struct ssd16xx_data *driver)
|
|||
}
|
||||
}
|
||||
|
||||
static inline size_t push_x_param(u8_t *data, u16_t x)
|
||||
static inline size_t push_x_param(uint8_t *data, uint16_t x)
|
||||
{
|
||||
#if DT_INST_PROP(0, pp_width_bits) == 8
|
||||
data[0] = (u8_t)x;
|
||||
data[0] = (uint8_t)x;
|
||||
return 1;
|
||||
#elif DT_INST_PROP(0, pp_width_bits) == 16
|
||||
sys_put_le16(sys_cpu_to_le16(x), data);
|
||||
|
@ -133,10 +133,10 @@ static inline size_t push_x_param(u8_t *data, u16_t x)
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline size_t push_y_param(u8_t *data, u16_t y)
|
||||
static inline size_t push_y_param(uint8_t *data, uint16_t y)
|
||||
{
|
||||
#if DT_INST_PROP(0, pp_height_bits) == 8
|
||||
data[0] = (u8_t)y;
|
||||
data[0] = (uint8_t)y;
|
||||
return 1;
|
||||
#elif DT_INST_PROP(0, pp_height_bits) == 16
|
||||
sys_put_le16(sys_cpu_to_le16(y), data);
|
||||
|
@ -148,10 +148,10 @@ static inline size_t push_y_param(u8_t *data, u16_t y)
|
|||
|
||||
|
||||
static inline int ssd16xx_set_ram_param(struct ssd16xx_data *driver,
|
||||
u16_t sx, u16_t ex, u16_t sy, u16_t ey)
|
||||
uint16_t sx, uint16_t ex, uint16_t sy, uint16_t ey)
|
||||
{
|
||||
int err;
|
||||
u8_t tmp[4];
|
||||
uint8_t tmp[4];
|
||||
size_t len;
|
||||
|
||||
len = push_x_param(tmp, sx);
|
||||
|
@ -172,10 +172,10 @@ static inline int ssd16xx_set_ram_param(struct ssd16xx_data *driver,
|
|||
}
|
||||
|
||||
static inline int ssd16xx_set_ram_ptr(struct ssd16xx_data *driver,
|
||||
u16_t x, u16_t y)
|
||||
uint16_t x, uint16_t y)
|
||||
{
|
||||
int err;
|
||||
u8_t tmp[2];
|
||||
uint8_t tmp[2];
|
||||
size_t len;
|
||||
|
||||
len = push_x_param(tmp, x);
|
||||
|
@ -211,7 +211,7 @@ static int ssd16xx_blanking_on(const struct device *dev)
|
|||
static int ssd16xx_update_display(const struct device *dev)
|
||||
{
|
||||
struct ssd16xx_data *driver = dev->driver_data;
|
||||
u8_t tmp;
|
||||
uint8_t tmp;
|
||||
int err;
|
||||
|
||||
tmp = (SSD16XX_CTRL2_ENABLE_CLK |
|
||||
|
@ -229,19 +229,19 @@ static int ssd16xx_update_display(const struct device *dev)
|
|||
NULL, 0);
|
||||
}
|
||||
|
||||
static int ssd16xx_write(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int ssd16xx_write(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
const void *buf)
|
||||
{
|
||||
struct ssd16xx_data *driver = dev->driver_data;
|
||||
int err;
|
||||
size_t buf_len;
|
||||
u16_t x_start;
|
||||
u16_t x_end;
|
||||
u16_t y_start;
|
||||
u16_t y_end;
|
||||
u16_t panel_h = EPD_PANEL_HEIGHT -
|
||||
uint16_t x_start;
|
||||
uint16_t x_end;
|
||||
uint16_t y_start;
|
||||
uint16_t y_end;
|
||||
uint16_t panel_h = EPD_PANEL_HEIGHT -
|
||||
EPD_PANEL_HEIGHT % EPD_PANEL_NUMOF_ROWS_PER_PAGE;
|
||||
|
||||
if (desc->pitch < desc->width) {
|
||||
|
@ -319,7 +319,7 @@ static int ssd16xx_write(const struct device *dev, const u16_t x,
|
|||
return err;
|
||||
}
|
||||
|
||||
err = ssd16xx_write_cmd(driver, SSD16XX_CMD_WRITE_RAM, (u8_t *)buf,
|
||||
err = ssd16xx_write_cmd(driver, SSD16XX_CMD_WRITE_RAM, (uint8_t *)buf,
|
||||
buf_len);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
|
@ -328,8 +328,8 @@ static int ssd16xx_write(const struct device *dev, const u16_t x,
|
|||
return ssd16xx_update_display(dev);
|
||||
}
|
||||
|
||||
static int ssd16xx_read(const struct device *dev, const u16_t x,
|
||||
const u16_t y,
|
||||
static int ssd16xx_read(const struct device *dev, const uint16_t x,
|
||||
const uint16_t y,
|
||||
const struct display_buffer_descriptor *desc,
|
||||
void *buf)
|
||||
{
|
||||
|
@ -344,13 +344,13 @@ static void *ssd16xx_get_framebuffer(const struct device *dev)
|
|||
}
|
||||
|
||||
static int ssd16xx_set_brightness(const struct device *dev,
|
||||
const u8_t brightness)
|
||||
const uint8_t brightness)
|
||||
{
|
||||
LOG_WRN("not supported");
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int ssd16xx_set_contrast(const struct device *dev, u8_t contrast)
|
||||
static int ssd16xx_set_contrast(const struct device *dev, uint8_t contrast)
|
||||
{
|
||||
LOG_WRN("not supported");
|
||||
return -ENOTSUP;
|
||||
|
@ -390,14 +390,14 @@ static int ssd16xx_set_pixel_format(const struct device *dev,
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static int ssd16xx_clear_cntlr_mem(struct device *dev, u8_t ram_cmd,
|
||||
static int ssd16xx_clear_cntlr_mem(struct device *dev, uint8_t ram_cmd,
|
||||
bool update)
|
||||
{
|
||||
struct ssd16xx_data *driver = dev->driver_data;
|
||||
u8_t clear_page[EPD_PANEL_WIDTH];
|
||||
u16_t panel_h = EPD_PANEL_HEIGHT /
|
||||
uint8_t clear_page[EPD_PANEL_WIDTH];
|
||||
uint16_t panel_h = EPD_PANEL_HEIGHT /
|
||||
EPD_PANEL_NUMOF_ROWS_PER_PAGE;
|
||||
u8_t scan_mode = SSD16XX_DATA_ENTRY_XIYDY;
|
||||
uint8_t scan_mode = SSD16XX_DATA_ENTRY_XIYDY;
|
||||
|
||||
/*
|
||||
* Clear unusable memory area when the resolution of the panel is not
|
||||
|
@ -442,7 +442,7 @@ static int ssd16xx_clear_cntlr_mem(struct device *dev, u8_t ram_cmd,
|
|||
static int ssd16xx_controller_init(struct device *dev)
|
||||
{
|
||||
int err;
|
||||
u8_t tmp[3];
|
||||
uint8_t tmp[3];
|
||||
size_t len;
|
||||
struct ssd16xx_data *driver = dev->driver_data;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue