mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 22:35:23 +03:00
Merge pull request #4261 from DanNixon/max7456_remove_duplicate_code
Remove duplicate code in MAX7456 driver
This commit is contained in:
commit
582e180e5f
2 changed files with 4 additions and 19 deletions
|
@ -349,9 +349,7 @@ uint8_t max7456GetRowsCount(void)
|
|||
|
||||
void max7456ReInit(void)
|
||||
{
|
||||
uint8_t maxScreenRows;
|
||||
uint8_t srdata = 0;
|
||||
uint16_t x;
|
||||
static bool firstInit = true;
|
||||
|
||||
ENABLE_MAX7456;
|
||||
|
@ -381,17 +379,14 @@ void max7456ReInit(void)
|
|||
|
||||
if (videoSignalReg & VIDEO_MODE_PAL) { //PAL
|
||||
maxScreenSize = VIDEO_BUFFER_CHARS_PAL;
|
||||
maxScreenRows = VIDEO_LINES_PAL;
|
||||
} else { // NTSC
|
||||
maxScreenSize = VIDEO_BUFFER_CHARS_NTSC;
|
||||
maxScreenRows = VIDEO_LINES_NTSC;
|
||||
}
|
||||
|
||||
// Set all rows to same charactor black/white level.
|
||||
|
||||
for (x = 0; x < maxScreenRows; x++) {
|
||||
max7456Send(MAX7456ADD_RB0 + x, BWBRIGHTNESS);
|
||||
}
|
||||
/* Set all rows to same charactor black/white level. */
|
||||
max7456Brightness(0, 2);
|
||||
/* Re-enable MAX7456 (last function call disables it) */
|
||||
ENABLE_MAX7456;
|
||||
|
||||
// Make sure the Max7456 is enabled
|
||||
max7456Send(MAX7456ADD_VM0, videoSignalReg);
|
||||
|
@ -402,7 +397,6 @@ void max7456ReInit(void)
|
|||
DISABLE_MAX7456;
|
||||
|
||||
// Clear shadow to force redraw all screen in non-dma mode.
|
||||
|
||||
memset(shadowBuffer, 0, maxScreenSize);
|
||||
if (firstInit)
|
||||
{
|
||||
|
|
|
@ -17,15 +17,6 @@
|
|||
|
||||
#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 */
|
||||
#define VIDEO_BUFFER_CHARS_NTSC 390
|
||||
#define VIDEO_BUFFER_CHARS_PAL 480
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue