Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. // IN OLED.C LIB
  2. void oled_DeleteLastChar(FontDef Font, OLED_COLOR BackgroundColor) {
  3. int index = OLED.CurrentX - Font.FontWidth;
  4. int index2 = OLED.CurrentY - Font.FontHeight;
  5. if (index < 0) {
  6. if (index2 < 0) return;
  7. else index = 126;
  8. } else index2 = OLED.CurrentY;
  9. oled_SetCursor(index, index2);
  10. for (int i = 0; i < Font.FontHeight; i++) {
  11. for (int j = 0; j < Font.FontWidth; j++) {
  12. oled_DrawPixel(OLED.CurrentX + j, (OLED.CurrentY + i), (OLED_COLOR) BackgroundColor);
  13. }
  14. }
  15. }
  16.  
  17. void oled_GotoNextLine(FontDef Font) {
  18. oled_SetCursor(0, OLED.CurrentY + Font.FontHeight);
  19. }
  20.  
  21. void oled_MoveDown(FontDef Font) {
  22. oled_SetCursor(OLED.CurrentX, OLED.CurrentY + Font.FontHeight);
  23. }
  24.  
  25. void oled_MoveUp(FontDef Font) {
  26. int index = OLED.CurrentY - Font.FontHeight;
  27. if (index < 0) return;
  28. oled_SetCursor(0, index);
  29. }
  30.  
  31. void oled_MoveRight(FontDef Font) {
  32. oled_SetCursor(OLED.CurrentX + Font.FontWidth, OLED.CurrentY);
  33. }
  34.  
  35. void oled_MoveLeft(FontDef Font) {
  36. int index = OLED.CurrentX - Font.FontWidth;
  37. if (index < 0) return;
  38. oled_SetCursor(index, OLED.CurrentY);
  39. }
  40.  
  41. void oled_GotoLine(FontDef Font, int lineNumber) {
  42. if (lineNumber < 0) return;
  43. oled_SetCursor(0, lineNumber * Font.FontHeight);
  44. }
  45.  
  46. uint16_t oled_GetCursorX() {
  47. return OLED.CurrentX;
  48. }
  49.  
  50. uint16_t oled_GetCursorY() {
  51. return OLED.CurrentY;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement