1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00
betaflight/src/main/drivers/max7456.h
Alberto García Hierro db0e1e7788 MAX7456: Support delayed initialization
This allows the init sequence to correctly determine and store that
the selected display device after autoselection was MAX7456 but it
hasn't been yet initialized, and allows us to properly transmit this
information to the configurator.

This also lets the display subsystem initialize the MAX7456 at any
time, so for example in flight controllers that require battery power
in order to turn on the MAX7456, the user can plug the battery after
powering the system up via USB and the MAX7456 will be detected shortly
after without having to reboot.
2020-06-25 11:51:12 +01:00

64 lines
2.4 KiB
C

/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <stdint.h>
#include "drivers/display.h"
/** PAL or NTSC, value is number of chars total */
#define VIDEO_BUFFER_CHARS_NTSC 390
#define VIDEO_BUFFER_CHARS_PAL 480
#define VIDEO_LINES_NTSC 13
#define VIDEO_LINES_PAL 16
typedef enum {
// IO defined and MAX7456 was detected
MAX7456_INIT_OK = 0,
// IO defined, but MAX7456 could not be detected (maybe not yet
// powered on)
MAX7456_INIT_NOT_FOUND = -1,
// No MAX7456 IO defined, which means either the we don't have it or
// it's not properly configured
MAX7456_INIT_NOT_CONFIGURED = -2,
} max7456InitStatus_e;
extern uint16_t maxScreenSize;
struct vcdProfile_s;
void max7456HardwareReset(void);
struct max7456Config_s;
void max7456PreInit(const struct max7456Config_s *max7456Config);
max7456InitStatus_e max7456Init(const struct max7456Config_s *max7456Config, const struct vcdProfile_s *vcdProfile, bool cpuOverclock);
void max7456Invert(bool invert);
void max7456Brightness(uint8_t black, uint8_t white);
void max7456DrawScreen(void);
bool max7456WriteNvm(uint8_t char_address, const uint8_t *font_data);
uint8_t max7456GetRowsCount(void);
void max7456Write(uint8_t x, uint8_t y, const char *buff);
void max7456WriteChar(uint8_t x, uint8_t y, uint8_t c);
void max7456ClearScreen(void);
void max7456RefreshAll(void);
bool max7456DmaInProgress(void);
bool max7456BuffersSynced(void);
bool max7456LayerSupported(displayPortLayer_e layer);
bool max7456LayerSelect(displayPortLayer_e layer);
bool max7456LayerCopy(displayPortLayer_e destLayer, displayPortLayer_e sourceLayer);
bool max7456IsDeviceDetected(void);