Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // IN OLED.C LIB
- void oled_DeleteLastChar(FontDef Font, OLED_COLOR BackgroundColor) {
- int index = OLED.CurrentX - Font.FontWidth;
- int index2 = OLED.CurrentY - Font.FontHeight;
- if (index < 0) {
- if (index2 < 0) return;
- else index = 126;
- } else index2 = OLED.CurrentY;
- oled_SetCursor(index, index2);
- for (int i = 0; i < Font.FontHeight; i++) {
- for (int j = 0; j < Font.FontWidth; j++) {
- oled_DrawPixel(OLED.CurrentX + j, (OLED.CurrentY + i), (OLED_COLOR) BackgroundColor);
- }
- }
- }
- void oled_GotoNextLine(FontDef Font) {
- oled_SetCursor(0, OLED.CurrentY + Font.FontHeight);
- }
- void oled_MoveDown(FontDef Font) {
- oled_SetCursor(OLED.CurrentX, OLED.CurrentY + Font.FontHeight);
- }
- void oled_MoveUp(FontDef Font) {
- int index = OLED.CurrentY - Font.FontHeight;
- if (index < 0) return;
- oled_SetCursor(0, index);
- }
- void oled_MoveRight(FontDef Font) {
- oled_SetCursor(OLED.CurrentX + Font.FontWidth, OLED.CurrentY);
- }
- void oled_MoveLeft(FontDef Font) {
- int index = OLED.CurrentX - Font.FontWidth;
- if (index < 0) return;
- oled_SetCursor(index, OLED.CurrentY);
- }
- void oled_GotoLine(FontDef Font, int lineNumber) {
- if (lineNumber < 0) return;
- oled_SetCursor(0, lineNumber * Font.FontHeight);
- }
- uint16_t oled_GetCursorX() {
- return OLED.CurrentX;
- }
- uint16_t oled_GetCursorY() {
- return OLED.CurrentY;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement