Merge pull request #10558 from iNavFlight/MrD_Correct-comments-on-OSD-symbols
[inav.git] / src / main / drivers / max7456.h
blob38ddd650c3804425614d91d15ff0ec7d294ee627
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 #pragma once
20 #include <stdbool.h>
22 #include "drivers/osd.h"
24 #ifndef MAX7456_WHITEBRIGHTNESS
25 #define MAX7456_WHITEBRIGHTNESS 0x01
26 #endif
27 #ifndef MAX7456_BLACKBRIGHTNESS
28 #define MAX7456_BLACKBRIGHTNESS 0x00
29 #endif
31 #define MAX7456_BWBRIGHTNESS ((MAX7456_BLACKBRIGHTNESS << 2) | MAX7456_WHITEBRIGHTNESS)
33 #define MAX7456_CHARS_PER_LINE 30
35 /** PAL or NTSC, value is number of chars total */
36 #define MAX7456_LINES_NTSC 13
37 #define MAX7456_LINES_PAL 16
38 #define MAX7456_BUFFER_CHARS_NTSC (MAX7456_LINES_NTSC * MAX7456_CHARS_PER_LINE)
39 #define MAX7456_BUFFER_CHARS_PAL (MAX7456_LINES_PAL * MAX7456_CHARS_PER_LINE)
41 enum VIDEO_TYPES { AUTO = 0, PAL, NTSC };
43 #define MAX7456_MODE_INVERT (1 << 3)
44 #define MAX7456_MODE_BLINK (1 << 4)
45 #define MAX7456_MODE_SOLID_BG (1 << 5)
47 void max7456Init(const videoSystem_e videoSystem);
48 void max7456Update(void);
49 void max7456ReadNvm(uint16_t char_address, osdCharacter_t *chr);
50 void max7456WriteNvm(uint16_t char_address, const osdCharacter_t *chr);
51 uint16_t max7456GetScreenSize(void);
52 uint8_t max7456GetRowsCount(void);
53 void max7456Write(uint8_t x, uint8_t y, const char *buff, uint8_t mode);
54 void max7456WriteChar(uint8_t x, uint8_t y, uint16_t c, uint8_t mode);
55 bool max7456ReadChar(uint8_t x, uint8_t y, uint16_t *c, uint8_t *mode);
56 void max7456ClearScreen(void);
57 void max7456RefreshAll(void);
58 uint8_t* max7456GetScreenBuffer(void);