sd1306.h 888 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef _SD1306_H_
  2. #define _SD1306_H_
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6. #define OLED_HEIGHT _u(32)
  7. #define OLED_WIDTH _u(128)
  8. #define OLED_PAGE_HEIGHT _u(8)
  9. #define OLED_NUM_PAGES OLED_HEIGHT / OLED_PAGE_HEIGHT
  10. #define OLED_BUF_LEN (OLED_NUM_PAGES * OLED_WIDTH)
  11. struct render_area {
  12. uint8_t start_col;
  13. uint8_t end_col;
  14. uint8_t start_page;
  15. uint8_t end_page;
  16. int buflen;
  17. };
  18. void fill(uint8_t buf[], uint8_t fill);
  19. void fill_page(uint8_t *buf, uint8_t fill, uint8_t page);
  20. void print_buf_page(uint8_t buf[], uint8_t page);
  21. void print_buf_pages(uint8_t buf[]);
  22. void print_buf_area(uint8_t *buf, struct render_area *area);
  23. void calc_render_area_buflen(struct render_area *area);
  24. void oled_send_cmd(uint8_t cmd);
  25. void oled_send_buf(uint8_t buf[], int buflen);
  26. void oled_init(void);
  27. void render(uint8_t *buf, struct render_area *area);
  28. #endif