65 lines
		
	
	
		
			69 KiB
		
	
	
	
		
			Arduino
		
	
	
	
	
	
		
		
			
		
	
	
			65 lines
		
	
	
		
			69 KiB
		
	
	
	
		
			Arduino
		
	
	
	
	
	
|   | // Do not remove the include below
 | ||
|  | #include "max7456.h"
 | ||
|  | #include <SPI.h>
 | ||
|  | 
 | ||
|  | 
 | ||
|  | Max7456 *osd = NULL; //Pointer representing a max7456 .
 | ||
|  | //THIS ARRAY IS OBTAINED BY AN OTHER PROGRAM
 | ||
|  | //Those 13.5ko of data are stored in the program memory.
 | ||
|  | //Be awared that 0xFF are stored as 0x55 as program memory can't stand series of 0xFF (Arduino vicious problem)
 | ||
|  | const char tableOfAllCharacters[13824] PROGMEM = {0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xf3,0x55,0x55,0x55,0x55,0x3f,0x55,0xcf,0x55,0x55,0xcf,0x55,0x55,0xcf,0x55,0x55,0xcf,0x55,0x55,0x55,0x3f,0x55,0x55,0x3f,0x55,0x3f,0x3f,0x55,0xf,0x3f,0x55,0xc0,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xfc,0x55,0xcf,0x55,0x55,0x55,0x55,0xf3,0x55,0x55,0xf3,0x55,0x55,0xf3,0x55,0x55,0xf3,0x55,0x55,0x55,0x55,0x55,0xf0,0x55,0x55,0xf0,0x3f,0x55,0xcf,0x3f,0x55,0x3f,0x3f,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0xf3,0x55,0xf3,0x55,0x55,0x55,0xf3,0x55,0x55,0xf3,0x55,0x55,0xf3,0x55,0x55,0xf3,0x55,0x55,0xf3,0x55,0x55,0xf3,0x55,0x55,0x55,0x55,0x55,0x55,0xcf,0x55,0xfc,0x3,0x55,0xfc,0xf3,0x55,0xfc,0x3,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x3f,0xf3,0x55,0x55,0x55,0xcf,0x55,0x55,0xcf,0x55,0x55,0xcf,0xc3,0x55,0x55,0x3f,0x55,0xfc,0x3f,0x55,0xfc,0x55,0xfc,0xc,0x55,0xfc,0xc0,0x55,0xfc,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55 | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | void setup(){ | ||
|  | 
 | ||
|  |   //Sample code : Write a complete table of character in the character memory of the max7456.
 | ||
|  | 
 | ||
|  |   charact currentChar; //represents a character as stored in memory (byte[54])
 | ||
|  | 
 | ||
|  |   Serial.begin(9600); | ||
|  |   osd = new Max7456(9); //new Max7456 with CS on pin 9.
 | ||
|  |   Serial.println("INSERTING CHARACTERS TABLE IN MAX7456"); | ||
|  |   Serial.println("ARE YOU SURE ? (y/n)"); | ||
|  |   bool goodChar = true; | ||
|  | 
 | ||
|  |   osd->activateOSD(false); // Deactivate osd display.
 | ||
|  |   //Just some serial manipulations
 | ||
|  |   while (!goodChar) | ||
|  |   { | ||
|  |     while (!Serial.available() ); | ||
|  |     char found; | ||
|  |     found =  char(Serial.read()); | ||
|  |     goodChar = (found == 'y' || found == 'Y'); | ||
|  |     if (found == 'n' || found == 'N') | ||
|  |     { | ||
|  |       Serial.println("------ NOTHING DONE ------"); | ||
|  |       Serial.println("please unplug your arduino"); | ||
|  |       while (true); | ||
|  |     } | ||
|  |   } | ||
|  | 
 | ||
|  |   char number[] = "000"; | ||
|  | 
 | ||
|  |   for (int i = 0 ; i <= 0xff; i++) | ||
|  |   { | ||
|  |     Serial.print("inserting "); | ||
|  |     dtostrf(i, 3, 0, number); | ||
|  |     Serial.print(number); | ||
|  |     Serial.print(" / 255"); | ||
|  |     Max7456::getCARACFromProgMem(tableOfAllCharacters, i, currentChar); //Because the table is too big for ram memory
 | ||
|  | 
 | ||
|  |     osd->sendCharacter(currentChar,i&0xF0, i&0xF0); //We send currentChar at address i.
 | ||
|  | 
 | ||
|  |     for (int j = 0 ; j < 19 ; j++) //Rewind Serial.
 | ||
|  |       Serial.print(char(0x08)); | ||
|  |   } | ||
|  |   Serial.println("--------- DONE ! ---------"); | ||
|  |   Serial.println("please unplug your arduino"); | ||
|  | 
 | ||
|  | } | ||
|  | 
 | ||
|  | void loop() | ||
|  | { | ||
|  |   //Nothing done here
 | ||
|  | } |