ssd1306_12864_hw_i2c_example.cpp 857 B

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