Qt DeviceTestT113

本文记录了Linux在全志T113-S3/S4平台上的移植过程,介绍了盈鹏飞嵌入式SBC-T113S主板特性,还包含命令行测试硬件、wifi,以及Qt DeviceTest说明、工程文件pro内容,还有串口、喇叭、触摸等功能的代码实现。

本系列调试说明记录了Linux在全志T113-S3/S4平台上的移植过程,说明过程中可能会技术瑕疵,希望大家提供宝贵意见。
本文移植的硬件平台来自于盈鹏飞嵌入式的SBC-T113S(处理器是T113-S3)主板。

SBC-T113S产品特性:

  • 采用Allwinner公司Cortex-A7双核T113-S3/S4处理器,运行最高速度为1.2GHZ;
  • 内置64-bit XuanTie C906 RISC-V协处理器(仅T113-S4支持);
  • 支持JPEG/MJPEG视频编码,最大分辨率1080p@60fps;支持多格式1080P@60fps视频解码 (H.265,H.264, MPEG-1/2/4);
  • 支持RGB666/LVDS/MIPI-DSI,分辨率最高1920x1080;
  • 支持128-256M Bytes DDR3 SDRAM,其中T113-S3内置128MB;T113-S4内置256MB;
  • 支持SPI NAND存储和启动(默认:256MB;最大1GB)或者EMMC启动(默认:4GB,最大32GB);
  • 支持一路USB2.0 OTG(设计为TYPE-A接口);支持二路USB2.0 HOST;
  • 支持七路RS232通信或者6路RS232和1路RS485(隔离);
  • 支持一路CAN BUS通信(隔离);
  • 支持一路10/100M以太网;
  • 稳定的操作系统的支持,可预装LINUX 5.4或者OpenWRT;
  • 经典尺寸主板,尺寸为120*100MM; 

产品功能评估图:

产品尺寸:

以下为Qt DeviceTestT113说明:

命令行测试硬件

sh-4.4# ls -al rp_test/

total 55668

drwxrwxr-x    3 root     root          4096 Jan  1 00:16 .

drwxr-xr-x   22 root     root          4096 Jan  1 00:00 ..

-rwxrwxr-x    1 root     root          5212 Nov  3  2023 comtest

drwxrwxr-x    2 root     root          4096 Nov  3  2023 input

-rwxrwxrwx    1 root     root      46329002 Oct 20  2023 test.wav

-rwxrwxrwx    1 root     root      10557420 Oct 20  2023 test48000.wav

-rwxrwxr-x    1 root     root           357 Nov  3  2023 test_4G.sh

-rwxrwxr-x    1 root     root            46 Nov  3  2023 test_audio.sh

-rwxrwxr-x    1 root     root            96 Nov  3  2023 test_bt.sh

-rwxrwxr-x    1 root     root           606 Nov  3  2023 test_can.sh

-rwxrwxr-x    1 root     root            99 Nov  3  2023 test_ethernet.sh

-rwxrwxr-x    1 root     root            33 Nov  3  2023 test_uart.sh

-rwxrwxr-x    1 root     root           189 Nov  3  2023 test_watchdog.sh

-rwxrwxr-x    1 root     root           530 Nov  3  2023 test_wifi.sh

-rwxrwxr-x    1 root     root           311 Nov  3  2023 test_wifi_ap.sh

-rwxrwxr-x    1 root     root          2407 Nov  3  2023 watchdogd.cpp

-rwxrwxr-x    1 root     root          3928 Nov  3  2023 watchdogd.out

命令行测试wifi

1. iw dev wlan0 scan | grep SSID

2. wpa_passphrase kefu xintian888 >> /etc/wpa_supplicant.conf

3. wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf

4. iw wlan0 link

test_wifi.sh

sh-4.4# cat rp_test/test_wifi.sh

#!/bin/sh

read -p "Enter your wifi-ssid, please: " WIFISSID

read -p "Enter your wifi-pwd, please: " WIFIPWD

#WIFISSID=$1

#WIFIPWD=$2

CONF=/tmp/wpa_supplicant.conf

cp /etc/wpa_supplicant.conf /tmp/

echo "connect to WiFi ssid: $WIFISSID, Passwd: $WIFIPWD"

#sed -i "s/SSID/$WIFISSID/g" $CONF

#sed -i "s/PASSWORD/$WIFIPWD/g" $CONF

wpa_passphrase $WIFISSID $WIFIPWD > $CONF

killall wpa_supplicant

sleep 1

wpa_supplicant -B -i wlan0 -c $CONF

# auto get ipaddress

udhcpc -i wlan0

ifconfig wlan0

ping -I wlan0 -c 4 www.rpdzkj.com

DeviceTest

t113_linux/platform/framework/auto/qt_demo/DeviceTest$ tree -L 1

.

├── 4G

├── adc

├── bluetooth

├── camera

├── common

├── device

├── DeviceTest.pro

├── DeviceTest.pro.user

├── ethernet

├── led

├── main.cpp

├── mainUI

├── makeDeviceTest

├── pwm

├── qrc_res.cpp

├── res

├── res.qrc

├── rgb

├── rtc

├── sound

├── test.test

├── tfcard

├── touch

├── uart

├── usb

└── wifi

工程文件pro

QT       += core gui serialport network multimedia multimediawidgets

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the # deprecated API in order to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 

