CC2530使用OLED实现自动换行垂直滚动显示

本文介绍了一种在CC2350实验平台上,使用SSD1306驱动芯片的128*64 OLED屏幕上重定向printf的方法。通过设置显示偏移量和清空移动后的行,实现了类似Windows命令行窗口的自动换行和内容上移功能。文章详细解释了偏移量的计算和代码实现。

实验平台:CC2350
屏幕参数:128*64
驱动芯片: SSD1306

使用OLED时,想要重定向printf输出到OLED屏幕上,并实现横向128列输出完毕后或者遇到 ‘\n’ 时自动换行显示,并且将已输入内容向上移动一行,类似win的命令行窗口。实现的主要思路为SSD1306的设置显示偏移量( Set Display Offset (D3h) )

Set Display Offset (D3h)
This is a double byte command. The second command specifies the mapping of the display start line to one of COM0~COM63 (assuming that COM0 is the display start line then the display start line register is equal to 0).
For example, to move the COM16 towards the COM0 direction by 16 lines the 6-bit data in the second byte should be given as 010000b. To move in the opposite direction by 16 lines the 6-bit data should be given by 64 – 16, so the second byte would be 100000b. The following two tables (Table 10-1, Table 10-2) show the example of setting the command C0h/C8h and D3h.

评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值