Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1702 | - | 1 | #ifndef ArduCam_Max7456_h |
2 | #define ArduCam_Max7456_h |
||
3 | |||
4 | /******* FROM DATASHEET *******/ |
||
5 | |||
6 | //#define isPAL |
||
7 | #define MAX7456_SELECT 6//SS |
||
8 | #define MAX7456_VSYNC 2//INT0 |
||
9 | |||
10 | #ifdef isPAL |
||
11 | #define MAX7456_MODE 0x40 //PAL mask 10000000 |
||
12 | #else |
||
13 | #define MAX7456_MODE 0x00 //NTSC mask 00000000 ("|" will do nothing) |
||
14 | #endif |
||
15 | |||
16 | //MAX7456 reg write addresses |
||
17 | #define MAX7456_VM0_reg 0x00 |
||
18 | #define MAX7456_VM1_reg 0x01 |
||
19 | #define MAX7456_DMM_reg 0x04 |
||
20 | #define MAX7456_DMAH_reg 0x05 |
||
21 | #define MAX7456_DMAL_reg 0x06 |
||
22 | #define MAX7456_DMDI_reg 0x07 |
||
23 | #define MAX7456_OSDM_reg 0x0c //not used. Is to set mix |
||
24 | |||
25 | //MAX7456 reg write addresses to recording NVM process |
||
26 | #define MAX7456_CMM_reg 0x08 |
||
27 | #define MAX7456_CMAH_reg 0x09 |
||
28 | #define MAX7456_CMAL_reg 0x0a |
||
29 | #define MAX7456_CMDI_reg 0x0b |
||
30 | #define MAX7456_STAT_reg 0xa0 //0xa[X] |
||
31 | |||
32 | //DMM commands |
||
33 | #define MAX7456_CLEAR_display 0x04 |
||
34 | #define MAX7456_CLEAR_display_vert 0x06 |
||
35 | |||
36 | #define MAX7456_INCREMENT_auto 0x03 |
||
37 | #define MAX7456_SETBG_local 0x20 //00100000 force local BG to defined brightness level VM1[6:4] |
||
38 | |||
39 | #define MAX7456_END_string 0xff |
||
40 | |||
41 | //VM0 commands mixed with mode NTSC or PAL mode |
||
42 | #define MAX7456_ENABLE_display (0x08 | MAX7456_MODE) //Don't used. Bad sync. 00001000 |
||
43 | #define MAX7456_ENABLE_display_vert (0x0c | MAX7456_MODE) //Much better. Good sync 00001100 |
||
44 | #define MAX7456_RESET (0x02 | MAX7456_MODE) |
||
45 | #define MAX7456_DISABLE_display (0x00 | MAX7456_MODE) |
||
46 | //VM0 command modifiers |
||
47 | #define MAX7456_SYNC_autosync 0x10 |
||
48 | #define MAX7456_SYNC_internal 0x30 |
||
49 | #define MAX7456_SYNC_external 0x20 |
||
50 | //VM1 command modifiers |
||
51 | #define MAX7456_WHITE_level_80 0x03 |
||
52 | #define MAX7456_WHITE_level_90 0x02 |
||
53 | #define MAX7456_WHITE_level_100 0x01 |
||
54 | #define MAX7456_WHITE_level_120 0x00 |
||
55 | |||
56 | //If PAL |
||
57 | #ifdef isPAL |
||
58 | #define MAX7456_screen_size 480 |
||
59 | #define MAX7456_screen_rows 15 |
||
60 | #else |
||
61 | #define MAX7456_screen_size 390 |
||
62 | #define MAX7456_screen_rows 13 |
||
63 | #endif |
||
64 | |||
65 | //------------------ the OSD class ----------------------------------------------- |
||
66 | |||
67 | class OSD: public BetterStream |
||
68 | { |
||
69 | public: |
||
70 | OSD(void); |
||
71 | void init(void); |
||
72 | void clear(void); |
||
73 | void plug(void); |
||
74 | void setPanel(uint8_t start_col, uint8_t start_row); |
||
75 | void openPanel(void); |
||
76 | void closePanel(void); |
||
77 | void control(uint8_t ctrl); |
||
78 | virtual int available(void); |
||
79 | virtual int read(void); |
||
80 | virtual int peek(void); |
||
81 | virtual void flush(void); |
||
82 | virtual void write(uint8_t c); |
||
83 | using BetterStream::write; |
||
84 | private: |
||
85 | uint8_t start_col, start_row, col, row; |
||
86 | }; |
||
87 | |||
88 | #endif |