コード例 #1
0
/************************************************************************
 * @brief 	main function	
 * @param[in]	None
 * @return		None
 ***********************************************************************/
int main(void)
{
	uint16_t i;
	uint16_t ReData;
	SystemInit();
	USART_Config();
	init_display ();

	USART1_Puts("This msg from USART1\n\r");
	USART2_Puts("This msg from USART2\n\r");
	
	
	while(1)
	{
#if 0	
		
		ReData = USART2_GetChar();
		//USART2_Puts((unsigned char*)ReData);
		USART_SendData(USART2, ReData);
		
#endif
		
#if 1
		
		
		USART2_Puts("*STS#");
		
		GLCD_displayStringLn(Line7, "Sending: *STS#");
		USART2_SmartCardGet(4); //updating data
		if (USART2_BufferCompare((uint8_t *)"*CP#", 4))
		{
			USART2_Puts("*R0802#");
			
			GLCD_displayStringLn(Line8, "Sending: *R0802#");
			USART2_SmartCardGet(12); //updating data
			if (USART2_BufferCompare((uint8_t *)"*RD08024344#", 12))
				{
					GLCD_clearLn(Line9);
					GLCD_displayStringLn(Line9, "Person 1");
					//break;
				}
			
			if (USART2_BufferCompare((uint8_t *)"*RD08024142#", 12))
				{
					GLCD_clearLn(Line9);
					GLCD_displayStringLn(Line9, "Person 2");
					//break;
				}
			
			if (USART2_BufferCompare((uint8_t *)"*RD08024143#", 12))
				{
					GLCD_clearLn(Line9);
					GLCD_displayStringLn(Line9, "Person 3");
					//break;
				}
					
			}
#endif		
		}
}
コード例 #2
0
ファイル: screen.c プロジェクト: tcp/Embedded
/**
 * Display one line of text plus a grid with characters (qwerty...)
 * asking for example to "Enter Text"
 *
 * textCol - text color, see file GLCD.h (not all colors work)
 * text - a number of characters forming a text string
 * numberOfChars - maximum number of characters in response
 * (maximum characters in one line is 20)
 *
 * returns entered characters, which can be ' ', ended by a \0
 */
void screenQueryChars(unsigned short textCol, unsigned char text[], int numberOfChars, unsigned char textEntered[]) {
	int dataX;
	int dataY;
	int charInt = 0;
	int pos = 0;
	int	caps = 1;
	//let capsOld be different from caps,
	//so grid with characters will be drawn first time
	int capsOld = 1 - caps;

	screenClear ();

 	xSemaphoreTake(lcdLock, portMAX_DELAY);
	//clear display
	GLCD_clear(White);
	//set color
	GLCD_setTextColor(textCol);
	//write text on bottom line
  	GLCD_displayStringLn(Line9, text);
	xSemaphoreGive(lcdLock);

	//loop over touched numbers
	while (pos < numberOfChars && charInt < 201) {
		//if caps changed, redraw grid with characters
		if (caps != capsOld) {
			screenDisplayGrid(0,caps);
			capsOld = caps;
		}
		//find out where screen touched
		screenTouched(&dataX, &dataY);
		//and which character this means
		charInt = screenGridTouchedChar(dataX, dataY);

		if (charInt == 32 || (charInt > 64  && charInt < 91)) {
			//spece or regular printable character
			//eventually change to lower case
			if (!caps && charInt != 32) charInt = charInt + 32;
			textEntered[pos] = charInt;
			//if lower case change character (except for spaces)
			screenDisplayChar(0, pos, textCol, charInt);
			pos++;
		} else if (charInt == 199) {
			//change between caps and lower case
			caps = 1 - caps;
		} else if (charInt == 200) {
			//Delete one character
			if (pos > 0) pos--;
			//write a space (clear next position)
			screenDisplayChar(0, pos, textCol, 32);
		} else if (charInt == 201 ) {
			//Cancel pressed
			pos = 0;
			//add a char 0 to end of string
			textEntered[pos] = 0;
		} else if (charInt == 202) {
			//Enter pressed
			textEntered[pos] = 0;			
		}
	}
}
コード例 #3
0
ファイル: screen.c プロジェクト: tcp/Embedded
/**
 * Diplay one line of text, max 20 chars
 *
 * lineNo = selected Line1 to Line9 (or y-coordinates)
 * textCol = text color, see file GLCD.h (not all colors work)
 * text = text to print
 */
