Exemplo n.º 1
0
void HD44780_74HC595::print(String value) {
  for (int i = 0; i < value.length(); i++){
    uint8_t charCode = value.charAt(i);
    uint8_t shiftCode7 = charCode >> 7;
    uint8_t shiftCode5 = charCode >> 5;
    if (shiftCode7 == 0x00) {
      // 1 octet UTF-8 Char (https://fr.wikipedia.org/wiki/UTF-8)
      // ASCII table from "Exclamation mark" to "Closing brace"
      if ((charCode >= 0x20) && (charCode <= 0x7D)) {
        LCDdata(charCode);
      } else {
        if (HD44780_74HC595_SerialDebug) { Serial.println("[HD44780_74HC595.cpp] print(" + String(charCode, HEX) + ") non géré"); }
      }
    } else if (shiftCode5 == 0x06) {
      // 2 octets UTF-8 Char
      uint16_t UTF8Hex = charCode << 8;
      i++;
      UTF8Hex = UTF8Hex | ((uint16_t)value.charAt(i));
      switch (UTF8Hex) {
        case 0xC2B0: LCDdata(LCD_DEG); break;
        default:
          if (HD44780_74HC595_SerialDebug) { Serial.println("[HD44780_74HC595.cpp] print(" + String(UTF8Hex, HEX) + ") non géré"); }
      }
    }
  }
}
Exemplo n.º 2
0
void LCDdisplay(void)
{
	uint8_t col, maxcol, p;

	for(p = 0; p < 6; p++)
	{
#ifdef enablePartialUpdate
		/* check if this page is part of update*/
		if ( yUpdateMin >= ((p+1)*8) )
		{
			continue;   /* nope, skip it! */
		}
		if (yUpdateMax < p*8)
		{
			break;
		}
#endif

		LCDcommand(PCD8544_SETYADDR | p);


#ifdef enablePartialUpdate
		col = xUpdateMin;
		maxcol = xUpdateMax;
#else
		/* start at the beginning of the row */
		col = 0;
		maxcol = LCDWIDTH-1;
#endif

		LCDcommand(PCD8544_SETXADDR | col);

		for(; col <= maxcol; col++) {
			/*uart_putw_dec(col); */
			/*uart_putchar(' '); */
			LCDdata(pcd8544_buffer[(LCDWIDTH*p)+col]);
		}
	}

	LCDcommand(PCD8544_SETYADDR );  /* no idea why this is necessary but it is to finish the last byte? */
#ifdef enablePartialUpdate
	xUpdateMin = LCDWIDTH - 1;
	xUpdateMax = 0;
	yUpdateMin = LCDHEIGHT-1;
	yUpdateMax = 0;
#endif

}