Subversion Repositories Projects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
 
2
#ifndef ArduCam_Max7456_h
3
#define ArduCam_Max7456_h
4
 
5
/******* FROM DATASHEET *******/
6
 
7
#define MAX7456_SELECT 6//SS
8
#define MAX7456_VSYNC 2//INT0
9
 
10
#define NTSC 0
11
#define PAL 1
12
#define MAX7456_MODE_MASK_PAL 0x40 //PAL mask 01000000
13
#define MAX7456_CENTER_PAL 0x8
14
 
15
#define MAX7456_MODE_MASK_NTCS 0x00 //NTSC mask 00000000 ("|" will do nothing)
16
#define MAX7456_CENTER_NTSC 0x6
17
 
18
//MAX7456 reg read addresses
19
#define MAX7456_OSDBL_reg_read 0xec //black level
20
#define MAX7456_STAT_reg_read  0xa0 //0xa[X] Status
21
 
22
//MAX7456 reg write addresses
23
#define MAX7456_VM0_reg   0x00
24
#define MAX7456_VM1_reg   0x01
25
#define MAX7456_DMM_reg   0x04
26
#define MAX7456_DMAH_reg  0x05
27
#define MAX7456_DMAL_reg  0x06
28
#define MAX7456_DMDI_reg  0x07
29
#define MAX7456_OSDM_reg  0x0c //not used. Is to set mix
30
#define MAX7456_OSDBL_reg 0x6c //black level
31
 
32
//MAX7456 reg write addresses to recording NVM process
33
#define MAX7456_CMM_reg   0x08
34
#define MAX7456_CMAH_reg  0x09
35
#define MAX7456_CMAL_reg  0x0a
36
#define MAX7456_CMDI_reg  0x0b
37
 
38
//DMM commands
39
#define MAX7456_CLEAR_display 0x04
40
#define MAX7456_CLEAR_display_vert 0x06
41
 
42
#define MAX7456_INCREMENT_auto 0x03
43
#define MAX7456_SETBG_local 0x20 //00100000 force local BG to defined brightness level VM1[6:4]
44
 
45
#define MAX7456_END_string 0xff
46
 
47
//VM0 commands mixed with mode NTSC or PAL mode
48
#define MAX7456_ENABLE_display_vert 0x0c //mask with NTSC/PAL
49
#define MAX7456_RESET 0x02 //mask with NTSC/PAL
50
#define MAX7456_DISABLE_display 0x00 //mask with NTSC/PAL
51
 
52
//VM0 command modifiers
53
#define MAX7456_SYNC_autosync 0x10
54
#define MAX7456_SYNC_internal 0x30
55
#define MAX7456_SYNC_external 0x20
56
//VM1 command modifiers
57
#define MAX7456_WHITE_level_80 0x03
58
#define MAX7456_WHITE_level_90 0x02
59
#define MAX7456_WHITE_level_100 0x01
60
#define MAX7456_WHITE_level_120 0x00
61
 
62
#define NVM_ram_size 0x36
63
#define WRITE_nvr 0xa0
64
#define STATUS_reg_nvr_busy 0x20
65
 
66
//If PAL
67
#ifdef isPAL
68
  #define MAX7456_screen_size 480 //16x30
69
  #define MAX7456_screen_rows 15
70
#else
71
  #define MAX7456_screen_size 390 //13x30
72
  #define MAX7456_screen_rows 12
73
#endif
74
 
75
//------------------ the OSD class -----------------------------------------------
76
 
77
class OSD: public BetterStream
78
{
79
  public:
80
    OSD(void);
81
    void init(void);
82
    void clear(void);
83
    void plug(void);
84
    void setPanel(uint8_t start_col, uint8_t start_row);
85
    void openPanel(void);
86
    void closePanel(void);
87
    void control(uint8_t ctrl);
88
    void detectMode(void);
89
    void setMode(int mode);
90
    void openSingle(uint8_t x, uint8_t y);
91
    int getMode(void);
92
    int getCenter(void);
93
    virtual int     available(void);
94
    virtual int     read(void);
95
    virtual int     peek(void);
96
    virtual void    flush(void);
97
    virtual size_t write(uint8_t c);
98
    void write_NVM(int font_count, uint8_t *character_bitmap);
99
    using BetterStream::write;
100
  private:
101
    uint8_t start_col, start_row, col, row, video_mode, video_center;
102
};
103
 
104
#endif
105