fb: cfb_shell: remove dev
null check
Remove `dev` null check as `DEVICE_DT_GET` ensures compile-time initialization. Refer to commit 6eb371f (fb: initialize devices at compile time) Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This commit is contained in:
parent
cff8b6092e
commit
effe4bbf95
1 changed files with 0 additions and 100 deletions
|
@ -35,11 +35,6 @@ static int cmd_clear(const struct shell *sh, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = cfb_framebuffer_clear(dev, true);
|
err = cfb_framebuffer_clear(dev, true);
|
||||||
if (err) {
|
if (err) {
|
||||||
shell_error(sh, "Framebuffer clear error=%d", err);
|
shell_error(sh, "Framebuffer clear error=%d", err);
|
||||||
|
@ -62,11 +57,6 @@ static int cmd_cfb_print(const struct shell *sh, int col, int row, char *str)
|
||||||
int err;
|
int err;
|
||||||
uint8_t ppt;
|
uint8_t ppt;
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
ppt = cfb_get_display_parameter(dev, CFB_DISPLAY_PPT);
|
ppt = cfb_get_display_parameter(dev, CFB_DISPLAY_PPT);
|
||||||
|
|
||||||
err = cfb_framebuffer_clear(dev, false);
|
err = cfb_framebuffer_clear(dev, false);
|
||||||
|
@ -97,11 +87,6 @@ static int cmd_print(const struct shell *sh, size_t argc, char *argv[])
|
||||||
int err;
|
int err;
|
||||||
int col, row;
|
int col, row;
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
col = strtol(argv[1], NULL, 10);
|
col = strtol(argv[1], NULL, 10);
|
||||||
if (col > cfb_get_display_parameter(dev, CFB_DISPLAY_COLS)) {
|
if (col > cfb_get_display_parameter(dev, CFB_DISPLAY_COLS)) {
|
||||||
shell_error(sh, "Invalid col=%d position", col);
|
shell_error(sh, "Invalid col=%d position", col);
|
||||||
|
@ -128,11 +113,6 @@ static int cmd_draw_text(const struct shell *sh, size_t argc, char *argv[])
|
||||||
int err;
|
int err;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
x = strtol(argv[1], NULL, 10);
|
x = strtol(argv[1], NULL, 10);
|
||||||
y = strtol(argv[2], NULL, 10);
|
y = strtol(argv[2], NULL, 10);
|
||||||
err = cfb_draw_text(dev, argv[3], x, y);
|
err = cfb_draw_text(dev, argv[3], x, y);
|
||||||
|
@ -151,11 +131,6 @@ static int cmd_draw_point(const struct shell *sh, size_t argc, char *argv[])
|
||||||
int err;
|
int err;
|
||||||
struct cfb_position pos;
|
struct cfb_position pos;
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
pos.x = strtol(argv[1], NULL, 10);
|
pos.x = strtol(argv[1], NULL, 10);
|
||||||
pos.y = strtol(argv[2], NULL, 10);
|
pos.y = strtol(argv[2], NULL, 10);
|
||||||
|
|
||||||
|
@ -175,11 +150,6 @@ static int cmd_draw_line(const struct shell *sh, size_t argc, char *argv[])
|
||||||
int err;
|
int err;
|
||||||
struct cfb_position start, end;
|
struct cfb_position start, end;
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
start.x = strtol(argv[1], NULL, 10);
|
start.x = strtol(argv[1], NULL, 10);
|
||||||
start.y = strtol(argv[2], NULL, 10);
|
start.y = strtol(argv[2], NULL, 10);
|
||||||
end.x = strtol(argv[3], NULL, 10);
|
end.x = strtol(argv[3], NULL, 10);
|
||||||
|
@ -201,11 +171,6 @@ static int cmd_draw_rect(const struct shell *sh, size_t argc, char *argv[])
|
||||||
int err;
|
int err;
|
||||||
struct cfb_position start, end;
|
struct cfb_position start, end;
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
start.x = strtol(argv[1], NULL, 10);
|
start.x = strtol(argv[1], NULL, 10);
|
||||||
start.y = strtol(argv[2], NULL, 10);
|
start.y = strtol(argv[2], NULL, 10);
|
||||||
end.x = strtol(argv[3], NULL, 10);
|
end.x = strtol(argv[3], NULL, 10);
|
||||||
|
@ -228,11 +193,6 @@ static int cmd_scroll_vert(const struct shell *sh, size_t argc, char *argv[])
|
||||||
int col, row;
|
int col, row;
|
||||||
int boundary;
|
int boundary;
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
col = strtol(argv[1], NULL, 10);
|
col = strtol(argv[1], NULL, 10);
|
||||||
if (col > cfb_get_display_parameter(dev, CFB_DISPLAY_COLS)) {
|
if (col > cfb_get_display_parameter(dev, CFB_DISPLAY_COLS)) {
|
||||||
shell_error(sh, "Invalid col=%d position", col);
|
shell_error(sh, "Invalid col=%d position", col);
|
||||||
|
@ -269,11 +229,6 @@ static int cmd_scroll_horz(const struct shell *sh, size_t argc, char *argv[])
|
||||||
int col, row;
|
int col, row;
|
||||||
int boundary;
|
int boundary;
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
col = strtol(argv[1], NULL, 10);
|
col = strtol(argv[1], NULL, 10);
|
||||||
if (col > cfb_get_display_parameter(dev, CFB_DISPLAY_COLS)) {
|
if (col > cfb_get_display_parameter(dev, CFB_DISPLAY_COLS)) {
|
||||||
shell_error(sh, "Invalid col=%d position", col);
|
shell_error(sh, "Invalid col=%d position", col);
|
||||||
|
@ -312,11 +267,6 @@ static int cmd_set_font(const struct shell *sh, size_t argc, char *argv[])
|
||||||
uint8_t height;
|
uint8_t height;
|
||||||
uint8_t width;
|
uint8_t width;
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
idx = strtol(argv[1], NULL, 10);
|
idx = strtol(argv[1], NULL, 10);
|
||||||
|
|
||||||
err = cfb_get_font_size(dev, idx, &width, &height);
|
err = cfb_get_font_size(dev, idx, &width, &height);
|
||||||
|
@ -343,11 +293,6 @@ static int cmd_set_kerning(const struct shell *sh, size_t argc, char *argv[])
|
||||||
int err = 0;
|
int err = 0;
|
||||||
long kerning;
|
long kerning;
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
kerning = shell_strtol(argv[1], 10, &err);
|
kerning = shell_strtol(argv[1], 10, &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
shell_error(sh, HELP_INIT);
|
shell_error(sh, HELP_INIT);
|
||||||
|
@ -367,11 +312,6 @@ static int cmd_invert(const struct shell *sh, size_t argc, char *argv[])
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
err = cfb_framebuffer_invert(dev);
|
err = cfb_framebuffer_invert(dev);
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -412,11 +352,6 @@ static int cmd_get_fonts(const struct shell *sh, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int idx = 0; idx < cfb_get_numof_fonts(dev); idx++) {
|
for (int idx = 0; idx < cfb_get_numof_fonts(dev); idx++) {
|
||||||
if (cfb_get_font_size(dev, idx, &font_width, &font_height)) {
|
if (cfb_get_font_size(dev, idx, &font_width, &font_height)) {
|
||||||
break;
|
break;
|
||||||
|
@ -435,11 +370,6 @@ static int cmd_get_device(const struct shell *sh, size_t argc, char *argv[])
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
shell_print(sh, "Framebuffer Device: %s", dev->name);
|
shell_print(sh, "Framebuffer Device: %s", dev->name);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
@ -451,11 +381,6 @@ static int cmd_get_param_all(const struct shell *sh, size_t argc,
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (unsigned int i = 0; i <= CFB_DISPLAY_COLS; i++) {
|
for (unsigned int i = 0; i <= CFB_DISPLAY_COLS; i++) {
|
||||||
shell_print(sh, "param: %s=%d", param_name[i],
|
shell_print(sh, "param: %s=%d", param_name[i],
|
||||||
cfb_get_display_parameter(dev, i));
|
cfb_get_display_parameter(dev, i));
|
||||||
|
@ -471,11 +396,6 @@ static int cmd_get_param_height(const struct shell *sh, size_t argc,
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_HEIGH],
|
shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_HEIGH],
|
||||||
cfb_get_display_parameter(dev, CFB_DISPLAY_HEIGH));
|
cfb_get_display_parameter(dev, CFB_DISPLAY_HEIGH));
|
||||||
|
|
||||||
|
@ -488,11 +408,6 @@ static int cmd_get_param_width(const struct shell *sh, size_t argc,
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_WIDTH],
|
shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_WIDTH],
|
||||||
cfb_get_display_parameter(dev, CFB_DISPLAY_WIDTH));
|
cfb_get_display_parameter(dev, CFB_DISPLAY_WIDTH));
|
||||||
|
|
||||||
|
@ -505,11 +420,6 @@ static int cmd_get_param_ppt(const struct shell *sh, size_t argc,
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_PPT],
|
shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_PPT],
|
||||||
cfb_get_display_parameter(dev, CFB_DISPLAY_PPT));
|
cfb_get_display_parameter(dev, CFB_DISPLAY_PPT));
|
||||||
|
|
||||||
|
@ -522,11 +432,6 @@ static int cmd_get_param_rows(const struct shell *sh, size_t argc,
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_ROWS],
|
shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_ROWS],
|
||||||
cfb_get_display_parameter(dev, CFB_DISPLAY_ROWS));
|
cfb_get_display_parameter(dev, CFB_DISPLAY_ROWS));
|
||||||
|
|
||||||
|
@ -539,11 +444,6 @@ static int cmd_get_param_cols(const struct shell *sh, size_t argc,
|
||||||
ARG_UNUSED(argc);
|
ARG_UNUSED(argc);
|
||||||
ARG_UNUSED(argv);
|
ARG_UNUSED(argv);
|
||||||
|
|
||||||
if (!dev) {
|
|
||||||
shell_error(sh, HELP_INIT);
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
|
|
||||||
shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_COLS],
|
shell_print(sh, "param: %s=%d", param_name[CFB_DISPLAY_COLS],
|
||||||
cfb_get_display_parameter(dev, CFB_DISPLAY_COLS));
|
cfb_get_display_parameter(dev, CFB_DISPLAY_COLS));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue