Blackbox device type 'file' (SITL) considered working when file handler is available
[inav.git] / src / main / io / displayport_oled.c
blobbc132e524b69b0731e83c4ecb5dca4b8471ea27c
1 /*
2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
18 #include <stdbool.h>
19 #include <stdint.h>
21 #include "platform.h"
23 #include "common/utils.h"
25 #include "drivers/display.h"
26 #include "drivers/display_ug2864hsweg01.h"
28 static displayPort_t oledDisplayPort;
30 static int oledGrab(displayPort_t *displayPort)
32 UNUSED(displayPort);
33 return 0;
36 static int oledRelease(displayPort_t *displayPort)
38 UNUSED(displayPort);
39 return 0;
42 static int oledClearScreen(displayPort_t *displayPort)
44 UNUSED(displayPort);
45 i2c_OLED_clear_display_quick();
46 return 0;
49 static int oledDrawScreen(displayPort_t *displayPort)
51 UNUSED(displayPort);
52 return 0;
55 static int oledScreenSize(const displayPort_t *displayPort)
57 return displayPort->rows * displayPort->cols;
60 static int oledWriteString(displayPort_t *displayPort, uint8_t x, uint8_t y, const char *s, textAttributes_t attr)
62 UNUSED(displayPort);
63 UNUSED(attr);
64 i2c_OLED_set_xy(x, y);
65 i2c_OLED_send_string(s);
66 return 0;
69 static int oledWriteChar(displayPort_t *displayPort, uint8_t x, uint8_t y, uint16_t c, textAttributes_t attr)
71 UNUSED(displayPort);
72 UNUSED(attr);
73 i2c_OLED_set_xy(x, y);
74 i2c_OLED_send_char(c);
75 return 0;
78 static bool oledIsTransferInProgress(const displayPort_t *displayPort)
80 UNUSED(displayPort);
81 return false;
84 static int oledHeartbeat(displayPort_t *displayPort)
86 UNUSED(displayPort);
87 return 0;
90 static void oledResync(displayPort_t *displayPort)
92 UNUSED(displayPort);
95 static uint32_t oledTxBytesFree(const displayPort_t *displayPort)
97 UNUSED(displayPort);
98 return UINT32_MAX;
101 static const displayPortVTable_t oledVTable = {
102 .grab = oledGrab,
103 .release = oledRelease,
104 .clearScreen = oledClearScreen,
105 .drawScreen = oledDrawScreen,
106 .screenSize = oledScreenSize,
107 .writeString = oledWriteString,
108 .writeChar = oledWriteChar,
109 .readChar = NULL,
110 .isTransferInProgress = oledIsTransferInProgress,
111 .heartbeat = oledHeartbeat,
112 .resync = oledResync,
113 .txBytesFree = oledTxBytesFree,
114 .supportedTextAttributes = NULL,
117 displayPort_t *displayPortOledInit(void)
119 displayInit(&oledDisplayPort, &oledVTable);
120 oledDisplayPort.rows = SCREEN_CHARACTER_ROW_COUNT;
121 oledDisplayPort.cols = SCREEN_CHARACTER_COLUMN_COUNT;
122 return &oledDisplayPort;