在介绍0.91寸 SSD1306之前先附上模块链接:点击购买SSD1306 OLED显示模块
本文章我们来介绍下0.91寸 OLED SSD1306的代码,在介绍之前,请参照前面两篇文章对OLED的概念说明:
0.91寸 SSD1306 OLED介绍(一) — 整体介绍/IIC时序介绍
0.91寸 SSD1306 OLED介绍(二) — 命令介绍
1)命令枚举定义
/*************************************************************
* SSD1306 OLED commands are divided into 7 categories:
* Basic commands
* Scroll command
* Address setting command
* Hardware configuration command
* Timing and driver scheme configuration commands
* Advanced graphics command
* Charge pump command
**************************************************************/
typedef enum
{
/* 1. Basic commands */
/* Set the contrast, range 0~0xff, the higher the value, the higher the contrast */
oled_cmd_contrast = 0x81,
/* Where the contents of GDDRAM are output */
oled_cmd_entire_display_on_with_ram = 0xa4,
/* Ignore GDDRAM content to light up the full screen */
oled_cmd_entire_display_on_without_ram = 0xa5,
/* Normal display, that is, pixel 1 represents light */
oled_cmd_normal_display = 0xa6,
/* Invert the display so that the pixel 0 represents the light */
oled_cmd_inverse_display = 0xa7,
/* Turn off oled display */
oled_cmd_display_off = 0xae,
/* Turn on oled display */
oled_cmd_display_on = 0xaf,
/* 2. Scroll command */
/* Scroll horizontally to the right */
oled_cmd_right_hor_scroll = 0x26,
/* Scroll left horizontally */
oled_cmd_left_horl_scroll = 0x27,
/* Scroll vertically and shift to the right */
oled_cmd_ver_right_hor_scroll = 0x29,
/* Scroll vertically and shift to the left */
oled_cmd_ver_left_horl_scroll = 0x2a,
/* Stop rolling */
oled_cmd_stop_scroll = 0x2e,
/* Start rolling */
oled_cmd_start_scroll = 0x2f,
/* Sets the vertical scroll area range */
oled_cmd_set_ver_scroll_area = 0xa3,
/* 3. Address setting command */
/* Set the low starting address of the column in page address mode, range 0x0~0x1f */
oled_cmd_lower_col_start_addr = 0x0,
/* Set the high starting address of the column in page address mode, range 0x10~0x1f */
oled_cmd_higher_col_start_addr = 0x10,
/* Set memory address mode */
oled_cmd_set_mem_addr_mode = 0x20,
/* Set column address */
oled_cmd_set_col_addr = 0x21,
/* Set page address */
oled_cmd_set_page_addr = 0x22,
/* Page0 of the page address pattern */
oled_cmd_set_page0_start = 0xb0,
/* Page1 of the page address pattern */
oled_cmd_set_page1_start = 0xb1,
/* Page2 of the page address pattern */
oled_cmd_set_page2_start = 0xb2,
/* Page3 of the page address pattern */
oled_cmd_set_page3_start = 0xb3,
/* Page4 of the page address pattern */
oled_cmd_set_page4_start = 0xb4,
/* Page5 of the page address pattern */
oled_cmd_set_page5_start = 0xb5,
/* Page6 of the page address pattern */
oled_cmd_set_page6_start = 0xb6,
/* Page7 of the page address pattern */
oled_cmd_set_page7_start = 0xb7,
/* 4. Hardware configuration command */
/* Set the starting line of the screen to 0x40~0x7f, corresponding to lines 0~63, respectively */
oled_cmd_set_start_line_lowset = 0x40,
/* Remap, mapping column address 0 to SEG0 */
oled_cmd_set_remap0 = 0xa0,
/* Remap, mapping column address 127 to SEG0 */
oled_cmd_set_remap1 = 0xa1,
/* Set reuse rate */
oled_cmd_set_multiplex_ratio = 0xa8,
/* Scan from COM0 to COM[n-1] */
oled_cmd_set_com_normal_scan = 0xc0,
/* Scan from COM[n-1] to COM0 */
oled_cmd_set_com_remap_scan = 0xc8,
/* Sets the offset to display */
oled_cmd_set_display_offset = 0xd3,
/* Sets the region color to close */
oled_cmd_set_area_color_mode_off = 0xd8,
/* Set the column pin hardware configuration */
oled_cmd_set_compin_hw_conf = 0xda,
/* 5. Timing and driver scheme configuration commands */
/* Set the display clock divider value/oscillation frequency */
oled_cmd_set_clk_div_osc_freq = 0xd5,
/* Set the pre-charge cycle */
oled_cmd_set_precharge_period = 0xd9,
/* Set VCOMH backpressure value */
oled_cmd_set_vcomh_deselect_level = 0xdb,
/* Empty instruction */
oled_cmd_nop = 0xe3,
/* 6. Advanced graphics command */
/* Settings fade out */
oled_cmd_set_colour_fading = 0x23,
/* Set amp */
oled_cmd_set_amp = 0xd6,
/* 7. Charge pump command */
/* Charge setting pump */
oled_cmd_set_charge_pump = 0x8d,
}oled_cmd_e;
2)函数定义
uint8_t hw_oled_init(void);
uint8_t hw_oled_clear(void);
uint8_t hw_oled_display_on(void);
uint8_t hw_oled_display_off(void);
uint8_t hw_oled_set_contrast(uint8_t value);
uint8_t hw_oled_entry_display_with_ram(void);
uint8_t hw_oled_entry_display_without_ram(void);
uint8_t hw_oled_set_normal_display(void);
uint8_t hw_oled_set_inverse_display(void);
uint8_t hw_oled_set_horizontal_scroll(uint8_t direct,uint8_t start_page,uint8_t end_page,uint8_t interval);
uint8_t hw_oled_set_vertical_scroll(uint8_t direct,uint8_t start_page,uint8_t end_page,uint8_t interval,uint8_t offset);
uint8_t hw_oled_scroll_active(void);
uint8_t hw_oled_scroll_deactive(void);
uint8_t hw_oled_show_char(uint8_t col,uint8_t page,uint8_t show_char,uint8_t char_lenght);
uint8_t hw_oled_show_num(uint8_t col,uint8_t page,uint32_t num,uint8_t num_len,uint8_t char_lenght);
uint8_t hw_oled_show_string(uint8_t col,uint8_t page,uint8_t *string,uint8_t char_lenght);
uint8_t hw_oled_show_chinese(uint8_t col,uint8_t page,uint8_t chinese_index);
uint8_t hw_oled_draw_bmp(uint8_t col_start,uint8_t page_start,uint8_t col_end,uint8_t page_end,uint8_t *bmp);
3)初始化
/******************************************************************************
* 函数名: hw_oled_init
* 参数: NULL
* 返回值: oled init结果
* 描述: OLED的初始化,采用软件模拟IIC来驱动SSD1306,用到的PIN为:
SSD1306_SDA_PIN-->IIC SDA,SSD1306_SCL_PIN-->IIC SCL
******************************************************************************/
uint8_t hw_oled_init()
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(SSD1306_PERIPH_CLK, ENABLE);
GPIO_InitStructure.GPIO_Pin = SSD1306_SCL_PIN|SSD1306_SDA_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(SSD1306_SCL_GPIO, &GPIO_InitStructure);
GPIO_SetBits(SSD1306_SCL_GPIO,SSD1306_SCL_PIN|SSD1306_SDA_PIN);
/* 延时200ms */
hw_delay_ms(200);
hw_oled_write_byte(oled_cmd_set_multiplex_ratio,OLED_CMD); /* 设置复用率为32 */
hw_oled_write_byte(0x3F,OLED_CMD);
hw_oled_write_byte(oled_cmd_set_display_offset,OLED_CMD); /* 设置偏移量为0 */
hw_oled_write_byte(0x00,OLED_CMD);
hw_oled_write_byte(oled_cmd_set_start_line_lowset,OLED_CMD); /* 设置起始行地址 */
hw_oled_write_byte(oled_cmd_set_remap1,OLED_CMD); /* 设置重映射 */
hw_oled_write_byte(oled_cmd_set_com_remap_scan,OLED_CMD); /* 设置从COM[N-1]扫描到COM0 */
hw_oled_write_byte(oled_cmd_set_compin_hw_conf,OLED_CMD); /* 设置列引脚硬件配置 */
hw_oled_write_byte(0x12,OLED_CMD);
hw_oled_write_byte(oled_cmd_contrast,OLED_CMD); /* 设置对比度为 */
hw_oled_write_byte(0xff,OLED_CMD);
hw_oled_write_byte(oled_cmd_entire_display_on_with_ram,OLED_CMD);
hw_oled_write_byte(oled_cmd_normal_display,OLED_CMD); /* 设置为正常显示 */
hw_oled_write_byte(oled_cmd_set_clk_div_osc_freq,OLED_CMD); /* 设置显示时钟分频值/震荡频率 */
hw_oled_write_byte(0x80,OLED_CMD);
hw_oled_write_byte(oled_cmd_set_charge_pump,OLED_CMD);
hw_oled_write_byte(0x14,OLED_CMD);
hw_oled_write_byte(oled_cmd_display_on,OLED_CMD); /* 启动显示 */
hw_oled_clear();
return HW_ERR_OK;
}
4)显示字符
/******************************************************************************
* func name : hw_oled_show_char
* para : col(IN) -->Columns. SSD1306 columns range from 0 to 127
page(IN) -->Page, SSD1306 pages range from 0 to 7
show_char(IN) -->The character to display
char_lenght(IN)-->There are currently only two fonts, 16x8 and 8x6,
for the length of the characters to be displayed
* return : hw_oled_show_char result
* description : According to the character
******************************************************************************/
uint8_t hw_oled_show_char(uint8_t col,uint8_t page,uint8_t show_char,uint8_t char_lenght)
{
uint8_t char_index = 0;
uint8_t index = 0;
/* Determine whether the page is legal */
if(page > SSD1306_MAX_PAGE)
{
return HW_ERR_OLED_INVALID_PAGE;
}
char_index =show_char-' ';
/* 16x8 font processing and 8x6 font and expandable font */
if(char_lenght == FONT16X8_LENGTH)
{
/* Determines whether the column to be written can contain this character until the last column */
if(col + FONT16X8_WEIGHT > SSD1306_MAX_COL)
{
return HW_ERR_OLED_INVALID_COL;
}
/* Because SSD1306 is 128*64 pixels, there are 8 pages in total,
so each page is 128 pixels *8 pixels, so 16 pixels is across two pages*/
hw_oled_set_pos(col,page);
for(index = 0; index < FONT16X8_WEIGHT; index++)
{
hw_oled_write_byte(font16x8[char_index*FONT16X8_LENGTH+index],OLED_DATA);
}
hw_oled_set_pos(col,page+1);
for(index = 0; index < FONT16X8_WEIGHT; index++)
{
hw_oled_write_byte(font16x8[char_index*FONT16X8_LENGTH+index+FONT16X8_WEIGHT],OLED_DATA);
}
}
else if(char_lenght == FONT8X6_LENGTH)
{
/* Determines whether the column to be written can contain this character until the last column */
if(col + FONT8X6_WEIGHT > SSD1306_MAX_COL)
{
return HW_ERR_OLED_INVALID_COL;
}
hw_oled_set_pos(col,page);
for(index = 0; index < FONT8X6_WEIGHT; index++)
{
hw_oled_write_byte(font8x6[char_index][index],OLED_DATA);
}
}
else
{
/* TODO:Expansion of word stock */
}
return HW_ERR_OK;
}
5)显示数字
/******************************************************************************
* func name : hw_oled_show_num
* para : col(IN) -->Columns. SSD1306 columns range from 0 to 127
page(IN) -->Page, SSD1306 pages range from 0 to 7
num(IN) -->The digital to display
num_len(IN) -->The number of digits in a number,
for example, 0~9 is 1 bit, 10~99 2 bits
char_lenght(IN)-->There are currently only two fonts, 16x8 and 8x6,
for the length of the characters to be displayed
* return : hw_oled_show_num result
* description : According to digital
******************************************************************************/
uint8_t hw_oled_show_num(uint8_t col,uint8_t page,uint32_t num,uint8_t num_len,uint8_t char_lenght)
{
uint8_t temp_num = 0;
uint32_t temp_calc = 0;
uint8_t num_offset = 0;
while(num_len)
{
/* figure out 10 to the power */
temp_calc = hw_oled_10_pow(num_len-1);
/* Figure out the number to write */
temp_num = num/temp_calc;
num -= temp_num*temp_calc;
if(char_lenght == FONT16X8_LENGTH)
{
/* Convert the number to ASCII and write, and calculate the offset of the number written */
hw_oled_show_char(col+num_offset,page,temp_num+'0',char_lenght);
num_offset += FONT16X8_WEIGHT;
}
else if(char_lenght == FONT8X6_LENGTH)
{
/* Convert the number to ASCII and write, and calculate the offset of the number written */
hw_oled_show_char(col+num_offset,page,temp_num+'0',char_lenght);
num_offset += FONT8X6_WEIGHT;
}
else
{
/* TODO:Expansion of word stock */
}
num_len--;
}
return HW_ERR_OK;
}
6)显示字符串
/******************************************************************************
* 函数名: hw_oled_show_string
* 参数: col(IN) -->列,SSD1306列的范围是0~127
page(IN) -->页,SSD1306页的范围是0~7
string(IN) -->要显示的字符串
char_lenght(IN) -->要显示的字符的长度,目前只有两种字体,16x8,8x6
* 返回值: hw_oled_show_string结果
* 描述: 显示字符串
******************************************************************************/
uint8_t hw_oled_show_string(uint8_t col,uint8_t page,uint8_t *string,uint8_t char_lenght)
{
uint8_t index = 0;
uint8_t offset = 0;
/* 直到取到字符串最后一个字符 */
while (string[index]!='\0')
{
if(char_lenght == FONT16X8_LENGTH)
{
hw_oled_show_char(col + offset,page,string[index],char_lenght);
offset += FONT16X8_WEIGHT;
}
else if(char_lenght == FONT8X6_LENGTH)
{
hw_oled_show_char(col + offset,page,string[index],char_lenght);
offset += FONT8X6_WEIGHT;
}
else
{
/* 待扩充 */
}
index++;
}
return HW_ERR_OK;
}
7)显示中文
/******************************************************************************
* 函数名: hw_oled_show_chinese
* 参数: col(IN) -->列,SSD1306列的范围是0~127
page(IN) -->页,SSD1306页的范围是0~7
string(IN) -->要显示的字符串
char_lenght(IN) -->要显示的字符的长度,目前只有两种字体,16x8,8x6
* 返回值: hw_oled_show_chinese结果
* 描述: 显示字符串
******************************************************************************/
uint8_t hw_oled_show_chinese(uint8_t col,uint8_t page,uint8_t chinese_index)
{
uint8_t index,adder=0;
if(page > SSD1306_MAX_PAGE)
{
return HW_ERR_OLED_INVALID_PAGE;
}
hw_oled_set_pos(col,page);
for(index=0; index<16; index++)
{
hw_oled_write_byte(chinese[2*chinese_index][index],OLED_DATA);
adder+=1;
}
hw_oled_set_pos(col,page+1);
for(index=0; index<16; index++)
{
hw_oled_write_byte(chinese[2*chinese_index+1][index],OLED_DATA);
adder+=1;
}
return HW_ERR_OK;
}
8)显示bmp图片
/******************************************************************************
* 函数名: hw_oled_draw_bmp
* 参数: col_start(IN) -->起始列
page_start(IN) -->起始页
col_end(IN) -->结束列
page_end(IN) -->结束页
bmp(IN) -->bmp数据
* 返回值: hw_oled_draw_bmp结果
* 描述: 显示bmp图片
******************************************************************************/
uint8_t hw_oled_draw_bmp(uint8_t col_start,uint8_t page_start,uint8_t col_end,uint8_t page_end,uint8_t *bmp)
{
uint32_t j=0;
uint8_t col_temp,temp_page;
for(temp_page = page_start; temp_page < page_end; temp_page++)
{
hw_oled_set_pos(col_start,temp_page);
for(col_temp = col_start; col_temp < col_end; col_temp++)
{
hw_oled_write_byte(bmp[j++],OLED_DATA);
}
}
return HW_ERR_OK;
}
9)设置水平滚动
/******************************************************************************
* func name : hw_oled_set_horizontal_scroll
* para : direct(IN) --> direct 0->left 1->right
start_page(IN) -->Start Page, SSD1306 pages range from 0 to 7
end_page(IN) -->Endi Page, SSD1306 pages range from 0 to 7
interval(IN) -->time interval
#define SSD1306_TIME_INTEVAL_2FRAME 0x7
#define SSD1306_TIME_INTEVAL_3FRAME 0x4
#define SSD1306_TIME_INTEVAL_4FRAME 0x5
#define SSD1306_TIME_INTEVAL_5FRAME 0x0
#define SSD1306_TIME_INTEVAL_25FRAME 0x6
#define SSD1306_TIME_INTEVAL_64FRAME 0x1
#define SSD1306_TIME_INTEVAL_128FRAME 0x2
#define SSD1306_TIME_INTEVAL_256FRAME 0x3
* return : hw_oled_set_horizontal_scroll result
* description : Config horizontal_scroll,but not active
******************************************************************************/
uint8_t hw_oled_set_horizontal_scroll(uint8_t direct,uint8_t start_page,uint8_t end_page,uint8_t interval)
{
if((direct != SSD1306_LEFT_H_SCROLL) && (direct != SSD1306_RIGHT_H_SCROLL))
{
return HW_ERR_OLED_INVALID_DIRECT;
}
if((start_page > SSD1306_MAX_PAGE) || (end_page > SSD1306_MAX_PAGE))
{
return HW_ERR_OLED_INVALID_PAGE;
}
if(interval > SSD1306_TIME_INTERVAL_MASK)
{
return HW_ERR_OLED_INVALID_INTERVAL;
}
hw_oled_scroll_deactive();
if(direct == SSD1306_RIGHT_H_SCROLL)
{
hw_oled_write_byte(oled_cmd_right_hor_scroll,OLED_CMD);
}
else
{
hw_oled_write_byte(oled_cmd_left_horl_scroll,OLED_CMD);
}
hw_oled_write_byte(0x00,OLED_CMD);
hw_oled_write_byte(start_page,OLED_CMD);
hw_oled_write_byte(interval,OLED_CMD);
hw_oled_write_byte(end_page,OLED_CMD);
hw_oled_write_byte(0x00,OLED_CMD);
hw_oled_write_byte(0xff,OLED_CMD);
return HW_ERR_OK;
}
10)设置垂直滚动
uint8_t hw_oled_set_vertical_scroll(uint8_t direct,uint8_t start_page,uint8_t end_page,uint8_t interval,uint8_t offset)
{
if((direct != SSD1306_LEFT_V_SCROLL) && (direct != SSD1306_LEFT_V_SCROLL))
{
return HW_ERR_OLED_INVALID_DIRECT;
}
if((start_page > SSD1306_MAX_PAGE) || (end_page > SSD1306_MAX_PAGE))
{
return HW_ERR_OLED_INVALID_PAGE;
}
if(interval > SSD1306_TIME_INTERVAL_MASK)
{
return HW_ERR_OLED_INVALID_INTERVAL;
}
if(offset >= SSD1306_MAX_RAW)
{
return HW_ERR_OLED_INVALID_OFFSET;
}
hw_oled_scroll_deactive();
if(direct == SSD1306_LEFT_V_SCROLL)
{
hw_oled_write_byte(oled_cmd_ver_left_horl_scroll,OLED_CMD);
}
else
{
hw_oled_write_byte(oled_cmd_ver_right_hor_scroll,OLED_CMD);
}
hw_oled_write_byte(0x00,OLED_CMD);
hw_oled_write_byte(start_page,OLED_CMD);
hw_oled_write_byte(interval,OLED_CMD);
hw_oled_write_byte(end_page,OLED_CMD);
hw_oled_write_byte(offset,OLED_CMD);
hw_oled_write_byte(0x00,OLED_CMD);
hw_oled_write_byte(0xff,OLED_CMD);
return HW_ERR_OK;
}
11)使能滚动
/******************************************************************************
* func name : hw_oled_scroll_active
* para : NULL
* return : hw_oled_scroll_active result
* description : active scroll
******************************************************************************/
uint8_t hw_oled_scroll_active(void)
{
hw_oled_write_byte(oled_cmd_start_scroll,OLED_CMD);
return HW_ERR_OK;
}
12)失能滚动
/******************************************************************************
* func name : hw_oled_scroll_deactive
* para : NULL
* return : hw_oled_scroll_deactive result
* description : deactive scroll
******************************************************************************/
uint8_t hw_oled_scroll_deactive(void)
{
hw_oled_write_byte(oled_cmd_stop_scroll,OLED_CMD);
return HW_ERR_OK;
}
13)ascii字库
/********************************** 8x6 lattice ************************************/
const uint8_t font8x6[][6] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,// sp
0x00, 0x00, 0x00, 0x2f, 0x00, 0x00,// !
0x00, 0x00, 0x07, 0x00, 0x07, 0x00,// "
0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14,// #
0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12,// $
0x00, 0x62, 0x64, 0x08, 0x13, 0x23,// %
0x00, 0x36, 0x49, 0x55, 0x22, 0x50,// &
0x00, 0x00, 0x05, 0x03, 0x00, 0x00,// '
0x00, 0x00, 0x1c, 0x22, 0x41, 0x00,// (
0x00, 0x00, 0x41, 0x22, 0x1c, 0x00,// )
0x00, 0x14, 0x08, 0x3E, 0x08, 0x14,// *
0x00, 0x08, 0x08, 0x3E, 0x08, 0x08,// +
0x00, 0x00, 0x00, 0xA0, 0x60, 0x00,// ,
0x00, 0x08, 0x08, 0x08, 0x08, 0x08,// -
0x00, 0x00, 0x60, 0x60, 0x00, 0x00,// .
0x00, 0x20, 0x10, 0x08, 0x04, 0x02,// /
0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0
0x00, 0x00, 0x42, 0x7F, 0x40, 0x00,// 1
0x00, 0x42, 0x61, 0x51, 0x49, 0x46,// 2
0x00, 0x21, 0x41, 0x45, 0x4B, 0x31,// 3
0x00, 0x18, 0x14, 0x12, 0x7F, 0x10,// 4
0x00, 0x27, 0x45, 0x45, 0x45, 0x39,// 5
0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6
0x00, 0x01, 0x71, 0x09, 0x05, 0x03,// 7
0x00, 0x36, 0x49, 0x49, 0x49, 0x36,// 8
0x00, 0x06, 0x49, 0x49, 0x29, 0x1E,// 9
0x00, 0x00, 0x36, 0x36, 0x00, 0x00,// :
0x00, 0x00, 0x56, 0x36, 0x00, 0x00,// ;
0x00, 0x08, 0x14, 0x22, 0x41, 0x00,// <
0x00, 0x14, 0x14, 0x14, 0x14, 0x14,// =
0x00, 0x00, 0x41, 0x22, 0x14, 0x08,// >
0x00, 0x02, 0x01, 0x51, 0x09, 0x06,// ?
0x00, 0x32, 0x49, 0x59, 0x51, 0x3E,// @
0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C,// A
0x00, 0x7F, 0x49, 0x49, 0x49, 0x36,// B
0x00, 0x3E, 0x41, 0x41, 0x41, 0x22,// C
0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C,// D
0x00, 0x7F, 0x49, 0x49, 0x49, 0x41,// E
0x00, 0x7F, 0x09, 0x09, 0x09, 0x01,// F
0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A,// G
0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F,// H
0x00, 0x00, 0x41, 0x7F, 0x41, 0x00,// I
0x00, 0x20, 0x40, 0x41, 0x3F, 0x01,// J
0x00, 0x7F, 0x08, 0x14, 0x22, 0x41,// K
0x00, 0x7F, 0x40, 0x40, 0x40, 0x40,// L
0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F,// M
0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F,// N
0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E,// O
0x00, 0x7F, 0x09, 0x09, 0x09, 0x06,// P
0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q
0x00, 0x7F, 0x09, 0x19, 0x29, 0x46,// R
0x00, 0x46, 0x49, 0x49, 0x49, 0x31,// S
0x00, 0x01, 0x01, 0x7F, 0x01, 0x01,// T
0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F,// U
0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F,// V
0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F,// W
0x00, 0x63, 0x14, 0x08, 0x14, 0x63,// X
0x00, 0x07, 0x08, 0x70, 0x08, 0x07,// Y
0x00, 0x61, 0x51, 0x49, 0x45, 0x43,// Z
0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,// [
0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55,// 55
0x00, 0x00, 0x41, 0x41, 0x7F, 0x00,// ]
0x00, 0x04, 0x02, 0x01, 0x02, 0x04,// ^
0x00, 0x40, 0x40, 0x40, 0x40, 0x40,// _
0x00, 0x00, 0x01, 0x02, 0x04, 0x00,// '
0x00, 0x20, 0x54, 0x54, 0x54, 0x78,// a
0x00, 0x7F, 0x48, 0x44, 0x44, 0x38,// b
0x00, 0x38, 0x44, 0x44, 0x44, 0x20,// c
0x00, 0x38, 0x44, 0x44, 0x48, 0x7F,// d
0x00, 0x38, 0x54, 0x54, 0x54, 0x18,// e
0x00, 0x08, 0x7E, 0x09, 0x01, 0x02,// f
0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,// g
0x00, 0x7F, 0x08, 0x04, 0x04, 0x78,// h
0x00, 0x00, 0x44, 0x7D, 0x40, 0x00,// i
0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,// j
0x00, 0x7F, 0x10, 0x28, 0x44, 0x00,// k
0x00, 0x00, 0x41, 0x7F, 0x40, 0x00,// l
0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,// m
0x00, 0x7C, 0x08, 0x04, 0x04, 0x78,// n
0x00, 0x38, 0x44, 0x44, 0x44, 0x38,// o
0x00, 0xFC, 0x24, 0x24, 0x24, 0x18,// p
0x00, 0x18, 0x24, 0x24, 0x18, 0xFC,// q
0x00, 0x7C, 0x08, 0x04, 0x04, 0x08,// r
0x00, 0x48, 0x54, 0x54, 0x54, 0x20,// s
0x00, 0x04, 0x3F, 0x44, 0x40, 0x20,// t
0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C,// u
0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C,// v
0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C,// w
0x00, 0x44, 0x28, 0x10, 0x28, 0x44,// x
0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C,// y
0x00, 0x44, 0x64, 0x54, 0x4C, 0x44,// z
0x14, 0x14, 0x14, 0x14, 0x14, 0x14,// horiz lines
};
/************************************ 16x8 lattice ************************************/
const uint8_t font16x8[]=
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,// 0
0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x30,0x00,0x00,0x00,//! 1
0x00,0x10,0x0C,0x06,0x10,0x0C,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//" 2
0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0x00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0x00,//# 3
0x00,0x70,0x88,0xFC,0x08,0x30,0x00,0x00,0x00,0x18,0x20,0xFF,0x21,0x1E,0x00,0x00,//$ 4
0xF0,0x08,0xF0,0x00,0xE0,0x18,0x00,0x00,0x00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0x00,//% 5
0x00,0xF0,0x08,0x88,0x70,0x00,0x00,0x00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10,//& 6
0x10,0x16,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//' 7
0x00,0x00,0x00,0xE0,0x18,0x04,0x02,0x00,0x00,0x00,0x00,0x07,0x18,0x20,0x40,0x00,//( 8
0x00,0x02,0x04,0x18,0xE0,0x00,0x00,0x00,0x00,0x40,0x20,0x18,0x07,0x00,0x00,0x00,//) 9
0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0x00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0x00,//* 10
0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0x00,//+ 11
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xB0,0x70,0x00,0x00,0x00,0x00,0x00,//, 12
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,//- 13
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,0x00,0x00,//. 14
0x00,0x00,0x00,0x00,0x80,0x60,0x18,0x04,0x00,0x60,0x18,0x06,0x01,0x00,0x00,0x00,/// 15
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x0F,0x10,0x20,0x20,0x10,0x0F,0x00,//0 16
0x00,0x10,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,// 1 17
0x00,0x70,0x08,0x08,0x08,0x88,0x70,0x00,0x00,0x30,0x28,0x24,0x22,0x21,0x30,0x00,// 2 18
0x00,0x30,0x08,0x88,0x88,0x48,0x30,0x00,0x00,0x18,0x20,0x20,0x20,0x11,0x0E,0x00,// 3 19
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x07,0x04,0x24,0x24,0x3F,0x24,0x00,// 4 20
0x00,0xF8,0x08,0x88,0x88,0x08,0x08,0x00,0x00,0x19,0x21,0x20,0x20,0x11,0x0E,0x00,//5 21
0x00,0xE0,0x10,0x88,0x88,0x18,0x00,0x00,0x00,0x0F,0x11,0x20,0x20,0x11,0x0E,0x00,//6 22
0x00,0x38,0x08,0x08,0xC8,0x38,0x08,0x00,0x00,0x00,0x00,0x3F,0x00,0x00,0x00,0x00,//7 23
0x00,0x70,0x88,0x08,0x08,0x88,0x70,0x00,0x00,0x1C,0x22,0x21,0x21,0x22,0x1C,0x00,//8 24
0x00,0xE0,0x10,0x08,0x08,0x10,0xE0,0x00,0x00,0x00,0x31,0x22,0x22,0x11,0x0F,0x00,//9 25
0x00,0x00,0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x30,0x00,0x00,0x00,//: 26
0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x60,0x00,0x00,0x00,0x00,//; 27
0x00,0x00,0x80,0x40,0x20,0x10,0x08,0x00,0x00,0x01,0x02,0x04,0x08,0x10,0x20,0x00,//< 28
0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00,//= 29
0x00,0x08,0x10,0x20,0x40,0x80,0x00,0x00,0x00,0x20,0x10,0x08,0x04,0x02,0x01,0x00,//> 30
0x00,0x70,0x48,0x08,0x08,0x08,0xF0,0x00,0x00,0x00,0x00,0x30,0x36,0x01,0x00,0x00,//? 31
0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0x00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0x00,//@ 32
0x00,0x00,0xC0,0x38,0xE0,0x00,0x00,0x00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20,//A 33
0x08,0xF8,0x88,0x88,0x88,0x70,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0x00,//B 34
0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0x00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0x00,//C 35
0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0x00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0x00,//D 36
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0x00,//E 37
0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0x00,0x20,0x3F,0x20,0x00,0x03,0x00,0x00,0x00,//F 38
0xC0,0x30,0x08,0x08,0x08,0x38,0x00,0x00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0x00,//G 39
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20,//H 40
0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//I 41
0x00,0x00,0x08,0x08,0xF8,0x08,0x08,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,0x00,//J 42
0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0x00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0x00,//K 43
0x08,0xF8,0x08,0x00,0x00,0x00,0x00,0x00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0x00,//L 44
0x08,0xF8,0xF8,0x00,0xF8,0xF8,0x08,0x00,0x20,0x3F,0x00,0x3F,0x00,0x3F,0x20,0x00,//M 45
0x08,0xF8,0x30,0xC0,0x00,0x08,0xF8,0x08,0x20,0x3F,0x20,0x00,0x07,0x18,0x3F,0x00,//N 46
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0x00,//O 47
0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0x00,0x20,0x3F,0x21,0x01,0x01,0x01,0x00,0x00,//P 48
0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0x00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0x00,//Q 49
0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0x00,0x20,0x3F,0x20,0x00,0x03,0x0C,0x30,0x20,//R 50
0x00,0x70,0x88,0x08,0x08,0x08,0x38,0x00,0x00,0x38,0x20,0x21,0x21,0x22,0x1C,0x00,//S 51
0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//T 52
0x08,0xF8,0x08,0x00,0x00,0x08,0xF8,0x08,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//U 53
0x08,0x78,0x88,0x00,0x00,0xC8,0x38,0x08,0x00,0x00,0x07,0x38,0x0E,0x01,0x00,0x00,//V 54
0xF8,0x08,0x00,0xF8,0x00,0x08,0xF8,0x00,0x03,0x3C,0x07,0x00,0x07,0x3C,0x03,0x00,//W 55
0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20,//X 56
0x08,0x38,0xC8,0x00,0xC8,0x38,0x08,0x00,0x00,0x00,0x20,0x3F,0x20,0x00,0x00,0x00,//Y 57
0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0x00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0x00,//Z 58
0x00,0x00,0x00,0xFE,0x02,0x02,0x02,0x00,0x00,0x00,0x00,0x7F,0x40,0x40,0x40,0x00,//[ 59
0x00,0x0C,0x30,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x06,0x38,0xC0,0x00,//\ 60
0x00,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,0x00,0x40,0x40,0x40,0x7F,0x00,0x00,0x00,//] 61
0x00,0x00,0x04,0x02,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//^ 62
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,//_ 63
0x00,0x02,0x02,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//` 64
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20,//a 65
0x08,0xF8,0x00,0x80,0x80,0x00,0x00,0x00,0x00,0x3F,0x11,0x20,0x20,0x11,0x0E,0x00,//b 66
0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0x0E,0x11,0x20,0x20,0x20,0x11,0x00,//c 67
0x00,0x00,0x00,0x80,0x80,0x88,0xF8,0x00,0x00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20,//d 68
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x22,0x22,0x22,0x22,0x13,0x00,//e 69
0x00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//f 70
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x6B,0x94,0x94,0x94,0x93,0x60,0x00,//g 71
0x08,0xF8,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//h 72
0x00,0x80,0x98,0x98,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//i 73
0x00,0x00,0x00,0x80,0x98,0x98,0x00,0x00,0x00,0xC0,0x80,0x80,0x80,0x7F,0x00,0x00,//j 74
0x08,0xF8,0x00,0x00,0x80,0x80,0x80,0x00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0x00,//k 75
0x00,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x00,0x20,0x20,0x3F,0x20,0x20,0x00,0x00,//l 76
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x20,0x3F,0x20,0x00,0x3F,0x20,0x00,0x3F,//m 77
0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x3F,0x21,0x00,0x00,0x20,0x3F,0x20,//n 78
0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x1F,0x20,0x20,0x20,0x20,0x1F,0x00,//o 79
0x80,0x80,0x00,0x80,0x80,0x00,0x00,0x00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0x00,//p 80
0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80,//q 81
0x80,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x20,0x20,0x3F,0x21,0x20,0x00,0x01,0x00,//r 82
0x00,0x00,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x33,0x24,0x24,0x24,0x24,0x19,0x00,//s 83
0x00,0x80,0x80,0xE0,0x80,0x80,0x00,0x00,0x00,0x00,0x00,0x1F,0x20,0x20,0x00,0x00,//t 84
0x80,0x80,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20,//u 85
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x00,0x01,0x0E,0x30,0x08,0x06,0x01,0x00,//v 86
0x80,0x80,0x00,0x80,0x00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0x00,//w 87
0x00,0x80,0x80,0x00,0x80,0x80,0x80,0x00,0x00,0x20,0x31,0x2E,0x0E,0x31,0x20,0x00,//x 88
0x80,0x80,0x80,0x00,0x00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0x00,//y 89
0x00,0x80,0x80,0x80,0x80,0x80,0x80,0x00,0x00,0x21,0x30,0x2C,0x22,0x21,0x30,0x00,//z 90
0x00,0x00,0x00,0x00,0x80,0x7C,0x02,0x02,0x00,0x00,0x00,0x00,0x00,0x3F,0x40,0x40,//{ 91
0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,//| 92
0x00,0x02,0x02,0x7C,0x80,0x00,0x00,0x00,0x00,0x40,0x40,0x3F,0x00,0x00,0x00,0x00,//} 93
0x00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//~ 94
};