Skip to content

Commit 7eea58d

Browse files
committed
drivers: video: sw_generator: refactor: flatten arrays
Help with maintainance and possibly readability by using a more regular layout for various tables of numbers. This adds a comma on the last element to help with formatters like clang-format. Signed-off-by: Josuah Demangeon <me@josuah.net>
1 parent 7557dd5 commit 7eea58d

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

drivers/video/video_sw_generator.c

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,27 @@ struct video_sw_generator_data {
4444
uint32_t frame_rate;
4545
};
4646

47-
static const struct video_format_cap fmts[] = {{
48-
.pixelformat = VIDEO_PIX_FMT_RGB565,
49-
.width_min = 64,
50-
.width_max = 1920,
51-
.height_min = 64,
52-
.height_max = 1080,
53-
.width_step = 1,
54-
.height_step = 1,
55-
}, {
56-
.pixelformat = VIDEO_PIX_FMT_XRGB32,
57-
.width_min = 64,
58-
.width_max = 1920,
59-
.height_min = 64,
60-
.height_max = 1080,
61-
.width_step = 1,
62-
.height_step = 1,
63-
},
64-
{0}};
47+
static const struct video_format_cap fmts[] = {
48+
{
49+
.pixelformat = VIDEO_PIX_FMT_RGB565,
50+
.width_min = 64,
51+
.width_max = 1920,
52+
.height_min = 64,
53+
.height_max = 1080,
54+
.width_step = 1,
55+
.height_step = 1,
56+
},
57+
{
58+
.pixelformat = VIDEO_PIX_FMT_XRGB32,
59+
.width_min = 64,
60+
.width_max = 1920,
61+
.height_min = 64,
62+
.height_max = 1080,
63+
.width_step = 1,
64+
.height_step = 1,
65+
},
66+
{0},
67+
};
6568

6669
static int video_sw_generator_set_fmt(const struct device *dev, struct video_format *fmt)
6770
{
@@ -110,10 +113,14 @@ static int video_sw_generator_set_stream(const struct device *dev, bool enable,
110113
}
111114

112115
/* Black, Blue, Red, Purple, Green, Aqua, Yellow, White */
113-
uint16_t rgb565_colorbar_value[] = {0x0000, 0x001F, 0xF800, 0xF81F, 0x07E0, 0x07FF, 0xFFE0, 0xFFFF};
116+
uint16_t rgb565_colorbar_value[] = {
117+
0x0000, 0x001F, 0xF800, 0xF81F, 0x07E0, 0x07FF, 0xFFE0, 0xFFFF,
118+
};
114119

115-
uint32_t xrgb32_colorbar_value[] = {0xFF000000, 0xFF0000FF, 0xFFFF0000, 0xFFFF00FF,
116-
0xFF00FF00, 0xFF00FFFF, 0xFFFFFF00, 0xFFFFFFFF};
120+
uint32_t xrgb32_colorbar_value[] = {
121+
0xFF000000, 0xFF0000FF, 0xFFFF0000, 0xFFFF00FF,
122+
0xFF00FF00, 0xFF00FFFF, 0xFFFFFF00, 0xFFFFFFFF,
123+
};
117124

118125
static void video_sw_generator_fill_colorbar(struct video_sw_generator_data *data,
119126
struct video_buffer *vbuf)

0 commit comments

Comments
 (0)