Example #1
0
/**
 *  @brief Display character on LCD
 *
 *  @param[in] u32Zone   the assigned number of display area
 *  @param[in] u32Index  the requested display position in zone
 *  @param[in] u8Ch      Character to show on display
 *
 *  @return None
 *
 */
void LCDLIB_PutChar(uint32_t u32Zone, uint32_t u32Index, uint8_t u8Ch)
{
    int      data, index;
    uint16_t bitfield;
    uint32_t com, bit;
    int      i;

    index  = u32Index;

    data = u8Ch;

    if(u32Index > LCD_ZoneInfo[u32Zone].Sub_Zone_Num) return;

    /* defined letters currently starts at "SPACE" - 0x20; */
    data     = data - 0x20;
    bitfield = *(Zone_TextDisplay[u32Zone] + data);

    for (i = 0; i < LCD_ZoneInfo[u32Zone].Zone_Digit_SegNum; i++) {
        bit = *(Zone[u32Zone]
                + index*LCD_ZoneInfo[u32Zone].Zone_Digit_SegNum*2
                + i*2 + 1);

        com = *(Zone[u32Zone]
                + index*LCD_ZoneInfo[u32Zone].Zone_Digit_SegNum*2
                + i*2 + 0);

        LCD_SetPixel(com, bit, 0);

        if (bitfield & (1 << i)) {
            /* Turn on segment */
            LCD_SetPixel(com, bit, 1);
        }
    }

}
Example #2
0
/**
 *  @brief Display number on LCD
 *
 *  @param[in] u32Zone  the assigned number of display area
 *  @param[in] value  number to show on display
 *
 *  @return None
 *
 */
void LCDLIB_PrintNumber(uint32_t  u32Zone, long long value)
{
    int      index;
    long long num, i, com, bit, div, len, tmp;
    uint16_t bitpattern;

    if (value < 0) {
        value = abs(value);
    }

    /* Length of number */
    len = 0;
    tmp = value;
    while( 1 ) {
        if( (tmp/10) || (tmp%10) ) {
            tmp = tmp / 10;
            len++;
        } else
            break;
    }


    /* Extract useful digits */
    div = 1;

    /* fill out all characters on display */
    for (index = (LCD_ZoneInfo[u32Zone].Sub_Zone_Num-1); index >= 0; index--) {
        num = (value / div) % 10;
        num += 16;

        bitpattern = *(Zone_TextDisplay[u32Zone] + num);

        for (i = 0; i < LCD_ZoneInfo[u32Zone].Zone_Digit_SegNum; i++) {
            bit = *(Zone[u32Zone]
                    + index*LCD_ZoneInfo[u32Zone].Zone_Digit_SegNum*2
                    + i*2 + 1);
            com = *(Zone[u32Zone]
                    + index*LCD_ZoneInfo[u32Zone].Zone_Digit_SegNum*2
                    + i*2 + 0);

            LCD_SetPixel(com, bit, 0);

            if (bitpattern & (1 << i)) {
                LCD_SetPixel(com, bit, 1);
            }
        }
        div = div * 10;

    }

}
Example #3
0
/**
 *  @brief Display symbol on LCD
 *
 *  @param[in] u32Zone   the assigned number of display area
 *  @param[in] u32Index  the requested display position in zone
 *  @param[in] u32OnOff  1: display symbol
 *                   0: not display symbol
 *
 *  @return None
 *
 */
void LCDLIB_SetSymbol(uint32_t u32Zone, uint32_t u32Index, uint32_t u32OnOff)
{
    uint32_t com, bit;

    bit = *(Zone[u32Zone] + u32Index*2 + 1);

    com = *(Zone[u32Zone] + u32Index*2 + 0);

    if (u32OnOff)
        LCD_SetPixel(com, bit, 1); /* Turn on segment */
    else
        LCD_SetPixel(com, bit, 0); /* Turn off segment */

}
Example #4
0
void Reflow_PlotProfile(int highlight) {
	LCD_BMPDisplay(graphbmp,0,0);
	for(int x=1; x<48; x++) { // No need to plot first value as it is obscured by Y-axis
		int realx = (x << 1) + XAXIS;
		int y=profiles[profileidx]->temperatures[x] / 5;
		y = YAXIS-y;
		LCD_SetPixel(realx,y);
		if(highlight == x) {
			LCD_SetPixel(realx-1,y-1);
			LCD_SetPixel(realx+1,y+1);
			LCD_SetPixel(realx-1,y+1);
			LCD_SetPixel(realx+1,y-1);
		}
	}
}
// hour: 24-hours
void showTime(uint32_t hour, uint32_t minute)
{
    long long time;
    // show time
    time = hour * 100 + minute;

    LCDLIB_PrintNumber(1, time);
    LCD_SetPixel(3,29,1);
}
Example #6
0
/**
 *  @brief Display text on LCD
 *
 *  @param[in] u32Zone  the assigned number of display area
 *  @param[in] string  Text string to show on display
 *
 *  @return None
 *
 */
