mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 16:25:31 +03:00
Improved OSD & displayPort initialisation. Allowed nested screen grabbing
This commit is contained in:
parent
9a62b04699
commit
7c8d1967d0
9 changed files with 153 additions and 124 deletions
|
@ -37,6 +37,122 @@
|
|||
#include "max7456.h"
|
||||
#include "max7456_symbols.h"
|
||||
|
||||
|
||||
|
||||
//MAX7456 opcodes
|
||||
#define DMM_REG 0x04
|
||||
#define DMAH_REG 0x05
|
||||
#define DMAL_REG 0x06
|
||||
#define DMDI_REG 0x07
|
||||
#define VM0_REG 0x00
|
||||
#define VM1_REG 0x01
|
||||
|
||||
// video mode register 0 bits
|
||||
#define VIDEO_BUFFER_DISABLE 0x01
|
||||
#define MAX7456_RESET 0x02
|
||||
#define VERTICAL_SYNC_NEXT_VSYNC 0x04
|
||||
#define OSD_ENABLE 0x08
|
||||
#define SYNC_MODE_AUTO 0x00
|
||||
#define SYNC_MODE_INTERNAL 0x30
|
||||
#define SYNC_MODE_EXTERNAL 0x20
|
||||
#define VIDEO_MODE_PAL 0x40
|
||||
#define VIDEO_MODE_NTSC 0x00
|
||||
|
||||
// video mode register 1 bits
|
||||
|
||||
|
||||
// duty cycle is on_off
|
||||
#define BLINK_DUTY_CYCLE_50_50 0x00
|
||||
#define BLINK_DUTY_CYCLE_33_66 0x01
|
||||
#define BLINK_DUTY_CYCLE_25_75 0x02
|
||||
#define BLINK_DUTY_CYCLE_75_25 0x03
|
||||
|
||||
// blinking time
|
||||
#define BLINK_TIME_0 0x00
|
||||
#define BLINK_TIME_1 0x04
|
||||
#define BLINK_TIME_2 0x08
|
||||
#define BLINK_TIME_3 0x0C
|
||||
|
||||
// background mode brightness (percent)
|
||||
#define BACKGROUND_BRIGHTNESS_0 0x00
|
||||
#define BACKGROUND_BRIGHTNESS_7 0x01
|
||||
#define BACKGROUND_BRIGHTNESS_14 0x02
|
||||
#define BACKGROUND_BRIGHTNESS_21 0x03
|
||||
#define BACKGROUND_BRIGHTNESS_28 0x04
|
||||
#define BACKGROUND_BRIGHTNESS_35 0x05
|
||||
#define BACKGROUND_BRIGHTNESS_42 0x06
|
||||
#define BACKGROUND_BRIGHTNESS_49 0x07
|
||||
|
||||
#define BACKGROUND_MODE_GRAY 0x40
|
||||
|
||||
//MAX7456 commands
|
||||
#define CLEAR_DISPLAY 0x04
|
||||
#define CLEAR_DISPLAY_VERT 0x06
|
||||
#define END_STRING 0xff
|
||||
|
||||
|
||||
#define MAX7456ADD_VM0 0x00 //0b0011100// 00 // 00 ,0011100
|
||||
#define MAX7456ADD_VM1 0x01
|
||||
#define MAX7456ADD_HOS 0x02
|
||||
#define MAX7456ADD_VOS 0x03
|
||||
#define MAX7456ADD_DMM 0x04
|
||||
#define MAX7456ADD_DMAH 0x05
|
||||
#define MAX7456ADD_DMAL 0x06
|
||||
#define MAX7456ADD_DMDI 0x07
|
||||
#define MAX7456ADD_CMM 0x08
|
||||
#define MAX7456ADD_CMAH 0x09
|
||||
#define MAX7456ADD_CMAL 0x0a
|
||||
#define MAX7456ADD_CMDI 0x0b
|
||||
#define MAX7456ADD_OSDM 0x0c
|
||||
#define MAX7456ADD_RB0 0x10
|
||||
#define MAX7456ADD_RB1 0x11
|
||||
#define MAX7456ADD_RB2 0x12
|
||||
#define MAX7456ADD_RB3 0x13
|
||||
#define MAX7456ADD_RB4 0x14
|
||||
#define MAX7456ADD_RB5 0x15
|
||||
#define MAX7456ADD_RB6 0x16
|
||||
#define MAX7456ADD_RB7 0x17
|
||||
#define MAX7456ADD_RB8 0x18
|
||||
#define MAX7456ADD_RB9 0x19
|
||||
#define MAX7456ADD_RB10 0x1a
|
||||
#define MAX7456ADD_RB11 0x1b
|
||||
#define MAX7456ADD_RB12 0x1c
|
||||
#define MAX7456ADD_RB13 0x1d
|
||||
#define MAX7456ADD_RB14 0x1e
|
||||
#define MAX7456ADD_RB15 0x1f
|
||||
#define MAX7456ADD_OSDBL 0x6c
|
||||
#define MAX7456ADD_STAT 0xA0
|
||||
|
||||
#define NVM_RAM_SIZE 54
|
||||
#define WRITE_NVR 0xA0
|
||||
#define STATUS_REG_NVR_BUSY 0x20
|
||||
|
||||
/** Line multiples, for convenience & one less op at runtime **/
|
||||
#define LINE 30
|
||||
#define LINE01 0
|
||||
#define LINE02 30
|
||||
#define LINE03 60
|
||||
#define LINE04 90
|
||||
#define LINE05 120
|
||||
#define LINE06 150
|
||||
#define LINE07 180
|
||||
#define LINE08 210
|
||||
#define LINE09 240
|
||||
#define LINE10 270
|
||||
#define LINE11 300
|
||||
#define LINE12 330
|
||||
#define LINE13 360
|
||||
#define LINE14 390
|
||||
#define LINE15 420
|
||||
#define LINE16 450
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//on shared SPI buss we want to change clock for OSD chip and restore for other devices
|
||||
#ifdef MAX7456_SPI_CLK
|
||||
#define ENABLE_MAX7456 {spiSetDivisor(MAX7456_SPI_INSTANCE, MAX7456_SPI_CLK);IOLo(max7456CsPin);}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue