Guest User

Untitled

a guest
Oct 18th, 2017
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.91 KB | None | 0 0
  1. #include "stm8s.h"
  2.  
  3. #ifndef hd44780_h
  4. #define hd44780_h
  5.  
  6. #define MAX_WIDTH 20
  7. #define MAX_HEIGHT 4
  8.  
  9. typedef struct {
  10.   void (*delay_w)(void);
  11.   void (*set_data)(uint8_t);
  12.   void (*set_RS)(uint8_t);
  13.   void (*set_E)(uint8_t);
  14.   uint8_t width;
  15.   uint8_t height;
  16.   uint8_t cursor_x;
  17.   uint8_t cursor_y;
  18.   uint8_t data[MAX_WIDTH][MAX_HEIGHT];
  19. } hd44780_state_t;
  20.  
  21.  
  22. void hd44780_init(hd44780_state_t *state,
  23.                         uint8_t width,
  24.                         uint8_t height,
  25.                         void (*delay_w)(void),
  26.                         void (*set_data)(uint8_t),
  27.                         void (*set_RS)(uint8_t),
  28.                         void (*set_E)(uint8_t));
  29.  
  30. void hd44780_update(hd44780_state_t *state);
  31. void hd44780_putc(hd44780_state_t *state, uint8_t xpos, uint8_t ypos, char ch);
  32. void hd44780_putstring(hd44780_state_t *state, uint8_t xpos, uint8_t ypos, char *str);
  33.  
  34. #endif
Add Comment
Please, Sign In to add comment