[4.4.2] Remove 15 m/s limit on estimated vario (#12788)
[betaflight.git] / src / main / io / displayport_oled.c
blob96087c95b77870449dbc32ffb4c82c3328955c08
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #include <stdbool.h>
22 #include <stdint.h>
24 #include "platform.h"
26 #include "common/utils.h"
28 #include "drivers/display.h"
29 #include "drivers/display_ug2864hsweg01.h"
31 static displayPort_t oledDisplayPort;
33 static int oledGrab(displayPort_t *displayPort)
35 UNUSED(displayPort);
36 return 0;
39 static int oledRelease(displayPort_t *displayPort)
41 UNUSED(displayPort);
42 return 0;
45 static int oledClearScreen(displayPort_t *displayPort, displayClearOption_e options)
47 UNUSED(options);
49 i2c_OLED_clear_display_quick(displayPort->device);
50 return 0;
53 static bool oledDrawScreen(displayPort_t *displayPort)
55 UNUSED(displayPort);
56 return 0;
59 static int oledScreenSize(const displayPort_t *displayPort)
61 return displayPort->rows * displayPort->cols;
64 static int oledWriteString(displayPort_t *displayPort, uint8_t x, uint8_t y, uint8_t attr, const char *s)
66 UNUSED(attr);
68 i2c_OLED_set_xy(displayPort->device, x, y);
69 i2c_OLED_send_string(displayPort->device, s);
70 return 0;
73 static int oledWriteChar(displayPort_t *displayPort, uint8_t x, uint8_t y, uint8_t attr, uint8_t c)
75 UNUSED(attr);
77 i2c_OLED_set_xy(displayPort->device, x, y);
78 i2c_OLED_send_char(displayPort->device, c);
79 return 0;
82 static bool oledIsTransferInProgress(const displayPort_t *displayPort)
84 UNUSED(displayPort);
85 return false;
88 static bool oledIsSynced(const displayPort_t *displayPort)
90 UNUSED(displayPort);
91 return true;
94 static int oledHeartbeat(displayPort_t *displayPort)
96 UNUSED(displayPort);
97 return 0;
100 static void oledRedraw(displayPort_t *displayPort)
102 UNUSED(displayPort);
105 static uint32_t oledTxBytesFree(const displayPort_t *displayPort)
107 UNUSED(displayPort);
108 return UINT32_MAX;
111 static const displayPortVTable_t oledVTable = {
112 .grab = oledGrab,
113 .release = oledRelease,
114 .clearScreen = oledClearScreen,
115 .drawScreen = oledDrawScreen,
116 .screenSize = oledScreenSize,
117 .writeString = oledWriteString,
118 .writeChar = oledWriteChar,
119 .isTransferInProgress = oledIsTransferInProgress,
120 .heartbeat = oledHeartbeat,
121 .redraw = oledRedraw,
122 .isSynced = oledIsSynced,
123 .txBytesFree = oledTxBytesFree,
124 .layerSupported = NULL,
125 .layerSelect = NULL,
126 .layerCopy = NULL,
129 displayPort_t *displayPortOledInit(void *device)
131 oledDisplayPort.device = device;
132 displayInit(&oledDisplayPort, &oledVTable, DISPLAYPORT_DEVICE_TYPE_OLED);
133 oledDisplayPort.rows = SCREEN_CHARACTER_ROW_COUNT;
134 oledDisplayPort.cols = SCREEN_CHARACTER_COLUMN_COUNT;
135 return &oledDisplayPort;