main.c 710 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. this example was written to debug a problem with a display width, which
  3. is not multiple of 8.
  4. the display width is set to 102 for this purpose
  5. */
  6. #include "u8g2.h"
  7. #include <stdio.h>
  8. u8g2_t u8g2;
  9. int main(void)
  10. {
  11. u8g2_SetupBuffer_Utf8(&u8g2, U8G2_R0);
  12. u8g2_InitDisplay(&u8g2);
  13. u8g2_SetPowerSave(&u8g2, 0);
  14. u8g2_SetFont(&u8g2, u8g2_font_6x13_tf);
  15. u8g2_SetFontDirection(&u8g2, 0);
  16. u8g2_FirstPage(&u8g2);
  17. do
  18. {
  19. u8g2_DrawHLine(&u8g2, u8g2_GetDisplayWidth(&u8g2)-1, 2, 4);
  20. u8g2_DrawStr(&u8g2, 10, 20, "Clip");
  21. } while( u8g2_NextPage(&u8g2) );
  22. utf8_show();
  23. printf("DisplayWidth = %d\n", u8g2_GetDisplayWidth(&u8g2));
  24. return 0;
  25. }