creator_hd44780_direct.c 620 B

12345678910111213141516171819202122232425262728
  1. #include <stddef.h>
  2. #include <stdint.h>
  3. #include <stdbool.h>
  4. #include <cx/chlcd.h>
  5. chlcd_error_t chlcd_hd44780_direct_create(
  6. chlcd_display_t *self,
  7. chlcd_hd44780_direct_connector_t *connector,
  8. chlcd_size_t width,
  9. chlcd_size_t height
  10. ) {
  11. if (connector == NULL) {
  12. return CHLCD_BAD_ARGUMENT;
  13. }
  14. if (width == 0 || height == 0) {
  15. return CHLCD_BAD_ARGUMENT;
  16. }
  17. self->width = width;
  18. self->height = height;
  19. self->sender = chlcd_hd44780_direct_sender;
  20. self->decoder = chlcd_hd44780_decoder;
  21. self->connector = (void *) connector;
  22. return CHLCD_SUCCESS;
  23. }