all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against unsigned variables. Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
This commit is contained in:
parent
caebf204c6
commit
24d71431e9
559 changed files with 2331 additions and 2328 deletions
|
@ -55,7 +55,7 @@ static int ili9340_init(struct device *dev)
|
|||
data->cs_ctrl.gpio_dev =
|
||||
device_get_binding(DT_ILITEK_ILI9340_0_CS_GPIO_CONTROLLER);
|
||||
data->cs_ctrl.gpio_pin = DT_ILITEK_ILI9340_0_CS_GPIO_PIN;
|
||||
data->cs_ctrl.delay = 0;
|
||||
data->cs_ctrl.delay = 0U;
|
||||
data->spi_config.cs = &(data->cs_ctrl);
|
||||
#else
|
||||
data->spi_config.cs = NULL;
|
||||
|
@ -229,8 +229,8 @@ static void ili9340_get_capabilities(const struct device *dev,
|
|||
struct display_capabilities *capabilities)
|
||||
{
|
||||
memset(capabilities, 0, sizeof(struct display_capabilities));
|
||||
capabilities->x_resolution = 320;
|
||||
capabilities->y_resolution = 240;
|
||||
capabilities->x_resolution = 320U;
|
||||
capabilities->y_resolution = 240U;
|
||||
capabilities->supported_pixel_formats = PIXEL_FORMAT_RGB_888;
|
||||
capabilities->current_pixel_format = PIXEL_FORMAT_RGB_888;
|
||||
capabilities->current_orientation = DISPLAY_ORIENTATION_NORMAL;
|
||||
|
|
|
@ -183,10 +183,10 @@ static int mcux_elcdif_init(struct device *dev)
|
|||
|
||||
elcdif_rgb_mode_config_t rgb_mode = config->rgb_mode;
|
||||
|
||||
data->pixel_bytes = config->bits_per_pixel / 8;
|
||||
data->pixel_bytes = config->bits_per_pixel / 8U;
|
||||
data->fb_bytes = data->pixel_bytes *
|
||||
rgb_mode.panelWidth * rgb_mode.panelHeight;
|
||||
data->write_idx = 1;
|
||||
data->write_idx = 1U;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(data->fb); i++) {
|
||||
if (k_mem_pool_alloc(&mcux_elcdif_pool, &data->fb[i],
|
||||
|
|
|
@ -89,8 +89,8 @@ static void sdl_display_write_rgb888(u8_t *disp_buf,
|
|||
__ASSERT((3 * desc->pitch * desc->height) <= desc->buf_size,
|
||||
"Input buffer to small");
|
||||
|
||||
for (h_idx = 0; h_idx < desc->height; ++h_idx) {
|
||||
for (w_idx = 0; w_idx < desc->width; ++w_idx) {
|
||||
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 +
|
||||
3 * ((h_idx * desc->pitch) + w_idx);
|
||||
pixel = *byte_ptr << 16;
|
||||
|
@ -116,22 +116,22 @@ static void sdl_display_write_mono(u8_t *disp_buf,
|
|||
|
||||
__ASSERT((desc->pitch * desc->height) <= (8 * desc->buf_size),
|
||||
"Input buffer to small");
|
||||
__ASSERT((desc->height % 8) == 0,
|
||||
__ASSERT((desc->height % 8) == 0U,
|
||||
"Input buffer height not aligned per 8 pixels");
|
||||
|
||||
if (one_is_black) {
|
||||
one_color = 0;
|
||||
one_color = 0U;
|
||||
} else {
|
||||
one_color = 0x00FFFFFF;
|
||||
}
|
||||
|
||||
for (tile_idx = 0; tile_idx < desc->height/8; ++tile_idx) {
|
||||
for (w_idx = 0; w_idx < desc->width; ++w_idx) {
|
||||
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 +
|
||||
((tile_idx * desc->pitch) + w_idx);
|
||||
disp_buf_start = disp_buf;
|
||||
for (h_idx = 0; h_idx < 8; ++h_idx) {
|
||||
if ((*byte_ptr & BIT(7-h_idx)) != 0) {
|
||||
for (h_idx = 0U; h_idx < 8; ++h_idx) {
|
||||
if ((*byte_ptr & BIT(7-h_idx)) != 0U) {
|
||||
pixel = one_color;
|
||||
} else {
|
||||
pixel = (~one_color) & 0x00FFFFFF;
|
||||
|
|
|
@ -125,7 +125,7 @@ void glcd_cursor_pos_set(struct device *port, u8_t col, u8_t row)
|
|||
|
||||
unsigned char data[2];
|
||||
|
||||
if (row == 0) {
|
||||
if (row == 0U) {
|
||||
col |= 0x80;
|
||||
} else {
|
||||
col |= 0xC0;
|
||||
|
|
|
@ -308,7 +308,7 @@ static void show_row(struct k_timer *timer)
|
|||
update_pins(disp, disp->row[disp->cur]);
|
||||
disp->cur = (disp->cur + 1) % DISPLAY_ROWS;
|
||||
|
||||
if (disp->cur == 0 && disp->expiry != K_FOREVER &&
|
||||
if (disp->cur == 0U && disp->expiry != K_FOREVER &&
|
||||
k_uptime_get() > disp->expiry) {
|
||||
if (disp->scroll) {
|
||||
update_scroll(disp);
|
||||
|
|
|
@ -228,7 +228,7 @@ int ssd1306_write(const struct device *dev, const u16_t x, const u16_t y,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (buf == NULL || desc->buf_size == 0) {
|
||||
if (buf == NULL || desc->buf_size == 0U) {
|
||||
LOG_ERR("Display buffer is not available");
|
||||
return -1;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ int ssd1306_write(const struct device *dev, const u16_t x, const u16_t y,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (x != 0 && y != 0) {
|
||||
if (x != 0U && y != 0U) {
|
||||
LOG_ERR("Unsupported origin");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ static int ssd1673_write(const struct device *dev, const u16_t x,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (buf == NULL || desc->buf_size == 0) {
|
||||
if (buf == NULL || desc->buf_size == 0U) {
|
||||
LOG_ERR("Display buffer is not available");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -297,13 +297,13 @@ static int ssd1673_write(const struct device *dev, const u16_t x,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((desc->height % EPD_PANEL_NUMOF_ROWS_PER_PAGE) != 0) {
|
||||
if ((desc->height % EPD_PANEL_NUMOF_ROWS_PER_PAGE) != 0U) {
|
||||
LOG_ERR("Buffer height not multiple of %d",
|
||||
EPD_PANEL_NUMOF_ROWS_PER_PAGE);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((y % EPD_PANEL_NUMOF_ROWS_PER_PAGE) != 0) {
|
||||
if ((y % EPD_PANEL_NUMOF_ROWS_PER_PAGE) != 0U) {
|
||||
LOG_ERR("Y coordinate not multiple of %d",
|
||||
EPD_PANEL_NUMOF_ROWS_PER_PAGE);
|
||||
return -EINVAL;
|
||||
|
@ -461,7 +461,7 @@ static int ssd1673_clear_and_write_buffer(struct device *dev)
|
|||
memset(clear_page, 0xff, sizeof(clear_page));
|
||||
sbuf.buf = clear_page;
|
||||
sbuf.len = sizeof(clear_page);
|
||||
for (page = 0; page <= (SSD1673_PANEL_LAST_PAGE + 1); ++page) {
|
||||
for (page = 0U; page <= (SSD1673_PANEL_LAST_PAGE + 1); ++page) {
|
||||
err = spi_write(driver->spi_dev, &driver->spi_config, &buf_set);
|
||||
if (err < 0) {
|
||||
return err;
|
||||
|
@ -629,7 +629,7 @@ static int ssd1673_init(struct device *dev)
|
|||
}
|
||||
|
||||
driver->cs_ctrl.gpio_pin = DT_SOLOMON_SSD1673FB_0_CS_GPIO_PIN;
|
||||
driver->cs_ctrl.delay = 0;
|
||||
driver->cs_ctrl.delay = 0U;
|
||||
driver->spi_config.cs = &driver->cs_ctrl;
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue