LinkLib例子之十一:Hi3531D 点阵双色OLED屏显示

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/weixin_45326556/article/details/94164074

Hi3531D 点阵双色OLED屏显示

OLED

该示例程序展示了如何利用LinkUI框架进行便捷的OLED界面开发,需要购买指定的OLED配件。

其中展示了文字修改、中文显示、图片显示、刷新等功能。

准备工作

•连接OLED模块,插入评估板的J10位置,线序如下,点击图片放大

在这里插入图片描述
•参照用户手册搭建开发环境、编译3531D工程、配置网络启动参数。

其中启动参数变更为带有oled功能的参数,形式如下:

setenv serverip 192.168.1.92;setenv ipaddr 192.168.1.206;setenv gatewayip 192.168.1.1;setenv netmask 255.255.252.0
setenv bootcmd 'mw.b 42000000 ff 100000;tftp 42000000 linkpiV.bin;i2c reset;i2c oled_init;i2c oled_show 0x42000000;mw.b 42000000 ff 400000;tftp 42000000 uImage_3531D;bootm 0x42000000'
setenv bootargs 'mem=512M console=ttyAMA0,115200 root=/dev/nfs rw nfsroot=192.168.1.92:/home/linkpi/work/3531D/fs ip=192.168.1.206 init=/linuxrc mtdparts=hinand:1M(boot),4M(kernel),250M(rootfs)'

•上电,应该看到如下启动画面
在这里插入图片描述
•进入/root/demo目录,运行OLED程序

运行结果

在这里插入图片描述

源程序

完整工程:https://gitee.com/LinkPi/3531D/tree/master/OLED

//main.cpp
#include "Widget.h"
#include <QApplication>
#include <QDebug>
#include <LinkUI.h>

int main(int argc, char *argv[])
{

    Link::init();
    LinkObject *vo=Link::create("OutputVo");
    QVariantMap dataVo;
    dataVo["type"]="hdmi";
    vo->start(dataVo);
    QApplication a(argc, argv);
    Widget w;
    LinkUI::initOLED(&w);
    w.setText("192.168.1.212");
    LinkUI::refreshOLED();
    return a.exec();
}

 
//Widget.cpp
#include "Widget.h"
#include "ui_Widget.h"
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::setText(QString str)
{
    ui->label_IP->setText(str);
}

猜你喜欢

转载自blog.csdn.net/weixin_45326556/article/details/94164074
今日推荐