Okay, I have some updates to the library if anyone wants to check it out. First, it now works with both Mega and Uno! Just select the correct board in Arduino IDE, and it's gonna work!
The font upload program works with Mega & Uno (or deci)
Next, I changed some stuff:
blink() & no_blink(), invert() & no_invert() to
osd.blink_on &
osd.blink_offosd.invert_on() &
osd.invert_off()osd.write_to_screen() is now
osd.print_full_screen("characters",x,y,blink,invert,char_bg)Also, I added:
char_bg_on() and
char_bg_off()for individual character backgrounds.
osd.cursor(x,y) and
osd.cursor(x,y,blink,invert,char_bg)this will look like:
osd.cursor(5,2,1,0,1) and gives you column 5, row 2, blink on, invert off, and character background on.
Here's the big additions:
osd.set_vm1(blink_duty, blink_time, gray_lvl, bg_modethis function sets your video mode 1 options (see max7456 datasheet)
you can use this function anytime, in the setup or during the loop.
It looks like this: osd.vm1_set(75,3,7,0)
the blink_duty can be set to 25, 33, 50, or 75. This would be for the blink "on time"... like (33% on & 66% off).
the blink_time can be set from 0 to 3, where 0 blinks the fastest, and 3 blinks the slowest.
the gray_lvl can be set from 0 to 7, where 0 is the darkest (black) and 7 is the lightest (very light gray).
the bg_mode can be set at 0 or 1, where 0 gives you the video_in background, and 1 gives you gray background.
osd.set_screen(x_min, x_max, y_min, y_max, x_offset, y_offset)this function lets you adjust the area to accommodate your screen.
it looks like this: osd.set_screen(1,28,2,11,-5,-8)
x_min & x_max let you set your first & last viewable column, y_min & y_max set your first & last viewable rows.
x can be 0 to 29, and y can be 0 to 12. I don't have a PAL tv, but I assume y could be 0 to 15 if needed.
**in my example, column 1 becomes column 0, and row 2 becomes row 0...
**so if you use cursor(0,0) you will actually write to column 1 and row 2.
**this way you don't have to over-think the locations, just set your screen and everything else works okay with it
x_offset lets you shift your screen left & right, -32 for 32 pixels left, 0 for no shift, and 31 for 31 pixels right.
y_offset lets you shift your screen up & down. -16 for 16 pixels up, 0 for no shift, and 15 for 15 pixels down.
like my other functions, this can be used anywhere in your sketch.
the osd.print_full_screen () function is the only function this is not limited to your defined screen area.
osd.set_white_level(row,white_level)this function lets you change the white level brightness on any row.
you can set any row, and the white_level can be 0 to 3, with 0 being brightest white, and 3 being dullest white.
it looks like this: osd.set_white_level (2,3) to set row 2 to the dullest white,
OR
osd.set_white_level(all_rows,0) to set all rows to the brightest white.
last, osd.put
(hex, x,y,blink,invert, char_bg)OR
osd.put(hex,x,y)these functions let you print a hex character with the normal options
it looks like osd.put(0x8F,3,6,0,1,0)
osd.PALmode ( ) can be used if you have a PAL display. You may have to use osd.set_screen ( ) to change the number of rows from (13 on NTSC) to (15 on PAL). The code will default to a NTSC setup.
I think that's everything that needs explaining. I just expanded on work done by Please let me know what you think, but be gently, this is my first library upload!
http://www.filefactory.com/file/c5da981/n/Max7456_osd.zipThanks to dfraser, zitron, and kg4wsv. I'm really just expanding on work they did first.
P.S. If your video goes in and out, try uploading a new font. That magically solved my problem. Don't know why, don't care.