Pages: [1]   Go Down
Author Topic: ProFont_ST7735: Improved text rendering for ST7735  (Read 1005 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ProFont_ST7735 is an extension to Adafruit_ST7735 which implements better text rendering support based on the ProFont font. ProFont is 6x12 bitmap font and includes all ANSI glyphs.

The main function ProFont_ST7735::drawString() takes UTF-8 strings as input.

Due to the fact that the underlying font bitmap is larger (3.5KB) than the available SRAM on the Arduino Uno (2KB) ProFont_ST7735 is implemented using a method to store user data in the .text section. This comes at the cost of overall code size. To store 1 byte of data you need to reserve 3-4 bytes in the .text section. Because of this ProFont_ST7735 consumes about 8KB of code. On the other hand the benefit is that it leaves the majority of SRAM open for other application data.

The avrdata2text ( tool allows to prepare arbitrary data so it can be stored in the .text section of your Arduino projects, the same way ProFont_ST7735 does. Very little SRAM is used to enable this. This is great for static data like sounds, logos etc.

Instructions for the use of avrdata2text:

1. Create a file with raw data you want to use in your Arduino project, for instance a file named mydata.raw.
2. Compile avrdata2text.cpp and run avrdata2text as such:

    > g++ avrdata2text.cpp -o avrdata2text
    > avrdata2text -o mydata.cpp -n GetMyData mydata.raw

3. Add the resulting mydata.cpp to your project and create a prototype to the access function in your main code:

    uint8_t GetMyData(uint16_t pos);

4. To access an arbitrary byte of your data call the GetMyData function where pos is the byte position. Example:

    for ( int32_t pos=0; pos<256; pos++ ) {

I hope you find this useful!


* ProFont_ST7735.jpg (140.35 KB, 512x593 - viewed 108 times.)

Pages: [1]   Go Up
Jump to: