C

Qt Quick Ultralite freertos_multitask Example

/****************************************************************************** ** ** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Quick Ultralite module. ** ** $QT_BEGIN_LICENSE:COMM$ ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see http://www.qt.io/terms-conditions. For further ** information use the contact form at http://www.qt.io/contact-us. ** ** $QT_END_LICENSE$ ** ******************************************************************************/
import QtQuick 2.15 Rectangle { id: root Image { id: background source: "images/background-dark.png" anchors.fill: root } Column { anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: 10 Text { anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter color: "white" text: "Speed: " + HardwareControl.fanSpeed font.pixelSize: 34 } Text { topPadding: 10 anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter color: "silver" text: "LED cycle count:" font.pixelSize: 17 } Text { anchors.horizontalCenter: parent.horizontalCenter horizontalAlignment: Text.AlignHCenter color: "white" text: HardwareControl.ledCycleCount font.pixelSize: 17 font.bold: true } } Text { horizontalAlignment: Text.AlignHCenter anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: parent.bottom anchors.bottomMargin: 10 color: "gray" text: "Tap to change fan and LED speed!" } Image { id: fan source: "images/fan-off.png" anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter transform: Rotation { origin.x: fan.width / 2 origin.y: fan.height / 2 RotationAnimation on angle { id: imageRotation loops: Animation.Infinite from: 0 to: 360 duration: 0 running: false } } } MouseArea { id: ta anchors.fill: parent onPressed: { HardwareControl.updateSpeed((HardwareControl.fanSpeed + 1) % 6); } } HardwareControl.onFanRotationPeriodChanged: { imageRotation.duration = rotationPeriod imageRotation.running = rotationPeriod > 0 } Component.onCompleted: { HardwareControl.updateSpeed(HardwareControl.fanSpeed) } }