-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Wu Han
committed
Apr 21, 2019
1 parent
9cb076d
commit 5ea7a59
Showing
17 changed files
with
14,266 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,3 +50,4 @@ modules.order | |
Module.symvers | ||
Mkfile.old | ||
dkms.conf | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <rthw.h> | ||
#include <rtthread.h> | ||
#include <rtdevice.h> | ||
#include <U8g2lib.h> | ||
|
||
// You may reference Drivers/drv_gpio.c for pinout | ||
// In u8x8.h #define U8X8_USE_PINS | ||
|
||
#define OLED_SPI_PIN_RES 16 // PA2 | ||
#define OLED_SPI_PIN_DC 15 // PA1 | ||
#define OLED_SPI_PIN_CS 14 // PA0 | ||
|
||
// Check https://github.com/olikraus/u8g2/wiki/u8g2setupcpp for all supported devices | ||
static U8G2_SSD1306_128X64_ALT0_F_4W_HW_SPI u8g2(U8G2_R0, | ||
/* cs=*/ OLED_SPI_PIN_CS, | ||
/* dc=*/ OLED_SPI_PIN_DC, | ||
/* reset=*/ OLED_SPI_PIN_RES); | ||
// same as the NONAME variant, but may solve the "every 2nd line skipped" problem | ||
|
||
static void ssd1306_12864_4wire_hw_spi_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(ssd1306_12864_4wire_hw_spi_example, sw 4wire spi ssd1306 sample); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#include <rthw.h> | ||
#include <rtthread.h> | ||
#include <rtdevice.h> | ||
#include <U8g2lib.h> | ||
|
||
// You may reference Drivers/drv_gpio.c for pinout | ||
// In u8x8.h #define U8X8_USE_PINS | ||
|
||
#define OLED_SPI_PIN_CLK 21 // PA5 | ||
#define OLED_SPI_PIN_MOSI 23 // PA7 | ||
#define OLED_SPI_PIN_RES 16 // PA2 | ||
#define OLED_SPI_PIN_DC 15 // PA1 | ||
#define OLED_SPI_PIN_CS 14 // PA0 | ||
|
||
// Check https://github.com/olikraus/u8g2/wiki/u8g2setupcpp for all supported devices | ||
static U8G2_SSD1306_128X64_NONAME_F_4W_SW_SPI u8g2(U8G2_R0, | ||
/* clock=*/ OLED_SPI_PIN_CLK, | ||
/* data=*/ OLED_SPI_PIN_MOSI, | ||
/* cs=*/ OLED_SPI_PIN_CS, | ||
/* dc=*/ OLED_SPI_PIN_DC, | ||
/* reset=*/ OLED_SPI_PIN_RES); | ||
|
||
static void ssd1306_12864_4wire_sw_spi_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(ssd1306_12864_4wire_sw_spi_example, sw 4wire spi ssd1306 sample); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#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 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(ssd1306_12864_hw_i2c_example, i2c ssd1306 sample); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <rthw.h> | ||
#include <rtthread.h> | ||
#include <rtdevice.h> | ||
#include <U8g2lib.h> | ||
|
||
// You may reference Drivers/drv_gpio.c for pinout | ||
// In u8x8.h #define U8X8_USE_PINS | ||
#define OLED_I2C_PIN_SCL 58 // PB6 | ||
#define OLED_I2C_PIN_SDA 59 // PB7 | ||
|
||
// Check https://github.com/olikraus/u8g2/wiki/u8g2setupcpp for all supported devices | ||
static U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, | ||
/* clock=*/ OLED_I2C_PIN_SCL, | ||
/* data=*/ OLED_I2C_PIN_SDA, | ||
/* reset=*/ U8X8_PIN_NONE); | ||
// All Boards without Reset of the Display | ||
|
||
static void ssd1306_12864_sw_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(ssd1306_12864_sw_i2c_example, i2c ssd1306 software i2c sample); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include <rthw.h> | ||
#include <rtthread.h> | ||
#include <rtdevice.h> | ||
#include <U8g2lib.h> | ||
|
||
// You may reference Drivers/drv_gpio.c for pinout | ||
// In u8x8.h #define U8X8_USE_PINS | ||
|
||
#define ST7920_8080_PIN_D0 36 // PB15 | ||
#define ST7920_8080_PIN_D1 35 // PB14 | ||
#define ST7920_8080_PIN_D2 34 // PB13 | ||
#define ST7920_8080_PIN_D3 33 // PB12 | ||
#define ST7920_8080_PIN_D4 37 // PC6 | ||
#define ST7920_8080_PIN_D5 38 // PC7 | ||
#define ST7920_8080_PIN_D6 39 // PC8 | ||
#define ST7920_8080_PIN_D7 40 // PC9 | ||
#define ST7920_8080_PIN_EN 50 // PA15 | ||
#define ST7920_8080_PIN_CS U8X8_PIN_NONE | ||
#define ST7920_8080_PIN_DC 44 // PA11 | ||
#define ST7920_8080_PIN_RST 45 // PA12 | ||
|
||
// Check https://github.com/olikraus/u8g2/wiki/u8g2setupcpp for all supported devices | ||
static U8G2_ST7920_128X64_F_8080 u8g2(U8G2_R0, | ||
ST7920_8080_PIN_D0, | ||
ST7920_8080_PIN_D1, | ||
ST7920_8080_PIN_D2, | ||
ST7920_8080_PIN_D3, | ||
ST7920_8080_PIN_D4, | ||
ST7920_8080_PIN_D5, | ||
ST7920_8080_PIN_D6, | ||
ST7920_8080_PIN_D7, | ||
/*enable=*/ ST7920_8080_PIN_EN, | ||
/*cs=*/ ST7920_8080_PIN_CS, | ||
/*dc=*/ ST7920_8080_PIN_DC, | ||
/*reset=*/ ST7920_8080_PIN_RST); | ||
|
||
static void st7920_12864_8080_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(st7920_12864_8080_example, st7920 12864 LCD sample); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.