Hello Thomas,
On 2/2/22 09:23, Thomas Zimmermann wrote:
[snip]
Thanks to both of you. I was asking because I found the code to be repetitive and it's not clear that these 3 statements belong together.
I'd like to suggest to add a function
ssd1307_write_cmds(client, len, const u8 *cmds)
that loops through cmds and sends the values one by one. A call would look like this:
const u8 set_col_range[] = { SSD1307_SET_COL_RANGE, col_start, col_end };
ssd1307_write_cmds(client, ARRAY_SIZE(set_col_range), set_col_range);
AND/OR
You could have functions that take a command with arguments; either as va_args or with one function per number of arguments. Or you could combine all these somehow.
Thanks for the suggestion, that a makes sense to me. I'll look into it when working on v2. Probably during the weekend.
Best regards,