Skip to content

Commit

Permalink
drivers: display: ssd1306: Cleanup
Browse files Browse the repository at this point in the history
- Removed unused variables from the data struct
- Set all members of capability struct in `ssd1306_get_capabilities`
  instead of zeroing it. This has the same effect but saves some bytes.
- Removed empty log

Signed-off-by: Greter Raffael <[email protected]>
  • Loading branch information
raffi-g authored and aescolar committed Mar 1, 2024
1 parent cbec475 commit 1109027
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions drivers/display/ssd1306.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ struct ssd1306_config {
};

struct ssd1306_data {
uint8_t contrast;
uint8_t scan_mode;
enum display_pixel_format pf;
};

Expand Down Expand Up @@ -335,12 +333,12 @@ static void ssd1306_get_capabilities(const struct device *dev,
const struct ssd1306_config *config = dev->config;
struct ssd1306_data *data = dev->data;

memset(caps, 0, sizeof(struct display_capabilities));
caps->x_resolution = config->width;
caps->y_resolution = config->height;
caps->supported_pixel_formats = PIXEL_FORMAT_MONO10 | PIXEL_FORMAT_MONO01;
caps->current_pixel_format = data->pf;
caps->screen_info = SCREEN_INFO_MONO_VTILED;
caps->current_orientation = DISPLAY_ORIENTATION_NORMAL;
}

static int ssd1306_set_pixel_format(const struct device *dev,
Expand Down Expand Up @@ -432,8 +430,6 @@ static int ssd1306_init(const struct device *dev)
{
const struct ssd1306_config *config = dev->config;

LOG_DBG("");

k_sleep(K_TIMEOUT_ABS_MS(config->ready_time_ms));

if (!ssd1306_bus_ready(dev)) {
Expand Down

0 comments on commit 1109027

Please sign in to comment.