Merge pull request #11939 from blckmn/flash-fix
[betaflight.git] / src / main / drivers / max7456.h
blobc6de2c990cd0541461cd42e80b6798054320ecb0
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 #pragma once
23 #include <stdint.h>
25 #include "drivers/display.h"
27 /** PAL or NTSC, value is number of chars total */
28 #define VIDEO_BUFFER_CHARS_NTSC 390
29 #define VIDEO_BUFFER_CHARS_PAL 480
30 #define VIDEO_LINES_NTSC 13
31 #define VIDEO_LINES_PAL 16
33 typedef enum {
34 // IO defined and MAX7456 was detected
35 MAX7456_INIT_OK = 0,
36 // IO defined, but MAX7456 could not be detected (maybe not yet
37 // powered on)
38 MAX7456_INIT_NOT_FOUND = -1,
39 // No MAX7456 IO defined, which means either the we don't have it or
40 // it's not properly configured
41 MAX7456_INIT_NOT_CONFIGURED = -2,
42 } max7456InitStatus_e;
44 extern uint16_t maxScreenSize;
45 struct vcdProfile_s;
46 void max7456HardwareReset(void);
47 struct max7456Config_s;
48 void max7456PreInit(const struct max7456Config_s *max7456Config);
49 max7456InitStatus_e max7456Init(const struct max7456Config_s *max7456Config, const struct vcdProfile_s *vcdProfile, bool cpuOverclock);
50 void max7456Invert(bool invert);
51 void max7456Brightness(uint8_t black, uint8_t white);
52 bool max7456ReInitIfRequired(bool forceStallCheck);
53 bool max7456DrawScreen(void);
54 bool max7456WriteNvm(uint8_t char_address, const uint8_t *font_data);
55 uint8_t max7456GetRowsCount(void);
56 void max7456Write(uint8_t x, uint8_t y, const char *text);
57 void max7456WriteChar(uint8_t x, uint8_t y, uint8_t c);
58 void max7456ClearScreen(void);
59 void max7456RefreshAll(void);
60 bool max7456DmaInProgress(void);
61 bool max7456BuffersSynced(void);
62 bool max7456LayerSupported(displayPortLayer_e layer);
63 bool max7456LayerSelect(displayPortLayer_e layer);
64 bool max7456LayerCopy(displayPortLayer_e destLayer, displayPortLayer_e sourceLayer);
65 bool max7456IsDeviceDetected(void);
66 void max7456SetBackgroundType(displayPortBackground_e backgroundType);