Esempio n. 1
0
SSPEC_RESOURCETABLE_END


/*
 * These constants define keypad actions
 */
#define DELETE 		'1'
#define READ 			'2'
#define EMAIL_UP 		'3'
#define EMAIL_DOWN 	'4'
#define SCROLL_UP 	'5'
#define SCROLL_DOWN 	'6'
#define IGNORE 		'7'

void initsystem()
{
	auto int status;

	brdInit();				//initialize board for this demo
	dispInit();

	glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8);
	status = TextWindowFrame(&wholewindow, &fi6x8,0, 0, LCD_XS, LCD_YS);

	keyConfig ( 0, EMAIL_DOWN,  0, 0, 0,  0, 0);
	keyConfig ( 1, SCROLL_UP,   0, 0, 0,  0, 0);
	keyConfig ( 2, SCROLL_DOWN, 0, 0, 0,  0, 0);
	keyConfig ( 3, EMAIL_UP,    0, 0, 0,  0, 0);
	keyConfig ( 4, READ,        0, 0, 0,  0, 0);
	keyConfig ( 5, DELETE,      0, 0, 0,  0, 0);
	keyConfig ( 6, IGNORE,      0, 0, 0,  0, 0);
}
Esempio n. 2
0
void initsystem()
{

    brdInit();
    dispInit();
    keypadDef();
    glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8);
    TextWindowFrame(&wholewindow, &fi6x8, 0, 0, LCD_XS, LCD_YS);
    glBackLight(1);
}
Esempio n. 3
0
main()
{

	//------------------------------------------------------------------------
	// Initialize the controller
	//------------------------------------------------------------------------	
	brdInit();				//initialize board for this demo

	// Start-up the keypad driver
	// Initialize the graphic driver
	dispInit();
	
	keypadDef();		// Use the default keypad ASCII return values

	glBackLight(1);	// Turn-on the backlight
	glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8);			//	Initialize 6x8 font
	glBlankScreen();
	for(;;)
	{
		glPrintf (0,  0, &fi6x8,  "Waiting for a Switch"); 
		glPrintf (0,  8, &fi6x8,  "to be pressed on the");
		glPrintf (0,  16, &fi6x8, "prototyping board...");
		
		while (BitRdPortI(PGDR, S2) && BitRdPortI(PGDR, S3));
		glBlankScreen();
		if (!BitRdPortI(PGDR, S2))
		{
			glPrintf (0,  0, &fi6x8, "Switch 2 is Active!");
			dispLedOut(5, 1);   									//Turn-on Keypad LED DS1
			BitWrPortI(PGDR, &PGDRShadow, 0, DS1);		//proto-board DS1 on

			while (!BitRdPortI(PGDR, S2));
			dispLedOut(5, 0); 	// Turn-OFF Keypad LED DS1
			BitWrPortI(PGDR, &PGDRShadow, 1, DS1);		//proto-board DS1 off
		}
		if (!BitRdPortI(PGDR, S3))
		{
			glPrintf (0,  0, &fi6x8, "Switch 3 is Active!");
			dispLedOut(6, 1); 										//Turn-on Keypad LED DS2
			BitWrPortI(PGDR, &PGDRShadow, 0, DS2);		//proto-board DS2 on

			while (!BitRdPortI(PGDR, S3));
			dispLedOut(6, 0); 	// Turn-OFF Keypad LED DS2
			BitWrPortI(PGDR, &PGDRShadow, 1, DS2);		//proto-board DS2 off
		}
		glBlankScreen();
	}
}			
Esempio n. 4
0
void initsystem()
{
	auto int status;
	
	brdInit();				//initialize board for this demo

	dispInit();
	glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8);
	status = TextWindowFrame(&wholewindow, &fi6x8,0, 0, LCD_XS, LCD_YS);
	
	keyConfig ( 0, EMAIL_DOWN,  0, 0, 0,  0, 0);
	keyConfig ( 1, SCROLL_UP,   0, 0, 0,  0, 0);
	keyConfig ( 2, SCROLL_DOWN, 0, 0, 0,  0, 0);
	keyConfig ( 3, EMAIL_UP,    0, 0, 0,  0, 0);
	keyConfig ( 4, READ,        0, 0, 0,  0, 0);
	keyConfig ( 5, DELETE,      0, 0, 0,  0, 0);
	keyConfig ( 6, IGNORE,      0, 0, 0,  0, 0);
}
Esempio n. 5
0
void initLcdKeypad()
{
	// Start-up the keypad driver and
	// Initialize the graphic driver
	dispInit();

	// Use default key values along with a key release code
	keyConfig (  0,'1', 0, 0, 0,  0, 0 );
	keyConfig (  1,'2', 0, 0, 0,  0, 0 );
	keyConfig (  2,'3', 0, 0, 0,  0, 0 );
	keyConfig (  3,'4', 0, 0, 0,  0, 0 );
	keyConfig (  4,'-', 0, 0, 0,  0, 0 );
	keyConfig (  5,'+', 0, 0, 0,  0, 0 );
	keyConfig (  6,'0', 0, 0, 0,  0, 0 );

	// Initialize 6x8 font
	glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8);          // Initialize 6x8 font
	TextWindowFrame(&wholewindow, &fi6x8, 0, 0, LCD_XS, LCD_YS);
	glBlankScreen();
	TextGotoXY(&wholewindow, 0, 0);
	TextPrintf(&wholewindow, "Password");
}
Esempio n. 6
0
int main(void)
{


	//DDRD &= ~(1<<PD2);
	//PORTD |= (1<<PD2);
	// Ustawienia dla przerwania na INT0 z zegara; co 1s
	// Reakcja na opadajace zbocze

	EIFR |= (1<<INTF0);
	PCMSK |= (1<<PD2);
	MCUCR |= (1<<ISC00);
	GIMSK |= (1<<INT0);

	//Timer 16bit
	//TCCR1B |= (1<<CS11) | (1<<CS10);
	//TIMSK |= (1<<TOIE1);

	// Flaga uplywajacej minuty, po ktorej odswiezam wyswietlacz
	USIFlags.ONE_MINUTE = 1;

	dispInit();
	InitUSI();
	sei();

	u8 clkConf[1];
	clkConf[0] = 0b10000011;
	TwiWriteBuf(0x0D,1,clkConf);
	u8 bufor[2];
	u8 buf[2];
	buf[0] = (4 << 4) | 0;
	buf[1] = (1 << 4 ) |  3;
	TwiWriteBuf(0x03,2,buf);

//	TwiReadBuf(0x03,2,bufor);
//	u8 mmT = (bufor[0] & 0xf0) >> 4;
//	u8 mmU = bufor[0] & 0x0f;
//	u8 hhT = (bufor[1] & 0x30) >> 4;
//	u8 hhU = bufor[1] & 0x0f;
	u8 mmT = 0;
	u8 mmU = 0;
	u8 hhT = 0;
	u8 hhU = 0;




	for(;;)
	{

		if(USIFlags.ONE_MINUTE)
		{
			TwiReadBuf(0x03,2,bufor);
			 mmT = (bufor[0] & 0x70) >> 4;
			 mmU = bufor[0] & 0x0f;
			 hhT = (bufor[1] & 0x30) >> 4;
			 hhU = bufor[1] & 0x0f;

			 USIFlags.ONE_MINUTE = 0;
		}

		test(hhT);
		DIG1_ON;
		_delay_ms(5);
		DIG1_OFF;
		lightsOut();
		//zapal pierwsza liczbe

		test(hhU);
		//zapal pierwsza liczbe
		DIG2_ON;
		_delay_ms(5);
		DIG2_OFF;
		lightsOut();


		test(mmT);
		//zapal pierwsza liczbe
		DIG3_ON;
		_delay_ms(5);
		DIG3_OFF;
		lightsOut();

		test(mmU);
		//zapal pierwsza liczbe
		DIG4_ON;
		_delay_ms(5);
		DIG4_OFF;
		lightsOut();


	}
Esempio n. 7
0
//////////////////////////////////////////////////////////
// clear display and turn on backlight
//////////////////////////////////////////////////////////
void displayInit()
{
	dispInit();
	glBlankScreen();
	glBackLight(1);
}
Esempio n. 8
0
//------------------------------------------------------------------------
// Sample program to demonstrate the LCD and keypad
//------------------------------------------------------------------------
void main (	void	)
{
	auto int option;
	static int state;

	//------------------------------------------------------------------------
	// Initialize the controller
	//------------------------------------------------------------------------
	brdInit();			// Initialize the controller
	dispInit();			// Start-up the keypad driver, Initialize the graphic driver
	keypadDef();		// Use the default keypad ASCII return values


	glBackLight(1);	// Turn-on the backlight
	glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8);			//	Initialize 6x8 font
	glXFontInit(&fi8x10, 8, 10, 32, 127, Font8x10);		//	Initialize 10x16 font
	glXFontInit(&fi12x16, 12, 16, 32, 127, Font12x16);	//	Initialize 12x16 font

	// Setup and center text window to be the entire display
	TextWindowFrame(&textWindow, &fi6x8, 1, 0, 121, 32);

	// Set variables to known states
	ledCntrl = LEDOFF;	// Initially disable the LED's
	state = MENU_INIT;
	//------------------------------------------------------------------------
	// Display Sign-on message and wait for keypress
	//------------------------------------------------------------------------
	SignOnMessage();

	//------------------------------------------------------------------------
	// Main program loop for the MENU system
	//------------------------------------------------------------------------
	for (;;)
	{
		costate
		{
			keyProcess ();
			waitfor(DelayMs(10));
		}

		costate
		{
			leds(OPERATE);
			waitfor(DelayMs(50));
		}
		costate
		{
			// Display the MAIN MENU
			waitfor((option = display_menu(main_menu, &state, LVL_MAINMENU, NUM_MAINMENU_OPTS)) > 0);


			// Get menu option from the user
			switch(option)
			{
				// Change Date/Time
				case 1:	glBlankScreen();
							SetDateTime();
							state = MENU_INIT;
							break;

				// Display current Date/Time
				case 2:	glBlankScreen();
							waitfor(dispDate());
							state = MENU_INIT;
							break;

				// Display backlight memu options
				case 3:	waitfor(backlight_menu());
							state = MENU_REFRESH;
							break;

				// Enable Toggle leds option
				case 4:	leds(TOGGLE);
							state = MENU_NO_CHANGE;
							break;

				// Enable Increment leds option
				case 5:	leds(INCREMENT);
							state = MENU_NO_CHANGE;
							break;

				// Disable LED's
				case 6:	leds(LEDOFF);
							state = MENU_NO_CHANGE;
							break;

				// User made invalid selection
				default:
					break;
			}
		}
	}
}
Esempio n. 9
0
//***************************************************************************
//	Mainline
//***************************************************************************
void main (	void	)
{
	auto char entry[256];

	auto int wKey, i, loop;
	auto int helpMenuDone;

	//------------------------------------------------------------------------
	// Board and drivers initialization
	//------------------------------------------------------------------------
	brdInit();		// Required for all controllers
	dispInit();		// Graphic driver initialization, Start-up the keypad driver
	keypadDef();	// Set keys to the default driver configuration

	//------------------------------------------------------------------------
	// Font initialization
	//------------------------------------------------------------------------
	// Initialize structures with FONT bitmap information
	glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8);				//	initialize basic font

	//------------------------------------------------------------------------
	// Text window initialization
	//------------------------------------------------------------------------
	// Setup the widow frame to be the entire LCD to display information
	TextWindowFrame(&textWindow1, &fi6x8, 0, 0, 122, 32);
	TextWindowFrame(&textWindow2, &fi6x8, 0, 24, 122, 8);

	//------------------------------------------------------------------------
	// Main loop for the user to create messages from the keypad
	//------------------------------------------------------------------------
	while(1)
	{
		// Display user prompt for the message menu
		glBlankScreen();
		TextGotoXY(&textWindow1, 0, 0);
		TextPrintf(&textWindow1, "Press + to create a message...\n");

		// Wait for ENTER key to be pressed
		do
		{
			keyProcess();
			wKey = keyGet();
		} while(wKey != '+');

		// Go to the message menu
		glBlankScreen();
		memset(entry,0,sizeof(entry));
		enter_chars(entry);

		// Display the message the user typed
		glBlankScreen();
		TextGotoXY(&textWindow1, 0, 0);
		TextPrintf(&textWindow1, "Typed...%s", entry);

		// Wait for user to press any key to startover
		TextGotoXY(&textWindow1, 0, 3);
		TextPrintf(&textWindow1, "ENTER to Continue");
		do
		{
			keyProcess();
			wKey = keyGet();
		} while(wKey == 0);
	}
}
Esempio n. 10
0
main()
{
	static int led, channel, wKey, keypad_active, prompt_displayed;
	static int new_keypress_message, release_value, i;
	//------------------------------------------------------------------------
	// Initialize the controller
	//------------------------------------------------------------------------
	brdInit();				// Initialize the controller for this demo

	// Start-up the keypad driver and
	// Initialize the graphic driver
	dispInit();

	// Use default key values along with a key release code
	keyConfig (  3,'R', '1', 0, 0,  0, 0 );
	keyConfig (  6,'E', '2', 0, 0,  0, 0 );
	keyConfig (  2,'D', '3', 0, 0,  0, 0 );
	keyConfig (  5,'+', '4', 0, 0,  0, 0 );
	keyConfig (  1,'U', '5', 0, 0,  0, 0 );
	keyConfig (  4,'-', '6', 0, 0,  0, 0 );
	keyConfig (  0,'L', '7', 0, 0,  0, 0 );

	// Initialize 6x8 font
	glXFontInit(&fi6x8, 6, 8, 32, 127, Font6x8);          // Initialize 6x8 font
	glXFontInit(&fi8x10, 8, 10, 32, 127, Font8x10);			//	initialize 8x10 font
	glBlankScreen();

	// Initialize control flags
	keypad_active = FALSE;
	prompt_displayed = FALSE;
	new_keypress_message = FALSE;
	for(;;)
	{
		costate
		{
			keyProcess ();
			waitfor ( DelayMs(10) );

		}

		costate
		{
			// Wait for any key to be pressed
			waitfor((wKey = keyGet()) != 0);
			release_value = -1;
			switch(wKey)
			{
				case 'L': 	release_value = '7'; break;
				case '-': 	release_value = '6'; break;
				case 'U':   release_value = '5'; break;
				case '+': 	release_value = '4'; break;
				case 'D':	release_value = '3'; break;
				case 'E':	release_value = '2'; break;
				case 'R':	release_value = '1'; break;
			}
			if(release_value != -1)
			{
				keypad_active = TRUE;
				// Wait for the key to be released
				waitfor(keyGet() == release_value);
				keypad_active = FALSE;
			}
		}

		costate
		{
			if(!keypad_active)
			{
				if(!prompt_displayed)
				{
					glBlankScreen();
					glPrintf (0,  0, &fi6x8,  "Waiting for a Key to");
					glPrintf (0,  8, &fi6x8,  "be pressed on the ");
					glPrintf (0,  16, &fi6x8, "LCD Keypad....");
					glFillPolygon(4, 115, 26,  121,26,   121,31,   115, 31);
					prompt_displayed = TRUE;
					new_keypress_message = FALSE;

					// Turn-Off leds on the Demo board
					pbLedOut(DS1, OFF); 		//DS1 off
					pbLedOut(DS2, OFF);		//DS2 off
				}

				for(channel = 0; channel <= 6; channel++)
				{
					for(led = 0; led <=6; led++)
					{
						if(led != channel)
						dispLedOut(led, 0);
					}
					dispLedOut(channel, 1);
					waitfor(DelayMs(100));
					if(keypad_active)
					{

						break;
					}
				}
			}
		}

		costate
		{
			if(keypad_active && !new_keypress_message)
			{
				glBlankScreen();
				glFillPolygon(4, 113, 26,  121,26,   121,31,   113, 31);
				switch(wKey)
				{
					case 'L':
						glPrintf (0,  0, &fi8x10, "Scroll-Left key");
						glPrintf (0,  16, &fi8x10, "is Active.");
						dispLedOut(0, 1);
						channel = 0;
						break;

					case '-':
						glPrintf (0,  0, &fi8x10, "Page-Down key");
						glPrintf (0,  16, &fi8x10, "is Active.");
						dispLedOut(1, 1);
						channel = 1;
						pbLedOut(DS1, ON); 		//DS1 on
						break;

					case 'U':
						glPrintf (0,  0, &fi8x10, "Scroll-Up key");
						glPrintf (0,  16, &fi8x10, "is Active.");
						dispLedOut(2, 1);
						channel = 2;
						break;

					case '+':
						glPrintf (0,  0, &fi8x10, "Page-Up key");
						glPrintf (0,  16, &fi8x10, "is Active.");
						dispLedOut(3, 1);
						channel = 3;
						pbLedOut(DS2, ON); 		//DS2 on
						break;

					case 'D':
						glPrintf (0,  0, &fi8x10, "Scroll-Down key");
						glPrintf (0,  16, &fi8x10, "is Active.");
						dispLedOut(4, 1);
						channel = 4;
						break;

					case 'E':
						glPrintf (0,  0, &fi8x10, "Enter key");
						glPrintf (0,  16, &fi8x10, "is Active.");
						dispLedOut(5, 1);
						channel = 5;
						break;

					case 'R':
						glPrintf (0,  0, &fi8x10, "Scroll-Right");
						glPrintf (0,  16, &fi8x10, "key is Active.");
						dispLedOut(6, 1);
						channel = 6;
						break;
				}
				for(led=0; led <=6; led++)
				{
					if(led != channel)
					{
						dispLedOut(led, 0);
					}
				}
				prompt_displayed = FALSE;
				new_keypress_message = TRUE;
			}
		}
		costate
		{
			if(keypad_active)
			{
				for(i=0; i<(LCD_XS-8); i+=4)
				{
					glHScroll(0, 26, LCD_XS, 6, -4);
					waitfor(DelayMs(5));
					if(!keypad_active)
						abort;
				}
				for(i=0; i<(LCD_XS-8); i+=4)
				{
					glHScroll(0, 26, LCD_XS, 6, 4);
					waitfor(DelayMs(5));
					if(!keypad_active)
						abort;
				}
			}
		}
	}
}