In 4-bit mode, 8-bit commands and data are written using two raw writes to the data interface: high nibble first, low nibble last. This must be handled by the low-level driver. However, as we don't know in which mode (4-bit or 8-bit) nor 4-bit phase the LCD was left, initialization must always be handled using raw writes, and needs to configure the LCD for 8-bit mode first.
Showing the changes to include/misc (1 of 2 files). Show all
Unified · Split
| @@ -14,6 +14,7 @@ struct charlcd { · 13 unmodified lines | ||
| 14 | 14 | const struct charlcd_ops *ops; |
| 15 | 15 | const unsigned char *char_conv; /* Optional */ |
| 16 | 16 | |
| 17 | + int ifwidth; /* 4-bit or 8-bit (default) */ | |
| 17 | 18 | int height; |
| 18 | 19 | int width; |
| 19 | 20 | int bwidth; /* Default set by charlcd_alloc() */ |
| @@ -28,6 +29,7 @@ struct charlcd_ops { · 8 unmodified lines | ||
| 28 | 29 | void (*write_data)(struct charlcd *lcd, int data); |
| 29 | 30 | |
| 30 | 31 | /* Optional */ |
| 32 | + void (*write_cmd_raw4)(struct charlcd *lcd, int cmd); /* 4-bit only */ | |
| 31 | 33 | void (*clear_fast)(struct charlcd *lcd); |
| 32 | 34 | void (*backlight)(struct charlcd *lcd, int on); |
| 33 | 35 | }; |