mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
Remove duplicate code in MAX7456 driver
Removes some duplicate code for handling black and white brightness on initialisation.
This commit is contained in:
parent
ceb6f70aa9
commit
932caac42b
2 changed files with 4 additions and 19 deletions
|
@ -349,9 +349,7 @@ uint8_t max7456GetRowsCount(void)
|
||||||
|
|
||||||
void max7456ReInit(void)
|
void max7456ReInit(void)
|
||||||
{
|
{
|
||||||
uint8_t maxScreenRows;
|
|
||||||
uint8_t srdata = 0;
|
uint8_t srdata = 0;
|
||||||
uint16_t x;
|
|
||||||
static bool firstInit = true;
|
static bool firstInit = true;
|
||||||
|
|
||||||
ENABLE_MAX7456;
|
ENABLE_MAX7456;
|
||||||
|
@ -381,17 +379,14 @@ void max7456ReInit(void)
|
||||||
|
|
||||||
if (videoSignalReg & VIDEO_MODE_PAL) { //PAL
|
if (videoSignalReg & VIDEO_MODE_PAL) { //PAL
|
||||||
maxScreenSize = VIDEO_BUFFER_CHARS_PAL;
|
maxScreenSize = VIDEO_BUFFER_CHARS_PAL;
|
||||||
maxScreenRows = VIDEO_LINES_PAL;
|
|
||||||
} else { // NTSC
|
} else { // NTSC
|
||||||
maxScreenSize = VIDEO_BUFFER_CHARS_NTSC;
|
maxScreenSize = VIDEO_BUFFER_CHARS_NTSC;
|
||||||
maxScreenRows = VIDEO_LINES_NTSC;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set all rows to same charactor black/white level.
|
/* Set all rows to same charactor black/white level. */
|
||||||
|
max7456Brightness(0, 2);
|
||||||
for (x = 0; x < maxScreenRows; x++) {
|
/* Re-enable MAX7456 (last function call disables it) */
|
||||||
max7456Send(MAX7456ADD_RB0 + x, BWBRIGHTNESS);
|
ENABLE_MAX7456;
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure the Max7456 is enabled
|
// Make sure the Max7456 is enabled
|
||||||
max7456Send(MAX7456ADD_VM0, videoSignalReg);
|
max7456Send(MAX7456ADD_VM0, videoSignalReg);
|
||||||
|
@ -402,7 +397,6 @@ void max7456ReInit(void)
|
||||||
DISABLE_MAX7456;
|
DISABLE_MAX7456;
|
||||||
|
|
||||||
// Clear shadow to force redraw all screen in non-dma mode.
|
// Clear shadow to force redraw all screen in non-dma mode.
|
||||||
|
|
||||||
memset(shadowBuffer, 0, maxScreenSize);
|
memset(shadowBuffer, 0, maxScreenSize);
|
||||||
if (firstInit)
|
if (firstInit)
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,15 +17,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef WHITEBRIGHTNESS
|
|
||||||
#define WHITEBRIGHTNESS 0x01
|
|
||||||
#endif
|
|
||||||
#ifndef BLACKBRIGHTNESS
|
|
||||||
#define BLACKBRIGHTNESS 0x00
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define BWBRIGHTNESS ((BLACKBRIGHTNESS << 2) | WHITEBRIGHTNESS)
|
|
||||||
|
|
||||||
/** PAL or NTSC, value is number of chars total */
|
/** PAL or NTSC, value is number of chars total */
|
||||||
#define VIDEO_BUFFER_CHARS_NTSC 390
|
#define VIDEO_BUFFER_CHARS_NTSC 390
|
||||||
#define VIDEO_BUFFER_CHARS_PAL 480
|
#define VIDEO_BUFFER_CHARS_PAL 480
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue