charlcd.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Character LCD driver for Linux
  3. *
  4. * Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu>
  5. * Copyright (C) 2016-2017 Glider bvba
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version
  10. * 2 of the License, or (at your option) any later version.
  11. */
  12. struct charlcd {
  13. const struct charlcd_ops *ops;
  14. const unsigned char *char_conv; /* Optional */
  15. int ifwidth; /* 4-bit or 8-bit (default) */
  16. int height;
  17. int width;
  18. int bwidth; /* Default set by charlcd_alloc() */
  19. int hwidth; /* Default set by charlcd_alloc() */
  20. void *drvdata; /* Set by charlcd_alloc() */
  21. };
  22. struct charlcd_ops {
  23. /* Required */
  24. void (*write_cmd)(struct charlcd *lcd, int cmd);
  25. void (*write_data)(struct charlcd *lcd, int data);
  26. /* Optional */
  27. void (*write_cmd_raw4)(struct charlcd *lcd, int cmd); /* 4-bit only */
  28. void (*clear_fast)(struct charlcd *lcd);
  29. void (*backlight)(struct charlcd *lcd, int on);
  30. };
  31. struct charlcd *charlcd_alloc(unsigned int drvdata_size);
  32. int charlcd_register(struct charlcd *lcd);
  33. int charlcd_unregister(struct charlcd *lcd);
  34. void charlcd_poke(struct charlcd *lcd);