allow definition of font and display tables in an external file

This commit is contained in:
devsaurus 2018-01-04 22:25:56 +01:00
parent 5f3e210f98
commit eba5d57db7
3 changed files with 41 additions and 1 deletions

View File

@ -10,7 +10,9 @@
// Uncomment the U8G2_DISPLAY_TABLE_ENTRY for the device(s) you want to
// compile into the firmware.
// Stick to the assignments to *_I2C and *_SPI tables.
//
#ifndef U8G2_DISPLAY_TABLE_I2C_EXTRA
// I2C based displays go into here:
// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1610_i2c_ea_dogxl160_f, uc1610_i2c_ea_dogxl160) \
// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1325_i2c_nhd_128x64_f, ssd1325_i2c_nhd_128x64) \
@ -38,6 +40,17 @@
#define U8G2_DISPLAY_TABLE_I2C \
U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_i2c_128x64_noname_f, ssd1306_i2c_128x64_noname) \
#else
// I2C displays can be defined in an external file.
#define U8G2_DISPLAY_TABLE_I2C \
U8G2_DISPLAY_TABLE_I2C_EXTRA
#endif
#ifndef U8G2_DISPLAY_TABLE_SPI_EXTRA
// SPI based displays go into here:
// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1606_172x72_f, ssd1606_172x72) \
// U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_uc1608_240x128_f, uc1608_240x128) \
@ -93,6 +106,14 @@
#define U8G2_DISPLAY_TABLE_SPI \
U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_ssd1306_128x64_noname_f, ssd1306_128x64_noname) \
#else
// SPI displays can be defined in an external file.
#define U8G2_DISPLAY_TABLE_SPI \
U8G2_DISPLAY_TABLE_SPI_EXTRA
#endif
//
// ***************************************************************************

View File

@ -7,11 +7,20 @@
// ***************************************************************************
// Configure U8glib fonts
//
#ifndef U8G2_FONT_TABLE_EXTRA
//
// Add a U8G2_FONT_TABLE_ENTRY for each font you want to compile into the image
#define U8G2_FONT_TABLE \
U8G2_FONT_TABLE_ENTRY(font_6x10_tf) \
U8G2_FONT_TABLE_ENTRY(font_unifont_t_symbols) \
#else
//
// The font table can be defined in an external file.
#define U8G2_FONT_TABLE \
U8G2_FONT_TABLE_EXTRA
#endif
// ***************************************************************************

View File

@ -80,6 +80,11 @@ Add the desired entries to the I²C or SPI display tables in [app/include/u8g2_d
U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_pcf8812_96x65_f, pcf8812_96x65) \
```
Alternatively, you can define them as `U8G2_DISPLAY_TABLE_I2C_EXTRA` and `U8G2_DISPLAY_TABLE_SPI_EXTRA` in an external file to avoid changing the source tree. Include the extra file on the `make` command line:
```
make EXTRA_CCFLAGS='-include $(TOP_DIR)/my_extras.h'
```
#### ESP32
Enable the desired entries for I²C and SPI displays in u8g2's sub-menu (run `make menuconfig`).
@ -96,6 +101,11 @@ Add the desired fonts to the font table in [app/include/u8g2_fonts.h](../../../a
U8G2_FONT_TABLE_ENTRY(font_unifont_t_symbols) \
```
Alternatively, you can define this as `U8G2_FONT_TABLE_EXTRA` in an external file to avoid changing the source tree. Include the extra file on the `make` command line:
```
make EXTRA_CCFLAGS='-include $(TOP_DIR)/my_extras.h'
```
#### ESP32
Add the desired fonts to the font selection sub-entry via `make menuconfig`.