/**************************************************/
/***                                            ***/
/*** Test VDF NEC   ***/
/***  Copyright X.Fenard Xavier 2009 ***/
/***   ***/
/***   version 20090914 ***/
/***   ***/
/***   ***/
/***   ***/
/***   ***/
/***                                            ***/
/**************************************************/


/*******************************************************/
/*                                                     */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*                                                     */
/*******************************************************/






#include <stdio.h>
#include <conio.h>
#include <windows.h>

#include "VFD_test.h"

int main(void)
{
      /* Ouverture */
	int T=0,V; 
	 if (Open_InOut(0)==-1) {printf("Ouverture raté.\n");return -1;}
	 
	 VFDInit();
		 T=1;
	 
	while (T!=200)
	 { 
	printf("Selection commande  \n");
	printf("1 reglage luminosite \n");
	printf("2 ecrire en memoire affichage \n");
	printf("3 ecrire un chiffre \n");
	printf("4 lecture clavier \n");
	printf("5 lecture interupteur \n");
	printf(" fin 200\n ");
	printf(" choix (tout en decimal) ");
	scanf ("%d",&T);
	switch(T)
		{
		case 1: printf ("luminosite:");
	 			scanf ("%d",&T);	 
	 			VFDLuminosite((char)T); 	/* liminosite min */
				break;
		case 2:	printf(" fin 200\n ");
				while (T!=200)
	 			{
				printf("Adresse fin 200 ");
	 			scanf ("%d",&T);
	 			printf("Data  ");
	 			scanf ("%d",&V);	
				VFDDataPoke(T,V);
				};
				break;
		case 3: printf(" fin 200\n ");
				while (T!=200)
	 			{ 
				printf("Adresse fin 200 ");
	 			scanf ("%d",&T);
	 			printf("Data  ");
	 			scanf ("%d",&V);	
				VFDNumbPoke(T,V);
				};
				break;
		 case 4: VFDSend(0x42,1); 	 /* lecture clavier */
				printf ("%x ",VFDReceive());
				printf ("%x ",VFDReceive());
				printf ("%x ",VFDReceive());
				printf ("%x ",VFDReceive());
				printf ("%x ",VFDReceive());
				printf ("%x ",VFDReceive());
				VFDSend(0x42,0); 	 /* pour remonter strobe */
				break;
		  case 5: VFDSend(0x43,1); 	 /* lecture interupteur */
				printf ("%x ",VFDReceive());
				VFDSend(0x40,0); 	 /* pour remonter strobe */
				break;
		};
		
	 };

	 






	 
	 


/***************************************************************/
/* now test the functions */

     Close_InOut();
     return 0;
}


/*Afficheur lecteur DVD Gowell 
config Chip: 5 digits/16segments
config Afficheur 10/8
adresse 0...9
Adresse 9 8 7 6 5 4 3 2 1 0
Digit	x x x D D D D D x D				

Digit5,6: rouge
Digit9,8: roue a gauche

B8: affichage icones divers

Roue digit 8,partigauche 128:180,64:200,32:220,16:270,8:290,4:300, 2 et1 rien
Roue digit 9,parti droite 64:350,32:10,16:30,8:40,4:60,2:100,1:170

	D76543210
	  abfgced	
	a
f		b
e	g	c
	d
abcdefg : 0x01,0x4F,0x12,0x06,0x4C,0x24,0x60,0x0F,0x00,0x0C,0x72,0x66,0x5C,0x34,0x70,0x7f

N=(N&0x40)|(N&0x20)|((N&0x10)>>2)|((N&0x08)>>3)|((N&0x04)>>1)|((N&0x02)<<3)|((N&0x01)<<3)

	
*/

