#申请原创# 【目的】利用rt-thread来驱动OLED
rt-thread的在线包,提供了ssd1306的驱动程以及常见画点画线的的基本能力。
1、进入rt-thread-master\bsp\apm32\apm32f107vc-evalboard目录,打开env使能ssd1306如下图。
2、使能I2c,SCL\SDA分别为PB6、PB7
3、保存后生成mdk:
- $ scons --target=mdk5
- scons: Reading SConscript files ...
- Keil5 project is generating...
- Keil Version: 0.0
- Keil-MDK project has generated successfully!
4、打开工程后编译下载,接好OLED屏,打开串口综端。执行ssd1306_TestAll
- \ | /
- - RT - Thread Operating System
- / | \ 5.0.0 build Mar 11 2023 10:07:26
- 2006 - 2022 Copyright by RT-Thread team
- System Clock: 72000000
- msh >list_device
- list_device: command not found.
- msh >
- RT-Thread shell commands:
- pin - pin [option]
- reboot - Reboot System
- help - RT-Thread shell help.
- ps - List threads in the system.
- free - Show the memory usage in the system.
- clear - clear the terminal screen
- version - show RT-Thread version information
- list - list objects
- ssd1306_TestAll - test ssd1306 oled driver
- msh >lsit device
- lsit: command not found.
- msh >list device
- device type ref count
- -------- -------------------- ----------
- i2c1 I2C Bus 0
- uart1 Character Device 2
- pin Pin Device 0
- msh >ssd
- ssd1306_TestAll
- msh >ssd
效果如下:
【小结】极海H32F107VC可以通过RT-Threa快速驱动OLED屏。
|