Commit a8ff8f05 authored by devsaurus's avatar devsaurus
Browse files

Add u8g2 module.

parent 329bd73b
......@@ -47,6 +47,8 @@ pages:
- 'spi': 'en/modules/spi.md'
- 'struct': 'en/modules/struct.md'
- 'tmr': 'en/modules/tmr.md'
- 'u8g2': 'en/modules/u8g2.md'
- 'u8g2 Display': 'en/modules/u8g2_disp.md'
- 'uart': 'en/modules/uart.md'
- 'wifi': 'en/modules/wifi.md'
- 'ws2812': 'en/modules/ws2812.md'
......
#!/usr/bin/perl -w
my (@i2c_displays, @spi_displays);
# scan provided header file for CONFIG_U8G2_I2C and CONFIG_U8G2_SPI entries
while (<STDIN>) {
if (/^\s*#\s*define\s+CONFIG_U8G2_I2C_([^_]+)_(\S+)\s+1/) {
push(@i2c_displays, lc($1)."_i2c_".lc($2));
}
if (/^\s*#\s*define\s+CONFIG_U8G2_SPI_(\S+)\s+1/) {
push(@spi_displays, lc($1));
}
}
if (@i2c_displays > 0 || @spi_displays > 0) {
print << 'HEADER';
#ifndef _U8G2_DISPLAYS_H
#define _U8G2_DISPLAYS_H
#define U8G2_DISPLAY_TABLE_ENTRY(function, binding)
HEADER
print("#define U8G2_DISPLAY_TABLE_I2C \\\n");
foreach my $display (@i2c_displays) {
print(" U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_${display}_f, $display) \\\n");
}
print("\n");
print("#define U8G2_DISPLAY_TABLE_SPI \\\n");
foreach my $display (@spi_displays) {
print(" U8G2_DISPLAY_TABLE_ENTRY(u8g2_Setup_${display}_f, $display) \\\n");
}
print("\n");
print << 'FOOTER';
#endif /* _U8G2_DISPLAYS_H */
FOOTER
}
#!/usr/bin/perl -w
my @font_selection;
# scan provided header file for CONFIG_U8G2_FONT_SELECTION entry
while (<STDIN>) {
if (/^\s*#\s*define\s+CONFIG_U8G2_FONT_SELECTION\s+"([^"]+)"/) {
@font_selection = split(/,/, $1);
last;
}
}
if (@font_selection > 0) {
print << 'HEADER';
#ifndef _U8G2_FONTS_H
#define _U8G2_FONTS_H
#define U8G2_FONT_TABLE_ENTRY(font)
#define U8G2_FONT_TABLE \
HEADER
foreach my $font (@font_selection) {
print(" U8G2_FONT_TABLE_ENTRY($font) \\\n");
}
print << 'FOOTER';
#endif /* _U8G2_FONTS_H */
FOOTER
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment