Skip to content

Commit 5ab18e6

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 a290dfa commit 5ab18e6

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
@@ -38,24 +38,27 @@ struct video_sw_generator_data {
3838
uint32_t frame_rate;
3939
};
4040

41-
static const struct video_format_cap fmts[] = {{
42-
.pixelformat = VIDEO_PIX_FMT_RGB565,
43-
.width_min = 64,
44-
.width_max = 1920,
45-
.height_min = 64,
46-
.height_max = 1080,
47-
.width_step = 1,
48-
.height_step = 1,
49-
}, {
50-
.pixelformat = VIDEO_PIX_FMT_XRGB32,
51-
.width_min = 64,
52-
.width_max = 1920,
53-
.height_min = 64,
54-
.height_max = 1080,
55-
.width_step = 1,
56-
.height_step = 1,
57-
},
58-
{0}};
41+
static const struct video_format_cap fmts[] = {
42+
{
43+
.pixelformat = VIDEO_PIX_FMT_RGB565,
44+
.width_min = 64,
45+
.width_max = 1920,
46+
.height_min = 64,
47+
.height_max = 1080,
48+
.width_step = 1,
49+
.height_step = 1,
50+
},
51+
{
52+
.pixelformat = VIDEO_PIX_FMT_XRGB32,
53+
.width_min = 64,
54+
.width_max = 1920,
55+
.height_min = 64,
56+
.height_max = 1080,
57+
.width_step = 1,
58+
.height_step = 1,
59+
},
60+
{0},
61+
};
5962

6063
static int video_sw_generator_set_fmt(const struct device *dev, enum video_endpoint_id ep,
6164
struct video_format *fmt)
@@ -113,10 +116,14 @@ static int video_sw_generator_set_stream(const struct device *dev, bool enable)
113116
}
114117

115118
/* Black, Blue, Red, Purple, Green, Aqua, Yellow, White */
116-
uint16_t rgb565_colorbar_value[] = {0x0000, 0x001F, 0xF800, 0xF81F, 0x07E0, 0x07FF, 0xFFE0, 0xFFFF};
119+
uint16_t rgb565_colorbar_value[] = {
120+
0x0000, 0x001F, 0xF800, 0xF81F, 0x07E0, 0x07FF, 0xFFE0, 0xFFFF,
121+
};
117122

118-
uint32_t xrgb32_colorbar_value[] = {0xFF000000, 0xFF0000FF, 0xFFFF0000, 0xFFFF00FF,
119-
0xFF00FF00, 0xFF00FFFF, 0xFFFFFF00, 0xFFFFFFFF};
123+
uint32_t xrgb32_colorbar_value[] = {
124+
0xFF000000, 0xFF0000FF, 0xFFFF0000, 0xFFFF00FF,
125+
0xFF00FF00, 0xFF00FFFF, 0xFFFFFF00, 0xFFFFFFFF,
126+
};
120127

121128
static void video_sw_generator_fill_colorbar(struct video_sw_generator_data *data,
122129
struct video_buffer *vbuf)

0 commit comments

Comments
 (0)