void LCDLIB_Printf(uint32_t  u32Zone, char *string)
{
    int      data, length, index;
    uint16_t bitfield;
    uint32_t com, bit;
    int      i;

    length = strlen(string);
    index  = 0;

    /* fill out all characters on display */
    for (index = 0; index < LCD_ZoneInfo[u32Zone].Sub_Zone_Num; index++) {
        if (index < length) {
            data = (int) *string;
        } else {       /* padding with space */
            data = 0x20; /* SPACE */
        }
        /* defined letters currently starts at "SPACE" - 0x20; */
        data     = data - 0x20;
        bitfield = *(Zone_TextDisplay[u32Zone] + data);

        for (i = 0; i < LCD_ZoneInfo[u32Zone].Zone_Digit_SegNum; i++) {
            bit = *(Zone[u32Zone]
                    + index*LCD_ZoneInfo[u32Zone].Zone_Digit_SegNum*2
                    + i*2 + 1);

            com = *(Zone[u32Zone]
                    + index*LCD_ZoneInfo[u32Zone].Zone_Digit_SegNum*2
                    + i*2 + 0);

            LCD_SetPixel(com, bit, 0);

            if (bitfield & (1 << i)) {
                /* Turn on segment */
                LCD_SetPixel(com, bit, 1);
            }
        }
        string++;
    }

}
Example #7
0
void LCDDrawMask(const void *buf, unsigned short x, unsigned short y, unsigned short width,
                  unsigned short height, unsigned int color_f, unsigned int color_b) {
   unsigned int nbyteperline = (width + 7) / 8;
   for (int i = 0; i < height; i++) {
      for (int j = 0; j < nbyteperline; j++) {
         for (int k = 0; k < 8; k++) {
            unsigned char mask = *((unsigned char *)buf + i * nbyteperline + j);
            unsigned int color = (mask & (1 << (8 - k))) ? color_f : color_b;
            LCD_SetPixel(x + 8 * j + k, y + i, color);
         }
      }
   }
}
Example #8
0
int32_t Reflow_Run(uint32_t thetime, float meastemp, uint8_t* pheat, uint8_t* pfan, int32_t manualsetpoint) {
	int32_t retval=0;
	if(manualsetpoint) {
		PID.mySetpoint = (float)manualsetpoint;
	} else { // Figure out what setpoint to use from the profile, brute-force way. Fix this.
		uint8_t idx = thetime / 10;
		uint16_t start = idx * 10;
		uint16_t offset = thetime-start;
		if(idx<47) {
			uint32_t value = profiles[profileidx]->temperatures[idx];
			if(value>0) {
				uint32_t value2 = profiles[profileidx]->temperatures[idx+1];
				uint32_t avg = (value*(10-offset) + value2*offset)/10;
				printf(" setpoint %uC",avg);
				intsetpoint = avg; // Keep this for UI
				PID.mySetpoint = (float)avg;
			} else {
				retval = -1;
			}
		} else {
			retval = -1;
		}
	}

	if(!manualsetpoint) {
		// Plot actual temperature on top of desired profile
		int realx = (thetime / 5) + XAXIS;
		int y=(uint16_t)(meastemp * 0.2f);
		y = YAXIS-y;
		LCD_SetPixel(realx,y);
	}

	PID.myInput=meastemp;
	PID_Compute(&PID);
	uint32_t out = PID.myOutput;
	if(out<248) { // Fan in reverse
		*pfan=255-out;
		*pheat=0;
	} else {
		*pheat=out-248;
		if(*pheat>192) *pfan=2; else *pfan=4; // When heating like crazy make sure we can reach our setpoint
	}
	return retval;
}
Example #9
0
/*********************************************************************
*
*       GUI_SIF_DispChar
*/
static void _GUI_SIF_DispChar(U16P c) {
  const U8 * pData;
  const GUI_SIF_CHARINFO *pCharInfo  = (const GUI_SIF_CHARINFO *)(_GetpCharInfo(GUI_Context.pAFont, c));
  if (!pCharInfo){
    pCharInfo  = (const GUI_SIF_CHARINFO *)(_GetpCharInfo(GUI_Context.pAFont, '?'));
  }
    unsigned short x = GUI_Context.DispPosX;
    unsigned short y = GUI_Context.DispPosY;
    unsigned int width = pCharInfo->XSize ;      
    unsigned int dis = pCharInfo->XDist ;      
    unsigned int nbyteperline = pCharInfo->BytesPerLine ;              
    unsigned int addr = (unsigned int)GUI_Context.pAFont->p.pFontData + pCharInfo->OffData ;
  
  for (int i = 0; i < GUI_Context.pAFont->YSize; i++) {    
      unsigned int mask = htonlAt((void*)(addr+i*nbyteperline));    
      for(int j=0;j<width;j++){
        GUI_COLOR color = (mask & (1<<(31-j))) ?  GUI_Context.Color: GUI_Context.BkColor;
        LCD_SetPixel(x + j, y + i, color);
      }
  }
  GUI_Context.DispPosX += pCharInfo->XDist;
}
Example #10
0
void ControlSegment(uint32_t onoff, int com, int seg)
{
    LCD_SetPixel(com, seg, onoff);
}
Example #11
0
void drawVLineEx(uint16 x, uint16 y, uint16 lineLen,COLOR color) {
   for (uint32 i = 0; i < lineLen; i++) {
      LCD_SetPixel(x, y + i,color);
   }
} 
Example #12
0
void drawVLine(uint16 x, uint16 y, uint16 lineLen) {
   for (uint32 i = 0; i < lineLen; i++) {
      LCD_SetPixel(x, y + i, GUI_Context.Color);
   }
}