diff --git a/main/hello_world_main.c b/main/hello_world_main.c index 1512f14..177c423 100644 --- a/main/hello_world_main.c +++ b/main/hello_world_main.c @@ -158,16 +158,26 @@ void write_address(uint8_t addr){ gpio_set_level(GPIO_E, (addr&0x10)>>4); } +uint8_t check_chr_width(uint8_t chr[]){ + for(int i=6;i>=0;i--) + if(chr[i] != 0) + return i; + return 0; +} + void put_chr(uint8_t line, uint8_t pos, uint8_t chr[]){ for(int i=0;i<8;i++) - for(int j=0;j<7;j++) - fb[1+(line*10)+i][(pos*8)+j][0] = (chr[j]&(1<>i; + for(int j=0;j<7;j++){ + fb[1+(line*10)+i][(pos)+j][0] = (chr[j]&(1<>i; + } } void put_line(uint8_t line, char *str){ uint8_t pos = 0; + uint8_t disp_pos = 0; while(str[pos] != 0){ - put_chr(line, pos, font[str[pos]-0x20]); + put_chr(line, disp_pos, font[str[pos]-0x20]); + disp_pos += check_chr_width(font[str[pos]-0x20]) + 3; pos++; } }