コード例 #1
0
void displayPedLights(Tlight lightcolor) {
	INT8U i = 0;
	
	switch (lightcolor) {
	case red:
		PC_DispChar(X_INTER1-1, Y_INTER2-1, ' ', DISP_FGND_GREEN + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		PC_DispChar(X_INTER1-2, Y_INTER2-1, 'R', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		break;
	case green:
		PC_DispChar(X_INTER1-2, Y_INTER2-1, ' ', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		PC_DispChar(X_INTER1-1, Y_INTER2-1, 'G', DISP_FGND_GREEN + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		break;
	case flashingGreen:
		PC_DispChar(X_INTER1-2, Y_INTER2-1, ' ', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		for (i = 0 ; i < 4 ; i++) {
			PC_DispChar(X_INTER1-1, Y_INTER2-1, ' ', DISP_FGND_GREEN + DISP_BGND_LIGHT_GRAY); //col, row, INT8U c, INT8U color
			OSTimeDlyHMSM(0,0,0,200);
			PC_DispChar(X_INTER1-1, Y_INTER2-1, 'G', DISP_FGND_GREEN + DISP_BGND_LIGHT_GRAY); //col, row, INT8U c, INT8U color
			OSTimeDlyHMSM(0,0,0,200);
		}
		break;
	default:
		PC_DispChar(X_INTER1-2, Y_INTER2-1, ' ', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		PC_DispChar(X_INTER1-1, Y_INTER2-1, 'G', DISP_FGND_GREEN + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		break;
	}
}
コード例 #2
0
ファイル: TEST.C プロジェクト: loganwhite/uCOSIIExp
/*
*********************************************************************************************************
*                                                  PRINTGRAPH
*********************************************************************************************************
*/
void  DrawGraph(INT16U data, INT8U pos) {
	INT8U i;
	data -= 180;
	data /= 25;
	if (data > 4 ) data = 4;
	for (i = 0; i < data; i++)
		PC_DispChar(67+pos, 20-i, 178, DISP_FGND_BLACK + DISP_BGND_LIGHT_GRAY);
}
コード例 #3
0
ファイル: PC.C プロジェクト: ak869/armcontroller
//change by cmj
        void PC_DispClrRow (INT8U y, INT8U color)
{
    INT8U      i;

    for (i = 0; i < DISP_MAX_X; i++)
    {
        PC_DispChar(i, y, ' ', color);
    }
}
コード例 #4
0
ファイル: PC.C プロジェクト: ak869/armcontroller
//change by cmj
        void PC_DispClrCol (INT8U x, INT8U color)
{
    INT8U      i;

    for (i = 0; i < DISP_MAX_Y; i++)
    {
        PC_DispChar(x, i, ' ', color);
    }
}
コード例 #5
0
void movePed(Tlocation *pos, INT16U speed) {
	if (pedLastStop == true && pedDirection == RIGHT) {
		PC_DispChar(pos->x-1, pos->y, ' ', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY); //col, row, INT8U c, INT8U color
		pedLastStop = false;
	}
	
	if (pedLastStop == true && pedDirection == LEFT) {
		PC_DispChar(pos->x+1, pos->y, ' ', DISP_FGND_BLACK + DISP_BGND_LIGHT_GRAY); //col, row, INT8U c, INT8U color
		pedLastStop = false;
	}
	
	PC_DispChar(pos->x, pos->y, '$', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY); 		//col, row, INT8U c, INT8U color
	OSTimeDlyHMSM(0,0,0,speed);
	if (pos->x == X_INTER1 || pos->x == X_INTER2)
		PC_DispChar(pos->x, pos->y, '|', DISP_FGND_BLACK + DISP_BGND_LIGHT_GRAY);
	else
		PC_DispChar(pos->x, pos->y, ' ', DISP_FGND_BLACK + DISP_BGND_LIGHT_GRAY);
}
コード例 #6
0
void moveCar3(Tlocation *pos, INT16U speed) {
	if (car3LastStop == true && car3Direction == DOWN) { 
		PC_DispChar(pos->x, pos->y-1, ' ', DISP_FGND_BLACK + DISP_BGND_LIGHT_GRAY); //col, row, INT8U c, INT8U color
		car3LastStop = false;
	}
	
	if (car3LastStop == true && car3Direction == UP) {
		PC_DispChar(pos->x, pos->y + 1, ' ', DISP_FGND_BLACK + DISP_BGND_LIGHT_GRAY); //col, row, INT8U c, INT8U color
		car3LastStop = false;
	}
	
	PC_DispChar(pos->x, pos->y, 'Z', DISP_FGND_BLACK + DISP_BGND_LIGHT_GRAY); 		//col, row, INT8U c, INT8U color
	OSTimeDlyHMSM(0,0,0,speed);
	if (pos->y == Y_INTER1 || pos->y == Y_INTER2)
		PC_DispChar(pos->x, pos->y, '_', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY);
	else
		PC_DispChar(pos->x, pos->y, ' ', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY);
}
コード例 #7
0
ファイル: PC.C プロジェクト: ak869/armcontroller
//change by cmj
        void PC_DispClrScr (INT8U color)
{
    INT16U      i,j;

    for (i = 0; i < DISP_MAX_Y; i++)
    {
        for (j = 0; j < DISP_MAX_X; j++)
        {
            PC_DispChar(j, i, ' ', color);
        }
    }
}
コード例 #8
0
ファイル: PC.C プロジェクト: ak869/armcontroller
//change by cmj
        void PC_DispStr (INT8U x, INT8U y, const char *s, INT8U color)
{
    while (*s)
    {
        if (x >= DISP_MAX_X)
        {
            x = 0;
            y++;
        }
        PC_DispChar(x, y, *s++, color);
        x++;
    }
}
コード例 #9
0
ファイル: EXT2.C プロジェクト: cole3/super_clock
                            void TaskE(void)
{
    uint8 x,y;
    
    while (1)
    {
        OS_ENTER_CRITICAL();
        x = random(80);
        y = random(20);
        PC_DispChar(x, y + 5, '5', DISP_FGND_LIGHT_GRAY);    
        OS_EXIT_CRITICAL();
        OSWait(K_TMO,1);
    }    
}
コード例 #10
0
ファイル: TASKS.C プロジェクト: kernelhcy/hcyprojects
void Task ( void * data )
{
	UBYTE x;
	UBYTE y;
	UBYTE err;
	int   curwin;
	PWINDOWS ptr;
	int   i, full;


	for (;;)
	{
		OSSemPend(RandomSem, 0, &err);           /* Acquire semaphore to perform random numbers        */
		curwin = GetCurrentWin();
		SetCurrentWin(*(char *)data - 0x2f);
		ptr = GetActiveWindow();
		x = random(ptr->ex - ptr->sx);                          /* Find X position where task number will appear      */
		y = random(ptr->ey - ptr->sy);                          /* Find Y position where task number will appear      */

		ptr->cache[x + y * (ptr->ex - ptr->sx)] = *(char *)data;
		for (full = 1, i = 0; i < (ptr->ex - ptr->sx) * (ptr->ey - ptr->sy); i ++)
		{
			if (ptr->cache[i] != *(char *)data)
			{
				full = 0; break;
			}
		}
		if (full)
			ClearWindow();

		PC_DispChar(ptr->sx + x + 1, ptr->sy + y, 'o', ptr->color);  // *(char *)data, ptr->color);
		SetCurrentWin(curwin);
		OSSemPost(RandomSem);                    /* Release semaphore                 */
		OSTimeDly(1);                            /* Delay 1 clock tick                                 */
	}
}
コード例 #11
0
void displayCarLights(Tlight lightcolor) {
	switch (lightcolor) {
	case red:
		PC_DispChar(X_INTER1+1, Y_INTER1-3, ' ', DISP_FGND_GREEN + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		PC_DispChar(X_INTER1+1, Y_INTER1-2, ' ', DISP_FGND_YELLOW + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		PC_DispChar(X_INTER1+1, Y_INTER1-1, 'R', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		break;
	case yellow:
		PC_DispChar(X_INTER1+1, Y_INTER1-1, ' ', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		PC_DispChar(X_INTER1+1, Y_INTER1-3, ' ', DISP_FGND_GREEN + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		PC_DispChar(X_INTER1+1, Y_INTER1-2, 'Y', DISP_FGND_YELLOW + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		break;
	case green:
		PC_DispChar(X_INTER1+1, Y_INTER1-1, ' ', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		PC_DispChar(X_INTER1+1, Y_INTER1-2, ' ', DISP_FGND_YELLOW + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		PC_DispChar(X_INTER1+1, Y_INTER1-3, 'G', DISP_FGND_GREEN + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		break;
	default:
		PC_DispChar(X_INTER1+1, Y_INTER1-3, ' ', DISP_FGND_GREEN + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		PC_DispChar(X_INTER1+1, Y_INTER1-2, ' ', DISP_FGND_YELLOW + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		PC_DispChar(X_INTER1+1, Y_INTER1-1, 'R', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY); 	//col, row, INT8U c, INT8U color
		break;
	}	
}
コード例 #12
0
void stopPed(Tlocation *pos) {
	PC_DispChar(pos->x, pos->y, '$', DISP_FGND_RED + DISP_BGND_LIGHT_GRAY); 		//col, row, INT8U c, INT8U color
	pedLastStop = true;
}
コード例 #13
0
void stopCar3(Tlocation *pos) {
	PC_DispChar(pos->x, pos->y, 'Z', DISP_FGND_BLACK + DISP_BGND_LIGHT_GRAY); 		//col, row, INT8U c, INT8U color
	car3LastStop = true;
}
コード例 #14
0
ファイル: TASKS.C プロジェクト: kernelhcy/hcyprojects
void DisplayCursor ( int x, int y )
{
	PWINDOWS ptr = GetActiveWindow();

	PC_DispChar(x, y, '_', ptr->color | 0x80);
}
コード例 #15
0
ファイル: TASKS.C プロジェクト: kernelhcy/hcyprojects
void TaskStart ( void *data )
{
	PWINDOWS ptr = GetActiveWindow();
	UBYTE  i;
	char   sCmd[MAX_X];
	WORD   key;
	WORD   index, pos = 0x00;

	data = data;                                           /* Prevent compiler warning                 */

	OS_ENTER_CRITICAL();
	PC_VectSet(0x08, OSTickISR);                           /* Install uC/OS-II's clock tick ISR        */
	PC_SetTickRate(OS_TICKS_PER_SEC);                      /* Reprogram tick rate                      */
	OS_EXIT_CRITICAL();

    PC_DispChar(0, 0, ' ', 0x00);               
	PC_DispStr (8, 16, "Determining  CPU's capacity ...", DISP_FGND_WHITE);
	CreateWindow (0, StartY, MAX_X, EndY, DISP_FGND_WHITE, DISP_BGND_BLUE, "[ Prompt Window ]");
	CreateTaskWindows();
	OSStatInit();                                          /* Initialize uC/OS-II's statistics         */

	for (i = 0; i < N_TASKS; i ++)
	{                                                      /* Create N_TASKS identical tasks           */
		TaskData[i] = '0' + i;                             /* Each task will display its own letter    */
		OSTaskCreate(Task, (void *)&TaskData[i], (void *)&TaskStk[i][TASK_STK_SIZE - 1], i + 1);
	}

	DisplayTitle();

	ClearWindow();
	memset(sCmd, 0x00, MAX_X);
	DisplayPrompt();
	for (;;)
	{
		DisplayStatus();                                   // display status of tasks

		if (PC_GetKey(&key) == TRUE)
		{                                                  /* See if key has been pressed              */
			if (key == 0x1B)
			{                                              /* Yes, see if it's the ESCAPE key          */
				PC_DOSReturn();                            /* Return to DOS                            */
			}
			else if (key == 0x08)                           // backspace
			{
				pos --;
				pos = pos <= 0x00 ? 0x00 : pos;
				sCmd[pos] = '\0';
				PC_DispChar(ptr->cx + pos + strlen(sCmdPrompt), ptr->cy, ' ', ptr->color);
				DisplayCursor(ptr->cx + pos + strlen(sCmdPrompt), ptr->cy);
			}
			else if (key == 0x0d || key == 0x0a)                           // enter
			{
				if (pos)
				{
					index = ParseCommand(sCmd);
					HandleCommand(index);
				}
				memset(sCmd, 0x00, MAX_X);
				pos = 0x00;
				ptr->cy ++;
				if (ptr->cy == ptr->ey - 1)
					ClearWindow();
				DisplayPrompt();
			}
			else if ((key >= '0' && key <= '9') ||
				(key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z'))
			{
				if (pos < MAX_X)
				{
					sCmd[pos] = (char)key;
					PC_DispChar(ptr->cx + pos + strlen(sCmdPrompt), ptr->cy, key, ptr->color);
	                DisplayCursor (ptr->cx + pos + strlen(sCmdPrompt) + 1, ptr->cy);
				}
				pos ++;
			}

		}
		OSTimeDlyHMSM(0, 0, 0, 200);                         /* Wait 200 ms                          */
	}
}