drivers: Add 'U' to unsigned variable assignments

Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
This commit is contained in:
Patrik Flykt 2018-11-29 11:12:22 -08:00 committed by Anas Nashif
commit 8ff96b5a57
172 changed files with 693 additions and 693 deletions

View file

@ -134,11 +134,11 @@ static int ili9340_write(const struct device *dev, const u16_t x,
ili9340_set_mem_area(data, x, y, desc->width, desc->height);
if (desc->pitch > desc->width) {
write_h = 1;
write_h = 1U;
nbr_of_writes = desc->height;
} else {
write_h = desc->height;
nbr_of_writes = 1;
nbr_of_writes = 1U;
}
ili9340_transmit(data, ILI9340_CMD_MEM_WRITE,
@ -148,7 +148,7 @@ static int ili9340_write(const struct device *dev, const u16_t x,
tx_bufs.count = 1;
write_data_start += (3 * desc->pitch);
for (write_cnt = 1; write_cnt < nbr_of_writes; ++write_cnt) {
for (write_cnt = 1U; write_cnt < nbr_of_writes; ++write_cnt) {
tx_buf.buf = (void *)write_data_start;
tx_buf.len = 3 * desc->width * write_h;
spi_write(data->spi_dev, &data->spi_config, &tx_bufs);

View file

@ -252,9 +252,9 @@ int glcd_initialize(struct device *port)
LOG_DBG("initialize called");
dev->input_set = 0;
dev->display_switch = 0;
dev->function = 0;
dev->input_set = 0U;
dev->display_switch = 0U;
dev->function = 0U;
/*
* First set up the device driver...

View file

@ -146,7 +146,7 @@ static void start_image(struct mb_display *disp, const struct mb_image *img)
int row, col;
for (row = 0; row < DISPLAY_ROWS; row++) {
disp->row[row] = 0;
disp->row[row] = 0U;
for (col = 0; col < DISPLAY_COLS; col++) {
if (GET_PIXEL(img, map[row][col].x, map[row][col].y)) {
@ -158,7 +158,7 @@ static void start_image(struct mb_display *disp, const struct mb_image *img)
disp->row[row] |= BIT(LED_ROW1_GPIO_PIN + row);
}
disp->cur = 0;
disp->cur = 0U;
if (disp->duration == K_FOREVER) {
disp->expiry = K_FOREVER;
@ -196,9 +196,9 @@ static void reset_display(struct mb_display *disp)
k_timer_stop(&disp->timer);
disp->str = NULL;
disp->cur_img = 0;
disp->cur_img = 0U;
disp->img = NULL;
disp->img_count = 0;
disp->img_count = 0U;
disp->scroll = SCROLL_OFF;
}
@ -269,7 +269,7 @@ static void update_scroll(struct mb_display *disp)
start_image(disp, &img);
} else {
if (disp->first) {
disp->first = 0;
disp->first = 0U;
} else {
disp->cur_img++;
}
@ -280,8 +280,8 @@ static void update_scroll(struct mb_display *disp)
return;
}
disp->cur_img = 0;
disp->first = 1;
disp->cur_img = 0U;
disp->first = 1U;
}
disp->scroll = SCROLL_START;
@ -299,7 +299,7 @@ static void update_image(struct mb_display *disp)
return;
}
disp->cur_img = 0;
disp->cur_img = 0U;
}
start_image(disp, current_img(disp));
@ -343,8 +343,8 @@ static void start_scroll(struct mb_display *disp, s32_t duration)
}
disp->scroll = SCROLL_START;
disp->first = 1;
disp->cur_img = 0;
disp->first = 1U;
disp->cur_img = 0U;
start_image(disp, get_font(' '));
}
@ -366,11 +366,11 @@ void mb_display_image(struct mb_display *disp, u32_t mode, s32_t duration,
__ASSERT(img && img_count > 0, "Invalid parameters");
disp->text = 0;
disp->text = 0U;
disp->img_count = img_count;
disp->img = img;
disp->img_sep = 0;
disp->cur_img = 0;
disp->img_sep = 0U;
disp->cur_img = 0U;
disp->loop = !!(mode & MB_DISPLAY_FLAG_LOOP);
switch (mode & MODE_MASK) {
@ -407,9 +407,9 @@ void mb_display_print(struct mb_display *disp, u32_t mode,
}
disp->str = disp->str_buf;
disp->text = 1;
disp->img_sep = 1;
disp->cur_img = 0;
disp->text = 1U;
disp->img_sep = 1U;
disp->cur_img = 0U;
disp->loop = !!(mode & MB_DISPLAY_FLAG_LOOP);
switch (mode & MODE_MASK) {

View file

@ -88,7 +88,7 @@ static inline int ssd1673_write_cmd(struct ssd1673_data *driver,
static inline void ssd1673_busy_wait(struct ssd1673_data *driver)
{
u32_t val = 0;
u32_t val = 0U;
gpio_pin_read(driver->busy, DT_SSD1673_BUSY_PIN, &val);
while (val) {
@ -181,7 +181,7 @@ static int ssd1673_update_display(const struct device *dev, bool initial)
}
if (initial) {
driver->numof_part_cycles = 0;
driver->numof_part_cycles = 0U;
driver->last_lut = SSD1673_LAST_LUT_INITIAL;
if (ssd1673_write_cmd(driver, SSD1673_CMD_UPDATE_LUT,
ssd1673_lut_initial,
@ -409,7 +409,7 @@ static int ssd1673_controller_init(struct device *dev)
ssd1673_busy_wait(driver);
tmp[0] = (SSD1673_RAM_YRES - 1);
tmp[1] = 0;
tmp[1] = 0U;
if (ssd1673_write_cmd(driver, SSD1673_CMD_GDO_CTRL, tmp, 2)) {
return -1;
}
@ -441,9 +441,9 @@ static int ssd1673_controller_init(struct device *dev)
}
ssd1673_set_orientation(driver);
driver->numof_part_cycles = 0;
driver->numof_part_cycles = 0U;
driver->last_lut = SSD1673_LAST_LUT_INITIAL;
driver->contrast = 0;
driver->contrast = 0U;
return 0;
}