Professional Documents
Culture Documents
*----------------------------------------------------------------------------
* Name: TRAFFIC.C
* Rev.: V3.20
*----------------------------------------------------------------------------
*---------------------------------------------------------------------------*/
#include "lcd.h"
/*------------------------------------------------------------------------------
*------------------------------------------------------------------------------*/
#define FONT_WIDTH 16
#define FONT_HEIGHT 24
"\n"
"+**** TRAFFIC LIGHT CONTROLLER using RVCT and RTX kernel *****+\n"
"| start time and end time the system controls a traffic light |\n"
"+----------+-------------+------------------------------------+\n";
U8 hour; /* hour */
U8 min; /* minute */
U8 sec; /* second */
};
struct time end = { 18, 30, 0 }; /* storage for end time values */
//#define setLights(o,s) { \
//};
if (on == 0)
LCD_DisplayChar(Line4, DISPLAY_WIDTH-5*FONT_WIDTH, 0x80+0); /* Circle Empty */
else
if (on == 0)
else
if (on == 0)
else
if (on == 0)
else
else
if (on == 0)
else
GPIOB->ODR |= (light);
/*---------------------------------------------------------------------------
Delay function
*---------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
*---------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
*---------------------------------------------------------------------------*/
os_dly_wait (50);
/*----------------------------------------------------------------------------
* Task 3 'clock'
*---------------------------------------------------------------------------*/
ctime.sec = 0;
ctime.min = 0;
ctime.hour = 0;
}
os_itv_wait (); /* wait interval (already set to 1s ) */
/*----------------------------------------------------------------------------
*---------------------------------------------------------------------------*/
int hour,min,sec;
return (0);
return (1);
/*----------------------------------------------------------------------------
* Task 7 'get_escape': check if ESC (escape character) was entered
*---------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
*---------------------------------------------------------------------------*/
U32 i;
printf ("\n\n");
break;
ctime.min = rtime.min;
ctime.sec = rtime.sec;
break;
end.min = rtime.min;
end.sec = rtime.sec;
break;
start.min = rtime.min;
start.sec = rtime.sec;
break;
break;
}
}
/*----------------------------------------------------------------------------
*---------------------------------------------------------------------------*/
return (1);
else {
return (1);
/*----------------------------------------------------------------------------
* Task 4 'blinking': runs if current time is outside start & end time
*---------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
* Task 5 'lights': executes if current time is between start & end time
*---------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------
*---------------------------------------------------------------------------*/
}
}
/*----------------------------------------------------------------------------
*---------------------------------------------------------------------------*/
for (;;) {
os_dly_wait (400);
os_dly_wait (400);
}
/*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/