| 1234567891011121314151617181920 |
- #include <rthw.h>
- #include <rtthread.h>
- #include <rtdevice.h>
- #include <U8g2lib.h>
- // Check https://github.com/olikraus/u8g2/wiki/u8g2setupcpp for all supported devices
- static U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
- static void u8g2_ssd1306_12864_hw_i2c_example(int argc,char *argv[])
- {
- u8g2.begin();
- u8g2.clearBuffer(); // clear the internal memory
- u8g2.setFont(u8g2_font_6x13_tr); // choose a suitable font
- u8g2.drawStr(1, 18, "U8g2 on RT-Thread"); // write something to the internal memory
- u8g2.sendBuffer(); // transfer internal memory to the display
- u8g2.setFont(u8g2_font_unifont_t_symbols);
- u8g2.drawGlyph(112, 56, 0x2603 );
- u8g2.sendBuffer();
- }
- MSH_CMD_EXPORT(u8g2_ssd1306_12864_hw_i2c_example, i2c ssd1306 sample);
|