void screenOutputTextLine(unsigned short textCol, unsigned int lineNo, unsigned char text[]) {

  xSemaphoreTake(lcdLock, portMAX_DELAY);
  GLCD_setTextColor(textCol);
  GLCD_displayStringLn(lineNo, text);
  xSemaphoreGive(lcdLock);
}
コード例 #4
0
void init_display (void) 
{
  /* LCD Module init */

  GLCD_init();

  GLCD_clear(Navy);
  GLCD_setBackColor(Navy);
  GLCD_setTextColor(White);
    
  GLCD_displayStringLn(Line0, "       VBEB Co.,Ltd");
  GLCD_displayStringLn(Line3, "Libarary Management");
	GLCD_displayStringLn(Line4, "      Center");
	GLCD_displayStringLn(Line6, "    Version 1.0");

  GLCD_bitmap (5, 10, 95, 35, VBEBLogo); 

//  upd_display ();

}
コード例 #5
0
ファイル: screen.c プロジェクト: tcp/Embedded
/**
 * Display one line of text plus a grid with numbers
 * from 0 to 9. Asking for example to "Enter Code
 *
 * textCol - text color, see file GLCD.h (not all colors work)
 * text - a number of characters forming a text string
 * numberOfDigits - maximum number of digits in response
 *
 * returns entered number, which can be 0
 */
int screenQueryNumber(unsigned short textCol, unsigned char text[], int numberOfDigits) {
	int dataX;
	int dataY;
	int digit = 0;
	char cDigit;
	int pos = 0;
	int totalInput = 0;

	screenClear ();

 	xSemaphoreTake(lcdLock, portMAX_DELAY);
	//clear display
	GLCD_clear(White);
	//set color
	GLCD_setTextColor(textCol);
	//write text on bottom line
  	GLCD_displayStringLn(Line9, text);
	xSemaphoreGive(lcdLock);

	//show grid with numbers
	screenDisplayGrid(1, 0);

	//loop over touched numbers
	while (pos < numberOfDigits && digit < 201) {
		//find out where screen touched
		screenTouched(&dataX, &dataY);

		//find out the meaning of where screen touched
		digit = screenGridTouchedDigit(dataX, dataY);
		if(digit >= 0 && digit <= 9) {
			//regular input of digit
			pos++;
			cDigit = digit + 48;
			totalInput = totalInput*10 + digit;
			screenDisplayChar(0, pos, textCol, cDigit);
		} else if (digit == 200 && pos > 0 ) {
			//delete previous character
			cDigit = ' ';
			totalInput = totalInput/10;		
			screenDisplayChar(0, pos, textCol, cDigit);
			pos--;
		}
	}
	if(digit == 201) {
		//cancel pressed
		totalInput = 0;
	}

	return totalInput;
}
コード例 #6
0
ファイル: task_display.c プロジェクト: pabe/pins-oscilloscope
static void new_multimeter_sample(const measure_data_t* data)
{
  int channel = ch_generic2internal(data->ch);
  static portTickType last_update[NUMBER_OF_CHANNELS] = { 0 };

  if((last_update[channel] + CONFIG_DISPLAY_MULTIMETER_REFRESH_TIME) < xTaskGetTickCount())
  {
    static char buffer[15];
    static const int max_mV = 3300;
    int mV = (data->data[0]*max_mV)/ADC_MAX;
    int Line;
    char ch;
    last_update[channel] = xTaskGetTickCount();


    switch (channel)
    {
      case  input_channel0:
        Line = Line3;
        ch = 'A';
        break;

      case  input_channel1:
        Line = Line4;
        ch = 'B';
        break;

      default:
        ipc_watchdog_signal_error(0);
        return;
    }
    sprintf (buffer, "Channel %c: %i.%03i V", ch, mV/1000,mV%1000);

    xSemaphoreTake(lcdLock, portMAX_DELAY);
    taskDISABLE_INTERRUPTS();
    TIM_ITConfig(TIM2, TIM_IT_Update, DISABLE);
    
    GLCD_setTextColor(Black);
    GLCD_displayStringLn(Line, (unsigned char *) buffer); 

    TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);
    taskENABLE_INTERRUPTS();
    xSemaphoreGive(lcdLock);
  }
}
コード例 #7
0
ファイル: main.c プロジェクト: pabe/pins-oscilloscope
static void printTask(void *params) { 
  unsigned char str[21] = "                    "; 
  portTickType lastWakeTime = xTaskGetTickCount(); 
  int i; 

  for (;;) { 
    xSemaphoreTake(lcdLock, portMAX_DELAY); 
    GLCD_setTextColor(Black); 
    GLCD_displayStringLn(Line9, str); 
    xSemaphoreGive(lcdLock); 

    for (i = 0; i < 19; ++i) 
      str[i] = str[i+1]; 

    if (!xQueueReceive(printQueue, str + 19, 0)) 
      str[19] = ' '; 

    vTaskDelayUntil(&lastWakeTime, 100 / portTICK_RATE_MS); 
  } 
} 
コード例 #8
0
/*******************************************************************************
* Clear given line                                                             *
*   Parameter:     ln:        line number                                      *
*   Return:                                                                    *
*******************************************************************************/
void GLCD_clearLn(unsigned int ln) {
    GLCD_displayStringLn(ln, "                    ");
}