static void new_osc_sample(const measure_data_t* data)
{
  int channel = ch_generic2internal(data->ch);
  int i;

  xSemaphoreTake(lcdLock, portMAX_DELAY);
  interrupt_off();

  /* first we clear the old line */
  GLCD_setTextColor(White);
  for(i=0;i<CONFIG_SAMPLE_BUFFER_SIZE;i++)
  {
    display_show_analog(
        (display_buffer_index[channel]+i) % DISPLAY_BUFF_SIZE,
        display_buffer[(display_buffer_index[channel]+i) % DISPLAY_BUFF_SIZE][channel]);
  }

  GLCD_setTextColor(osc_color[channel]);
  for(i=0;i<CONFIG_SAMPLE_BUFFER_SIZE;i++)
  {
    display_show_analog(display_index(channel), data->data[i]);

    // Update buffer
    display_buffer[display_index(channel)][channel] = data->data[i];
    display_buffer_index[channel]++;


  }

  interrupt_on();
  xSemaphoreGive(lcdLock);
}
Exemple #2
0
/**
 *	Display a menu and select menu item number
 * 	With 3 menu items
 *
 *	text1 - text on line 1 (max 18 characters)
 *	text2 - text on line 2 (max 18 characters)
 *	text3 - text on line 3 (max 18 characters)
 *
 *	returns selected menue alternative, 1, 2 or 3
 */
int screenMenu3(unsigned char text1[], unsigned char text2[], unsigned char text3[]) {
	int dataX;
	int dataY;
	int i = 0;

	screenClear ();

	//write text
	screenOutputText(2, 1, Blue, text1);
	screenOutputText(4, 1, Blue, text2);
	screenOutputText(6, 1, Blue, text3);

	//draw rectangles
	xSemaphoreTake(lcdLock, portMAX_DELAY);	
	GLCD_setTextColor(Blue);
	GLCD_drawRect(Line2 - 12, 5, 48, 310);
	GLCD_drawRect(Line4 - 12, 5, 48, 310);
	GLCD_drawRect(Line6 - 12, 5, 48, 310);
	
  	xSemaphoreGive(lcdLock);

	//wait for user to select alternative
	while(i == 0) {
		//select alternative
		screenTouched(&dataX, &dataY);
		//find out which alternative selected
		if (dataY > Line2 - 12 && dataY < Line4 - 12) i = 1;
		if (dataY > Line4 - 12 && dataY < Line6 - 12) i = 2;
		if (dataY > Line6 - 12 && dataY < Line8 - 12) i = 3;
	}

	xSemaphoreTake(lcdLock, portMAX_DELAY);	
	GLCD_setTextColor(Green);
	GLCD_setBackColor (Green);
	if ( i == 1) {
		GLCD_fillRect(Line2 - 12, 5, 48, 310);
  		xSemaphoreGive(lcdLock);
		screenOutputText(2, 1, Blue, text1);
	} else if (i == 2) {
		GLCD_fillRect(Line4 - 12, 5, 48, 310);
	  	xSemaphoreGive(lcdLock);
		screenOutputText(4, 1, Blue, text2);
	} else {
		GLCD_fillRect(Line6 - 12, 5, 48, 310);
	  	xSemaphoreGive(lcdLock);
		screenOutputText(6, 1, Blue, text2);
	}

	xSemaphoreTake(lcdLock, portMAX_DELAY);
	GLCD_setBackColor (White);
  	xSemaphoreGive(lcdLock);

	vTaskDelay(900 / portTICK_RATE_MS);


	return i;
}
Exemple #3
0
/**
 * 	Display a line with text and let the user confirm
 *
 *	text - text on line, within rectangle max 18 characters)
 *
 */
int screenTextOk(unsigned char text[] ) {
	int dataX;
	int dataY;
	int i = 0;

	screenClear ();

	//write text
	screenOutputText(4, 1, Blue, text);
	screenOutputText(6, 5, Red, "Please confirm");

	//draw rectangle 
	xSemaphoreTake(lcdLock, portMAX_DELAY);	
	GLCD_setTextColor(Blue);
	GLCD_drawRect(Line2, 5, 120,310);
	xSemaphoreGive(lcdLock);

	//wait for the user to confirm
	while(i == 0) {
		//select alternative
		screenTouched(&dataX, &dataY);
		//find out which alternative selected
		if (dataY > Line2 && dataY < Line6) i = 1;		
	}

	return i;

}
Exemple #4
0
/**
 * 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;			
		}
	}
}
Exemple #5
0
/**
 * 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);
}
void display_button(int button) {
	xSemaphoreTake(lcdLock, portMAX_DELAY);
	GLCD_setTextColor(Black);
	GLCD_drawRect(buttons[button].upper, buttons[button].right, buttons[button].lower-buttons[button].upper, buttons[button].left-buttons[button].right);
	GLCD_displayChar(buttons[button].upper + 10, buttons[button].right + 20, *(buttons[button].text));
	xSemaphoreGive(lcdLock);
}
Exemple #7
0
/**
 * Initialize the display
 */
void initDisplay () {

  lcdLock = xSemaphoreCreateMutex();

  GLCD_init();
  GLCD_clear(White);
  GLCD_setTextColor(Blue);
}
Exemple #8
0
/**
 * Display one character, in pos y, x
 * with color according to textCol (= text color)
 * with size of y = line number
 * with size of x = number of characters from left border
 * (max 20 characters on one line)
 *
 * y = 0 -> first line, y = 2 -> second line....
 *
 * in this case input x=0 means the left border
 * A small distance to the right will be added to x
 */
static void screenDisplayChar(int y, int x, unsigned short textCol, char c) {
	unsigned char cOut;

	cOut = c;

    xSemaphoreTake(lcdLock, portMAX_DELAY);
  	GLCD_setTextColor(textCol);		
	GLCD_displayChar(y * 24, 304 - 16 * x, cOut);
	xSemaphoreGive(lcdLock);
}
Exemple #9
0
/**
 * Diplay some chars somewhere on the screen (horisontal)
 *
 * with size of y = line number
 * with size of x = number of characters from left border
 * (max 20 characters on one line)
 *
 * y = 0 -> first line, y = 2 -> second line....
 *
 * In this case input x=0 means the left border
 * A small distance to the right will be added to x
 *
 * textCol = text color, see file GLCD.h (not all colors work), 0 = black
 * text = text to print
 */
void screenOutputText(int y, int x, unsigned short textCol, unsigned char text[]) {
	int i = 0; 		//counter

  	xSemaphoreTake(lcdLock, portMAX_DELAY);
  	GLCD_setTextColor(textCol);
	xSemaphoreGive(lcdLock);
	
	while (text[i] > 0 ) {
		screenDisplayChar(y, x + i, textCol, text[i]);
		i++;
	}
}
Exemple #10
0
/**
 * 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;
}
Exemple #11
0
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);
  }
}
Exemple #12
0
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); 
  } 
} 
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 ();

}