示例#1
0
static __forceinline uint32_t utf8_read_increment(const char **data, const char *last)
{
	if ((**data & 0x80) == 0 && *data + 1 <= last) // 0xxxxxxx
		return *(*data)++;
	else if ((**data & 0xE0) == 0xC0 && *data + 2 <= last) // 110xxxxx
	{
		uint32_t codepoint = 0;
		codepoint += LOWBITS(*(*data)++, 5) << 6;
		codepoint += LOWBITS(*(*data)++, 6);
		return codepoint;
	}
	else if ((**data & 0xF0) == 0xE0 && *data + 3 <= last) // 1110xxxx
	{
		uint32_t codepoint = 0;
		codepoint += LOWBITS(*(*data)++, 4) << 12;
		codepoint += LOWBITS(*(*data)++, 6) << 6;
		codepoint += LOWBITS(*(*data)++, 6);
		return codepoint;
	}
	else if ((**data & 0xF8) == 0xF0 && *data + 4 <= last) // 11110xxx
	{
		uint32_t codepoint = 0;
		codepoint += LOWBITS(*(*data)++, 3) << 18;
		codepoint += LOWBITS(*(*data)++, 6) << 12;
		codepoint += LOWBITS(*(*data)++, 6) << 6;
		codepoint += LOWBITS(*(*data)++, 6);
		return codepoint;
	}
	else
		return -1;
}
示例#2
0
//-------------------------------
void lcd_cmd(int8u_t data, int16u_t loop)
{/* LCD ELEMENTARY COMMAND */
 HIGHBITS(data);
 LCD_STROBE(0);
 LOWBITS(data);
 LCD_STROBE(loop); // busy delay
}
示例#3
0
void lcd_cmd_native(int8u_t data)
{/* LCD ELEMENTARY COMMAND */
 HIGHBITS(data);
 LCD_STROBE_native(20);
 LOWBITS(data);
 LCD_STROBE_native(20); // busy delay
}
示例#4
0
//-------------------------------
void lcd_config(int8u_t param)
{/* CONFIGURE THE DISPLAY */
 HIGHBITS(param); // 4-bit, two lines, 5x8 pixel
  LCD_STROBE(0); // change 8-bit interface to 4-bit interface
  LCD_STROBE(0); // init 4-bit interface
 LOWBITS(param);
  LCD_STROBE(0);
}
示例#5
0
uint32_t utf8_decode(const char *data)
{
	if ((data[0] & 0x80) == 0)
		return (uint32_t)data[0];
	else if ((data[0] & 0xE0) == 0xC0)
		return (uint32_t)(LOWBITS(data[0], 5) << 6) + LOWBITS(data[1], 6);
	else if ((data[0] & 0xF0) == 0xE0)
		return (uint32_t)(LOWBITS(data[0], 4) << 12) + (LOWBITS(data[1], 6) << 6) + LOWBITS(data[2], 6);
	else if ((data[0] & 0xF8) == 0xF0)
		return (uint32_t)(LOWBITS(data[0], 3) << 18) + (LOWBITS(data[1], 6) << 12) + (LOWBITS(data[2], 6) << 6) + LOWBITS(data[3], 6);
	else
		return -1;
}