SOURCES += \

    4G/mobilenet.cpp \

    4G/mobilenetthread.cpp \

    adc/adckey.cpp \

    adc/adcthread.cpp \

    bluetooth/bluetooth.cpp \

    bluetooth/bluetooththread.cpp \

    camera/camera.cpp \

    camera/thread/camerathread1.cpp \

    camera/thread/camerathread2.cpp \

    camera/v4l2/v4l2.c \

    common/common.cpp \

    device/deviceinfo.cpp \

    device/devicethread.cpp \

    ethernet/ethernet.cpp \

    ethernet/ethnetautotest.cpp \

    ethernet/eththread.cpp \

    led/led.cpp \

    main.cpp \

    mainUI/mainwindow.cpp \

    pwm/pwm.cpp \

    pwm/pwmthread.cpp \

    rgb/lcdrgb.cpp \

    rtc/rtc.cpp \

    rtc/rtcthread.cpp \

    sound/playtimethread.cpp \

    sound/recortTimeThread.cpp \

    sound/sound.cpp \

    tfcard/tfcard.cpp \

    tfcard/tfcardthread.cpp \

    touch/touch.cpp \

    uart/uart.cpp \

    usb/usbdevices.cpp \

    usb/usbthread.cpp \

    wifi/connectthread.cpp \

    wifi/wifi.cpp \

    wifi/wifithread.cpp

HEADERS += \

    4G/mobilenet.h \

    4G/mobilenetthread.h \

    adc/adckey.h \

    adc/adcthread.h \

    bluetooth/bluetooth.h \

    bluetooth/bluetooththread.h \

    camera/camera.h \

    camera/thread/camerathread1.h \

    camera/thread/camerathread2.h \

    camera/v4l2/config.h \

    camera/v4l2/v4l2.h \

    common/common.h \

    device/deviceinfo.h \

    device/devicethread.h \

    ethernet/ethernet.h \

    ethernet/ethnetautotest.h \

    ethernet/eththread.h \

    led/led.h \

    mainUI/mainwindow.h \

    pwm/pwm.h \

    pwm/pwmthread.h \

    rgb/lcdrgb.h \

    rtc/rtc.h \

    rtc/rtcthread.h \

    sound/playtimethread.h \

    sound/recortTimeThread.h \

    sound/sound.h \

    tfcard/tfcard.h \

    tfcard/tfcardthread.h \

    touch/touch.h \

    uart/uart.h \

    usb/usbdevices.h \

    usb/usbthread.h \

    wifi/connectthread.h \

    wifi/wifi.h \

    wifi/wifithread.h

# Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin

else: unix:!android: target.path = /opt/$${TARGET}/bin

!isEmpty(target.path): INSTALLS += target

RESOURCES += \

    res.qrc

main.cpp

#include "mainUI/mainwindow.h" 

#include <QApplication> 

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

{

    QApplication a(argc, argv);

    MainWindow w;

    w.show();

    return a.exec();

}

main_window.cpp

#include "mainwindow.h" #include "rtc/rtc.h" #include "uart/uart.h" #include "device/deviceinfo.h" #include "touch/touch.h" #include "adc/adckey.h" #include "pwm/pwm.h" #include "ethernet/ethernet.h" #include "wifi/wifi.h" #include "bluetooth/bluetooth.h" #include "camera/camera.h" #include "led/led.h" #include "sound/sound.h" #include "4G/mobilenet.h" #include "tfcard/tfcard.h" #include "rgb/lcdrgb.h" #include "usb/usbdevices.h" 

MainWindow::MainWindow(QWidget *parent)

    : QMainWindow(parent)

{

    QScreen *screen = QGuiApplication::primaryScreen();

    windSize = screen->virtualGeometry();

    //default full screen

    resize(windSize.width(), windSize.height());

    this->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool | Qt::WindowStaysOnTopHint); // 去掉标题栏,去掉任务栏显示,窗口置顶

    this->initWindow();

}

void MainWindow::initWindow()

{

    QGridLayout *mainLayout = new QGridLayout;

    widget = new QWidget();

    QSettings  *setting = new QSettings(CONFIG_FILE_PATH,QSettings::IniFormat);

    setting->setIniCodec("UTF-8");

    QStringList groups = setting->childGroups();

    int row = 1;

    int index = 0;

    for(int i = 0;i < groups.length(); i++){

        QString enable = setting->value("/"+groups.at(i)+"/enable").toString();

        QString name = setting->value("/"+groups.at(i)+"/name").toString();

        QString state = setting->value("/"+groups.at(i)+"/state").toString();

        if(enable == "1"){

            QPushButton *funBtn = common.getButton(name);

            funBtn->setStyleSheet(funBtn->styleSheet()+"QPushButton{width:200;height:40}");

            if(state == "1")

                funBtn->setStyleSheet(funBtn->styleSheet()+"QPushButton{border-image:url(:/icon/pass.png)}");

            if(state == "0")

                funBtn->setStyleSheet(funBtn->styleSheet()+"QPushButton{border-image:url(:/icon/faild.png)}");

            connect(funBtn, &QPushButton::clicked, [=] { handleClick(funBtn->text()); });

            if(index % 2 == 0){

                mainLayout->addWidget(funBtn, row, 1, Qt::AlignRight);

            }else{

                mainLayout->addWidget(funBtn, row, 2, Qt::AlignLeft);

                row++;

            }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值